Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
n_stack.h File Reference

Stack header definitions. More...

#include "nilorea/n_common.h"
+ Include dependency graph for n_stack.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

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
 
STACKnew_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_ITEMstack_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
 

Detailed Description

Stack header definitions.

Author
Castagnier Mickael
Version
2.0
Date
01/01/2018

Definition in file n_stack.h.