Changeset 7ee3c87 for libcfa/src
- Timestamp:
- Apr 2, 2021, 12:23:21 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- c7625e0
- Parents:
- 7a2972b9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/containers/list.hfa
r7a2972b9 r7ee3c87 83 83 (this.is_terminator){ 1 }; 84 84 } 85 forall ( tInit | { void ?{}( $mgd_link(tE) &, tInit); } ) 86 static inline void ?=?( $mgd_link(tE) &this, tInit i ) { 87 ^?{}( this ); 88 ?{}( this, i ); 85 static inline void ?=?( $mgd_link(tE) &this, tE* elem ) { 86 this.elem = elem ; 87 this.terminator = 0p; 88 this.is_terminator = 0; 89 } 90 static inline void ?=?( $mgd_link(tE) &this, void * terminator ) { 91 this.elem = 0p; 92 this.terminator = terminator; 93 this.is_terminator = 1; 89 94 } 90 95 struct $dlinks { … … 181 186 182 187 static inline void insert_after(Tnode &list_pos, Telem &to_insert) { 183 assert(&list_pos != 0p);184 assert(&to_insert != 0p);188 verify (&list_pos != 0p); 189 verify (&to_insert != 0p); 185 190 Tnode &singleton_to_insert = $tempcv_e2n(to_insert); 186 assert($prev_link(singleton_to_insert).elem == 0p);187 assert($next_link(singleton_to_insert).elem == 0p);191 verify($prev_link(singleton_to_insert).elem == 0p); 192 verify($next_link(singleton_to_insert).elem == 0p); 188 193 $prev_link(singleton_to_insert) = & $tempcv_n2e(list_pos); 189 194 $next_link(singleton_to_insert) = $next_link(list_pos); … … 204 209 205 210 static inline void insert_before(Tnode &list_pos, Telem &to_insert) { 206 assert(&list_pos != 0p);207 assert(&to_insert != 0p);211 verify (&list_pos != 0p); 212 verify (&to_insert != 0p); 208 213 Tnode &singleton_to_insert = $tempcv_e2n(to_insert); 209 assert($prev_link(singleton_to_insert).elem == 0p);210 assert($next_link(singleton_to_insert).elem == 0p);214 verify($prev_link(singleton_to_insert).elem == 0p); 215 verify($next_link(singleton_to_insert).elem == 0p); 211 216 $next_link(singleton_to_insert) = & $tempcv_n2e(list_pos); 212 217 $prev_link(singleton_to_insert) = $prev_link(list_pos); … … 227 232 228 233 static inline void insert_first(dlist(Tnode, Telem) &list, Telem &to_insert) { 229 assert(&list != 0p);230 assert(&to_insert != 0p);234 verify (&list != 0p); 235 verify (&to_insert != 0p); 231 236 Tnode &singleton_to_insert = $tempcv_e2n(to_insert); 232 assert($prev_link(singleton_to_insert).elem == 0p);233 assert($next_link(singleton_to_insert).elem == 0p);237 verify($prev_link(singleton_to_insert).elem == 0p); 238 verify($next_link(singleton_to_insert).elem == 0p); 234 239 235 240 $prev_link(singleton_to_insert) = (void*) &list; … … 249 254 250 255 static inline void insert_last(dlist(Tnode, Telem) &list, Telem &to_insert) { 251 assert(&list != 0p);252 assert(&to_insert != 0p);256 verify (&list != 0p); 257 verify (&to_insert != 0p); 253 258 Tnode &singleton_to_insert = $tempcv_e2n(to_insert); 254 assert($next_link(singleton_to_insert).elem == 0p);255 assert($prev_link(singleton_to_insert).elem == 0p);259 verify($next_link(singleton_to_insert).elem == 0p); 260 verify($prev_link(singleton_to_insert).elem == 0p); 256 261 257 262 $next_link(singleton_to_insert) = (void*) &list; … … 271 276 272 277 static inline void remove(Tnode &list_pos) { 273 assert( &list_pos != 0p );278 verify( &list_pos != 0p ); 274 279 275 280 $mgd_link(Telem) &incoming_from_prev = *0p; … … 308 313 309 314 static inline bool ?`is_empty(dlist(Tnode, Telem) &list) { 310 assert( &list != 0p );315 verify( &list != 0p ); 311 316 $dlinks(Telem) *listLinks = & list.$links; 312 317 if (listLinks->next.is_terminator) { 313 assert(listLinks->prev.is_terminator);314 assert(listLinks->next.terminator);315 assert(listLinks->prev.terminator);318 verify(listLinks->prev.is_terminator); 319 verify(listLinks->next.terminator); 320 verify(listLinks->prev.terminator); 316 321 return true; 317 322 } else { 318 assert(!listLinks->prev.is_terminator);319 assert(listLinks->next.elem);320 assert(listLinks->prev.elem);323 verify(!listLinks->prev.is_terminator); 324 verify(listLinks->next.elem); 325 verify(listLinks->prev.elem); 321 326 return false; 322 327 } … … 324 329 325 330 static inline Telem & pop_first(dlist(Tnode, Telem) &list) { 326 assert( &list != 0p );327 assert( !list`is_empty );331 verify( &list != 0p ); 332 verify( !list`is_empty ); 328 333 $dlinks(Telem) *listLinks = & list.$links; 329 334 Telem & first = *listLinks->next.elem; … … 334 339 335 340 static inline Telem & pop_last(dlist(Tnode, Telem) &list) { 336 assert( &list != 0p );337 assert( !list`is_empty );341 verify( &list != 0p ); 342 verify( !list`is_empty ); 338 343 $dlinks(Telem) *listLinks = & list.$links; 339 344 Telem & last = *listLinks->prev.elem;
Note: See TracChangeset
for help on using the changeset viewer.