281#define vlStackSize(stackPtr) ((stackPtr)->depth)
291#define vlStackEmpty(stackPtr) ((stackPtr)->depth == 0)
VL_MEMORY_T vl_transient
Definition vl_memory.h:118
VL_UPTR_T vl_uintptr_t
Unsigned integer type suitable for expressing memory addresses.
Definition vl_numtypes.h:163
VL_STRUCTURE_INDEX_T vl_dsidx_t
Index type for data structures.
Definition vl_numtypes.h:75
VL_STRUCTURE_OFFSET_T vl_dsoffs_t
Byte offset type for data structures.
Definition vl_numtypes.h:70
VL_API void vlStackDelete(vl_stack *stack)
Deletes the specified stack and its internal buffer.
Definition vl_stack.c:36
VL_API vl_stack_offset vlStackPushValue(vl_stack *stack, const void *data, vl_memsize_t size)
Reserves and assigns a new block of memory at the top of the stack, returning its offset.
Definition vl_stack.c:63
VL_API vl_transient * vlStackSample(vl_stack *stack, vl_stack_offset offset)
Samples the stack at the specified offset.
Definition vl_stack.c:70
VL_API vl_memsize_t vlStackPeekSize(vl_stack *stack)
Returns the size of the top level of the stack, in bytes.
Definition vl_stack.c:86
VL_API 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.
Definition vl_stack.c:49
VL_API vl_stack * vlStackNew(void)
Allocates on the heap, initializes, and returns a new stack allocator instance.
Definition vl_stack.c:29
vl_uintptr_t headOffset
Definition vl_stack.h:40
VL_API void vlStackFree(vl_stack *stack)
Frees the specified stack instance's internal allocation.
Definition vl_stack.c:27
vl_buffer buffer
Definition vl_stack.h:41
VL_API void vlStackPop(vl_stack *stack)
Pops the top level of the stack, allowing it to be overwritten in the future.
Definition vl_stack.c:92
VL_API void vlStackInit(vl_stack *stack)
Initializes the underlying memory of an existing vl_stack pointer. The stack allocator should be free...
Definition vl_stack.c:16
VL_API void vlStackReset(vl_stack *stack)
Resets the specified stack allocator, allowing it to be used as if it had just been initialized.
Definition vl_stack.c:42
vl_dsidx_t depth
Definition vl_stack.h:39
VL_API vl_memsize_t vlStackSampleSize(vl_stack *stack, vl_stack_offset offset)
Samples the size of the stack level at the specified offset.
Definition vl_stack.c:75
VL_API vl_transient * vlStackPeek(vl_stack *stack)
Returns a pointer to the top level of the stack.
Definition vl_stack.c:81
A virtual stack allocator.
Definition vl_stack.h:38