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

Reorganised inbuild's run into sequenced phases

This commit is contained in:
Graham Nelson 2020-02-13 19:43:24 +00:00
parent 978aa77772
commit 56b2a15450
19 changed files with 236 additions and 143 deletions

View file

@ -116,12 +116,12 @@ int main(int argc, char **argv) {
L"apply to all works in nest(s) matching requirement X");
CommandLine::declare_switch(CONTENTS_OF_CLSW, L"contents-of", 2,
L"apply to all targets in the directory X");
SharedCLI::declare_options();
Inbuild::declare_options();
CommandLine::read(argc, argv, NULL, &Main::option, &Main::bareword);
if (LinkedLists::len(unsorted_nest_list) == 0)
SharedCLI::add_nest(
Inbuild::add_nest(
Pathnames::from_text(I"inform7/Internal"), INTERNAL_NEST_TAG);
CommandLine::play_back_log();
@ -134,16 +134,16 @@ int main(int argc, char **argv) {
else proj = C;
}
proj = SharedCLI::optioneering_complete(proj);
proj = Inbuild::optioneering_complete(proj);
if (proj) {
int found = FALSE;
LOOP_OVER_LINKED_LIST(C, inbuild_copy, targets)
if (C == proj)
found = TRUE;
if (found == FALSE) ADD_TO_LINKED_LIST(proj, inbuild_copy, targets);
Projects::construct_graph(SharedCLI::project());
}
inbuild_nest_list = SharedCLI::nest_list();
inbuild_nest_list = Inbuild::nest_list();
Inbuild::go_operational();
@ =
void Main::option(int id, int val, text_stream *arg, void *state) {
@ -163,7 +163,7 @@ void Main::option(int id, int val, text_stream *arg, void *state) {
destination_nest = Nests::new(Pathnames::from_text(arg));
break;
}
SharedCLI::option(id, val, arg, state);
Inbuild::option(id, val, arg, state);
}
void Main::bareword(int id, text_stream *arg, void *state) {

View file

@ -1,18 +1,133 @@
[SharedCLI::] Shared CLI.
[Inbuild::] Inbuild Control.
A subset of command-line options shared by the tools which incorporate this
module.
The top-level controller through which client tools use this module.
@h Using this API.
The Inbuild module has to be used in three phases, as follows:
@h Phases.
Although nothing at all clever happens in this section, it requires careful
sequencing to avoid invisible errors coming in because function X assumes
that function Y has already been called, or perhaos that it never will
be again. The client tool ("the tool") has to work in the following way
to avoid those problems.
Firstly, the inbuild module runs through the following phases in sequence:
@e CONFIGURATION_INBUILD_PHASE from 1
@e PRETINKERING_INBUILD_PHASE
@e TINKERING_INBUILD_PHASE
@e GRAPHING_INBUILD_PHASE
@e NESTED_INBUILD_PHASE
@e PROJECTED_INBUILD_PHASE
@e GOING_OPERATIONAL_INBUILD_PHASE
@e OPERATIONAL_INBUILD_PHASE
@d RUN_ONLY_IN_PHASE(P)
if (inbuild_phase < P) internal_error("too soon");
if (inbuild_phase > P) internal_error("too late");
@d RUN_ONLY_FROM_PHASE(P)
if (inbuild_phase < P) internal_error("too soon");
@d RUN_ONLY_BEFORE_PHASE(P)
if (inbuild_phase >= P) internal_error("too late");
=
int inbuild_phase = CONFIGURATION_INBUILD_PHASE;
@ Initially, then, we are in the configuration phase. This is when command
line processing should be done, and the tool should use the following routines
to add and process command line switches handled by inbuild:
@e INBUILD_CLSG
@e NEST_CLSW
@e INTERNAL_CLSW
@e EXTERNAL_CLSW
@e TRANSIENT_CLSW
@e KIT_CLSW
@e PROJECT_CLSW
@e SOURCE_CLSW
=
void Inbuild::declare_options(void) {
RUN_ONLY_IN_PHASE(CONFIGURATION_INBUILD_PHASE)
CommandLine::begin_group(INBUILD_CLSG);
CommandLine::declare_switch(NEST_CLSW, L"nest", 2,
L"add the nest at pathname X to the search list");
CommandLine::declare_switch(INTERNAL_CLSW, L"internal", 2,
L"use X as the location of built-in material such as the Standard Rules");
CommandLine::declare_switch(EXTERNAL_CLSW, L"external", 2,
L"use X as the user's home for installed material such as extensions");
CommandLine::declare_switch(TRANSIENT_CLSW, L"transient", 2,
L"use X for transient data such as the extensions census");
CommandLine::declare_switch(KIT_CLSW, L"kit", 2,
L"load the Inform kit called X");
CommandLine::declare_switch(PROJECT_CLSW, L"project", 2,
L"work within the Inform project X");
CommandLine::declare_switch(SOURCE_CLSW, L"source", 2,
L"use file X as the Inform source text");
CommandLine::end_group();
}
pathname *shared_transient_resources = NULL;
void Inbuild::option(int id, int val, text_stream *arg, void *state) {
RUN_ONLY_IN_PHASE(CONFIGURATION_INBUILD_PHASE)
switch (id) {
case NEST_CLSW: Inbuild::add_nest(Pathnames::from_text(arg), GENERIC_NEST_TAG); break;
case INTERNAL_CLSW: Inbuild::add_nest(Pathnames::from_text(arg), INTERNAL_NEST_TAG); break;
case EXTERNAL_CLSW: Inbuild::add_nest(Pathnames::from_text(arg), EXTERNAL_NEST_TAG); break;
case TRANSIENT_CLSW: shared_transient_resources = Pathnames::from_text(arg); break;
case KIT_CLSW: Inbuild::request_kit(arg); break;
case PROJECT_CLSW:
if (Inbuild::set_I7_bundle(arg) == FALSE)
Errors::fatal_with_text("can't specify the project twice: '%S'", arg);
break;
case SOURCE_CLSW:
if (Inbuild::set_I7_source(arg) == FALSE)
Errors::fatal_with_text("can't specify the source file twice: '%S'", arg);
break;
}
}
@ Once the tool has finished with the command line, it should call this
function.Inbuild rapidly runs through the next few phases as it does so.
From the "nested" phase, the final list of nests in the search path for
finding kits, extensions and so on exists; from the "projected" phase,
the main Inform project exists. As we shall see, Inbuild deals with only
one Inform project at a time, though it may be handling many kits and
extensions, and so on, which are needed by that project.
=
inbuild_copy *Inbuild::optioneering_complete(inbuild_copy *C) {
RUN_ONLY_IN_PHASE(CONFIGURATION_INBUILD_PHASE)
inbuild_phase = PRETINKERING_INBUILD_PHASE;
Inbuild::create_shared_project(C);
inbuild_phase = TINKERING_INBUILD_PHASE;
Inbuild::sort_nest_list();
inbuild_phase = NESTED_INBUILD_PHASE;
Inbuild::pass_kit_requests();
inbuild_phase = PROJECTED_INBUILD_PHASE;
inform_project *project = Inbuild::project();
return (project)?(project->as_copy):NULL;
}
@ Inbuild is now in the "projected" phase, then. The idea is that this
is a short interval during which the tool can if it wishes add further
kit dependencies to the main project. Once that sort of thing is done,
the tool should call the following, which puts Inbuild into its
final "operational" phase -- at this point Inbuild is fully configured
and ready for use.
The brief "going operational" phase is used, for example, to build out
dependency graphs.
=
void Inbuild::go_operational(void) {
RUN_ONLY_IN_PHASE(PROJECTED_INBUILD_PHASE)
inbuild_phase = GOING_OPERATIONAL_INBUILD_PHASE;
inbuild_copy *C;
LOOP_OVER(C, inbuild_copy)
Model::cppy_go_operational(C);
inbuild_phase = OPERATIONAL_INBUILD_PHASE;
}
@h The nest list.
Nests used by the Inform and Inbuild tools are tagged with the following
comstamts, except that no nest is ever tagged |NOT_A_NEST_TAG|.
@ -38,8 +153,8 @@ inbuild_nest *shared_internal_nest = NULL;
inbuild_nest *shared_external_nest = NULL;
inbuild_nest *shared_materials_nest = NULL;
inbuild_nest *SharedCLI::add_nest(pathname *P, int tag) {
if (inbuild_phase > CONFIGURATION_INBUILD_PHASE) internal_error("too late");
inbuild_nest *Inbuild::add_nest(pathname *P, int tag) {
RUN_ONLY_BEFORE_PHASE(TINKERING_INBUILD_PHASE)
if (unsorted_nest_list == NULL)
unsorted_nest_list = NEW_LINKED_LIST(inbuild_nest);
inbuild_nest *N = Nests::new(P);
@ -59,9 +174,8 @@ are given precedence over those in the external folder, and so on.
=
linked_list *shared_nest_list = NULL;
void SharedCLI::sort_nest_list(void) {
if (inbuild_phase < TINKERING_INBUILD_PHASE) internal_error("too soon");
if (inbuild_phase > TINKERING_INBUILD_PHASE) internal_error("too late");
void Inbuild::sort_nest_list(void) {
RUN_ONLY_IN_PHASE(TINKERING_INBUILD_PHASE)
shared_nest_list = NEW_LINKED_LIST(inbuild_nest);
inbuild_nest *N;
LOOP_OVER_LINKED_LIST(N, inbuild_nest, unsorted_nest_list)
@ -81,20 +195,24 @@ void SharedCLI::sort_nest_list(void) {
@ And the rest of Inform or Inbuild can now use:
=
linked_list *SharedCLI::nest_list(void) {
linked_list *Inbuild::nest_list(void) {
RUN_ONLY_FROM_PHASE(NESTED_INBUILD_PHASE)
if (shared_nest_list == NULL) internal_error("nest list never sorted");
return shared_nest_list;
}
inbuild_nest *SharedCLI::internal(void) {
inbuild_nest *Inbuild::internal(void) {
RUN_ONLY_FROM_PHASE(NESTED_INBUILD_PHASE)
return shared_internal_nest;
}
inbuild_nest *SharedCLI::external(void) {
inbuild_nest *Inbuild::external(void) {
RUN_ONLY_FROM_PHASE(NESTED_INBUILD_PHASE)
return shared_external_nest;
}
pathname *SharedCLI::materials(void) {
pathname *Inbuild::materials(void) {
RUN_ONLY_FROM_PHASE(NESTED_INBUILD_PHASE)
if (shared_materials_nest == NULL) return NULL;
return shared_materials_nest->location;
}
@ -104,8 +222,8 @@ documentation and telemetry files. |-transient| sets it, but otherwise
the external nest is used.
=
pathname *shared_transient_resources = NULL;
pathname *SharedCLI::transient(void) {
pathname *Inbuild::transient(void) {
RUN_ONLY_FROM_PHASE(PROJECTED_INBUILD_PHASE)
if (shared_transient_resources == NULL)
if (shared_external_nest)
return shared_external_nest->location;
@ -127,17 +245,19 @@ specify the bundle twice, or specify the file twice.
text_stream *project_bundle_request = NULL;
text_stream *project_file_request = NULL;
int SharedCLI::set_I7_source(text_stream *loc) {
int Inbuild::set_I7_source(text_stream *loc) {
RUN_ONLY_FROM_PHASE(CONFIGURATION_INBUILD_PHASE)
if (Str::len(project_file_request) > 0) return FALSE;
project_file_request = Str::duplicate(loc);
return TRUE;
}
int SharedCLI::set_I7_bundle(text_stream *loc) {
int Inbuild::set_I7_bundle(text_stream *loc) {
RUN_ONLY_FROM_PHASE(CONFIGURATION_INBUILD_PHASE)
if (Str::len(project_bundle_request) > 0) return FALSE;
project_bundle_request = Str::duplicate(loc);
pathname *pathname_of_bundle = Pathnames::from_text(project_bundle_request);
pathname *materials = SharedCLI::pathname_of_materials(pathname_of_bundle);
pathname *materials = Inbuild::pathname_of_materials(pathname_of_bundle);
TEMPORARY_TEXT(leaf);
WRITE_TO(leaf, "%s-settings.txt", INTOOL_NAME);
filename *expert_settings = Filenames::in_folder(materials, leaf);
@ -155,7 +275,8 @@ int SharedCLI::set_I7_bundle(text_stream *loc) {
=
inform_project *shared_project = NULL;
void SharedCLI::create_shared_project(inbuild_copy *C) {
void Inbuild::create_shared_project(inbuild_copy *C) {
RUN_ONLY_IN_PHASE(PRETINKERING_INBUILD_PHASE)
filename *filename_of_i7_source = NULL;
pathname *pathname_of_bundle = NULL;
if (Str::len(project_bundle_request) > 0) {
@ -192,19 +313,20 @@ void SharedCLI::create_shared_project(inbuild_copy *C) {
@<Create the materials nest@> =
pathname *materials = NULL;
if (pathname_of_bundle) {
materials = SharedCLI::pathname_of_materials(pathname_of_bundle);
materials = Inbuild::pathname_of_materials(pathname_of_bundle);
Pathnames::create_in_file_system(materials);
} else if (filename_of_i7_source) {
materials = Pathnames::from_text(I"inform.materials");
}
if (materials) {
shared_materials_nest = SharedCLI::add_nest(materials, MATERIALS_NEST_TAG);
shared_materials_nest = Inbuild::add_nest(materials, MATERIALS_NEST_TAG);
}
@ And the rest of Inform or Inbuild can now use:
=
inform_project *SharedCLI::project(void) {
inform_project *Inbuild::project(void) {
RUN_ONLY_FROM_PHASE(PROJECTED_INBUILD_PHASE)
return shared_project;
}
@ -212,7 +334,7 @@ inform_project *SharedCLI::project(void) {
but ending |.materials| instead of |.inform|.
=
pathname *SharedCLI::pathname_of_materials(pathname *pathname_of_bundle) {
pathname *Inbuild::pathname_of_materials(pathname *pathname_of_bundle) {
TEMPORARY_TEXT(mf);
WRITE_TO(mf, "%S", Pathnames::directory_name(pathname_of_bundle));
int i = Str::len(mf)-1;
@ -227,10 +349,14 @@ pathname *SharedCLI::pathname_of_materials(pathname *pathname_of_bundle) {
}
@h Kit requests.
These are triggered by, for example, |-kit MyFancyKit| at the command line.
For timing reasons, we store those up in the configuration phase and then
add them as dependencies only when a project exists.
=
linked_list *kits_requested_at_command_line = NULL;
void SharedCLI::request_kit(text_stream *name) {
void Inbuild::request_kit(text_stream *name) {
RUN_ONLY_IN_PHASE(CONFIGURATION_INBUILD_PHASE)
if (kits_requested_at_command_line == NULL)
kits_requested_at_command_line = NEW_LINKED_LIST(text_stream);
text_stream *kit_name;
@ -240,7 +366,8 @@ void SharedCLI::request_kit(text_stream *name) {
ADD_TO_LINKED_LIST(Str::duplicate(name), text_stream, kits_requested_at_command_line);
}
void SharedCLI::pass_kit_requests(void) {
void Inbuild::pass_kit_requests(void) {
RUN_ONLY_IN_PHASE(NESTED_INBUILD_PHASE)
if ((shared_project) && (kits_requested_at_command_line)) {
text_stream *kit_name;
LOOP_OVER_LINKED_LIST(kit_name, text_stream, kits_requested_at_command_line) {
@ -250,65 +377,4 @@ void SharedCLI::pass_kit_requests(void) {
}
}
@h Command line.
We add the following switches:
@e INBUILD_CLSG
@e NEST_CLSW
@e INTERNAL_CLSW
@e EXTERNAL_CLSW
@e TRANSIENT_CLSW
@e KIT_CLSW
@e PROJECT_CLSW
@e SOURCE_CLSW
=
void SharedCLI::declare_options(void) {
CommandLine::begin_group(INBUILD_CLSG);
CommandLine::declare_switch(NEST_CLSW, L"nest", 2,
L"add the nest at pathname X to the search list");
CommandLine::declare_switch(INTERNAL_CLSW, L"internal", 2,
L"use X as the location of built-in material such as the Standard Rules");
CommandLine::declare_switch(EXTERNAL_CLSW, L"external", 2,
L"use X as the user's home for installed material such as extensions");
CommandLine::declare_switch(TRANSIENT_CLSW, L"transient", 2,
L"use X for transient data such as the extensions census");
CommandLine::declare_switch(KIT_CLSW, L"kit", 2,
L"load the Inform kit called X");
CommandLine::declare_switch(PROJECT_CLSW, L"project", 2,
L"work within the Inform project X");
CommandLine::declare_switch(SOURCE_CLSW, L"source", 2,
L"use file X as the Inform source text");
CommandLine::end_group();
}
void SharedCLI::option(int id, int val, text_stream *arg, void *state) {
switch (id) {
case NEST_CLSW: SharedCLI::add_nest(Pathnames::from_text(arg), GENERIC_NEST_TAG); break;
case INTERNAL_CLSW: SharedCLI::add_nest(Pathnames::from_text(arg), INTERNAL_NEST_TAG); break;
case EXTERNAL_CLSW: SharedCLI::add_nest(Pathnames::from_text(arg), EXTERNAL_NEST_TAG); break;
case TRANSIENT_CLSW: shared_transient_resources = Pathnames::from_text(arg); break;
case KIT_CLSW: SharedCLI::request_kit(arg); break;
case PROJECT_CLSW:
if (SharedCLI::set_I7_bundle(arg) == FALSE)
Errors::fatal_with_text("can't specify the project twice: '%S'", arg);
break;
case SOURCE_CLSW:
if (SharedCLI::set_I7_source(arg) == FALSE)
Errors::fatal_with_text("can't specify the source file twice: '%S'", arg);
break;
}
}
@ The client tool (i.e., Inform or Inbuild) should call this when no further
options remain to be processed.
=
inbuild_copy *SharedCLI::optioneering_complete(inbuild_copy *C) {
SharedCLI::create_shared_project(C);
inbuild_phase = TINKERING_INBUILD_PHASE;
SharedCLI::sort_nest_list();
SharedCLI::pass_kit_requests();
return (shared_project)?(shared_project->as_copy):NULL;
}

View file

@ -10,6 +10,7 @@ few of these.
@e GENRE_CLAIM_AS_COPY_MTID
@e GENRE_SEARCH_NEST_FOR_MTID
@e GENRE_COPY_TO_NEST_MTID
@e GENRE_GO_OPERATIONAL_MTID
=
typedef struct inbuild_genre {
@ -22,6 +23,7 @@ VMETHOD_TYPE(GENRE_WRITE_WORK_MTID, inbuild_genre *gen, text_stream *OUT, inbuil
VMETHOD_TYPE(GENRE_CLAIM_AS_COPY_MTID, inbuild_genre *gen, inbuild_copy **C, text_stream *arg, text_stream *ext, int directory_status)
VMETHOD_TYPE(GENRE_SEARCH_NEST_FOR_MTID, inbuild_genre *gen, inbuild_nest *N, inbuild_requirement *req, linked_list *search_results)
VMETHOD_TYPE(GENRE_COPY_TO_NEST_MTID, inbuild_genre *gen, inbuild_copy *C, inbuild_nest *N, int syncing, build_methodology *meth)
VMETHOD_TYPE(GENRE_GO_OPERATIONAL_MTID, inbuild_genre *gen, inbuild_copy *C)
@ =
inbuild_genre *Model::genre(text_stream *name) {
@ -125,3 +127,7 @@ inbuild_copy *Model::claim(text_stream *arg) {
DISCARD_TEXT(ext);
return C;
}
void Model::cppy_go_operational(inbuild_copy *C) {
VMETHOD_CALL(C->edition->work->genre, GENRE_GO_OPERATIONAL_MTID, C);
}

View file

@ -12,6 +12,7 @@ void ProjectBundleManager::start(void) {
METHOD_ADD(project_bundle_genre, GENRE_CLAIM_AS_COPY_MTID, ProjectBundleManager::claim_as_copy);
METHOD_ADD(project_bundle_genre, GENRE_SEARCH_NEST_FOR_MTID, ProjectBundleManager::search_nest_for);
METHOD_ADD(project_bundle_genre, GENRE_COPY_TO_NEST_MTID, ProjectBundleManager::copy_to_nest);
METHOD_ADD(project_bundle_genre, GENRE_GO_OPERATIONAL_MTID, ProjectBundleManager::go_operational);
}
void ProjectBundleManager::write_work(inbuild_genre *gen, OUTPUT_STREAM, inbuild_work *work) {
@ -84,9 +85,18 @@ void ProjectBundleManager::copy_to_nest(inbuild_genre *gen, inbuild_copy *C, inb
}
@h Build graph.
The build graph for a project will need further thought.
The build graph for a project will need further thought...
=
void ProjectBundleManager::build_vertex(inbuild_copy *C) {
Graphs::copy_vertex(C);
}
@ which it will get here:
=
void ProjectBundleManager::go_operational(inbuild_genre *G, inbuild_copy *C) {
Projects::construct_graph(ProjectBundleManager::from_copy(C));
}

View file

@ -12,6 +12,7 @@ void ProjectFileManager::start(void) {
METHOD_ADD(project_file_genre, GENRE_CLAIM_AS_COPY_MTID, ProjectFileManager::claim_as_copy);
METHOD_ADD(project_file_genre, GENRE_SEARCH_NEST_FOR_MTID, ProjectFileManager::search_nest_for);
METHOD_ADD(project_file_genre, GENRE_COPY_TO_NEST_MTID, ProjectFileManager::copy_to_nest);
METHOD_ADD(project_file_genre, GENRE_GO_OPERATIONAL_MTID, ProjectFileManager::go_operational);
}
void ProjectFileManager::write_work(inbuild_genre *gen, OUTPUT_STREAM, inbuild_work *work) {
@ -93,3 +94,10 @@ The build graph for a project will need further thought.
void ProjectFileManager::build_vertex(inbuild_copy *C) {
Graphs::copy_vertex(C);
}
@ which it will get here:
=
void ProjectFileManager::go_operational(inbuild_genre *G, inbuild_copy *C) {
Projects::construct_graph(ProjectFileManager::from_copy(C));
}

View file

@ -16,7 +16,7 @@ typedef struct extension_census {
extension_census *Extensions::Census::new(void) {
extension_census *C = CREATE(extension_census);
C->search_list = SharedCLI::nest_list();
C->search_list = Inbuild::nest_list();
C->built_in_tag = INTERNAL_NEST_TAG;
C->materials_tag = MATERIALS_NEST_TAG;
C->external_tag = EXTERNAL_NEST_TAG;

View file

@ -193,7 +193,7 @@ int Kits::number_of_early_fed_sentences(inform_kit *K) {
linked_list *Kits::inter_paths(void) {
linked_list *inter_paths = NEW_LINKED_LIST(pathname);
inbuild_nest *N;
linked_list *L = SharedCLI::nest_list();
linked_list *L = Inbuild::nest_list();
LOOP_OVER_LINKED_LIST(N, inbuild_nest, L)
ADD_TO_LINKED_LIST(KitManager::path_within_nest(N), pathname, inter_paths);
return inter_paths;

View file

@ -65,8 +65,9 @@ linked_list *Projects::source(inform_project *project) {
}
void Projects::add_kit_dependency(inform_project *project, text_stream *kit_name) {
RUN_ONLY_BEFORE_PHASE(OPERATIONAL_INBUILD_PHASE)
if (Projects::uses_kit(project, kit_name)) return;
linked_list *nest_list = SharedCLI::nest_list();
linked_list *nest_list = Inbuild::nest_list();
inform_kit *kit = Kits::load(kit_name, nest_list);
ADD_TO_LINKED_LIST(kit, inform_kit, project->kits_to_include);
}
@ -80,6 +81,7 @@ int Projects::uses_kit(inform_project *project, text_stream *name) {
}
void Projects::finalise_kit_dependencies(inform_project *project) {
RUN_ONLY_IN_PHASE(GOING_OPERATIONAL_INBUILD_PHASE)
Projects::add_kit_dependency(project, I"BasicInformKit");
Languages::request_required_kits(project);
if (project->assumed_to_be_parser_IF)
@ -187,6 +189,7 @@ linked_list *Projects::list_of_inter_libraries(inform_project *project) {
#endif
void Projects::construct_graph(inform_project *project) {
RUN_ONLY_IN_PHASE(GOING_OPERATIONAL_INBUILD_PHASE)
if (project == NULL) return;
Projects::finalise_kit_dependencies(project);
build_vertex *V = project->as_copy->vertex;

View file

@ -6,7 +6,7 @@ Licence: Artistic License 2.0
Chapter 1: Setting Up
Inbuild Module
Shared CLI
Inbuild Control
Chapter 2: Conceptual Framework
Conceptual Model

View file

@ -162,13 +162,13 @@ list is not exhaustive.
L"specify code-generation pipeline from file X");
CommandLine::declare_switch(PIPELINE_VARIABLE_CLSW, L"variable", 2,
L"set pipeline variable X (in form name=value)");
SharedCLI::declare_options();
Inbuild::declare_options();
@<Establish our location in the file system@> =
path_to_inform7 = Pathnames::installation_path("INFORM7_PATH", I"inform7");
@<With that done, configure all other settings@> =
SharedCLI::optioneering_complete(NULL);
Inbuild::optioneering_complete(NULL);
VirtualMachines::set_identifier(story_filename_extension);
if (Locations::set_defaults(census_mode) == FALSE)
Problems::Fatal::issue("Unable to create folders in local file system");
@ -212,7 +212,7 @@ list is not exhaustive.
doc_references_top = lexer_wordcount - 1;
@<Work out our kit requirements@> =
Projects::construct_graph(SharedCLI::project());
Inbuild::go_operational();
@<Perform lexical analysis@> =
ProgressBar::update_progress_bar(0, 0);
@ -223,7 +223,7 @@ list is not exhaustive.
@<Perform semantic analysis@> =
ProgressBar::update_progress_bar(1, 0);
if (problem_count == 0) CoreMain::go_to_log_phase(I"Semantic analysis Ia");
Projects::activate_plugins(SharedCLI::project());
Projects::activate_plugins(Inbuild::project());
COMPILATION_STEP(ParseTreeUsage::plant_parse_tree, I"ParseTreeUsage::plant_parse_tree")
COMPILATION_STEP(StructuralSentences::break_source, I"StructuralSentences::break_source")
COMPILATION_STEP(Extensions::Inclusion::traverse, I"Extensions::Inclusion::traverse")
@ -231,7 +231,7 @@ list is not exhaustive.
if (problem_count == 0) CoreMain::go_to_log_phase(I"Initialise language semantics");
COMPILATION_STEP(Plugins::Manage::start_plugins, I"Plugins::Manage::start_plugins");
Projects::load_types(SharedCLI::project());
Projects::load_types(Inbuild::project());
COMPILATION_STEP(BinaryPredicates::make_built_in, I"BinaryPredicates::make_built_in")
COMPILATION_STEP(NewVerbs::add_inequalities, I"NewVerbs::add_inequalities")
@ -368,7 +368,7 @@ with "Output.i6t".
COMPILATION_STEP(Lists::check, I"Lists::check")
COMPILATION_STEP(Lists::compile, I"Lists::compile")
if (Projects::Main_defined(SharedCLI::project()) == FALSE)
if (Projects::Main_defined(Inbuild::project()) == FALSE)
COMPILATION_STEP(Phrases::invoke_to_begin, I"Phrases::invoke_to_begin")
COMPILATION_STEP(Phrases::Manager::compile_as_needed, I"Phrases::Manager::compile_as_needed")
COMPILATION_STEP(Strings::compile_responses, I"Strings::compile_responses")
@ -432,7 +432,7 @@ with "Output.i6t".
inbuild_requirement *req =
Requirements::any_version_of(Works::new(pipeline_genre, inter_processing_file, NULL));
linked_list *L = NEW_LINKED_LIST(inbuild_search_result);
Nests::search_for(req, SharedCLI::nest_list(), L);
Nests::search_for(req, Inbuild::nest_list(), L);
if (LinkedLists::len(L) == 0) {
WRITE_TO(STDERR, "Sought pipeline '%S'\n", inter_processing_file);
Problems::Fatal::issue("The Inter pipeline could not be found");
@ -450,7 +450,7 @@ with "Output.i6t".
}
CodeGen::Pipeline::set_repository(SS, Emit::tree());
CodeGen::Pipeline::run(Filenames::get_path_to(filename_of_compiled_i6_code),
SS, Kits::inter_paths(), Projects::list_of_inter_libraries(SharedCLI::project()));
SS, Kits::inter_paths(), Projects::list_of_inter_libraries(Inbuild::project()));
}
LOG("Back end elapsed time: %dcs\n", ((int) (clock() - front_end)) / (CLOCKS_PER_SEC/100));
}
@ -546,11 +546,11 @@ void CoreMain::switch(int id, int val, text_stream *arg, void *state) {
break;
}
}
SharedCLI::option(id, val, arg, state);
Inbuild::option(id, val, arg, state);
}
void CoreMain::bareword(int id, text_stream *opt, void *state) {
if (SharedCLI::set_I7_source(opt) == FALSE)
if (Inbuild::set_I7_source(opt) == FALSE)
Errors::fatal_with_text("unknown command line argument: %S (see -help)", opt);
}

View file

@ -71,7 +71,7 @@ int Locations::set_defaults(int census_mode) {
@<External resources@>;
@<Project resources@>;
@<Materials resources@>;
inform_project *project = SharedCLI::project();
inform_project *project = Inbuild::project();
if ((census_mode == FALSE) && (project == NULL))
Problems::Fatal::issue("Except in census mode, source text must be supplied");
if ((census_mode) && (project))
@ -94,7 +94,7 @@ Inform therefore requires on every run that it be told via the |-internal|
switch where the internal resources folder is.
@<Internal resources@> =
inbuild_nest *I = SharedCLI::internal();
inbuild_nest *I = Inbuild::internal();
if (I == NULL) Problems::Fatal::issue("Did not set -internal when calling");
pathname *pathname_of_internal_folder = I->location;
@ -145,7 +145,7 @@ If |-transient| is not specified, it's the same folder, i.e., Inform does
not distinguish between permanent and transient external resources.
@<External resources@> =
inbuild_nest *E = SharedCLI::external();
inbuild_nest *E = Inbuild::external();
if (E == NULL) {
pathname *P = home_path;
char *subfolder_within = INFORM_FOLDER_RELATIVE_TO_HOME;
@ -156,14 +156,14 @@ not distinguish between permanent and transient external resources.
DISCARD_TEXT(SF);
}
P = Pathnames::subfolder(P, I"Inform");
E = SharedCLI::add_nest(P, EXTERNAL_NEST_TAG);
E = Inbuild::add_nest(P, EXTERNAL_NEST_TAG);
}
pathname *pathname_of_external_folder = E->location;
if (Pathnames::create_in_file_system(pathname_of_external_folder) == 0) return FALSE;
@<Permanent external resources@>;
pathname *pathname_of_transient_external_resources = SharedCLI::transient();
pathname *pathname_of_transient_external_resources = Inbuild::transient();
if (Pathnames::create_in_file_system(pathname_of_transient_external_resources) == 0) return FALSE;
@<Transient external resources@>;
@ -240,7 +240,7 @@ have no purpose unless Inform is in a release run (with |-release| set on
the command line), but they take no time to generate so we make them anyway.
@<Project resources@> =
pathname *proj = Projects::path(SharedCLI::project());
pathname *proj = Projects::path(Inbuild::project());
@<The Build folder within the project@>;
@<The Index folder within the project@>;
@ -326,7 +326,7 @@ This is also where the originals (not the released copies) of the Figures
and Sounds, if any, live: in their own subfolders.
@<Figures and sounds@> =
pathname *M = SharedCLI::materials();
pathname *M = Inbuild::materials();
pathname_of_materials_figures = Pathnames::subfolder(M, I"Figures");
pathname_of_materials_sounds = Pathnames::subfolder(M, I"Sounds");
@ -344,7 +344,7 @@ is that everything in Release can always be thrown away without loss, because
it can all be generated again.
@<The Release folder@> =
pathname *M = SharedCLI::materials();
pathname *M = Inbuild::materials();
pathname_of_materials_release = Pathnames::subfolder(M, I"Release");
@ -361,7 +361,7 @@ have by default, if so.
TEMPORARY_TEXT(leaf);
WRITE_TO(leaf, "story.%S", story_filename_extension);
filename_of_existing_story_file =
Filenames::in_folder(SharedCLI::materials(), leaf);
Filenames::in_folder(Inbuild::materials(), leaf);
DISCARD_TEXT(leaf);
@h Location of extensions.
@ -410,7 +410,7 @@ leafname |A.html|.
=
filename *Locations::in_index(text_stream *leafname, int sub) {
pathname *proj = Projects::path(SharedCLI::project());
pathname *proj = Projects::path(Inbuild::project());
if (proj == NULL) return Filenames::in_folder(NULL, leafname);
if (sub >= 0) {
TEMPORARY_TEXT(full_leafname);

View file

@ -21,7 +21,7 @@ void NaturalLanguages::scan(void) {
bundle_scan_made = TRUE;
inbuild_requirement *req = Requirements::anything_of_genre(language_genre);
linked_list *L = NEW_LINKED_LIST(inbuild_search_result);
Nests::search_for(req, SharedCLI::nest_list(), L);
Nests::search_for(req, Inbuild::nest_list(), L);
language_scan_top = lexer_wordcount - 1;
}
}
@ -69,7 +69,7 @@ inform_language *NaturalLanguages::English(void) {
void NaturalLanguages::produce_index(void) {
I6T::interpret_indext(
Filenames::in_folder(
Languages::path_to_bundle(language_of_index), Projects::index_template(SharedCLI::project())));
Languages::path_to_bundle(language_of_index), Projects::index_template(Inbuild::project())));
}
@

View file

@ -30,11 +30,11 @@ int SourceFiles::read_extension_source_text(extension_file *EF,
void SourceFiles::read_primary_source_text(void) {
TEMPORARY_TEXT(early);
Projects::early_source_text(early, SharedCLI::project());
Projects::early_source_text(early, Inbuild::project());
if (Str::len(early) > 0) Feeds::feed_stream(early);
DISCARD_TEXT(early);
SourceFiles::read_further_mandatory_text();
linked_list *L = Projects::source(SharedCLI::project());
linked_list *L = Projects::source(Inbuild::project());
if (L) {
build_vertex *N;
LOOP_OVER_LINKED_LIST(N, build_vertex, L) {
@ -93,7 +93,7 @@ int SourceFiles::read_file(filename *F, text_stream *synopsis, extension_file *E
int area = -1;
if (EF)
area = SourceFiles::read_file_inner(F, synopsis,
SharedCLI::nest_list(), documentation_only, &sf,
Inbuild::nest_list(), documentation_only, &sf,
STORE_POINTER_extension_file(EF), FALSE, EF);
else
area = SourceFiles::read_file_inner(F, synopsis,

View file

@ -209,7 +209,7 @@ void PL::Bibliographic::Release::handle_release_declaration_inner(parse_node *p)
TEMPORARY_TEXT(leaf);
WRITE_TO(leaf, "%N", Wordings::first_wn(SW));
filename_of_existing_story_file =
Filenames::in_folder(SharedCLI::materials(), leaf);
Filenames::in_folder(Inbuild::materials(), leaf);
DISCARD_TEXT(leaf);
}
existing_story_file = TRUE;
@ -221,7 +221,7 @@ void PL::Bibliographic::Release::handle_release_declaration_inner(parse_node *p)
Word::dequote(Wordings::first_wn(DW));
TEMPORARY_TEXT(leaf);
WRITE_TO(leaf, "%N", Wordings::first_wn(LW));
filename *A = Filenames::in_folder(SharedCLI::materials(), leaf);
filename *A = Filenames::in_folder(Inbuild::materials(), leaf);
DISCARD_TEXT(leaf);
PL::Bibliographic::Release::create_aux_file(A,
pathname_of_materials_release,
@ -234,7 +234,7 @@ void PL::Bibliographic::Release::handle_release_declaration_inner(parse_node *p)
Word::dequote(Wordings::first_wn(LW));
TEMPORARY_TEXT(leaf);
WRITE_TO(leaf, "%N", Wordings::first_wn(LW));
filename *A = Filenames::in_folder(SharedCLI::materials(), leaf);
filename *A = Filenames::in_folder(Inbuild::materials(), leaf);
DISCARD_TEXT(leaf);
PL::Bibliographic::Release::create_aux_file(A,
pathname_of_materials_release,
@ -249,7 +249,7 @@ void PL::Bibliographic::Release::handle_release_declaration_inner(parse_node *p)
Word::dequote(Wordings::first_wn(FW));
TEMPORARY_TEXT(leaf);
WRITE_TO(leaf, "%N", Wordings::first_wn(LW));
filename *A = Filenames::in_folder(SharedCLI::materials(), leaf);
filename *A = Filenames::in_folder(Inbuild::materials(), leaf);
DISCARD_TEXT(leaf);
TEMPORARY_TEXT(folder);
WRITE_TO(folder, "%N", Wordings::first_wn(FW));
@ -352,13 +352,13 @@ application sandboxing in Mac OS X in 2012 may force us to revisit this.
}
@<Create the Materials folder if not already present@> =
if (Pathnames::create_in_file_system(SharedCLI::materials()) == FALSE) {
if (Pathnames::create_in_file_system(Inbuild::materials()) == FALSE) {
Problems::Issue::release_problem_path(_p_(Untestable),
"In order to release the story file along with other "
"resources, I tried to create a folder alongside this "
"Inform project, but was unable to do so. The folder "
"was to have been called",
SharedCLI::materials());
Inbuild::materials());
return;
}
@ -614,7 +614,7 @@ void PL::Bibliographic::Release::write_ifiction_record(OUTPUT_STREAM, zbyte *hea
WRITE("<auxiliary>\n"); INDENT;
WRITE("<leafname>");
TEMPORARY_TEXT(rel);
Filenames::to_text_relative(rel, af->name_of_original_file, SharedCLI::materials());
Filenames::to_text_relative(rel, af->name_of_original_file, Inbuild::materials());
HTMLFiles::write_xml_safe_text(OUT, rel);
DISCARD_TEXT(rel);
WRITE("</leafname>\n");
@ -867,7 +867,7 @@ the Blorb-file's filename won't be too long for the file system.
filename_of_cblorb_report);
@<Tell Inblorb where the project and release folders are@> =
WRITE("project folder \"%p\"\n", Projects::path(SharedCLI::project()));
WRITE("project folder \"%p\"\n", Projects::path(Inbuild::project()));
if (create_Materials)
WRITE("release to \"%p\"\n", pathname_of_materials_release);
@ -1001,14 +1001,14 @@ file online.
LOOP_OVER(af, auxiliary_file)
if (af->from_payload == JAVASCRIPT_PAYLOAD) {
TEMPORARY_TEXT(rel);
Filenames::to_text_relative(rel, af->name_of_original_file, SharedCLI::materials());
Filenames::to_text_relative(rel, af->name_of_original_file, Inbuild::materials());
WRITE("<script src='%S'></script>", rel);
DISCARD_TEXT(rel);
}
LOOP_OVER(af, auxiliary_file)
if (af->from_payload == CSS_PAYLOAD) {
TEMPORARY_TEXT(rel);
Filenames::to_text_relative(rel, af->name_of_original_file, SharedCLI::materials());
Filenames::to_text_relative(rel, af->name_of_original_file, Inbuild::materials());
WRITE("<link rel='stylesheet' href='%S' type='text/css' media='all'></link>", rel);
DISCARD_TEXT(rel);
}
@ -1030,7 +1030,7 @@ with the earliest quoted searched first.
@<Tell Inblorb where to find the website templates@> =
inbuild_nest *N;
linked_list *L = SharedCLI::nest_list();
linked_list *L = Inbuild::nest_list();
LOOP_OVER_LINKED_LIST(N, inbuild_nest, L)
WRITE("template path \"%p\"\n", TemplateManager::path_within_nest(N));

View file

@ -100,9 +100,9 @@ void HTMLFiles::html_source_link(OUTPUT_STREAM, source_location sl, int nonbreak
if (sl.file_of_origin) {
TEMPORARY_TEXT(fn);
WRITE_TO(fn, "%f", TextFromFiles::get_filename(sl.file_of_origin));
if (Projects::path(SharedCLI::project())) {
if (Projects::path(Inbuild::project())) {
TEMPORARY_TEXT(pp);
WRITE_TO(pp, "%p", Projects::path(SharedCLI::project()));
WRITE_TO(pp, "%p", Projects::path(Inbuild::project()));
int N = Str::len(pp);
if (Str::prefix_eq(fn, pp, N))
Str::delete_n_characters(fn, N+1);

View file

@ -211,7 +211,7 @@ void PL::Figures::write_picture_manifest(OUTPUT_STREAM, int include_cover,
if (bf->figure_number > 1) {
WRITE("<key>%d</key>\n", bf->figure_number);
TEMPORARY_TEXT(rel);
Filenames::to_text_relative(rel, bf->filename_of_image_file, SharedCLI::materials());
Filenames::to_text_relative(rel, bf->filename_of_image_file, Inbuild::materials());
WRITE("<string>%S</string>\n", rel);
DISCARD_TEXT(rel);
}
@ -335,7 +335,7 @@ void PL::Figures::index_all(OUTPUT_STREAM) {
Index::link(OUT, Wordings::first_wn(bf->name));
TEMPORARY_TEXT(rel);
Filenames::to_text_relative(rel, bf->filename_of_image_file, SharedCLI::materials());
Filenames::to_text_relative(rel, bf->filename_of_image_file, Inbuild::materials());
HTML_TAG("br");
WRITE("%SFilename: \"%S\" - resource number %d", line2, rel, bf->figure_number);
DISCARD_TEXT(rel);

View file

@ -175,7 +175,7 @@ void PL::Sounds::write_sounds_manifest(OUTPUT_STREAM) {
LOOP_OVER(bs, blorb_sound) {
WRITE("<key>%d</key>\n", bs->sound_number);
TEMPORARY_TEXT(rel);
Filenames::to_text_relative(rel, bs->filename_of_sound_file, SharedCLI::materials());
Filenames::to_text_relative(rel, bs->filename_of_sound_file, Inbuild::materials());
WRITE("<string>%S</string>\n", rel);
DISCARD_TEXT(rel);
}
@ -331,7 +331,7 @@ void PL::Sounds::index_all(OUTPUT_STREAM) {
WRITE("%+W", bs->name);
Index::link(OUT, Wordings::first_wn(bs->name));
TEMPORARY_TEXT(rel);
Filenames::to_text_relative(rel, bs->filename_of_sound_file, SharedCLI::materials());
Filenames::to_text_relative(rel, bs->filename_of_sound_file, Inbuild::materials());
HTML_TAG("br");
WRITE("%SFilename: \"%S\" - resource number %d", line2, rel, bs->sound_number);
DISCARD_TEXT(rel);

View file

@ -70,7 +70,7 @@ void Problems::Buffer::copy_source_reference_into_problem_buffer(wording W) {
if (referred) {
WRITE_TO(file, "%f", TextFromFiles::get_filename(referred));
#ifdef INBUILD_MODULE
pathname *proj = Projects::path(SharedCLI::project());
pathname *proj = Projects::path(Inbuild::project());
if (proj) {
TEMPORARY_TEXT(project_prefix);
WRITE_TO(project_prefix, "%p", proj);

View file

@ -453,7 +453,7 @@ source texts implicitly begin with an inclusion of the Standard Rules.)
<if-start-of-source-text> internal 0 {
int w1 = Wordings::first_wn(W);
#ifdef CORE_MODULE
int N = 1 + Projects::number_of_early_fed_sentences(SharedCLI::project());
int N = 1 + Projects::number_of_early_fed_sentences(Inbuild::project());
#endif
#ifndef CORE_MODULE
int N = 3;