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

Stack functions definitions. More...

#include "nilorea/n_stack.h"
+ Include dependency graph for n_stack.c:

Go to the source code of this file.

Functions

size_t __stack_pop (STACK *stack, uint8_t *status)
 helper for stack_pop.
 
size_t __stack_push (STACK *stack, uint8_t *status)
 helper for stack_push.
 
bool delete_stack (STACK **stack)
 delete a STACK *stack
 
STACKnew_stack (size_t size)
 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_ITEMstack_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
 

Detailed Description

Stack functions definitions.

Stack header definitions.

Author
Castagnier Mickael
Version
2.0
Date
01/01/2018

Definition in file n_stack.c.

Function Documentation

◆ __stack_pop()

size_t __stack_pop ( STACK stack,
uint8_t *  status 
)

helper for stack_pop.

Try to remove a new cell in the stack, and store the result in status

Parameters
stacktarget STACK *stack
statuspointer to uint8_t holding the result of the operation (STACK_IS_UNDEFINED,STACK_IS_EMPTY,STACK_ITEM_OK)
Returns
the position in the stack

Definition at line 140 of file n_stack.c.

References __n_assert, STACK_IS_EMPTY, STACK_IS_UNDEFINED, and STACK_ITEM_OK.

Referenced by stack_pop_b(), stack_pop_c(), stack_pop_d(), stack_pop_f(), stack_pop_i32(), stack_pop_i8(), stack_pop_p(), stack_pop_ui32(), and stack_pop_ui8().

+ Here is the caller graph for this function:

◆ __stack_push()

size_t __stack_push ( STACK stack,
uint8_t *  status 
)

helper for stack_push.

Try to get a new cell in the stack, and store the result in status

Parameters
stacktarget STACK *stack
statuspointer to uint8_t holding the result of the operation (STACK_IS_UNDEFINED,STACK_ITEM_OK,STACK_IS_FULL)
Returns
the position in the stack

Definition at line 107 of file n_stack.c.

References __n_assert, STACK_IS_FULL, stack_is_full(), STACK_IS_UNDEFINED, and STACK_ITEM_OK.

Referenced by stack_push_b(), stack_push_c(), stack_push_d(), stack_push_f(), stack_push_i32(), stack_push_i8(), stack_push_p(), stack_push_ui32(), and stack_push_ui8().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: