Changeset 4c80a75 for doc/papers/general/evaluation
- Timestamp:
- May 1, 2018, 9:17:06 AM (6 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, with_gc
- Children:
- 1518b39, 7f0001c, 94dea96
- Parents:
- 8a5bdf0
- Location:
- doc/papers/general/evaluation
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/papers/general/evaluation/c-stack.c
r8a5bdf0 r4c80a75 27 27 } 28 28 29 stack new_stack() { return (stack){ NULL }; /***/ } 29 stack new_stack() { 30 return (stack){ NULL }; /***/ 31 } 30 32 31 33 stack * assign_stack( stack * s, const stack * t, … … 37 39 } 38 40 39 _Bool stack_empty( const stack * s ) { return s->head == NULL; } 41 _Bool stack_empty( const stack * s ) { 42 return s->head == NULL; 43 } 40 44 41 45 void push_stack( stack * s, void * v ) { -
doc/papers/general/evaluation/c-stack.h
r8a5bdf0 r4c80a75 6 6 } stack; 7 7 8 void copy_stack(stack * dst, const stack * src, void * (* copy)(const void *)); 9 void clear_stack(stack * s, void (*free_el)(void *)); 8 10 stack new_stack(); 9 void copy_stack(stack * dst, const stack * src, void * (* copy)(const void *));10 11 stack * assign_stack( stack * dst, const stack * src, 11 12 void * (* copy_el)(const void *), void (* free_el)(void *)); 12 void clear_stack(stack * s, void (*free_el)(void *));13 13 14 14 _Bool stack_empty( const stack * s ); -
doc/papers/general/evaluation/cfa-stack.c
r8a5bdf0 r4c80a75 8 8 }; 9 9 10 void ?{}( stack(T) & s ) { (s.head){ 0 }; } 11 12 void ?{}( stack(T) & s, stack(T) t ) { 10 void ?{}( stack(T) & s, stack(T) t ) { // copy 13 11 node(T) ** cr = &s.head; 14 12 for ( node(T) * nx = t.head; nx; nx = nx->next ) { … … 20 18 } 21 19 22 void ^?{}( stack(T) & s) { clear( s ); } 23 24 void clear( stack(T) & s ) with( s ) { 20 void clear( stack(T) & s ) with( s ) { 25 21 for ( node(T) * nx = head; nx; ) { 26 22 node(T) * cr = nx; 27 23 nx = cr->next; 28 24 ^(*cr){}; 29 free( cr);25 free( cr ); 30 26 } 31 27 head = 0; 32 28 } 29 30 void ?{}( stack(T) & s ) { (s.head){ 0 }; } 31 void ^?{}( stack(T) & s) { clear( s ); } 33 32 34 33 stack(T) ?=?( stack(T) & s, stack(T) t ) { … … 39 38 } 40 39 41 _Bool empty( const stack(T) & s ) { return s.head == 0; } 40 _Bool empty( const stack(T) & s ) { 41 return s.head == 0; 42 } 42 43 43 44 void push( stack(T) & s, T value ) with( s ) { -
doc/papers/general/evaluation/cfa-stack.h
r8a5bdf0 r4c80a75 7 7 }; 8 8 9 void ?{}( stack(T) & s, stack(T) t ); 10 void clear( stack(T) & s ); 9 11 void ?{}( stack(T) & s ); 10 void ?{}( stack(T) & s, stack(T) t );11 12 void ^?{}( stack(T) & s); 12 void clear( stack(T) & s );13 13 14 14 stack(T) ?=?( stack(T) & s, stack(T) t ); -
doc/papers/general/evaluation/cpp-stack.hpp
r8a5bdf0 r4c80a75 10 10 node * head; 11 11 12 stack() : head( nullptr ) {} 13 stack( const stack<T> & o ) { copy( o ); } 12 void copy( const stack<T> & o ) { 13 node ** cr = &head; 14 for ( node * nx = o.head; nx; nx = nx->next ) { 15 *cr = new node{ nx->value }; /***/ 16 cr = &(*cr)->next; 17 } 18 *cr = nullptr; 19 } 14 20 15 21 void clear() { … … 22 28 } 23 29 24 void copy( const stack<T> & o ) { 25 node ** cr = &head; 26 for ( node * nx = o.head; nx; nx = nx->next ) { 27 *cr = new node{ nx->value }; /***/ 28 cr = &(*cr)->next; 29 } 30 *cr = nullptr; 31 } 32 30 stack() : head( nullptr ) {} 31 stack( const stack<T> & o ) { copy( o ); } 33 32 ~stack() { clear(); } 34 33 35 stack & operator= 34 stack & operator=( const stack<T> & o ) { 36 35 if ( this == &o ) return *this; 37 36 clear(); … … 40 39 } 41 40 42 bool empty() const { return head == nullptr; } 41 bool empty() const { 42 return head == nullptr; 43 } 43 44 44 void push( const T & value ) { head = new node{ value, head }; /***/ } 45 void push( const T & value ) { 46 head = new node{ value, head }; /***/ 47 } 45 48 46 49 T pop() { -
doc/papers/general/evaluation/cpp-vstack.cpp
r8a5bdf0 r4c80a75 3 3 4 4 stack::node::node( const object & v, node * n ) : value( v.new_copy() ), next( n ) {} 5 6 void stack::copy( const stack & o ) { 7 node ** cr = &head; 8 for ( node * nx = o.head; nx; nx = nx->next ) { 9 *cr = new node{ *nx->value }; /***/ 10 cr = &(*cr)->next; 11 } 12 *cr = nullptr; 13 } 5 14 6 15 void stack::clear() { … … 11 20 } 12 21 head = nullptr; 13 }14 15 void stack::copy( const stack & o ) {16 node ** cr = &head;17 for ( node * nx = o.head; nx; nx = nx->next ) {18 *cr = new node{ *nx->value }; /***/19 cr = &(*cr)->next;20 }21 *cr = nullptr;22 22 } 23 23 … … 33 33 } 34 34 35 bool stack::empty() const { return head == nullptr; } 35 bool stack::empty() const { 36 return head == nullptr; 37 } 36 38 37 void stack::push( const object & value ) { head = new node{ value, head }; /***/ } 39 void stack::push( const object & value ) { 40 head = new node{ value, head }; /***/ 41 } 38 42 39 43 ptr<object> stack::pop() { -
doc/papers/general/evaluation/cpp-vstack.hpp
r8a5bdf0 r4c80a75 10 10 node * head; 11 11 12 void copy( const stack & o ); 12 13 void clear(); 13 void copy( const stack & o );14 14 15 15 stack();
Note: See TracChangeset
for help on using the changeset viewer.