summaryrefslogtreecommitdiffhomepage
path: root/types.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2022-07-21 10:49:23 +0200
committerJo-Philipp Wich <jo@mein.io>2022-07-30 00:41:56 +0200
commit3c168b5184ebd217ea276bf374d28bbf937681fd (patch)
tree00da23f6c0500518c4bebc73e9b85566ef75f052 /types.c
parentd85bc716df9b97ac6093afa0bdf77c1b6b0cf6aa (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.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/types.c b/types.c
index d0b933d..3a3e35c 100644
--- a/types.c
+++ b/types.c
@@ -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]));
+}