LispBM
Functions | Variables
lbm_flat_value.c File Reference
#include <lbm_flat_value.h>
#include <eval_cps.h>
#include <stack.h>
#include <setjmp.h>
Include dependency graph for lbm_flat_value.c:

Functions

int lbm_perform_gc (void)
 
bool lbm_start_flatten (lbm_flat_value_t *v, size_t buffer_size)
 
bool lbm_finish_flatten (lbm_flat_value_t *v)
 
static bool write_byte (lbm_flat_value_t *v, uint8_t b)
 
static bool write_bytes (lbm_flat_value_t *v, uint8_t *data, lbm_uint num_bytes)
 
static bool write_word (lbm_flat_value_t *v, uint32_t w)
 
static bool write_dword (lbm_flat_value_t *v, uint64_t w)
 
bool f_cons (lbm_flat_value_t *v)
 
bool f_lisp_array (lbm_flat_value_t *v, uint32_t size)
 
bool f_sym (lbm_flat_value_t *v, lbm_uint sym_id)
 
bool f_sym_string (lbm_flat_value_t *v, char *str)
 
int f_sym_string_bytes (lbm_value sym)
 
bool f_i (lbm_flat_value_t *v, lbm_int i)
 
bool f_u (lbm_flat_value_t *v, lbm_uint u)
 
bool f_b (lbm_flat_value_t *v, uint8_t b)
 
bool f_i32 (lbm_flat_value_t *v, int32_t w)
 
bool f_u32 (lbm_flat_value_t *v, uint32_t w)
 
bool f_float (lbm_flat_value_t *v, float f)
 
bool f_double (lbm_flat_value_t *v, double d)
 
bool f_i64 (lbm_flat_value_t *v, int64_t w)
 
bool f_u64 (lbm_flat_value_t *v, uint64_t w)
 
bool f_lbm_array (lbm_flat_value_t *v, uint32_t num_bytes, uint8_t *data)
 
void lbm_set_max_flatten_depth (int depth)
 
void flatten_error (jmp_buf jb, int val)
 
int flatten_value_size_internal (jmp_buf jb, lbm_value v, int depth)
 
int flatten_value_size (lbm_value v, int depth)
 
int flatten_value_c (lbm_flat_value_t *fv, lbm_value v)
 
lbm_value handle_flatten_error (int err_val)
 
lbm_value flatten_value (lbm_value v)
 
static bool extract_byte (lbm_flat_value_t *v, uint8_t *r)
 
static bool extract_word (lbm_flat_value_t *v, uint32_t *r)
 
static bool extract_dword (lbm_flat_value_t *v, uint64_t *r)
 
static int lbm_unflatten_value_internal (lbm_flat_value_t *v, lbm_value *res)
 
bool lbm_unflatten_value (lbm_flat_value_t *v, lbm_value *res)
 

Variables

static int flatten_maximum_depth = FLATTEN_VALUE_MAXIMUM_DEPTH
 

Function Documentation

◆ extract_byte()

static bool extract_byte ( lbm_flat_value_t v,
uint8_t *  r 
)
static

◆ extract_dword()

static bool extract_dword ( lbm_flat_value_t v,
uint64_t *  r 
)
static

◆ extract_word()

static bool extract_word ( lbm_flat_value_t v,
uint32_t *  r 
)
static

◆ f_b()

bool f_b ( lbm_flat_value_t v,
uint8_t  b 
)

◆ f_cons()

bool f_cons ( lbm_flat_value_t v)

◆ f_double()

bool f_double ( lbm_flat_value_t v,
double  d 
)

◆ f_float()

bool f_float ( lbm_flat_value_t v,
float  f 
)

◆ f_i()

bool f_i ( lbm_flat_value_t v,
lbm_int  i 
)

◆ f_i32()

bool f_i32 ( lbm_flat_value_t v,
int32_t  w 
)

◆ f_i64()

bool f_i64 ( lbm_flat_value_t v,
int64_t  w 
)

◆ f_lbm_array()

bool f_lbm_array ( lbm_flat_value_t v,
uint32_t  num_bytes,
uint8_t *  data 
)

◆ f_lisp_array()

bool f_lisp_array ( lbm_flat_value_t v,
uint32_t  size 
)

◆ f_sym()

bool f_sym ( lbm_flat_value_t v,
lbm_uint  sym_id 
)

◆ f_sym_string()

bool f_sym_string ( lbm_flat_value_t v,
char *  str 
)

◆ f_sym_string_bytes()

int f_sym_string_bytes ( lbm_value  sym)

◆ f_u()

bool f_u ( lbm_flat_value_t v,
lbm_uint  u 
)

◆ f_u32()

bool f_u32 ( lbm_flat_value_t v,
uint32_t  w 
)

◆ f_u64()

bool f_u64 ( lbm_flat_value_t v,
uint64_t  w 
)

◆ flatten_error()

void flatten_error ( jmp_buf  jb,
int  val 
)

◆ flatten_value()

lbm_value flatten_value ( lbm_value  v)

◆ flatten_value_c()

int flatten_value_c ( lbm_flat_value_t fv,
lbm_value  v 
)

◆ flatten_value_size()

int flatten_value_size ( lbm_value  v,
int  depth 
)

◆ flatten_value_size_internal()

int flatten_value_size_internal ( jmp_buf  jb,
lbm_value  v,
int  depth 
)

◆ handle_flatten_error()

lbm_value handle_flatten_error ( int  err_val)

◆ lbm_finish_flatten()

bool lbm_finish_flatten ( lbm_flat_value_t v)

◆ lbm_perform_gc()

int lbm_perform_gc ( void  )

Perform garbage collection, If this is called from another thread than the eval thread, evaluation must be paused! Or there will be lots of trouble!

Returns
1 on success

◆ lbm_set_max_flatten_depth()

void lbm_set_max_flatten_depth ( int  depth)

◆ lbm_start_flatten()

bool lbm_start_flatten ( lbm_flat_value_t v,
size_t  buffer_size 
)

◆ lbm_unflatten_value()

bool lbm_unflatten_value ( lbm_flat_value_t v,
lbm_value res 
)

Unflatten a flat value stored in an lbm_memory array onto the heap

Parameters
vFlat value to unflatten.
resPointer to where the result lbm_value should be stored.
Returns
True on success and false otherwise.

◆ lbm_unflatten_value_internal()

static int lbm_unflatten_value_internal ( lbm_flat_value_t v,
lbm_value res 
)
static

◆ write_byte()

static bool write_byte ( lbm_flat_value_t v,
uint8_t  b 
)
static

◆ write_bytes()

static bool write_bytes ( lbm_flat_value_t v,
uint8_t *  data,
lbm_uint  num_bytes 
)
static

◆ write_dword()

static bool write_dword ( lbm_flat_value_t v,
uint64_t  w 
)
static

◆ write_word()

static bool write_word ( lbm_flat_value_t v,
uint32_t  w 
)
static

Variable Documentation

◆ flatten_maximum_depth

int flatten_maximum_depth = FLATTEN_VALUE_MAXIMUM_DEPTH
static