![]() |
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 *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 |
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 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 | |||
| ) |
| 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 56 of file n_stack.c.
References nb_items.
Referenced by stack_peek().
Here is the caller graph for this function:| bool stack_is_full | ( | STACK * | stack | ) |
| 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 66 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 | ||
| ) |
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 177 of file n_stack.c.
References __n_assert, __stack_pop(), STACK_DATA::b, STACK_ITEM::data, stack_array, 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 | ||
| ) |
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 221 of file n_stack.c.
References __n_assert, __stack_pop(), STACK_DATA::c, STACK_ITEM::data, stack_array, STACK_IS_UNDEFINED, STACK_ITEM_CHAR, STACK_ITEM_OK, STACK_ITEM_WRONG_TYPE, tail, and STACK_ITEM::v_type.
Here is the call graph for this function:| 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 485 of file n_stack.c.
References __n_assert, __stack_pop(), STACK_DATA::d, STACK_ITEM::data, stack_array, STACK_IS_UNDEFINED, STACK_ITEM_DOUBLE, STACK_ITEM_OK, STACK_ITEM_WRONG_TYPE, tail, and STACK_ITEM::v_type.
Here is the call graph for this function:| 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 441 of file n_stack.c.
References __n_assert, __stack_pop(), STACK_ITEM::data, STACK_DATA::f, stack_array, STACK_IS_UNDEFINED, STACK_ITEM_FLOAT, STACK_ITEM_OK, STACK_ITEM_WRONG_TYPE, tail, and STACK_ITEM::v_type.
Here is the call graph for this function:| 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 397 of file n_stack.c.
References __n_assert, __stack_pop(), STACK_ITEM::data, STACK_DATA::i32, stack_array, 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 | ||
| ) |
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 309 of file n_stack.c.
References __n_assert, __stack_pop(), STACK_ITEM::data, STACK_DATA::i8, stack_array, STACK_IS_UNDEFINED, STACK_ITEM_INT8, STACK_ITEM_OK, STACK_ITEM_WRONG_TYPE, tail, and STACK_ITEM::v_type.
Here is the call graph for this function:| 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 531 of file n_stack.c.
References __n_assert, __stack_pop(), STACK_ITEM::data, STACK_DATA::p, stack_array, STACK_IS_UNDEFINED, STACK_ITEM_OK, STACK_ITEM_PTR, STACK_ITEM_WRONG_TYPE, tail, and STACK_ITEM::v_type.
Here is the call graph for this function:| 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 353 of file n_stack.c.
References __n_assert, __stack_pop(), STACK_ITEM::data, stack_array, STACK_IS_UNDEFINED, STACK_ITEM_OK, STACK_ITEM_UINT32, STACK_ITEM_WRONG_TYPE, tail, STACK_DATA::ui32, and STACK_ITEM::v_type.
Here is the call graph for this function:| 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 265 of file n_stack.c.
References __n_assert, __stack_pop(), STACK_ITEM::data, stack_array, STACK_IS_UNDEFINED, STACK_ITEM_OK, STACK_ITEM_UINT8, STACK_ITEM_WRONG_TYPE, tail, STACK_DATA::ui8, and STACK_ITEM::v_type.
Here is the call graph for this function:| 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 159 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 | ||
| ) |
helper to push a char
| stack | target STACK *stack |
| c | the char to push |
Definition at line 201 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 | ||
| ) |
helper to push a double
| stack | target STACK *stack |
| d | the double to push |
Definition at line 465 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 | ||
| ) |
helper to push a float
| stack | target STACK *stack |
| f | the float to push |
Definition at line 421 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 | ||
| ) |
helper to push an int32_t
| stack | target STACK *stack |
| i32 | the int32 to push |
Definition at line 377 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 | ||
| ) |
helper to push an int8_t
| stack | target STACK *stack |
| i8 | the int8_t to push |
Definition at line 289 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 | ||
| ) |
helper to push a pointer
| stack | target STACK *stack |
| p | the pointer to push |
| p_type | the pointer type |
Definition at line 510 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.
Here is the call graph for this function:| 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 333 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 | ||
| ) |
helper to push an uint8_t
| stack | target STACK *stack |
| ui8 | the uint8_t to push |
Definition at line 245 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: