Table of Contents
- STACKS: generic type stack
- Structures
- Functions
- Defines
- Functions Documentation
- function stack_push_ui8
- function stack_push_ui32
- function stack_push_p_default
- function stack_push_p
- function stack_push_i8
- function stack_push_i32
- function stack_push_f
- function stack_push_d
- function stack_push_c
- function stack_push_b
- function stack_pop_ui8
- function stack_pop_ui32
- function stack_pop_p
- function stack_pop_i8
- function stack_pop_i32
- function stack_pop_f
- function stack_pop_d
- function stack_pop_c
- function stack_pop_b
- function stack_peek
- function stack_is_full
- function stack_is_empty
- function new_stack
- function delete_stack
- Macros Documentation
- define stack_push
- define STACK_ITEM_WRONG_TYPE
- define STACK_ITEM_UINT8
- define STACK_ITEM_UINT64
- define STACK_ITEM_UINT32
- define STACK_ITEM_PTR
- define STACK_ITEM_OK
- define STACK_ITEM_INT8
- define STACK_ITEM_INT64
- define STACK_ITEM_INT32
- define STACK_ITEM_FLOAT
- define STACK_ITEM_DOUBLE
- define STACK_ITEM_CHAR
- define STACK_ITEM_BOOL
- define STACK_IS_UNDEFINED
- define STACK_IS_FULL
- define STACK_IS_EMPTY
STACKS: generic type stack
Structures
| Name | |
|---|---|
| struct | STACK_ITEM structure of a STACK item |
| union | STACK_DATA structure of a STACK_ITEM data |
| struct | STACK STACK structure. |
Functions
| Name | |
|---|---|
| bool | stack_push_ui8(STACK * stack, uint8_t ui8) push a uint8_t onto the stack |
| bool | stack_push_ui32(STACK * stack, uint32_t ui32) push a uint32_t onto the stack |
| bool | stack_push_p_default(STACK * stack, void * p) push a pointer onto the stack with default type |
| bool | stack_push_p(STACK * stack, void * p, uint16_t p_type) push a pointer onto the stack with a custom type |
| bool | stack_push_i8(STACK * stack, int8_t i8) push an int8_t onto the stack |
| bool | stack_push_i32(STACK * stack, int32_t i32) push an int32_t onto the stack |
| bool | stack_push_f(STACK * stack, float f) push a float onto the stack |
| bool | stack_push_d(STACK * stack, double d) push a double onto the stack |
| bool | stack_push_c(STACK * stack, char c) push a char onto the stack |
| bool | stack_push_b(STACK * stack, bool b) push a bool onto the stack |
| uint8_t | stack_pop_ui8(STACK * stack, uint8_t * status) pop a uint8_t from the stack |
| uint32_t | stack_pop_ui32(STACK * stack, uint8_t * status) pop a uint32_t from the stack |
| void * | stack_pop_p(STACK * stack, uint8_t * status) pop a pointer from the stack |
| int8_t | stack_pop_i8(STACK * stack, uint8_t * status) pop an int8_t from the stack |
| int32_t | stack_pop_i32(STACK * stack, uint8_t * status) pop an int32_t from the stack |
| float | stack_pop_f(STACK * stack, uint8_t * status) pop a float from the stack |
| double | stack_pop_d(STACK * stack, uint8_t * status) pop a double from the stack |
| char | stack_pop_c(STACK * stack, uint8_t * status) pop a char from the stack |
| bool | stack_pop_b(STACK * stack, uint8_t * status) pop a bool from the stack |
| STACK_ITEM * | stack_peek(STACK * stack, size_t position) peek at an item at given position without removing it |
| bool | stack_is_full(const STACK * stack) check if the stack is full |
| bool | stack_is_empty(const STACK * stack) check if the stack is empty |
| STACK * | new_stack(size_t nb_items) allocate a new stack |
| bool | delete_stack(STACK ** stack) delete a stack and free its memory |
Defines
| Name | |
|---|---|
| stack_push(__STACK, __VAL) | |
| STACK_ITEM_WRONG_TYPE code for a bad item type |
|
| STACK_ITEM_UINT8 v_type value for a uint8_t |
|
| STACK_ITEM_UINT64 v_type value for a uint64_t |
|
| STACK_ITEM_UINT32 v_type value for a uint32_t |
|
| STACK_ITEM_PTR v_type value for a void *pointer |
|
| STACK_ITEM_OK code for a successfully retrieved item |
|
| STACK_ITEM_INT8 v_type value for a int8_t |
|
| STACK_ITEM_INT64 v_type value for a int64_t |
|
| STACK_ITEM_INT32 v_type value for a int32_t |
|
| STACK_ITEM_FLOAT v_type value for a float |
|
| STACK_ITEM_DOUBLE v_type value for a double |
|
| STACK_ITEM_CHAR v_type value for a char |
|
| STACK_ITEM_BOOL v_type value for a bool |
|
| STACK_IS_UNDEFINED code for a NULL stack state |
|
| STACK_IS_FULL code for a full stack state |
|
| STACK_IS_EMPTY code for an empty stack state |
Functions Documentation
function stack_push_ui8
bool stack_push_ui8(
STACK * stack,
uint8_t ui8
)
push a uint8_t onto the stack
Parameters:
- stack target STACK *stack
- ui8 the uint8_t to push
Return: TRUE or FALSE
helper to push an uint8_t
push a uint8_t onto the stack
function stack_push_ui32
bool stack_push_ui32(
STACK * stack,
uint32_t ui32
)
push a uint32_t onto the stack
Parameters:
- stack target STACK *stack
- ui32 the uint32 to push
Return: TRUE or FALSE
helper to push an uint32_t
push a uint32_t onto the stack
function stack_push_p_default
bool stack_push_p_default(
STACK * stack,
void * p
)
push a pointer onto the stack with default type
Parameters:
- stack target STACK *stack
- p the pointer to push
Return: TRUE or FALSE
helper to push a pointer with a default p_type of 0
push a pointer onto the stack with default type
function stack_push_p
bool stack_push_p(
STACK * stack,
void * p,
uint16_t p_type
)
push a pointer onto the stack with a custom type
Parameters:
- stack target STACK *stack
- p the pointer to push
- p_type the pointer type
Return: TRUE or FALSE
helper to push a pointer
push a pointer onto the stack with a custom type
function stack_push_i8
bool stack_push_i8(
STACK * stack,
int8_t i8
)
push an int8_t onto the stack
Parameters:
- stack target STACK *stack
- i8 the int8_t to push
Return: TRUE or FALSE
helper to push an int8_t
push an int8_t onto the stack
function stack_push_i32
bool stack_push_i32(
STACK * stack,
int32_t i32
)
push an int32_t onto the stack
Parameters:
- stack target STACK *stack
- i32 the int32 to push
Return: TRUE or FALSE
helper to push an int32_t
push an int32_t onto the stack
function stack_push_f
bool stack_push_f(
STACK * stack,
float f
)
push a float onto the stack
Parameters:
- stack target STACK *stack
- f the float to push
Return: TRUE or FALSE
helper to push a float
push a float onto the stack
function stack_push_d
bool stack_push_d(
STACK * stack,
double d
)
push a double onto the stack
Parameters:
- stack target STACK *stack
- d the double to push
Return: TRUE or FALSE
helper to push a double
push a double onto the stack
function stack_push_c
bool stack_push_c(
STACK * stack,
char c
)
push a char onto the stack
Parameters:
- stack target STACK *stack
- c the char to push
Return: TRUE or FALSE
helper to push a char
push a char onto the stack
function stack_push_b
bool stack_push_b(
STACK * stack,
bool b
)
push a bool onto the stack
Parameters:
- stack target STACK *stack
- b the bool to push
Return: TRUE or FALSE
helper to push a bool
push a bool onto the stack
function stack_pop_ui8
uint8_t stack_pop_ui8(
STACK * stack,
uint8_t * status
)
pop a uint8_t from the stack
Parameters:
- stack target STACK *stack
- status pointer to uint8_t holding the result of the operation (STACK_IS_UNDEFINED,STACK_IS_EMPTY,STACK_ITEM_OK)
Return: the popped uint8_t
helper to pop a uint8_t
pop a uint8_t from the stack
function stack_pop_ui32
uint32_t stack_pop_ui32(
STACK * stack,
uint8_t * status
)
pop a uint32_t from the stack
Parameters:
- stack target STACK *stack
- status pointer to uint8_t holding the result of the operation (STACK_IS_UNDEFINED,STACK_IS_EMPTY,STACK_ITEM_OK)
Return: the popped uint32_t
helper to pop a uint32_t
pop a uint32_t from the stack
function stack_pop_p
void * stack_pop_p(
STACK * stack,
uint8_t * status
)
pop a pointer from the stack
Parameters:
- stack target STACK *stack
- status pointer to uint8_t holding the result of the operation (STACK_IS_UNDEFINED,STACK_IS_EMPTY,STACK_ITEM_OK)
Return: the popped pointer
helper to pop a pointer
pop a pointer from the stack
function stack_pop_i8
int8_t stack_pop_i8(
STACK * stack,
uint8_t * status
)
pop an int8_t from the stack
Parameters:
- stack target STACK *stack
- status pointer to uint8_t holding the result of the operation (STACK_IS_UNDEFINED,STACK_IS_EMPTY,STACK_ITEM_OK)
Return: the popped int8_t
helper to pop a int8_t
pop an int8_t from the stack
function stack_pop_i32
int32_t stack_pop_i32(
STACK * stack,
uint8_t * status
)
pop an int32_t from the stack
Parameters:
- stack target STACK *stack
- status pointer to uint8_t holding the result of the operation (STACK_IS_UNDEFINED,STACK_IS_EMPTY,STACK_ITEM_OK)
Return: the popped int32_t
helper to pop a int32_t
pop an int32_t from the stack
function stack_pop_f
float stack_pop_f(
STACK * stack,
uint8_t * status
)
pop a float from the stack
Parameters:
- stack target STACK *stack
- status pointer to uint8_t holding the result of the operation (STACK_IS_UNDEFINED,STACK_IS_EMPTY,STACK_ITEM_OK)
Return: the popped float
helper to pop a float
pop a float from the stack
function stack_pop_d
double stack_pop_d(
STACK * stack,
uint8_t * status
)
pop a double from the stack
Parameters:
- stack target STACK *stack
- status pointer to uint8_t holding the result of the operation (STACK_IS_UNDEFINED,STACK_IS_EMPTY,STACK_ITEM_OK)
Return: the popped double
helper to pop a double
pop a double from the stack
function stack_pop_c
char stack_pop_c(
STACK * stack,
uint8_t * status
)
pop a char from the stack
Parameters:
- stack target STACK *stack
- status pointer to uint8_t holding the result of the operation (STACK_IS_UNDEFINED,STACK_IS_EMPTY,STACK_ITEM_OK)
Return: the popped char
helper to pop a char
pop a char from the stack
function stack_pop_b
bool stack_pop_b(
STACK * stack,
uint8_t * status
)
pop a bool from the stack
Parameters:
- stack target STACK *stack
- status pointer to uint8_t holding the result of the operation (STACK_IS_UNDEFINED,STACK_IS_EMPTY,STACK_ITEM_OK)
Return: the popped bool
helper to pop a bool
pop a bool from the stack
function stack_peek
STACK_ITEM * stack_peek(
STACK * stack,
size_t position
)
peek at an item at given position without removing it
Parameters:
- stack the STACK *stack to peek
- position the position to peek
Return: a pointer to a STACK_ITEM or NULL
peek in the stack without removing the stack item
peek at an item at given position without removing it
function stack_is_full
bool stack_is_full(
const STACK * stack
)
check if the stack is full
Parameters:
- stack the STACK *stack to test
Return: TRUE or FALSE
test if the stack is full
check if the stack is full
function stack_is_empty
bool stack_is_empty(
const STACK * stack
)
check if the stack is empty
Parameters:
- stack the STACK *stack to test
Return: TRUE or FALSE
test if the stack is empty
check if the stack is empty
function new_stack
STACK * new_stack(
size_t nb_items
)
allocate a new stack
Parameters:
- size size of the new stack
Return: the new STACK *stack or NULL
allocate a new STACK
allocate a new stack
function delete_stack
bool delete_stack(
STACK ** stack
)
delete a stack and free its memory
Parameters:
- stack pointer to the STACK *stack to delete
Return: TRUE or FALSE
delete a STACK *stack
delete a stack and free its memory
Macros Documentation
define stack_push
#define stack_push(
__STACK,
__VAL
)
_Generic((__VAL), \
bool: stack_push_b, \
char: stack_push_c, \
uint8_t: stack_push_ui8, \
int8_t: stack_push_i8, \
uint32_t: stack_push_ui32, \
int32_t: stack_push_i32, \
float: stack_push_f, \
double: stack_push_d, \
void*: stack_push_p_default)(__STACK, __VAL)
define STACK_ITEM_WRONG_TYPE
#define STACK_ITEM_WRONG_TYPE 3
code for a bad item type
define STACK_ITEM_UINT8
#define STACK_ITEM_UINT8 3
v_type value for a uint8_t
define STACK_ITEM_UINT64
#define STACK_ITEM_UINT64 7
v_type value for a uint64_t
define STACK_ITEM_UINT32
#define STACK_ITEM_UINT32 5
v_type value for a uint32_t
define STACK_ITEM_PTR
#define STACK_ITEM_PTR 11
v_type value for a void *pointer
define STACK_ITEM_OK
#define STACK_ITEM_OK 4
code for a successfully retrieved item
define STACK_ITEM_INT8
#define STACK_ITEM_INT8 4
v_type value for a int8_t
define STACK_ITEM_INT64
#define STACK_ITEM_INT64 8
v_type value for a int64_t
define STACK_ITEM_INT32
#define STACK_ITEM_INT32 6
v_type value for a int32_t
define STACK_ITEM_FLOAT
#define STACK_ITEM_FLOAT 9
v_type value for a float
define STACK_ITEM_DOUBLE
#define STACK_ITEM_DOUBLE 10
v_type value for a double
define STACK_ITEM_CHAR
#define STACK_ITEM_CHAR 2
v_type value for a char
define STACK_ITEM_BOOL
#define STACK_ITEM_BOOL 1
v_type value for a bool
define STACK_IS_UNDEFINED
#define STACK_IS_UNDEFINED 2
code for a NULL stack state
define STACK_IS_FULL
#define STACK_IS_FULL 0
code for a full stack state
define STACK_IS_EMPTY
#define STACK_IS_EMPTY 1
code for an empty stack state
Modules
- AABB3D
- ACCEPT_POOL
- ALLEGRO4
- ALLEGRO5
- ANIM_LIB
- ASTAR
- ATLAS_LIB
- AVRO
- CLOCK_SYNC
- COMMONS
- CONFIGFILE
- CYPHER_BASE64
- CYPHER_VIGENERE
- DEAD_RECKONING
- ENUMS
- EXCEPTIONS
- GAME_ENV
- GIT
- GUI
- HASH_TABLE
- ISOMETRIC_ENGINE
- LIST
- LOG
- LOGNODUP
- LZ4
- NETWORKING
- NETWORK_MSG
- N_COOKIES
- N_DIFF
- N_DIGEST
- N_DISK_CACHE
- N_DNS
- N_ECC
- N_ENTROPY
- N_FILES
- N_FLUIDS
- N_GUI_COLOR
- N_GUI_COLORWHEEL
- N_GUI_CURVE
- N_GUI_GRID
- N_GUI_POPUP
- N_HEX
- N_HTTP3
- N_HTTP_COOKIE
- N_HTTP_FORM
- N_HTTP_MIME
- N_HTTP_REQ
- N_HTTP_RESP
- N_HTTP_ROUTER
- N_HTTP_SERVER
- N_ICC
- N_JSON
- N_KAFKA
- N_LINALG
- N_MODULE
- N_OPENSSL_COMPAT
- N_PRETTY
- N_PTH
- N_QUERY
- N_RANDOM
- N_SHA256
- N_STR
- N_TIFF
- N_TIME
- N_USER
- N_X509
- N_ZIP
- PARTICLES
- PCRE
- PHYSICS
- SIGNALS
- STACK
- THREADS
- TRAJECTORY
- TREE
- ZLIB