scripting: Added stubs for compiling scripts
authorLukas Krickl <lukas@krickl.dev>
Sun, 8 Mar 2026 12:48:21 +0000 (13:48 +0100)
committerLukas Krickl <lukas@krickl.dev>
Sun, 8 Mar 2026 12:48:21 +0000 (13:48 +0100)
src/l_lsl.c
src/l_lsl.h
src/lrts_impl.h

index 637cc2b35c3f5a67aceae0bdf83fd83324fa7b3e..87b918c3f7532676fc047a7b3a6268089f609d7b 100644 (file)
@@ -1,5 +1,5 @@
-#include "u_lsl.h"
-#include "m_mem.h"
+#include "l_lsl.h"
+#include "u_mem.h"
 
 struct l_lsl_vm l_lsl_vm_init() {
        struct l_lsl_vm v;
@@ -9,4 +9,21 @@ struct l_lsl_vm l_lsl_vm_init() {
 }
 
 void l_lsl_vm_free(struct l_lsl_vm *vm) {
+       LRTS_UNUSED(vm);
+}
+
+enum l_lsl_error l_lsl_compile_file(struct l_lsl_vm *v, const char *path) {
+       enum l_lsl_error err = L_LSL_ERR_OK;
+       LRTS_UNUSED(v);
+       LRTS_UNUSED(path);
+
+       return err;
+}
+
+enum l_lsl_error l_lsl_exec(struct l_lsl_vm *v, const char *path) {
+       enum l_lsl_error err = L_LSL_ERR_OK;
+
+       err = l_lsl_compile_file(v, path);
+
+       return err;
 }
index 4e21daf671320d00b7f1fdc67746e6795ab6ce29..34d4f424f388488dbb9c938d97c71535a55b729c 100644 (file)
@@ -100,13 +100,23 @@ struct l_lsl_strings {
        u32 max_len;
 };
 
+struct l_lsl_table;
+
+union l_lsl_tableent_data {
+       i32 int_val;
+       char *str_val;
+       struct l_lsl_table *table;
+       /* start of code in bytecode table */
+       u32 function_code_index;
+};
+
 /* a table entry is a single value
  * of a specific data type */
 struct l_lsl_tableent {
        /* string table entry */
        u32 name;
        enum l_lsl_data_type type;
-       
+       union l_lsl_tableent_data data;
 };
 
 /* 
@@ -174,4 +184,10 @@ enum l_lsl_error l_lsl_compile(struct l_lsl_vm *v, const char *code, u32 len);
  * if the entry point is NULL the global scope is executed */
 enum l_lsl_error l_lsl_run(struct l_lsl_vm *v, const char *entry);
 
+/* compiles from a file */
+enum l_lsl_error l_lsl_compile_file(struct l_lsl_vm *v, const char *path);
+
+/* loads a file, compiles it and runs it */
+enum l_lsl_error l_lsl_exec(struct l_lsl_vm *v, const char *path);
+
 #endif
index e387655a7b0b0a3c5d1aa12a663b6bf4565b517d..6bd2ac75fcefa1a7aff1cc9f1461e7e4661346f7 100644 (file)
@@ -52,7 +52,7 @@
 #include "i_input.c"
 #include "u_time.c"
 #include "t_update.c"
-#include "l_lsl.h"
+#include "l_lsl.c"
 #include "u_debug.c"
 
 #endif