42 #ifndef STACK_INCLUDED
43 #define STACK_INCLUDED
52 #define STACK_NULL ((stack) NULL)
53 #define STACK_NULL_P(s) ((s)==STACK_NULL)
55 #define stack_undefined ((stack)-14)
56 #define stack_undefined_p(s) ((s)==stack_undefined)
58 #define STACK_CHECK(s) \
59 message_assert("stack null or undefined", \
60 !STACK_NULL_P(s) && !stack_undefined_p(s))
104 #define STACK_MAP_X(_item, _itemtype, _code, _stack, _downwards) \
106 stack_iterator _i = stack_iterator_init(_stack, _downwards); \
108 while (stack_iterator_next_and_go(_i, &_vs_item)) \
110 _itemtype _item = (_itemtype) _vs_item; \
113 stack_iterator_end(&_i); \
116 #define STACK_MAP(_item, _itemtype, _code, _stack) \
117 STACK_MAP_X(_item, _itemtype, _code, _stack, true)
struct __stack_iterator * stack_iterator
void stack_map(const stack, gen_iter_func_t)
APPLY f to all items of stack s;.
void * stack_nth(const stack, int)
returns the nth item starting from the head and counting from 1, when possible, or NULL,...
int stack_type(const stack)
bool stack_iterator_end_p(stack_iterator)
void stack_info(FILE *, const stack)
stack_iterator stack_iterator_init(const stack, bool)
stack iterator
bool stack_empty_p(const stack)
int stack_bsize(const stack)
stack stack_copy(const stack)
duplicate a stack with its contents.
int stack_policy(const stack)
int stack_consistent_p(const stack)
miscellaneous
int stack_max_extent(const stack)
void * stack_head(const stack)
returns the item on top of stack s
int stack_size(const stack)
observers
void stack_push(void *, stack)
stack use
void stack_free(stack *)
type, bucket_size, policy
void stack_iterator_end(stack_iterator *)
stack stack_make(int, int, int)
allocation
bool stack_iterator_next_and_go(stack_iterator, void **)
X-ward.
void * stack_replace(void *, stack)
REPLACEs the item on top of stack s, and returns the old item.
struct __stack_head * stack
STACK MANAGEMENT – headers.
void * stack_pop(stack)
POPs one item from stack s.
void(* gen_iter_func_t)(void *)