This module contains enums, functions, and structures related to sld_stack objects.
A sld_stack contains data in a LIFO (last in, first out) arrangement
These constants allow the user to define how stack data should reside in memory (contiguous or not.) This can also affect performance (resizing arrays can be expensive in the case of a vector for example.)
Enumerator |
---|
sld_stack_list |
|
sld_stack_vector |
|
void sld_stack_free |
( |
struct sld_stack * |
stack | ) |
|
|
related |
Frees any memory allocated for an initialized sld_stack.
- Parameters
-
- Examples:
- stack.c.
Initializes a sld_stack.
- Parameters
-
stack | an uninitialized sld_stack |
stack_type | can be either a sld_stack_list or sld_stack_vector |
- Returns
- Success or failure
- Examples:
- stack.c.
void * sld_stack_peek |
( |
struct sld_stack * |
stack | ) |
|
|
related |
Returns the object at the top of a sld_stack.
- Parameters
-
- Returns
- The object at the top of the passed sld_stack
- Examples:
- stack.c.
void * sld_stack_pop |
( |
struct sld_stack * |
stack | ) |
|
|
related |
Returns and removes the object at the top of a sld_stack.
- Parameters
-
- Returns
- The object at the top of the passed sld_stack
- Examples:
- stack.c.
Adds an object to the top of a sld_stack.
- Parameters
-
stack | an initialized sld_stack |
object | an arbitrary object |
- Returns
- Success or failure
- Examples:
- stack.c.