Ignore:
Timestamp:
Mar 8, 2018, 11:04:14 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:
81e8ab0, e59f0bf
Parents:
deb52a0
Message:

additional changes

File:
1 edited

Legend:

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

    rdeb52a0 r29db723  
    22#include "cfa-stack.h"
    33
    4 forall(otype T) struct stack_node {
     4forall( otype T ) struct stack_node {
    55        T value;
    66        stack_node(T) * next;
    77};
    88
    9 forall(otype T) void ?{}( stack(T) & s ) { (s.head){ 0 }; }
     9forall( otype T ) void ?{}( stack(T) & s ) { (s.head){ 0 }; }
    1010
    11 forall(otype T) void ?{}( stack(T) & s, stack(T) t ) {
     11forall( otype T ) void ?{}( stack(T) & s, stack(T) t ) {
    1212        stack_node(T) ** crnt = &s.head;
    1313        for ( stack_node(T) * next = t.head; next; next = next->next ) {
     
    1919}
    2020
    21 forall(otype T) stack(T) ?=?( stack(T) & s, stack(T) t ) {
     21forall( otype T ) stack(T) ?=?( stack(T) & s, stack(T) t ) {
    2222        if ( s.head == t.head ) return s;
    2323        clear( s );
     
    2626}
    2727
    28 forall(otype T) void ^?{}( stack(T) & s) { clear( s ); }
     28forall( otype T ) void ^?{}( stack(T) & s) { clear( s ); }
    2929
    30 forall(otype T) _Bool empty( const stack(T) & s ) { return s.head == 0; }
     30forall( otype T ) _Bool empty( const stack(T) & s ) { return s.head == 0; }
    3131
    32 forall(otype T) void push( stack(T) & s, T value ) with( s ) {
    33         stack_node(T)* n = alloc();
     32forall( otype T ) void push( stack(T) & s, T value ) with( s ) {
     33        stack_node(T) * n = alloc();
    3434        (*n){ value, head };
    3535        head = n;
    3636}
    3737
    38 forall(otype T) T pop( stack(T) & s ) with( s ) {
     38forall( otype T ) T pop( stack(T) & s ) with( s ) {
    3939        stack_node(T) * n = head;
    4040        head = n->next;
    41         T x = n->value;
     41        T v = n->value;
    4242        ^(*n){};
    4343        free( n );
    44         return x;
     44        return v;
    4545}
    4646
    47 forall(otype T) void clear( stack(T) & s ) with( s ) {
     47forall( otype T ) void clear( stack(T) & s ) with( s ) {
    4848        for ( stack_node(T) * next = head; next; ) {
    4949                stack_node(T) * crnt = next;
Note: See TracChangeset for help on using the changeset viewer.