Ignore:
Timestamp:
Mar 9, 2018, 1:08:32 PM (6 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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.
Message:

more changes

Location:
doc/papers/general/evaluation
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • doc/papers/general/evaluation/c-stack.c

    r81e8ab0 r8b001bd  
    66        struct stack_node * next;
    77};
    8 
    9 struct stack new_stack() { return (struct stack){ NULL }; /***/ }
    108
    119void clear_stack( struct stack * s, void (*free_el)( void * ) ) {
     
    1917}
    2018
     19struct stack new_stack() { return (struct stack){ NULL }; /***/ }
     20
    2121void copy_stack( struct stack * s, const struct stack * t, void * (*copy)( const void * ) ) {
    2222        struct stack_node ** crnt = &s->head;
     
    2727        }
    2828        *crnt = NULL;
     29}
     30struct 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;
    2936}
    3037
  • doc/papers/general/evaluation/c-stack.h

    r81e8ab0 r8b001bd  
    88struct stack new_stack();
    99void copy_stack(struct stack* dst, const struct stack* src, void* (*copy)(const void*));
     10struct stack* assign_stack(struct stack* dst, const struct stack* src,
     11        void* (*copy_el)(const void*), void (*free_el)(void*));
    1012void clear_stack(struct stack* s, void (*free_el)(void*));
    1113
  • doc/papers/general/evaluation/cfa-stack.c

    r81e8ab0 r8b001bd  
    66        stack_node(T) * next;
    77};
     8
     9forall( 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}
    818
    919forall( otype T ) void ?{}( stack(T) & s ) { (s.head){ 0 }; }
     
    1727        }
    1828        *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;
    2929}
    3030
  • doc/papers/general/evaluation/cpp-stack.hpp

    r81e8ab0 r8b001bd  
    1414        stack( stack<T> && o ) : head( o.head ) { o.head = nullptr; }
    1515
     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
    1625        void copy( const stack<T> & o ) {
    1726                node ** crnt = &head;
     
    2130                }
    2231                *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;
    3232        }
    3333
  • doc/papers/general/evaluation/cpp-vstack.cpp

    r81e8ab0 r8b001bd  
    33
    44stack::node::node( const object & v, node * n ) : value( v.new_copy() ), next( n ) {}
     5
     6void stack::clear() {
     7        for ( node * next = head; next; ) {
     8                node * crnt = next;
     9                next = crnt->next;
     10                delete crnt;
     11        }
     12        head = nullptr;
     13}
    514
    615void stack::copy( const stack & o ) {
     
    1120        }
    1221        *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;
    2222}
    2323
     
    4141}
    4242
    43 
    4443bool stack::empty() const { return head == nullptr; }
    4544
  • doc/papers/general/evaluation/cpp-vstack.hpp

    r81e8ab0 r8b001bd  
    1010        node * head;
    1111
     12        void clear();
    1213        void copy( const stack & o );
    1314
     
    1920        stack& operator=( stack && o );
    2021
    21         void clear();
    2222        bool empty() const;
    2323        void push( const object & value );
Note: See TracChangeset for help on using the changeset viewer.