Changeset 8b001bd for doc/papers/general/evaluation
- Timestamp:
- Mar 9, 2018, 1:08:32 PM (7 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:
- 3d8f2f8
- Parents:
- 81e8ab0 (diff), e59f0bf (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- doc/papers/general/evaluation
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/papers/general/evaluation/c-stack.c
r81e8ab0 r8b001bd 6 6 struct stack_node * next; 7 7 }; 8 9 struct stack new_stack() { return (struct stack){ NULL }; /***/ }10 8 11 9 void clear_stack( struct stack * s, void (*free_el)( void * ) ) { … … 19 17 } 20 18 19 struct stack new_stack() { return (struct stack){ NULL }; /***/ } 20 21 21 void copy_stack( struct stack * s, const struct stack * t, void * (*copy)( const void * ) ) { 22 22 struct stack_node ** crnt = &s->head; … … 27 27 } 28 28 *crnt = NULL; 29 } 30 struct stack * assign_stack( struct stack * s, const struct stack * t, 31 void * (*copy_el)( const void * ), void (*free_el)( void * ) ) { 32 if ( s->head == t->head ) return s; 33 clear_stack( s, free_el ); /***/ 34 copy_stack( s, t, copy_el ); /***/ 35 return s; 29 36 } 30 37 -
doc/papers/general/evaluation/c-stack.h
r81e8ab0 r8b001bd 8 8 struct stack new_stack(); 9 9 void copy_stack(struct stack* dst, const struct stack* src, void* (*copy)(const void*)); 10 struct stack* assign_stack(struct stack* dst, const struct stack* src, 11 void* (*copy_el)(const void*), void (*free_el)(void*)); 10 12 void clear_stack(struct stack* s, void (*free_el)(void*)); 11 13 -
doc/papers/general/evaluation/cfa-stack.c
r81e8ab0 r8b001bd 6 6 stack_node(T) * next; 7 7 }; 8 9 forall( otype T ) void clear( stack(T) & s ) with( s ) { 10 for ( stack_node(T) * next = head; next; ) { 11 stack_node(T) * crnt = next; 12 next = crnt->next; 13 ^(*crnt){}; 14 free(crnt); 15 } 16 head = 0; 17 } 8 18 9 19 forall( otype T ) void ?{}( stack(T) & s ) { (s.head){ 0 }; } … … 17 27 } 18 28 *crnt = 0; 19 }20 21 forall( otype T ) void clear( stack(T) & s ) with( s ) {22 for ( stack_node(T) * next = head; next; ) {23 stack_node(T) * crnt = next;24 next = crnt->next;25 ^(*crnt){};26 free(crnt);27 }28 head = 0;29 29 } 30 30 -
doc/papers/general/evaluation/cpp-stack.hpp
r81e8ab0 r8b001bd 14 14 stack( stack<T> && o ) : head( o.head ) { o.head = nullptr; } 15 15 16 void clear() { 17 for ( node * next = head; next; ) { 18 node * crnt = next; 19 next = crnt->next; 20 delete crnt; 21 } 22 head = nullptr; 23 } 24 16 25 void copy( const stack<T> & o ) { 17 26 node ** crnt = &head; … … 21 30 } 22 31 *crnt = nullptr; 23 }24 25 void clear() {26 for ( node * next = head; next; ) {27 node * crnt = next;28 next = crnt->next;29 delete crnt;30 }31 head = nullptr;32 32 } 33 33 -
doc/papers/general/evaluation/cpp-vstack.cpp
r81e8ab0 r8b001bd 3 3 4 4 stack::node::node( const object & v, node * n ) : value( v.new_copy() ), next( n ) {} 5 6 void stack::clear() { 7 for ( node * next = head; next; ) { 8 node * crnt = next; 9 next = crnt->next; 10 delete crnt; 11 } 12 head = nullptr; 13 } 5 14 6 15 void stack::copy( const stack & o ) { … … 11 20 } 12 21 *crnt = nullptr; 13 }14 15 void stack::clear() {16 for ( node * next = head; next; ) {17 node * crnt = next;18 next = crnt->next;19 delete crnt;20 }21 head = nullptr;22 22 } 23 23 … … 41 41 } 42 42 43 44 43 bool stack::empty() const { return head == nullptr; } 45 44 -
doc/papers/general/evaluation/cpp-vstack.hpp
r81e8ab0 r8b001bd 10 10 node * head; 11 11 12 void clear(); 12 13 void copy( const stack & o ); 13 14 … … 19 20 stack& operator=( stack && o ); 20 21 21 void clear();22 22 bool empty() const; 23 23 void push( const object & value );
Note: See TracChangeset
for help on using the changeset viewer.