LispBM
Data Structures | Macros | Functions
lbm_flat_value.h File Reference
#include <heap.h>
#include <symrepr.h>
#include <lbm_memory.h>
Include dependency graph for lbm_flat_value.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  lbm_flat_value_t
 

Macros

#define S_CONS   0x01
 
#define S_SYM_VALUE   0x02
 
#define S_SYM_STRING   0x03
 
#define S_BYTE_VALUE   0x04
 
#define S_I28_VALUE   0x05
 
#define S_U28_VALUE   0x06
 
#define S_I32_VALUE   0x07
 
#define S_U32_VALUE   0x08
 
#define S_FLOAT_VALUE   0x09
 
#define S_I64_VALUE   0x0A
 
#define S_U64_VALUE   0x0B
 
#define S_DOUBLE_VALUE   0x0C
 
#define S_LBM_ARRAY   0x0D
 
#define S_I56_VALUE   0x0E
 
#define S_U56_VALUE   0x0F
 
#define S_LBM_LISP_ARRAY   0x1F
 
#define FLATTEN_VALUE_MAXIMUM_DEPTH   2000
 
#define FLATTEN_VALUE_OK   0
 
#define FLATTEN_VALUE_ERROR_CANNOT_BE_FLATTENED   -1
 
#define FLATTEN_VALUE_ERROR_BUFFER_TOO_SMALL   -2
 
#define FLATTEN_VALUE_ERROR_ARRAY   -3
 
#define FLATTEN_VALUE_ERROR_CIRCULAR   -4
 
#define FLATTEN_VALUE_ERROR_MAXIMUM_DEPTH   -5
 
#define FLATTEN_VALUE_ERROR_NOT_ENOUGH_MEMORY   -6
 
#define FLATTEN_VALUE_ERROR_FATAL   -7
 
#define UNFLATTEN_MALFORMED   -2
 
#define UNFLATTEN_GC_RETRY   -1
 
#define UNFLATTEN_OK   0
 

Functions

bool lbm_start_flatten (lbm_flat_value_t *v, size_t buffer_size)
 
bool lbm_finish_flatten (lbm_flat_value_t *v)
 
bool f_cons (lbm_flat_value_t *v)
 
bool f_lisp_array (lbm_flat_value_t *v, uint32_t num_elt)
 
bool f_sym (lbm_flat_value_t *v, lbm_uint sym_id)
 
bool f_sym_string (lbm_flat_value_t *v, char *str)
 
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_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)
 
lbm_value flatten_value (lbm_value v)
 
int flatten_value_c (lbm_flat_value_t *fv, lbm_value v)
 
int flatten_value_size (lbm_value v, int depth)
 
void lbm_set_max_flatten_depth (int depth)
 
bool lbm_unflatten_value (lbm_flat_value_t *v, lbm_value *res)
 

Macro Definition Documentation

◆ FLATTEN_VALUE_ERROR_ARRAY

#define FLATTEN_VALUE_ERROR_ARRAY   -3

◆ FLATTEN_VALUE_ERROR_BUFFER_TOO_SMALL

#define FLATTEN_VALUE_ERROR_BUFFER_TOO_SMALL   -2

◆ FLATTEN_VALUE_ERROR_CANNOT_BE_FLATTENED

#define FLATTEN_VALUE_ERROR_CANNOT_BE_FLATTENED   -1

◆ FLATTEN_VALUE_ERROR_CIRCULAR

#define FLATTEN_VALUE_ERROR_CIRCULAR   -4

◆ FLATTEN_VALUE_ERROR_FATAL

#define FLATTEN_VALUE_ERROR_FATAL   -7

◆ FLATTEN_VALUE_ERROR_MAXIMUM_DEPTH

#define FLATTEN_VALUE_ERROR_MAXIMUM_DEPTH   -5

◆ FLATTEN_VALUE_ERROR_NOT_ENOUGH_MEMORY

#define FLATTEN_VALUE_ERROR_NOT_ENOUGH_MEMORY   -6

◆ FLATTEN_VALUE_MAXIMUM_DEPTH

#define FLATTEN_VALUE_MAXIMUM_DEPTH   2000

◆ FLATTEN_VALUE_OK

#define FLATTEN_VALUE_OK   0

◆ S_BYTE_VALUE

#define S_BYTE_VALUE   0x04

◆ S_CONS

#define S_CONS   0x01

◆ S_DOUBLE_VALUE

#define S_DOUBLE_VALUE   0x0C

◆ S_FLOAT_VALUE

#define S_FLOAT_VALUE   0x09

◆ S_I28_VALUE

#define S_I28_VALUE   0x05

◆ S_I32_VALUE

#define S_I32_VALUE   0x07

◆ S_I56_VALUE

#define S_I56_VALUE   0x0E

◆ S_I64_VALUE

#define S_I64_VALUE   0x0A

◆ S_LBM_ARRAY

#define S_LBM_ARRAY   0x0D

◆ S_LBM_LISP_ARRAY

#define S_LBM_LISP_ARRAY   0x1F

◆ S_SYM_STRING

#define S_SYM_STRING   0x03

◆ S_SYM_VALUE

#define S_SYM_VALUE   0x02

◆ S_U28_VALUE

#define S_U28_VALUE   0x06

◆ S_U32_VALUE

#define S_U32_VALUE   0x08

◆ S_U56_VALUE

#define S_U56_VALUE   0x0F

◆ S_U64_VALUE

#define S_U64_VALUE   0x0B

◆ UNFLATTEN_GC_RETRY

#define UNFLATTEN_GC_RETRY   -1

◆ UNFLATTEN_MALFORMED

#define UNFLATTEN_MALFORMED   -2

◆ UNFLATTEN_OK

#define UNFLATTEN_OK   0

Function Documentation

◆ f_b()

bool f_b ( lbm_flat_value_t v,
uint8_t  b 
)

◆ f_cons()

bool f_cons ( lbm_flat_value_t v)

◆ 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  num_elt 
)

◆ 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_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_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 
)

◆ lbm_finish_flatten()

bool lbm_finish_flatten ( lbm_flat_value_t v)

◆ 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.