00001
00002
00003
00004
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
00025
00026
00027 # define st_foreach(var,stack) \
00028 { STACK st__0O_tmp; \
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