diff --git a/src/builtins/basic.h b/src/builtins/basic.h
index bbf03c4..f458542 100644
--- a/src/builtins/basic.h
+++ b/src/builtins/basic.h
@@ -17,5 +17,5 @@
** with The Noja Interpreter. If not, see .
*/
-#include "../runtime/o_staticmap.h"
+#include "../runtime/runtime.h"
extern const StaticMapSlot bins_basic[];
\ No newline at end of file
diff --git a/src/builtins/files.h b/src/builtins/files.h
index 79420c6..e757083 100644
--- a/src/builtins/files.h
+++ b/src/builtins/files.h
@@ -17,5 +17,5 @@
** with The Noja Interpreter. If not, see .
*/
-#include "../runtime/o_staticmap.h"
+#include "../runtime/runtime.h"
extern const StaticMapSlot bins_files[];
\ No newline at end of file
diff --git a/src/builtins/math.h b/src/builtins/math.h
index c48b18b..1fe56a8 100644
--- a/src/builtins/math.h
+++ b/src/builtins/math.h
@@ -17,5 +17,5 @@
** with The Noja Interpreter. If not, see .
*/
-#include "../runtime/o_staticmap.h"
+#include "../runtime/runtime.h"
extern const StaticMapSlot bins_math[];
\ No newline at end of file
diff --git a/src/main.c b/src/main.c
index 28aca49..928b62b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -24,8 +24,6 @@
#include "compiler/parse.h"
#include "compiler/compile.h"
#include "runtime/runtime.h"
-#include "runtime/runtime_error.h"
-#include "runtime/o_staticmap.h"
#include "builtins/basic.h"
static const char usage[] =
diff --git a/src/runtime/o_func.h b/src/runtime/o_func.h
deleted file mode 100644
index 66f6288..0000000
--- a/src/runtime/o_func.h
+++ /dev/null
@@ -1,24 +0,0 @@
-
-/* Copyright (c) 2022 Francesco Cozzuto
-**
-** This file is part of The Noja Interpreter.
-**
-** The Noja Interpreter is free software: you can redistribute it and/or
-** modify it under the terms of the GNU General Public License as published
-** by the Free Software Foundation, either version 3 of the License, or (at
-** your option) any later version.
-**
-** The Noja Interpreter is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
-** Public License for more details.
-**
-** You should have received a copy of the GNU General Public License along
-** with The Noja Interpreter. If not, see .
-*/
-
-#ifndef NOJAFUNC_H
-#define NOJAFUNC_H
-#include "runtime.h"
-Object *Object_FromNojaFunction(Runtime *runtime, Executable *exe, int index, int argc, Object *closure, Heap *heap, Error *error);
-#endif
\ No newline at end of file
diff --git a/src/runtime/o_nfunc.h b/src/runtime/o_nfunc.h
deleted file mode 100644
index 37876d7..0000000
--- a/src/runtime/o_nfunc.h
+++ /dev/null
@@ -1,24 +0,0 @@
-
-/* Copyright (c) 2022 Francesco Cozzuto
-**
-** This file is part of The Noja Interpreter.
-**
-** The Noja Interpreter is free software: you can redistribute it and/or
-** modify it under the terms of the GNU General Public License as published
-** by the Free Software Foundation, either version 3 of the License, or (at
-** your option) any later version.
-**
-** The Noja Interpreter is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
-** Public License for more details.
-**
-** You should have received a copy of the GNU General Public License along
-** with The Noja Interpreter. If not, see .
-*/
-
-#ifndef NOJAFUNC_H
-#define NOJAFUNC_H
-#include "runtime.h"
-Object *Object_FromNativeFunction(Runtime *runtime, Object *(*callback)(Runtime*, Object**, unsigned int, Error*), int argc, Heap *heap, Error *error);
-#endif
\ No newline at end of file
diff --git a/src/runtime/o_staticmap.c b/src/runtime/o_staticmap.c
index b8dcde2..ff502ab 100644
--- a/src/runtime/o_staticmap.c
+++ b/src/runtime/o_staticmap.c
@@ -46,8 +46,7 @@
*/
#include
#include
-#include "o_nfunc.h"
-#include "o_staticmap.h"
+#include "../runtime/runtime.h"
#include "../utils/defs.h"
#include "../objects/objects.h"
diff --git a/src/runtime/o_staticmap.h b/src/runtime/o_staticmap.h
deleted file mode 100644
index fa33b06..0000000
--- a/src/runtime/o_staticmap.h
+++ /dev/null
@@ -1,56 +0,0 @@
-
-/* Copyright (c) 2022 Francesco Cozzuto
-**
-** This file is part of The Noja Interpreter.
-**
-** The Noja Interpreter is free software: you can redistribute it and/or
-** modify it under the terms of the GNU General Public License as published
-** by the Free Software Foundation, either version 3 of the License, or (at
-** your option) any later version.
-**
-** The Noja Interpreter is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
-** Public License for more details.
-**
-** You should have received a copy of the GNU General Public License along
-** with The Noja Interpreter. If not, see .
-*/
-
-#ifndef STATICMAP_H
-#define STATICMAP_H
-
-#include "../objects/objects.h"
-#include "runtime.h"
-
-typedef enum {
- SM_END,
- SM_BOOL,
- SM_INT,
- SM_FLOAT,
- SM_FUNCT,
- SM_STRING,
- SM_SMAP,
- SM_NONE,
- SM_TYPE,
-} StaticMapSlotKind;
-
-typedef struct StaticMapSlot StaticMapSlot;
-
-struct StaticMapSlot {
- const char *name;
- StaticMapSlotKind kind;
- union {
- const StaticMapSlot *as_smap;
- const char *as_string;
- _Bool as_bool;
- long long int as_int;
- double as_float;
- Object *(*as_funct)(Runtime*, Object**, unsigned int, Error*);
- TypeObject *as_type;
- };
- union { int argc; int length; };
-};
-
-Object *Object_NewStaticMap(const StaticMapSlot *slots, Runtime *runt, Error *error);
-#endif
\ No newline at end of file
diff --git a/src/runtime/runtime.c b/src/runtime/runtime.c
index 2da108f..33f9157 100644
--- a/src/runtime/runtime.c
+++ b/src/runtime/runtime.c
@@ -20,7 +20,6 @@
#include
#include "../utils/defs.h"
#include "../utils/stack.h"
-#include "o_func.h"
#include "runtime.h"
#define MAX_FRAME_STACK 16
diff --git a/src/runtime/runtime.h b/src/runtime/runtime.h
index e415a28..acab6af 100644
--- a/src/runtime/runtime.h
+++ b/src/runtime/runtime.h
@@ -19,13 +19,16 @@
#ifndef RUNTIME_H
#define RUNTIME_H
+
#include // meh.. just for the definition of FILE.
#include "../utils/error.h"
#include "../utils/stack.h"
#include "../objects/objects.h"
#include "../common/executable.h"
+
typedef struct xRuntime Runtime;
typedef struct xSnapshot Snapshot;
+
Runtime* Runtime_New(int stack_size, int heap_size, void *callback_userp, _Bool (*callback_addr)(Runtime*, void*));
Runtime* Runtime_New2(int stack_size, Heap *heap, _Bool free_heap, void *callback_userp, _Bool (*callback_addr)(Runtime*, void*));
void Runtime_Free(Runtime *runtime);
@@ -41,4 +44,47 @@ Snapshot *Snapshot_New(Runtime *runtime);
void Snapshot_Free(Snapshot *snapshot);
void Snapshot_Print(Snapshot *snapshot, FILE *fp);
Object *run(Runtime *runtime, Error *error, Executable *exe, int index, Object *closure, Object **argv, int argc);
+
+typedef enum {
+ SM_END,
+ SM_BOOL,
+ SM_INT,
+ SM_FLOAT,
+ SM_FUNCT,
+ SM_STRING,
+ SM_SMAP,
+ SM_NONE,
+ SM_TYPE,
+} StaticMapSlotKind;
+
+typedef struct StaticMapSlot StaticMapSlot;
+
+struct StaticMapSlot {
+ const char *name;
+ StaticMapSlotKind kind;
+ union {
+ const StaticMapSlot *as_smap;
+ const char *as_string;
+ _Bool as_bool;
+ long long int as_int;
+ double as_float;
+ Object *(*as_funct)(Runtime*, Object**, unsigned int, Error*);
+ TypeObject *as_type;
+ };
+ union { int argc; int length; };
+};
+
+Object *Object_NewStaticMap(const StaticMapSlot *slots, Runtime *runt, Error *error);
+Object *Object_FromNojaFunction(Runtime *runtime, Executable *exe, int index, int argc, Object *closure, Heap *heap, Error *error);
+Object *Object_FromNativeFunction(Runtime *runtime, Object *(*callback)(Runtime*, Object**, unsigned int, Error*), int argc, Heap *heap, Error *error);
+
+typedef struct {
+ Error base;
+ Runtime *runtime;
+ Snapshot *snapshot;
+} RuntimeError;
+
+void RuntimeError_Init(RuntimeError *error, Runtime *runtime);
+void RuntimeError_Free(RuntimeError *error);
+
#endif
\ No newline at end of file
diff --git a/src/runtime/runtime_error.c b/src/runtime/runtime_error.c
index 2041a19..c0f69de 100644
--- a/src/runtime/runtime_error.c
+++ b/src/runtime/runtime_error.c
@@ -18,7 +18,7 @@
*/
#include
-#include "runtime_error.h"
+#include "runtime.h"
static void on_report(Error *error)
{
diff --git a/src/runtime/runtime_error.h b/src/runtime/runtime_error.h
deleted file mode 100644
index d348eaa..0000000
--- a/src/runtime/runtime_error.h
+++ /dev/null
@@ -1,33 +0,0 @@
-
-/* Copyright (c) 2022 Francesco Cozzuto
-**
-** This file is part of The Noja Interpreter.
-**
-** The Noja Interpreter is free software: you can redistribute it and/or
-** modify it under the terms of the GNU General Public License as published
-** by the Free Software Foundation, either version 3 of the License, or (at
-** your option) any later version.
-**
-** The Noja Interpreter is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
-** Public License for more details.
-**
-** You should have received a copy of the GNU General Public License along
-** with The Noja Interpreter. If not, see .
-*/
-
-#ifndef RUNTIME_ERROR_H
-#define RUNTIME_ERROR_H
-#include "../utils/error.h"
-#include "runtime.h"
-
-typedef struct {
- Error base;
- Runtime *runtime;
- Snapshot *snapshot;
-} RuntimeError;
-
-void RuntimeError_Init(RuntimeError *error, Runtime *runtime);
-void RuntimeError_Free(RuntimeError *error);
-#endif
\ No newline at end of file