Changeset 122aecd for doc/generic_types/evaluation/cfa-stack.c
- Timestamp:
- Apr 7, 2017, 2:32:03 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 3a48e283
- Parents:
- 4cfcf41
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/generic_types/evaluation/cfa-stack.c
r4cfcf41 r122aecd 8 8 9 9 forall(otype T) void ?{}(stack(T)* s) { 10 ?{}( &s->head, 0 ); 10 (&s->head){ 0 }; 11 } 12 13 forall(otype T) void ?{}(stack(T)* s, stack(T) t) { 14 stack_node(T)** crnt = &s->head; 15 stack_node(T)* next = t.head; 16 while ( next ) { 17 *crnt = ((stack_node(T)*)malloc()){ next->value }; 18 stack_node(T)* acrnt = *crnt; 19 crnt = &acrnt->next; 20 next = next->next; 21 } 22 *crnt = 0; 23 } 24 25 forall(otype T) stack(T) ?=?(stack(T)* s, stack(T) t) { 26 if ( s->head == t.head ) return *s; 27 clear(s); 28 s{ t }; 29 return *s; 11 30 } 12 31 13 32 forall(otype T) void ^?{}(stack(T)* s) { 14 stack_node(T)* next = s->head; 15 while ( next ) { 16 stack_node(T)* crnt = next; 17 next = crnt->next; 18 delete(crnt); 19 } 33 clear(s); 20 34 } 21 35 … … 35 49 return x; 36 50 } 51 52 forall(otype T) void clear(stack(T)* s) { 53 stack_node(T)* next = s->head; 54 while ( next ) { 55 stack_node(T)* crnt = next; 56 next = crnt->next; 57 delete(crnt); 58 } 59 }
Note: See TracChangeset
for help on using the changeset viewer.