From c6e8fcd81326361a8bc254120eafb0ab61d91d88 Mon Sep 17 00:00:00 2001 From: Graham Nelson Date: Mon, 27 Jan 2020 23:20:49 +0000 Subject: [PATCH] Created inbuild-module --- inbuild/Contents.w | 1 + .../inbuild-module/Chapter 1/Inbuild Module.w | 56 +++++++++++++++++++ .../inbuild-module/Chapter 2}/Kits.w | 27 +++++---- inbuild/inbuild-module/Contents.w | 11 ++++ inform7/Contents.w | 1 + inform7/core-module/Chapter 1/Core Module.w | 6 -- inform7/core-module/Chapter 1/Main Routine.w | 2 +- inform7/core-module/Contents.w | 1 - 8 files changed, 86 insertions(+), 19 deletions(-) create mode 100644 inbuild/inbuild-module/Chapter 1/Inbuild Module.w rename {inform7/core-module/Chapter 1 => inbuild/inbuild-module/Chapter 2}/Kits.w (95%) create mode 100644 inbuild/inbuild-module/Contents.w diff --git a/inbuild/Contents.w b/inbuild/Contents.w index b8dde02b2..4895f1bfd 100644 --- a/inbuild/Contents.w +++ b/inbuild/Contents.w @@ -7,6 +7,7 @@ Version Number: 1 Version Name: Avignon Import: foundation +Import: inbuild Preliminaries Using Inbuild diff --git a/inbuild/inbuild-module/Chapter 1/Inbuild Module.w b/inbuild/inbuild-module/Chapter 1/Inbuild Module.w new file mode 100644 index 000000000..63f1b516e --- /dev/null +++ b/inbuild/inbuild-module/Chapter 1/Inbuild Module.w @@ -0,0 +1,56 @@ +[InbuildModule::] Inter Module. + +Setting up the use of this module. + +@h Introduction. + +@d INBUILD_MODULE TRUE + +@ To begin with, this module needs to allocate memory: + +@e inform_kit_MT +@e inform_kit_ittt_MT +@e element_activation_MT + += +ALLOCATE_INDIVIDUALLY(inform_kit) +ALLOCATE_INDIVIDUALLY(inform_kit_ittt) +ALLOCATE_INDIVIDUALLY(element_activation) + +@h The beginning. +(The client doesn't need to call the start and end routines, because the +foundation module does that automatically.) + += +void InbuildModule::start(void) { + @; + @; + @; + @; + @; +} + +@ + +@ = + ; + +@ = + ; + +@ + +@ = + ; + +@ = + ; + +@ = + ; + +@h The end. + += +void InbuildModule::end(void) { +} diff --git a/inform7/core-module/Chapter 1/Kits.w b/inbuild/inbuild-module/Chapter 2/Kits.w similarity index 95% rename from inform7/core-module/Chapter 1/Kits.w rename to inbuild/inbuild-module/Chapter 2/Kits.w index 6ca1a393f..42df58ab4 100644 --- a/inform7/core-module/Chapter 1/Kits.w +++ b/inbuild/inbuild-module/Chapter 2/Kits.w @@ -66,12 +66,9 @@ inform_kit *Kits::load_at(text_stream *name, pathname *P) { return K; } -inform_kit *Kits::load(text_stream *name) { - pathname *P = Kits::find(name, NO_FS_AREAS, pathname_of_inter_resources); - if (P == NULL) { - WRITE_TO(STDERR, "Cannot find kit '%S'\n", name); - Problems::Fatal::issue("Unable to find one of the Inform support kits"); - } +inform_kit *Kits::load(text_stream *name, int N, pathname **PP) { + pathname *P = Kits::find(name, N, PP); + if (P == NULL) Errors::fatal_with_text("cannot find kit", name); return Kits::load_at(name, P); } @@ -137,7 +134,7 @@ int Kits::loaded(text_stream *name) { return FALSE; } -void Kits::perform_ittt(void) { +void Kits::perform_ittt(int N, pathname **PP) { int changes_made = TRUE; while (changes_made) { changes_made = FALSE; @@ -147,7 +144,7 @@ void Kits::perform_ittt(void) { LOOP_OVER_LINKED_LIST(ITTT, inform_kit_ittt, K->ittt) if ((Kits::loaded(ITTT->then_name) == FALSE) && (Kits::loaded(ITTT->if_name) == ITTT->if_included)) { - Kits::load(ITTT->then_name); + Kits::load(ITTT->then_name, N, PP); changes_made = TRUE; } } @@ -165,15 +162,16 @@ void Kits::request(text_stream *name) { ADD_TO_LINKED_LIST(Str::duplicate(name), text_stream, kits_requested); } -void Kits::determine(void) { +#ifdef CORE_MODULE +void Kits::determine(int N, pathname **PP) { if (kits_requested == NULL) Kits::request(I"CommandParserKit"); Kits::request(I"BasicInformKit"); NaturalLanguages::request_required_kits(); text_stream *kit_name; LOOP_OVER_LINKED_LIST(kit_name, text_stream, kits_requested) - Kits::load(kit_name); + Kits::load(kit_name, N, PP); - Kits::perform_ittt(); + Kits::perform_ittt(N, PP); kits_to_include = NEW_LINKED_LIST(inform_kit); for (int p=0; p<100; p++) { @@ -186,7 +184,9 @@ void Kits::determine(void) { LOOP_OVER_LINKED_LIST(K, inform_kit, kits_to_include) LOG("Using Inform kit '%S' (priority %d).\n", K->name, K->priority); } +#endif +#ifdef CORE_MODULE void Kits::load_types(void) { inform_kit *K; LOOP_OVER_LINKED_LIST(K, inform_kit, kits_to_include) { @@ -199,7 +199,9 @@ void Kits::load_types(void) { } } } +#endif +#ifdef CORE_MODULE void Kits::activate_plugins(void) { LOG("Activate plugins...\n"); Plugins::Manage::activate(CORE_PLUGIN_NAME); @@ -221,6 +223,7 @@ void Kits::activate_plugins(void) { Plugins::Manage::show(DL, "Included", TRUE); Plugins::Manage::show(DL, "Excluded", FALSE); } +#endif int Kits::Main_defined(void) { inform_kit *K; @@ -273,6 +276,7 @@ int Kits::number_of_early_fed_sentences(void) { return N; } +#ifdef CODEGEN_MODULE linked_list *requirements_list = NULL; linked_list *Kits::list_of_inter_libraries(void) { requirements_list = NEW_LINKED_LIST(link_instruction); @@ -283,3 +287,4 @@ linked_list *Kits::list_of_inter_libraries(void) { } return requirements_list; } +#endif diff --git a/inbuild/inbuild-module/Contents.w b/inbuild/inbuild-module/Contents.w new file mode 100644 index 000000000..a12490abb --- /dev/null +++ b/inbuild/inbuild-module/Contents.w @@ -0,0 +1,11 @@ +Title: inbuild +Author: Graham Nelson +Purpose: The functional part of the build manager. +Language: InC +Licence: Artistic License 2.0 + +Chapter 1: Setting Up + Inbuild Module + +Chapter 2: Everything Else + Kits diff --git a/inform7/Contents.w b/inform7/Contents.w index e308a1e6d..327f198b0 100644 --- a/inform7/Contents.w +++ b/inform7/Contents.w @@ -20,6 +20,7 @@ Import: inter/inter Import: core Import: inter/building Import: inter/codegen +Import: inbuild/inbuild Import: if Import: multimedia Import: index diff --git a/inform7/core-module/Chapter 1/Core Module.w b/inform7/core-module/Chapter 1/Core Module.w index 0169210c4..be0bc0963 100644 --- a/inform7/core-module/Chapter 1/Core Module.w +++ b/inform7/core-module/Chapter 1/Core Module.w @@ -99,9 +99,6 @@ We need to itemise the structures we'll want to allocate: @e value_holster_array_MT @e adjective_iname_holder_MT @e label_namespace_MT -@e inform_kit_MT -@e inform_kit_ittt_MT -@e element_activation_MT @ Deep breath, then: the following macros define several hundred functions. @@ -174,9 +171,6 @@ ALLOCATE_INDIVIDUALLY(VM_usage_note) ALLOCATE_INDIVIDUALLY(runtime_kind_structure) ALLOCATE_INDIVIDUALLY(adjective_iname_holder) ALLOCATE_INDIVIDUALLY(label_namespace) -ALLOCATE_INDIVIDUALLY(inform_kit) -ALLOCATE_INDIVIDUALLY(inform_kit_ittt) -ALLOCATE_INDIVIDUALLY(element_activation) @ So much for the managed structures: now for the unmanaged structures. diff --git a/inform7/core-module/Chapter 1/Main Routine.w b/inform7/core-module/Chapter 1/Main Routine.w index 97253c5e1..6fcb0fbea 100644 --- a/inform7/core-module/Chapter 1/Main Routine.w +++ b/inform7/core-module/Chapter 1/Main Routine.w @@ -225,7 +225,7 @@ list is not exhaustive. doc_references_top = lexer_wordcount - 1; @ = - COMPILATION_STEP(Kits::determine, I"Kits::determine") + Kits::determine(NO_FS_AREAS, pathname_of_inter_resources); @ = ProgressBar::update_progress_bar(0, 0); diff --git a/inform7/core-module/Contents.w b/inform7/core-module/Contents.w index d11072659..963eeddc6 100644 --- a/inform7/core-module/Contents.w +++ b/inform7/core-module/Contents.w @@ -9,7 +9,6 @@ Chapter 1: Configuration and Control execution, and which reads command-line switches supplied by its customers." Main Routine Core Module - Kits Progress Percentages Where Everything Lives