C:/Users/Dennis/src/lang/russell.orig/src/datatypes/stack.h

Go to the documentation of this file.
00001 /* These are structure declarations and macro definitions for a traversable */
00002 /* stack with marks */
00003 
00004 /* These use the routines in consnodes.c and the macros in consnodes.h */
00005 
00006 typedef ConsNode * STACK;
00007                                                  
00008 typedef ConsNode * MARK;
00009 
00010 # define push(x,S) (S) = cn_cons((x),(S))
00011 
00012 # define pop(S) (S) = cn_del_hd((S))
00013 
00014 # define top(S) cn_head((S))
00015 
00016 # define is_stempty(S) cn_null((S))
00017 
00018 # define emptystack() NIL
00019 
00020 # define mark(S) (S)
00021 
00022 # define is_top_marked(S,mark) ((S) == (mark))
00023 
00024 /* The following defines a loop construct to traverse a stack, starting */
00025 /* with the top */
00026 
00027 # define st_foreach(var,stack)  \
00028     {   STACK st__0O_tmp; /* how's that for an obscure variable name ? */\
00029         for ( st__0O_tmp = (stack);  \
00030               ((var) = top(st__0O_tmp), !is_stempty(st__0O_tmp)); \
00031               st__0O_tmp = cn_tail(st__0O_tmp) ) {
00032 
00033 # define end_foreach  \
00034         }             \
00035     }
00036 
00037 
00038 

Generated on Fri Jan 25 10:39:45 2008 for russell by  doxygen 1.5.4