#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"
Go to the source code of this file.
|
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) |
|
◆ 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
-
value | Result array value. |
num_elt | Number of bytes in the array. |
◆ lbm_define()
int lbm_define |
( |
char * |
symbol, |
|
|
lbm_value |
value |
|
) |
| |
Add a definition to the global environment
- Parameters
-
symbol | Name to bind the data to. |
value | The 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
-
symbol | The 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
-
symbol | The name of the binding to schedule for execution. |
- Returns
- A context if on success or 0 on failure.
◆ lbm_load_and_define_expression()
Load an expression and bind it to a symbol in the environment.
- Parameters
-
tokenizer | The tokenizer to read the expression from. |
symbol | A 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()
Load a program and bind it to a symbol in the environment.
- Parameters
-
tokenizer | The tokenizer to read the program from. |
symbol | A 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()
Load and schedule an expression for execution.
- Parameters
-
tokenizer | The tokenizer to read the expression from. |
- Returns
- A context id on success or 0 on failure.
◆ lbm_load_and_eval_program()
Load and schedule a program for execution.
- Parameters
-
tokenizer | The tokenizer to read the program from. |
name | Name 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
-
tokenizer | The tokenizer to read the program from. |
name | Name 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
-
cid | Context id of the process to send a message to. |
msg | lbm_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
-
value | Result array value. |
data | Pointer to the C array |
num_elt | Number 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
-
value | Pointer to a heap-cell allocated in flash. |
data | Pointer to the C array. |
num_elt | Number 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
-
symbol | Name of symbol to undefine in the environment. |
- Returns
- 1 if removed any bindings, 0 otherwise.