Name
SPVM::Document::NativeAPI::Compiler - Compiler Native APIs
Usage
void* compiler = env->api->compiler->new_instance();
env->api->compiler->add_include_dir(compiler, "lib");
env->api->compiler->set_start_file(compiler, __FILE__);
env->api->compiler->get_start_line(compiler, __LINE__ + 1);
int32_t status = env->api->compiler->compile(compiler, "MyClass");
env->api->compiler->free_instance(compiler);
Description
The compiler native APIs of SPVM are the APIs to compile SPVM modules.
Compiler Native APIs
new_instance
void* (*new_instance)(void);
Creates a compiler object.
free_instance
void (*free_instance)(void* compiler);
Frees a compiler.
get_start_line
int32_t (*get_start_line)(void* compiler);
Gets the start line.
set_start_line
void (*set_start_line)(void* compiler, int32_t start_line);
Sets a start line.
get_start_file
const char* (*get_start_file)(void* compiler);
Gets the start file.
set_start_file
void (*set_start_file)(void* compiler, const char* start_file);
Set a start file.
get_include_dirs_length
int32_t (*get_include_dirs_length)(void* compiler);
Gets the length of the directories for searching modules.
get_include_dir
const char* (*get_include_dir)(void* compiler, int32_t index);
Gets a directory for searching modules by an index.
add_include_dir
void (*add_include_dir)(void* compiler, const char* include_dir);
Adds a directory for searching modules.
clear_include_dirs
void (*clear_include_dirs)(SPVM_COMPILER* compiler);
Clears the directories for searching modules.
add_module_file
void (*add_module_file)(void* compiler, const char* module_name);
Adds a module file object for a module.
If the module file already exists, nothing is performed.
delete_module_file
void (*delete_module_file)(void* compiler, const char* module_name);
Deletes a module file object for a module.
get_module_file
void* (*get_module_file)(void* compiler, const char* module_name);
Gets the module file object for a module.
compile
int32_t (*compile)(void* compiler, const char* module_name);
Compiles SPVM modules.
get_error_messages_length
int32_t (*get_error_messages_length)(void* compiler);
Gets the length of the compilation error messages.
get_error_message
const char* (*get_error_message)(void* compiler, int32_t index);
Gets a compiler error message by an index.
get_runtime
void* (*get_runtime)(void* compiler);
Gets the runtime.
Native API IDs
0 new_instance
1 free_instance
2 get_start_line
3 set_start_line
4 get_start_file
5 set_start_file
6 get_include_dirs_length
7 get_include_dir
8 add_include_dir
9 clear_include_dirs
10 add_module_file
11 delete_module_file
12 get_module_file
13 compile
14 get_error_message
15 get_error_messages_length
16 get_runtime
Copyright & License
Copyright (c) 2023 Yuki Kimoto
MIT License