1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-06-26 04:00:43 +03:00

Created inbuild-module

This commit is contained in:
Graham Nelson 2020-01-27 23:20:49 +00:00
parent 1f2cf3cc2d
commit c6e8fcd813
8 changed files with 86 additions and 19 deletions

View file

@ -7,6 +7,7 @@ Version Number: 1
Version Name: Avignon
Import: foundation
Import: inbuild
Preliminaries
Using Inbuild

View file

@ -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) {
@<Register this module's memory allocation reasons@>;
@<Register this module's stream writers@>;
@<Register this module's debugging log aspects@>;
@<Register this module's debugging log writers@>;
@<Register this module's command line switches@>;
}
@
@<Register this module's memory allocation reasons@> =
;
@<Register this module's stream writers@> =
;
@
@<Register this module's debugging log aspects@> =
;
@<Register this module's debugging log writers@> =
;
@<Register this module's command line switches@> =
;
@h The end.
=
void InbuildModule::end(void) {
}

View file

@ -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

View file

@ -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

View file

@ -20,6 +20,7 @@ Import: inter/inter
Import: core
Import: inter/building
Import: inter/codegen
Import: inbuild/inbuild
Import: if
Import: multimedia
Import: index

View file

@ -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.

View file

@ -225,7 +225,7 @@ list is not exhaustive.
doc_references_top = lexer_wordcount - 1;
@<Work out our kit requirements@> =
COMPILATION_STEP(Kits::determine, I"Kits::determine")
Kits::determine(NO_FS_AREAS, pathname_of_inter_resources);
@<Perform lexical analysis@> =
ProgressBar::update_progress_bar(0, 0);

View file

@ -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