cheax
Lisp dialect with C API
|
Functions and datastructures to initialize, clean up and configure a cheax virtual machine instance. More...
Data Structures | |
struct | chx_config_help |
Information about cheax config option. More... | |
Functions | |
CHEAX * | cheax_init (void) |
Initializes a new cheax virtual machine instance. More... | |
const char * | cheax_version (void) |
Returns cheax library version as a string in the static storage class. More... | |
int | cheax_load_feature (CHEAX *c, const char *feat) |
Loads extra functions or language features into the cheax environment, including 'unsafe' ones. More... | |
int | cheax_load_prelude (CHEAX *c) |
Loads the cheax standard library. More... | |
void | cheax_destroy (CHEAX *c) |
Destroys a cheax virtual machine instance, freeing its resources. More... | |
int | cheax_config_get_int (CHEAX *c, const char *opt) |
Get value of integer configuration option. More... | |
int | cheax_config_int (CHEAX *c, const char *opt, int value) |
Set value of integer configuration option. More... | |
bool | cheax_config_get_bool (CHEAX *c, const char *opt) |
Get value of boolean configuration option. More... | |
int | cheax_config_bool (CHEAX *c, const char *opt, bool value) |
Set value of boolean configuration option. More... | |
int | cheax_config_help (struct chx_config_help **help, size_t *num_opts) |
Load information about all cheax config options. More... | |
Functions and datastructures to initialize, clean up and configure a cheax virtual machine instance.
CHEAX* cheax_init | ( | void | ) |
Initializes a new cheax virtual machine instance.
const char* cheax_version | ( | void | ) |
Returns cheax library version as a string in the static storage class.
int cheax_load_feature | ( | CHEAX * | c, |
const char * | feat | ||
) |
Loads extra functions or language features into the cheax environment, including 'unsafe' ones.
Supported values for feat are:
"file-io"
to load fopen
and fclose
built-ins; "set-max-stack-depth"
to load the set-max-stack-depth
built-in; "gc"
to load the gc
built-in function; "exit"
to load the exit
function; "stdin"
to expose the stdin
variable; "stdout"
to expose the stdout
variable; "stderr"
to expose the stderr
variable; "stdio"
to expose stdin
, stdout
and stderr
; "all"
to load every feature available (think twice before using).A feature can only be loaded once. Attempting to load a feature more than once will cause no action.
feat | Which feature to load. |
int cheax_load_prelude | ( | CHEAX * | c | ) |
Loads the cheax standard library.
Sets cheax_errno() to CHEAX_EAPI if the standard library could not be found.
void cheax_destroy | ( | CHEAX * | c | ) |
Destroys a cheax virtual machine instance, freeing its resources.
Any use of c after calling cheax_destroy() on it results in undefined behavior.
int cheax_config_get_int | ( | CHEAX * | c, |
const char * | opt | ||
) |
Get value of integer configuration option.
Sets cheax_errno() to CHEAX_EAPI if no option of integer type with name opt exists.
opt | Option name. |
int cheax_config_int | ( | CHEAX * | c, |
const char * | opt, | ||
int | value | ||
) |
Set value of integer configuration option.
Sets cheax_errno() to CHEAX_EAPI if option opt does not have integer type, or if value is otherwise invalid for option opt. Fails silently in case no option with name opt could be found.
opt | Option name. |
value | Option value. |
bool cheax_config_get_bool | ( | CHEAX * | c, |
const char * | opt | ||
) |
Get value of boolean configuration option.
Sets cheax_errno() to CHEAX_EAPI if no option of boolean type with name opt exists.
opt | Option name. |
false
upon failure. int cheax_config_bool | ( | CHEAX * | c, |
const char * | opt, | ||
bool | value | ||
) |
Set value of boolean configuration option.
Sets cheax_errno() to CHEAX_EAPI if option opt does not have boolean type, or if value is otherwise invalid for option opt. Fails silently in case no option with name opt could be found.
opt | Option name. |
value | Option value. |
int cheax_config_help | ( | struct chx_config_help ** | help, |
size_t * | num_opts | ||
) |
Load information about all cheax config options.
help | Output parameter. Make sure to free() after use. |
num_opts | Output parameter, will point to length of output array. |