Libparserutils
|
Go to the source code of this file.
Data Structures | |
struct | parserutils_stack |
Stack object. More... | |
Functions | |
parserutils_error | parserutils_stack_create (size_t item_size, size_t chunk_size, parserutils_stack **stack) |
Create a stack. | |
parserutils_error | parserutils_stack_destroy (parserutils_stack *stack) |
Destroy a stack instance. | |
parserutils_error | parserutils_stack_push (parserutils_stack *stack, const void *item) |
Push an item onto the stack. | |
parserutils_error | parserutils_stack_pop (parserutils_stack *stack, void *item) |
Pop an item off a stack. | |
void * | parserutils_stack_get_current (parserutils_stack *stack) |
Retrieve a pointer to the current item on the stack. | |
void | parserutils_stack_dump (parserutils_stack *stack, const char *prefix, void(*printer)(void *item)) |
parserutils_error parserutils_stack_create | ( | size_t | item_size, |
size_t | chunk_size, | ||
parserutils_stack ** | stack | ||
) |
Create a stack.
item_size | Length, in bytes, of an item in the stack |
chunk_size | Number of stack slots in a chunk |
stack | Pointer to location to receive stack instance |
Definition at line 35 of file stack.c.
References parserutils_stack::chunk_size, parserutils_stack::current_item, parserutils_stack::item_size, parserutils_stack::items, parserutils_stack::items_allocated, PARSERUTILS_BADPARM, PARSERUTILS_NOMEM, and PARSERUTILS_OK.
parserutils_error parserutils_stack_destroy | ( | parserutils_stack * | stack | ) |
Destroy a stack instance.
stack | The stack to destroy |
Definition at line 69 of file stack.c.
References parserutils_stack::items, PARSERUTILS_BADPARM, and PARSERUTILS_OK.
|
extern |
Definition at line 166 of file stack.c.
References parserutils_stack::current_item, parserutils_stack::item_size, and parserutils_stack::items.
void * parserutils_stack_get_current | ( | parserutils_stack * | stack | ) |
Retrieve a pointer to the current item on the stack.
stack | The stack to inspect |
Definition at line 151 of file stack.c.
References parserutils_stack::current_item, parserutils_stack::item_size, and parserutils_stack::items.
parserutils_error parserutils_stack_pop | ( | parserutils_stack * | stack, |
void * | item | ||
) |
Pop an item off a stack.
stack | The stack to pop from |
item | Pointer to location to receive popped item, or NULL |
Definition at line 126 of file stack.c.
References parserutils_stack::current_item, parserutils_stack::item_size, parserutils_stack::items, PARSERUTILS_BADPARM, PARSERUTILS_INVALID, and PARSERUTILS_OK.
parserutils_error parserutils_stack_push | ( | parserutils_stack * | stack, |
const void * | item | ||
) |
Push an item onto the stack.
stack | The stack to push onto |
item | The item to push |
Definition at line 87 of file stack.c.
References parserutils_stack::chunk_size, parserutils_stack::current_item, parserutils_stack::item_size, parserutils_stack::items, parserutils_stack::items_allocated, PARSERUTILS_BADPARM, PARSERUTILS_INVALID, PARSERUTILS_NOMEM, and PARSERUTILS_OK.