This commit is contained in:
2025-09-11 17:29:45 +02:00
parent d6ea2e4c2f
commit b0653b6563
4 changed files with 66 additions and 5 deletions

3
.gitmodules vendored
View File

@@ -1,3 +1,6 @@
[submodule "modules/nbrutil"] [submodule "modules/nbrutil"]
path = modules/ncore path = modules/ncore
url = git@git.nbross.com:nielsbross/NCore.git url = git@git.nbross.com:nielsbross/NCore.git
[submodule "modules/tracy"]
path = modules/tracy
url = https://github.com/rluba/jai-tracy.git

View File

@@ -873,7 +873,7 @@ find_symbol :: (name : string, checker : *Semantic_Checker, containing_scope : *
} }
from_handle :: (variables : []Type_Variable, handle : Type_Variable_Handle) -> *Type_Variable { from_handle :: (variables : []Type_Variable, handle : Type_Variable_Handle) -> *Type_Variable {
assert(handle > 0 && xx handle <= variables.count, tprint("Invalid handle: %. Range is: 1-%", handle, variables.count - 1)); // assert(handle > 0 && xx handle <= variables.count, tprint("Invalid handle: %. Range is: 1-%", handle, variables.count - 1));
return *variables[handle - 1]; return *variables[handle - 1];
} }

View File

@@ -1,6 +1,9 @@
#import "Basic"; #import "Basic";
#import "File"; #import "File";
#import "Compiler"; #import "Compiler";
#import "Metaprogram_Plugins";
plugins: [..] *Metaprogram_Plugin;
build :: () { build :: () {
w := compiler_create_workspace("Ink Build"); w := compiler_create_workspace("Ink Build");
@@ -18,12 +21,43 @@ build :: () {
args := options.compile_time_command_line; args := options.compile_time_command_line;
intercept_flags: Intercept_Flags;
plugin_start_index := -1;
for arg : args { for arg : args {
if arg == { if arg == {
case "check"; { case "check"; {
options.output_type = .NO_OUTPUT; options.output_type = .NO_OUTPUT;
} }
} }
it := args[it_index];
if !it continue;
if it[0] == #char "+" {
plugin_start_index = it_index;
}
}
plugins_to_create: [..] Plugin_To_Create;
tracy : Plugin_To_Create;
tracy.name = "tracy";
array_add(*plugins_to_create, tracy);
// got_error := false;
// if plugin_start_index >= 0 {
// success:, plugins_to_create = parse_plugin_arguments(args, plugin_start_index);
// if !success got_error = true;
// }
// if got_error {
// exit(1);
// }
success := init_plugins(plugins_to_create, *plugins, w);
if !success {
log_error("A plugin init() failed. Exiting.\n");
exit(0);
} }
new_path: [..] string; new_path: [..] string;
@@ -35,18 +69,41 @@ build :: () {
wd := get_working_directory(); wd := get_working_directory();
set_build_options(options, w); set_build_options(options, w);
compiler_begin_intercept(w); for plugins {
if it.before_intercept it.before_intercept(it, *intercept_flags);
}
compiler_begin_intercept(w, intercept_flags);
for plugins if it.add_source it.add_source(it);
add_build_file(MAIN_FILE, w); add_build_file(MAIN_FILE, w);
// Call message_loop(), which is a routine of ours below that will receive the messages.
message_loop(w);
compiler_end_intercept(w); compiler_end_intercept(w);
for plugins if it.finish it.finish (it);
for plugins if it.shutdown it.shutdown(it);
print("\nDone!\n\n"); print("\nDone!\n\n");
set_build_options_dc(.{do_output=false}); set_build_options_dc(.{do_output=false, write_added_strings=false});
} }
#run build(); message_loop :: (w: Workspace) {
while true {
// We ask the compiler for the next message. If one is not available,
// we will wait until it becomes available.
message := compiler_wait_for_message();
// Pass the message to all plugins.
for plugins if it.message it.message(it, message);
if message.kind == .COMPLETE break;
}
}
#run, stallable build();

1
modules/tracy Submodule

Submodule modules/tracy added at 9668d7b8ab