Go to the documentation of this file.
27 #define DEFINE_STACK(PREFIX, name, type) \
29 static stack name##_stack = stack_undefined; \
31 PREFIX void __attribute__ ((unused)) make_##name##_stack(void) \
33 assert(name##_stack==stack_undefined); \
34 name##_stack = stack_make(type##_domain, 0, 0); \
36 PREFIX void __attribute__ ((unused)) free_##name##_stack(void) \
38 stack_free(&name##_stack); \
39 name##_stack = stack_undefined; \
41 PREFIX stack __attribute__ ((unused)) get_##name##_stack(void) \
43 return name##_stack; \
45 PREFIX void __attribute__ ((unused)) set_##name##_stack(stack s) \
47 assert(name##_stack==stack_undefined); \
50 PREFIX void __attribute__ ((unused)) reset_##name##_stack(void) \
52 assert(name##_stack!=stack_undefined); \
53 name##_stack = stack_undefined; \
55 PREFIX void __attribute__ ((unused)) name##_push(type i) \
57 stack_push((void *)i, name##_stack); \
59 PREFIX bool __attribute__ ((unused)) name##_filter(type i) \
61 stack_push((void *)i, name##_stack); \
64 PREFIX void __attribute__ ((unused)) name##_rewrite(type i) \
66 type __attribute__ ((unused)) t = (type)stack_pop(name##_stack);\
69 PREFIX type __attribute__ ((unused)) name##_replace(type i) \
71 return (type) stack_replace((void *)i, name##_stack); \
73 PREFIX type __attribute__ ((unused)) name##_pop(void) \
75 return (type) stack_pop(name##_stack); \
77 PREFIX type __attribute__ ((unused)) name##_head(void) \
79 return (type) stack_head(name##_stack); \
81 PREFIX type __attribute__ ((unused)) name##_nth(int n) \
83 return (type) stack_nth(name##_stack, n); \
85 PREFIX bool __attribute__ ((unused)) name##_empty_p(void) \
87 return stack_empty_p(name##_stack); \
89 PREFIX int __attribute__ ((unused)) name##_size(void) \
91 return stack_size(name##_stack); \
93 PREFIX void __attribute__ ((unused)) error_reset_##name##_stack(void) \
95 name##_stack = stack_undefined; \
98 #define DEFINE_LOCAL_STACK(name, type) DEFINE_STACK(static, name, type)
99 #define DEFINE_GLOBAL_STACK(name, type) DEFINE_STACK(extern, name, type)