![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
Data Structures | |
struct | STACK |
STACK structure. More... | |
union | STACK_DATA |
structure of a STACK_ITEM data More... | |
struct | STACK_ITEM |
structure of a STACK item More... | |
Macros | |
#define | STACK_IS_EMPTY 1 |
code for an empty stack state | |
#define | STACK_IS_FULL 0 |
code for a full stack state | |
#define | STACK_IS_UNDEFINED 2 |
code for a NULL stack state | |
#define | STACK_ITEM_BOOL 1 |
v_type value for a bool | |
#define | STACK_ITEM_CHAR 2 |
v_type value for a char | |
#define | STACK_ITEM_DOUBLE 10 |
v_type value for a double | |
#define | STACK_ITEM_FLOAT 9 |
v_type value for a float | |
#define | STACK_ITEM_INT32 6 |
v_type value for a int32_t | |
#define | STACK_ITEM_INT64 8 |
v_type value for a int64_t | |
#define | STACK_ITEM_INT8 4 |
v_type value for a int8_t | |
#define | STACK_ITEM_OK 4 |
code for a successfully retrieved item | |
#define | STACK_ITEM_PTR 11 |
v_type value for a void *pointer | |
#define | STACK_ITEM_UINT32 5 |
v_type value for a uint32_t | |
#define | STACK_ITEM_UINT64 7 |
v_type value for a uint64_t | |
#define | STACK_ITEM_UINT8 3 |
v_type value for a uint8_t | |
#define | STACK_ITEM_WRONG_TYPE 3 |
code for a bad item type | |
#define | stack_push(__STACK, __VAL) |
stack push helper with automatic value selection | |
Functions | |
bool | delete_stack (STACK **stack) |
delete a STACK *stack | |
STACK * | new_stack (size_t nb_items) |
allocate a new STACK | |
bool | stack_is_empty (STACK *stack) |
test if the stack is empty | |
bool | stack_is_full (STACK *stack) |
test if the stack is full | |
STACK_ITEM * | stack_peek (STACK *stack, size_t position) |
peek in the stack with un stacking the stack item | |
bool | stack_pop_b (STACK *stack, uint8_t *status) |
helper to pop a bool | |
char | stack_pop_c (STACK *stack, uint8_t *status) |
helper to pop a char | |
double | stack_pop_d (STACK *stack, uint8_t *status) |
helper to pop a double | |
float | stack_pop_f (STACK *stack, uint8_t *status) |
helper to pop a float | |
int32_t | stack_pop_i32 (STACK *stack, uint8_t *status) |
helper to pop a int32_t | |
int8_t | stack_pop_i8 (STACK *stack, uint8_t *status) |
helper to pop a int8_t | |
void * | stack_pop_p (STACK *stack, uint8_t *status) |
helper to pop a pointer | |
uint32_t | stack_pop_ui32 (STACK *stack, uint8_t *status) |
helper to pop a uint32_t | |
uint8_t | stack_pop_ui8 (STACK *stack, uint8_t *status) |
helper to pop a uint8_t | |
bool | stack_push_b (STACK *stack, bool b) |
helper to push a bool | |
bool | stack_push_c (STACK *stack, char c) |
helper to push a char | |
bool | stack_push_d (STACK *stack, double d) |
helper to push a double | |
bool | stack_push_f (STACK *stack, float f) |
helper to push a float | |
bool | stack_push_i32 (STACK *stack, int32_t i32) |
helper to push an int32_t | |
bool | stack_push_i8 (STACK *stack, int8_t i8) |
helper to push an int8_t | |
bool | stack_push_p (STACK *stack, void *p, uint16_t p_type) |
helper to push a pointer | |
bool | stack_push_ui32 (STACK *stack, uint32_t ui32) |
helper to push an uint32_t | |
bool | stack_push_ui8 (STACK *stack, uint8_t ui8) |
helper to push an uint8_t | |
struct STACK |
Data Fields | ||
---|---|---|
size_t | head | position of head |
size_t | nb_items | number of item inside stack |
size_t | size | Size of array. |
STACK_ITEM * | stack_array | STACK_ITEM array. |
size_t | tail | position of tail |
union STACK_DATA |
structure of a STACK_ITEM data
Data Fields | ||
---|---|---|
bool | b | boolean |
char | c | single character |
double | d | double |
float | f | float |
int32_t | i32 | int 32 |
int8_t | i8 | int 8 |
void * | p | pointer |
uint32_t | ui32 | unsigned int 32 |
uint8_t | ui8 | unsigned int 8 |
struct STACK_ITEM |
Data Fields | ||
---|---|---|
union STACK_DATA | data | union of different types |
bool | is_empty | is item set ? |
bool | is_set | is item empty ? |
uint16_t | p_type | if v_type is STACK_ITEM_PTR, user defined pointer type |
uint8_t | v_type | type of the item |
#define STACK_IS_UNDEFINED 2 |
#define STACK_ITEM_BOOL 1 |
#define STACK_ITEM_INT32 6 |
#define STACK_ITEM_OK 4 |
#define stack_push | ( | __STACK, | |
__VAL | |||
) |
stack push helper with automatic value selection
bool delete_stack | ( | STACK ** | stack | ) |
STACK * new_stack | ( | size_t | size | ) |
bool stack_is_empty | ( | STACK * | stack | ) |
test if the stack is empty
stack | the STACK *stack to test |
Definition at line 61 of file n_stack.c.
Referenced by stack_peek().
bool stack_is_full | ( | STACK * | stack | ) |
test if the stack is full
stack | the STACK *stack to test |
Definition at line 51 of file n_stack.c.
Referenced by __stack_push().
STACK_ITEM * stack_peek | ( | STACK * | stack, |
size_t | position | ||
) |
peek in the stack with un stacking the stack item
stack | the STACK *stack to peek |
position | the position to peek |
Definition at line 72 of file n_stack.c.
References __n_assert, and stack_is_empty().
bool stack_pop_b | ( | STACK * | stack, |
uint8_t * | status | ||
) |
helper to pop a bool
stack | target STACK *stack |
status | pointer to uint8_t holding the result of the operation (STACK_IS_UNDEFINED,STACK_IS_EMPTY,STACK_ITEM_OK) |
Definition at line 197 of file n_stack.c.
References __n_assert, __stack_pop(), STACK_IS_UNDEFINED, STACK_ITEM_BOOL, STACK_ITEM_OK, and STACK_ITEM_WRONG_TYPE.
char stack_pop_c | ( | STACK * | stack, |
uint8_t * | status | ||
) |
helper to pop a char
stack | target STACK *stack |
status | pointer to uint8_t holding the result of the operation (STACK_IS_UNDEFINED,STACK_IS_EMPTY,STACK_ITEM_OK) |
Definition at line 246 of file n_stack.c.
References __n_assert, __stack_pop(), STACK_IS_UNDEFINED, STACK_ITEM_CHAR, STACK_ITEM_OK, and STACK_ITEM_WRONG_TYPE.
double stack_pop_d | ( | STACK * | stack, |
uint8_t * | status | ||
) |
helper to pop a double
stack | target STACK *stack |
status | pointer to uint8_t holding the result of the operation (STACK_IS_UNDEFINED,STACK_IS_EMPTY,STACK_ITEM_OK) |
Definition at line 536 of file n_stack.c.
References __n_assert, __stack_pop(), STACK_IS_UNDEFINED, STACK_ITEM_DOUBLE, STACK_ITEM_OK, and STACK_ITEM_WRONG_TYPE.
float stack_pop_f | ( | STACK * | stack, |
uint8_t * | status | ||
) |
helper to pop a float
stack | target STACK *stack |
status | pointer to uint8_t holding the result of the operation (STACK_IS_UNDEFINED,STACK_IS_EMPTY,STACK_ITEM_OK) |
Definition at line 488 of file n_stack.c.
References __n_assert, __stack_pop(), STACK_IS_UNDEFINED, STACK_ITEM_FLOAT, STACK_ITEM_OK, and STACK_ITEM_WRONG_TYPE.
int32_t stack_pop_i32 | ( | STACK * | stack, |
uint8_t * | status | ||
) |
helper to pop a int32_t
stack | target STACK *stack |
status | pointer to uint8_t holding the result of the operation (STACK_IS_UNDEFINED,STACK_IS_EMPTY,STACK_ITEM_OK) |
Definition at line 440 of file n_stack.c.
References __n_assert, __stack_pop(), STACK_IS_UNDEFINED, STACK_ITEM_INT32, STACK_ITEM_OK, and STACK_ITEM_WRONG_TYPE.
int8_t stack_pop_i8 | ( | STACK * | stack, |
uint8_t * | status | ||
) |
helper to pop a int8_t
stack | target STACK *stack |
status | pointer to uint8_t holding the result of the operation (STACK_IS_UNDEFINED,STACK_IS_EMPTY,STACK_ITEM_OK) |
Definition at line 344 of file n_stack.c.
References __n_assert, __stack_pop(), STACK_IS_UNDEFINED, STACK_ITEM_INT8, STACK_ITEM_OK, and STACK_ITEM_WRONG_TYPE.
void * stack_pop_p | ( | STACK * | stack, |
uint8_t * | status | ||
) |
helper to pop a pointer
stack | target STACK *stack |
status | pointer to uint8_t holding the result of the operation (STACK_IS_UNDEFINED,STACK_IS_EMPTY,STACK_ITEM_OK) |
Definition at line 588 of file n_stack.c.
References __n_assert, __stack_pop(), STACK_IS_UNDEFINED, STACK_ITEM_OK, STACK_ITEM_PTR, and STACK_ITEM_WRONG_TYPE.
uint32_t stack_pop_ui32 | ( | STACK * | stack, |
uint8_t * | status | ||
) |
helper to pop a uint32_t
stack | target STACK *stack |
status | pointer to uint8_t holding the result of the operation (STACK_IS_UNDEFINED,STACK_IS_EMPTY,STACK_ITEM_OK) |
Definition at line 392 of file n_stack.c.
References __n_assert, __stack_pop(), STACK_IS_UNDEFINED, STACK_ITEM_OK, STACK_ITEM_UINT32, and STACK_ITEM_WRONG_TYPE.
uint8_t stack_pop_ui8 | ( | STACK * | stack, |
uint8_t * | status | ||
) |
helper to pop a uint8_t
stack | target STACK *stack |
status | pointer to uint8_t holding the result of the operation (STACK_IS_UNDEFINED,STACK_IS_EMPTY,STACK_ITEM_OK) |
Definition at line 296 of file n_stack.c.
References __n_assert, __stack_pop(), STACK_IS_UNDEFINED, STACK_ITEM_OK, STACK_ITEM_UINT8, and STACK_ITEM_WRONG_TYPE.
bool stack_push_b | ( | STACK * | stack, |
bool | b | ||
) |
helper to push a bool
stack | target STACK *stack |
b | the bool to push |
Definition at line 178 of file n_stack.c.
References __stack_push(), STACK_ITEM_BOOL, and STACK_ITEM_OK.
bool stack_push_c | ( | STACK * | stack, |
char | c | ||
) |
helper to push a char
stack | target STACK *stack |
c | the char to push |
Definition at line 225 of file n_stack.c.
References __stack_push(), STACK_ITEM_CHAR, and STACK_ITEM_OK.
bool stack_push_d | ( | STACK * | stack, |
double | d | ||
) |
helper to push a double
stack | target STACK *stack |
d | the double to push |
Definition at line 515 of file n_stack.c.
References __stack_push(), STACK_ITEM_DOUBLE, and STACK_ITEM_OK.
bool stack_push_f | ( | STACK * | stack, |
float | f | ||
) |
helper to push a float
stack | target STACK *stack |
f | the float to push |
Definition at line 467 of file n_stack.c.
References __stack_push(), STACK_ITEM_FLOAT, and STACK_ITEM_OK.
bool stack_push_i32 | ( | STACK * | stack, |
int32_t | i32 | ||
) |
helper to push an int32_t
stack | target STACK *stack |
i32 | the int32 to push |
Definition at line 419 of file n_stack.c.
References __stack_push(), STACK_ITEM_INT32, and STACK_ITEM_OK.
bool stack_push_i8 | ( | STACK * | stack, |
int8_t | i8 | ||
) |
helper to push an int8_t
stack | target STACK *stack |
i8 | the int8_t to push |
Definition at line 323 of file n_stack.c.
References __stack_push(), STACK_ITEM_INT8, and STACK_ITEM_OK.
bool stack_push_p | ( | STACK * | stack, |
void * | p, | ||
uint16_t | p_type | ||
) |
helper to push a pointer
stack | target STACK *stack |
p | the pointer to push |
p_type | the pointer type |
Definition at line 565 of file n_stack.c.
References __stack_push(), STACK_ITEM_OK, and STACK_ITEM_PTR.
bool stack_push_ui32 | ( | STACK * | stack, |
uint32_t | ui32 | ||
) |
helper to push an uint32_t
stack | target STACK *stack |
ui32 | the uint32 to push |
Definition at line 371 of file n_stack.c.
References __stack_push(), STACK_ITEM_OK, and STACK_ITEM_UINT32.
bool stack_push_ui8 | ( | STACK * | stack, |
uint8_t | ui8 | ||
) |
helper to push an uint8_t
stack | target STACK *stack |
ui8 | the uint8_t to push |
Definition at line 275 of file n_stack.c.
References __stack_push(), STACK_ITEM_OK, and STACK_ITEM_UINT8.