LispBM
Functions
lbm_c_interop.h File Reference
#include "env.h"
#include "symrepr.h"
#include "eval_cps.h"
#include "heap.h"
#include "tokpar.h"
#include "lbm_memory.h"
#include "lbm_variables.h"
#include "lbm_types.h"
#include "lbm_channel.h"
Include dependency graph for lbm_c_interop.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

lbm_cid lbm_load_and_eval_program (lbm_char_channel_t *tokenizer, char *name)
 
lbm_cid lbm_load_and_eval_program_incremental (lbm_char_channel_t *tokenizer, char *name)
 
lbm_cid lbm_load_and_eval_expression (lbm_char_channel_t *tokenizer)
 
lbm_cid lbm_load_and_define_program (lbm_char_channel_t *tokenizer, char *symbol)
 
lbm_cid lbm_load_and_define_expression (lbm_char_channel_t *tokenizer, char *symbol)
 
lbm_cid lbm_eval_defined_expression (char *symbol)
 
lbm_cid lbm_eval_defined_program (char *symbol)
 
int lbm_send_message (lbm_cid cid, lbm_value msg)
 
int lbm_define (char *symbol, lbm_value value)
 
int lbm_undefine (char *symbol)
 
int lbm_share_array (lbm_value *value, char *data, lbm_uint num_elt)
 
int lbm_share_const_array (lbm_value *res, char *flash_ptr, lbm_uint num_elt)
 
int lbm_create_array (lbm_value *value, lbm_uint num_elt)
 

Function Documentation

◆ lbm_create_array()

int lbm_create_array ( lbm_value value,
lbm_uint  num_elt 
)

Create an array to access from both LBM and C. This function should be called while the evaluator is paused and the array should be bound to something before un-pausing. Send the array in a message with lbm_send_message or define it in the global with lbm_define. The data is stored in lbm_memory as C values (not encoded as lbm values).

Parameters
valueResult array value.
num_eltNumber of bytes in the array.

◆ lbm_define()

int lbm_define ( char *  symbol,
lbm_value  value 
)

Add a definition to the global environment

Parameters
symbolName to bind the data to.
valueThe data.
Returns
1 on success and 0 on failure.

◆ lbm_eval_defined_expression()

lbm_cid lbm_eval_defined_expression ( char *  symbol)

Create a context for a bound expression and schedule it for execution

Parameters
symbolThe name of the binding to schedule for execution.
Returns
A context if on success or 0 on failure.

◆ lbm_eval_defined_program()

lbm_cid lbm_eval_defined_program ( char *  symbol)

Create a context for a bound program and schedule it for execution

Parameters
symbolThe name of the binding to schedule for execution.
Returns
A context if on success or 0 on failure.

◆ lbm_load_and_define_expression()

lbm_cid lbm_load_and_define_expression ( lbm_char_channel_t tokenizer,
char *  symbol 
)

Load an expression and bind it to a symbol in the environment.

Parameters
tokenizerThe tokenizer to read the expression from.
symbolA string with the name you want the binding to have in the environment.
Returns
A context id on success or 0 on failure.

◆ lbm_load_and_define_program()

lbm_cid lbm_load_and_define_program ( lbm_char_channel_t tokenizer,
char *  symbol 
)

Load a program and bind it to a symbol in the environment.

Parameters
tokenizerThe tokenizer to read the program from.
symbolA string with the name you want the binding to have in the environment.
Returns
A context id on success or 0 on failure.

◆ lbm_load_and_eval_expression()

lbm_cid lbm_load_and_eval_expression ( lbm_char_channel_t tokenizer)

Load and schedule an expression for execution.

Parameters
tokenizerThe tokenizer to read the expression from.
Returns
A context id on success or 0 on failure.

◆ lbm_load_and_eval_program()

lbm_cid lbm_load_and_eval_program ( lbm_char_channel_t tokenizer,
char *  name 
)

Load and schedule a program for execution.

Parameters
tokenizerThe tokenizer to read the program from.
nameName of thread (or NULL) thread doing the load and eval.
Returns
A context id on success or 0 on failure.

◆ lbm_load_and_eval_program_incremental()

lbm_cid lbm_load_and_eval_program_incremental ( lbm_char_channel_t tokenizer,
char *  name 
)

Load a program while evaluating incrementally.

Parameters
tokenizerThe tokenizer to read the program from.
nameName of the thread (or NULL) that performs the incremental load.
Returns
A context id on success or 0 on failure.

◆ lbm_send_message()

int lbm_send_message ( lbm_cid  cid,
lbm_value  msg 
)

Send a message to a process running in the evaluator.

Parameters
cidContext id of the process to send a message to.
msglbm_value that will be sent to the process.
Returns
1 on success or 0 on failure.

◆ lbm_share_array()

int lbm_share_array ( lbm_value value,
char *  data,
lbm_uint  num_elt 
)

Share a C array with LBM. The array should be created while the evaluator is paused and the array should be bound to something before un-pausing. Send the array in a message with lbm_send_message or define it in the global with lbm_define. The data is stored in the array as C values (not encoded as lbm values).

Parameters
valueResult array value.
dataPointer to the C array
num_eltNumber of bytes in the array.

◆ lbm_share_const_array()

int lbm_share_const_array ( lbm_value res,
char *  flash_ptr,
lbm_uint  num_elt 
)

Share a C array stored in flash with LBM.

Parameters
valuePointer to a heap-cell allocated in flash.
dataPointer to the C array.
num_eltNumber of bytes in the array.
Returns
1 on success otherwise 0.

◆ lbm_undefine()

int lbm_undefine ( char *  symbol)

Remove a definition from the global environment.

Parameters
symbolName of symbol to undefine in the environment.
Returns
1 if removed any bindings, 0 otherwise.