diff options
Diffstat (limited to 'include/compiler.h')
-rw-r--r-- | include/compiler.h | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/include/compiler.h b/include/compiler.h index 3a31ad9..0ae8532 100644 --- a/include/compiler.h +++ b/include/compiler.h @@ -8,6 +8,7 @@ #include "std/thread.h" #include "compiler_options.h" #include "ast.h" +#include "program.h" #define AMAL_COMPILER_OK 0 /* General error */ @@ -32,6 +33,7 @@ typedef struct { struct amal_compiler { amal_default_types default_types; amal_compiler_options options; + amal_program *program; ScopedAllocator allocator; Scope root_scope; Buffer/*<Parser*>*/ parsers; @@ -40,22 +42,19 @@ struct amal_compiler { ParserThreadData *threads; int usable_thread_count; bool started; - bool used; amal_mutex mutex; int generic_work_object_index; }; void amal_compiler_options_init(amal_compiler_options *self); -/* If @options is NULL, then default values are used */ -CHECK_RESULT int amal_compiler_init(amal_compiler *self, const amal_compiler_options *options); -CHECK_RESULT int amal_compiler_deinit(amal_compiler *self); /* -This function creates a copy of @filepath in the same thread it's called from -so it doesn't have to survive longer than this function call. + If @options is NULL, then default values are used. + You should run @amal_program_deinit even @amal_compiler_load_file fails, to cleanup memory. + This function creates a copy of @filepath so it doesn't have to survive longer than this function call. + The file has to be in utf-8 format and it can optionally have utf-8 BOM. */ -CHECK_RESULT int amal_compiler_load_file(amal_compiler *self, const char *filepath); +CHECK_RESULT int amal_compiler_load_file(amal_compiler_options *options, amal_program *program, const char *filepath); CHECK_RESULT int amal_compiler_internal_load_file(amal_compiler *self, const char *filepath, FileScopeReference **file_scope); -/* TODO: amal_compiler_unload_file */ #endif |