Fixed meta-program issues with new compiler version

This commit is contained in:
2024-12-01 23:29:59 +01:00
parent 1dad4397c0
commit e7522f9c55
2 changed files with 21 additions and 12 deletions

View File

@@ -1,14 +1,6 @@
#load "../renderer/directional_light.jai"; #load "../renderer/directional_light.jai";
#load "particles.jai"; #load "particles.jai";
#placeholder init_scene;
#placeholder Entity_Storage;
#placeholder delete_entity;
#placeholder serialize_entity;
#placeholder deserialize_entity;
#placeholder duplicate_entity;
#placeholder entity_ui;
MAX_CACHED_PILES :: 8; MAX_CACHED_PILES :: 8;
last_unnamed_scene_id := 0; last_unnamed_scene_id := 0;

View File

@@ -207,9 +207,11 @@ generate_ui_procedure_for_entity :: (code_struct: *Code_Struct) {
// Serialize // Serialize
ui : String_Builder; ui : String_Builder;
print_to_builder(*ui, "#if EDITOR {");
print_to_builder(*ui, "entity_ui_proc :: (e: *%) {\n", name); print_to_builder(*ui, "entity_ui_proc :: (e: *%) {\n", name);
generate_member_ui(code_struct.defined_type, *ui); generate_member_ui(code_struct.defined_type, *ui);
print_to_builder(*ui, "}\n"); print_to_builder(*ui, "}\n");
print_to_builder(*ui, "}");
array_add(*entity_serialize_proc_string, builder_to_string(*ui)); array_add(*entity_serialize_proc_string, builder_to_string(*ui));
} }
@@ -273,7 +275,7 @@ note_struct :: (code_struct: *Code_Struct) {
} }
} }
import: *Message_Import; message: *Message_Import;
message_loop :: () { message_loop :: () {
while true { while true {
@@ -284,9 +286,7 @@ message_loop :: () {
if message.kind == { if message.kind == {
case .IMPORT; { case .IMPORT; {
import := cast(*Message_Import)message; import := cast(*Message_Import)message;
if import.module_name == "Coven" { if import.module_name == "Coven" message = import;
message = import;
}
} }
case .TYPECHECKED; case .TYPECHECKED;
typechecked := cast(*Message_Typechecked) message; typechecked := cast(*Message_Typechecked) message;
@@ -451,6 +451,7 @@ generate_code :: (w: Workspace) {
// Add this string to the target program: // Add this string to the target program:
add_build_string(build_string, w); add_build_string(build_string, w);
add_build_string(PLACEHOLDER, w);
// We'll print out the added code just to show at compile-time what we are doing: // We'll print out the added code just to show at compile-time what we are doing:
//print("Adding build string:\n%\n", build_string); //print("Adding build string:\n%\n", build_string);
@@ -538,11 +539,13 @@ duplicate_entity :: (e: *Entity) -> *Entity {
DONE DONE
ENTITY_UI :: #string DONE ENTITY_UI :: #string DONE
#if EDITOR {
entity_ui :: (e: *Entity) { entity_ui :: (e: *Entity) {
if e.type == { if e.type == {
%1 %1
} }
} }
}
DONE DONE
INIT_SCENE :: #string DONE INIT_SCENE :: #string DONE
@@ -561,3 +564,17 @@ editor_ui_entity_creation :: () -> *Entity {
} }
} }
DONE DONE
PLACEHOLDER :: #string DONE
#poke_name Coven init_scene;
#poke_name Coven Entity_Storage;
#poke_name Coven delete_entity;
#poke_name Coven deserialize_entity;
#poke_name Coven serialize_entity;
#if EDITOR {
#poke_name Coven editor_ui_entity_creation;
#poke_name Coven entity_ui;
#poke_name Coven duplicate_entity;
}
DONE