aboutsummaryrefslogtreecommitdiff
path: root/include/compiler.h
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2019-02-27 22:26:35 +0100
committerdec05eba <dec05eba@protonmail.com>2020-07-25 14:36:46 +0200
commit76d85a10f6cda93eba29dad5372e8160af7289c8 (patch)
treecfec3043ec45a5e83494ec109e87c239dad6cc47 /include/compiler.h
parent8201cd9f40897cf6b8e6973b28a8661108702ab1 (diff)
Use multiple threads to parse
Diffstat (limited to 'include/compiler.h')
-rw-r--r--include/compiler.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/compiler.h b/include/compiler.h
new file mode 100644
index 0000000..691263a
--- /dev/null
+++ b/include/compiler.h
@@ -0,0 +1,31 @@
+#ifndef AMALGAM_COMPILER_H
+#define AMALGAM_COMPILER_H
+
+#include "std/misc.h"
+#include "std/buffer.h"
+#include "std/buffer_view.h"
+#include "std/scoped_allocator.h"
+#include "std/thread.h"
+#include "defs.h"
+
+#define AMAL_COMPILER_OK 0
+/* General error */
+#define AMAL_COMPILER_ERR -1
+
+struct amal_compiler {
+ ScopedAllocator allocator;
+ ScopedAllocator main_thread_allocator;
+ Buffer parsers;
+ Buffer queued_files;
+ ParserThreadData *threads;
+ int usable_thread_count;
+ bool started;
+ amal_mutex mutex;
+};
+
+CHECK_RESULT int amal_compiler_init(amal_compiler *self);
+CHECK_RESULT int amal_compiler_deinit(amal_compiler *self);
+CHECK_RESULT int amal_compiler_load_file(amal_compiler *self, BufferView filepath);
+/* TODO: amal_compiler_unload_file */
+
+#endif \ No newline at end of file