Small, Fast S-Expression Library
|
00001 00042 #ifndef __FASTSTACK_H__ 00043 #define __FASTSTACK_H__ 00044 00050 typedef struct stack_level { 00057 struct stack_level *above; 00058 00063 struct stack_level *below; 00064 00069 void *data; 00070 } stack_lvl_t; 00071 00078 typedef struct stack_wrapper { 00082 stack_lvl_t *top; 00083 00087 stack_lvl_t *bottom; 00088 00092 int height; 00093 } faststack_t; 00094 00097 /* this is for C++ */ 00098 #ifdef __cplusplus 00099 extern "C" { 00100 #endif 00101 00106 faststack_t *make_stack(); 00107 00115 void destroy_stack(faststack_t *s); 00116 00124 faststack_t *push(faststack_t *cur_stack, void *data); 00125 00134 stack_lvl_t *pop(faststack_t *s); 00135 00136 /* this is for C++ */ 00137 #ifdef __cplusplus 00138 } 00139 #endif 00140 00144 #define top_data(s) (s->top->data) 00145 00150 #define empty_stack(s) (s->top == NULL) 00151 00152 #endif /* __FASTSTACK_H__ */