Go to the source code of this file.
Data Structures | |
| struct | stack_level |
| struct | stack_wrapper |
Defines | |
| #define | top_data(s) (s->top->data) |
| #define | empty_stack(s) (s->top == NULL) |
Typedefs | |
| typedef stack_level | stack_lvl_t |
| typedef stack_wrapper | faststack_t |
Functions | |
| faststack_t * | make_stack () |
| void | destroy_stack (faststack_t *s) |
| faststack_t * | push (faststack_t *cur_stack, void *data) |
| stack_lvl_t * | pop (faststack_t *s) |
|
|
Given a stack s, check to see if the stack is empty or not. Value is boolean true or false. |
|
|
Given a stack s, examine the data pointer at the top. |
|
|
Wrapper around the stack levels - keeps a pointer to the current top and bottom of the stack and a count of the current height. This allows the top to have non-null above pointer resulting from previously allocated stack levels that may be recycled later without |
|
|
Structure representing a single level in the stack. Has a pointer to the level above and below itself and a pointer to a generic blob of data associated with this level. |
|
|
Given a stack structure, destroy it and free all of the stack levels. Important note : This function does not free the data pointed to from each level of the stack - the user is responsible for freeing this data themselves before calling this function to prevent memory leakage. |
|
|
Return a pointer to an empty stack structure. If the return value is NULL, one should check sexp_errno to determine why. |
|
|
Given a stack, pop a level off and return a pointer to that level. The user is responsible for extracting the data, but the stack_lvl_t structures pointed to from the level (above and below) should be left alone. If NULL is returned, either the stack contained nothing, or the incoming stack s was NULL. Consult sexp_errno to determine which was the case -- SEXP_ERR_BAD_STACK indicates a null stack was passed in. |
|
||||||||||||
|
Given a stack, push a new level on referring to the data pointer. If a new level cannot be allocated, NULL is returned and sexp_errno is set with the appropriate error condition. Memory allocation errors will result in SEXP_ERR_MEMORY, while a null stack will result in SEXP_ERR_BAD_STACK. |
1.4.6