8#ifndef __N_STACK_HEADER
9#define __N_STACK_HEADER
23#define STACK_ITEM_BOOL 1
25#define STACK_ITEM_CHAR 2
27#define STACK_ITEM_UINT8 3
29#define STACK_ITEM_INT8 4
31#define STACK_ITEM_UINT32 5
33#define STACK_ITEM_INT32 6
35#define STACK_ITEM_UINT64 7
37#define STACK_ITEM_INT64 8
39#define STACK_ITEM_FLOAT 9
41#define STACK_ITEM_DOUBLE 10
43#define STACK_ITEM_PTR 11
46#define STACK_IS_FULL 0
48#define STACK_IS_EMPTY 1
50#define STACK_IS_UNDEFINED 2
52#define STACK_ITEM_WRONG_TYPE 3
54#define STACK_ITEM_OK 4
114#define stack_push(__STACK, __VAL) \
116 bool: stack_push_b, \
117 char: stack_push_c, \
118 uint8_t: stack_push_ui8, \
119 int8_t: stack_push_i8, \
120 uint32_t: stack_push_ui32, \
121 int32_t: stack_push_i32, \
122 uint64_t: stack_push_ui64, \
123 int64_t: stack_push_i64, \
124 float: stack_push_f, \
125 double: stack_push_d, \
126 void*: stack_push_p)(__STACK, __VAL)
129#define stack_push(__STACK, __VAL) \
131 bool: stack_push_b, \
132 char: stack_push_c, \
133 uint8_t: stack_push_ui8, \
134 int8_t: stack_push_i8, \
135 uint32_t: stack_push_ui32, \
136 int32_t: stack_push_i32, \
137 float: stack_push_f, \
138 double: stack_push_d, \
139 void*: stack_push_p)(__STACK, __VAL)
169bool stack_push_ui64(
STACK* stack, uint64_t ui64_t);
170bool stack_push_i64(
STACK* stack, int64_t i64);
171uint64_t stack_pop_ui64(
STACK* stack, uint8_t* status);
172int64_t stack_pop_i64(
STACK* stack, uint8_t* status);
size_t tail
position of tail
bool is_empty
is item set ?
size_t head
position of head
size_t nb_items
number of item inside stack
STACK_ITEM * stack_array
STACK_ITEM array.
uint16_t p_type
if v_type is STACK_ITEM_PTR, user defined pointer type
union STACK_DATA data
union of different types
size_t size
Size of array.
uint8_t v_type
type of the item
bool is_set
is item empty ?
uint32_t ui32
unsigned int 32
uint8_t ui8
unsigned int 8
bool stack_push_f(STACK *stack, float f)
helper to push a float
bool stack_is_empty(STACK *stack)
test if the stack is empty
double stack_pop_d(STACK *stack, uint8_t *status)
helper to pop a double
bool stack_pop_b(STACK *stack, uint8_t *status)
helper to pop a bool
bool stack_push_d(STACK *stack, double d)
helper to push a double
bool stack_push_ui8(STACK *stack, uint8_t ui8)
helper to push an uint8_t
STACK_ITEM * stack_peek(STACK *stack, size_t position)
peek in the stack with un stacking the stack item
bool stack_is_full(STACK *stack)
test if the stack is full
bool stack_push_ui32(STACK *stack, uint32_t ui32)
helper to push an uint32_t
int8_t stack_pop_i8(STACK *stack, uint8_t *status)
helper to pop a int8_t
char stack_pop_c(STACK *stack, uint8_t *status)
helper to pop a char
float stack_pop_f(STACK *stack, uint8_t *status)
helper to pop a float
uint8_t stack_pop_ui8(STACK *stack, uint8_t *status)
helper to pop a uint8_t
bool stack_push_c(STACK *stack, char c)
helper to push a char
uint32_t stack_pop_ui32(STACK *stack, uint8_t *status)
helper to pop a uint32_t
bool stack_push_b(STACK *stack, bool b)
helper to push a bool
bool stack_push_i32(STACK *stack, int32_t i32)
helper to push an int32_t
int32_t stack_pop_i32(STACK *stack, uint8_t *status)
helper to pop a int32_t
bool delete_stack(STACK **stack)
delete a STACK *stack
bool stack_push_i8(STACK *stack, int8_t i8)
helper to push an int8_t
STACK * new_stack(size_t nb_items)
allocate a new STACK
bool stack_push_p(STACK *stack, void *p, uint16_t p_type)
helper to push a pointer
void * stack_pop_p(STACK *stack, uint8_t *status)
helper to pop a pointer
structure of a STACK item
structure of a STACK_ITEM data
Common headers and low-level functions & define.