diff options
author | Jo-Philipp Wich <jo@mein.io> | 2022-07-21 10:49:23 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2022-07-30 00:41:56 +0200 |
commit | 3c168b5184ebd217ea276bf374d28bbf937681fd (patch) | |
tree | 00da23f6c0500518c4bebc73e9b85566ef75f052 /types.c | |
parent | d85bc716df9b97ac6093afa0bdf77c1b6b0cf6aa (diff) |
vm, cli: move search path into global configuration structure
The upcoming compile-time module support will require the configured
extension search path in the compiler as well, so move it to the
already shared uc_parse_config_t structure and add the appropriate
utility functions to initialize, append and free the search path
vector.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'types.c')
-rw-r--r-- | types.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -30,6 +30,15 @@ #include "ucode/vm.h" #include "ucode/program.h" +static char *uc_default_search_path[] = { LIB_SEARCH_PATH }; + +uc_parse_config_t uc_default_parse_config = { + .module_search_path = { + .count = ARRAY_SIZE(uc_default_search_path), + .entries = uc_default_search_path + } +}; + uc_type_t ucv_type(uc_value_t *uv) { @@ -2245,3 +2254,12 @@ ucv_freeall(uc_vm_t *vm) { ucv_gc_common(vm, true); } + +void +uc_search_path_init(uc_search_path_t *search_path) +{ + size_t i; + + for (i = 0; i < ARRAY_SIZE(uc_default_search_path); i++) + uc_vector_push(search_path, xstrdup(uc_default_search_path[i])); +} |