Configuration and settings shared by MeTTa runners.
More...
Configuration and settings shared by MeTTa runners.
This interface allows configuration of shared properties for MeTTa interpreters
◆ env_builder_create_config_dir()
| void env_builder_create_config_dir |
( |
struct env_builder_t * | builder, |
|
|
bool | should_create ) |
Sets whether the config dir should be created if it doesn't already exist.
- Parameters
-
| [in] | builder | A pointer to the in-process environment builder state |
| [in] | should_create | Whether the directory will be created. Defaults to true |
◆ env_builder_init_common_env()
Finishes initialization of the common environment.
- Parameters
-
| [in] | builder | The in-process environment builder state to install as the common environment |
- Returns
- True if the environment was sucessfully initialized with the provided builder state. False if the environment had already been initialized by a prior call
◆ env_builder_push_fs_module_format()
Adds logic to interpret a foreign format for MeTTa modules loaded from the file system.
- Parameters
-
| [in] | builder | A pointer to the in-process environment builder state |
| [in] | format | A pointer to a user-defined structure to store information related to this format |
◆ env_builder_push_include_path()
| void env_builder_push_include_path |
( |
struct env_builder_t * | builder, |
|
|
const char * | path ) |
Adds a directory to search for module imports.
- Parameters
-
| [in] | builder | A pointer to the in-process environment builder state |
| [in] | path | A C-style string specifying a path to a directory, to search for modules to load |
- Note
- The paths will be searched in the order they are added to the env_builder_t`
◆ env_builder_set_config_dir()
| void env_builder_set_config_dir |
( |
struct env_builder_t * | builder, |
|
|
const char * | path ) |
Sets the config directory for the environment.
- Parameters
-
| [in] | builder | A pointer to the in-process environment builder state |
| [in] | path | A C-style string specifying a path to the config directory |
◆ env_builder_set_default_config_dir()
| void env_builder_set_default_config_dir |
( |
struct env_builder_t * | builder | ) |
|
Sets the default config directory for the environment.
- Parameters
-
| [in] | builder | A pointer to the in-process environment builder state |
◆ env_builder_set_is_test()
| void env_builder_set_is_test |
( |
struct env_builder_t * | builder, |
|
|
bool | is_test ) |
Configures the environment for use in unit testing.
- Parameters
-
| [in] | builder | A pointer to the in-process environment builder state |
| [in] | is_test | True if the environment is a unit-test environment, False otherwise |
◆ env_builder_set_working_dir()
| void env_builder_set_working_dir |
( |
struct env_builder_t * | builder, |
|
|
const char * | path ) |
Sets the working directory for the environment.
- Parameters
-
| [in] | builder | A pointer to the in-process environment builder state |
| [in] | path | A C-string specifying a path to a working directory, to search for modules to load. Passing NULL will unset the working directory |
- Note
- This working directory is not required to be the same as the process working directory, and it will not change as the process' working directory is changed
◆ env_builder_start()
Begins initialization of an environment.
- Returns
- The env_builder_t object representing the in-process environment initialization
- Note
- The env_builder_t must be passed to either env_builder_init_common_env or metta_new_with_space in order to properly deallocate it
◆ env_builder_use_default()
Creates an env_builder_t to specify that the default common environment should be used.
- Returns
- The env_builder_t object specifying the common environment
- Note
- This function exists to supply an argument to metta_new_with_space when no special behavior is desired
-
The env_builder_t must be passed to metta_new_with_space
◆ env_builder_use_test_env()
A convenience to create an env_builder_t, to specify that a unit-test environment should be used.
- Returns
- The env_builder_t object specifying the unit test environment
- Note
- This function exists to supply an argument to metta_new_with_space when performing unit testing
-
The env_builder_t must be passed to metta_new_with_space
◆ environment_config_dir()
| uintptr_t environment_config_dir |
( |
char * | buf, |
|
|
uintptr_t | buf_len ) |
Renders the config_dir path from the common environment into a text buffer.
- Parameters
-
| [out] | buf | A buffer into which the text will be written |
| [in] | buf_len | The maximum allocated size of buf |
- Returns
- The length of the path string, minus the string terminator character. If return_value > buf_len + 1, then the text was not fully written and this function should be called again with a larger buffer. This function will return 0 if there is no config_dir.