XenevaOS
Loading...
Searching...
No Matches
Typedefs | Functions
stack.h File Reference
#include <stddef.h>
#include <parserutils/errors.h>
#include <parserutils/functypes.h>
Include dependency graph for stack.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct parserutils_stack parserutils_stack
 

Functions

parserutils_error parserutils_stack_create (size_t item_size, size_t chunk_size, parserutils_stack **stack)
 
parserutils_error parserutils_stack_destroy (parserutils_stack *stack)
 
parserutils_error parserutils_stack_push (parserutils_stack *stack, const void *item)
 
parserutils_error parserutils_stack_pop (parserutils_stack *stack, void *item)
 
void * parserutils_stack_get_current (parserutils_stack *stack)
 

Typedef Documentation

◆ parserutils_stack

Function Documentation

◆ parserutils_stack_create()

parserutils_error parserutils_stack_create ( size_t  item_size,
size_t  chunk_size,
parserutils_stack **  stack 
)

Create a stack

Parameters
item_sizeLength, in bytes, of an item in the stack
chunk_sizeNumber of stack slots in a chunk
stackPointer to location to receive stack instance
Returns
PARSERUTILS_OK on success, PARSERUTILS_BADPARM on bad parameters PARSERUTILS_NOMEM on memory exhaustion

◆ parserutils_stack_destroy()

parserutils_error parserutils_stack_destroy ( parserutils_stack *  stack)

Destroy a stack instance

Parameters
stackThe stack to destroy
Returns
PARSERUTILS_OK on success, appropriate error otherwise.

◆ parserutils_stack_get_current()

void * parserutils_stack_get_current ( parserutils_stack *  stack)

Retrieve a pointer to the current item on the stack

Parameters
stackThe stack to inspect
Returns
Pointer to item on stack, or NULL if none

◆ parserutils_stack_pop()

parserutils_error parserutils_stack_pop ( parserutils_stack *  stack,
void *  item 
)

Pop an item off a stack

Parameters
stackThe stack to pop from
itemPointer to location to receive popped item, or NULL
Returns
PARSERUTILS_OK on success, appropriate error otherwise.

◆ parserutils_stack_push()

parserutils_error parserutils_stack_push ( parserutils_stack *  stack,
const void *  item 
)

Push an item onto the stack

Parameters
stackThe stack to push onto
itemThe item to push
Returns
PARSERUTILS_OK on success, appropriate error otherwise