![]() |
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) |
Functions | |
| bool | delete_stack (STACK **stack) |
| delete a stack and free its memory | |
| STACK * | new_stack (size_t nb_items) |
| allocate a new stack | |
| bool | stack_is_empty (const STACK *stack) |
| check if the stack is empty | |
| bool | stack_is_full (const STACK *stack) |
| check if the stack is full | |
| STACK_ITEM * | stack_peek (STACK *stack, size_t position) |
| peek at an item at given position without removing it | |
| bool | stack_pop_b (STACK *stack, uint8_t *status) |
| pop a bool from the stack | |
| char | stack_pop_c (STACK *stack, uint8_t *status) |
| pop a char from the stack | |
| double | stack_pop_d (STACK *stack, uint8_t *status) |
| pop a double from the stack | |
| float | stack_pop_f (STACK *stack, uint8_t *status) |
| pop a float from the stack | |
| int32_t | stack_pop_i32 (STACK *stack, uint8_t *status) |
| pop an int32_t from the stack | |
| int8_t | stack_pop_i8 (STACK *stack, uint8_t *status) |
| pop an int8_t from the stack | |
| void * | stack_pop_p (STACK *stack, uint8_t *status) |
| pop a pointer from the stack | |
| uint32_t | stack_pop_ui32 (STACK *stack, uint8_t *status) |
| pop a uint32_t from the stack | |
| uint8_t | stack_pop_ui8 (STACK *stack, uint8_t *status) |
| pop a uint8_t from the stack | |
| bool | stack_push_b (STACK *stack, bool b) |
| push a bool onto the stack | |
| bool | stack_push_c (STACK *stack, char c) |
| push a char onto the stack | |
| bool | stack_push_d (STACK *stack, double d) |
| push a double onto the stack | |
| bool | stack_push_f (STACK *stack, float f) |
| push a float onto the stack | |
| bool | stack_push_i32 (STACK *stack, int32_t i32) |
| push an int32_t onto the stack | |
| bool | stack_push_i8 (STACK *stack, int8_t i8) |
| push an int8_t onto the stack | |
| 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_p_default (STACK *stack, void *p) |
| push a pointer onto the stack with default type | |
| bool | stack_push_ui32 (STACK *stack, uint32_t ui32) |
| push a uint32_t onto the stack | |
| bool | stack_push_ui8 (STACK *stack, uint8_t ui8) |
| push a uint8_t onto the stack | |
| struct STACK |
Collaboration diagram for 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
Collaboration diagram for STACK_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 |
Collaboration diagram for STACK_ITEM:| Data Fields | ||
|---|---|---|
| union STACK_DATA | data | union of different types |
| bool | is_empty | is item empty ? |
| bool | is_set | is item set ? |
| 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_CHAR 2 |
| #define STACK_ITEM_DOUBLE 10 |
| #define STACK_ITEM_FLOAT 9 |
| #define STACK_ITEM_INT32 6 |
| #define STACK_ITEM_INT8 4 |
| #define STACK_ITEM_OK 4 |
| #define STACK_ITEM_PTR 11 |
| #define STACK_ITEM_UINT32 5 |
| #define STACK_ITEM_UINT8 3 |
| #define stack_push | ( | __STACK, | |
| __VAL | |||
| ) |
| bool delete_stack | ( | STACK ** | stack | ) |
| STACK * new_stack | ( | size_t | size | ) |
allocate a new stack
allocate a new stack
| size | size of the new stack |
Definition at line 34 of file n_stack.c.
References __n_assert, Free, head, LOG_ERR, Malloc, n_log, nb_items, size, stack_array, and tail.
Referenced by main().
Here is the caller graph for this function:| bool stack_is_empty | ( | const STACK * | stack | ) |
| bool stack_is_full | ( | const STACK * | stack | ) |
| STACK_ITEM * stack_peek | ( | STACK * | stack, |
| size_t | position | ||
| ) |
peek at an item at given position without removing it
peek at an item at given position without removing it
| stack | the STACK *stack to peek |
| position | the position to peek |
Definition at line 92 of file n_stack.c.
References __n_assert, head, STACK_ITEM::is_set, stack_array, stack_is_empty(), and tail.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| bool stack_pop_b | ( | STACK * | stack, |
| uint8_t * | status | ||
| ) |
pop a bool from the stack
pop a bool from the stack
| 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 203 of file n_stack.c.
References __n_assert, __stack_pop(), STACK_DATA::b, STACK_ITEM::data, head, stack_array, STACK_IS_EMPTY, STACK_IS_UNDEFINED, STACK_ITEM_BOOL, STACK_ITEM_OK, STACK_ITEM_WRONG_TYPE, tail, and STACK_ITEM::v_type.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| char stack_pop_c | ( | STACK * | stack, |
| uint8_t * | status | ||
| ) |
pop a char from the stack
pop a char from the stack
| 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 252 of file n_stack.c.
References __n_assert, __stack_pop(), STACK_DATA::c, STACK_ITEM::data, head, stack_array, STACK_IS_EMPTY, STACK_IS_UNDEFINED, STACK_ITEM_CHAR, STACK_ITEM_OK, STACK_ITEM_WRONG_TYPE, tail, and STACK_ITEM::v_type.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| double stack_pop_d | ( | STACK * | stack, |
| uint8_t * | status | ||
| ) |
pop a double from the stack
pop a double from the stack
| 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 546 of file n_stack.c.
References __n_assert, __stack_pop(), STACK_DATA::d, STACK_ITEM::data, head, stack_array, STACK_IS_EMPTY, STACK_IS_UNDEFINED, STACK_ITEM_DOUBLE, STACK_ITEM_OK, STACK_ITEM_WRONG_TYPE, tail, and STACK_ITEM::v_type.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| float stack_pop_f | ( | STACK * | stack, |
| uint8_t * | status | ||
| ) |
pop a float from the stack
pop a float from the stack
| 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 497 of file n_stack.c.
References __n_assert, __stack_pop(), STACK_ITEM::data, STACK_DATA::f, head, stack_array, STACK_IS_EMPTY, STACK_IS_UNDEFINED, STACK_ITEM_FLOAT, STACK_ITEM_OK, STACK_ITEM_WRONG_TYPE, tail, and STACK_ITEM::v_type.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| int32_t stack_pop_i32 | ( | STACK * | stack, |
| uint8_t * | status | ||
| ) |
pop an int32_t from the stack
pop an int32_t from the stack
| 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 448 of file n_stack.c.
References __n_assert, __stack_pop(), STACK_ITEM::data, head, STACK_DATA::i32, stack_array, STACK_IS_EMPTY, STACK_IS_UNDEFINED, STACK_ITEM_INT32, STACK_ITEM_OK, STACK_ITEM_WRONG_TYPE, tail, and STACK_ITEM::v_type.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| int8_t stack_pop_i8 | ( | STACK * | stack, |
| uint8_t * | status | ||
| ) |
pop an int8_t from the stack
pop an int8_t from the stack
| 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 350 of file n_stack.c.
References __n_assert, __stack_pop(), STACK_ITEM::data, head, STACK_DATA::i8, stack_array, STACK_IS_EMPTY, STACK_IS_UNDEFINED, STACK_ITEM_INT8, STACK_ITEM_OK, STACK_ITEM_WRONG_TYPE, tail, and STACK_ITEM::v_type.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| void * stack_pop_p | ( | STACK * | stack, |
| uint8_t * | status | ||
| ) |
pop a pointer from the stack
pop a pointer from the stack
| 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 597 of file n_stack.c.
References __n_assert, __stack_pop(), STACK_ITEM::data, head, STACK_DATA::p, stack_array, STACK_IS_EMPTY, STACK_IS_UNDEFINED, STACK_ITEM_OK, STACK_ITEM_PTR, STACK_ITEM_WRONG_TYPE, tail, and STACK_ITEM::v_type.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| uint32_t stack_pop_ui32 | ( | STACK * | stack, |
| uint8_t * | status | ||
| ) |
pop a uint32_t from the stack
pop a uint32_t from the stack
| 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 399 of file n_stack.c.
References __n_assert, __stack_pop(), STACK_ITEM::data, head, stack_array, STACK_IS_EMPTY, STACK_IS_UNDEFINED, STACK_ITEM_OK, STACK_ITEM_UINT32, STACK_ITEM_WRONG_TYPE, tail, STACK_DATA::ui32, and STACK_ITEM::v_type.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| uint8_t stack_pop_ui8 | ( | STACK * | stack, |
| uint8_t * | status | ||
| ) |
pop a uint8_t from the stack
pop a uint8_t from the stack
| 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 301 of file n_stack.c.
References __n_assert, __stack_pop(), STACK_ITEM::data, head, stack_array, STACK_IS_EMPTY, STACK_IS_UNDEFINED, STACK_ITEM_OK, STACK_ITEM_UINT8, STACK_ITEM_WRONG_TYPE, tail, STACK_DATA::ui8, and STACK_ITEM::v_type.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| bool stack_push_b | ( | STACK * | stack, |
| bool | b | ||
| ) |
push a bool onto the stack
push a bool onto the stack
| stack | target STACK *stack |
| b | the bool to push |
Definition at line 185 of file n_stack.c.
References __stack_push(), STACK_DATA::b, STACK_ITEM::data, head, stack_array, STACK_ITEM_BOOL, STACK_ITEM_OK, and STACK_ITEM::v_type.
Here is the call graph for this function:| bool stack_push_c | ( | STACK * | stack, |
| char | c | ||
| ) |
push a char onto the stack
push a char onto the stack
| stack | target STACK *stack |
| c | the char to push |
Definition at line 232 of file n_stack.c.
References __stack_push(), STACK_DATA::c, STACK_ITEM::data, head, stack_array, STACK_ITEM_CHAR, STACK_ITEM_OK, and STACK_ITEM::v_type.
Here is the call graph for this function:| bool stack_push_d | ( | STACK * | stack, |
| double | d | ||
| ) |
push a double onto the stack
push a double onto the stack
| stack | target STACK *stack |
| d | the double to push |
Definition at line 526 of file n_stack.c.
References __stack_push(), STACK_DATA::d, STACK_ITEM::data, head, stack_array, STACK_ITEM_DOUBLE, STACK_ITEM_OK, and STACK_ITEM::v_type.
Here is the call graph for this function:| bool stack_push_f | ( | STACK * | stack, |
| float | f | ||
| ) |
push a float onto the stack
push a float onto the stack
| stack | target STACK *stack |
| f | the float to push |
Definition at line 477 of file n_stack.c.
References __stack_push(), STACK_ITEM::data, STACK_DATA::f, head, stack_array, STACK_ITEM_FLOAT, STACK_ITEM_OK, and STACK_ITEM::v_type.
Here is the call graph for this function:| bool stack_push_i32 | ( | STACK * | stack, |
| int32_t | i32 | ||
| ) |
push an int32_t onto the stack
push an int32_t onto the stack
| stack | target STACK *stack |
| i32 | the int32 to push |
Definition at line 428 of file n_stack.c.
References __stack_push(), STACK_ITEM::data, head, STACK_DATA::i32, stack_array, STACK_ITEM_INT32, STACK_ITEM_OK, and STACK_ITEM::v_type.
Here is the call graph for this function:| bool stack_push_i8 | ( | STACK * | stack, |
| int8_t | i8 | ||
| ) |
push an int8_t onto the stack
push an int8_t onto the stack
| stack | target STACK *stack |
| i8 | the int8_t to push |
Definition at line 330 of file n_stack.c.
References __stack_push(), STACK_ITEM::data, head, STACK_DATA::i8, stack_array, STACK_ITEM_INT8, STACK_ITEM_OK, and STACK_ITEM::v_type.
Here is the call graph for this function:| bool stack_push_p | ( | STACK * | stack, |
| void * | p, | ||
| uint16_t | p_type | ||
| ) |
push a pointer onto the stack with a custom type
push a pointer onto the stack with a custom type
| stack | target STACK *stack |
| p | the pointer to push |
| p_type | the pointer type |
Definition at line 576 of file n_stack.c.
References __stack_push(), STACK_ITEM::data, head, STACK_DATA::p, STACK_ITEM::p_type, stack_array, STACK_ITEM_OK, STACK_ITEM_PTR, and STACK_ITEM::v_type.
Referenced by stack_push_p_default().
Here is the call graph for this function:
Here is the caller graph for this function:| bool stack_push_p_default | ( | STACK * | stack, |
| void * | p | ||
| ) |
push a pointer onto the stack with default type
push a pointer onto the stack with default type
| stack | target STACK *stack |
| p | the pointer to push |
Definition at line 626 of file n_stack.c.
References stack_push_p().
Here is the call graph for this function:| bool stack_push_ui32 | ( | STACK * | stack, |
| uint32_t | ui32 | ||
| ) |
push a uint32_t onto the stack
push a uint32_t onto the stack
| stack | target STACK *stack |
| ui32 | the uint32 to push |
Definition at line 379 of file n_stack.c.
References __stack_push(), STACK_ITEM::data, head, stack_array, STACK_ITEM_OK, STACK_ITEM_UINT32, STACK_DATA::ui32, and STACK_ITEM::v_type.
Here is the call graph for this function:| bool stack_push_ui8 | ( | STACK * | stack, |
| uint8_t | ui8 | ||
| ) |
push a uint8_t onto the stack
push a uint8_t onto the stack
| stack | target STACK *stack |
| ui8 | the uint8_t to push |
Definition at line 281 of file n_stack.c.
References __stack_push(), STACK_ITEM::data, head, stack_array, STACK_ITEM_OK, STACK_ITEM_UINT8, STACK_DATA::ui8, and STACK_ITEM::v_type.
Here is the call graph for this function: