LispBM
|
#include <lbm_memory.h>
#include <lbm_types.h>
#include <string.h>
#include "stack.h"
#include "print.h"
Macros | |
#define | STACK_UNUSED_BYTE 0x55 |
#define | STACK_UNUSED_WORD 0x55555555 |
Functions | |
int | lbm_stack_allocate (lbm_stack_t *s, lbm_uint stack_size) |
int | lbm_stack_create (lbm_stack_t *s, lbm_uint *data, lbm_uint stack_size) |
lbm_uint | lbm_get_max_stack (lbm_stack_t *s) |
void | lbm_stack_free (lbm_stack_t *s) |
void | lbm_stack_clear (lbm_stack_t *s) |
int | lbm_stack_drop (lbm_stack_t *s, lbm_uint n) |
int | lbm_push (lbm_stack_t *s, lbm_uint val) |
int | lbm_pop (lbm_stack_t *s, lbm_uint *val) |
int | lbm_pop_2 (lbm_stack_t *s, lbm_uint *r0, lbm_uint *r1) |
int | lbm_pop_3 (lbm_stack_t *s, lbm_uint *r0, lbm_uint *r1, lbm_uint *r2) |
#define STACK_UNUSED_BYTE 0x55 |
#define STACK_UNUSED_WORD 0x55555555 |
lbm_uint lbm_get_max_stack | ( | lbm_stack_t * | s | ) |
Check maximum SP
s | Pointer to stack |
int lbm_pop | ( | lbm_stack_t * | s, |
lbm_uint * | val | ||
) |
Pop a value from a stack.
s | Stack to pop a value from. |
val | Pointer to an lbm_value to store the pop:ed value int. |
int lbm_pop_2 | ( | lbm_stack_t * | s, |
lbm_uint * | r0, | ||
lbm_uint * | r1 | ||
) |
Pop 2 values from a stack.
s | Stack to pop values from. |
r0 | Pointer to lbm_value where the first pop:ed value will be stored. |
r1 | Pointer to lbm_value where the seconds pop:ed value will be stored. |
int lbm_pop_3 | ( | lbm_stack_t * | s, |
lbm_uint * | r0, | ||
lbm_uint * | r1, | ||
lbm_uint * | r2 | ||
) |
Pop 3 values from a stack.
s | Stack to pop values from. |
r0 | |
r1 | |
r2 |
int lbm_push | ( | lbm_stack_t * | s, |
lbm_uint | val | ||
) |
Push an element onto a stack.
s | Stack to push a value onto. |
val | Value to push to the stack. |
int lbm_stack_allocate | ( | lbm_stack_t * | s, |
lbm_uint | stack_size | ||
) |
Allocate a stack on the symbols and arrays memory. lbm_memory_init must have been run before this function or it will fail.
s | Pointer to an lbm_stack_t to initialize. |
stack_size | Size in 32 bit words of stack to allocate. |
void lbm_stack_clear | ( | lbm_stack_t * | s | ) |
Sets the stack SP to 0.
s | Stack to clear. |
int lbm_stack_create | ( | lbm_stack_t * | s, |
lbm_uint * | data, | ||
lbm_uint | size | ||
) |
Create a stack in a statically allocated array.
s | Pointer to an lbm_stack_t to initialize. |
data | Pointer to array of 32 bit words to use as the stack storage. |
size | Size in number of 32 bit words. |
int lbm_stack_drop | ( | lbm_stack_t * | s, |
lbm_uint | n | ||
) |
Drop n elements (from the top) of a stack.
s | Stack to drop elements from. |
n | Number of elements to drop. |
void lbm_stack_free | ( | lbm_stack_t * | s | ) |
Free a stack allocated on the lispbm_memory.
s | Pointer to lbm_stack_t to free. |