8#ifndef __N_STACK_HEADER
9#define __N_STACK_HEADER
24#define STACK_ITEM_BOOL 1
26#define STACK_ITEM_CHAR 2
28#define STACK_ITEM_UINT8 3
30#define STACK_ITEM_INT8 4
32#define STACK_ITEM_UINT32 5
34#define STACK_ITEM_INT32 6
36#define STACK_ITEM_UINT64 7
38#define STACK_ITEM_INT64 8
40#define STACK_ITEM_FLOAT 9
42#define STACK_ITEM_DOUBLE 10
44#define STACK_ITEM_PTR 11
47#define STACK_IS_FULL 0
49#define STACK_IS_EMPTY 1
51#define STACK_IS_UNDEFINED 2
53#define STACK_ITEM_WRONG_TYPE 3
55#define STACK_ITEM_OK 4
119#define stack_push( __STACK , __VAL ) \
121 bool: stack_push_b, \
122 char: stack_push_c, \
123 uint8_t: stack_push_ui8, \
124 int8_t: stack_push_i8, \
125 uint32_t: stack_push_ui32, \
126 int32_t: stack_push_i32, \
127 uint64_t: stack_push_ui64, \
128 int64_t: stack_push_i64, \
129 float: stack_push_f, \
130 double: stack_push_d, \
131 void*: stack_push_p \
135#define stack_push( __STACK, __VAL ) \
137 bool: stack_push_b, \
138 char: stack_push_c, \
139 uint8_t: stack_push_ui8, \
140 int8_t: stack_push_i8, \
141 uint32_t: stack_push_ui32, \
142 int32_t: stack_push_i32, \
143 float: stack_push_f, \
144 double: stack_push_d, \
145 void*: stack_push_p \
176 bool stack_push_ui64(
STACK *stack , uint64_t ui64_t );
177 bool stack_push_i64(
STACK *stack , int64_t i64 );
178 uint64_t stack_pop_ui64(
STACK *stack , uint8_t *status );
179 int64_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 hugly functions & define.