Veritable Lasagna
An Allocator & Data Structure Library for C.
|
Functions | |
void | vlStackInit (vl_stack *stack) |
void | vlStackFree (vl_stack *stack) |
Frees the specified stack instance's allocation. | |
vl_stack * | vlStackNew () |
Allocates on the heap, initializes, and returns a stack allocator instance. | |
void | vlStackDelete (vl_stack *stack) |
Deletes the specified stack. This stack allocator should be initialized via vlStackNew. | |
void | vlStackReset (vl_stack *stack) |
Resets the specified stack allocator, allowing it to be used as if it had just been initialized. | |
vl_stack_offset | vlStackPush (vl_stack *stack, vl_memsize_t size) |
Reserves a new block of memory at the top of the stack, returning its offset. | |
vl_stack_offset | vlStackPushValue (vl_stack *stack, const void *data, vl_memsize_t size) |
Reserves and assigns new block of memory at the top of the stack, returning its offset. | |
vl_transient * | vlStackSample (vl_stack *stack, vl_stack_offset offset) |
Samples the stack at the specified offset. | |
vl_memsize_t | vlStackSampleSize (vl_stack *stack, vl_stack_offset offset) |
Samples the size of the stack level at the specified offset. | |
vl_transient * | vlStackPeek (vl_stack *stack) |
Returns a pointer to the top level of the stack. | |
vl_memsize_t | vlStackPeekSize (vl_stack *stack) |
Returns the size of the top level of the stack, in bytes. | |
void | vlStackPop (vl_stack *stack) |
Pops the top level of the stack, allowing it to be overwritten in the future. | |
void vlStackDelete | ( | vl_stack * | stack | ) |
Deletes the specified stack. This stack allocator should be initialized via vlStackNew.
stack | pointer |
void vlStackFree | ( | vl_stack * | stack | ) |
Frees the specified stack instance's allocation.
Frees the specified stack allocator. This stack allocator should first be initialized via vlStackInit.
stack | pointer |
void vlStackInit | ( | vl_stack * | stack | ) |
Initializes the underlying memory of an existing vl_stack pointer. The stack allocator should be freed with vlStackFree.
stack | stack pointer |
vl_stack * vlStackNew | ( | ) |
Allocates on the heap, initializes, and returns a stack allocator instance.
vl_transient * vlStackPeek | ( | vl_stack * | stack | ) |
Returns a pointer to the top level of the stack.
Results in undefined behavior if the stack is empty.
stack | pointer |
vl_memsize_t vlStackPeekSize | ( | vl_stack * | stack | ) |
Returns the size of the top level of the stack, in bytes.
Results in undefined behavior if the stack is empty.
stack | pointer |
void vlStackPop | ( | vl_stack * | stack | ) |
Pops the top level of the stack, allowing it to be overwritten in the future.
stack |
vl_stack_offset vlStackPush | ( | vl_stack * | stack, |
vl_memsize_t | size ) |
Reserves a new block of memory at the top of the stack, returning its offset.
This may force the underlying buffer to grow in size, which may invalidate the result of all prior calls to vlStackPeek and vlStackSample.
stack | pointer |
size | total bytes in the reserved block |
vl_stack_offset vlStackPushValue | ( | vl_stack * | stack, |
const void * | data, | ||
vl_memsize_t | size ) |
Reserves and assigns new block of memory at the top of the stack, returning its offset.
This may force the underlying buffer to grow in size, which may invalidate the result of all prior calls to vlStackPeek and vlStackSample.
stack | pointer |
data | pointer to the element data |
size | total bytes in the reserved block |
void vlStackReset | ( | vl_stack * | stack | ) |
Resets the specified stack allocator, allowing it to be used as if it had just been initialized.
This does NOT modify any of the information in the underlying buffer, but rather resets some variables used for book-keeping.
stack | pointer |
vl_transient * vlStackSample | ( | vl_stack * | stack, |
vl_stack_offset | offset ) |
Samples the stack at the specified offset.
Results in undefined behavior if the offset is invalid.
stack | pointer |
offset | level of the stack to sample |
vl_memsize_t vlStackSampleSize | ( | vl_stack * | stack, |
vl_stack_offset | offset ) |
Samples the size of the stack level at the specified offset.
Results in undefined behavior if the specified offset is invalid.
stack | pointer |
offset | level of the stack |