diff --git a/README.md b/README.md index 4852f5118..c2883fb97 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Inform 7 -v10.1.0-alpha.1+6T72 'Krypton' (12 November 2021) +v10.1.0-alpha.1+6T73 'Krypton' (13 November 2021) ## About Inform 7 diff --git a/build.txt b/build.txt index a8ffcdd06..acbb8165a 100644 --- a/build.txt +++ b/build.txt @@ -1,3 +1,3 @@ Prerelease: alpha.1 -Build Date: 12 November 2021 -Build Number: 6T72 +Build Date: 13 November 2021 +Build Number: 6T73 diff --git a/docs/building-module/3-prd.html b/docs/building-module/3-prd.html index 4fece7347..a9756980a 100644 --- a/docs/building-module/3-prd.html +++ b/docs/building-module/3-prd.html @@ -622,7 +622,7 @@ API in Local Variables #endif #ifndef CORE_MODULE #ifdef PIPELINE_MODULE - return CodeGen::Pipeline::uks(); + return RunningPipelines::uks(); #endif #ifndef PIPELINE_MODULE return NULL; diff --git a/docs/final-module/2-cg.html b/docs/final-module/2-cg.html index 4001e9285..ec8bdfd45 100644 --- a/docs/final-module/2-cg.html +++ b/docs/final-module/2-cg.html @@ -86,17 +86,17 @@ the same function.
 void CodeGen::create_pipeline_stage(void) {
-    CodeGen::Stage::new(I"generate", CodeGen::run_pipeline_stage,
+    ParsingPipelines::new_stage(I"generate", CodeGen::run_pipeline_stage,
         TEXT_OUT_STAGE_ARG, FALSE);
-    CodeGen::Stage::new(I"optionally-generate", CodeGen::run_pipeline_stage,
+    ParsingPipelines::new_stage(I"optionally-generate", CodeGen::run_pipeline_stage,
         OPTIONAL_TEXT_OUT_STAGE_ARG, FALSE);
 }
 
 int CodeGen::run_pipeline_stage(pipeline_step *step) {
     if (step->generator_argument) {
-        code_generation *gen = CodeGen::new_generation(step->parsed_filename,
-            step->to_stream, step->repository, step->package_argument,
-            step->generator_argument, step->for_VM, FALSE);
+        code_generation *gen = CodeGen::new_generation(step->ephemera.parsed_filename,
+            step->ephemera.to_stream, step->ephemera.repository, step->package_argument,
+            step->generator_argument, step->ephemera.for_VM, FALSE);
         Generators::go(gen);
     }
     return TRUE;
diff --git a/docs/inter/1-mn.html b/docs/inter/1-mn.html
index 00e07c56e..b77ba988e 100644
--- a/docs/inter/1-mn.html
+++ b/docs/inter/1-mn.html
@@ -144,7 +144,7 @@ also done with a pipeline.
 
 
     inter_file_list = NEW_LINKED_LIST(filename);
-    pipeline_vars = CodeGen::Pipeline::basic_dictionary(I"output.i6");
+    pipeline_vars = ParsingPipelines::basic_dictionary(I"output.i6");
     internal_path = Pathnames::from_text(I"inform7/Internal");
 
@@ -158,7 +158,7 @@ form, which would be written to - inter_architecture *A = CodeGen::Architecture::current(); + inter_architecture *A = RunningPipelines::get_architecture(); if (A == NULL) Errors::fatal("no -architecture given"); pathname *path_to_pipelines = Pathnames::down(path_to_inter, I"Pipelines"); @@ -183,13 +183,13 @@ form, which would be written to Errors::fatal("-pipeline-text and -pipeline-file are mutually exclusive"); linked_list *inter_paths = NEW_LINKED_LIST(pathname); if (kit_to_assimilate) ADD_TO_LINKED_LIST(kit_to_assimilate, pathname, inter_paths); - codegen_pipeline *SS; + inter_pipeline *SS; if (pipeline_as_file) - SS = CodeGen::Pipeline::parse_from_file(pipeline_as_file, pipeline_vars); + SS = ParsingPipelines::from_file(pipeline_as_file, pipeline_vars); else - SS = CodeGen::Pipeline::parse(pipeline_as_text, pipeline_vars); + SS = ParsingPipelines::from_text(pipeline_as_text, pipeline_vars); linked_list *requirements_list = NEW_LINKED_LIST(inter_library); - if (SS) CodeGen::Pipeline::run(domain_path, SS, inter_paths, requirements_list, NULL); + if (SS) RunningPipelines::run(domain_path, SS, NULL, inter_paths, requirements_list, NULL); else Errors::fatal("pipeline could not be parsed");
@@ -288,7 +288,7 @@ form, which would be written to case ASSIMILATE_CLSW: kit_to_assimilate = Pathnames::from_text(arg); break; case INTERNAL_CLSW: internal_path = Pathnames::from_text(arg); break; case ARCHITECTURE_CLSW: - if (CodeGen::Architecture::set(arg) == FALSE) + if (RunningPipelines::set_architecture(arg) == FALSE) Errors::fatal("no such -architecture"); break; } diff --git a/docs/pipeline-module/1-arc.html b/docs/pipeline-module/1-arc.html deleted file mode 100644 index 54dafcff4..000000000 --- a/docs/pipeline-module/1-arc.html +++ /dev/null @@ -1,219 +0,0 @@ - - - - Architecture - - - - - - - - - - - - - - - - - - -
- - -

To deal with multiple inter architectures.

- -
- -

§1. Current architecture.

- -
-inter_architecture *current_architecture = NULL;
-int CodeGen::Architecture::set(text_stream *name) {
-    current_architecture = Architectures::from_codename(name);
-    if (current_architecture) return TRUE;
-    return FALSE;
-}
-
-inter_architecture *CodeGen::Architecture::current(void) {
-    return current_architecture;
-}
-
-

§2. Prepare stage.

- -
-void CodeGen::Architecture::create_pipeline_stage(void) {
-    CodeGen::Stage::new(I"prepare", CodeGen::Architecture::run_prepare_stage, GENERAL_STAGE_ARG, TRUE);
-}
-
-int CodeGen::Architecture::run_prepare_stage(pipeline_step *step) {
-    if (current_architecture == NULL) internal_error("no architecture set");
-    return CodeGen::Architecture::run_prepare_stage_inner(step,
-        Architectures::is_16_bit(current_architecture),
-        Architectures::debug_enabled(current_architecture));
-}
-
-int CodeGen::Architecture::run_prepare_stage_inner(pipeline_step *step, int Z, int D) {
-    inter_tree *I = step->repository;
-    Packaging::outside_all_packages(I);
-    PackageTypes::get(I, I"_plain");
-    PackageTypes::get(I, I"_code");
-    PackageTypes::get(I, I"_linkage");
-    inter_symbol *module_name = PackageTypes::get(I, I"_module");
-    PackageTypes::get(I, I"_submodule");
-    PackageTypes::get(I, I"_function");
-    PackageTypes::get(I, I"_action");
-    PackageTypes::get(I, I"_command");
-    PackageTypes::get(I, I"_property");
-    PackageTypes::get(I, I"_to_phrase");
-    PackageTypes::get(I, I"_response");
-    inter_package *main_p = Site::main_package(I);
-    inter_bookmark in_main = Inter::Bookmarks::at_end_of_this_package(main_p);
-    inter_package *generic_p = NULL;
-    Inter::Package::new_package_named(&in_main, I"generic", FALSE, module_name, 1, NULL, &generic_p);
-    inter_bookmark in_generic = Inter::Bookmarks::at_end_of_this_package(generic_p);
-    inter_symbol *unchecked_kind_symbol = InterSymbolsTables::create_with_unique_name(Inter::Bookmarks::scope(&in_generic), I"K_unchecked");
-    Inter::Kind::new(&in_generic,
-        InterSymbolsTables::id_from_symbol(I, generic_p, unchecked_kind_symbol),
-        UNCHECKED_IDT,
-        0,
-        BASE_ICON, 0, NULL,
-        (inter_ti) Inter::Bookmarks::baseline(&in_generic) + 1, NULL);
-    inter_symbol *typeless_int_symbol = InterSymbolsTables::create_with_unique_name(Inter::Bookmarks::scope(&in_generic), I"K_typeless_int");
-    Inter::Kind::new(&in_generic,
-        InterSymbolsTables::id_from_symbol(I, generic_p, typeless_int_symbol),
-        INT32_IDT,
-        0,
-        BASE_ICON, 0, NULL,
-        (inter_ti) Inter::Bookmarks::baseline(&in_generic) + 1, NULL);
-    inter_symbol *truth_state_kind_symbol = InterSymbolsTables::create_with_unique_name(Inter::Bookmarks::scope(&in_generic), I"K_truth_state");
-    Inter::Kind::new(&in_generic,
-        InterSymbolsTables::id_from_symbol(I, generic_p, truth_state_kind_symbol),
-        INT2_IDT,
-        0,
-        BASE_ICON, 0, NULL,
-        (inter_ti) Inter::Bookmarks::baseline(&in_generic) + 1, NULL);
-    inter_symbol *action_name_kind_symbol = InterSymbolsTables::create_with_unique_name(Inter::Bookmarks::scope(&in_generic), I"K_action_name");
-    Inter::Kind::new(&in_generic,
-        InterSymbolsTables::id_from_symbol(I, generic_p, action_name_kind_symbol),
-        INT32_IDT,
-        0,
-        BASE_ICON, 0, NULL,
-        (inter_ti) Inter::Bookmarks::baseline(&in_generic) + 1, NULL);
-    inter_ti operands[2];
-    operands[0] = InterSymbolsTables::id_from_IRS_and_symbol(&in_generic, unchecked_kind_symbol);
-    operands[1] = InterSymbolsTables::id_from_IRS_and_symbol(&in_generic, unchecked_kind_symbol);
-    inter_symbol *unchecked_function_symbol = InterSymbolsTables::create_with_unique_name(Inter::Bookmarks::scope(&in_generic), I"K_unchecked_function");
-    Inter::Kind::new(&in_generic,
-        InterSymbolsTables::id_from_symbol(I, generic_p, unchecked_function_symbol),
-        ROUTINE_IDT,
-        0,
-        FUNCTION_ICON, 2, operands,
-        (inter_ti) Inter::Bookmarks::baseline(&in_generic) + 1, NULL);
-    inter_symbol *list_of_unchecked_kind_symbol = InterSymbolsTables::create_with_unique_name(Inter::Bookmarks::scope(&in_generic), I"K_list_of_values");
-    Inter::Kind::new(&in_generic,
-        InterSymbolsTables::id_from_symbol(I, generic_p, list_of_unchecked_kind_symbol),
-        LIST_IDT,
-        0,
-        LIST_ICON, 1, operands,
-        (inter_ti) Inter::Bookmarks::baseline(&in_generic) + 1, NULL);
-
-    if (Str::ne(step->step_argument, I"none")) {
-        inter_package *template_p = NULL;
-        Inter::Package::new_package_named(&in_main, step->step_argument, FALSE, module_name, 1, NULL, &template_p);
-        Site::set_assimilation_package(I, template_p);
-    }
-
-    inter_bookmark *in_veneer = Site::veneer_booknark(I);
-    inter_package *veneer_p = Inter::Packages::veneer(I);
-    inter_symbol *vi_unchecked = InterSymbolsTables::create_with_unique_name(Inter::Bookmarks::scope(in_veneer), I"K_unchecked");
-    InterSymbolsTables::equate(vi_unchecked, unchecked_kind_symbol);
-    inter_symbol *con_name = InterSymbolsTables::create_with_unique_name(Inter::Bookmarks::scope(in_veneer), I"WORDSIZE");
-    Inter::Constant::new_numerical(in_veneer,
-        InterSymbolsTables::id_from_symbol(I, veneer_p, con_name),
-        InterSymbolsTables::id_from_symbol(I, veneer_p, vi_unchecked),
-        LITERAL_IVAL, (Z)?2:4,
-        (inter_ti) Inter::Bookmarks::baseline(in_veneer) + 1, NULL);
-    inter_symbol *target_name;
-    if (Z) target_name = InterSymbolsTables::create_with_unique_name(Inter::Bookmarks::scope(in_veneer), I"TARGET_ZCODE");
-    else target_name = InterSymbolsTables::create_with_unique_name(Inter::Bookmarks::scope(in_veneer), I"TARGET_GLULX");
-    Inter::Constant::new_numerical(in_veneer,
-        InterSymbolsTables::id_from_symbol(I, veneer_p, target_name),
-        InterSymbolsTables::id_from_symbol(I, veneer_p, vi_unchecked),
-        LITERAL_IVAL, 1,
-        (inter_ti) Inter::Bookmarks::baseline(in_veneer) + 1, NULL);
-    if (D) {
-        inter_symbol *D_name = InterSymbolsTables::create_with_unique_name(Inter::Bookmarks::scope(in_veneer), I"DEBUG");
-        Inter::Constant::new_numerical(in_veneer,
-            InterSymbolsTables::id_from_symbol(I, veneer_p, D_name),
-            InterSymbolsTables::id_from_symbol(I, veneer_p, vi_unchecked),
-            LITERAL_IVAL, 1,
-            (inter_ti) Inter::Bookmarks::baseline(in_veneer) + 1, NULL);
-    }
-    inter_symbol *P_name = InterSymbolsTables::create_with_unique_name(Inter::Bookmarks::scope(in_veneer), I"FILES_PLUGIN");
-    Inter::Constant::new_numerical(in_veneer,
-        InterSymbolsTables::id_from_symbol(I, veneer_p, P_name),
-        InterSymbolsTables::id_from_symbol(I, veneer_p, vi_unchecked),
-        LITERAL_IVAL, 1,
-        (inter_ti) Inter::Bookmarks::baseline(in_veneer) + 1, NULL);
-    return TRUE;
-}
-
- - -
- - - diff --git a/docs/pipeline-module/1-pm.html b/docs/pipeline-module/1-pm.html index a860455db..727189941 100644 --- a/docs/pipeline-module/1-pm.html +++ b/docs/pipeline-module/1-pm.html @@ -76,7 +76,7 @@ which use this module:

enum I6T_intervention_CLASS
-enum codegen_pipeline_CLASS
+enum inter_pipeline_CLASS
 enum pipeline_step_CLASS
 enum uniqueness_count_CLASS
 enum text_literal_holder_CLASS
@@ -88,7 +88,7 @@ which use this module:
 
 DECLARE_CLASS(I6T_intervention)
-DECLARE_CLASS(codegen_pipeline)
+DECLARE_CLASS(inter_pipeline)
 DECLARE_CLASS(pipeline_step)
 DECLARE_CLASS(uniqueness_count)
 DECLARE_CLASS(text_literal_holder)
@@ -150,7 +150,7 @@ which use this module:
 
diff --git a/docs/pipeline-module/1-ppl.html b/docs/pipeline-module/1-ppl.html deleted file mode 100644 index 9504ef26f..000000000 --- a/docs/pipeline-module/1-ppl.html +++ /dev/null @@ -1,609 +0,0 @@ - - - - Pipelines - - - - - - - - - - - - - - - - - - -
- - -

To build and run through pipelines of code generation stages.

- -
- -

§1. Steps. A "step" is a single step in a pipeline of commands: it consists of a -choice of stage, together with a choice of argument. The other elements here -are all temporary storage for information needed when the step is run; they -have no meaningful contents when the step is not running. -

- -
-typedef struct pipeline_step {
-    struct pipeline_stage *step_stage;
-    struct text_stream *step_argument;
-    struct code_generator *generator_argument;
-    int take_generator_argument_from_VM;
-    struct text_stream *package_URL_argument;
-    struct inter_package *package_argument;
-    struct filename *parsed_filename;
-    struct linked_list *the_PP;  of pathname
-    int to_debugging_log;
-    int from_memory;
-    int repository_argument;
-    struct text_stream *to_stream;
-    struct linked_list *requirements_list;  of inter_library
-    struct inter_tree *repository;
-    struct codegen_pipeline *pipeline;
-    struct target_vm *for_VM;
-    CLASS_DEFINITION
-} pipeline_step;
-
-pipeline_step *CodeGen::Pipeline::new_step(void) {
-    pipeline_step *step = CREATE(pipeline_step);
-    step->step_stage = NULL;
-    step->step_argument = NULL;
-    step->package_URL_argument = NULL;
-    step->package_argument = NULL;
-    step->repository_argument = 0;
-    step->generator_argument = NULL;
-    step->take_generator_argument_from_VM = FALSE;
-    CodeGen::Pipeline::clean_step(step);
-    return step;
-}
-
- -

§2. This wipes clean the temporary storage for a step. -

- -
-void CodeGen::Pipeline::clean_step(pipeline_step *step) {
-    step->parsed_filename = NULL;
-    step->to_stream = NULL;
-    step->to_debugging_log = FALSE;
-    step->from_memory = FALSE;
-    step->the_PP = NULL;
-    step->repository = NULL;
-    step->pipeline = NULL;
-    step->requirements_list = NEW_LINKED_LIST(inter_library);
-    step->for_VM = NULL;
-}
-
-

§3. Here we write a textual description to a string, which is useful for -logging: -

- -
-void CodeGen::Pipeline::write_step(OUTPUT_STREAM, pipeline_step *step) {
-    WRITE("%S", step->step_stage->stage_name);
-    if (step->step_stage->stage_arg != NO_STAGE_ARG) {
-        if (step->repository_argument > 0) {
-            WRITE(" %d", step->repository_argument);
-            if (Str::len(step->package_URL_argument) > 0) WRITE(":%S", step->package_URL_argument);
-        } else {
-            if (Str::len(step->package_URL_argument) > 0) WRITE(" %S", step->package_URL_argument);
-        }
-        if (step->step_stage->takes_repository) WRITE(" <- %S", step->step_argument);
-        if (step->generator_argument) WRITE(" %S -> %S", step->generator_argument->generator_name, step->step_argument);
-    }
-}
-
-pipeline_step *CodeGen::Pipeline::read_step(text_stream *step, dictionary *D,
-    text_file_position *tfp) {
-    CodeGen::Stage::make_stages();
-    Generators::make_all();
-    pipeline_step *ST = CodeGen::Pipeline::new_step();
-    match_results mr = Regexp::create_mr();
-    int left_arrow_used = FALSE;
-    int allow_unknown_variables = FALSE;
-    if (Regexp::match(&mr, step, L"optionally-%c+")) allow_unknown_variables = TRUE;
-    if (Regexp::match(&mr, step, L"(%c+?) *<- *(%c*)")) {
-        if (Str::len(mr.exp[1]) > 0) {
-            ST->step_argument = CodeGen::Pipeline::read_parameter(mr.exp[1], D, tfp, allow_unknown_variables);
-            if (ST->step_argument == NULL) return NULL;
-        } else {
-            Errors::in_text_file_S(I"no source to right of arrow", tfp);
-            return NULL;
-        }
-        Str::copy(step, mr.exp[0]);
-        left_arrow_used = TRUE;
-    } else if (Regexp::match(&mr, step, L"(%c+?) (%C+) *-> *(%c*)")) {
-        code_generator *cgt = Generators::find(mr.exp[1]);
-        if (cgt == NULL) {
-            TEMPORARY_TEXT(ERR)
-            WRITE_TO(ERR, "no such code generation format as '%S'\n", mr.exp[1]);
-            Errors::in_text_file_S(ERR, tfp);
-            DISCARD_TEXT(ERR)
-            return NULL;
-        } else {
-            ST->generator_argument = cgt;
-        }
-        ST->step_argument = CodeGen::Pipeline::read_parameter(mr.exp[2], D, tfp, allow_unknown_variables);
-        if (ST->step_argument == NULL) return NULL;
-        Str::copy(step, mr.exp[0]);
-    } else if (Regexp::match(&mr, step, L"(%c+?) *-> *(%c*)")) {
-        ST->generator_argument = NULL;
-        ST->take_generator_argument_from_VM = TRUE;
-        ST->step_argument = CodeGen::Pipeline::read_parameter(mr.exp[1], D, tfp, allow_unknown_variables);
-        if (ST->step_argument == NULL) return NULL;
-        Str::copy(step, mr.exp[0]);
-    }
-    if (Regexp::match(&mr, step, L"(%C+?) (%d)")) {
-        ST->repository_argument = Str::atoi(mr.exp[1], 0);
-        Str::copy(step, mr.exp[0]);
-    } else if (Regexp::match(&mr, step, L"(%C+?) (%d):(%c*)")) {
-        ST->repository_argument = Str::atoi(mr.exp[1], 0);
-        if (Str::len(mr.exp[2]) > 0) {
-            ST->package_URL_argument = CodeGen::Pipeline::read_parameter(mr.exp[2], D, tfp, allow_unknown_variables);
-            if (ST->package_URL_argument == NULL) return NULL;
-        }
-        Str::copy(step, mr.exp[0]);
-    } else if (Regexp::match(&mr, step, L"(%C+?) (%c+)")) {
-        ST->package_URL_argument = CodeGen::Pipeline::read_parameter(mr.exp[1], D, tfp, allow_unknown_variables);
-        if (ST->package_URL_argument == NULL) return NULL;
-        Str::copy(step, mr.exp[0]);
-    }
-
-    pipeline_stage *stage;
-    LOOP_OVER(stage, pipeline_stage)
-        if (Str::eq(step, stage->stage_name))
-            ST->step_stage = stage;
-    if (ST->step_stage == NULL) {
-        TEMPORARY_TEXT(ERR)
-        WRITE_TO(ERR, "no such stage as '%S'\n", step);
-        Errors::in_text_file_S(ERR, tfp);
-        DISCARD_TEXT(ERR)
-        return NULL;
-    }
-    if (ST->step_stage->takes_repository) {
-        if (left_arrow_used == FALSE) {
-            Errors::in_text_file_S(I"this stage should take a left arrow and a source", tfp);
-            return NULL;
-        }
-    } else {
-        if (left_arrow_used) {
-            Errors::in_text_file_S(I"this stage should not take a left arrow and a source", tfp);
-            return NULL;
-        }
-    }
-
-    Regexp::dispose_of(&mr);
-    return ST;
-}
-
-text_stream *CodeGen::Pipeline::read_parameter(text_stream *from, dictionary *D,
-    text_file_position *tfp, int allow_unknown_variables) {
-    if (Str::get_first_char(from) == '*') {
-        text_stream *find = Dictionaries::get_text(D, from);
-        if (find) return Str::duplicate(find);
-        if (allow_unknown_variables == FALSE) {
-            TEMPORARY_TEXT(ERR)
-            WRITE_TO(ERR, "no such pipeline variable as '%S'\n", from);
-            Errors::in_text_file_S(ERR, tfp);
-            DISCARD_TEXT(ERR)
-        } else {
-            return I"";
-        }
-    }
-    return Str::duplicate(from);
-}
-
-

§4. Pipelines. And then a pipeline is just a linked list of steps. -

- -
-typedef struct codegen_pipeline {
-    struct dictionary *variables;
-    struct inter_tree *memory_repository;
-    struct inter_tree *repositories[10];
-    struct linked_list *steps;  of pipeline_step
-    int erroneous;
-    CLASS_DEFINITION
-} codegen_pipeline;
-
-dictionary *CodeGen::Pipeline::basic_dictionary(text_stream *leafname) {
-    dictionary *D = Dictionaries::new(16, TRUE);
-    if (Str::len(leafname) > 0) Str::copy(Dictionaries::create_text(D, I"*out"), leafname);
-    Str::copy(Dictionaries::create_text(D, I"*log"), I"*log");
-    return D;
-}
-
-codegen_pipeline *CodeGen::Pipeline::new(dictionary *D) {
-    codegen_pipeline *S = CREATE(codegen_pipeline);
-    S->variables = D;
-    S->steps = NEW_LINKED_LIST(pipeline_step);
-    S->memory_repository = NULL;
-    S->erroneous = FALSE;
-    for (int i=0; i<10; i++) S->repositories[i] = NULL;
-    return S;
-}
-
-codegen_pipeline *CodeGen::Pipeline::parse_from_file(filename *F, dictionary *D) {
-    codegen_pipeline *S = CodeGen::Pipeline::new(D);
-    TextFiles::read(F, FALSE, "can't open inter pipeline file",
-        TRUE, CodeGen::Pipeline::scan_line, NULL, (void *) S);
-    if (S->erroneous) return NULL;
-    return S;
-}
-
-void CodeGen::Pipeline::scan_line(text_stream *line, text_file_position *tfp, void *X) {
-    codegen_pipeline *S = (codegen_pipeline *) X;
-    CodeGen::Pipeline::parse_into(S, line, tfp);
-}
-
-codegen_pipeline *CodeGen::Pipeline::parse(text_stream *instructions, dictionary *D) {
-    codegen_pipeline *S = CodeGen::Pipeline::new(D);
-    CodeGen::Pipeline::parse_into(S, instructions, NULL);
-    if (S->erroneous) return NULL;
-    return S;
-}
-
-void CodeGen::Pipeline::parse_into(codegen_pipeline *S, text_stream *instructions,
-    text_file_position *tfp) {
-    TEMPORARY_TEXT(T)
-    LOOP_THROUGH_TEXT(P, instructions)
-        if (Characters::is_babel_whitespace(Str::get(P)))
-            PUT_TO(T, ' ');
-        else
-            PUT_TO(T, Str::get(P));
-    match_results mr = Regexp::create_mr();
-    while (Regexp::match(&mr, T, L" *(%c+?) *,+ *(%c*?) *")) {
-        pipeline_step *ST = CodeGen::Pipeline::read_step(mr.exp[0], S->variables, tfp);
-        if (ST) ADD_TO_LINKED_LIST(ST, pipeline_step, S->steps);
-        else S->erroneous = TRUE;
-        Str::copy(T, mr.exp[1]);
-    }
-    if (Regexp::match(&mr, T, L" *(%c+?) *")) {
-        pipeline_step *ST = CodeGen::Pipeline::read_step(mr.exp[0], S->variables, tfp);
-        if (ST) ADD_TO_LINKED_LIST(ST, pipeline_step, S->steps);
-        else S->erroneous = TRUE;
-    }
-    Regexp::dispose_of(&mr);
-    DISCARD_TEXT(T)
-}
-
-void CodeGen::Pipeline::set_repository(codegen_pipeline *S, inter_tree *I) {
-    S->memory_repository = I;
-}
-
-void CodeGen::Pipeline::run(pathname *P, codegen_pipeline *S, linked_list *PP,
-    linked_list *requirements_list, target_vm *VM) {
-    if (S == NULL) return;
-    stopwatch_timer *within = NULL;
-    #ifdef CORE_MODULE
-    within = inform7_timer;
-    #endif
-    stopwatch_timer *pipeline_timer =
-        Time::start_stopwatch(within, I"running Inter pipeline");
-
-    int step_count = 0, step_total = 0;
-    pipeline_step *step;
-    LOOP_OVER_LINKED_LIST(step, pipeline_step, S->steps) step_total++;
-
-    int active = TRUE;
-    stopwatch_timer *prep_timer = NULL;
-    LOOP_OVER_LINKED_LIST(step, pipeline_step, S->steps)
-        if (active) {
-            if (prep_timer == NULL)
-                prep_timer = Time::start_stopwatch(pipeline_timer, I"step preparation");
-            else
-                Time::resume_stopwatch(prep_timer);
-            if (S->repositories[step->repository_argument] == NULL)
-                S->repositories[step->repository_argument] = InterTree::new();
-            inter_tree *I = S->repositories[step->repository_argument];
-            if (I == NULL) internal_error("no repository");
-            CodeGen::Pipeline::prepare_to_run(I);
-            CodeGen::Pipeline::lint(I);
-
-            CodeGen::Pipeline::clean_step(step);
-            step->the_PP = PP;
-            step->repository = I;
-            step->pipeline = S;
-            step->requirements_list = requirements_list;
-            step->for_VM = VM;
-            if ((VM) && (step->take_generator_argument_from_VM)) {
-                step->generator_argument = Generators::find_for(VM);
-                if (step->generator_argument == NULL) {
-                    #ifdef PROBLEMS_MODULE
-                    Problems::fatal("Unable to guess target format");
-                    #endif
-                    #ifndef PROBLEMS_MODULE
-                    Errors::fatal("Unable to guess target format");
-                    exit(1);
-                    #endif
-                }
-            }
-
-            step->package_argument = NULL;
-            if (Str::len(step->package_URL_argument) > 0) {
-                step->package_argument =
-                    Inter::Packages::by_url(step->repository, step->package_URL_argument);
-                if (step->package_argument == NULL) {
-                    CodeGen::Pipeline::error_with("no such package as '%S'", step->package_URL_argument);
-                    continue;
-                }
-            }
-
-            Time::stop_stopwatch(prep_timer);
-
-            int skip_step = FALSE;
-            TEMPORARY_TEXT(STAGE_NAME)
-            WRITE_TO(STAGE_NAME, "inter step %d/%d: ", ++step_count, step_total);
-            CodeGen::Pipeline::write_step(STAGE_NAME, step);
-            Log::new_stage(STAGE_NAME);
-            stopwatch_timer *step_timer =
-                Time::start_stopwatch(pipeline_timer, STAGE_NAME);
-            DISCARD_TEXT(STAGE_NAME)
-
-            if ((step->step_stage->stage_arg == FILE_STAGE_ARG) ||
-                (step->step_stage->stage_arg == TEXT_OUT_STAGE_ARG) ||
-                (step->step_stage->stage_arg == OPTIONAL_TEXT_OUT_STAGE_ARG) ||
-                (step->step_stage->stage_arg == EXT_FILE_STAGE_ARG) ||
-                (step->step_stage->stage_arg == EXT_TEXT_OUT_STAGE_ARG)) {
-                if (Str::len(step->step_argument) == 0) {
-                    if (step->step_stage->stage_arg == OPTIONAL_TEXT_OUT_STAGE_ARG) {
-                        skip_step = TRUE;
-                    } else {
-                        #ifdef PROBLEMS_MODULE
-                        Problems::fatal("No filename given in pipeline step");
-                        #endif
-                        #ifndef PROBLEMS_MODULE
-                        Errors::fatal("No filename given in pipeline step");
-                        exit(1);
-                        #endif
-                    }
-                } else {
-                    if (Str::eq(step->step_argument, I"*log")) {
-                        step->to_debugging_log = TRUE;
-                    } else if (Str::eq(step->step_argument, I"*memory")) {
-                        S->repositories[step->repository_argument] = S->memory_repository;
-                        skip_step = TRUE;
-                    } else {
-                        int slashes = FALSE;
-                        LOOP_THROUGH_TEXT(pos, step->step_argument)
-                            if (Str::get(pos) == '/')
-                                slashes = TRUE;
-                        if (slashes) step->parsed_filename = Filenames::from_text(step->step_argument);
-                        else step->parsed_filename = Filenames::in(P, step->step_argument);
-                    }
-                }
-            }
-
-            text_stream text_output_struct;  For any text file we might write
-            text_stream *T = &text_output_struct;
-            if (step->to_debugging_log) {
-                step->to_stream = DL;
-            } else if ((step->step_stage->stage_arg == TEXT_OUT_STAGE_ARG) ||
-                (step->step_stage->stage_arg == OPTIONAL_TEXT_OUT_STAGE_ARG) ||
-                (step->step_stage->stage_arg == EXT_TEXT_OUT_STAGE_ARG)) {
-                if ((step->parsed_filename) &&
-                    (STREAM_OPEN_TO_FILE(T, step->parsed_filename, ISO_ENC) == FALSE)) {
-                    #ifdef PROBLEMS_MODULE
-                    Problems::fatal_on_file("Can't open output file", step->parsed_filename);
-                    #endif
-                    #ifndef PROBLEMS_MODULE
-                    Errors::fatal_with_file("Can't open output file", step->parsed_filename);
-                    exit(1);
-                    #endif
-                }
-                step->to_stream = T;
-            }
-
-            if (skip_step == FALSE)
-                active = (*(step->step_stage->execute))(step);
-
-            if (((step->step_stage->stage_arg == TEXT_OUT_STAGE_ARG) ||
-                (step->step_stage->stage_arg == EXT_TEXT_OUT_STAGE_ARG)) &&
-                (step->to_debugging_log == FALSE)) {
-                STREAM_CLOSE(T);
-            }
-            Time::stop_stopwatch(step_timer);
-        }
-    Time::stop_stopwatch(pipeline_timer);
-}
-
- -

§5. Following.

- -
-inter_symbol *unchecked_kind_symbol = NULL;
-inter_symbol *unchecked_function_symbol = NULL;
-inter_symbol *typeless_int_symbol = NULL;
-inter_symbol *list_of_unchecked_kind_symbol = NULL;
-inter_symbol *object_kind_symbol = NULL;
-inter_symbol *action_kind_symbol = NULL;
-inter_symbol *truth_state_kind_symbol = NULL;
-inter_symbol *direction_kind_symbol = NULL;
-
-inter_symbol *verb_directive_reverse_symbol = NULL;
-inter_symbol *verb_directive_slash_symbol = NULL;
-inter_symbol *verb_directive_divider_symbol = NULL;
-inter_symbol *verb_directive_result_symbol = NULL;
-inter_symbol *verb_directive_special_symbol = NULL;
-inter_symbol *verb_directive_number_symbol = NULL;
-inter_symbol *verb_directive_noun_symbol = NULL;
-inter_symbol *verb_directive_multi_symbol = NULL;
-inter_symbol *verb_directive_multiinside_symbol = NULL;
-inter_symbol *verb_directive_multiheld_symbol = NULL;
-inter_symbol *verb_directive_held_symbol = NULL;
-inter_symbol *verb_directive_creature_symbol = NULL;
-inter_symbol *verb_directive_topic_symbol = NULL;
-inter_symbol *verb_directive_multiexcept_symbol = NULL;
-
-inter_symbol *code_ptype_symbol = NULL;
-inter_symbol *plain_ptype_symbol = NULL;
-inter_symbol *submodule_ptype_symbol = NULL;
-inter_symbol *function_ptype_symbol = NULL;
-inter_symbol *action_ptype_symbol = NULL;
-inter_symbol *command_ptype_symbol = NULL;
-inter_symbol *property_ptype_symbol = NULL;
-inter_symbol *to_phrase_ptype_symbol = NULL;
-
-void CodeGen::Pipeline::prepare_to_run(inter_tree *I) {
-
-    code_ptype_symbol = InterSymbolsTables::url_name_to_symbol(I, NULL, I"/_code");
-    plain_ptype_symbol = InterSymbolsTables::url_name_to_symbol(I, NULL, I"/_plain");
-    submodule_ptype_symbol = InterSymbolsTables::url_name_to_symbol(I, NULL, I"/_submodule");
-    function_ptype_symbol = InterSymbolsTables::url_name_to_symbol(I, NULL, I"/_function");
-    action_ptype_symbol = InterSymbolsTables::url_name_to_symbol(I, NULL, I"/_action");
-    command_ptype_symbol = InterSymbolsTables::url_name_to_symbol(I, NULL, I"/_command");
-    property_ptype_symbol = InterSymbolsTables::url_name_to_symbol(I, NULL, I"/_property");
-    to_phrase_ptype_symbol = InterSymbolsTables::url_name_to_symbol(I, NULL, I"/_to_phrase");
-
-    unchecked_kind_symbol = Inter::Packages::search_resources_exhaustively(I, I"K_unchecked");
-    unchecked_function_symbol = Inter::Packages::search_resources_exhaustively(I, I"K_unchecked_function");
-    typeless_int_symbol = Inter::Packages::search_resources_exhaustively(I, I"K_typeless_int");
-    list_of_unchecked_kind_symbol = Inter::Packages::search_resources_exhaustively(I, I"K_list_of_values");
-    object_kind_symbol = Inter::Packages::search_resources_exhaustively(I, I"K_object");
-    action_kind_symbol = Inter::Packages::search_resources_exhaustively(I, I"K_action_name");
-    truth_state_kind_symbol = Inter::Packages::search_resources_exhaustively(I, I"K_truth_state");
-    direction_kind_symbol = Inter::Packages::search_resources_exhaustively(I, I"K3_direction");
-
-    verb_directive_reverse_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_REVERSE");
-    verb_directive_slash_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_SLASH");
-    verb_directive_divider_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_DIVIDER");
-    verb_directive_result_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_RESULT");
-    verb_directive_special_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_SPECIAL");
-    verb_directive_number_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_NUMBER");
-    verb_directive_noun_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_NOUN");
-    verb_directive_multi_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_MULTI");
-    verb_directive_multiinside_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_MULTIINSIDE");
-    verb_directive_multiheld_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_MULTIHELD");
-    verb_directive_held_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_HELD");
-    verb_directive_creature_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_CREATURE");
-    verb_directive_topic_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_TOPIC");
-    verb_directive_multiexcept_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_MULTIEXCEPT");
-}
-
-void CodeGen::Pipeline::lint(inter_tree *I) {
-    InterTree::traverse(I, CodeGen::Pipeline::visitor, NULL, NULL, -PACKAGE_IST);
-}
-
-void CodeGen::Pipeline::visitor(inter_tree *I, inter_tree_node *P, void *state) {
-    inter_ti c = Inode::get_package(P)->index_n;
-    inter_ti a = Inode::get_package_alt(P);
-    if (c != a) {
-        LOG("Frame gives package as $6, but its location is in package $6\n",
-            Inode::ID_to_package(P, c),
-            Inode::ID_to_package(P, a));
-        WRITE_TO(STDERR, "Frame gives package as %d, but its location is in package %d\n",
-            Inode::ID_to_package(P, c)->index_n,
-            Inode::ID_to_package(P, a)->index_n);
-        internal_error("misplaced package");
-    }
-
-    Produce::guard(Inter::Defn::verify_children_inner(P));
-}
-
-inter_symbol *CodeGen::Pipeline::uks(void) {
-    if (unchecked_kind_symbol == NULL) internal_error("no unchecked kind symbol");
-    return unchecked_kind_symbol;
-}
-
-void CodeGen::Pipeline::error(char *erm) {
-    #ifdef PROBLEMS_MODULE
-    TEMPORARY_TEXT(full)
-    WRITE_TO(full, "%s", erm);
-    do_not_locate_problems = TRUE;
-    Problems::quote_stream(1, full);
-    Problems::issue_problem_begin(NULL, erm);
-    Problems::issue_problem_segment("I was unable to perform final code-generation: %1");
-    Problems::issue_problem_end();
-    do_not_locate_problems = FALSE;
-    DISCARD_TEXT(full)
-    #endif
-    #ifndef PROBLEMS_MODULE
-    Errors::fatal(erm);
-    exit(1);
-    #endif
-}
-
-void CodeGen::Pipeline::error_with(char *erm, text_stream *quoted) {
-    #ifdef PROBLEMS_MODULE
-    TEMPORARY_TEXT(full)
-    WRITE_TO(full, erm, quoted);
-    do_not_locate_problems = TRUE;
-    Problems::quote_stream(1, full);
-    Problems::issue_problem_begin(NULL, erm);
-    Problems::issue_problem_segment("I was unable to perform final code-generation: %1");
-    Problems::issue_problem_end();
-    do_not_locate_problems = FALSE;
-    DISCARD_TEXT(full)
-    #endif
-    #ifndef PROBLEMS_MODULE
-    Errors::fatal_with_text(erm, quoted);
-    exit(1);
-    #endif
-}
-
- - -
- - - diff --git a/docs/pipeline-module/1-stg.html b/docs/pipeline-module/1-stg.html deleted file mode 100644 index 50cf1e7bc..000000000 --- a/docs/pipeline-module/1-stg.html +++ /dev/null @@ -1,191 +0,0 @@ - - - - Stages - - - - - - - - - - - - - - - - - - -
- - -

To create the stages through which code generation proceeds.

- -
- -

§1. Stages. Each possible pipeline stage is represented by a single instance of the -following. Some stages are invoked with an argument, often the filename to -write output to; others are not. -

- -
enum NO_STAGE_ARG from 1
-enum GENERAL_STAGE_ARG
-enum FILE_STAGE_ARG
-enum TEXT_OUT_STAGE_ARG
-enum OPTIONAL_TEXT_OUT_STAGE_ARG
-enum EXT_FILE_STAGE_ARG
-enum EXT_TEXT_OUT_STAGE_ARG
-enum TEMPLATE_FILE_STAGE_ARG
-
-
-typedef struct pipeline_stage {
-    struct text_stream *stage_name;
-    int (*execute)(void *);
-    int stage_arg;  one of the *_ARG values above
-    int takes_repository;
-    CLASS_DEFINITION
-} pipeline_stage;
-
-pipeline_stage *CodeGen::Stage::new(text_stream *name, int (*X)(struct pipeline_step *), int arg, int tr) {
-    pipeline_stage *stage = CREATE(pipeline_stage);
-    stage->stage_name = Str::duplicate(name);
-    stage->execute = (int (*)(void *)) X;
-    stage->stage_arg = arg;
-    stage->takes_repository = tr;
-    return stage;
-}
-
- -

§2. Creation. To add a new pipeline stage, put the code for it into a new section in -Chapter 2, and then add a call to its create_pipeline_stage routine -to the routine below. -

- -
-int stages_made = FALSE;
-void CodeGen::Stage::make_stages(void) {
-    if (stages_made == FALSE) {
-        stages_made = TRUE;
-        CodeGen::Stage::new(I"stop", CodeGen::Stage::run_stop_stage, NO_STAGE_ARG, FALSE);
-
-        CodeGen::Stage::new(I"wipe", CodeGen::Stage::run_wipe_stage, NO_STAGE_ARG, FALSE);
-        CodeGen::Stage::new(I"read", CodeGen::Stage::run_read_stage, FILE_STAGE_ARG, TRUE);
-        CodeGen::Stage::new(I"move", CodeGen::Stage::run_move_stage, GENERAL_STAGE_ARG, TRUE);
-
-        CodeGen::create_pipeline_stage();
-        CodeGen::Architecture::create_pipeline_stage();
-        CodeGen::LinkInstructions::create_pipeline_stage();
-        CodeGen::Assimilate::create_pipeline_stage();
-        DetectIndirectCalls::create_pipeline_stage();
-        CodeGen::Eliminate::create_pipeline_stage();
-        CodeGen::Externals::create_pipeline_stage();
-        CodeGen::Inspection::create_pipeline_stage();
-        CodeGen::Labels::create_pipeline_stage();
-        CodeGen::Operations::create_pipeline_stage();
-        Synoptic::create_pipeline_stage();
-        CodeGen::MergeTemplate::create_pipeline_stage();
-        CodeGen::PLM::create_pipeline_stage();
-        CodeGen::RCC::create_pipeline_stage();
-        CodeGen::ReconcileVerbs::create_pipeline_stage();
-        CodeGen::Uniqueness::create_pipeline_stage();
-    }
-}
-
-

§3. The "stop" stage is special, in that it always returns false, thus stopping -the pipeline: -

- -
-int CodeGen::Stage::run_stop_stage(pipeline_step *step) {
-    return FALSE;
-}
-
-int CodeGen::Stage::run_wipe_stage(pipeline_step *step) {
-    Inter::Warehouse::wipe();
-    return TRUE;
-}
-
-int CodeGen::Stage::run_read_stage(pipeline_step *step) {
-    filename *F = step->parsed_filename;
-    if (Inter::Binary::test_file(F)) Inter::Binary::read(step->repository, F);
-    else Inter::Textual::read(step->repository, F);
-    return TRUE;
-}
-
-int CodeGen::Stage::run_move_stage(pipeline_step *step) {
-    match_results mr = Regexp::create_mr();
-    inter_package *pack = NULL;
-    if (Regexp::match(&mr, step->step_argument, L"(%d):(%c+)")) {
-        int from_rep = Str::atoi(mr.exp[0], 0);
-        if (step->pipeline->repositories[from_rep] == NULL)
-            internal_error("no such repository");
-        pack = Inter::Packages::by_url(
-            step->pipeline->repositories[from_rep], mr.exp[1]);
-    }
-    Regexp::dispose_of(&mr);
-    if (pack == NULL) internal_error("not a package");
-    Inter::Transmigration::move(pack, Site::main_package(step->repository), FALSE);
-
-    return TRUE;
-}
-
- - -
- - - diff --git a/docs/pipeline-module/2-pp.html b/docs/pipeline-module/2-pp.html new file mode 100644 index 000000000..bc997b3f1 --- /dev/null +++ b/docs/pipeline-module/2-pp.html @@ -0,0 +1,457 @@ + + + + Parsing Pipelines + + + + + + + + + + + + + + + + + + +
+ + +

To parse pipelines from text files.

+ +
+ +

§1. How pipelines are stored. An inter_pipeline is a linked list of //pipeline_step//s, together with +some associated storage used when it runs: this is for storing variables and +pointers to trees being worked on. +

+ +
+typedef struct inter_pipeline {
+    struct linked_list *steps;  of pipeline_step
+    struct dictionary *variables;
+    int erroneous;  a syntax error occurred when parsing this
+    struct pipeline_ephemera ephemera;  temporary storage when running
+    CLASS_DEFINITION
+} inter_pipeline;
+
+inter_pipeline *ParsingPipelines::new_pipeline(dictionary *D) {
+    inter_pipeline *S = CREATE(inter_pipeline);
+    S->variables = D;
+    S->steps = NEW_LINKED_LIST(pipeline_step);
+    S->erroneous = FALSE;
+    RunningPipelines::clean_pipeline(S);
+    return S;
+}
+
+ +

§2. A pipeline_step is really only a choice of pipeline_stage, but comes +along with a wide variety of options and parameter settings, so that it looks +much more complicated than it actually is. +

+ +
+typedef struct pipeline_step {
+    struct pipeline_stage *step_stage;
+    struct text_stream *step_argument;
+    struct code_generator *generator_argument;
+    int take_generator_argument_from_VM;
+    struct text_stream *package_URL_argument;
+    struct inter_package *package_argument;
+    int repository_argument;
+    struct pipeline_step_ephemera ephemera;  temporary storage when running
+    CLASS_DEFINITION
+} pipeline_step;
+
+pipeline_step *ParsingPipelines::new_step(void) {
+    pipeline_step *step = CREATE(pipeline_step);
+    step->step_stage = NULL;
+    step->step_argument = NULL;
+    step->package_URL_argument = NULL;
+    step->package_argument = NULL;
+    step->repository_argument = 0;
+    step->generator_argument = NULL;
+    step->take_generator_argument_from_VM = FALSE;
+    RunningPipelines::clean_step(step);
+    return step;
+}
+
+ +

§3. And a pipeline_stage is simply a choice of what to do. For example, +eliminate-redundant-labels is a pipeline stage. This would need to be +combined with details of what tree to apply to in order to become a step. +

+ +
enum NO_STAGE_ARG from 1
+enum GENERAL_STAGE_ARG
+enum FILE_STAGE_ARG
+enum TEXT_OUT_STAGE_ARG
+enum OPTIONAL_TEXT_OUT_STAGE_ARG
+enum EXT_FILE_STAGE_ARG
+enum EXT_TEXT_OUT_STAGE_ARG
+enum TEMPLATE_FILE_STAGE_ARG
+
+
+typedef struct pipeline_stage {
+    struct text_stream *stage_name;
+    int (*execute)(void *);
+    int stage_arg;  one of the *_ARG values above
+    int takes_repository;
+    CLASS_DEFINITION
+} pipeline_stage;
+
+pipeline_stage *ParsingPipelines::new_stage(text_stream *name,
+    int (*X)(struct pipeline_step *), int arg, int tr) {
+    pipeline_stage *stage = CREATE(pipeline_stage);
+    stage->stage_name = Str::duplicate(name);
+    stage->execute = (int (*)(void *)) X;
+    stage->stage_arg = arg;
+    stage->takes_repository = tr;
+    return stage;
+}
+
+ +

§4. Parsing. All pipelines originate as textual descriptions, either from a text file or +supplied on the command line. Here, we turn such a description — in effect +a program for a very simple programming language — into an inter_pipeline. +

+ +
+inter_pipeline *ParsingPipelines::from_file(filename *F, dictionary *D) {
+    inter_pipeline *S = ParsingPipelines::new_pipeline(D);
+    TextFiles::read(F, FALSE, "can't open inter pipeline file",
+        TRUE, ParsingPipelines::scan_line, NULL, (void *) S);
+    if (S->erroneous) return NULL;
+    return S;
+}
+
+void ParsingPipelines::scan_line(text_stream *line, text_file_position *tfp, void *X) {
+    inter_pipeline *S = (inter_pipeline *) X;
+    ParsingPipelines::parse_line(S, line, tfp);
+}
+
+inter_pipeline *ParsingPipelines::from_text(text_stream *instructions, dictionary *D) {
+    inter_pipeline *S = ParsingPipelines::new_pipeline(D);
+    ParsingPipelines::parse_line(S, instructions, NULL);
+    if (S->erroneous) return NULL;
+    return S;
+}
+
+

§5. Either way, then, a sequence of 1 or more textual lines of description is +passed to the following. It breaks down the line into 1 or more steps, divided +by commas. +

+ +
+void ParsingPipelines::parse_line(inter_pipeline *S, text_stream *instructions,
+    text_file_position *tfp) {
+    TEMPORARY_TEXT(T)
+    LOOP_THROUGH_TEXT(P, instructions)
+        if (Characters::is_babel_whitespace(Str::get(P)))
+            PUT_TO(T, ' ');
+        else
+            PUT_TO(T, Str::get(P));
+    match_results mr = Regexp::create_mr();
+    while (Regexp::match(&mr, T, L" *(%c+?) *,+ *(%c*?) *")) {
+        pipeline_step *ST = ParsingPipelines::parse_step(mr.exp[0], S->variables, tfp);
+        if (ST) ADD_TO_LINKED_LIST(ST, pipeline_step, S->steps);
+        else S->erroneous = TRUE;
+        Str::copy(T, mr.exp[1]);
+    }
+    if (Regexp::match(&mr, T, L" *(%c+?) *")) {
+        pipeline_step *ST = ParsingPipelines::parse_step(mr.exp[0], S->variables, tfp);
+        if (ST) ADD_TO_LINKED_LIST(ST, pipeline_step, S->steps);
+        else S->erroneous = TRUE;
+    }
+    Regexp::dispose_of(&mr);
+    DISCARD_TEXT(T)
+}
+
+

§6. Finally, an individual textual description S of a dtep is turned into a +pipeline_step. +

+ +

For documentation on the syntax here, see Pipelines and Stages (in inter). +

+ +
+pipeline_step *ParsingPipelines::parse_step(text_stream *S, dictionary *D,
+    text_file_position *tfp) {
+    pipeline_step *step = ParsingPipelines::new_step();
+    match_results mr = Regexp::create_mr();
+
+    int allow_unknown = FALSE;
+    if (Regexp::match(&mr, S, L"optionally-%c+")) allow_unknown = TRUE;
+
+    int left_arrow_used = FALSE;
+    if (Regexp::match(&mr, S,      L"(%c+?) *<- *(%c*)"))       Left arrow notation6.1
+    else if (Regexp::match(&mr, S, L"(%c+?) (%C+) *-> *(%c*)")) Right arrow notation with generator6.2
+    else if (Regexp::match(&mr, S, L"(%c+?) *-> *(%c*)"))       Right arrow notation without generator6.3;
+
+    if (Regexp::match(&mr, S,      L"(%C+?) (%d)"))             Repository number as argument6.4
+    else if (Regexp::match(&mr, S, L"(%C+?) (%d):(%c*)"))       Repository number and package as arguments6.5
+    else if (Regexp::match(&mr, S, L"(%C+?) (%c+)"))            Package as argument6.6;
+
+    step->step_stage = ParsingPipelines::parse_stage(S);
+    Make consistency checks6.7;
+
+    Regexp::dispose_of(&mr);
+    return step;
+}
+
+

§6.1. Left arrow notation6.1 = +

+ +
+    if (Str::len(mr.exp[1]) > 0) {
+        step->step_argument = ParsingPipelines::text_arg(mr.exp[1], D, tfp, allow_unknown);
+        if (step->step_argument == NULL) return NULL;
+    } else {
+        Errors::in_text_file_S(I"no source to right of arrow", tfp);
+        return NULL;
+    }
+    Str::copy(S, mr.exp[0]);
+    left_arrow_used = TRUE;
+
+ +

§6.2. Right arrow notation with generator6.2 = +

+ +
+    code_generator *cgt = Generators::find(mr.exp[1]);
+    if (cgt == NULL) {
+        TEMPORARY_TEXT(ERR)
+        WRITE_TO(ERR, "no such code generation format as '%S'\n", mr.exp[1]);
+        Errors::in_text_file_S(ERR, tfp);
+        DISCARD_TEXT(ERR)
+        return NULL;
+    } else {
+        step->generator_argument = cgt;
+    }
+    step->step_argument = ParsingPipelines::text_arg(mr.exp[2], D, tfp, allow_unknown);
+    if (step->step_argument == NULL) return NULL;
+    Str::copy(S, mr.exp[0]);
+
+ +

§6.3. Right arrow notation without generator6.3 = +

+ +
+    step->generator_argument = NULL;
+    step->take_generator_argument_from_VM = TRUE;
+    step->step_argument = ParsingPipelines::text_arg(mr.exp[1], D, tfp, allow_unknown);
+    if (step->step_argument == NULL) return NULL;
+    Str::copy(S, mr.exp[0]);
+
+ +

§6.4. Repository number as argument6.4 = +

+ +
+    step->repository_argument = Str::atoi(mr.exp[1], 0);
+    Str::copy(S, mr.exp[0]);
+
+ +

§6.5. Repository number and package as arguments6.5 = +

+ +
+    step->repository_argument = Str::atoi(mr.exp[1], 0);
+    if (Str::len(mr.exp[2]) > 0) {
+        step->package_URL_argument = ParsingPipelines::text_arg(mr.exp[2], D, tfp, allow_unknown);
+        if (step->package_URL_argument == NULL) return NULL;
+    }
+    Str::copy(S, mr.exp[0]);
+
+ +

§6.6. Package as argument6.6 = +

+ +
+    step->package_URL_argument = ParsingPipelines::text_arg(mr.exp[1], D, tfp, allow_unknown);
+    if (step->package_URL_argument == NULL) return NULL;
+    Str::copy(S, mr.exp[0]);
+
+ +

§6.7. Make consistency checks6.7 = +

+ +
+    if (step->step_stage == NULL) {
+        TEMPORARY_TEXT(ERR)
+        WRITE_TO(ERR, "no such stage as '%S'\n", S);
+        Errors::in_text_file_S(ERR, tfp);
+        DISCARD_TEXT(ERR)
+        return NULL;
+    }
+    if (step->step_stage->takes_repository) {
+        if (left_arrow_used == FALSE) {
+            Errors::in_text_file_S(
+                I"this stage should take a left arrow and a source", tfp);
+            return NULL;
+        }
+    } else {
+        if (left_arrow_used) {
+            Errors::in_text_file_S(
+                I"this stage should not take a left arrow and a source", tfp);
+            return NULL;
+        }
+    }
+
+ +

§7. A textual argument beginning with an asterisk means "expand to the value of +this variable", which is required to exist unless allow_unknown is set. +If it is, then an empty text results as the argument. +

+ +
+text_stream *ParsingPipelines::text_arg(text_stream *from, dictionary *D,
+    text_file_position *tfp, int allow_unknown) {
+    if (Str::get_first_char(from) == '*') {
+        text_stream *find = Dictionaries::get_text(D, from);
+        if (find) return Str::duplicate(find);
+        if (allow_unknown == FALSE) {
+            TEMPORARY_TEXT(ERR)
+            WRITE_TO(ERR, "no such pipeline variable as '%S'\n", from);
+            Errors::in_text_file_S(ERR, tfp);
+            DISCARD_TEXT(ERR)
+        } else {
+            return I"";
+        }
+    }
+    return Str::duplicate(from);
+}
+
+

§8. Stages. Stages are a fixed set within this compiler: there's no way for a pipeline +file to specify a new one. +

+ +
+pipeline_stage *ParsingPipelines::parse_stage(text_stream *from) {
+    static int stages_made = FALSE;
+    if (stages_made == FALSE) {
+        stages_made = TRUE;
+        SimpleStages::create_pipeline_stages();
+        CodeGen::create_pipeline_stage();
+        CodeGen::Architecture::create_pipeline_stage();
+        CodeGen::LinkInstructions::create_pipeline_stage();
+        CodeGen::Assimilate::create_pipeline_stage();
+        DetectIndirectCalls::create_pipeline_stage();
+        CodeGen::Eliminate::create_pipeline_stage();
+        CodeGen::Externals::create_pipeline_stage();
+        CodeGen::Inspection::create_pipeline_stage();
+        CodeGen::Labels::create_pipeline_stage();
+        CodeGen::Operations::create_pipeline_stage();
+        Synoptic::create_pipeline_stage();
+        CodeGen::MergeTemplate::create_pipeline_stage();
+        CodeGen::PLM::create_pipeline_stage();
+        CodeGen::RCC::create_pipeline_stage();
+        CodeGen::ReconcileVerbs::create_pipeline_stage();
+        CodeGen::Uniqueness::create_pipeline_stage();
+    }
+    pipeline_stage *stage;
+    LOOP_OVER(stage, pipeline_stage)
+        if (Str::eq(from, stage->stage_name))
+            return stage;
+    return NULL;
+}
+
+

§9. Starting a variables dictionary. Note that the above ways to create a pipeline all expect a dictionary of variable +names and their values to exist. These dictionaries are typically very small, +and by convention the main variable is *out, the leafname to write output to. +So the following utility is convenient for getting started. +

+ +
+dictionary *ParsingPipelines::basic_dictionary(text_stream *leafname) {
+    dictionary *D = Dictionaries::new(16, TRUE);
+    if (Str::len(leafname) > 0) Str::copy(Dictionaries::create_text(D, I"*out"), leafname);
+    Str::copy(Dictionaries::create_text(D, I"*log"), I"*log");
+    return D;
+}
+
+

§10. Back to text. Here we write a textual description to a string, which is useful for logging: +

+ +
+void ParsingPipelines::write_step(OUTPUT_STREAM, pipeline_step *step) {
+    WRITE("%S", step->step_stage->stage_name);
+    if (step->step_stage->stage_arg != NO_STAGE_ARG) {
+        if (step->repository_argument > 0) {
+            WRITE(" %d", step->repository_argument);
+            if (Str::len(step->package_URL_argument) > 0)
+                WRITE(":%S", step->package_URL_argument);
+        } else {
+            if (Str::len(step->package_URL_argument) > 0)
+                WRITE(" %S", step->package_URL_argument);
+        }
+        if (step->step_stage->takes_repository)
+            WRITE(" <- %S", step->step_argument);
+        if (step->generator_argument)
+            WRITE(" %S -> %S",
+                step->generator_argument->generator_name, step->step_argument);
+    }
+}
+
+ + +
+ + + diff --git a/docs/pipeline-module/2-rmws.html b/docs/pipeline-module/2-rmws.html new file mode 100644 index 000000000..fd94723bd --- /dev/null +++ b/docs/pipeline-module/2-rmws.html @@ -0,0 +1,142 @@ + + + + Read, Move, Wipe, Stop + + + + + + + + + + + + + + + + + + +
+ + +

Four simple pipeline stages.

+ +
+ +

§1.

+ +
+void SimpleStages::create_pipeline_stages(void) {
+    ParsingPipelines::new_stage(I"stop", SimpleStages::run_stop_stage, NO_STAGE_ARG, FALSE);
+    ParsingPipelines::new_stage(I"wipe", SimpleStages::run_wipe_stage, NO_STAGE_ARG, FALSE);
+    ParsingPipelines::new_stage(I"read", SimpleStages::run_read_stage, FILE_STAGE_ARG, TRUE);
+    ParsingPipelines::new_stage(I"move", SimpleStages::run_move_stage, GENERAL_STAGE_ARG, TRUE);
+}
+
+

§2. Read.

+ +
+int SimpleStages::run_read_stage(pipeline_step *step) {
+    filename *F = step->ephemera.parsed_filename;
+    if (Inter::Binary::test_file(F)) Inter::Binary::read(step->ephemera.repository, F);
+    else Inter::Textual::read(step->ephemera.repository, F);
+    return TRUE;
+}
+
+

§3. Move.

+ +
+int SimpleStages::run_move_stage(pipeline_step *step) {
+    match_results mr = Regexp::create_mr();
+    inter_package *pack = NULL;
+    if (Regexp::match(&mr, step->step_argument, L"(%d):(%c+)")) {
+        int from_rep = Str::atoi(mr.exp[0], 0);
+        if (step->ephemera.pipeline->ephemera.repositories[from_rep] == NULL)
+            internal_error("no such repository");
+        pack = Inter::Packages::by_url(
+            step->ephemera.pipeline->ephemera.repositories[from_rep], mr.exp[1]);
+    }
+    Regexp::dispose_of(&mr);
+    if (pack == NULL) internal_error("not a package");
+    Inter::Transmigration::move(pack, Site::main_package(step->ephemera.repository), FALSE);
+
+    return TRUE;
+}
+
+

§4. Wipe.

+ +
+int SimpleStages::run_wipe_stage(pipeline_step *step) {
+    Inter::Warehouse::wipe();
+    return TRUE;
+}
+
+

§5. Stop. The "stop" stage is special, in that it always returns false, thus stopping +the pipeline: +

+ +
+int SimpleStages::run_stop_stage(pipeline_step *step) {
+    return FALSE;
+}
+
+ + +
+ + + diff --git a/docs/pipeline-module/2-rp.html b/docs/pipeline-module/2-rp.html new file mode 100644 index 000000000..84925f2b7 --- /dev/null +++ b/docs/pipeline-module/2-rp.html @@ -0,0 +1,427 @@ + + + + Running Pipelines + + + + + + + + + + + + + + + + + + +
+ + +

To run through pipelines of code generation stages.

+ +
+ +

§1. Ephemeral data. This is temporary data meaningful only while a pipeline is running; it is +"cleaned", that is, reinitialised, at the start of each pipeline run. +

+ +
+typedef struct pipeline_ephemera {
+    struct inter_tree *memory_repository;
+    struct inter_tree *repositories[10];
+} pipeline_ephemera;
+
+void RunningPipelines::clean_pipeline(inter_pipeline *pl) {
+    pl->ephemera.memory_repository = NULL;
+    for (int i=0; i<10; i++) pl->ephemera.repositories[i] = NULL;
+}
+
+ +

§2.

+ +
+typedef struct pipeline_step_ephemera {
+    struct filename *parsed_filename;
+    struct linked_list *the_PP;  of pathname
+    int to_debugging_log;
+    int from_memory;
+    struct text_stream *to_stream;
+    struct linked_list *requirements_list;  of inter_library
+    struct inter_tree *repository;
+    struct inter_pipeline *pipeline;
+    struct target_vm *for_VM;
+} pipeline_step_ephemera;
+
+void RunningPipelines::clean_step(pipeline_step *step) {
+    step->ephemera.parsed_filename = NULL;
+    step->ephemera.to_stream = NULL;
+    step->ephemera.to_debugging_log = FALSE;
+    step->ephemera.from_memory = FALSE;
+    step->ephemera.the_PP = NULL;
+    step->ephemera.repository = NULL;
+    step->ephemera.pipeline = NULL;
+    step->ephemera.requirements_list = NEW_LINKED_LIST(inter_library);
+    step->ephemera.for_VM = NULL;
+}
+
+ +

§3. This outer layer is all just instrumentation, really: we run through the +steps in turn, timing how long each one took us. +

+ +
+void RunningPipelines::run(pathname *P, inter_pipeline *S, inter_tree *I,
+    linked_list *PP, linked_list *requirements_list, target_vm *VM) {
+    if (S == NULL) return;
+    if (I) S->ephemera.memory_repository = I;
+    stopwatch_timer *within = NULL;
+    #ifdef CORE_MODULE
+    within = inform7_timer;
+    #endif
+    stopwatch_timer *pipeline_timer =
+        Time::start_stopwatch(within, I"running Inter pipeline");
+    int step_count = 0, step_total = LinkedLists::len(S->steps);
+    int active = TRUE;
+    stopwatch_timer *prep_timer = NULL;
+    pipeline_step *step;
+    LOOP_OVER_LINKED_LIST(step, pipeline_step, S->steps)
+        if (active) {
+            if (prep_timer == NULL)
+                prep_timer = Time::start_stopwatch(pipeline_timer, I"step preparation");
+            else
+                Time::resume_stopwatch(prep_timer);
+            Prepare this step3.1;
+            Time::stop_stopwatch(prep_timer);
+            TEMPORARY_TEXT(STAGE_NAME)
+            WRITE_TO(STAGE_NAME, "inter step %d/%d: ", ++step_count, step_total);
+            ParsingPipelines::write_step(STAGE_NAME, step);
+            Log::new_stage(STAGE_NAME);
+            stopwatch_timer *step_timer =
+                Time::start_stopwatch(pipeline_timer, STAGE_NAME);
+            DISCARD_TEXT(STAGE_NAME)
+            Run this step3.2;
+            Time::stop_stopwatch(step_timer);
+        }
+    Time::stop_stopwatch(pipeline_timer);
+}
+
+

§3.1. Prepare this step3.1 = +

+ +
+    if (S->ephemera.repositories[step->repository_argument] == NULL)
+        S->ephemera.repositories[step->repository_argument] = InterTree::new();
+    inter_tree *I = S->ephemera.repositories[step->repository_argument];
+    if (I == NULL) internal_error("no repository");
+    RunningPipelines::prepare_to_run(I);
+    RunningPipelines::lint(I);
+
+    RunningPipelines::clean_step(step);
+    step->ephemera.the_PP = PP;
+    step->ephemera.repository = I;
+    step->ephemera.pipeline = S;
+    step->ephemera.requirements_list = requirements_list;
+    step->ephemera.for_VM = VM;
+    if ((VM) && (step->take_generator_argument_from_VM)) {
+        step->generator_argument = Generators::find_for(VM);
+        if (step->generator_argument == NULL) {
+            #ifdef PROBLEMS_MODULE
+            Problems::fatal("Unable to guess target format");
+            #endif
+            #ifndef PROBLEMS_MODULE
+            Errors::fatal("Unable to guess target format");
+            exit(1);
+            #endif
+        }
+    }
+
+    step->package_argument = NULL;
+    if (Str::len(step->package_URL_argument) > 0) {
+        step->package_argument =
+            Inter::Packages::by_url(step->ephemera.repository, step->package_URL_argument);
+        if (step->package_argument == NULL) {
+            RunningPipelines::error_with("no such package as '%S'", step->package_URL_argument);
+            continue;
+        }
+    }
+
+ +

§3.2. Run this step3.2 = +

+ +
+    int skip_step = FALSE;
+
+    if ((step->step_stage->stage_arg == FILE_STAGE_ARG) ||
+        (step->step_stage->stage_arg == TEXT_OUT_STAGE_ARG) ||
+        (step->step_stage->stage_arg == OPTIONAL_TEXT_OUT_STAGE_ARG) ||
+        (step->step_stage->stage_arg == EXT_FILE_STAGE_ARG) ||
+        (step->step_stage->stage_arg == EXT_TEXT_OUT_STAGE_ARG)) {
+        if (Str::len(step->step_argument) == 0) {
+            if (step->step_stage->stage_arg == OPTIONAL_TEXT_OUT_STAGE_ARG) {
+                skip_step = TRUE;
+            } else {
+                #ifdef PROBLEMS_MODULE
+                Problems::fatal("No filename given in pipeline step");
+                #endif
+                #ifndef PROBLEMS_MODULE
+                Errors::fatal("No filename given in pipeline step");
+                exit(1);
+                #endif
+            }
+        } else {
+            if (Str::eq(step->step_argument, I"*log")) {
+                step->ephemera.to_debugging_log = TRUE;
+            } else if (Str::eq(step->step_argument, I"*memory")) {
+                S->ephemera.repositories[step->repository_argument] = S->ephemera.memory_repository;
+                skip_step = TRUE;
+            } else {
+                int slashes = FALSE;
+                LOOP_THROUGH_TEXT(pos, step->step_argument)
+                    if (Str::get(pos) == '/')
+                        slashes = TRUE;
+                if (slashes) step->ephemera.parsed_filename = Filenames::from_text(step->step_argument);
+                else step->ephemera.parsed_filename = Filenames::in(P, step->step_argument);
+            }
+        }
+    }
+
+    text_stream text_output_struct;  For any text file we might write
+    text_stream *T = &text_output_struct;
+    if (step->ephemera.to_debugging_log) {
+        step->ephemera.to_stream = DL;
+    } else if ((step->step_stage->stage_arg == TEXT_OUT_STAGE_ARG) ||
+        (step->step_stage->stage_arg == OPTIONAL_TEXT_OUT_STAGE_ARG) ||
+        (step->step_stage->stage_arg == EXT_TEXT_OUT_STAGE_ARG)) {
+        if ((step->ephemera.parsed_filename) &&
+            (STREAM_OPEN_TO_FILE(T, step->ephemera.parsed_filename, ISO_ENC) == FALSE)) {
+            #ifdef PROBLEMS_MODULE
+            Problems::fatal_on_file("Can't open output file", step->ephemera.parsed_filename);
+            #endif
+            #ifndef PROBLEMS_MODULE
+            Errors::fatal_with_file("Can't open output file", step->ephemera.parsed_filename);
+            exit(1);
+            #endif
+        }
+        step->ephemera.to_stream = T;
+    }
+
+    if (skip_step == FALSE)
+        active = (*(step->step_stage->execute))(step);
+
+    if (((step->step_stage->stage_arg == TEXT_OUT_STAGE_ARG) ||
+        (step->step_stage->stage_arg == EXT_TEXT_OUT_STAGE_ARG)) &&
+        (step->ephemera.to_debugging_log == FALSE)) {
+        STREAM_CLOSE(T);
+    }
+
+ +

§4. Following.

+ +
+inter_symbol *unchecked_kind_symbol = NULL;
+inter_symbol *unchecked_function_symbol = NULL;
+inter_symbol *typeless_int_symbol = NULL;
+inter_symbol *list_of_unchecked_kind_symbol = NULL;
+inter_symbol *object_kind_symbol = NULL;
+inter_symbol *action_kind_symbol = NULL;
+inter_symbol *truth_state_kind_symbol = NULL;
+inter_symbol *direction_kind_symbol = NULL;
+
+inter_symbol *verb_directive_reverse_symbol = NULL;
+inter_symbol *verb_directive_slash_symbol = NULL;
+inter_symbol *verb_directive_divider_symbol = NULL;
+inter_symbol *verb_directive_result_symbol = NULL;
+inter_symbol *verb_directive_special_symbol = NULL;
+inter_symbol *verb_directive_number_symbol = NULL;
+inter_symbol *verb_directive_noun_symbol = NULL;
+inter_symbol *verb_directive_multi_symbol = NULL;
+inter_symbol *verb_directive_multiinside_symbol = NULL;
+inter_symbol *verb_directive_multiheld_symbol = NULL;
+inter_symbol *verb_directive_held_symbol = NULL;
+inter_symbol *verb_directive_creature_symbol = NULL;
+inter_symbol *verb_directive_topic_symbol = NULL;
+inter_symbol *verb_directive_multiexcept_symbol = NULL;
+
+inter_symbol *code_ptype_symbol = NULL;
+inter_symbol *plain_ptype_symbol = NULL;
+inter_symbol *submodule_ptype_symbol = NULL;
+inter_symbol *function_ptype_symbol = NULL;
+inter_symbol *action_ptype_symbol = NULL;
+inter_symbol *command_ptype_symbol = NULL;
+inter_symbol *property_ptype_symbol = NULL;
+inter_symbol *to_phrase_ptype_symbol = NULL;
+
+void RunningPipelines::prepare_to_run(inter_tree *I) {
+
+    code_ptype_symbol = InterSymbolsTables::url_name_to_symbol(I, NULL, I"/_code");
+    plain_ptype_symbol = InterSymbolsTables::url_name_to_symbol(I, NULL, I"/_plain");
+    submodule_ptype_symbol = InterSymbolsTables::url_name_to_symbol(I, NULL, I"/_submodule");
+    function_ptype_symbol = InterSymbolsTables::url_name_to_symbol(I, NULL, I"/_function");
+    action_ptype_symbol = InterSymbolsTables::url_name_to_symbol(I, NULL, I"/_action");
+    command_ptype_symbol = InterSymbolsTables::url_name_to_symbol(I, NULL, I"/_command");
+    property_ptype_symbol = InterSymbolsTables::url_name_to_symbol(I, NULL, I"/_property");
+    to_phrase_ptype_symbol = InterSymbolsTables::url_name_to_symbol(I, NULL, I"/_to_phrase");
+
+    unchecked_kind_symbol = Inter::Packages::search_resources_exhaustively(I, I"K_unchecked");
+    unchecked_function_symbol = Inter::Packages::search_resources_exhaustively(I, I"K_unchecked_function");
+    typeless_int_symbol = Inter::Packages::search_resources_exhaustively(I, I"K_typeless_int");
+    list_of_unchecked_kind_symbol = Inter::Packages::search_resources_exhaustively(I, I"K_list_of_values");
+    object_kind_symbol = Inter::Packages::search_resources_exhaustively(I, I"K_object");
+    action_kind_symbol = Inter::Packages::search_resources_exhaustively(I, I"K_action_name");
+    truth_state_kind_symbol = Inter::Packages::search_resources_exhaustively(I, I"K_truth_state");
+    direction_kind_symbol = Inter::Packages::search_resources_exhaustively(I, I"K3_direction");
+
+    verb_directive_reverse_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_REVERSE");
+    verb_directive_slash_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_SLASH");
+    verb_directive_divider_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_DIVIDER");
+    verb_directive_result_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_RESULT");
+    verb_directive_special_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_SPECIAL");
+    verb_directive_number_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_NUMBER");
+    verb_directive_noun_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_NOUN");
+    verb_directive_multi_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_MULTI");
+    verb_directive_multiinside_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_MULTIINSIDE");
+    verb_directive_multiheld_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_MULTIHELD");
+    verb_directive_held_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_HELD");
+    verb_directive_creature_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_CREATURE");
+    verb_directive_topic_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_TOPIC");
+    verb_directive_multiexcept_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_MULTIEXCEPT");
+}
+
+void RunningPipelines::lint(inter_tree *I) {
+    InterTree::traverse(I, RunningPipelines::lint_visitor, NULL, NULL, -PACKAGE_IST);
+}
+
+void RunningPipelines::lint_visitor(inter_tree *I, inter_tree_node *P, void *state) {
+    inter_ti c = Inode::get_package(P)->index_n;
+    inter_ti a = Inode::get_package_alt(P);
+    if (c != a) {
+        LOG("Frame gives package as $6, but its location is in package $6\n",
+            Inode::ID_to_package(P, c),
+            Inode::ID_to_package(P, a));
+        WRITE_TO(STDERR, "Frame gives package as %d, but its location is in package %d\n",
+            Inode::ID_to_package(P, c)->index_n,
+            Inode::ID_to_package(P, a)->index_n);
+        internal_error("misplaced package");
+    }
+
+    Produce::guard(Inter::Defn::verify_children_inner(P));
+}
+
+inter_symbol *RunningPipelines::uks(void) {
+    if (unchecked_kind_symbol == NULL) internal_error("no unchecked kind symbol");
+    return unchecked_kind_symbol;
+}
+
+void RunningPipelines::error(char *erm) {
+    #ifdef PROBLEMS_MODULE
+    TEMPORARY_TEXT(full)
+    WRITE_TO(full, "%s", erm);
+    do_not_locate_problems = TRUE;
+    Problems::quote_stream(1, full);
+    Problems::issue_problem_begin(NULL, erm);
+    Problems::issue_problem_segment("I was unable to perform final code-generation: %1");
+    Problems::issue_problem_end();
+    do_not_locate_problems = FALSE;
+    DISCARD_TEXT(full)
+    #endif
+    #ifndef PROBLEMS_MODULE
+    Errors::fatal(erm);
+    exit(1);
+    #endif
+}
+
+void RunningPipelines::error_with(char *erm, text_stream *quoted) {
+    #ifdef PROBLEMS_MODULE
+    TEMPORARY_TEXT(full)
+    WRITE_TO(full, erm, quoted);
+    do_not_locate_problems = TRUE;
+    Problems::quote_stream(1, full);
+    Problems::issue_problem_begin(NULL, erm);
+    Problems::issue_problem_segment("I was unable to perform final code-generation: %1");
+    Problems::issue_problem_end();
+    do_not_locate_problems = FALSE;
+    DISCARD_TEXT(full)
+    #endif
+    #ifndef PROBLEMS_MODULE
+    Errors::fatal_with_text(erm, quoted);
+    exit(1);
+    #endif
+}
+
+

§5. Current architecture.

+ +
+inter_architecture *current_architecture = NULL;
+int RunningPipelines::set_architecture(text_stream *name) {
+    current_architecture = Architectures::from_codename(name);
+    if (current_architecture) return TRUE;
+    return FALSE;
+}
+
+inter_architecture *RunningPipelines::get_architecture(void) {
+    return current_architecture;
+}
+
+ + +
+ + + diff --git a/docs/pipeline-module/2-ass.html b/docs/pipeline-module/3-ass.html similarity index 96% rename from docs/pipeline-module/2-ass.html rename to docs/pipeline-module/3-ass.html index 1b7632f6b..722aa7273 100644 --- a/docs/pipeline-module/2-ass.html +++ b/docs/pipeline-module/3-ass.html @@ -70,16 +70,16 @@ function togglePopup(material_id) {
+

To assimilate the material in parsed non-code splats.

-
+

§1. Pipeline stage.

-void CodeGen::Assimilate::create_pipeline_stage(void) {
-    CodeGen::Stage::new(I"assimilate", CodeGen::Assimilate::run_pipeline_stage, NO_STAGE_ARG, FALSE);
+void CodeGen::Assimilate::create_pipeline_stage(void) {
+    ParsingPipelines::new_stage(I"assimilate", CodeGen::Assimilate::run_pipeline_stage, NO_STAGE_ARG, FALSE);
 }
 
 int current_assimilation_pass = 0;
@@ -90,27 +90,27 @@ function togglePopup(material_id) {
 int trace_AME = TRUE;
 
 int CodeGen::Assimilate::run_pipeline_stage(pipeline_step *step) {
-    inter_tree *I = step->repository;
+    inter_tree *I = step->ephemera.repository;
     ++current_assimilation_pass;
     no_assimilated_actions = 0;
     no_assimilated_commands = 0;
     no_assimilated_arrays = 0;
     Site::ensure_assimilation_package(I, plain_ptype_symbol);
 
-    CodeGen::Assimilate::ensure(I, &verb_directive_reverse_symbol, I"VERB_DIRECTIVE_REVERSE");
-    CodeGen::Assimilate::ensure(I, &verb_directive_slash_symbol, I"VERB_DIRECTIVE_SLASH");
-    CodeGen::Assimilate::ensure(I, &verb_directive_divider_symbol, I"VERB_DIRECTIVE_DIVIDER");
-    CodeGen::Assimilate::ensure(I, &verb_directive_result_symbol, I"VERB_DIRECTIVE_RESULT");
-    CodeGen::Assimilate::ensure(I, &verb_directive_special_symbol, I"VERB_DIRECTIVE_SPECIAL");
-    CodeGen::Assimilate::ensure(I, &verb_directive_number_symbol, I"VERB_DIRECTIVE_NUMBER");
-    CodeGen::Assimilate::ensure(I, &verb_directive_noun_symbol, I"VERB_DIRECTIVE_NOUN");
-    CodeGen::Assimilate::ensure(I, &verb_directive_multi_symbol, I"VERB_DIRECTIVE_MULTI");
-    CodeGen::Assimilate::ensure(I, &verb_directive_multiinside_symbol, I"VERB_DIRECTIVE_MULTIINSIDE");
-    CodeGen::Assimilate::ensure(I, &verb_directive_multiheld_symbol, I"VERB_DIRECTIVE_MULTIHELD");
-    CodeGen::Assimilate::ensure(I, &verb_directive_held_symbol, I"VERB_DIRECTIVE_HELD");
-    CodeGen::Assimilate::ensure(I, &verb_directive_creature_symbol, I"VERB_DIRECTIVE_CREATURE");
-    CodeGen::Assimilate::ensure(I, &verb_directive_topic_symbol, I"VERB_DIRECTIVE_TOPIC");
-    CodeGen::Assimilate::ensure(I, &verb_directive_multiexcept_symbol, I"VERB_DIRECTIVE_MULTIEXCEPT");
+    CodeGen::Assimilate::ensure(I, &verb_directive_reverse_symbol, I"VERB_DIRECTIVE_REVERSE");
+    CodeGen::Assimilate::ensure(I, &verb_directive_slash_symbol, I"VERB_DIRECTIVE_SLASH");
+    CodeGen::Assimilate::ensure(I, &verb_directive_divider_symbol, I"VERB_DIRECTIVE_DIVIDER");
+    CodeGen::Assimilate::ensure(I, &verb_directive_result_symbol, I"VERB_DIRECTIVE_RESULT");
+    CodeGen::Assimilate::ensure(I, &verb_directive_special_symbol, I"VERB_DIRECTIVE_SPECIAL");
+    CodeGen::Assimilate::ensure(I, &verb_directive_number_symbol, I"VERB_DIRECTIVE_NUMBER");
+    CodeGen::Assimilate::ensure(I, &verb_directive_noun_symbol, I"VERB_DIRECTIVE_NOUN");
+    CodeGen::Assimilate::ensure(I, &verb_directive_multi_symbol, I"VERB_DIRECTIVE_MULTI");
+    CodeGen::Assimilate::ensure(I, &verb_directive_multiinside_symbol, I"VERB_DIRECTIVE_MULTIINSIDE");
+    CodeGen::Assimilate::ensure(I, &verb_directive_multiheld_symbol, I"VERB_DIRECTIVE_MULTIHELD");
+    CodeGen::Assimilate::ensure(I, &verb_directive_held_symbol, I"VERB_DIRECTIVE_HELD");
+    CodeGen::Assimilate::ensure(I, &verb_directive_creature_symbol, I"VERB_DIRECTIVE_CREATURE");
+    CodeGen::Assimilate::ensure(I, &verb_directive_topic_symbol, I"VERB_DIRECTIVE_TOPIC");
+    CodeGen::Assimilate::ensure(I, &verb_directive_multiexcept_symbol, I"VERB_DIRECTIVE_MULTIEXCEPT");
 
     if (Inter::Connectors::find_socket(I, I"self") == NULL) {
         inter_symbol *ss = Veneer::find_by_index(I, SELF_VSYMB, unchecked_kind_symbol);
@@ -118,10 +118,10 @@ function togglePopup(material_id) {
         Inter::Connectors::socket(I, I"self", ss);
     }
 
-    InterTree::traverse(I, CodeGen::Assimilate::visitor1, NULL, NULL, SPLAT_IST);
-    InterTree::traverse(I, CodeGen::Assimilate::visitor2, NULL, NULL, SPLAT_IST);
-    CodeGen::Assimilate::function_bodies(I);
-    InterTree::traverse(I, CodeGen::Assimilate::visitor3, NULL, NULL, SPLAT_IST);
+    InterTree::traverse(I, CodeGen::Assimilate::visitor1, NULL, NULL, SPLAT_IST);
+    InterTree::traverse(I, CodeGen::Assimilate::visitor2, NULL, NULL, SPLAT_IST);
+    CodeGen::Assimilate::function_bodies(I);
+    InterTree::traverse(I, CodeGen::Assimilate::visitor3, NULL, NULL, SPLAT_IST);
     return TRUE;
 }
 
@@ -132,13 +132,13 @@ function togglePopup(material_id) {
 

§2. Parsing.

-inter_bookmark CodeGen::Assimilate::template_submodule(inter_tree *I, text_stream *name, inter_tree_node *P) {
+inter_bookmark CodeGen::Assimilate::template_submodule(inter_tree *I, text_stream *name, inter_tree_node *P) {
     if (submodule_ptype_symbol) {
         inter_package *template_package = Site::ensure_assimilation_package(I, plain_ptype_symbol);
         inter_package *t_p = Inter::Packages::by_name(template_package, name);
         if (t_p == NULL) {
             inter_bookmark IBM = Inter::Bookmarks::after_this_node(I, P);
-            t_p = CodeGen::Assimilate::new_package_named(&IBM, name, submodule_ptype_symbol);
+            t_p = CodeGen::Assimilate::new_package_named(&IBM, name, submodule_ptype_symbol);
         }
         if (t_p == NULL) internal_error("failed to define");
         return Inter::Bookmarks::at_end_of_this_package(t_p);
@@ -146,41 +146,41 @@ function togglePopup(material_id) {
     return Inter::Bookmarks::after_this_node(I, P);
 }
 
-void CodeGen::Assimilate::visitor1(inter_tree *I, inter_tree_node *P, void *state) {
+void CodeGen::Assimilate::visitor1(inter_tree *I, inter_tree_node *P, void *state) {
     switch (P->W.data[PLM_SPLAT_IFLD]) {
         case PROPERTY_PLM:
-            if (unchecked_kind_symbol) Assimilate definition2.1;
+            if (unchecked_kind_symbol) Assimilate definition2.1;
             break;
         case ATTRIBUTE_PLM:
-            if (truth_state_kind_symbol) Assimilate definition2.1;
+            if (truth_state_kind_symbol) Assimilate definition2.1;
             break;
         case ROUTINE_PLM:
         case STUB_PLM:
             if ((unchecked_kind_symbol) && (unchecked_function_symbol))
-                Assimilate routine2.2;
+                Assimilate routine2.2;
             break;
     }
 }
 
-void CodeGen::Assimilate::visitor2(inter_tree *I, inter_tree_node *P, void *state) {
+void CodeGen::Assimilate::visitor2(inter_tree *I, inter_tree_node *P, void *state) {
     switch (P->W.data[PLM_SPLAT_IFLD]) {
         case DEFAULT_PLM:
         case CONSTANT_PLM:
         case FAKEACTION_PLM:
         case OBJECT_PLM:
         case VERB_PLM:
-            if (unchecked_kind_symbol) Assimilate definition2.1;
+            if (unchecked_kind_symbol) Assimilate definition2.1;
             break;
         case ARRAY_PLM:
-            if (list_of_unchecked_kind_symbol) Assimilate definition2.1;
+            if (list_of_unchecked_kind_symbol) Assimilate definition2.1;
             break;
     }
 }
 
-void CodeGen::Assimilate::visitor3(inter_tree *I, inter_tree_node *P, void *state) {
+void CodeGen::Assimilate::visitor3(inter_tree *I, inter_tree_node *P, void *state) {
     switch (P->W.data[PLM_SPLAT_IFLD]) {
         case GLOBAL_PLM:
-            if (unchecked_kind_symbol) Assimilate definition2.1;
+            if (unchecked_kind_symbol) Assimilate definition2.1;
             break;
     }
 }
@@ -199,16 +199,16 @@ function togglePopup(material_id) {
     text_stream *value = NULL;
     int proceed = FALSE;
 
-    Parse text of splat for identifier and value2.1.1;
+    Parse text of splat for identifier and value2.1.1;
     if ((proceed) && (unchecked_kind_symbol)) {
         if ((plm == DEFAULT_PLM) && (Inter::Connectors::find_socket(I, identifier) == NULL))
             plm = CONSTANT_PLM;
-        if (plm != DEFAULT_PLM) Act on parsed constant definition2.1.2;
+        if (plm != DEFAULT_PLM) Act on parsed constant definition2.1.2;
         InterTree::remove_node(P);
     }
     Regexp::dispose_of(&mr);
 
-
  • This code is used in §2 (five times).
+
  • This code is used in §2 (five times).

§2.1.1. Parse text of splat for identifier and value2.1.1 =

@@ -239,7 +239,7 @@ function togglePopup(material_id) { } if (plm == OBJECT_PLM) value = NULL;
- +

§2.1.2. Act on parsed constant definition2.1.2 =

@@ -270,7 +270,7 @@ function togglePopup(material_id) { } if (submodule_name) { - IBM_d = CodeGen::Assimilate::template_submodule(I, submodule_name, P); + IBM_d = CodeGen::Assimilate::template_submodule(I, submodule_name, P); TEMPORARY_TEXT(subpackage_name) if (suffix) { @@ -279,12 +279,12 @@ function togglePopup(material_id) { WRITE_TO(subpackage_name, "assim_command_%d", ++no_assimilated_commands); } Inter::Bookmarks::set_current_package(IBM, - CodeGen::Assimilate::new_package_named(IBM, subpackage_name, subpackage_type)); + CodeGen::Assimilate::new_package_named(IBM, subpackage_name, subpackage_type)); DISCARD_TEXT(subpackage_name) } - inter_symbol *con_name = CodeGen::Assimilate::make_socketed_symbol(I, identifier, Inter::Bookmarks::scope(IBM)); + inter_symbol *con_name = CodeGen::Assimilate::make_socketed_symbol(I, identifier, Inter::Bookmarks::scope(IBM)); Inter::Symbols::annotate_i(con_name, ASSIMILATED_IANN, 1); if (plm == VERB_PLM) Inter::Symbols::set_flag(con_name, MAKE_NAME_UNIQUE); @@ -295,7 +295,7 @@ function togglePopup(material_id) { inter_symbol *id_s = NULL; if ((plm == ATTRIBUTE_PLM) || (plm == PROPERTY_PLM)) { - id_s = CodeGen::Assimilate::make_socketed_symbol(I, I"property_id", Inter::Bookmarks::scope(IBM)); + id_s = CodeGen::Assimilate::make_socketed_symbol(I, I"property_id", Inter::Bookmarks::scope(IBM)); } if (id_s) { Inter::Symbols::set_flag(id_s, MAKE_NAME_UNIQUE); @@ -318,21 +318,21 @@ function togglePopup(material_id) { case CONSTANT_PLM: case FAKEACTION_PLM: case OBJECT_PLM: { - Assimilate a value2.1.2.2; + Assimilate a value2.1.2.2; Produce::guard(Inter::Constant::new_numerical(IBM, InterSymbolsTables::id_from_symbol(I, Inter::Bookmarks::package(IBM), con_name), InterSymbolsTables::id_from_symbol(I, Inter::Bookmarks::package(IBM), unchecked_kind_symbol), v1, v2, (inter_ti) Inter::Bookmarks::baseline(IBM) + 1, NULL)); - CodeGen::Assimilate::install_socket(I, con_name, identifier); + CodeGen::Assimilate::install_socket(I, con_name, identifier); break; } case GLOBAL_PLM: - Assimilate a value2.1.2.2; + Assimilate a value2.1.2.2; Produce::guard(Inter::Variable::new(IBM, InterSymbolsTables::id_from_symbol(I, Inter::Bookmarks::package(IBM), con_name), InterSymbolsTables::id_from_symbol(I, Inter::Bookmarks::package(IBM), unchecked_kind_symbol), v1, v2, (inter_ti) Inter::Bookmarks::baseline(IBM) + 1, NULL)); - CodeGen::Assimilate::install_socket(I, con_name, identifier); + CodeGen::Assimilate::install_socket(I, con_name, identifier); break; case ATTRIBUTE_PLM: { @@ -359,10 +359,10 @@ function togglePopup(material_id) { InterSymbolsTables::equate(alias_symbol, attr_symbol); } } - CodeGen::Assimilate::install_socket(I, attr_symbol, A); - CodeGen::Assimilate::install_socket(I, attr_symbol, con_name->symbol_name); + CodeGen::Assimilate::install_socket(I, attr_symbol, A); + CodeGen::Assimilate::install_socket(I, attr_symbol, con_name->symbol_name); if (Str::ne(attr_symbol->symbol_name, Inter::Symbols::get_translate(attr_symbol))) - CodeGen::Assimilate::install_socket(I, attr_symbol, Inter::Symbols::get_translate(attr_symbol)); + CodeGen::Assimilate::install_socket(I, attr_symbol, Inter::Symbols::get_translate(attr_symbol)); DISCARD_TEXT(A) break; @@ -372,9 +372,9 @@ function togglePopup(material_id) { InterSymbolsTables::id_from_symbol(I, Inter::Bookmarks::package(IBM), con_name), InterSymbolsTables::id_from_symbol(I, Inter::Bookmarks::package(IBM), unchecked_kind_symbol), (inter_ti) Inter::Bookmarks::baseline(IBM) + 1, NULL)); - CodeGen::Assimilate::install_socket(I, con_name, identifier); + CodeGen::Assimilate::install_socket(I, con_name, identifier); if (Str::eq(identifier, I"absent")) - CodeGen::Assimilate::install_socket(I, con_name, I"P_absent"); + CodeGen::Assimilate::install_socket(I, con_name, I"P_absent"); break; } case VERB_PLM: @@ -389,7 +389,7 @@ function togglePopup(material_id) { else if (Regexp::match(&mr2, value, L" *buffer *(%c*?) *")) { conts = mr2.exp[0]; annot = BUFFERARRAY_IANN; } else { LOG("Identifier = <%S>, Value = <%S>", identifier, value); - TemplateReader::error("invalid Inform 6 array declaration in the template", NULL); + TemplateReader::error("invalid Inform 6 array declaration in the template", NULL); } } else { conts = value; annot = VERBARRAY_IANN; @@ -406,25 +406,25 @@ function togglePopup(material_id) { while (TRUE) { TEMPORARY_TEXT(value) if (next_is_action) WRITE_TO(value, "##"); - Extract a token2.1.2.1; + Extract a token2.1.2.1; if ((next_is_action) && (action_kind_symbol)) { - CodeGen::Assimilate::ensure_action(I, P, value); + CodeGen::Assimilate::ensure_action(I, P, value); } next_is_action = FALSE; if (plm == ARRAY_PLM) { - if (Str::eq(value, I"+")) TemplateReader::error("Inform 6 array declaration in the template using operator '+'", NULL); - if (Str::eq(value, I"-")) TemplateReader::error("Inform 6 array declaration in the template using operator '-'", NULL); - if (Str::eq(value, I"*")) TemplateReader::error("Inform 6 array declaration in the template using operator '*'", NULL); - if (Str::eq(value, I"/")) TemplateReader::error("Inform 6 array declaration in the template using operator '/'", NULL); + if (Str::eq(value, I"+")) TemplateReader::error("Inform 6 array declaration in the template using operator '+'", NULL); + if (Str::eq(value, I"-")) TemplateReader::error("Inform 6 array declaration in the template using operator '-'", NULL); + if (Str::eq(value, I"*")) TemplateReader::error("Inform 6 array declaration in the template using operator '*'", NULL); + if (Str::eq(value, I"/")) TemplateReader::error("Inform 6 array declaration in the template using operator '/'", NULL); } if ((NT == 0) && (plm == VERB_PLM) && (Str::eq(value, I"meta"))) { Inter::Symbols::annotate_i(con_name, METAVERB_IANN, 1); } else { - Assimilate a value2.1.2.2; + Assimilate a value2.1.2.2; if (Str::len(value) == 0) break; NT++; if (no_assimilated_array_entries >= MAX_ASSIMILATED_ARRAY_ENTRIES) { - TemplateReader::error("excessively long Inform 6 array in the template", NULL); + TemplateReader::error("excessively long Inform 6 array in the template", NULL); break; } v1_pile[no_assimilated_array_entries] = v1; @@ -453,14 +453,14 @@ function togglePopup(material_id) { Inter::Bookmarks::insert(IBM, array_in_progress); if (plm == ARRAY_PLM) { - CodeGen::Assimilate::install_socket(I, con_name, identifier); + CodeGen::Assimilate::install_socket(I, con_name, identifier); } break; } } - +

§2.1.2.1. Extract a token2.1.2.1 =

@@ -479,29 +479,29 @@ function togglePopup(material_id) { spos = Str::forward(spos); } - +

§2.1.2.2. Assimilate a value2.1.2.2 =

     if (Str::len(value) > 0) {
-        CodeGen::Assimilate::value(I, Inter::Bookmarks::package(IBM), IBM, value, &v1, &v2,
+        CodeGen::Assimilate::value(I, Inter::Bookmarks::package(IBM), IBM, value, &v1, &v2,
             (plm == VERB_PLM)?TRUE:FALSE);
     } else {
         v1 = LITERAL_IVAL; v2 = 0;
     }
 
- +

§2.2. Assimilate routine2.2 =

     text_stream *identifier = NULL, *chain = NULL, *body = NULL;
     match_results mr = Regexp::create_mr();
-    Parse the routine or stub header2.2.1;
-    if (identifier) Act on parsed header2.2.2;
+    Parse the routine or stub header2.2.1;
+    if (identifier) Act on parsed header2.2.2;
 
- +

§2.2.1. Parse the routine or stub header2.2.1 =

@@ -513,7 +513,7 @@ function togglePopup(material_id) { } else if (Regexp::match(&mr, S, L" *%[ *(%i+) *(%c*?); *(%c*)")) { identifier = mr.exp[0]; chain = mr.exp[1]; body = mr.exp[2]; } else { - TemplateReader::error("invalid Inform 6 routine declaration in the template", NULL); + TemplateReader::error("invalid Inform 6 routine declaration in the template", NULL); } } else { if (Regexp::match(&mr, S, L" *%C+ *(%i+) (%d+);%c*")) { @@ -523,15 +523,15 @@ function togglePopup(material_id) { if ((N<0) || (N>15)) N = 1; for (int i=1; i<=N; i++) WRITE_TO(chain, "x%d ", i); body = Str::duplicate(I"rfalse; ];"); - } else TemplateReader::error("invalid Inform 6 Stub declaration in the template", NULL); + } else TemplateReader::error("invalid Inform 6 Stub declaration in the template", NULL); } - +

§2.2.2. Act on parsed header2.2.2 =

-    inter_bookmark IBM_d = CodeGen::Assimilate::template_submodule(I, I"functions", P);
+    inter_bookmark IBM_d = CodeGen::Assimilate::template_submodule(I, I"functions", P);
     inter_bookmark *IBM = &IBM_d;
 
     inter_symbol *fnt = function_ptype_symbol;
@@ -539,7 +539,7 @@ function togglePopup(material_id) {
 
     TEMPORARY_TEXT(fname)
     WRITE_TO(fname, "%S_fn", identifier);
-    inter_package *FP = CodeGen::Assimilate::new_package_named(IBM, fname, fnt);
+    inter_package *FP = CodeGen::Assimilate::new_package_named(IBM, fname, fnt);
     DISCARD_TEXT(fname)
 
     inter_bookmark outer_save = Inter::Bookmarks::snapshot(IBM);
@@ -547,7 +547,7 @@ function togglePopup(material_id) {
 
     TEMPORARY_TEXT(bname)
     WRITE_TO(bname, "%S_B", identifier);
-    inter_package *IP = CodeGen::Assimilate::new_package_named(IBM, bname, code_ptype_symbol);
+    inter_package *IP = CodeGen::Assimilate::new_package_named(IBM, bname, code_ptype_symbol);
     DISCARD_TEXT(bname)
 
     inter_bookmark inner_save = Inter::Bookmarks::snapshot(IBM);
@@ -558,7 +558,7 @@ function togglePopup(material_id) {
         string_position spos = Str::start(chain);
         while (TRUE) {
             TEMPORARY_TEXT(value)
-            Extract a token2.1.2.1;
+            Extract a token2.1.2.1;
             if (Str::len(value) == 0) break;
             inter_symbol *loc_name = InterSymbolsTables::create_with_unique_name(Inter::Packages::scope(IP), value);
             Inter::Symbols::local(loc_name);
@@ -573,12 +573,12 @@ function togglePopup(material_id) {
         while ((L>0) && (Str::get_at(body, L) != ']')) L--;
         while ((L>0) && (Characters::is_whitespace(Str::get_at(body, L-1)))) L--;
         Str::truncate(body, L);
-        CodeGen::Assimilate::routine_body(IBM, IP, (inter_ti) Inter::Bookmarks::baseline(IBM) + 1, body, block_bookmark);
+        CodeGen::Assimilate::routine_body(IBM, IP, (inter_ti) Inter::Bookmarks::baseline(IBM) + 1, body, block_bookmark);
     }
 
     *IBM = inner_save;
 
-    inter_symbol *rsymb = CodeGen::Assimilate::make_socketed_symbol(I, identifier, Inter::Bookmarks::scope(IBM));
+    inter_symbol *rsymb = CodeGen::Assimilate::make_socketed_symbol(I, identifier, Inter::Bookmarks::scope(IBM));
     Inter::Symbols::annotate_i(rsymb, ASSIMILATED_IANN, 1);
     Produce::guard(Inter::Constant::new_function(IBM,
         InterSymbolsTables::id_from_symbol(I, FP, rsymb),
@@ -588,43 +588,43 @@ function togglePopup(material_id) {
 
     *IBM = outer_save;
 
-    CodeGen::Assimilate::install_socket(I, rsymb, rsymb->symbol_name);
+    CodeGen::Assimilate::install_socket(I, rsymb, rsymb->symbol_name);
     InterTree::remove_node(P);
 
- +

§3.

-inter_package *CodeGen::Assimilate::new_package_named(inter_bookmark *IBM, text_stream *name, inter_symbol *ptype) {
+inter_package *CodeGen::Assimilate::new_package_named(inter_bookmark *IBM, text_stream *name, inter_symbol *ptype) {
     inter_package *P = NULL;
     Produce::guard(Inter::Package::new_package_named(IBM, name, TRUE,
         ptype, (inter_ti) Inter::Bookmarks::baseline(IBM) + 1, NULL, &P));
     return P;
 }
 
-void CodeGen::Assimilate::install_socket(inter_tree *I, inter_symbol *con_name, text_stream *aka_text) {
+void CodeGen::Assimilate::install_socket(inter_tree *I, inter_symbol *con_name, text_stream *aka_text) {
     inter_symbol *socket = Inter::Connectors::find_socket(I, aka_text);
     if (socket == NULL) Inter::Connectors::socket(I, aka_text, con_name);
 }
 
-inter_symbol *CodeGen::Assimilate::make_socketed_symbol(inter_tree *I, text_stream *identifier, inter_symbols_table *into_scope) {
+inter_symbol *CodeGen::Assimilate::make_socketed_symbol(inter_tree *I, text_stream *identifier, inter_symbols_table *into_scope) {
     inter_symbol *new_symbol = InterSymbolsTables::create_with_unique_name(into_scope, identifier);
-    CodeGen::Assimilate::install_socket(I, new_symbol, identifier);
+    CodeGen::Assimilate::install_socket(I, new_symbol, identifier);
     return new_symbol;
 }
 

§4.

-void CodeGen::Assimilate::ensure_action(inter_tree *I, inter_tree_node *P, text_stream *value) {
+void CodeGen::Assimilate::ensure_action(inter_tree *I, inter_tree_node *P, text_stream *value) {
     if (Inter::Connectors::find_socket(I, value) == NULL) {
-        inter_bookmark IBM_d = CodeGen::Assimilate::template_submodule(I, I"actions", P);
+        inter_bookmark IBM_d = CodeGen::Assimilate::template_submodule(I, I"actions", P);
         inter_bookmark *IBM = &IBM_d;
         inter_symbol *ptype = action_ptype_symbol;
         if (ptype == NULL) ptype = plain_ptype_symbol;
         TEMPORARY_TEXT(an)
         WRITE_TO(an, "assim_action_%d", ++no_assimilated_actions);
-        Inter::Bookmarks::set_current_package(IBM, CodeGen::Assimilate::new_package_named(IBM, an, ptype));
+        Inter::Bookmarks::set_current_package(IBM, CodeGen::Assimilate::new_package_named(IBM, an, ptype));
         DISCARD_TEXT(an)
         inter_symbol *aid_s = InterSymbolsTables::create_with_unique_name(Inter::Bookmarks::scope(IBM), I"action_id");
         Produce::guard(Inter::Constant::new_numerical(IBM,
@@ -632,7 +632,7 @@ function togglePopup(material_id) {
             InterSymbolsTables::id_from_symbol(I, Inter::Bookmarks::package(IBM), unchecked_kind_symbol),
             LITERAL_IVAL, 0, (inter_ti) Inter::Bookmarks::baseline(IBM) + 1, NULL));
         Inter::Symbols::set_flag(aid_s, MAKE_NAME_UNIQUE);
-        inter_symbol *asymb = CodeGen::Assimilate::make_socketed_symbol(I, value, Inter::Bookmarks::scope(IBM));
+        inter_symbol *asymb = CodeGen::Assimilate::make_socketed_symbol(I, value, Inter::Bookmarks::scope(IBM));
         TEMPORARY_TEXT(unsharped)
         WRITE_TO(unsharped, "%SSub", value);
         Str::delete_first_character(unsharped);
@@ -652,7 +652,7 @@ function togglePopup(material_id) {
 

§5.

-void CodeGen::Assimilate::value(inter_tree *I, inter_package *pack, inter_bookmark *IBM, text_stream *S, inter_ti *val1, inter_ti *val2, int Verbal) {
+void CodeGen::Assimilate::value(inter_tree *I, inter_package *pack, inter_bookmark *IBM, text_stream *S, inter_ti *val1, inter_ti *val2, int Verbal) {
     int sign = 1, base = 10, from = 0, to = Str::len(S)-1, bad = FALSE;
     if ((Str::get_at(S, from) == '\'') && (Str::get_at(S, to) == '\'')) {
         from++;
@@ -768,13 +768,13 @@ function togglePopup(material_id) {
     }
 
     inter_schema *sch = InterSchemas::from_text(S, FALSE, 0, NULL);
-    inter_symbol *mcc_name = CodeGen::Assimilate::compute_constant(I, pack, IBM, sch);
+    inter_symbol *mcc_name = CodeGen::Assimilate::compute_constant(I, pack, IBM, sch);
     Inter::Symbols::to_data(I, pack, mcc_name, val1, val2);
 }
 
 inter_symbol *CodeGen::Assimilate::compute_constant(inter_tree *I, inter_package *pack, inter_bookmark *IBM, inter_schema *sch) {
 
-    inter_symbol *try = CodeGen::Assimilate::compute_constant_r(I, pack, IBM, sch->node_tree);
+    inter_symbol *try = CodeGen::Assimilate::compute_constant_r(I, pack, IBM, sch->node_tree);
     if (try) return try;
 
     InterSchemas::log(DL, sch);
@@ -786,7 +786,7 @@ function togglePopup(material_id) {
     text_stream *glob_storage = Inter::Warehouse::get_text(InterTree::warehouse(I), ID);
     Str::copy(glob_storage, sch->converted_from);
 
-    inter_symbol *mcc_name = CodeGen::Assimilate::computed_constant_symbol(pack);
+    inter_symbol *mcc_name = CodeGen::Assimilate::computed_constant_symbol(pack);
     Produce::guard(Inter::Constant::new_numerical(IBM,
         InterSymbolsTables::id_from_symbol(I, pack, mcc_name),
         InterSymbolsTables::id_from_symbol(I, pack, unchecked_kind_symbol), GLOB_IVAL, ID,
@@ -797,7 +797,7 @@ function togglePopup(material_id) {
 
 inter_symbol *CodeGen::Assimilate::compute_constant_r(inter_tree *I, inter_package *pack, inter_bookmark *IBM, inter_schema_node *isn) {
     if (isn->isn_type == SUBEXPRESSION_ISNT)
-        return CodeGen::Assimilate::compute_constant_r(I, pack, IBM, isn->child_node);
+        return CodeGen::Assimilate::compute_constant_r(I, pack, IBM, isn->child_node);
     if (isn->isn_type == OPERATION_ISNT) {
         inter_ti op = 0;
         if (isn->isn_clarifier == PLUS_BIP) op = CONSTANT_SUM_LIST;
@@ -805,23 +805,23 @@ function togglePopup(material_id) {
         else if (isn->isn_clarifier == MINUS_BIP) op = CONSTANT_DIFFERENCE_LIST;
         else if (isn->isn_clarifier == DIVIDE_BIP) op = CONSTANT_QUOTIENT_LIST;
         else if (isn->isn_clarifier == UNARYMINUS_BIP)
-            return CodeGen::Assimilate::compute_constant_unary_operation(I, pack, IBM, isn->child_node);
+            return CodeGen::Assimilate::compute_constant_unary_operation(I, pack, IBM, isn->child_node);
         else return NULL;
-        inter_symbol *i1 = CodeGen::Assimilate::compute_constant_r(I, pack, IBM, isn->child_node);
-        inter_symbol *i2 = CodeGen::Assimilate::compute_constant_r(I, pack, IBM, isn->child_node->next_node);
+        inter_symbol *i1 = CodeGen::Assimilate::compute_constant_r(I, pack, IBM, isn->child_node);
+        inter_symbol *i2 = CodeGen::Assimilate::compute_constant_r(I, pack, IBM, isn->child_node->next_node);
         if ((i1 == NULL) || (i2 == NULL)) return NULL;
-        return CodeGen::Assimilate::compute_constant_binary_operation(op, I, pack, IBM, i1, i2);
+        return CodeGen::Assimilate::compute_constant_binary_operation(op, I, pack, IBM, i1, i2);
     }
     if (isn->isn_type == EXPRESSION_ISNT) {
         inter_schema_token *t = isn->expression_tokens;
         if (t->next) {
             if (t->next->next) return NULL;
-            inter_symbol *i1 = CodeGen::Assimilate::compute_constant_eval(I, pack, IBM, t);
-            inter_symbol *i2 = CodeGen::Assimilate::compute_constant_eval(I, pack, IBM, t->next);
+            inter_symbol *i1 = CodeGen::Assimilate::compute_constant_eval(I, pack, IBM, t);
+            inter_symbol *i2 = CodeGen::Assimilate::compute_constant_eval(I, pack, IBM, t->next);
             if ((i1 == NULL) || (i2 == NULL)) return NULL;
-            return CodeGen::Assimilate::compute_constant_binary_operation(CONSTANT_SUM_LIST, I, pack, IBM, i1, i2);
+            return CodeGen::Assimilate::compute_constant_binary_operation(CONSTANT_SUM_LIST, I, pack, IBM, i1, i2);
         }
-        return CodeGen::Assimilate::compute_constant_eval(I, pack, IBM, t);
+        return CodeGen::Assimilate::compute_constant_eval(I, pack, IBM, t);
     }
     return NULL;
 }
@@ -843,7 +843,7 @@ function togglePopup(material_id) {
             break;
     }
     if (v1 == UNDEF_IVAL) return NULL;
-    inter_symbol *mcc_name = CodeGen::Assimilate::computed_constant_symbol(pack);
+    inter_symbol *mcc_name = CodeGen::Assimilate::computed_constant_symbol(pack);
     Produce::guard(Inter::Constant::new_numerical(IBM,
         InterSymbolsTables::id_from_symbol(I, pack, mcc_name),
         InterSymbolsTables::id_from_symbol(I, pack, unchecked_kind_symbol), v1, v2,
@@ -852,9 +852,9 @@ function togglePopup(material_id) {
 }
 
 inter_symbol *CodeGen::Assimilate::compute_constant_unary_operation(inter_tree *I, inter_package *pack, inter_bookmark *IBM, inter_schema_node *operand1) {
-    inter_symbol *i1 = CodeGen::Assimilate::compute_constant_r(I, pack, IBM, operand1);
+    inter_symbol *i1 = CodeGen::Assimilate::compute_constant_r(I, pack, IBM, operand1);
     if (i1 == NULL) return NULL;
-    inter_symbol *mcc_name = CodeGen::Assimilate::computed_constant_symbol(pack);
+    inter_symbol *mcc_name = CodeGen::Assimilate::computed_constant_symbol(pack);
     inter_tree_node *array_in_progress =
         Inode::fill_3(IBM, CONSTANT_IST, InterSymbolsTables::id_from_IRS_and_symbol(IBM, mcc_name), InterSymbolsTables::id_from_symbol(I, pack, unchecked_kind_symbol), CONSTANT_DIFFERENCE_LIST, NULL, (inter_ti) Inter::Bookmarks::baseline(IBM) + 1);
     int pos = array_in_progress->W.extent;
@@ -868,7 +868,7 @@ function togglePopup(material_id) {
 }
 
 inter_symbol *CodeGen::Assimilate::compute_constant_binary_operation(inter_ti op, inter_tree *I, inter_package *pack, inter_bookmark *IBM, inter_symbol *i1, inter_symbol *i2) {
-    inter_symbol *mcc_name = CodeGen::Assimilate::computed_constant_symbol(pack);
+    inter_symbol *mcc_name = CodeGen::Assimilate::computed_constant_symbol(pack);
     inter_tree_node *array_in_progress =
         Inode::fill_3(IBM, CONSTANT_IST, InterSymbolsTables::id_from_IRS_and_symbol(IBM, mcc_name), InterSymbolsTables::id_from_symbol(I, pack, unchecked_kind_symbol), op, NULL, (inter_ti) Inter::Bookmarks::baseline(IBM) + 1);
     int pos = array_in_progress->W.extent;
@@ -903,7 +903,7 @@ function togglePopup(material_id) {
 } routine_body_request;
 
 int rb_splat_count = 1;
-int CodeGen::Assimilate::routine_body(inter_bookmark *IBM, inter_package *block_package, inter_ti offset, text_stream *body, inter_bookmark bb) {
+int CodeGen::Assimilate::routine_body(inter_bookmark *IBM, inter_package *block_package, inter_ti offset, text_stream *body, inter_bookmark bb) {
     if (Str::is_whitespace(body)) return FALSE;
     routine_body_request *req = CREATE(routine_body_request);
     req->assimilation_pass = current_assimilation_pass;
@@ -916,7 +916,7 @@ function togglePopup(material_id) {
     return TRUE;
 }
 
-void CodeGen::Assimilate::function_bodies(inter_tree *I) {
+void CodeGen::Assimilate::function_bodies(inter_tree *I) {
     routine_body_request *req;
     LOOP_OVER(req, routine_body_request)
         if (req->assimilation_pass == current_assimilation_pass) {
@@ -946,7 +946,7 @@ function togglePopup(material_id) {
 
  • The structure routine_body_request is private to this section.
diff --git a/docs/pipeline-module/2-dic.html b/docs/pipeline-module/3-dic.html similarity index 85% rename from docs/pipeline-module/2-dic.html rename to docs/pipeline-module/3-dic.html index 1520e2840..2b5a6ad5c 100644 --- a/docs/pipeline-module/2-dic.html +++ b/docs/pipeline-module/3-dic.html @@ -70,20 +70,20 @@ function togglePopup(material_id) {
+

To make sure certain symbol names translate into globally unique target symbols.

-
+

§1. Pipeline stage.

-void DetectIndirectCalls::create_pipeline_stage(void) {
-    CodeGen::Stage::new(I"detect-indirect-calls", DetectIndirectCalls::run_pipeline_stage, NO_STAGE_ARG, FALSE);
+void DetectIndirectCalls::create_pipeline_stage(void) {
+    ParsingPipelines::new_stage(I"detect-indirect-calls", DetectIndirectCalls::run_pipeline_stage, NO_STAGE_ARG, FALSE);
 }
 
 int DetectIndirectCalls::run_pipeline_stage(pipeline_step *step) {
-    InterTree::traverse(step->repository, DetectIndirectCalls::visitor, NULL, NULL, PACKAGE_IST);
+    InterTree::traverse(step->ephemera.repository, DetectIndirectCalls::visitor, NULL, NULL, PACKAGE_IST);
     return TRUE;
 }
 
@@ -91,7 +91,7 @@ function togglePopup(material_id) {
     inter_package *pack = Inter::Package::defined_by_frame(P);
     if (Inter::Packages::is_codelike(pack)) {
         inter_tree_node *D = Inter::Packages::definition(pack);
-        DetectIndirectCalls::traverse_code_tree(D);
+        DetectIndirectCalls::traverse_code_tree(D);
     }
 }
 
@@ -100,9 +100,9 @@ operations:

-void DetectIndirectCalls::traverse_code_tree(inter_tree_node *P) {
+void DetectIndirectCalls::traverse_code_tree(inter_tree_node *P) {
     PROTECTED_LOOP_THROUGH_INTER_CHILDREN(F, P) {
-        DetectIndirectCalls::traverse_code_tree(F);
+        DetectIndirectCalls::traverse_code_tree(F);
     }
     PROTECTED_LOOP_THROUGH_INTER_CHILDREN(F, P) {
         if ((F->W.data[ID_IFLD] == INV_IST) &&
@@ -128,7 +128,7 @@ operations:
 }
 
diff --git a/docs/pipeline-module/2-ip.html b/docs/pipeline-module/3-ip.html similarity index 81% rename from docs/pipeline-module/2-ip.html rename to docs/pipeline-module/3-ip.html index d257cc630..945f34dfe 100644 --- a/docs/pipeline-module/2-ip.html +++ b/docs/pipeline-module/3-ip.html @@ -70,22 +70,22 @@ function togglePopup(material_id) {
+

To make sure certain symbol names translate into globally unique target symbols.

-
+

§1. Pipeline stage.

-void CodeGen::Inspection::create_pipeline_stage(void) {
-    CodeGen::Stage::new(I"inspect-plugs", CodeGen::Inspection::run_pipeline_stage, NO_STAGE_ARG, FALSE);
+void CodeGen::Inspection::create_pipeline_stage(void) {
+    ParsingPipelines::new_stage(I"inspect-plugs", CodeGen::Inspection::run_pipeline_stage, NO_STAGE_ARG, FALSE);
 }
 
 int CodeGen::Inspection::run_pipeline_stage(pipeline_step *step) {
-    Inter::Connectors::stecker(step->repository);
+    Inter::Connectors::stecker(step->ephemera.repository);
     int resolution_failed = FALSE;
-    InterTree::traverse(step->repository, CodeGen::Inspection::visitor, &resolution_failed, NULL, PACKAGE_IST);
+    InterTree::traverse(step->ephemera.repository, CodeGen::Inspection::visitor, &resolution_failed, NULL, PACKAGE_IST);
     if (resolution_failed) internal_error("loose plug(s)");
     return TRUE;
 }
@@ -109,7 +109,7 @@ function togglePopup(material_id) {
 }
 
diff --git a/docs/pipeline-module/1-li.html b/docs/pipeline-module/3-lnk.html similarity index 82% rename from docs/pipeline-module/1-li.html rename to docs/pipeline-module/3-lnk.html index 823e43447..1f54a50ff 100644 --- a/docs/pipeline-module/1-li.html +++ b/docs/pipeline-module/3-lnk.html @@ -1,7 +1,7 @@ - Link Instructions + Link @@ -68,12 +68,12 @@ function togglePopup(material_id) {
- + +

Inter often needs to assimilate or otherwise deal with architecture-neutral kits of linkable material, and this is where such requirements are noted.

-
+

§1.

@@ -95,14 +95,14 @@ function togglePopup(material_id) {

§2. Link stage.

-void CodeGen::LinkInstructions::create_pipeline_stage(void) {
-    CodeGen::Stage::new(I"link", CodeGen::LinkInstructions::run_link_stage, NO_STAGE_ARG, FALSE);
+void CodeGen::LinkInstructions::create_pipeline_stage(void) {
+    ParsingPipelines::new_stage(I"link", CodeGen::LinkInstructions::run_link_stage, NO_STAGE_ARG, FALSE);
 }
 
 int CodeGen::LinkInstructions::run_link_stage(pipeline_step *step) {
     link_instruction *req;
-    LOOP_OVER_LINKED_LIST(req, link_instruction, step->requirements_list) {
-        inter_architecture *A = CodeGen::Architecture::current();
+    LOOP_OVER_LINKED_LIST(req, link_instruction, step->ephemera.requirements_list) {
+        inter_architecture *A = RunningPipelines::get_architecture();
         if (A == NULL) Errors::fatal("no -architecture given");
         filename *arch_file = Architectures::canonical_binary(req->location, A);
         if (TextFiles::exists(arch_file) == FALSE) internal_error("no arch file for requirement");
@@ -116,13 +116,13 @@ function togglePopup(material_id) {
             WRITE_TO(STDERR, "sought attachment material at: %S in %f\n", req->attachment_point, arch_file);
             internal_error("unable to find attachment point package");
         }
-        Inter::Transmigration::move(pack, Site::main_package(step->repository), FALSE);
+        Inter::Transmigration::move(pack, Site::main_package(step->ephemera.repository), FALSE);
     }
     return TRUE;
 }
 
diff --git a/docs/pipeline-module/2-mt.html b/docs/pipeline-module/3-mt.html similarity index 93% rename from docs/pipeline-module/2-mt.html rename to docs/pipeline-module/3-mt.html index fdb124358..044705b16 100644 --- a/docs/pipeline-module/2-mt.html +++ b/docs/pipeline-module/3-mt.html @@ -70,24 +70,24 @@ function togglePopup(material_id) {
+

To link inter from I7 with template code.

-
+

§1. Link.

-void CodeGen::MergeTemplate::create_pipeline_stage(void) {
-    CodeGen::Stage::new(I"merge-template", CodeGen::MergeTemplate::run_pipeline_stage, TEMPLATE_FILE_STAGE_ARG, TRUE);
+void CodeGen::MergeTemplate::create_pipeline_stage(void) {
+    ParsingPipelines::new_stage(I"merge-template", CodeGen::MergeTemplate::run_pipeline_stage, TEMPLATE_FILE_STAGE_ARG, TRUE);
 }
 
 int CodeGen::MergeTemplate::run_pipeline_stage(pipeline_step *step) {
-    inter_package *main_package = Site::main_package_if_it_exists(step->repository);
+    inter_package *main_package = Site::main_package_if_it_exists(step->ephemera.repository);
     inter_bookmark IBM;
     if (main_package) IBM = Inter::Bookmarks::at_end_of_this_package(main_package);
-    else IBM = Inter::Bookmarks::at_start_of_this_repository(step->repository);
-    CodeGen::MergeTemplate::link(&IBM, step->step_argument, step->the_PP, NULL);
+    else IBM = Inter::Bookmarks::at_start_of_this_repository(step->ephemera.repository);
+    CodeGen::MergeTemplate::link(&IBM, step->step_argument, step->ephemera.the_PP, NULL);
     return TRUE;
 }
 
@@ -95,16 +95,16 @@ function togglePopup(material_id) {
     if (IBM == NULL) internal_error("no inter to link with");
     inter_tree *I = Inter::Bookmarks::tree(IBM);
     if (Str::eq(template_file, I"none"))
-        InterTree::traverse(I, CodeGen::MergeTemplate::catch_all_visitor, NULL, NULL, 0);
+        InterTree::traverse(I, CodeGen::MergeTemplate::catch_all_visitor, NULL, NULL, 0);
     else
-        InterTree::traverse(I, CodeGen::MergeTemplate::visitor, NULL, NULL, 0);
+        InterTree::traverse(I, CodeGen::MergeTemplate::visitor, NULL, NULL, 0);
 
     inter_package *template_package = Site::ensure_assimilation_package(I, plain_ptype_symbol);
 
     inter_bookmark link_bookmark =
         Inter::Bookmarks::at_end_of_this_package(template_package);
 
-    I6T_kit kit = TemplateReader::kit_out(&link_bookmark, &(CodeGen::MergeTemplate::receive_raw),  &(CodeGen::MergeTemplate::receive_command), NULL);
+    I6T_kit kit = TemplateReader::kit_out(&link_bookmark, &(CodeGen::MergeTemplate::receive_raw),  &(CodeGen::MergeTemplate::receive_command), NULL);
     kit.no_i6t_file_areas = LinkedLists::len(PP);
     pathname *P;
     int i=0;
@@ -113,11 +113,11 @@ function togglePopup(material_id) {
     int stage = EARLY_LINK_STAGE;
     if (Str::eq(template_file, I"none")) stage = CATCH_ALL_LINK_STAGE;
     TEMPORARY_TEXT(T)
-    TemplateReader::I6T_file_intervene(T, stage, NULL, NULL, &kit);
-    CodeGen::MergeTemplate::receive_raw(T, &kit);
+    TemplateReader::I6T_file_intervene(T, stage, NULL, NULL, &kit);
+    CodeGen::MergeTemplate::receive_raw(T, &kit);
     DISCARD_TEXT(T)
     if (Str::ne(template_file, I"none"))
-        TemplateReader::extract(template_file, &kit);
+        TemplateReader::extract(template_file, &kit);
 }
 
 void CodeGen::MergeTemplate::visitor(inter_tree *I, inter_tree_node *P, void *state) {
@@ -127,7 +127,7 @@ function togglePopup(material_id) {
         text_stream *S3 = Inode::ID_to_text(P, P->W.data[TO_RAW_LINK_IFLD]);
         text_stream *S4 = Inode::ID_to_text(P, P->W.data[TO_SEGMENT_LINK_IFLD]);
         void *ref = Inode::ID_to_ref(P, P->W.data[REF_LINK_IFLD]);
-        TemplateReader::new_intervention((int) P->W.data[STAGE_LINK_IFLD], S1, S2, S3, S4, ref);
+        TemplateReader::new_intervention((int) P->W.data[STAGE_LINK_IFLD], S1, S2, S3, S4, ref);
     }
 }
 
@@ -138,11 +138,11 @@ function togglePopup(material_id) {
         text_stream *S3 = Inode::ID_to_text(P, P->W.data[TO_RAW_LINK_IFLD]);
         text_stream *S4 = Inode::ID_to_text(P, P->W.data[TO_SEGMENT_LINK_IFLD]);
         void *ref = Inode::ID_to_ref(P, P->W.data[REF_LINK_IFLD]);
-        TemplateReader::new_intervention((int) P->W.data[STAGE_LINK_IFLD], S1, S2, S3, S4, ref);
+        TemplateReader::new_intervention((int) P->W.data[STAGE_LINK_IFLD], S1, S2, S3, S4, ref);
     }
 }
 
-void CodeGen::MergeTemplate::entire_splat(inter_bookmark *IBM, text_stream *origin, text_stream *content, inter_ti level) {
+void CodeGen::MergeTemplate::entire_splat(inter_bookmark *IBM, text_stream *origin, text_stream *content, inter_ti level) {
     inter_ti SID = Inter::Warehouse::create_text(Inter::Bookmarks::warehouse(IBM), Inter::Bookmarks::package(IBM));
     text_stream *glob_storage = Inter::Warehouse::get_text(Inter::Bookmarks::warehouse(IBM), SID);
     Str::copy(glob_storage, content);
@@ -160,7 +160,7 @@ function togglePopup(material_id) {
 define SUBORDINATE_FILTER_BITS (COMMENTED_FILTER_BIT + SQUOTED_FILTER_BIT + DQUOTED_FILTER_BIT + ROUTINED_FILTER_BIT)
 
-void CodeGen::MergeTemplate::receive_raw(text_stream *S, I6T_kit *kit) {
+void CodeGen::MergeTemplate::receive_raw(text_stream *S, I6T_kit *kit) {
     text_stream *R = Str::new();
     int mode = IGNORE_WS_FILTER_BIT;
     LOOP_THROUGH_TEXT(pos, S) {
@@ -202,22 +202,22 @@ function togglePopup(material_id) {
         }
         PUT_TO(R, c);
         if ((c == ';') && (!(mode & SUBORDINATE_FILTER_BITS))) {
-            CodeGen::MergeTemplate::chunked_raw(R, kit);
+            CodeGen::MergeTemplate::chunked_raw(R, kit);
             mode = IGNORE_WS_FILTER_BIT;
         }
     }
-    CodeGen::MergeTemplate::chunked_raw(R, kit);
+    CodeGen::MergeTemplate::chunked_raw(R, kit);
     Str::clear(S);
 }
 
 void CodeGen::MergeTemplate::chunked_raw(text_stream *S, I6T_kit *kit) {
     if (Str::len(S) == 0) return;
     PUT_TO(S, '\n');
-    CodeGen::MergeTemplate::entire_splat(kit->IBM, I"template", S, (inter_ti) (Inter::Bookmarks::baseline(kit->IBM) + 1));
+    CodeGen::MergeTemplate::entire_splat(kit->IBM, I"template", S, (inter_ti) (Inter::Bookmarks::baseline(kit->IBM) + 1));
     Str::clear(S);
 }
 
-void CodeGen::MergeTemplate::receive_command(OUTPUT_STREAM, text_stream *command, text_stream *argument, I6T_kit *kit) {
+void CodeGen::MergeTemplate::receive_command(OUTPUT_STREAM, text_stream *command, text_stream *argument, I6T_kit *kit) {
     if ((Str::eq_wide_string(command, L"plugin")) ||
         (Str::eq_wide_string(command, L"type")) ||
         (Str::eq_wide_string(command, L"open-file")) ||
@@ -242,15 +242,15 @@ function togglePopup(material_id) {
         (Str::eq_wide_string(command, L"testing-routine")) ||
         (Str::eq_wide_string(command, L"testing-command"))) {
         LOG("command: <%S> argument: <%S>\n", command, argument);
-        TemplateReader::error("the template command '{-%S}' has been withdrawn in this version of Inform", command);
+        TemplateReader::error("the template command '{-%S}' has been withdrawn in this version of Inform", command);
     } else {
         LOG("command: <%S> argument: <%S>\n", command, argument);
-        TemplateReader::error("no such {-command} as '%S'", command);
+        TemplateReader::error("no such {-command} as '%S'", command);
     }
 }
 
diff --git a/docs/pipeline-module/2-plm.html b/docs/pipeline-module/3-plm.html similarity index 89% rename from docs/pipeline-module/2-plm.html rename to docs/pipeline-module/3-plm.html index cca8eb2fc..e8d78f9da 100644 --- a/docs/pipeline-module/2-plm.html +++ b/docs/pipeline-module/3-plm.html @@ -70,27 +70,27 @@ function togglePopup(material_id) {
+

To generate the initial state of storage for variables.

-
+

§1. Pipeline stage.

-void CodeGen::PLM::create_pipeline_stage(void) {
-    CodeGen::Stage::new(I"parse-linked-matter", CodeGen::PLM::run_pipeline_stage, NO_STAGE_ARG, FALSE);
+void CodeGen::PLM::create_pipeline_stage(void) {
+    ParsingPipelines::new_stage(I"parse-linked-matter", CodeGen::PLM::run_pipeline_stage, NO_STAGE_ARG, FALSE);
 }
 
 int CodeGen::PLM::run_pipeline_stage(pipeline_step *step) {
-    InterTree::traverse(step->repository, CodeGen::PLM::visitor, NULL, NULL, 0);
+    InterTree::traverse(step->ephemera.repository, CodeGen::PLM::visitor, NULL, NULL, 0);
     return TRUE;
 }
 

§2. Parsing.

-void CodeGen::PLM::visitor(inter_tree *I, inter_tree_node *P, void *state) {
+void CodeGen::PLM::visitor(inter_tree *I, inter_tree_node *P, void *state) {
     inter_package *outer = Inter::Packages::container(P);
     if (((outer == NULL) || (Inter::Packages::is_codelike(outer) == FALSE)) && (P->W.data[ID_IFLD] == SPLAT_IST)) {
         text_stream *S = Inode::ID_to_text(P, P->W.data[MATTER_SPLAT_IFLD]);
@@ -128,7 +128,7 @@ function togglePopup(material_id) {
 }
 
diff --git a/docs/pipeline-module/3-prp.html b/docs/pipeline-module/3-prp.html index f637f2ea9..6b9f9a86f 100644 --- a/docs/pipeline-module/3-prp.html +++ b/docs/pipeline-module/3-prp.html @@ -1,7 +1,7 @@ - Properties + Prepare @@ -68,42 +68,133 @@ function togglePopup(material_id) {
- + -

To compile the main/synoptic/properties submodule.

+ +

The Inter stage prepare.

-

§1. Before this runs, property packages are scattered all over the Inter tree. -We must allocate each one a unique ID. -

- -

As this is called, Synoptic Utilities has already formed a list property_nodes -of packages of type _activity. -

+

§1.

-void SynopticProperties::compile(inter_tree *I, tree_inventory *inv) {
-    if (TreeLists::len(inv->property_nodes) > 0) {
-        TreeLists::sort(inv->property_nodes, Synoptic::module_order);
-        for (int i=0; i<TreeLists::len(inv->property_nodes); i++) {
-            inter_package *pack = Inter::Package::defined_by_frame(inv->property_nodes->list[i].node);
-            inter_tree_node *D = Synoptic::get_definition(pack, I"property_id");
-            D->W.data[DATA_CONST_IFLD+1] = (inter_ti) i;
-        }
+void CodeGen::Architecture::create_pipeline_stage(void) {
+    ParsingPipelines::new_stage(I"prepare", CodeGen::Architecture::run_prepare_stage, GENERAL_STAGE_ARG, TRUE);
+}
+
+int CodeGen::Architecture::run_prepare_stage(pipeline_step *step) {
+    if (current_architecture == NULL) internal_error("no architecture set");
+    return CodeGen::Architecture::run_prepare_stage_inner(step,
+        Architectures::is_16_bit(current_architecture),
+        Architectures::debug_enabled(current_architecture));
+}
+
+int CodeGen::Architecture::run_prepare_stage_inner(pipeline_step *step, int Z, int D) {
+    inter_tree *I = step->ephemera.repository;
+    Packaging::outside_all_packages(I);
+    PackageTypes::get(I, I"_plain");
+    PackageTypes::get(I, I"_code");
+    PackageTypes::get(I, I"_linkage");
+    inter_symbol *module_name = PackageTypes::get(I, I"_module");
+    PackageTypes::get(I, I"_submodule");
+    PackageTypes::get(I, I"_function");
+    PackageTypes::get(I, I"_action");
+    PackageTypes::get(I, I"_command");
+    PackageTypes::get(I, I"_property");
+    PackageTypes::get(I, I"_to_phrase");
+    PackageTypes::get(I, I"_response");
+    inter_package *main_p = Site::main_package(I);
+    inter_bookmark in_main = Inter::Bookmarks::at_end_of_this_package(main_p);
+    inter_package *generic_p = NULL;
+    Inter::Package::new_package_named(&in_main, I"generic", FALSE, module_name, 1, NULL, &generic_p);
+    inter_bookmark in_generic = Inter::Bookmarks::at_end_of_this_package(generic_p);
+    inter_symbol *unchecked_kind_symbol = InterSymbolsTables::create_with_unique_name(Inter::Bookmarks::scope(&in_generic), I"K_unchecked");
+    Inter::Kind::new(&in_generic,
+        InterSymbolsTables::id_from_symbol(I, generic_p, unchecked_kind_symbol),
+        UNCHECKED_IDT,
+        0,
+        BASE_ICON, 0, NULL,
+        (inter_ti) Inter::Bookmarks::baseline(&in_generic) + 1, NULL);
+    inter_symbol *typeless_int_symbol = InterSymbolsTables::create_with_unique_name(Inter::Bookmarks::scope(&in_generic), I"K_typeless_int");
+    Inter::Kind::new(&in_generic,
+        InterSymbolsTables::id_from_symbol(I, generic_p, typeless_int_symbol),
+        INT32_IDT,
+        0,
+        BASE_ICON, 0, NULL,
+        (inter_ti) Inter::Bookmarks::baseline(&in_generic) + 1, NULL);
+    inter_symbol *truth_state_kind_symbol = InterSymbolsTables::create_with_unique_name(Inter::Bookmarks::scope(&in_generic), I"K_truth_state");
+    Inter::Kind::new(&in_generic,
+        InterSymbolsTables::id_from_symbol(I, generic_p, truth_state_kind_symbol),
+        INT2_IDT,
+        0,
+        BASE_ICON, 0, NULL,
+        (inter_ti) Inter::Bookmarks::baseline(&in_generic) + 1, NULL);
+    inter_symbol *action_name_kind_symbol = InterSymbolsTables::create_with_unique_name(Inter::Bookmarks::scope(&in_generic), I"K_action_name");
+    Inter::Kind::new(&in_generic,
+        InterSymbolsTables::id_from_symbol(I, generic_p, action_name_kind_symbol),
+        INT32_IDT,
+        0,
+        BASE_ICON, 0, NULL,
+        (inter_ti) Inter::Bookmarks::baseline(&in_generic) + 1, NULL);
+    inter_ti operands[2];
+    operands[0] = InterSymbolsTables::id_from_IRS_and_symbol(&in_generic, unchecked_kind_symbol);
+    operands[1] = InterSymbolsTables::id_from_IRS_and_symbol(&in_generic, unchecked_kind_symbol);
+    inter_symbol *unchecked_function_symbol = InterSymbolsTables::create_with_unique_name(Inter::Bookmarks::scope(&in_generic), I"K_unchecked_function");
+    Inter::Kind::new(&in_generic,
+        InterSymbolsTables::id_from_symbol(I, generic_p, unchecked_function_symbol),
+        ROUTINE_IDT,
+        0,
+        FUNCTION_ICON, 2, operands,
+        (inter_ti) Inter::Bookmarks::baseline(&in_generic) + 1, NULL);
+    inter_symbol *list_of_unchecked_kind_symbol = InterSymbolsTables::create_with_unique_name(Inter::Bookmarks::scope(&in_generic), I"K_list_of_values");
+    Inter::Kind::new(&in_generic,
+        InterSymbolsTables::id_from_symbol(I, generic_p, list_of_unchecked_kind_symbol),
+        LIST_IDT,
+        0,
+        LIST_ICON, 1, operands,
+        (inter_ti) Inter::Bookmarks::baseline(&in_generic) + 1, NULL);
+
+    if (Str::ne(step->step_argument, I"none")) {
+        inter_package *template_p = NULL;
+        Inter::Package::new_package_named(&in_main, step->step_argument, FALSE, module_name, 1, NULL, &template_p);
+        Site::set_assimilation_package(I, template_p);
     }
-    Define CCOUNT_PROPERTY1.1;
+
+    inter_bookmark *in_veneer = Site::veneer_booknark(I);
+    inter_package *veneer_p = Inter::Packages::veneer(I);
+    inter_symbol *vi_unchecked = InterSymbolsTables::create_with_unique_name(Inter::Bookmarks::scope(in_veneer), I"K_unchecked");
+    InterSymbolsTables::equate(vi_unchecked, unchecked_kind_symbol);
+    inter_symbol *con_name = InterSymbolsTables::create_with_unique_name(Inter::Bookmarks::scope(in_veneer), I"WORDSIZE");
+    Inter::Constant::new_numerical(in_veneer,
+        InterSymbolsTables::id_from_symbol(I, veneer_p, con_name),
+        InterSymbolsTables::id_from_symbol(I, veneer_p, vi_unchecked),
+        LITERAL_IVAL, (Z)?2:4,
+        (inter_ti) Inter::Bookmarks::baseline(in_veneer) + 1, NULL);
+    inter_symbol *target_name;
+    if (Z) target_name = InterSymbolsTables::create_with_unique_name(Inter::Bookmarks::scope(in_veneer), I"TARGET_ZCODE");
+    else target_name = InterSymbolsTables::create_with_unique_name(Inter::Bookmarks::scope(in_veneer), I"TARGET_GLULX");
+    Inter::Constant::new_numerical(in_veneer,
+        InterSymbolsTables::id_from_symbol(I, veneer_p, target_name),
+        InterSymbolsTables::id_from_symbol(I, veneer_p, vi_unchecked),
+        LITERAL_IVAL, 1,
+        (inter_ti) Inter::Bookmarks::baseline(in_veneer) + 1, NULL);
+    if (D) {
+        inter_symbol *D_name = InterSymbolsTables::create_with_unique_name(Inter::Bookmarks::scope(in_veneer), I"DEBUG");
+        Inter::Constant::new_numerical(in_veneer,
+            InterSymbolsTables::id_from_symbol(I, veneer_p, D_name),
+            InterSymbolsTables::id_from_symbol(I, veneer_p, vi_unchecked),
+            LITERAL_IVAL, 1,
+            (inter_ti) Inter::Bookmarks::baseline(in_veneer) + 1, NULL);
+    }
+    inter_symbol *P_name = InterSymbolsTables::create_with_unique_name(Inter::Bookmarks::scope(in_veneer), I"FILES_PLUGIN");
+    Inter::Constant::new_numerical(in_veneer,
+        InterSymbolsTables::id_from_symbol(I, veneer_p, P_name),
+        InterSymbolsTables::id_from_symbol(I, veneer_p, vi_unchecked),
+        LITERAL_IVAL, 1,
+        (inter_ti) Inter::Bookmarks::baseline(in_veneer) + 1, NULL);
+    return TRUE;
 }
 
-

§1.1. Define CCOUNT_PROPERTY1.1 = -

- -
-    inter_name *iname = HierarchyLocations::find(I, CCOUNT_PROPERTY_HL);
-    Produce::numeric_constant(I, iname, K_value, (inter_ti) (TreeLists::len(inv->property_nodes)));
-
-
diff --git a/docs/pipeline-module/2-rcc.html b/docs/pipeline-module/3-rcc.html similarity index 91% rename from docs/pipeline-module/2-rcc.html rename to docs/pipeline-module/3-rcc.html index 0eb386104..8edf2d9df 100644 --- a/docs/pipeline-module/2-rcc.html +++ b/docs/pipeline-module/3-rcc.html @@ -70,20 +70,20 @@ function togglePopup(material_id) {
+

To generate the initial state of storage for variables.

-
+

§1. Pipeline stage.

-void CodeGen::RCC::create_pipeline_stage(void) {
-    CodeGen::Stage::new(I"resolve-conditional-compilation", CodeGen::RCC::run_pipeline_stage, NO_STAGE_ARG, FALSE);
+void CodeGen::RCC::create_pipeline_stage(void) {
+    ParsingPipelines::new_stage(I"resolve-conditional-compilation", CodeGen::RCC::run_pipeline_stage, NO_STAGE_ARG, FALSE);
 }
 
 int CodeGen::RCC::run_pipeline_stage(pipeline_step *step) {
-    CodeGen::RCC::resolve(step->repository);
+    CodeGen::RCC::resolve(step->ephemera.repository);
     return TRUE;
 }
 
@@ -98,13 +98,13 @@ function togglePopup(material_id) { int cc_sp; } rcc_state; -void CodeGen::RCC::resolve(inter_tree *I) { +void CodeGen::RCC::resolve(inter_tree *I) { rcc_state state; state.I6_level_symbols = Dictionaries::new(1024, TRUE); state.cc_sp = 0; - InterTree::traverse(I, CodeGen::RCC::visitor, &state, NULL, 0); + InterTree::traverse(I, CodeGen::RCC::visitor, &state, NULL, 0); if (state.cc_sp != 0) - TemplateReader::error("conditional compilation is wrongly structured in the template: not enough #endif", NULL); + TemplateReader::error("conditional compilation is wrongly structured in the template: not enough #endif", NULL); } void CodeGen::RCC::visitor(inter_tree *I, inter_tree_node *P, void *v_state) { @@ -122,13 +122,13 @@ function togglePopup(material_id) { case ROUTINE_PLM: case DEFAULT_PLM: case STUB_PLM: - if (allow) Symbol definition2.1; + if (allow) Symbol definition2.1; break; - case IFDEF_PLM: Deal with an IFDEF2.2; break; - case IFNDEF_PLM: Deal with an IFNDEF2.3; break; - case IFTRUE_PLM: Deal with an IFTRUE2.4; break; - case IFNOT_PLM: Deal with an IFNOT2.5; break; - case ENDIF_PLM: Deal with an ENDIF2.6; break; + case IFDEF_PLM: Deal with an IFDEF2.2; break; + case IFNDEF_PLM: Deal with an IFNDEF2.3; break; + case IFTRUE_PLM: Deal with an IFTRUE2.4; break; + case IFNOT_PLM: Deal with an IFNOT2.5; break; + case ENDIF_PLM: Deal with an ENDIF2.6; break; } } } @@ -153,7 +153,7 @@ function togglePopup(material_id) { } } - +

§.1. Extract rest of text into ident.1 =

@@ -170,47 +170,47 @@ function togglePopup(material_id) { } } - +

§2.1. Symbol definition2.1 =

     TEMPORARY_TEXT(ident)
-    Extract second token into ident.1;
+    Extract second token into ident.1;
     LOGIF(RESOLVING_CONDITIONAL_COMPILATION, "I6 defines %S here\n", ident);
     Dictionaries::create(state->I6_level_symbols, ident);
     DISCARD_TEXT(ident)
 
- +

§2.2. Deal with an IFDEF2.2 =

     TEMPORARY_TEXT(ident)
-    Extract rest of text into ident.1;
+    Extract rest of text into ident.1;
     int result = FALSE;
     text_stream *symbol_name = ident;
-    Decide whether symbol defined2.2.1;
-    Stack up the result2.2.2;
+    Decide whether symbol defined2.2.1;
+    Stack up the result2.2.2;
     allow = FALSE;
     DISCARD_TEXT(ident)
 
- +

§2.3. Deal with an IFNDEF2.3 =

     TEMPORARY_TEXT(ident)
-    Extract rest of text into ident.1;
+    Extract rest of text into ident.1;
     int result = FALSE;
     text_stream *symbol_name = ident;
-    Decide whether symbol defined2.2.1;
+    Decide whether symbol defined2.2.1;
     result = (result)?FALSE:TRUE;
-    Stack up the result2.2.2;
+    Stack up the result2.2.2;
     allow = FALSE;
     DISCARD_TEXT(ident)
 
- +

§2.2.1. Decide whether symbol defined2.2.1 =

@@ -223,13 +223,13 @@ function togglePopup(material_id) { LOGIF(RESOLVING_CONDITIONAL_COMPILATION, "Must decide if %S defined: %s\n", symbol_name, (result)?"yes":"no"); if (Log::aspect_switched_on(RESOLVING_CONDITIONAL_COMPILATION_DA)) LOG_INDENT; - +

§2.4. Deal with an IFTRUE2.4 =

     TEMPORARY_TEXT(ident)
-    Extract rest of text into ident.1;
+    Extract rest of text into ident.1;
     int result = NOT_APPLICABLE;
     text_stream *cond = ident;
     match_results mr2 = Regexp::create_mr();
@@ -249,38 +249,38 @@ function togglePopup(material_id) {
         }
     }
     if (result == NOT_APPLICABLE) {
-        TemplateReader::error("conditional compilation is too difficult in the template: #iftrue on %S", cond);
+        TemplateReader::error("conditional compilation is too difficult in the template: #iftrue on %S", cond);
         result = FALSE;
     }
     LOGIF(RESOLVING_CONDITIONAL_COMPILATION, "Must decide if %S: ", cond);
     LOGIF(RESOLVING_CONDITIONAL_COMPILATION, "%s\n", (result)?"true":"false");
     if (Log::aspect_switched_on(RESOLVING_CONDITIONAL_COMPILATION_DA)) LOG_INDENT;
-    Stack up the result2.2.2;
+    Stack up the result2.2.2;
     allow = FALSE;
     DISCARD_TEXT(ident)
 
- +

§2.2.2. Stack up the result2.2.2 =

     if (state->cc_sp >= MAX_CC_STACK_SIZE) {
-        state->cc_sp = MAX_CC_STACK_SIZE; TemplateReader::error("conditional compilation is wrongly structured in the template: too many nested #ifdef or #iftrue", NULL);
+        state->cc_sp = MAX_CC_STACK_SIZE; TemplateReader::error("conditional compilation is wrongly structured in the template: too many nested #ifdef or #iftrue", NULL);
     } else {
         state->cc_stack[state->cc_sp++] = result;
     }
 
- +

§2.5. Deal with an IFNOT2.5 =

     LOGIF(RESOLVING_CONDITIONAL_COMPILATION, "ifnot\n");
-    if (state->cc_sp == 0) TemplateReader::error("conditional compilation is wrongly structured in the template: #ifnot at top level", NULL);
+    if (state->cc_sp == 0) TemplateReader::error("conditional compilation is wrongly structured in the template: #ifnot at top level", NULL);
     else state->cc_stack[state->cc_sp-1] = (state->cc_stack[state->cc_sp-1])?FALSE:TRUE;
     allow = FALSE;
 
- +

§2.6. Deal with an ENDIF2.6 =

@@ -288,12 +288,12 @@ function togglePopup(material_id) { if (Log::aspect_switched_on(RESOLVING_CONDITIONAL_COMPILATION_DA)) LOG_OUTDENT; LOGIF(RESOLVING_CONDITIONAL_COMPILATION, "endif\n"); state->cc_sp--; - if (state->cc_sp < 0) { state->cc_sp = 0; TemplateReader::error("conditional compilation is wrongly structured in the template: too many #endif", NULL); } + if (state->cc_sp < 0) { state->cc_sp = 0; TemplateReader::error("conditional compilation is wrongly structured in the template: too many #endif", NULL); } allow = FALSE; - +
diff --git a/docs/pipeline-module/2-res.html b/docs/pipeline-module/3-res.html similarity index 86% rename from docs/pipeline-module/2-res.html rename to docs/pipeline-module/3-res.html index 34b6df21d..65bcc677f 100644 --- a/docs/pipeline-module/2-res.html +++ b/docs/pipeline-module/3-res.html @@ -70,22 +70,22 @@ function togglePopup(material_id) {
+

To make sure certain symbol names translate into globally unique target symbols.

-
+

§1. Pipeline stage.

-void CodeGen::Externals::create_pipeline_stage(void) {
-    CodeGen::Stage::new(I"resolve-external-symbols", CodeGen::Externals::run_pipeline_stage, NO_STAGE_ARG, FALSE);
+void CodeGen::Externals::create_pipeline_stage(void) {
+    ParsingPipelines::new_stage(I"resolve-external-symbols", CodeGen::Externals::run_pipeline_stage, NO_STAGE_ARG, FALSE);
 }
 
 int CodeGen::Externals::run_pipeline_stage(pipeline_step *step) {
-    Inter::Connectors::stecker(step->repository);
+    Inter::Connectors::stecker(step->ephemera.repository);
     int resolution_failed = FALSE;
-    InterTree::traverse(step->repository, CodeGen::Externals::visitor, &resolution_failed, NULL, PACKAGE_IST);
+    InterTree::traverse(step->ephemera.repository, CodeGen::Externals::visitor, &resolution_failed, NULL, PACKAGE_IST);
     if (resolution_failed) internal_error("undefined external link(s)");
     return TRUE;
 }
@@ -132,7 +132,7 @@ function togglePopup(material_id) {
 }
 
diff --git a/docs/pipeline-module/2-rv.html b/docs/pipeline-module/3-rv.html similarity index 86% rename from docs/pipeline-module/2-rv.html rename to docs/pipeline-module/3-rv.html index 428bdf85d..216dc54a6 100644 --- a/docs/pipeline-module/2-rv.html +++ b/docs/pipeline-module/3-rv.html @@ -70,30 +70,30 @@ function togglePopup(material_id) {
+

To reconcile clashes between assimilated and originally generated verbs.

-
+

§1. Pipeline stage.

-void CodeGen::ReconcileVerbs::create_pipeline_stage(void) {
-    CodeGen::Stage::new(I"reconcile-verbs", CodeGen::ReconcileVerbs::run_pipeline_stage, NO_STAGE_ARG, FALSE);
+void CodeGen::ReconcileVerbs::create_pipeline_stage(void) {
+    ParsingPipelines::new_stage(I"reconcile-verbs", CodeGen::ReconcileVerbs::run_pipeline_stage, NO_STAGE_ARG, FALSE);
 }
 
 int CodeGen::ReconcileVerbs::run_pipeline_stage(pipeline_step *step) {
-    CodeGen::ReconcileVerbs::reconcile(step->repository);
+    CodeGen::ReconcileVerbs::reconcile(step->ephemera.repository);
     return TRUE;
 }
 

§2. Parsing.

-void CodeGen::ReconcileVerbs::reconcile(inter_tree *I) {
+void CodeGen::ReconcileVerbs::reconcile(inter_tree *I) {
     dictionary *observed_verbs = Dictionaries::new(1024, TRUE);
-    InterTree::traverse(I, CodeGen::ReconcileVerbs::visitor1, observed_verbs, NULL, 0);
-    InterTree::traverse(I, CodeGen::ReconcileVerbs::visitor2, observed_verbs, NULL, 0);
+    InterTree::traverse(I, CodeGen::ReconcileVerbs::visitor1, observed_verbs, NULL, 0);
+    InterTree::traverse(I, CodeGen::ReconcileVerbs::visitor2, observed_verbs, NULL, 0);
 }
 
 void CodeGen::ReconcileVerbs::visitor1(inter_tree *I, inter_tree_node *P, void *v_state) {
@@ -102,7 +102,7 @@ function togglePopup(material_id) {
         inter_symbol *con_name = InterSymbolsTables::symbol_from_frame_data(P, DEFN_CONST_IFLD);
         if ((Inter::Symbols::read_annotation(con_name, VERBARRAY_IANN) == 1) &&
             (Inter::Symbols::read_annotation(con_name, METAVERB_IANN) != 1))
-            Attend to the verb2.1;
+            Attend to the verb2.1;
     }
 }
 
@@ -113,7 +113,7 @@ function togglePopup(material_id) {
         inter_symbol *con_name = InterSymbolsTables::symbol_from_frame_data(P, DEFN_CONST_IFLD);
         if ((Inter::Symbols::read_annotation(con_name, VERBARRAY_IANN) == 1) &&
             (Inter::Symbols::read_annotation(con_name, METAVERB_IANN) == 1))
-            Attend to the verb2.1;
+            Attend to the verb2.1;
     }
 }
 
@@ -136,9 +136,9 @@ function togglePopup(material_id) { } } - +
diff --git a/docs/pipeline-module/2-tr.html b/docs/pipeline-module/3-tr.html similarity index 95% rename from docs/pipeline-module/2-tr.html rename to docs/pipeline-module/3-tr.html index d3e54be0c..0d95d6371 100644 --- a/docs/pipeline-module/2-tr.html +++ b/docs/pipeline-module/3-tr.html @@ -84,10 +84,10 @@ function togglePopup(material_id) {
+

Inform 6 meta-language is the language used by template files (with extension |.i6t|); we need tp be able to read it here in order to assimilate template code.

-
+

§1. Interventions. The user (or an extension used by the user) is allowed to register gobbets of I6T code to be used before, instead of, or after any whole segment or @@ -114,7 +114,7 @@ such a request.

§2.

-void TemplateReader::new_intervention(int stage, text_stream *segment,
+void TemplateReader::new_intervention(int stage, text_stream *segment,
     text_stream *part, text_stream *i6, text_stream *seg, void *ref) {
     I6T_intervention *i6ti = NULL;
     if (stage == INSTEAD_LINK_STAGE) {
@@ -143,7 +143,7 @@ stages — before and after — they are accumulated.
 

-int TemplateReader::I6T_file_intervene(OUTPUT_STREAM, int stage, text_stream *segment, text_stream *part, I6T_kit *kit) {
+int TemplateReader::I6T_file_intervene(OUTPUT_STREAM, int stage, text_stream *segment, text_stream *part, I6T_kit *kit) {
     I6T_intervention *i6ti;
     int rv = FALSE;
     if (Str::eq_wide_string(segment, L"Main.i6t")) return rv;
@@ -160,10 +160,10 @@ stages — before and after — they are accumulated.
             #endif
             LOGIF(TEMPLATE_READING, "Intervention at stage %d Segment %S Part %S\n", stage, segment, part);
             if (i6ti->I6T_matter) {
-                TemplateReader::interpret(OUT, i6ti->I6T_matter, NULL, -1, kit, NULL);
+                TemplateReader::interpret(OUT, i6ti->I6T_matter, NULL, -1, kit, NULL);
             }
             if (Str::len(i6ti->alternative_segment) > 0)
-                TemplateReader::interpret(OUT, NULL, i6ti->alternative_segment, -1, kit, NULL);
+                TemplateReader::interpret(OUT, NULL, i6ti->alternative_segment, -1, kit, NULL);
             if (stage == 0) rv = TRUE;
         }
     return rv;
@@ -193,7 +193,7 @@ or part — which would otherwise be an error very difficult to detect.
                 "available at the Inform website, may help.)");
             #endif
             #ifndef PROBLEMS_MODULE
-            TemplateReader::error("was asked to intervene on this segment, but never saw it: '%S'", i6ti->segment_name);
+            TemplateReader::error("was asked to intervene on this segment, but never saw it: '%S'", i6ti->segment_name);
             #endif
         } else if ((i6ti->part_found == FALSE) && (i6ti->part_name) &&
             (Str::eq_wide_string(i6ti->segment_name, L"Main.i6t") == FALSE)) {
@@ -212,7 +212,7 @@ or part — which would otherwise be an error very difficult to detect.
                 "the Inform website, may help.)");
             #endif
             #ifndef PROBLEMS_MODULE
-            TemplateReader::error("was asked to intervene on this part, but never saw it: '%S'", i6ti->part_name);
+            TemplateReader::error("was asked to intervene on this part, but never saw it: '%S'", i6ti->part_name);
             #endif
         }
     }
@@ -234,11 +234,11 @@ varying dispositions can do different things with the code parsed.
     void *I6T_state;
 } I6T_kit;
 
-
  • The structure I6T_kit is accessed in 2/mt and here.
+
  • The structure I6T_kit is accessed in 3/mt and here.

§7.

-I6T_kit TemplateReader::kit_out(inter_bookmark *IBM, void (*A)(struct text_stream *, struct I6T_kit *),
+I6T_kit TemplateReader::kit_out(inter_bookmark *IBM, void (*A)(struct text_stream *, struct I6T_kit *),
     void (*B)(struct text_stream *, struct text_stream *, struct text_stream *, struct I6T_kit *),
     void *C) {
     I6T_kit kit;
@@ -298,9 +298,9 @@ and therefore no interventions will have happened.)
 

-void TemplateReader::extract(text_stream *template_file, I6T_kit *kit) {
+void TemplateReader::extract(text_stream *template_file, I6T_kit *kit) {
     text_stream *SP = Str::new();
-    TemplateReader::interpret(SP, NULL, template_file, -1, kit, NULL);
+    TemplateReader::interpret(SP, NULL, template_file, -1, kit, NULL);
     (*(kit->raw_callback))(SP, kit);
 }
 
@@ -309,7 +309,7 @@ and therefore no interventions will have happened.)
     int active;
 } contents_section_state;
 
-void TemplateReader::interpret(OUTPUT_STREAM, text_stream *sf,
+void TemplateReader::interpret(OUTPUT_STREAM, text_stream *sf,
     text_stream *segment_name, int N_escape, I6T_kit *kit, filename *Input_Filename) {
     if (Str::eq(segment_name, I"all")) {
         for (int area=0; area<kit->no_i6t_file_areas; area++) {
@@ -320,7 +320,7 @@ and therefore no interventions will have happened.)
                 section_md *Sm;
                 LOOP_OVER_LINKED_LIST(Sm, section_md, Cm->sections_md) {
                     filename *SF = Sm->source_file_for_section;
-                    TemplateReader::interpret(OUT, sf, Sm->sect_title, N_escape, kit, SF);
+                    TemplateReader::interpret(OUT, sf, Sm->sect_title, N_escape, kit, SF);
                 }
             }
         }
@@ -331,27 +331,27 @@ and therefore no interventions will have happened.)
     int col = 1, cr, sfp = 0;
 
     if (Str::len(segment_name) > 0)
-        TemplateReader::I6T_file_intervene(OUT, BEFORE_LINK_STAGE, segment_name, NULL, kit);
+        TemplateReader::I6T_file_intervene(OUT, BEFORE_LINK_STAGE, segment_name, NULL, kit);
     if ((Str::len(segment_name) > 0) &&
-        (TemplateReader::I6T_file_intervene(OUT, INSTEAD_LINK_STAGE, segment_name, NULL, kit)))
+        (TemplateReader::I6T_file_intervene(OUT, INSTEAD_LINK_STAGE, segment_name, NULL, kit)))
         goto OmitFile;
 
     FILE *Input_File = NULL;
     if ((Str::len(segment_name) > 0) || (Input_Filename)) {
-        Open the I6 template file10.1;
+        Open the I6 template file10.1;
         comment = TRUE;
     } else comment = FALSE;
 
-    Interpret the I6T file10.2;
+    Interpret the I6T file10.2;
 
     if (Input_File) { if (DL) STREAM_FLUSH(DL); fclose(Input_File); }
 
     if ((Str::len(heading_name) > 0) && (Str::len(segment_name) > 0))
-        TemplateReader::I6T_file_intervene(OUT, AFTER_LINK_STAGE, segment_name, heading_name, kit);
+        TemplateReader::I6T_file_intervene(OUT, AFTER_LINK_STAGE, segment_name, heading_name, kit);
 
     OmitFile:
     if (Str::len(segment_name) > 0)
-        TemplateReader::I6T_file_intervene(OUT, AFTER_LINK_STAGE, segment_name, NULL, kit);
+        TemplateReader::I6T_file_intervene(OUT, AFTER_LINK_STAGE, segment_name, NULL, kit);
     DISCARD_TEXT(heading_name)
 }
 
@@ -371,9 +371,9 @@ part of the I6T kit. Input_File = Filenames::fopen( Filenames::in(kit->i6t_files[area], segment_name), "r"); if (Input_File == NULL) - TemplateReader::error("unable to open the template segment '%S'", segment_name); + TemplateReader::error("unable to open the template segment '%S'", segment_name);
-
  • This code is used in §10.
+
  • This code is used in §10.

§10.2. Interpret the I6T file10.2 =

@@ -383,21 +383,21 @@ part of the I6T kit. do { Str::clear(command); Str::clear(argument); - Read next character from I6T stream10.2.1; + Read next character from I6T stream10.2.1; NewCharacter: if (cr == EOF) break; if (((cr == '@') || (cr == '=')) && (col == 1)) { int inweb_syntax = -1; - if (cr == '=') Read the rest of line as an equals-heading10.2.3 - else Read the rest of line as an at-heading10.2.2; - Act on the heading, going in or out of comment mode as appropriate10.2.4; + if (cr == '=') Read the rest of line as an equals-heading10.2.3 + else Read the rest of line as an at-heading10.2.2; + Act on the heading, going in or out of comment mode as appropriate10.2.4; continue; } - if (comment == FALSE) Deal with material which isn't commentary10.2.5; + if (comment == FALSE) Deal with material which isn't commentary10.2.5; } while (cr != EOF); DISCARD_TEXT(command) DISCARD_TEXT(argument)
- +

§10.2.1. I6 template files are encoded as ISO Latin-1, not as Unicode UTF-8, so ordinary fgetc is used, and no BOM marker is parsed. Lines are assumed to be terminated with either 0x0a or 0x0d. (Since blank lines are @@ -416,7 +416,7 @@ terminated 0x0a } else cr = EOF; col++; if ((cr == 10) || (cr == 13)) col = 0; -

+

§10.2.2. Anything following an at-character in the first column is looked at to see if it's a heading, that is, an Inweb syntax. We recognise both @h and @p as heading markers, in order to accommodate both old and new Inweb syntaxes. @@ -437,7 +437,7 @@ heading markers, in order to accommodate both old and new Inweb syntaxes. TEMPORARY_TEXT(I6T_buffer) int i = 0, committed = FALSE, unacceptable_character = FALSE; while (i<MAX_I6T_LINE_LENGTH) { - Read next character from I6T stream10.2.1; + Read next character from I6T stream10.2.1; if ((committed == FALSE) && ((cr == 10) || (cr == 13) || (cr == ' '))) { if (Str::eq_wide_string(I6T_buffer, L"p")) inweb_syntax = INWEB_PARAGRAPH_SYNTAX; @@ -470,7 +470,7 @@ heading markers, in order to accommodate both old and new Inweb syntaxes. "the opcode(s) to keep them clear of the left margin.)"); #endif #ifndef PROBLEMS_MODULE - TemplateReader::error( + TemplateReader::error( "unknown '@...' marker at column 0 in template matter: '%S'", I6T_buffer); #endif } @@ -486,7 +486,7 @@ heading markers, in order to accommodate both old and new Inweb syntaxes. Str::copy(command, I6T_buffer); DISCARD_TEXT(I6T_buffer) -

+

§10.2.3. Read the rest of line as an equals-heading10.2.3 =

@@ -494,7 +494,7 @@ heading markers, in order to accommodate both old and new Inweb syntaxes. TEMPORARY_TEXT(I6T_buffer) int i = 0; while (i<MAX_I6T_LINE_LENGTH) { - Read next character from I6T stream10.2.1; + Read next character from I6T stream10.2.1; if ((cr == 10) || (cr == 13)) break; PUT_TO(I6T_buffer, cr); } @@ -511,7 +511,7 @@ heading markers, in order to accommodate both old and new Inweb syntaxes. "raw Inform 6 template material, of a kind not allowed."); #endif #ifndef PROBLEMS_MODULE - TemplateReader::error( + TemplateReader::error( "unsupported '= (...)' marker at column 0 in template matter", NULL); #endif } else { @@ -519,7 +519,7 @@ heading markers, in order to accommodate both old and new Inweb syntaxes. } Regexp::dispose_of(&mr); - +

§10.2.4. As can be seen, only a small minority of Inweb syntaxes are allowed: in particular, no definitions or angle-bracketed macros. This reader is not a full-fledged tangler. @@ -532,7 +532,7 @@ in particular, no definitions switch (inweb_syntax) { case INWEB_PARAGRAPH_SYNTAX: { if ((Str::len(heading_name) > 0) && (Str::len(segment_name) > 0)) - TemplateReader::I6T_file_intervene(OUT, + TemplateReader::I6T_file_intervene(OUT, AFTER_LINK_STAGE, segment_name, heading_name, kit); Str::copy_tail(heading_name, command, 2); int c; @@ -540,13 +540,13 @@ in particular, no definitions ((c == ' ') || (c == '\t') || (c == '.'))) Str::delete_last_character(heading_name); if (Str::len(heading_name) == 0) - TemplateReader::error("Empty heading name in I6 template file", NULL); + TemplateReader::error("Empty heading name in I6 template file", NULL); extract = FALSE; comment = TRUE; skip_part = FALSE; if (Str::len(segment_name) > 0) { - TemplateReader::I6T_file_intervene(OUT, + TemplateReader::I6T_file_intervene(OUT, BEFORE_LINK_STAGE, segment_name, heading_name, kit); - if (TemplateReader::I6T_file_intervene(OUT, + if (TemplateReader::I6T_file_intervene(OUT, INSTEAD_LINK_STAGE, segment_name, heading_name, kit)) skip_part = TRUE; } break; @@ -570,20 +570,20 @@ in particular, no definitions case INWEB_FIGURE_SYNTAX: break; } -

+

§10.2.5. Deal with material which isn't commentary10.2.5 =

     if (cr == '{') {
-        Read next character from I6T stream10.2.1;
+        Read next character from I6T stream10.2.1;
         if (cr == '-') {
-            Read up to the next close brace as an I6T command and argument10.2.5.1;
+            Read up to the next close brace as an I6T command and argument10.2.5.1;
             if (Str::get_first_char(command) == '!') continue;
-            Act on I6T command and argument10.2.5.3;
+            Act on I6T command and argument10.2.5.3;
             continue;
         } else if ((cr == 'N') && (N_escape >= 0)) {
-            Read next character from I6T stream10.2.1;
+            Read next character from I6T stream10.2.1;
             if (cr == '}') {
                 WRITE("%d", N_escape);
                 continue;
@@ -596,9 +596,9 @@ in particular, no definitions
         }
     }
     if (cr == '(') {
-        Read next character from I6T stream10.2.1;
+        Read next character from I6T stream10.2.1;
         if (cr == '+') {
-            Read up to the next plus close-bracket as an I7 expression10.2.5.2;
+            Read up to the next plus close-bracket as an I7 expression10.2.5.2;
             continue;
         } else {  otherwise the open bracket was a literal
             PUT_TO(OUT, '(');
@@ -607,7 +607,7 @@ in particular, no definitions
     }
     PUT_TO(OUT, cr);
 
- +

§10.2.5.1. And here we read a normal command. The command name must not include } or :. If there is no : then the argument is left unset (so that it will be the empty string: see above). The argument must not include }. @@ -621,14 +621,14 @@ be the empty string: see above). The argument must not include Str::clear(argument); int com_mode = TRUE; while (TRUE) { - Read next character from I6T stream10.2.1; + Read next character from I6T stream10.2.1; if ((cr == '}') || (cr == EOF)) break; if ((cr == ':') && (com_mode)) { com_mode = FALSE; continue; } if (com_mode) PUT_TO(command, cr); else PUT_TO(argument, cr); } -

+

§10.2.5.2. And similarly, for the (+ ... +) notation used to mark I7 material within I6:

@@ -639,7 +639,7 @@ within I6:
     TEMPORARY_TEXT(i7_exp)
     while (TRUE) {
-        Read next character from I6T stream10.2.1;
+        Read next character from I6T stream10.2.1;
         if (cr == EOF) break;
         if ((cr == ')') && (Str::get_last_char(i7_exp) == '+')) {
             Str::delete_last_character(i7_exp); break; }
@@ -647,17 +647,17 @@ within I6:
     }
     LOG("SPONG: %S\n", i7_exp);
     DISCARD_TEXT(i7_exp)
-        TemplateReader::error("use of (+ ... +) in the template has been withdrawn: '%S'", i7_exp);
+        TemplateReader::error("use of (+ ... +) in the template has been withdrawn: '%S'", i7_exp);
 
- +

§10.2.5.3. Acting on I6T commands. Act on I6T command and argument10.2.5.3 =

-    Act on the I6T segment command10.2.5.3.1;
+    Act on the I6T segment command10.2.5.3.1;
     (*(kit->command_callback))(OUT, command, argument, kit);
 
- +

§10.2.5.3.1. The {-segment:...} command recursively calls the I6T interpreter on the supplied I6T filename, which means it acts rather like #include in C. Note that because we pass the current output file handle of through to @@ -673,13 +673,13 @@ safely between {-open-index}< if (Str::eq_wide_string(command, L"segment")) { (*(kit->raw_callback))(OUT, kit); Str::clear(OUT); - TemplateReader::interpret(OUT, NULL, argument, -1, kit, NULL); + TemplateReader::interpret(OUT, NULL, argument, -1, kit, NULL); (*(kit->raw_callback))(OUT, kit); Str::clear(OUT); continue; } -

+

§11. Contents section.

@@ -702,7 +702,7 @@ using template-hacking there are a handful of cases that can't be avoided, so...
 

-void TemplateReader::error(char *message, text_stream *quote) {
+void TemplateReader::error(char *message, text_stream *quote) {
     #ifdef PROBLEMS_MODULE
     TEMPORARY_TEXT(M)
     WRITE_TO(M, message, quote);
@@ -724,7 +724,7 @@ using template-hacking there are a handful of cases that can't be avoided, so...
 }
 
diff --git a/docs/pipeline-module/2-unq.html b/docs/pipeline-module/3-unq.html similarity index 84% rename from docs/pipeline-module/2-unq.html rename to docs/pipeline-module/3-unq.html index 04791fddd..c4ba7f07c 100644 --- a/docs/pipeline-module/2-unq.html +++ b/docs/pipeline-module/3-unq.html @@ -70,21 +70,21 @@ function togglePopup(material_id) {
+

To make sure certain symbol names translate into globally unique target symbols.

-
+

§1. Pipeline stage.

-void CodeGen::Uniqueness::create_pipeline_stage(void) {
-    CodeGen::Stage::new(I"make-identifiers-unique", CodeGen::Uniqueness::run_pipeline_stage, NO_STAGE_ARG, FALSE);
+void CodeGen::Uniqueness::create_pipeline_stage(void) {
+    ParsingPipelines::new_stage(I"make-identifiers-unique", CodeGen::Uniqueness::run_pipeline_stage, NO_STAGE_ARG, FALSE);
 }
 
 int CodeGen::Uniqueness::run_pipeline_stage(pipeline_step *step) {
     dictionary *D = Dictionaries::new(INITIAL_INTER_SYMBOLS_ID_RANGE, FALSE);
-    InterTree::traverse(step->repository, CodeGen::Uniqueness::visitor, D, NULL, 0);
+    InterTree::traverse(step->ephemera.repository, CodeGen::Uniqueness::visitor, D, NULL, 0);
     return TRUE;
 }
 
@@ -124,7 +124,7 @@ function togglePopup(material_id) {
 
diff --git a/docs/pipeline-module/3-act.html b/docs/pipeline-module/4-act.html similarity index 88% rename from docs/pipeline-module/3-act.html rename to docs/pipeline-module/4-act.html index c024c8639..f9d4510ca 100644 --- a/docs/pipeline-module/3-act.html +++ b/docs/pipeline-module/4-act.html @@ -70,34 +70,34 @@ function togglePopup(material_id) {
+

To compile the main/synoptic/activities submodule.

§1. Before this runs, activity packages are scattered all over the Inter tree. We must allocate each one a unique ID.

-

As this is called, Synoptic Utilities has already formed a list activity_nodes +

As this is called, Synoptic Utilities has already formed a list activity_nodes of packages of type _activity.

-void SynopticActivities::compile(inter_tree *I, tree_inventory *inv) {
+void SynopticActivities::compile(inter_tree *I, tree_inventory *inv) {
     if (TreeLists::len(inv->activity_nodes) > 0) {
-        TreeLists::sort(inv->activity_nodes, Synoptic::module_order);
+        TreeLists::sort(inv->activity_nodes, Synoptic::module_order);
         for (int i=0; i<TreeLists::len(inv->activity_nodes); i++) {
             inter_package *pack = Inter::Package::defined_by_frame(inv->activity_nodes->list[i].node);
-            inter_tree_node *D = Synoptic::get_definition(pack, I"activity_id");
+            inter_tree_node *D = Synoptic::get_definition(pack, I"activity_id");
             D->W.data[DATA_CONST_IFLD+1] = (inter_ti) i;
-            D = Synoptic::get_optional_definition(pack, I"var_id");
+            D = Synoptic::get_optional_definition(pack, I"var_id");
             if (D) D->W.data[DATA_CONST_IFLD+1] = (inter_ti) (10000 + i);
         }
     }
-    Define ACTIVITY_AFTER_RULEBOOKS array1.1;
-    Define ACTIVITY_ATB_RULEBOOKS array1.2;
-    Define ACTIVITY_BEFORE_RULEBOOKS array1.3;
-    Define ACTIVITY_FOR_RULEBOOKS array1.4;
-    Define ACTIVITY_VAR_CREATORS array1.5;
+    Define ACTIVITY_AFTER_RULEBOOKS array1.1;
+    Define ACTIVITY_ATB_RULEBOOKS array1.2;
+    Define ACTIVITY_BEFORE_RULEBOOKS array1.3;
+    Define ACTIVITY_FOR_RULEBOOKS array1.4;
+    Define ACTIVITY_VAR_CREATORS array1.5;
 }
 

§1.1. Define ACTIVITY_AFTER_RULEBOOKS array1.1 = @@ -105,75 +105,75 @@ of packages of type _activity

     inter_name *iname = HierarchyLocations::find(I, ACTIVITY_AFTER_RULEBOOKS_HL);
-    Synoptic::begin_array(I, iname);
+    Synoptic::begin_array(I, iname);
     for (int i=0; i<TreeLists::len(inv->activity_nodes); i++) {
         inter_package *pack = Inter::Package::defined_by_frame(inv->activity_nodes->list[i].node);
         inter_symbol *vc_s = Metadata::read_symbol(pack, I"^after_rulebook");
-        Synoptic::symbol_entry(vc_s);
+        Synoptic::symbol_entry(vc_s);
     }
-    Synoptic::end_array(I);
+    Synoptic::end_array(I);
 
- +

§1.2. Define ACTIVITY_ATB_RULEBOOKS array1.2 =

     inter_name *iname = HierarchyLocations::find(I, ACTIVITY_ATB_RULEBOOKS_HL);
     Produce::annotate_iname_i(iname, BYTEARRAY_IANN, 1);
-    Synoptic::begin_array(I, iname);
+    Synoptic::begin_array(I, iname);
     for (int i=0; i<TreeLists::len(inv->activity_nodes); i++) {
         inter_package *pack = Inter::Package::defined_by_frame(inv->activity_nodes->list[i].node);
         inter_ti ubf = Metadata::read_numeric(pack, I"^used_by_future");
-        Synoptic::numeric_entry(ubf);
+        Synoptic::numeric_entry(ubf);
     }
-    Synoptic::end_array(I);
+    Synoptic::end_array(I);
 
- +

§1.3. Define ACTIVITY_BEFORE_RULEBOOKS array1.3 =

     inter_name *iname = HierarchyLocations::find(I, ACTIVITY_BEFORE_RULEBOOKS_HL);
-    Synoptic::begin_array(I, iname);
+    Synoptic::begin_array(I, iname);
     for (int i=0; i<TreeLists::len(inv->activity_nodes); i++) {
         inter_package *pack = Inter::Package::defined_by_frame(inv->activity_nodes->list[i].node);
         inter_symbol *vc_s = Metadata::read_symbol(pack, I"^before_rulebook");
-        Synoptic::symbol_entry(vc_s);
+        Synoptic::symbol_entry(vc_s);
     }
-    Synoptic::end_array(I);
+    Synoptic::end_array(I);
 
- +

§1.4. Define ACTIVITY_FOR_RULEBOOKS array1.4 =

     inter_name *iname = HierarchyLocations::find(I, ACTIVITY_FOR_RULEBOOKS_HL);
-    Synoptic::begin_array(I, iname);
+    Synoptic::begin_array(I, iname);
     for (int i=0; i<TreeLists::len(inv->activity_nodes); i++) {
         inter_package *pack = Inter::Package::defined_by_frame(inv->activity_nodes->list[i].node);
         inter_symbol *vc_s = Metadata::read_symbol(pack, I"^for_rulebook");
-        Synoptic::symbol_entry(vc_s);
+        Synoptic::symbol_entry(vc_s);
     }
-    Synoptic::end_array(I);
+    Synoptic::end_array(I);
 
- +

§1.5. Define ACTIVITY_VAR_CREATORS array1.5 =

     inter_name *iname = HierarchyLocations::find(I, ACTIVITY_VAR_CREATORS_HL);
-    Synoptic::begin_array(I, iname);
+    Synoptic::begin_array(I, iname);
     for (int i=0; i<TreeLists::len(inv->activity_nodes); i++) {
         inter_package *pack = Inter::Package::defined_by_frame(inv->activity_nodes->list[i].node);
         inter_symbol *vc_s = Metadata::read_optional_symbol(pack, I"^var_creator");
-        if (vc_s) Synoptic::symbol_entry(vc_s);
-        else Synoptic::numeric_entry(0);
+        if (vc_s) Synoptic::symbol_entry(vc_s);
+        else Synoptic::numeric_entry(0);
     }
-    Synoptic::end_array(I);
+    Synoptic::end_array(I);
 
- +
diff --git a/docs/pipeline-module/3-act2.html b/docs/pipeline-module/4-act2.html similarity index 91% rename from docs/pipeline-module/3-act2.html rename to docs/pipeline-module/4-act2.html index a0d00ed85..0b1b51f77 100644 --- a/docs/pipeline-module/3-act2.html +++ b/docs/pipeline-module/4-act2.html @@ -70,14 +70,14 @@ function togglePopup(material_id) {
+

To compile the main/synoptic/actions submodule.

§1. Before this runs, action packages are scattered all over the Inter tree. We must allocate each one a unique ID.

-

As this is called, Synoptic Utilities has already formed a list action_nodes +

As this is called, Synoptic Utilities has already formed a list action_nodes of packages of type _action.

@@ -90,25 +90,25 @@ of packages of type _actiondefine REQUIRES_POSSESSION 4 actor must be carrying this object
-void SynopticActions::compile(inter_tree *I, tree_inventory *inv) {
+void SynopticActions::compile(inter_tree *I, tree_inventory *inv) {
     if (TreeLists::len(inv->action_nodes) > 0) {
-        TreeLists::sort(inv->action_nodes, Synoptic::module_order);
+        TreeLists::sort(inv->action_nodes, Synoptic::module_order);
         for (int i=0; i<TreeLists::len(inv->action_nodes); i++) {
             inter_package *pack = Inter::Package::defined_by_frame(inv->action_nodes->list[i].node);
-            inter_tree_node *D = Synoptic::get_definition(pack, I"action_id");
+            inter_tree_node *D = Synoptic::get_definition(pack, I"action_id");
             D->W.data[DATA_CONST_IFLD+1] = (inter_ti) i;
-            D = Synoptic::get_optional_definition(pack, I"var_id");
+            D = Synoptic::get_optional_definition(pack, I"var_id");
             if (D) D->W.data[DATA_CONST_IFLD+1] = (inter_ti) (20000 + i);
         }
     }
-    Define CCOUNT_ACTION_NAME2.1;
-    Define AD_RECORDS2.2;
+    Define CCOUNT_ACTION_NAME2.1;
+    Define AD_RECORDS2.2;
     if (TreeLists::len(inv->action_nodes) > 0) {
-        Define ACTIONHAPPENED array2.3;
-        Define ACTIONCODING array2.4;
-        Define ACTIONDATA array2.5;
+        Define ACTIONHAPPENED array2.3;
+        Define ACTIONCODING array2.4;
+        Define ACTIONDATA array2.5;
     }
-    Define DB_ACTION_DETAILS function2.6;
+    Define DB_ACTION_DETAILS function2.6;
 }
 

§2.1. Define CCOUNT_ACTION_NAME2.1 = @@ -118,7 +118,7 @@ of packages of type _action inter_name *iname = HierarchyLocations::find(I, CCOUNT_ACTION_NAME_HL); Produce::numeric_constant(I, iname, K_value, (inter_ti) TreeLists::len(inv->action_nodes)); -

  • This code is used in §2.
+
  • This code is used in §2.

§2.2. Define AD_RECORDS2.2 =

@@ -126,54 +126,54 @@ of packages of type _action inter_name *iname = HierarchyLocations::find(I, AD_RECORDS_HL); Produce::numeric_constant(I, iname, K_value, (inter_ti) TreeLists::len(inv->action_nodes)); -
  • This code is used in §2.
+
  • This code is used in §2.

§2.3. Define ACTIONHAPPENED array2.3 =

     inter_name *iname = HierarchyLocations::find(I, ACTIONHAPPENED_HL);
-    Synoptic::begin_array(I, iname);
+    Synoptic::begin_array(I, iname);
     for (int i=0; i<=(TreeLists::len(inv->action_nodes)/16); i++)
-        Synoptic::numeric_entry(0);
-    Synoptic::numeric_entry(0);
-    Synoptic::end_array(I);
+        Synoptic::numeric_entry(0);
+    Synoptic::numeric_entry(0);
+    Synoptic::end_array(I);
 
-
  • This code is used in §2.
+
  • This code is used in §2.

§2.4. Define ACTIONCODING array2.4 =

     inter_name *iname = HierarchyLocations::find(I, ACTIONCODING_HL);
-    Synoptic::begin_array(I, iname);
+    Synoptic::begin_array(I, iname);
     for (int i=0; i<TreeLists::len(inv->action_nodes); i++) {
         inter_package *pack = Inter::Package::defined_by_frame(inv->action_nodes->list[i].node);
         inter_symbol *double_sharp_s = Metadata::read_optional_symbol(pack, I"^double_sharp");
         inter_ti no = Metadata::read_optional_numeric(pack, I"^no_coding");
-        if ((no) || (double_sharp_s == NULL)) Synoptic::numeric_entry(0);
-        else Synoptic::symbol_entry(double_sharp_s);
+        if ((no) || (double_sharp_s == NULL)) Synoptic::numeric_entry(0);
+        else Synoptic::symbol_entry(double_sharp_s);
     }
-    Synoptic::numeric_entry(0);
-    Synoptic::end_array(I);
+    Synoptic::numeric_entry(0);
+    Synoptic::end_array(I);
 
-
  • This code is used in §2.
+
  • This code is used in §2.

§2.5. Define ACTIONDATA array2.5 =

     inter_name *iname = HierarchyLocations::find(I, ACTIONDATA_HL);
     Produce::annotate_iname_i(iname, TABLEARRAY_IANN, 1);
-    Synoptic::begin_array(I, iname);
+    Synoptic::begin_array(I, iname);
     for (int i=0; i<TreeLists::len(inv->action_nodes); i++) {
         inter_package *pack = Inter::Package::defined_by_frame(inv->action_nodes->list[i].node);
         inter_symbol *double_sharp_s = Metadata::read_optional_symbol(pack, I"^double_sharp");
         if (double_sharp_s == NULL) {
-            Synoptic::numeric_entry(0);
-            Synoptic::numeric_entry(0);
-            Synoptic::numeric_entry(0);
-            Synoptic::numeric_entry(0);
-            Synoptic::numeric_entry(0);
+            Synoptic::numeric_entry(0);
+            Synoptic::numeric_entry(0);
+            Synoptic::numeric_entry(0);
+            Synoptic::numeric_entry(0);
+            Synoptic::numeric_entry(0);
         } else {
-            Synoptic::symbol_entry(double_sharp_s);
+            Synoptic::symbol_entry(double_sharp_s);
             inter_ti out_of_world = Metadata::read_numeric(pack, I"^out_of_world");
             inter_ti requires_light = Metadata::read_numeric(pack, I"^requires_light");
             inter_ti can_have_noun = Metadata::read_numeric(pack, I"^can_have_noun");
@@ -192,29 +192,29 @@ of packages of type _action            if (can_have_second == 0) msp = 0;
             inter_ti bitmap = (inter_ti) (mn + ms*0x02 + ml*0x04 + mnp*0x08 +
                 msp*0x10 + (out_of_world?1:0)*0x20 + hn*0x40 + hs*0x80);
-            Synoptic::numeric_entry(bitmap);
-            Synoptic::symbol_entry(noun_kind);
-            Synoptic::symbol_entry(second_kind);
+            Synoptic::numeric_entry(bitmap);
+            Synoptic::symbol_entry(noun_kind);
+            Synoptic::symbol_entry(second_kind);
             inter_symbol *vc_s = Metadata::read_optional_symbol(pack, I"^var_creator");
-            if (vc_s) Synoptic::symbol_entry(vc_s);
-            else Synoptic::numeric_entry(0);
+            if (vc_s) Synoptic::symbol_entry(vc_s);
+            else Synoptic::numeric_entry(0);
         }
-        Synoptic::numeric_entry((inter_ti) (20000 + i));
+        Synoptic::numeric_entry((inter_ti) (20000 + i));
     }
-    Synoptic::numeric_entry(0);
-    Synoptic::end_array(I);
+    Synoptic::numeric_entry(0);
+    Synoptic::end_array(I);
 
-
  • This code is used in §2.
+
  • This code is used in §2.

§2.6. Define DB_ACTION_DETAILS function2.6 =

     inter_name *iname = HierarchyLocations::find(I, DB_ACTION_DETAILS_HL);
-    Synoptic::begin_function(I, iname);
-    inter_symbol *act_s = Synoptic::local(I, I"act", NULL);
-    inter_symbol *n_s = Synoptic::local(I, I"n", NULL);
-    inter_symbol *s_s = Synoptic::local(I, I"s", NULL);
-    inter_symbol *for_say_s = Synoptic::local(I, I"for_say", NULL);
+    Synoptic::begin_function(I, iname);
+    inter_symbol *act_s = Synoptic::local(I, I"act", NULL);
+    inter_symbol *n_s = Synoptic::local(I, I"n", NULL);
+    inter_symbol *s_s = Synoptic::local(I, I"s", NULL);
+    inter_symbol *for_say_s = Synoptic::local(I, I"for_say", NULL);
     Produce::inv_primitive(I, SWITCH_BIP);
     Produce::down(I);
         Produce::val_symbol(I, K_value, act_s);
@@ -244,11 +244,11 @@ of packages of type _action        Produce::up(I);
     Produce::up(I);
-    Synoptic::end_function(I, iname);
+    Synoptic::end_function(I, iname);
 
-
  • This code is used in §2.
+
  • This code is used in §2.
diff --git a/docs/pipeline-module/3-chr.html b/docs/pipeline-module/4-chr.html similarity index 96% rename from docs/pipeline-module/3-chr.html rename to docs/pipeline-module/4-chr.html index 5b0c67355..1ea625df4 100644 --- a/docs/pipeline-module/3-chr.html +++ b/docs/pipeline-module/4-chr.html @@ -70,7 +70,7 @@ function togglePopup(material_id) {
+

To compile the main/synoptic/chronology submodule.

§1. The purpose of all this is to keep track of the state of things so that it @@ -82,32 +82,32 @@ over the Inter tree. Each needs its own set of unique IDs.

-void SynopticChronology::compile(inter_tree *I, tree_inventory *inv) {
+void SynopticChronology::compile(inter_tree *I, tree_inventory *inv) {
     if (TreeLists::len(inv->action_history_condition_nodes) > 0) {
-        TreeLists::sort(inv->action_history_condition_nodes, Synoptic::module_order);
+        TreeLists::sort(inv->action_history_condition_nodes, Synoptic::module_order);
         for (int i=0; i<TreeLists::len(inv->action_history_condition_nodes); i++) {
             inter_package *pack = Inter::Package::defined_by_frame(inv->action_history_condition_nodes->list[i].node);
-            inter_tree_node *D = Synoptic::get_definition(pack, I"ahc_id");
+            inter_tree_node *D = Synoptic::get_definition(pack, I"ahc_id");
             D->W.data[DATA_CONST_IFLD+1] = (inter_ti) i;
         }
     }
     if (TreeLists::len(inv->past_tense_condition_nodes) > 0) {
-        TreeLists::sort(inv->past_tense_condition_nodes, Synoptic::module_order);
+        TreeLists::sort(inv->past_tense_condition_nodes, Synoptic::module_order);
         for (int i=0; i<TreeLists::len(inv->past_tense_condition_nodes); i++) {
             inter_package *pack = Inter::Package::defined_by_frame(inv->past_tense_condition_nodes->list[i].node);
-            inter_tree_node *D = Synoptic::get_definition(pack, I"ptc_id");
+            inter_tree_node *D = Synoptic::get_definition(pack, I"ptc_id");
             D->W.data[DATA_CONST_IFLD+1] = (inter_ti) i;
         }
     }
 
-    Define NO_PAST_TENSE_CONDS1.1;
-    Define NO_PAST_TENSE_ACTIONS1.2;
+    Define NO_PAST_TENSE_CONDS1.1;
+    Define NO_PAST_TENSE_ACTIONS1.2;
 
-    Define TIMEDEVENTSTABLE1.3;
-    Define TIMEDEVENTTIMESTABLE1.4;
+    Define TIMEDEVENTSTABLE1.3;
+    Define TIMEDEVENTTIMESTABLE1.4;
 
-    Define PASTACTIONSI6ROUTINES1.5;
-    Define TESTSINGLEPASTSTATE1.6;
+    Define PASTACTIONSI6ROUTINES1.5;
+    Define TESTSINGLEPASTSTATE1.6;
 }
 

§1.1. Define NO_PAST_TENSE_CONDS1.1 = @@ -117,7 +117,7 @@ over the Inter tree. Each needs its own set of unique IDs. inter_name *iname = HierarchyLocations::find(I, NO_PAST_TENSE_CONDS_HL); Produce::numeric_constant(I, iname, K_value, (inter_ti) TreeLists::len(inv->past_tense_condition_nodes)); -

+

§1.2. Define NO_PAST_TENSE_ACTIONS1.2 =

@@ -125,86 +125,86 @@ over the Inter tree. Each needs its own set of unique IDs. inter_name *iname = HierarchyLocations::find(I, NO_PAST_TENSE_ACTIONS_HL); Produce::numeric_constant(I, iname, K_value, (inter_ti) TreeLists::len(inv->action_history_condition_nodes)); - +

§1.3. Define TIMEDEVENTSTABLE1.3 =

     inter_name *iname = HierarchyLocations::find(I, TIMEDEVENTSTABLE_HL);
     Produce::annotate_iname_i(iname, TABLEARRAY_IANN, 1);
-    Synoptic::begin_array(I, iname);
+    Synoptic::begin_array(I, iname);
     int when_count = 0;
     for (int i=0; i<TreeLists::len(inv->rule_nodes); i++) {
         inter_package *pack = Inter::Package::defined_by_frame(inv->rule_nodes->list[i].node);
         if (Metadata::exists(pack, I"^timed")) {
             inter_symbol *rule_s = Metadata::read_symbol(pack, I"^value");
             if (Metadata::exists(pack, I"^timed_for")) {
-                Synoptic::symbol_entry(rule_s);
+                Synoptic::symbol_entry(rule_s);
             } else when_count++;
         }
     }
     for (int i=0; i<when_count+1; i++) {
-        Synoptic::numeric_entry(0);
-        Synoptic::numeric_entry(0);
+        Synoptic::numeric_entry(0);
+        Synoptic::numeric_entry(0);
     }
-    Synoptic::end_array(I);
+    Synoptic::end_array(I);
 
- +

§1.4. Define TIMEDEVENTTIMESTABLE1.4 =

     inter_name *iname = HierarchyLocations::find(I, TIMEDEVENTTIMESTABLE_HL);
     Produce::annotate_iname_i(iname, TABLEARRAY_IANN, 1);
-    Synoptic::begin_array(I, iname);
+    Synoptic::begin_array(I, iname);
     int when_count = 0;
     for (int i=0; i<TreeLists::len(inv->rule_nodes); i++) {
         inter_package *pack = Inter::Package::defined_by_frame(inv->rule_nodes->list[i].node);
         if (Metadata::exists(pack, I"^timed")) {
             if (Metadata::exists(pack, I"^timed_for")) {
                 inter_ti t = Metadata::read_optional_numeric(pack, I"^timed_for");
-                Synoptic::numeric_entry(t);
+                Synoptic::numeric_entry(t);
             } else when_count++;
         }
     }
     for (int i=0; i<when_count+1; i++) {
-        Synoptic::numeric_entry(0);
-        Synoptic::numeric_entry(0);
+        Synoptic::numeric_entry(0);
+        Synoptic::numeric_entry(0);
     }
-    Synoptic::end_array(I);
+    Synoptic::end_array(I);
 
- +

§1.5. Define PASTACTIONSI6ROUTINES1.5 =

     inter_name *iname = HierarchyLocations::find(I, PASTACTIONSI6ROUTINES_HL);
-    Synoptic::begin_array(I, iname);
+    Synoptic::begin_array(I, iname);
     for (int i=0; i<TreeLists::len(inv->action_history_condition_nodes); i++) {
         inter_package *pack = Inter::Package::defined_by_frame(inv->action_history_condition_nodes->list[i].node);
         inter_symbol *fn_s = Metadata::read_symbol(pack, I"^value");
         if (fn_s == NULL) internal_error("no pap_fn");
-        Synoptic::symbol_entry(fn_s);
+        Synoptic::symbol_entry(fn_s);
     }
-    Synoptic::numeric_entry(0);
-    Synoptic::numeric_entry(0);
-    Synoptic::end_array(I);
+    Synoptic::numeric_entry(0);
+    Synoptic::numeric_entry(0);
+    Synoptic::end_array(I);
 
- +

§1.6. Define TESTSINGLEPASTSTATE1.6 =

     inter_name *iname = HierarchyLocations::find(I, TESTSINGLEPASTSTATE_HL);
-    Synoptic::begin_function(I, iname);
-    inter_symbol *past_flag_s = Synoptic::local(I, I"past_flag", NULL);
-    inter_symbol *pt_s = Synoptic::local(I, I"pt", NULL);
-    inter_symbol *turn_end_s = Synoptic::local(I, I"turn_end", NULL);
-    inter_symbol *wanted_s = Synoptic::local(I, I"wanted", NULL);
-    inter_symbol *old_s = Synoptic::local(I, I"old", NULL);
-    inter_symbol *new_s = Synoptic::local(I, I"new", NULL);
-    inter_symbol *trips_s = Synoptic::local(I, I"trips", NULL);
-    inter_symbol *consecutives_s = Synoptic::local(I, I"consecutives", NULL);
+    Synoptic::begin_function(I, iname);
+    inter_symbol *past_flag_s = Synoptic::local(I, I"past_flag", NULL);
+    inter_symbol *pt_s = Synoptic::local(I, I"pt", NULL);
+    inter_symbol *turn_end_s = Synoptic::local(I, I"turn_end", NULL);
+    inter_symbol *wanted_s = Synoptic::local(I, I"wanted", NULL);
+    inter_symbol *old_s = Synoptic::local(I, I"old", NULL);
+    inter_symbol *new_s = Synoptic::local(I, I"new", NULL);
+    inter_symbol *trips_s = Synoptic::local(I, I"trips", NULL);
+    inter_symbol *consecutives_s = Synoptic::local(I, I"consecutives", NULL);
 
     if (TreeLists::len(inv->past_tense_condition_nodes) > 0) {
         inter_symbol *prcr_s = InterNames::to_symbol(HierarchyLocations::find(I, PRESENT_CHRONOLOGICAL_RECORD_HL));
@@ -215,23 +215,23 @@ over the Inter tree. Each needs its own set of unique IDs.
             Produce::val_symbol(I, K_value, past_flag_s);
             Produce::code(I);
             Produce::down(I);
-                Unpack the past1.6.1;
+                Unpack the past1.6.1;
             Produce::up(I);
             Produce::code(I);
             Produce::down(I);
-                Unpack the present1.6.2;
-                Swizzle1.6.4;
-                Repack the present1.6.3;
+                Unpack the present1.6.2;
+                Swizzle1.6.4;
+                Repack the present1.6.3;
             Produce::up(I);
         Produce::up(I);
-        Answer the question posed1.6.5;
+        Answer the question posed1.6.5;
     } else {
         Produce::rfalse(I);
     }
 
-    Synoptic::end_function(I, iname);
+    Synoptic::end_function(I, iname);
 
- +

§1.6.1. Unpack the past1.6.1 =

@@ -284,7 +284,7 @@ over the Inter tree. Each needs its own set of unique IDs. Produce::up(I); Produce::up(I); - +

§1.6.2. Unpack the present1.6.2 =

@@ -337,7 +337,7 @@ over the Inter tree. Each needs its own set of unique IDs. Produce::up(I); Produce::up(I); - +

§1.6.3. Repack the present1.6.3 =

@@ -371,7 +371,7 @@ over the Inter tree. Each needs its own set of unique IDs. Produce::up(I); Produce::up(I); - +

§1.6.4. Swizzle1.6.4 =

@@ -492,7 +492,7 @@ over the Inter tree. Each needs its own set of unique IDs. Produce::up(I); Produce::up(I); - +

§1.6.5. Answer the question posed1.6.5 =

@@ -601,9 +601,9 @@ over the Inter tree. Each needs its own set of unique IDs. Produce::val(I, K_value, LITERAL_IVAL, 0); Produce::up(I); - +
diff --git a/docs/pipeline-module/3-ext.html b/docs/pipeline-module/4-ext.html similarity index 90% rename from docs/pipeline-module/3-ext.html rename to docs/pipeline-module/4-ext.html index ef2703c3b..a372f420c 100644 --- a/docs/pipeline-module/3-ext.html +++ b/docs/pipeline-module/4-ext.html @@ -70,30 +70,30 @@ function togglePopup(material_id) {
+

To renumber the extensions and construct suitable functions and arrays.

§1. Before this runs, there are one or more modules in the Inter tree which contain the material compiled from extensions. We must allocate each one a unique ID.

-

As this is called, Synoptic Utilities has already formed a list extension_nodes +

As this is called, Synoptic Utilities has already formed a list extension_nodes of packages of type _module which derive from extensions.

-void SynopticExtensions::compile(inter_tree *I, tree_inventory *inv) {
+void SynopticExtensions::compile(inter_tree *I, tree_inventory *inv) {
     if (TreeLists::len(inv->extension_nodes) > 0) {
-        TreeLists::sort(inv->extension_nodes, Synoptic::category_order);
+        TreeLists::sort(inv->extension_nodes, Synoptic::category_order);
         for (int i=0; i<TreeLists::len(inv->extension_nodes); i++) {
             inter_package *pack = Inter::Package::defined_by_frame(inv->extension_nodes->list[i].node);
-            inter_tree_node *D = Synoptic::get_definition(pack, I"extension_id");
+            inter_tree_node *D = Synoptic::get_definition(pack, I"extension_id");
             D->W.data[DATA_CONST_IFLD+1] = (inter_ti) (i + 1);
         }
     }
-    Define SHOWEXTENSIONVERSIONS function1.1;
-    Define SHOWFULLEXTENSIONVERSIONS function1.2;
-    Define SHOWONEEXTENSION function1.3;
+    Define SHOWEXTENSIONVERSIONS function1.1;
+    Define SHOWFULLEXTENSIONVERSIONS function1.2;
+    Define SHOWONEEXTENSION function1.3;
 }
 

§1.1. Extensions have an obvious effect at runtime — they include extra material. @@ -124,7 +124,7 @@ would violate the CC license.

     inter_name *iname = HierarchyLocations::find(I, SHOWEXTENSIONVERSIONS_HL);
-    Synoptic::begin_function(I, iname);
+    Synoptic::begin_function(I, iname);
     for (int i=0; i<TreeLists::len(inv->extension_nodes); i++) {
         inter_package *pack = Inter::Package::defined_by_frame(inv->extension_nodes->list[i].node);
         inter_ti modesty = Metadata::read_numeric(pack, I"^modesty");
@@ -137,9 +137,9 @@ would violate the CC license.
             Produce::up(I);
         }
     }
-    Synoptic::end_function(I, iname);
+    Synoptic::end_function(I, iname);
 
- +

§1.2. This fuller version does not allow the exemptions.

@@ -148,7 +148,7 @@ would violate the CC license.
     inter_name *iname = HierarchyLocations::find(I, SHOWFULLEXTENSIONVERSIONS_HL);
-    Synoptic::begin_function(I, iname);
+    Synoptic::begin_function(I, iname);
     for (int i=0; i<TreeLists::len(inv->extension_nodes); i++) {
         inter_package *pack = Inter::Package::defined_by_frame(inv->extension_nodes->list[i].node);
         text_stream *credit = Str::duplicate(Metadata::read_textual(pack, I"^credit"));
@@ -158,9 +158,9 @@ would violate the CC license.
             Produce::val_text(I, credit);
         Produce::up(I);
     }
-    Synoptic::end_function(I, iname);
+    Synoptic::end_function(I, iname);
 
- +

§1.3. This prints the name of a single extension, identified by a value which is its extension ID.

@@ -170,8 +170,8 @@ is its extension ID.
     inter_name *iname = HierarchyLocations::find(I, SHOWONEEXTENSION_HL);
-    Synoptic::begin_function(I, iname);
-    inter_symbol *id_s = Synoptic::local(I, I"id", NULL);
+    Synoptic::begin_function(I, iname);
+    inter_symbol *id_s = Synoptic::local(I, I"id", NULL);
     for (int i=0; i<TreeLists::len(inv->extension_nodes); i++) {
         inter_package *pack = Inter::Package::defined_by_frame(inv->extension_nodes->list[i].node);
         text_stream *credit = Metadata::read_textual(pack, I"^credit");
@@ -191,11 +191,11 @@ is its extension ID.
             Produce::up(I);
         Produce::up(I);
     }
-    Synoptic::end_function(I, iname);
+    Synoptic::end_function(I, iname);
 
- +
diff --git a/docs/pipeline-module/3-ins.html b/docs/pipeline-module/4-ins.html similarity index 86% rename from docs/pipeline-module/3-ins.html rename to docs/pipeline-module/4-ins.html index 3ceb58cfa..744226f51 100644 --- a/docs/pipeline-module/3-ins.html +++ b/docs/pipeline-module/4-ins.html @@ -70,13 +70,13 @@ function togglePopup(material_id) {
+

To compile the main/synoptic/instances submodule.

§1. Before this runs, instance packages are scattered all over the Inter tree.

-

As this is called, Synoptic Utilities has already formed a list instance_nodes +

As this is called, Synoptic Utilities has already formed a list instance_nodes of packages of type _instance.

@@ -84,11 +84,11 @@ of packages of type _instance

-void SynopticInstances::compile(inter_tree *I, tree_inventory *inv) {
+void SynopticInstances::compile(inter_tree *I, tree_inventory *inv) {
     if (TreeLists::len(inv->instance_nodes) > 0) {
-        TreeLists::sort(inv->instance_nodes, Synoptic::module_order);
+        TreeLists::sort(inv->instance_nodes, Synoptic::module_order);
     }
-    Define SHOWMEINSTANCEDETAILS function1.1
+    Define SHOWMEINSTANCEDETAILS function1.1
 }
 

§1.1. Define SHOWMEINSTANCEDETAILS function1.1 = @@ -96,10 +96,10 @@ of packages of type _instance

     inter_name *iname = HierarchyLocations::find(I, SHOWMEINSTANCEDETAILS_HL);
-    Synoptic::begin_function(I, iname);
-    inter_symbol *which_s = Synoptic::local(I, I"which", NULL);
-    inter_symbol *na_s = Synoptic::local(I, I"na", NULL);
-    inter_symbol *t_0_s = Synoptic::local(I, I"t_0", NULL);
+    Synoptic::begin_function(I, iname);
+    inter_symbol *which_s = Synoptic::local(I, I"which", NULL);
+    inter_symbol *na_s = Synoptic::local(I, I"na", NULL);
+    inter_symbol *t_0_s = Synoptic::local(I, I"t_0", NULL);
     for (int i=0; i<TreeLists::len(inv->instance_nodes); i++) {
         inter_package *pack = Inter::Package::defined_by_frame(inv->instance_nodes->list[i].node);
         inter_symbol *showme_s = Metadata::read_optional_symbol(pack, I"^showme_fn");
@@ -120,11 +120,11 @@ of packages of type _instance
     Produce::down(I);
         Produce::val_symbol(I, K_value, na_s);
     Produce::up(I);
-    Synoptic::end_function(I, iname);
+    Synoptic::end_function(I, iname);
 
-
  • This code is used in §1.
+
  • This code is used in §1.
diff --git a/docs/pipeline-module/3-knd.html b/docs/pipeline-module/4-knd.html similarity index 95% rename from docs/pipeline-module/3-knd.html rename to docs/pipeline-module/4-knd.html index 742e91331..84da09c61 100644 --- a/docs/pipeline-module/3-knd.html +++ b/docs/pipeline-module/4-knd.html @@ -84,21 +84,21 @@ MathJax = {
+

To compile the main/synoptic/kinds submodule.

§1. Before this runs, kind packages are scattered all over the Inter tree. We must allocate each one a unique ID.

-

As this is called, Synoptic Utilities has already formed a list kind_nodes +

As this is called, Synoptic Utilities has already formed a list kind_nodes of packages of type _kind, and similarly for derived_kind_nodes.

-void SynopticKinds::compile(inter_tree *I, tree_inventory *inv) {
+void SynopticKinds::compile(inter_tree *I, tree_inventory *inv) {
     if (TreeLists::len(inv->kind_nodes) > 0) {
-        TreeLists::sort(inv->kind_nodes, Synoptic::module_order);
+        TreeLists::sort(inv->kind_nodes, Synoptic::module_order);
         for (int i=0; i<TreeLists::len(inv->kind_nodes); i++) {
             inter_package *pack = Inter::Package::defined_by_frame(inv->kind_nodes->list[i].node);
             inter_symbol *id_s = Metadata::read_optional_symbol(pack, I"^strong_id");
@@ -106,20 +106,20 @@ of packages of type _kind        }
     }
     if (TreeLists::len(inv->derived_kind_nodes) > 0) {
-        TreeLists::sort(inv->derived_kind_nodes, Synoptic::module_order);
+        TreeLists::sort(inv->derived_kind_nodes, Synoptic::module_order);
     }
-    Define BASE_KIND_HWM1.1;
-    Define DEFAULTVALUEFINDER function1.2;
-    Define DEFAULTVALUEOFKOV function1.3;
-    Define PRINTKINDVALUEPAIR function1.4;
-    Define KOVCOMPARISONFUNCTION function1.5;
-    Define KOVDOMAINSIZE function1.6;
-    Define KOVISBLOCKVALUE function1.7;
-    Define I7_KIND_NAME function1.8;
-    Define KOVSUPPORTFUNCTION function1.9;
-    Define SHOWMEKINDDETAILS function1.10;
-    Define RUCKSACK_CLASS constant1.11;
-    Define KINDHIERARCHY array1.12;
+    Define BASE_KIND_HWM1.1;
+    Define DEFAULTVALUEFINDER function1.2;
+    Define DEFAULTVALUEOFKOV function1.3;
+    Define PRINTKINDVALUEPAIR function1.4;
+    Define KOVCOMPARISONFUNCTION function1.5;
+    Define KOVDOMAINSIZE function1.6;
+    Define KOVISBLOCKVALUE function1.7;
+    Define I7_KIND_NAME function1.8;
+    Define KOVSUPPORTFUNCTION function1.9;
+    Define SHOWMEKINDDETAILS function1.10;
+    Define RUCKSACK_CLASS constant1.11;
+    Define KINDHIERARCHY array1.12;
 }
 

§1.1. Define BASE_KIND_HWM1.1 = @@ -129,19 +129,19 @@ of packages of type _kind inter_name *iname = HierarchyLocations::find(I, BASE_KIND_HWM_HL); Produce::numeric_constant(I, iname, K_value, (inter_ti) (TreeLists::len(inv->kind_nodes) + 2)); -

+

§1.2. Define DEFAULTVALUEFINDER function1.2 =

     inter_name *iname = HierarchyLocations::find(I, DEFAULTVALUEFINDER_HL);
-    Synoptic::begin_function(I, iname);
-    inter_symbol *k_s = Synoptic::local(I, I"k", NULL);
+    Synoptic::begin_function(I, iname);
+    inter_symbol *k_s = Synoptic::local(I, I"k", NULL);
     for (int i=0; i<TreeLists::len(inv->derived_kind_nodes); i++) {
         inter_package *pack = Inter::Package::defined_by_frame(inv->derived_kind_nodes->list[i].node);
         if (Metadata::read_numeric(pack, I"^default_value_needed")) {
-            inter_symbol *rks_s = Synoptic::get_symbol(pack, I"strong_id");
-            inter_symbol *dv_s = Synoptic::get_symbol(pack, I"default_value");
+            inter_symbol *rks_s = Synoptic::get_symbol(pack, I"strong_id");
+            inter_symbol *dv_s = Synoptic::get_symbol(pack, I"default_value");
             Produce::inv_primitive(I, IF_BIP);
             Produce::down(I);
                 Produce::inv_primitive(I, EQ_BIP);
@@ -160,9 +160,9 @@ of packages of type _kind        }
     }
     Produce::rfalse(I);
-    Synoptic::end_function(I, iname);
+    Synoptic::end_function(I, iname);
 
- +

§1.3. DefaultValueOfKOV(K) returns the default value for kind K: it's needed, for instance, when increasing the size of a list of \(K\) to include new entries, which have to be given some type-safe value to start out at. @@ -173,9 +173,9 @@ which have to be given some type-safe value to start out at.

     inter_name *iname = HierarchyLocations::find(I, DEFAULTVALUEOFKOV_HL);
-    Synoptic::begin_function(I, iname);
-    inter_symbol *sk_s = Synoptic::local(I, I"sk", NULL);
-    inter_symbol *k_s = Synoptic::local(I, I"k", NULL);
+    Synoptic::begin_function(I, iname);
+    inter_symbol *sk_s = Synoptic::local(I, I"sk", NULL);
+    inter_symbol *k_s = Synoptic::local(I, I"k", NULL);
     Produce::inv_primitive(I, STORE_BIP);
     Produce::down(I);
         Produce::ref_symbol(I, K_value, k_s);
@@ -213,9 +213,9 @@ which have to be given some type-safe value to start out at.
         Produce::up(I);
     Produce::up(I);
     Produce::rfalse(I);
-    Synoptic::end_function(I, iname);
+    Synoptic::end_function(I, iname);
 
- +

§1.4. PrintKindValuePair(K, V) prints out the value V, declaring its kind to be K.

@@ -224,9 +224,9 @@ which have to be given some type-safe value to start out at.
     inter_name *iname = HierarchyLocations::find(I, PRINTKINDVALUEPAIR_HL);
-    Synoptic::begin_function(I, iname);
-    inter_symbol *k_s = Synoptic::local(I, I"k", NULL);
-    inter_symbol *v_s = Synoptic::local(I, I"v", NULL);
+    Synoptic::begin_function(I, iname);
+    inter_symbol *k_s = Synoptic::local(I, I"k", NULL);
+    inter_symbol *v_s = Synoptic::local(I, I"v", NULL);
     Produce::inv_primitive(I, STORE_BIP);
     Produce::down(I);
         Produce::ref_symbol(I, K_value, k_s);
@@ -272,9 +272,9 @@ which have to be given some type-safe value to start out at.
             Produce::up(I);
         Produce::up(I);
     Produce::up(I);
-    Synoptic::end_function(I, iname);
+    Synoptic::end_function(I, iname);
 
- +

§1.5. KOVComparisonFunction(K) returns either the address of a function to perform a comparison between two values, or else 0 to signal that no special sort of comparison is needed. (In which case signed numerical @@ -289,8 +289,8 @@ unless the two values are genuinely equal.

     inter_name *iname = HierarchyLocations::find(I, KOVCOMPARISONFUNCTION_HL);
-    Synoptic::begin_function(I, iname);
-    inter_symbol *k_s = Synoptic::local(I, I"k", NULL);
+    Synoptic::begin_function(I, iname);
+    inter_symbol *k_s = Synoptic::local(I, I"k", NULL);
     Produce::inv_primitive(I, STORE_BIP);
     Produce::down(I);
         Produce::ref_symbol(I, K_value, k_s);
@@ -325,16 +325,16 @@ unless the two values are genuinely equal.
         Produce::up(I);
     Produce::up(I);
     Produce::rfalse(I);
-    Synoptic::end_function(I, iname);
+    Synoptic::end_function(I, iname);
 
- +

§1.6. Define KOVDOMAINSIZE function1.6 =

     inter_name *iname = HierarchyLocations::find(I, KOVDOMAINSIZE_HL);
-    Synoptic::begin_function(I, iname);
-    inter_symbol *k_s = Synoptic::local(I, I"k", NULL);
+    Synoptic::begin_function(I, iname);
+    inter_symbol *k_s = Synoptic::local(I, I"k", NULL);
     Produce::inv_primitive(I, STORE_BIP);
     Produce::down(I);
         Produce::ref_symbol(I, K_value, k_s);
@@ -369,9 +369,9 @@ unless the two values are genuinely equal.
         Produce::up(I);
     Produce::up(I);
     Produce::rfalse(I);
-    Synoptic::end_function(I, iname);
+    Synoptic::end_function(I, iname);
 
- +

§1.7. KOVIsBlockValue(k) is true if and only if k is the (strong or weak) ID of a kind storing pointers to blocks of data.

@@ -381,8 +381,8 @@ a kind storing pointers to blocks of data.
     inter_name *iname = HierarchyLocations::find(I, KOVISBLOCKVALUE_HL);
-    Synoptic::begin_function(I, iname);
-    inter_symbol *k_s = Synoptic::local(I, I"k", NULL);
+    Synoptic::begin_function(I, iname);
+    inter_symbol *k_s = Synoptic::local(I, I"k", NULL);
 
     Produce::inv_primitive(I, STORE_BIP);
     Produce::down(I);
@@ -415,16 +415,16 @@ a kind storing pointers to blocks of data.
         Produce::up(I);
     Produce::up(I);
     Produce::rfalse(I);
-    Synoptic::end_function(I, iname);
+    Synoptic::end_function(I, iname);
 
- +

§1.8. Define I7_KIND_NAME function1.8 =

     inter_name *iname = HierarchyLocations::find(I, I7_KIND_NAME_HL);
-    Synoptic::begin_function(I, iname);
-    inter_symbol *k_s = Synoptic::local(I, I"k", NULL);
+    Synoptic::begin_function(I, iname);
+    inter_symbol *k_s = Synoptic::local(I, I"k", NULL);
     for (int i=0; i<TreeLists::len(inv->kind_nodes); i++) {
         inter_package *pack = Inter::Package::defined_by_frame(inv->kind_nodes->list[i].node);
         inter_symbol *class_s = Metadata::read_optional_symbol(pack, I"^object_class");
@@ -447,9 +447,9 @@ a kind storing pointers to blocks of data.
             Produce::up(I);
         }
     }
-    Synoptic::end_function(I, iname);
+    Synoptic::end_function(I, iname);
 
- +

§1.9. KOVSupportFunction(K) returns the address of the specific support function for a pointer-value kind K, or returns 0 if K is not such a kind. For what such a function does, see "BlockValues.i6t". @@ -460,9 +460,9 @@ such a function does, see "BlockValues.i6t".

     inter_name *iname = HierarchyLocations::find(I, KOVSUPPORTFUNCTION_HL);
-    Synoptic::begin_function(I, iname);
-    inter_symbol *k_s = Synoptic::local(I, I"k", NULL);
-    inter_symbol *fail_s = Synoptic::local(I, I"fail", NULL);
+    Synoptic::begin_function(I, iname);
+    inter_symbol *k_s = Synoptic::local(I, I"k", NULL);
+    inter_symbol *fail_s = Synoptic::local(I, I"fail", NULL);
 
     Produce::inv_primitive(I, STORE_BIP);
     Produce::down(I);
@@ -512,18 +512,18 @@ such a function does, see "BlockValues.i6t".
     Produce::up(I);
 
     Produce::rfalse(I);
-    Synoptic::end_function(I, iname);
+    Synoptic::end_function(I, iname);
 
- +

§1.10. Define SHOWMEKINDDETAILS function1.10 =

     inter_name *iname = HierarchyLocations::find(I, SHOWMEKINDDETAILS_HL);
-    Synoptic::begin_function(I, iname);
-    inter_symbol *which_s = Synoptic::local(I, I"which", NULL);
-    inter_symbol *na_s = Synoptic::local(I, I"na", NULL);
-    inter_symbol *t_0_s = Synoptic::local(I, I"t_0", NULL);
+    Synoptic::begin_function(I, iname);
+    inter_symbol *which_s = Synoptic::local(I, I"which", NULL);
+    inter_symbol *na_s = Synoptic::local(I, I"na", NULL);
+    inter_symbol *t_0_s = Synoptic::local(I, I"t_0", NULL);
     for (int i=0; i<TreeLists::len(inv->kind_nodes); i++) {
         inter_package *pack = Inter::Package::defined_by_frame(inv->kind_nodes->list[i].node);
         if (Metadata::read_optional_numeric(pack, I"^is_object")) {
@@ -546,9 +546,9 @@ such a function does, see "BlockValues.i6t".
     Produce::down(I);
         Produce::val_symbol(I, K_value, na_s);
     Produce::up(I);
-    Synoptic::end_function(I, iname);
+    Synoptic::end_function(I, iname);
 
- +

§1.11. This goes right back to a curious feature of Inform 1, in 1993. To enable the use of player's holdalls, we must declare a constant RUCKSACK_CLASS to tell some code in WorldModelKit to use possessions with this Inter class as @@ -575,7 +575,7 @@ name), with other actors oblivious. } if (found == FALSE) Produce::numeric_constant(I, iname, K_value, 0); -

+

§1.12. The kind inheritance tree is represented by an array providing metadata on the kinds of object: there are just two words per kind — the class, then the instance count for its own kind. For instance, "door" is usually @@ -607,31 +607,31 @@ a kind of thing. Inter::Symbols::annotate_i(kind_name, OBJECT_KIND_COUNTER_IANN, (inter_ti) i++); inter_name *iname = HierarchyLocations::find(I, KINDHIERARCHY_HL); - Synoptic::begin_array(I, iname); + Synoptic::begin_array(I, iname); if (LinkedLists::len(L) > 0) { - Synoptic::symbol_entry(object_kind_symbol); - Synoptic::numeric_entry(0); + Synoptic::symbol_entry(object_kind_symbol); + Synoptic::numeric_entry(0); inter_symbol *kind_name; LOOP_OVER_LINKED_LIST(kind_name, inter_symbol, ordered_L) { - Synoptic::symbol_entry(kind_name); + Synoptic::symbol_entry(kind_name); inter_symbol *super_name = Inter::Kind::super(kind_name); if ((super_name) && (super_name != object_kind_symbol)) { - Synoptic::numeric_entry(SynopticKinds::kind_of_object_count(super_name)); + Synoptic::numeric_entry(SynopticKinds::kind_of_object_count(super_name)); } else { - Synoptic::numeric_entry(0); + Synoptic::numeric_entry(0); } } } else { - Synoptic::numeric_entry(0); - Synoptic::numeric_entry(0); + Synoptic::numeric_entry(0); + Synoptic::numeric_entry(0); } - Synoptic::end_array(I); + Synoptic::end_array(I); -

+

§2.

-inter_ti SynopticKinds::kind_of_object_count(inter_symbol *kind_name) {
+inter_ti SynopticKinds::kind_of_object_count(inter_symbol *kind_name) {
     if ((kind_name == NULL) || (kind_name == object_kind_symbol)) return 0;
     int N = Inter::Symbols::read_annotation(kind_name, OBJECT_KIND_COUNTER_IANN);
     if (N >= 0) return (inter_ti) N;
@@ -639,7 +639,7 @@ a kind of thing.
 }
 
diff --git a/docs/pipeline-module/3-lt.html b/docs/pipeline-module/4-lt.html similarity index 91% rename from docs/pipeline-module/3-lt.html rename to docs/pipeline-module/4-lt.html index 8d14869ac..aa04215ee 100644 --- a/docs/pipeline-module/3-lt.html +++ b/docs/pipeline-module/4-lt.html @@ -70,7 +70,7 @@ function togglePopup(material_id) {
+

To alphabetise literal texts, deduplicate them, and stote a canonical set in the main/texts linkage.

§1. Before this runs, literal text constants are scattered all over the Inter tree. @@ -94,14 +94,14 @@ two instances might be much further apart than in this example — one might in a kit, and the other in an unrelated extension, for example.

-

As this is called, Synoptic Utilities has already formed a list text_nodes +

As this is called, Synoptic Utilities has already formed a list text_nodes of constants marked with the TEXT_LITERAL_IANN annotation. We take it from there:

-void SynopticText::compile(inter_tree *I, tree_inventory *inv) {
+void SynopticText::compile(inter_tree *I, tree_inventory *inv) {
     if (TreeLists::len(inv->text_nodes) > 0) {
-        TreeLists::sort(inv->text_nodes, SynopticText::cmp);
+        TreeLists::sort(inv->text_nodes, SynopticText::cmp);
         inter_package *texts_pack = Site::ensure_texts_package(I);
         inter_bookmark IBM = Inter::Bookmarks::at_end_of_this_package(texts_pack);
 
@@ -110,10 +110,10 @@ of constants marked with the 
         for (int i=0, j=0; i<TreeLists::len(inv->text_nodes); i++) {
             inter_tree_node *P = inv->text_nodes->list[i].node;
             inter_package *pack = Inter::Packages::container(P);
-            text_stream *S = SynopticText::text_quoted_here(P);
+            text_stream *S = SynopticText::text_quoted_here(P);
             if ((latest_text == NULL) || (Str::ne(S, latest_text)))
-                A new entry, not a duplicated one1.1;
-            Change the value in P from a literal text to an alias for the latest text1.2;
+                A new entry, not a duplicated one1.1;
+            Change the value in P from a literal text to an alias for the latest text1.2;
         }
     }
 }
@@ -134,13 +134,13 @@ this will be executed on the first 
     TEMPORARY_TEXT(A)
     WRITE_TO(A, "alphabetised_text_%d", j++);
-    inter_symbol *alpha_s = Synoptic::new_symbol(texts_pack, A);
+    inter_symbol *alpha_s = Synoptic::new_symbol(texts_pack, A);
     DISCARD_TEXT(A)
-    Synoptic::def_textual_constant(I, alpha_s, S, &IBM);
+    Synoptic::def_textual_constant(I, alpha_s, S, &IBM);
     latest_s = alpha_s;
     latest_text = S;
 
- +

§1.2. This is run on every P in the list. It begins as, for example,

@@ -161,7 +161,7 @@ in texts.

-    inter_symbol *ref_s = Synoptic::new_symbol(pack, I"ref_to_text");
+    inter_symbol *ref_s = Synoptic::new_symbol(pack, I"ref_to_text");
 
     InterSymbolsTables::equate(ref_s, latest_s);
     inter_ti val1 = 0, val2 = 0;
@@ -174,13 +174,13 @@ in texts.
         InterSymbolsTables::symbol_from_frame_data(P, DEFN_CONST_IFLD);
     Inter::Symbols::unannotate(con_name, TEXT_LITERAL_IANN);
 
- +

§2. Here we extract the actual text from a node defining a constant literal text, and use that to define a sorting function on nodes:

-text_stream *SynopticText::text_quoted_here(inter_tree_node *P) {
+text_stream *SynopticText::text_quoted_here(inter_tree_node *P) {
     if (P->W.data[FORMAT_CONST_IFLD] == CONSTANT_INDIRECT_TEXT) {
         inter_ti val1 = P->W.data[DATA_CONST_IFLD];
         return Inode::ID_to_text(P, val1);
@@ -189,19 +189,19 @@ and use that to define a sorting function on nodes:
     return NULL;
 }
 
-int SynopticText::cmp(const void *ent1, const void *ent2) {
+int SynopticText::cmp(const void *ent1, const void *ent2) {
     itl_entry *E1 = (itl_entry *) ent1;
     itl_entry *E2 = (itl_entry *) ent2;
     if (E1 == E2) return 0;
     inter_tree_node *P1 = E1->node;
     inter_tree_node *P2 = E2->node;
-    text_stream *S1 = SynopticText::text_quoted_here(P1);
-    text_stream *S2 = SynopticText::text_quoted_here(P2);
+    text_stream *S1 = SynopticText::text_quoted_here(P1);
+    text_stream *S2 = SynopticText::text_quoted_here(P2);
     return Str::cmp(S1, S2);
 }
 
diff --git a/docs/pipeline-module/3-mlt.html b/docs/pipeline-module/4-mlt.html similarity index 85% rename from docs/pipeline-module/3-mlt.html rename to docs/pipeline-module/4-mlt.html index 6c3fac367..ff9fcc508 100644 --- a/docs/pipeline-module/3-mlt.html +++ b/docs/pipeline-module/4-mlt.html @@ -70,32 +70,32 @@ function togglePopup(material_id) {
+

To compile the main/synoptic/multimedia submodule.

§1. Before this runs, instances of figures, sounds and external files are scattered all over the Inter tree.

-

As this is called, Synoptic Utilities has already formed lists of sound_nodes +

As this is called, Synoptic Utilities has already formed lists of sound_nodes of instances having the kind K_sound_name, and so on.

-void SynopticMultimedia::compile(inter_tree *I, tree_inventory *inv) {
+void SynopticMultimedia::compile(inter_tree *I, tree_inventory *inv) {
     if (TreeLists::len(inv->figure_nodes) > 0) {
-        TreeLists::sort(inv->figure_nodes, Synoptic::module_order);
+        TreeLists::sort(inv->figure_nodes, Synoptic::module_order);
     }
     if (TreeLists::len(inv->sound_nodes) > 0) {
-        TreeLists::sort(inv->sound_nodes, Synoptic::module_order);
+        TreeLists::sort(inv->sound_nodes, Synoptic::module_order);
     }
     if (TreeLists::len(inv->file_nodes) > 0) {
-        TreeLists::sort(inv->file_nodes, Synoptic::module_order);
+        TreeLists::sort(inv->file_nodes, Synoptic::module_order);
     }
-    Define RESOURCEIDSOFFIGURES array1.1;
-    Define RESOURCEIDSOFSOUNDS array1.2;
-    Define NO_EXTERNAL_FILES1.3;
-    Define TABLEOFEXTERNALFILES array1.4;
+    Define RESOURCEIDSOFFIGURES array1.1;
+    Define RESOURCEIDSOFSOUNDS array1.2;
+    Define NO_EXTERNAL_FILES1.3;
+    Define TABLEOFEXTERNALFILES array1.4;
 }
 

§1.1. Define RESOURCEIDSOFFIGURES array1.1 = @@ -103,33 +103,33 @@ of instances having the kind

     inter_name *iname = HierarchyLocations::find(I, RESOURCEIDSOFFIGURES_HL);
-    Synoptic::begin_array(I, iname);
-    Synoptic::numeric_entry(0);
+    Synoptic::begin_array(I, iname);
+    Synoptic::numeric_entry(0);
     for (int i=0; i<TreeLists::len(inv->figure_nodes); i++) {
         inter_package *pack = Inter::Package::defined_by_frame(inv->figure_nodes->list[i].node);
         inter_ti id = Metadata::read_numeric(pack, I"^resource_id");
-        Synoptic::numeric_entry(id);
+        Synoptic::numeric_entry(id);
     }
-    Synoptic::numeric_entry(0);
-    Synoptic::end_array(I);
+    Synoptic::numeric_entry(0);
+    Synoptic::end_array(I);
 
- +

§1.2. Define RESOURCEIDSOFSOUNDS array1.2 =

     inter_name *iname = HierarchyLocations::find(I, RESOURCEIDSOFSOUNDS_HL);
-    Synoptic::begin_array(I, iname);
-    Synoptic::numeric_entry(0);
+    Synoptic::begin_array(I, iname);
+    Synoptic::numeric_entry(0);
     for (int i=0; i<TreeLists::len(inv->sound_nodes); i++) {
         inter_package *pack = Inter::Package::defined_by_frame(inv->sound_nodes->list[i].node);
         inter_ti id = Metadata::read_numeric(pack, I"^resource_id");
-        Synoptic::numeric_entry(id);
+        Synoptic::numeric_entry(id);
     }
-    Synoptic::numeric_entry(0);
-    Synoptic::end_array(I);
+    Synoptic::numeric_entry(0);
+    Synoptic::end_array(I);
 
- +

§1.3. Define NO_EXTERNAL_FILES1.3 =

@@ -137,25 +137,25 @@ of instances having the kind inter_name *iname = HierarchyLocations::find(I, NO_EXTERNAL_FILES_HL); Produce::numeric_constant(I, iname, K_value, (inter_ti) TreeLists::len(inv->file_nodes)); -
  • This code is used in §1.
+
  • This code is used in §1.

§1.4. Define TABLEOFEXTERNALFILES array1.4 =

     inter_name *iname = HierarchyLocations::find(I, TABLEOFEXTERNALFILES_HL);
-    Synoptic::begin_array(I, iname);
-    Synoptic::numeric_entry(0);
+    Synoptic::begin_array(I, iname);
+    Synoptic::numeric_entry(0);
     for (int i=0; i<TreeLists::len(inv->file_nodes); i++) {
         inter_package *pack = Inter::Package::defined_by_frame(inv->file_nodes->list[i].node);
         inter_symbol *vc_s = Metadata::read_symbol(pack, I"^file_value");
-        Synoptic::symbol_entry(vc_s);
+        Synoptic::symbol_entry(vc_s);
     }
-    Synoptic::numeric_entry(0);
-    Synoptic::end_array(I);
+    Synoptic::numeric_entry(0);
+    Synoptic::end_array(I);
 
-
  • This code is used in §1.
+
  • This code is used in §1.
diff --git a/docs/pipeline-module/4-prp.html b/docs/pipeline-module/4-prp.html new file mode 100644 index 000000000..140ae0d97 --- /dev/null +++ b/docs/pipeline-module/4-prp.html @@ -0,0 +1,112 @@ + + + + Properties + + + + + + + + + + + + + + + + + + +
+ + +

To compile the main/synoptic/properties submodule.

+ +

§1. Before this runs, property packages are scattered all over the Inter tree. +We must allocate each one a unique ID. +

+ +

As this is called, Synoptic Utilities has already formed a list property_nodes +of packages of type _activity. +

+ +
+void SynopticProperties::compile(inter_tree *I, tree_inventory *inv) {
+    if (TreeLists::len(inv->property_nodes) > 0) {
+        TreeLists::sort(inv->property_nodes, Synoptic::module_order);
+        for (int i=0; i<TreeLists::len(inv->property_nodes); i++) {
+            inter_package *pack = Inter::Package::defined_by_frame(inv->property_nodes->list[i].node);
+            inter_tree_node *D = Synoptic::get_definition(pack, I"property_id");
+            D->W.data[DATA_CONST_IFLD+1] = (inter_ti) i;
+        }
+    }
+    Define CCOUNT_PROPERTY1.1;
+}
+
+

§1.1. Define CCOUNT_PROPERTY1.1 = +

+ +
+    inter_name *iname = HierarchyLocations::find(I, CCOUNT_PROPERTY_HL);
+    Produce::numeric_constant(I, iname, K_value, (inter_ti) (TreeLists::len(inv->property_nodes)));
+
+ + + +
+ + + diff --git a/docs/pipeline-module/3-rls.html b/docs/pipeline-module/4-rls.html similarity index 93% rename from docs/pipeline-module/3-rls.html rename to docs/pipeline-module/4-rls.html index 8b5d72a4b..4463a788a 100644 --- a/docs/pipeline-module/3-rls.html +++ b/docs/pipeline-module/4-rls.html @@ -70,24 +70,24 @@ function togglePopup(material_id) {
+

To compile the main/synoptic/rules and main/synoptic/rulebooks submodules.

§1. Before this runs, rulebook packages are scattered all over the Inter tree. We must allocate each one a unique ID.

-

As this is called, Synoptic Utilities has already formed a list rulebook_nodes +

As this is called, Synoptic Utilities has already formed a list rulebook_nodes of packages of type _rulebook; and similarly for rule_nodes.

-void SynopticRules::compile(inter_tree *I, tree_inventory *inv) {
+void SynopticRules::compile(inter_tree *I, tree_inventory *inv) {
     if (TreeLists::len(inv->rulebook_nodes) > 0) {
-        TreeLists::sort(inv->rulebook_nodes, Synoptic::module_order);
+        TreeLists::sort(inv->rulebook_nodes, Synoptic::module_order);
         for (int i=0; i<TreeLists::len(inv->rulebook_nodes); i++) {
             inter_package *pack = Inter::Package::defined_by_frame(inv->rulebook_nodes->list[i].node);
-            inter_tree_node *D = Synoptic::get_definition(pack, I"rulebook_id");
+            inter_tree_node *D = Synoptic::get_definition(pack, I"rulebook_id");
             D->W.data[DATA_CONST_IFLD+1] = (inter_ti) i;
         }
     }
@@ -96,12 +96,12 @@ of packages of type _rulebook
         I"/main/completion/basics/^memory_economy");
     if (me_s) economy = Inter::Symbols::evaluate_to_int(me_s);
     else internal_error("no me_s");
-    Define NUMBER_RULEBOOKS_CREATED1.1;
-    Define RulebookNames array1.2;
-    if (economy) Define SlowLookup function1.5
-    else Define rulebook_var_creators array1.3;
-    Define rulebooks_array array1.4;
-    Define RULEPRINTINGRULE function1.6;
+    Define NUMBER_RULEBOOKS_CREATED1.1;
+    Define RulebookNames array1.2;
+    if (economy) Define SlowLookup function1.5
+    else Define rulebook_var_creators array1.3;
+    Define rulebooks_array array1.4;
+    Define RULEPRINTINGRULE function1.6;
 }
 

§1.1. Define NUMBER_RULEBOOKS_CREATED1.1 = @@ -111,63 +111,63 @@ of packages of type _rulebook inter_name *iname = HierarchyLocations::find(I, NUMBER_RULEBOOKS_CREATED_HL); Produce::numeric_constant(I, iname, K_value, (inter_ti) (TreeLists::len(inv->rulebook_nodes))); -

+

§1.2. Define RulebookNames array1.2 =

     inter_name *iname = HierarchyLocations::find(I, RULEBOOKNAMES_HL);
-    Synoptic::begin_array(I, iname);
+    Synoptic::begin_array(I, iname);
     if (economy) {
-        Synoptic::numeric_entry(0);
-        Synoptic::numeric_entry(0);
+        Synoptic::numeric_entry(0);
+        Synoptic::numeric_entry(0);
     } else {
         for (int i=0; i<TreeLists::len(inv->rulebook_nodes); i++) {
             inter_package *pack = Inter::Package::defined_by_frame(inv->rulebook_nodes->list[i].node);
             text_stream *name = Metadata::read_textual(pack, I"^printed_name");
-            Synoptic::textual_entry(name);
+            Synoptic::textual_entry(name);
         }
     }
-    Synoptic::end_array(I);
+    Synoptic::end_array(I);
 
- +

§1.3. Define rulebook_var_creators array1.3 =

     inter_name *iname = HierarchyLocations::find(I, RULEBOOK_VAR_CREATORS_HL);
-    Synoptic::begin_array(I, iname);
+    Synoptic::begin_array(I, iname);
     for (int i=0; i<TreeLists::len(inv->rulebook_nodes); i++) {
         inter_package *pack = Inter::Package::defined_by_frame(inv->rulebook_nodes->list[i].node);
         inter_symbol *vc_s = Metadata::read_optional_symbol(pack, I"^var_creator");
-        if (vc_s) Synoptic::symbol_entry(vc_s);
-        else Synoptic::numeric_entry(0);
+        if (vc_s) Synoptic::symbol_entry(vc_s);
+        else Synoptic::numeric_entry(0);
     }
-    Synoptic::end_array(I);
+    Synoptic::end_array(I);
 
- +

§1.4. Define rulebooks_array array1.4 =

     inter_name *iname = HierarchyLocations::find(I, RULEBOOKS_ARRAY_HL);
-    Synoptic::begin_array(I, iname);
+    Synoptic::begin_array(I, iname);
     for (int i=0; i<TreeLists::len(inv->rulebook_nodes); i++) {
         inter_package *pack = Inter::Package::defined_by_frame(inv->rulebook_nodes->list[i].node);
         inter_symbol *fn_s = Metadata::read_symbol(pack, I"^run_fn");
-        Synoptic::symbol_entry(fn_s);
+        Synoptic::symbol_entry(fn_s);
     }
-    Synoptic::numeric_entry(0);
-    Synoptic::end_array(I);
+    Synoptic::numeric_entry(0);
+    Synoptic::end_array(I);
 
- +

§1.5. Define SlowLookup function1.5 =

     inter_name *iname = HierarchyLocations::find(I, SLOW_LOOKUP_HL);
-    Synoptic::begin_function(I, iname);
-    inter_symbol *rb_s = Synoptic::local(I, I"rb", NULL);
+    Synoptic::begin_function(I, iname);
+    inter_symbol *rb_s = Synoptic::local(I, I"rb", NULL);
 
     Produce::inv_primitive(I, SWITCH_BIP);
     Produce::down(I);
@@ -197,16 +197,16 @@ of packages of type _rulebook
     Produce::down(I);
         Produce::val(I, K_value, LITERAL_IVAL, 0);
     Produce::up(I);
-    Synoptic::end_function(I, iname);
+    Synoptic::end_function(I, iname);
 
- +

§1.6. Define RULEPRINTINGRULE function1.6 =

     inter_name *iname = HierarchyLocations::find(I, RULEPRINTINGRULE_HL);
-    Synoptic::begin_function(I, iname);
-    inter_symbol *R_s = Synoptic::local(I, I"R", NULL);
+    Synoptic::begin_function(I, iname);
+    inter_symbol *R_s = Synoptic::local(I, I"R", NULL);
 
     Produce::inv_primitive(I, IFELSE_BIP);
     Produce::down(I);
@@ -225,16 +225,16 @@ of packages of type _rulebook
         Produce::up(I);
         Produce::code(I);
         Produce::down(I);
-            Print a rulebook name1.6.1;
+            Print a rulebook name1.6.1;
         Produce::up(I);
         Produce::code(I);
         Produce::down(I);
-            Print a rule name1.6.2;
+            Print a rule name1.6.2;
         Produce::up(I);
     Produce::up(I);
-    Synoptic::end_function(I, iname);
+    Synoptic::end_function(I, iname);
 
- +

§1.6.1. Print a rulebook name1.6.1 =

@@ -263,7 +263,7 @@ of packages of type _rulebook Produce::up(I); } -
  • This code is used in §1.6.
+
  • This code is used in §1.6.

§1.6.2. Print a rule name1.6.2 =

@@ -318,9 +318,9 @@ of packages of type _rulebook Produce::up(I); } -
  • This code is used in §1.6.
+
  • This code is used in §1.6.
diff --git a/docs/pipeline-module/3-rlt.html b/docs/pipeline-module/4-rlt.html similarity index 90% rename from docs/pipeline-module/3-rlt.html rename to docs/pipeline-module/4-rlt.html index 573a0c2b1..66b844cc5 100644 --- a/docs/pipeline-module/3-rlt.html +++ b/docs/pipeline-module/4-rlt.html @@ -70,31 +70,31 @@ function togglePopup(material_id) {
+

To compile the main/synoptic/relations submodule.

§1. Before this runs, relation packages are scattered all over the Inter tree. We must allocate each one a unique ID.

-

As this is called, Synoptic Utilities has already formed a list relation_nodes +

As this is called, Synoptic Utilities has already formed a list relation_nodes of packages of type _relation.

-void SynopticRelations::compile(inter_tree *I, tree_inventory *inv) {
+void SynopticRelations::compile(inter_tree *I, tree_inventory *inv) {
     if (TreeLists::len(inv->relation_nodes) > 0) {
-        TreeLists::sort(inv->relation_nodes, Synoptic::module_order);
+        TreeLists::sort(inv->relation_nodes, Synoptic::module_order);
         for (int i=0; i<TreeLists::len(inv->relation_nodes); i++) {
             inter_package *pack = Inter::Package::defined_by_frame(inv->relation_nodes->list[i].node);
-            inter_tree_node *D = Synoptic::get_definition(pack, I"relation_id");
+            inter_tree_node *D = Synoptic::get_definition(pack, I"relation_id");
             D->W.data[DATA_CONST_IFLD+1] = (inter_ti) i;
         }
     }
-    Define CCOUNT_BINARY_PREDICATE1.1;
-    Define CREATEDYNAMICRELATIONS function1.2;
-    Define ITERATERELATIONS function1.3;
-    Define RPROPERTY function1.4;
+    Define CCOUNT_BINARY_PREDICATE1.1;
+    Define CREATEDYNAMICRELATIONS function1.2;
+    Define ITERATERELATIONS function1.3;
+    Define RPROPERTY function1.4;
 }
 

§1.1. Define CCOUNT_BINARY_PREDICATE1.1 = @@ -104,28 +104,28 @@ of packages of type _relation inter_name *iname = HierarchyLocations::find(I, CCOUNT_BINARY_PREDICATE_HL); Produce::numeric_constant(I, iname, K_value, (inter_ti) (TreeLists::len(inv->relation_nodes))); -

+

§1.2. Define CREATEDYNAMICRELATIONS function1.2 =

     inter_name *iname = HierarchyLocations::find(I, CREATEDYNAMICRELATIONS_HL);
-    Synoptic::begin_function(I, iname);
+    Synoptic::begin_function(I, iname);
     for (int i=0; i<TreeLists::len(inv->relation_nodes); i++) {
         inter_package *pack = Inter::Package::defined_by_frame(inv->relation_nodes->list[i].node);
         inter_symbol *creator_s = Metadata::read_optional_symbol(pack, I"^creator");
         if (creator_s) Produce::inv_call(I, creator_s);
     }
-    Synoptic::end_function(I, iname);
+    Synoptic::end_function(I, iname);
 
- +

§1.3. Define ITERATERELATIONS function1.3 =

     inter_name *iname = HierarchyLocations::find(I, ITERATERELATIONS_HL);
-    Synoptic::begin_function(I, iname);
-    inter_symbol *callback_s = Synoptic::local(I, I"callback", NULL);
+    Synoptic::begin_function(I, iname);
+    inter_symbol *callback_s = Synoptic::local(I, I"callback", NULL);
     for (int i=0; i<TreeLists::len(inv->relation_nodes); i++) {
         inter_package *pack = Inter::Package::defined_by_frame(inv->relation_nodes->list[i].node);
         inter_symbol *rel_s = Metadata::read_optional_symbol(pack, I"^value");
@@ -137,18 +137,18 @@ of packages of type _relation
             Produce::up(I);
         }
     }
-    Synoptic::end_function(I, iname);
+    Synoptic::end_function(I, iname);
 
- +

§1.4. Define RPROPERTY function1.4 =

     inter_name *iname = HierarchyLocations::find(I, RPROPERTY_HL);
-    Synoptic::begin_function(I, iname);
-    inter_symbol *obj_s = Synoptic::local(I, I"obj", NULL);
-    inter_symbol *cl_s = Synoptic::local(I, I"cl", NULL);
-    inter_symbol *pr_s = Synoptic::local(I, I"pr", NULL);
+    Synoptic::begin_function(I, iname);
+    inter_symbol *obj_s = Synoptic::local(I, I"obj", NULL);
+    inter_symbol *cl_s = Synoptic::local(I, I"cl", NULL);
+    inter_symbol *pr_s = Synoptic::local(I, I"pr", NULL);
     Produce::inv_primitive(I, IF_BIP);
     Produce::down(I);
         Produce::inv_primitive(I, OFCLASS_BIP);
@@ -174,11 +174,11 @@ of packages of type _relation
     Produce::down(I);
         Produce::val(I, K_value, LITERAL_IVAL, 0);
     Produce::up(I);
-    Synoptic::end_function(I, iname);
+    Synoptic::end_function(I, iname);
 
- +
diff --git a/docs/pipeline-module/3-rsp.html b/docs/pipeline-module/4-rsp.html similarity index 90% rename from docs/pipeline-module/3-rsp.html rename to docs/pipeline-module/4-rsp.html index 801f6c55d..f81813668 100644 --- a/docs/pipeline-module/3-rsp.html +++ b/docs/pipeline-module/4-rsp.html @@ -70,7 +70,7 @@ function togglePopup(material_id) {
+

To compile the main/synoptic/responses submodule.

§1. Before this runs, response packages are scattered all over the Inter tree. @@ -86,25 +86,25 @@ be the enumerated values of the kind ^rule, symbol, the rule to which this is a response.

  • ^value, symbol, the text for the response at start of play.
  • -

    As this is called, Synoptic Utilities has already formed a list response_nodes +

    As this is called, Synoptic Utilities has already formed a list response_nodes of packages of type _response. Each of these contains a constant called response_id, which the Inform compiler created as just 0; we substitute the correct ID.

    -void SynopticResponses::compile(inter_tree *I, tree_inventory *inv) {
    +void SynopticResponses::compile(inter_tree *I, tree_inventory *inv) {
         if (TreeLists::len(inv->response_nodes) > 0) {
             for (int i=0; i<TreeLists::len(inv->response_nodes); i++) {
                 inter_package *pack = Inter::Package::defined_by_frame(inv->response_nodes->list[i].node);
    -            inter_tree_node *D = Synoptic::get_definition(pack, I"response_id");
    +            inter_tree_node *D = Synoptic::get_definition(pack, I"response_id");
                 D->W.data[DATA_CONST_IFLD+1] = (inter_ti) i+1;
             }
         }
    -    Define NO_RESPONSES1.1;
    -    Define ResponseTexts array1.2;
    -    Define ResponseDivisions array1.3;
    -    Define PrintResponse function1.4;
    +    Define NO_RESPONSES1.1;
    +    Define ResponseTexts array1.2;
    +    Define ResponseDivisions array1.3;
    +    Define PrintResponse function1.4;
     }
     

    §1.1. Define NO_RESPONSES1.1 = @@ -114,7 +114,7 @@ correct ID. inter_name *iname = HierarchyLocations::find(I, NO_RESPONSES_HL); Produce::numeric_constant(I, iname, K_value, (inter_ti) (TreeLists::len(inv->response_nodes))); -

    +

    §1.2. This is the critical array which connects a response ID to the current value of the text of that response.

    @@ -124,17 +124,17 @@ of the text of that response.
         inter_name *iname = HierarchyLocations::find(I, RESPONSETEXTS_HL);
    -    Synoptic::begin_array(I, iname);
    +    Synoptic::begin_array(I, iname);
         for (int i=0; i<TreeLists::len(inv->response_nodes); i++) {
             inter_package *pack = Inter::Package::defined_by_frame(inv->response_nodes->list[i].node);
             inter_symbol *value_s = Metadata::read_symbol(pack, I"^value");
    -        Synoptic::symbol_entry(value_s);
    +        Synoptic::symbol_entry(value_s);
         }
    -    Synoptic::numeric_entry(0);
    -    Synoptic::numeric_entry(0);
    -    Synoptic::end_array(I);
    +    Synoptic::numeric_entry(0);
    +    Synoptic::numeric_entry(0);
    +    Synoptic::end_array(I);
     
    - +

    §1.3. The following array is used only by the testing command RESPONSES, and enables the Inter template to print out all known responses at run-time, divided up by the extensions containing the rules which produce them. @@ -153,32 +153,32 @@ The triple (0, 0, 0) inter_name *iname = HierarchyLocations::find(I, RESPONSEDIVISIONS_HL); - Synoptic::begin_array(I, iname); + Synoptic::begin_array(I, iname); text_stream *current_group = NULL; int start_pos = -1; for (int i=0; i<TreeLists::len(inv->response_nodes); i++) { inter_package *pack = Inter::Package::defined_by_frame(inv->response_nodes->list[i].node); text_stream *group = Metadata::read_textual(pack, I"^group"); if (Str::ne(group, current_group)) { if (start_pos >= 0) { - Synoptic::textual_entry(current_group); - Synoptic::numeric_entry((inter_ti) start_pos + 1); - Synoptic::numeric_entry((inter_ti) i); + Synoptic::textual_entry(current_group); + Synoptic::numeric_entry((inter_ti) start_pos + 1); + Synoptic::numeric_entry((inter_ti) i); } current_group = group; start_pos = i; } } if (start_pos >= 0) { - Synoptic::textual_entry(current_group); - Synoptic::numeric_entry((inter_ti) start_pos + 1); - Synoptic::numeric_entry((inter_ti) TreeLists::len(inv->response_nodes)); + Synoptic::textual_entry(current_group); + Synoptic::numeric_entry((inter_ti) start_pos + 1); + Synoptic::numeric_entry((inter_ti) TreeLists::len(inv->response_nodes)); } - Synoptic::numeric_entry(0); - Synoptic::numeric_entry(0); - Synoptic::numeric_entry(0); - Synoptic::end_array(I); + Synoptic::numeric_entry(0); + Synoptic::numeric_entry(0); + Synoptic::numeric_entry(0); + Synoptic::end_array(I); -

    +

    §1.4. Finally, a function used when printing values of the K_response kind; the main compiler created this as a mostly empty function with two local variables — R, the ID for the response we should print, and RPR, the @@ -200,8 +200,8 @@ code is less limited.

         inter_name *iname = HierarchyLocations::find(I, PRINT_RESPONSE_HL);
    -    Synoptic::begin_function(I, iname);
    -    inter_symbol *R_s = Synoptic::local(I, I"R", NULL);
    +    Synoptic::begin_function(I, iname);
    +    inter_symbol *R_s = Synoptic::local(I, I"R", NULL);
     
         for (int i=0; i<TreeLists::len(inv->response_nodes); i++) {
             inter_package *pack = Inter::Package::defined_by_frame(inv->response_nodes->list[i].node);
    @@ -235,11 +235,11 @@ code is less limited.
                 Produce::up(I);
             Produce::up(I);
         }
    -    Synoptic::end_function(I, iname);
    +    Synoptic::end_function(I, iname);
     
    - +
    diff --git a/docs/pipeline-module/3-scn.html b/docs/pipeline-module/4-scn.html similarity index 91% rename from docs/pipeline-module/3-scn.html rename to docs/pipeline-module/4-scn.html index 5486da7b3..c27170499 100644 --- a/docs/pipeline-module/3-scn.html +++ b/docs/pipeline-module/4-scn.html @@ -70,23 +70,23 @@ function togglePopup(material_id) {
    +

    To compile the main/synoptic/scenes submodule.

    §1. Before this runs, instances of scenes are scattered all over the Inter tree.

    -

    As this is called, Synoptic Utilities has already formed a list scene_nodes +

    As this is called, Synoptic Utilities has already formed a list scene_nodes of instances having the kind K_scene.

    -void SynopticScenes::compile(inter_tree *I, tree_inventory *inv) {
    +void SynopticScenes::compile(inter_tree *I, tree_inventory *inv) {
         if (TreeLists::len(inv->scene_nodes) > 0) {
    -        TreeLists::sort(inv->scene_nodes, Synoptic::module_order);
    +        TreeLists::sort(inv->scene_nodes, Synoptic::module_order);
         }
    -    Define SHOWSCENESTATUS function1.1;
    -    Define DETECTSCENECHANGE function1.2;
    +    Define SHOWSCENESTATUS function1.1;
    +    Define DETECTSCENECHANGE function1.2;
     }
     

    §1.1. Define SHOWSCENESTATUS function1.1 = @@ -94,15 +94,15 @@ of instances having the kind

         inter_name *iname = HierarchyLocations::find(I, SHOWSCENESTATUS_HL);
    -    Synoptic::begin_function(I, iname);
    +    Synoptic::begin_function(I, iname);
         for (int i=0; i<TreeLists::len(inv->scene_nodes); i++) {
             inter_package *pack = Inter::Package::defined_by_frame(inv->scene_nodes->list[i].node);
             inter_symbol *ssf_s = Metadata::read_symbol(pack, I"^scene_status_fn");
             Produce::inv_call(I, ssf_s);
         }
    -    Synoptic::end_function(I, iname);
    +    Synoptic::end_function(I, iname);
     
    - +

    §1.2. There is one argument, chs: the number of iterations so far. Iterations occur because each set of scene changes could change the circumstances in such a way that other scene changes are now required (through external conditions, @@ -118,8 +118,8 @@ whether any change in status has or has not occurred.

         inter_name *iname = HierarchyLocations::find(I, DETECTSCENECHANGE_HL);
    -    Synoptic::begin_function(I, iname);
    -    inter_symbol *chs_s = Synoptic::local(I, I"chs", NULL);
    +    Synoptic::begin_function(I, iname);
    +    inter_symbol *chs_s = Synoptic::local(I, I"chs", NULL);
         inter_symbol *Again_l = Produce::reserve_label(I, I".Again");
         inter_symbol *CScene_l = Produce::reserve_label(I, I".CScene");
         Produce::place_label(I, Again_l);
    @@ -166,11 +166,11 @@ whether any change in status has or has not occurred.
         Produce::down(I);
             Produce::lab(I, Again_l);
         Produce::up(I);
    -    Synoptic::end_function(I, iname);
    +    Synoptic::end_function(I, iname);
     
    - +
    diff --git a/docs/pipeline-module/3-sh.html b/docs/pipeline-module/4-sh.html similarity index 97% rename from docs/pipeline-module/3-sh.html rename to docs/pipeline-module/4-sh.html index 1ad01d710..b14af527a 100644 --- a/docs/pipeline-module/3-sh.html +++ b/docs/pipeline-module/4-sh.html @@ -62,10 +62,10 @@
    +

    The layout and naming conventions for the contents of the main/synoptic module.

    -
    +

    §1.

    @@ -75,23 +75,23 @@ if (SynopticHierarchy_established) return; SynopticHierarchy_established = TRUE; location_requirement req; - Establish actions1.2; - Establish activities1.4; - Establish chronology1.6; - Establish conjugations1.8; - Establish extensions1.10; - Establish instances1.12; - Establish kinds1.14; - Establish multimedia1.16; - Establish properties1.18; - Establish relations1.20; - Establish rulebooks1.22; - Establish rules1.24; - Establish scenes1.26; - Establish tables1.28; - Establish tests1.30; - Establish use options1.32; - Establish kit-defined resources1.34; + Establish actions1.2; + Establish activities1.4; + Establish chronology1.6; + Establish conjugations1.8; + Establish extensions1.10; + Establish instances1.12; + Establish kinds1.14; + Establish multimedia1.16; + Establish properties1.18; + Establish relations1.20; + Establish rulebooks1.22; + Establish rules1.24; + Establish scenes1.26; + Establish tables1.28; + Establish tests1.30; + Establish use options1.32; + Establish kit-defined resources1.34; }

    §1.1.

    @@ -133,7 +133,7 @@ SYN_CONST(CCOUNT_ACTION_NAME_HL, I"CCOUNT_ACTION_NAME") SYN_FUNCT(DB_ACTION_DETAILS_HL, I"DB_Action_Details_fn", I"DB_Action_Details") - +

    §1.3. Activities.

    enum ACTIVITY_AFTER_RULEBOOKS_HL
    @@ -153,7 +153,7 @@
             SYN_CONST(ACTIVITY_FOR_RULEBOOKS_HL,      I"Activity_for_rulebooks")
             SYN_CONST(ACTIVITY_VAR_CREATORS_HL,       I"activity_var_creators")
     
    - +

    §1.5. Chronology.

    enum TIMEDEVENTSTABLE_HL
    @@ -175,7 +175,7 @@
             SYN_CONST(NO_PAST_TENSE_ACTIONS_HL,       I"NO_PAST_TENSE_ACTIONS")
             SYN_FUNCT(TESTSINGLEPASTSTATE_HL,         I"test_fn", I"TestSinglePastState")
     
    - +

    §1.7. Conjugations.

    enum TABLEOFVERBS_HL
    @@ -187,7 +187,7 @@
         SYN_SUBMD(I"conjugations")
             SYN_CONST(TABLEOFVERBS_HL,                I"TableOfVerbs")
     
    - +

    §1.9. Extensions.

    enum SHOWEXTENSIONVERSIONS_HL
    @@ -203,7 +203,7 @@
             SYN_FUNCT(SHOWFULLEXTENSIONVERSIONS_HL,   I"showfullextensionversions_fn", I"ShowFullExtensionVersions")
             SYN_FUNCT(SHOWONEEXTENSION_HL,            I"showoneextension_fn", I"ShowOneExtension")
     
    - +

    §1.11. Instances.

    enum SHOWMEINSTANCEDETAILS_HL
    @@ -215,7 +215,7 @@
         SYN_SUBMD(I"instances")
             SYN_FUNCT(SHOWMEINSTANCEDETAILS_HL,       I"showmeinstancedetails_fn", I"ShowMeInstanceDetails")
     
    - +

    §1.13. Kinds.

    enum DEFAULTVALUEOFKOV_HL
    @@ -249,7 +249,7 @@
             SYN_CONST(RUCKSACK_CLASS_HL,              I"RUCKSACK_CLASS")
             SYN_CONST(KINDHIERARCHY_HL,               I"KindHierarchy")
     
    - +

    §1.15. Multimedia.

    enum RESOURCEIDSOFFIGURES_HL
    @@ -267,7 +267,7 @@
             SYN_CONST(NO_EXTERNAL_FILES_HL,           I"NO_EXTERNAL_FILES")
             SYN_CONST(TABLEOFEXTERNALFILES_HL,        I"TableOfExternalFiles")
     
    - +

    §1.17. Properties.

    enum CCOUNT_PROPERTY_HL
    @@ -279,7 +279,7 @@
         SYN_SUBMD(I"properties")
             SYN_CONST(CCOUNT_PROPERTY_HL,             I"CCOUNT_PROPERTY")
     
    - +

    §1.19. Relations.

    enum CREATEDYNAMICRELATIONS_HL
    @@ -297,7 +297,7 @@
             SYN_FUNCT(ITERATERELATIONS_HL,            I"iterator_fn", I"IterateRelations")
             SYN_FUNCT(RPROPERTY_HL,                   I"property_fn", I"RProperty")
     
    - +

    §1.21. Rulebooks.

    enum NUMBER_RULEBOOKS_CREATED_HL
    @@ -317,7 +317,7 @@
             SYN_CONST(RULEBOOKS_ARRAY_HL,             I"rulebooks_array")
             SYN_CONST(RULEBOOKNAMES_HL,               I"RulebookNames")
     
    - +

    §1.23. Rules.

    enum RULEPRINTINGRULE_HL
    @@ -339,7 +339,7 @@
             SYN_CONST(NO_RESPONSES_HL,                I"NO_RESPONSES")
             SYN_FUNCT(PRINT_RESPONSE_HL,              I"print_fn", I"PrintResponse")
     
    - +

    §1.25. Scenes.

    enum SHOWSCENESTATUS_HL
    @@ -353,7 +353,7 @@
             SYN_FUNCT(SHOWSCENESTATUS_HL,             I"show_scene_status_fn", I"ShowSceneStatus")
             SYN_FUNCT(DETECTSCENECHANGE_HL,           I"detect_scene_change_fn", I"DetectSceneChange")
     
    - +

    §1.27. Tables.

    enum PRINT_TABLE_HL
    @@ -375,7 +375,7 @@
         SYN_SUBMD(I"table_columns")
             SYN_FUNCT(TC_KOV_HL,                      I"weak_kind_ID_of_column_entry_fn", I"TC_KOV")
     
    - +

    §1.29. Tests.

    enum TESTSCRIPTSUB_HL
    @@ -387,7 +387,7 @@
         SYN_SUBMD(I"tests")
             SYN_FUNCT(TESTSCRIPTSUB_HL,               I"test_fn", I"TestScriptSub")
     
    - +

    §1.31. Use options.

    enum NO_USE_OPTIONS_HL
    @@ -403,7 +403,7 @@
             SYN_FUNCT(TESTUSEOPTION_HL,               I"test_fn", I"TestUseOption")
             SYN_FUNCT(PRINT_USE_OPTION_HL,            I"print_fn", I"PrintUseOption")
     
    - +

    §1.33. Kit-defined symbols. The Inform 7 compiler creates none of the constants below. (Note that some are the addresses of functions, but they are constants for our purposes here.) Instead, they are defined using Inform 6 notation in one of the kits. We don't @@ -896,9 +896,9 @@ need to know which kit; we simply leaves them as "plugs" to be connected to KIT_PROVIDED(WORDINPROPERTY_HL, I"WordInProperty") KIT_PROVIDED(WORDLENGTH_HL, I"WordLength") -

    +
    diff --git a/docs/pipeline-module/3-su.html b/docs/pipeline-module/4-su.html similarity index 85% rename from docs/pipeline-module/3-su.html rename to docs/pipeline-module/4-su.html index 7dac11a43..d1f28ef12 100644 --- a/docs/pipeline-module/3-su.html +++ b/docs/pipeline-module/4-su.html @@ -70,18 +70,18 @@ function togglePopup(material_id) {
    +

    Managing the generation of code and arrays in the synoptic module, which is put together from resources all over the Inter tree.

    -
    +

    §1. Pipeline stage. This stage...

    -void Synoptic::create_pipeline_stage(void) {
    -    CodeGen::Stage::new(I"consolidate-text",
    -        Synoptic::go, NO_STAGE_ARG, FALSE);
    +void Synoptic::create_pipeline_stage(void) {
    +    ParsingPipelines::new_stage(I"consolidate-text",
    +        Synoptic::go, NO_STAGE_ARG, FALSE);
     }
     
     typedef struct tree_inventory {
    @@ -130,34 +130,34 @@ function togglePopup(material_id) {
         inv->items = NEW_LINKED_LIST(tree_inventory_item);
         inv->text_nodes = TreeLists::new();
     
    -    inv->response_nodes = Synoptic::add_inventory_need(inv, I"_response");
    -    inv->rulebook_nodes = Synoptic::add_inventory_need(inv, I"_rulebook");
    -    inv->rule_nodes = Synoptic::add_inventory_need(inv, I"_rule");
    -    inv->activity_nodes = Synoptic::add_inventory_need(inv, I"_activity");
    -    inv->action_nodes = Synoptic::add_inventory_need(inv, I"_action");
    -    inv->property_nodes = Synoptic::add_inventory_need(inv, I"_property");
    -    inv->relation_nodes = Synoptic::add_inventory_need(inv, I"_relation");
    -    inv->table_nodes = Synoptic::add_inventory_need(inv, I"_table");
    -    inv->table_column_nodes = Synoptic::add_inventory_need(inv, I"_table_column");
    -    inv->table_column_usage_nodes = Synoptic::add_inventory_need(inv, I"_table_column_usage");
    -    inv->action_history_condition_nodes = Synoptic::add_inventory_need(inv, I"_action_history_condition");
    -    inv->past_tense_condition_nodes = Synoptic::add_inventory_need(inv, I"_past_condition");
    -    inv->use_option_nodes = Synoptic::add_inventory_need(inv, I"_use_option");
    -    inv->verb_nodes = Synoptic::add_inventory_need(inv, I"_verb");
    -    inv->modal_verb_nodes = Synoptic::add_inventory_need(inv, I"_modal_verb");
    -    inv->verb_form_nodes = Synoptic::add_inventory_need(inv, I"_verb_form");
    -    inv->preposition_nodes = Synoptic::add_inventory_need(inv, I"_preposition");
    -    inv->adjective_nodes = Synoptic::add_inventory_need(inv, I"_adjective");
    -    inv->derived_kind_nodes = Synoptic::add_inventory_need(inv, I"_derived_kind");
    -    inv->kind_nodes = Synoptic::add_inventory_need(inv, I"_kind");
    -    inv->module_nodes = Synoptic::add_inventory_need(inv, I"_module");
    -    inv->instance_nodes = Synoptic::add_inventory_need(inv, I"_instance");
    -    inv->test_nodes = Synoptic::add_inventory_need(inv, I"_test");
    -    inv->named_action_pattern_nodes = Synoptic::add_inventory_need(inv, I"_named_action_pattern");
    -    inv->variable_nodes = Synoptic::add_inventory_need(inv, I"_variable");
    -    inv->equation_nodes = Synoptic::add_inventory_need(inv, I"_equation");
    -    inv->heading_nodes = Synoptic::add_inventory_need(inv, I"_heading");
    -    inv->multiplication_rule_nodes = Synoptic::add_inventory_need(inv, I"_multiplication_rule");
    +    inv->response_nodes = Synoptic::add_inventory_need(inv, I"_response");
    +    inv->rulebook_nodes = Synoptic::add_inventory_need(inv, I"_rulebook");
    +    inv->rule_nodes = Synoptic::add_inventory_need(inv, I"_rule");
    +    inv->activity_nodes = Synoptic::add_inventory_need(inv, I"_activity");
    +    inv->action_nodes = Synoptic::add_inventory_need(inv, I"_action");
    +    inv->property_nodes = Synoptic::add_inventory_need(inv, I"_property");
    +    inv->relation_nodes = Synoptic::add_inventory_need(inv, I"_relation");
    +    inv->table_nodes = Synoptic::add_inventory_need(inv, I"_table");
    +    inv->table_column_nodes = Synoptic::add_inventory_need(inv, I"_table_column");
    +    inv->table_column_usage_nodes = Synoptic::add_inventory_need(inv, I"_table_column_usage");
    +    inv->action_history_condition_nodes = Synoptic::add_inventory_need(inv, I"_action_history_condition");
    +    inv->past_tense_condition_nodes = Synoptic::add_inventory_need(inv, I"_past_condition");
    +    inv->use_option_nodes = Synoptic::add_inventory_need(inv, I"_use_option");
    +    inv->verb_nodes = Synoptic::add_inventory_need(inv, I"_verb");
    +    inv->modal_verb_nodes = Synoptic::add_inventory_need(inv, I"_modal_verb");
    +    inv->verb_form_nodes = Synoptic::add_inventory_need(inv, I"_verb_form");
    +    inv->preposition_nodes = Synoptic::add_inventory_need(inv, I"_preposition");
    +    inv->adjective_nodes = Synoptic::add_inventory_need(inv, I"_adjective");
    +    inv->derived_kind_nodes = Synoptic::add_inventory_need(inv, I"_derived_kind");
    +    inv->kind_nodes = Synoptic::add_inventory_need(inv, I"_kind");
    +    inv->module_nodes = Synoptic::add_inventory_need(inv, I"_module");
    +    inv->instance_nodes = Synoptic::add_inventory_need(inv, I"_instance");
    +    inv->test_nodes = Synoptic::add_inventory_need(inv, I"_test");
    +    inv->named_action_pattern_nodes = Synoptic::add_inventory_need(inv, I"_named_action_pattern");
    +    inv->variable_nodes = Synoptic::add_inventory_need(inv, I"_variable");
    +    inv->equation_nodes = Synoptic::add_inventory_need(inv, I"_equation");
    +    inv->heading_nodes = Synoptic::add_inventory_need(inv, I"_heading");
    +    inv->multiplication_rule_nodes = Synoptic::add_inventory_need(inv, I"_multiplication_rule");
     
         inv->extension_nodes = TreeLists::new();
         inv->scene_nodes = TreeLists::new();
    @@ -183,7 +183,7 @@ function togglePopup(material_id) {
     
     void Synoptic::perform_inventory(tree_inventory *inv) {
         inter_tree *I = inv->of_tree;
    -    InterTree::traverse(I, Synoptic::visitor, inv, NULL, 0);
    +    InterTree::traverse(I, Synoptic::visitor, inv, NULL, 0);
         for (int i=0; i<TreeLists::len(inv->module_nodes); i++) {
             inter_package *pack = Inter::Package::defined_by_frame(inv->module_nodes->list[i].node);
             if (InterSymbolsTables::symbol_from_name(Inter::Packages::scope(pack), I"extension_id"))
    @@ -227,46 +227,46 @@ function togglePopup(material_id) {
     tree_inventory *Synoptic::inv(inter_tree *I) {
         if (cache_is_for == I) return cached_inventory;
         cache_is_for = I;
    -    cached_inventory = Synoptic::new_inventory(I);
    -    Synoptic::perform_inventory(cached_inventory);
    +    cached_inventory = Synoptic::new_inventory(I);
    +    Synoptic::perform_inventory(cached_inventory);
         return cached_inventory;
     }
     
     int Synoptic::go(pipeline_step *step) {
    -    tree_inventory *inv = Synoptic::inv(step->repository);
    +    tree_inventory *inv = Synoptic::inv(step->ephemera.repository);
     
    -    SynopticText::compile(step->repository, inv);
    -    SynopticActions::compile(step->repository, inv);
    -    SynopticActivities::compile(step->repository, inv);
    -    SynopticChronology::compile(step->repository, inv);
    -    SynopticExtensions::compile(step->repository, inv);
    -    SynopticInstances::compile(step->repository, inv);
    -    SynopticKinds::compile(step->repository, inv);
    -    SynopticMultimedia::compile(step->repository, inv);
    -    SynopticProperties::compile(step->repository, inv);
    -    SynopticRelations::compile(step->repository, inv);
    -    SynopticResponses::compile(step->repository, inv);
    -    SynopticRules::compile(step->repository, inv);
    -    SynopticScenes::compile(step->repository, inv);
    -    SynopticTables::compile(step->repository, inv);
    -    SynopticUseOptions::compile(step->repository, inv);
    -    SynopticVerbs::compile(step->repository, inv);
    -    SynopticTests::compile(step->repository, inv);
    +    SynopticText::compile(step->ephemera.repository, inv);
    +    SynopticActions::compile(step->ephemera.repository, inv);
    +    SynopticActivities::compile(step->ephemera.repository, inv);
    +    SynopticChronology::compile(step->ephemera.repository, inv);
    +    SynopticExtensions::compile(step->ephemera.repository, inv);
    +    SynopticInstances::compile(step->ephemera.repository, inv);
    +    SynopticKinds::compile(step->ephemera.repository, inv);
    +    SynopticMultimedia::compile(step->ephemera.repository, inv);
    +    SynopticProperties::compile(step->ephemera.repository, inv);
    +    SynopticRelations::compile(step->ephemera.repository, inv);
    +    SynopticResponses::compile(step->ephemera.repository, inv);
    +    SynopticRules::compile(step->ephemera.repository, inv);
    +    SynopticScenes::compile(step->ephemera.repository, inv);
    +    SynopticTables::compile(step->ephemera.repository, inv);
    +    SynopticUseOptions::compile(step->ephemera.repository, inv);
    +    SynopticVerbs::compile(step->ephemera.repository, inv);
    +    SynopticTests::compile(step->ephemera.repository, inv);
         return TRUE;
     }
     
    - +

    §2.

    -int Synoptic::module_order(const void *ent1, const void *ent2) {
    +int Synoptic::module_order(const void *ent1, const void *ent2) {
         itl_entry *E1 = (itl_entry *) ent1;
         itl_entry *E2 = (itl_entry *) ent2;
         if (E1 == E2) return 0;
         inter_tree_node *P1 = E1->node;
         inter_tree_node *P2 = E2->node;
    -    inter_package *mod1 = Synoptic::module_containing(P1);
    -    inter_package *mod2 = Synoptic::module_containing(P2);
    +    inter_package *mod1 = Synoptic::module_containing(P1);
    +    inter_package *mod2 = Synoptic::module_containing(P2);
         inter_ti C1 = Metadata::read_optional_numeric(mod1, I"^category");
         inter_ti C2 = Metadata::read_optional_numeric(mod2, I"^category");
         int d = ((int) C2) - ((int) C1);  larger values sort earlier
    @@ -274,7 +274,7 @@ function togglePopup(material_id) {
         return E1->sort_key - E2->sort_key;  smaller values sort earlier
     }
     
    -int Synoptic::category_order(const void *ent1, const void *ent2) {
    +int Synoptic::category_order(const void *ent1, const void *ent2) {
         itl_entry *E1 = (itl_entry *) ent1;
         itl_entry *E2 = (itl_entry *) ent2;
         if (E1 == E2) return 0;
    @@ -292,11 +292,11 @@ function togglePopup(material_id) {
     

    §3. Redefinition.

    -inter_symbol *Synoptic::new_symbol(inter_package *pack, text_stream *name) {
    +inter_symbol *Synoptic::new_symbol(inter_package *pack, text_stream *name) {
         return InterSymbolsTables::create_with_unique_name(Inter::Packages::scope(pack), name);
     }
     
    -inter_symbol *Synoptic::get_symbol(inter_package *pack, text_stream *name) {
    +inter_symbol *Synoptic::get_symbol(inter_package *pack, text_stream *name) {
         inter_symbol *loc_s = InterSymbolsTables::symbol_from_name(Inter::Packages::scope(pack), name);
         if (loc_s == NULL) Metadata::err("package symbol not found", pack, name);
         return loc_s;
    @@ -305,7 +305,7 @@ function togglePopup(material_id) {
     

    §4.

    -void Synoptic::def_textual_constant(inter_tree *I, inter_symbol *con_s, text_stream *S, inter_bookmark *IBM) {
    +void Synoptic::def_textual_constant(inter_tree *I, inter_symbol *con_s, text_stream *S, inter_bookmark *IBM) {
         Inter::Symbols::annotate_i(con_s, TEXT_LITERAL_IANN, 1);
         inter_ti ID = Inter::Warehouse::create_text(InterTree::warehouse(I),
             Inter::Bookmarks::package(IBM));
    @@ -321,12 +321,12 @@ function togglePopup(material_id) {
     
     inter_package *synoptic_fn_package = NULL;
     packaging_state synoptic_fn_ps;
    -void Synoptic::begin_function(inter_tree *I, inter_name *iname) {
    +void Synoptic::begin_function(inter_tree *I, inter_name *iname) {
         synoptic_fn_package = Produce::block(I, &synoptic_fn_ps, iname);
     }
    -void Synoptic::end_function(inter_tree *I, inter_name *iname) {
    +void Synoptic::end_function(inter_tree *I, inter_name *iname) {
         Produce::end_block(I);
    -    Synoptic::function(I, iname, synoptic_fn_package);
    +    Synoptic::function(I, iname, synoptic_fn_package);
         Produce::end_main_block(I, synoptic_fn_ps);
     }
     
    @@ -338,14 +338,14 @@ function togglePopup(material_id) {
             block,
             Produce::baseline(Packaging::at(I)), NULL));
     }
    -inter_symbol *Synoptic::local(inter_tree *I, text_stream *name,
    +inter_symbol *Synoptic::local(inter_tree *I, text_stream *name,
         text_stream *comment) {
         return Produce::local(I, K_value, name, 0, comment);
     }
     
     inter_tree_node *synoptic_array_node = NULL;
     packaging_state synoptic_array_ps;
    -void Synoptic::begin_array(inter_tree *I, inter_name *iname) {
    +void Synoptic::begin_array(inter_tree *I, inter_name *iname) {
         synoptic_array_ps = Packaging::enter_home_of(iname);
         inter_symbol *con_s = Produce::define_symbol(iname);
         synoptic_array_node = Inode::fill_3(Packaging::at(I), CONSTANT_IST,
    @@ -353,7 +353,7 @@ function togglePopup(material_id) {
              InterSymbolsTables::id_from_IRS_and_symbol(Packaging::at(I), list_of_unchecked_kind_symbol),
              CONSTANT_INDIRECT_LIST, NULL, (inter_ti) Inter::Bookmarks::baseline(Packaging::at(I)) + 1);
     }
    -void Synoptic::end_array(inter_tree *I) {
    +void Synoptic::end_array(inter_tree *I) {
         inter_error_message *E =
             Inter::Defn::verify_construct(Inter::Bookmarks::package(Packaging::at(I)), synoptic_array_node);
         if (E) {
    @@ -364,12 +364,12 @@ function togglePopup(material_id) {
         Packaging::exit(I, synoptic_array_ps);
     }
     
    -void Synoptic::numeric_entry(inter_ti val2) {
    +void Synoptic::numeric_entry(inter_ti val2) {
         if (Inode::extend(synoptic_array_node, 2) == FALSE) internal_error("cannot extend");
         synoptic_array_node->W.data[synoptic_array_node->W.extent-2] = LITERAL_IVAL;
         synoptic_array_node->W.data[synoptic_array_node->W.extent-1] = val2;
     }
    -void Synoptic::symbol_entry(inter_symbol *S) {
    +void Synoptic::symbol_entry(inter_symbol *S) {
         if (Inode::extend(synoptic_array_node, 2) == FALSE) internal_error("cannot extend");
         inter_package *pack = Inter::Packages::container(synoptic_array_node);
         inter_symbol *local_S = InterSymbolsTables::create_with_unique_name(Inter::Packages::scope(pack), S->symbol_name);
    @@ -379,7 +379,7 @@ function togglePopup(material_id) {
         synoptic_array_node->W.data[synoptic_array_node->W.extent-2] = ALIAS_IVAL;
         synoptic_array_node->W.data[synoptic_array_node->W.extent-1] = val2;
     }
    -void Synoptic::textual_entry(text_stream *text) {
    +void Synoptic::textual_entry(text_stream *text) {
         if (Inode::extend(synoptic_array_node, 2) == FALSE) internal_error("cannot extend");
         inter_package *pack = Inter::Packages::container(synoptic_array_node);
         inter_tree *I = Inter::Packages::tree(pack);
    @@ -390,7 +390,7 @@ function togglePopup(material_id) {
         synoptic_array_node->W.data[synoptic_array_node->W.extent-1] = val2;
     }
     
    -inter_tree_node *Synoptic::get_definition(inter_package *pack, text_stream *name) {
    +inter_tree_node *Synoptic::get_definition(inter_package *pack, text_stream *name) {
         inter_symbol *def_s = InterSymbolsTables::symbol_from_name(Inter::Packages::scope(pack), name);
         if (def_s == NULL) {
             LOG("Unable to find symbol %S in $6\n", name, pack);
    @@ -404,7 +404,7 @@ function togglePopup(material_id) {
         return D;
     }
     
    -inter_tree_node *Synoptic::get_optional_definition(inter_package *pack, text_stream *name) {
    +inter_tree_node *Synoptic::get_optional_definition(inter_package *pack, text_stream *name) {
         inter_symbol *def_s = InterSymbolsTables::symbol_from_name(Inter::Packages::scope(pack), name);
         if (def_s == NULL) return NULL;
         inter_tree_node *D = def_s->definition;
    @@ -412,7 +412,7 @@ function togglePopup(material_id) {
         return D;
     }
     
    -inter_package *Synoptic::module_containing(inter_tree_node *P) {
    +inter_package *Synoptic::module_containing(inter_tree_node *P) {
         inter_package *pack = Inter::Packages::container(P);
         inter_tree *I = Inter::Packages::tree(pack);
         while (pack) {
    @@ -424,7 +424,7 @@ function togglePopup(material_id) {
     }
     
    diff --git a/docs/pipeline-module/3-tbl.html b/docs/pipeline-module/4-tbl.html similarity index 93% rename from docs/pipeline-module/3-tbl.html rename to docs/pipeline-module/4-tbl.html index 50cf80692..ee220d8e1 100644 --- a/docs/pipeline-module/3-tbl.html +++ b/docs/pipeline-module/4-tbl.html @@ -70,14 +70,14 @@ function togglePopup(material_id) {
    +

    To compile the main/synoptic/tables submodule.

    §1. Before this runs, table packages are scattered all over the Inter tree. We must allocate each one a unique ID.

    -

    As this is called, Synoptic Utilities has already formed a list table_nodes +

    As this is called, Synoptic Utilities has already formed a list table_nodes of packages of type _table.

    @@ -89,42 +89,42 @@ by index within the current table: see
    -void SynopticTables::compile(inter_tree *I, tree_inventory *inv) {
    +void SynopticTables::compile(inter_tree *I, tree_inventory *inv) {
         if (TreeLists::len(inv->table_nodes) > 0) {
    -        TreeLists::sort(inv->table_nodes, Synoptic::module_order);
    +        TreeLists::sort(inv->table_nodes, Synoptic::module_order);
             for (int i=0; i<TreeLists::len(inv->table_nodes); i++) {
                 inter_package *pack = Inter::Package::defined_by_frame(inv->table_nodes->list[i].node);
    -            inter_tree_node *D = Synoptic::get_definition(pack, I"table_id");
    +            inter_tree_node *D = Synoptic::get_definition(pack, I"table_id");
                 D->W.data[DATA_CONST_IFLD+1] = (inter_ti) (i + 1);
             }
         }
         if (TreeLists::len(inv->table_column_nodes) > 0) {
    -        TreeLists::sort(inv->table_column_nodes, Synoptic::module_order);
    +        TreeLists::sort(inv->table_column_nodes, Synoptic::module_order);
             for (int i=0; i<TreeLists::len(inv->table_column_nodes); i++) {
                 inter_package *pack = Inter::Package::defined_by_frame(inv->table_column_nodes->list[i].node);
    -            inter_tree_node *D = Synoptic::get_definition(pack, I"table_column_id");
    +            inter_tree_node *D = Synoptic::get_definition(pack, I"table_column_id");
                 D->W.data[DATA_CONST_IFLD+1] = (inter_ti) (i + 100);
             }
         }
         if (TreeLists::len(inv->table_column_usage_nodes) > 0) {
    -        TreeLists::sort(inv->table_column_usage_nodes, Synoptic::module_order);
    +        TreeLists::sort(inv->table_column_usage_nodes, Synoptic::module_order);
             for (int i=0; i<TreeLists::len(inv->table_column_usage_nodes); i++) {
                 inter_package *pack = Inter::Package::defined_by_frame(inv->table_column_usage_nodes->list[i].node);
    -            inter_tree_node *ID = Synoptic::get_definition(pack, I"column_identity");
    +            inter_tree_node *ID = Synoptic::get_definition(pack, I"column_identity");
                 inter_symbol *id_s = NULL;
                 if (ID->W.data[DATA_CONST_IFLD] == ALIAS_IVAL)
                     id_s = InterSymbolsTables::symbol_from_id(Inter::Packages::scope(pack), ID->W.data[DATA_CONST_IFLD+1]);
                 if (id_s == NULL) internal_error("column_identity not an ALIAS_IVAL");
                 ID = Inter::Symbols::definition(id_s);
    -            inter_tree_node *D = Synoptic::get_definition(pack, I"column_bits");
    +            inter_tree_node *D = Synoptic::get_definition(pack, I"column_bits");
                 D->W.data[DATA_CONST_IFLD+1] += ID->W.data[DATA_CONST_IFLD+1];
             }
         }
    -    Define TABLEOFTABLES array1.1;
    -    Define PRINT_TABLE function1.2;
    -    Define TC_KOV function1.3;
    -    Define TB_BLANKS array1.4;
    -    Define RANKING_TABLE constant1.5;
    +    Define TABLEOFTABLES array1.1;
    +    Define PRINT_TABLE function1.2;
    +    Define TC_KOV function1.3;
    +    Define TB_BLANKS array1.4;
    +    Define RANKING_TABLE constant1.5;
     }
     

    §1.1. Define TABLEOFTABLES array1.1 = @@ -132,25 +132,25 @@ by index within the current table: see inter_name *iname = HierarchyLocations::find(I, TABLEOFTABLES_HL); - Synoptic::begin_array(I, iname); - Synoptic::symbol_entry(InterNames::to_symbol(HierarchyLocations::find(I, THEEMPTYTABLE_HL))); + Synoptic::begin_array(I, iname); + Synoptic::symbol_entry(InterNames::to_symbol(HierarchyLocations::find(I, THEEMPTYTABLE_HL))); for (int i=0; i<TreeLists::len(inv->table_nodes); i++) { inter_package *pack = Inter::Package::defined_by_frame(inv->table_nodes->list[i].node); inter_symbol *value_s = Metadata::read_symbol(pack, I"^value"); - Synoptic::symbol_entry(value_s); + Synoptic::symbol_entry(value_s); } - Synoptic::numeric_entry(0); - Synoptic::numeric_entry(0); - Synoptic::end_array(I); + Synoptic::numeric_entry(0); + Synoptic::numeric_entry(0); + Synoptic::end_array(I); -

    +

    §1.2. Define PRINT_TABLE function1.2 =

         inter_name *iname = HierarchyLocations::find(I, PRINT_TABLE_HL);
    -    Synoptic::begin_function(I, iname);
    -    inter_symbol *T_s = Synoptic::local(I, I"T", NULL);
    +    Synoptic::begin_function(I, iname);
    +    inter_symbol *T_s = Synoptic::local(I, I"T", NULL);
         Produce::inv_primitive(I, SWITCH_BIP);
         Produce::down(I);
             Produce::val_symbol(I, K_value, T_s);
    @@ -200,17 +200,17 @@ by index within the current table: see             Produce::up(I);
             Produce::up(I);
         Produce::up(I);
    -    Synoptic::end_function(I, iname);
    +    Synoptic::end_function(I, iname);
     
    - +

    §1.3. Define TC_KOV function1.3 =

         inter_name *iname = HierarchyLocations::find(I, TC_KOV_HL);
    -    Synoptic::begin_function(I, iname);
    -    inter_symbol *tc_s = Synoptic::local(I, I"tc", NULL);
    -    inter_symbol *unk_s = Synoptic::local(I, I"unk", NULL);
    +    Synoptic::begin_function(I, iname);
    +    inter_symbol *tc_s = Synoptic::local(I, I"tc", NULL);
    +    inter_symbol *unk_s = Synoptic::local(I, I"unk", NULL);
         Produce::inv_primitive(I, SWITCH_BIP);
         Produce::down(I);
             Produce::val_symbol(I, K_value, tc_s);
    @@ -239,34 +239,34 @@ by index within the current table: see     Produce::down(I);
             Produce::val_symbol(I, K_value, unk_s);
         Produce::up(I);
    -    Synoptic::end_function(I, iname);
    +    Synoptic::end_function(I, iname);
     
    - +

    §1.4. Define TB_BLANKS array1.4 =

         inter_name *iname = HierarchyLocations::find(I, TB_BLANKS_HL);
         Produce::annotate_iname_i(iname, BYTEARRAY_IANN, 1);
    -    Synoptic::begin_array(I, iname);
    +    Synoptic::begin_array(I, iname);
         inter_ti hwm = 0;
         for (int i=0; i<TreeLists::len(inv->table_column_usage_nodes); i++) {
             inter_package *pack = Inter::Package::defined_by_frame(inv->table_column_usage_nodes->list[i].node);
    -        inter_tree_node *D = Synoptic::get_optional_definition(pack, I"column_blanks");
    +        inter_tree_node *D = Synoptic::get_optional_definition(pack, I"column_blanks");
             if (D) {
                 D->W.data[DATA_CONST_IFLD+1] = hwm;
    -            inter_tree_node *B = Synoptic::get_definition(pack, I"^column_blank_data");
    +            inter_tree_node *B = Synoptic::get_definition(pack, I"^column_blank_data");
                 for (int i=DATA_CONST_IFLD; i<B->W.extent; i=i+2) {
    -                Synoptic::numeric_entry(B->W.data[i+1]);
    +                Synoptic::numeric_entry(B->W.data[i+1]);
                     hwm++;
                 }
             }
         }
    -    Synoptic::numeric_entry(0);
    -    Synoptic::numeric_entry(0);
    -    Synoptic::end_array(I);
    +    Synoptic::numeric_entry(0);
    +    Synoptic::numeric_entry(0);
    +    Synoptic::end_array(I);
     
    - +

    §1.5. Define RANKING_TABLE constant1.5 =

    @@ -285,9 +285,9 @@ by index within the current table: see } if (found == FALSE) Produce::numeric_constant(I, iname, K_value, 0); - +
    diff --git a/docs/pipeline-module/3-tst.html b/docs/pipeline-module/4-tst.html similarity index 91% rename from docs/pipeline-module/3-tst.html rename to docs/pipeline-module/4-tst.html index ecc0a3b33..e30d4718b 100644 --- a/docs/pipeline-module/3-tst.html +++ b/docs/pipeline-module/4-tst.html @@ -70,20 +70,20 @@ function togglePopup(material_id) {
    +

    To compile the main/synoptic/tests submodule.

    -

    §1. As this is called, Synoptic Utilities has already formed a list of packages +

    §1. As this is called, Synoptic Utilities has already formed a list of packages of type _test.

    -void SynopticTests::compile(inter_tree *I, tree_inventory *inv) {
    +void SynopticTests::compile(inter_tree *I, tree_inventory *inv) {
         if (TreeLists::len(inv->test_nodes) > 0) {
    -        TreeLists::sort(inv->test_nodes, Synoptic::module_order);
    +        TreeLists::sort(inv->test_nodes, Synoptic::module_order);
         }
     
    -    Define TESTSCRIPTSUB function1.1;
    +    Define TESTSCRIPTSUB function1.1;
     }
     

    §1.1. Define TESTSCRIPTSUB function1.1 = @@ -91,7 +91,7 @@ of type _test.

         inter_name *iname = HierarchyLocations::find(I, TESTSCRIPTSUB_HL);
    -    Synoptic::begin_function(I, iname);
    +    Synoptic::begin_function(I, iname);
         if (TreeLists::len(inv->test_nodes) == 0) {
             Produce::inv_primitive(I, PRINT_BIP);
             Produce::down(I);
    @@ -107,8 +107,8 @@ of type _test.
                         inter_package *pack = Inter::Package::defined_by_frame(inv->test_nodes->list[i].node);
                         text_stream *name = Metadata::read_textual(pack, I"^name");
                         inter_ti len = Metadata::read_numeric(pack, I"^length");
    -                    inter_symbol *text_s = Synoptic::get_symbol(pack, I"script");
    -                    inter_symbol *req_s = Synoptic::get_symbol(pack, I"requirements");
    +                    inter_symbol *text_s = Synoptic::get_symbol(pack, I"script");
    +                    inter_symbol *req_s = Synoptic::get_symbol(pack, I"requirements");
                         Produce::inv_primitive(I, CASE_BIP);
                         Produce::down(I);
                             Produce::val_dword(I, name);
    @@ -152,11 +152,11 @@ of type _test.
                 Produce::up(I);
             Produce::up(I);
         }
    -    Synoptic::end_function(I, iname);
    +    Synoptic::end_function(I, iname);
     
    - +
    diff --git a/docs/pipeline-module/3-uo.html b/docs/pipeline-module/4-uo.html similarity index 90% rename from docs/pipeline-module/3-uo.html rename to docs/pipeline-module/4-uo.html index ca20a9442..796e9dcc2 100644 --- a/docs/pipeline-module/3-uo.html +++ b/docs/pipeline-module/4-uo.html @@ -70,27 +70,27 @@ function togglePopup(material_id) {
    +

    To compile the main/synoptic/use_options submodule.

    -

    §1. As this is called, Synoptic Utilities has already formed a list use_option_nodes +

    §1. As this is called, Synoptic Utilities has already formed a list use_option_nodes of packages of type _use_option.

    -void SynopticUseOptions::compile(inter_tree *I, tree_inventory *inv) {
    +void SynopticUseOptions::compile(inter_tree *I, tree_inventory *inv) {
         if (TreeLists::len(inv->use_option_nodes) > 0) {
    -        TreeLists::sort(inv->use_option_nodes, Synoptic::module_order);
    +        TreeLists::sort(inv->use_option_nodes, Synoptic::module_order);
             for (int i=0; i<TreeLists::len(inv->use_option_nodes); i++) {
                 inter_package *pack = Inter::Package::defined_by_frame(inv->use_option_nodes->list[i].node);
    -            inter_tree_node *D = Synoptic::get_definition(pack, I"use_option_id");
    +            inter_tree_node *D = Synoptic::get_definition(pack, I"use_option_id");
                 D->W.data[DATA_CONST_IFLD+1] = (inter_ti) i;
             }
         }
     
    -    Define NO_USE_OPTIONS1.1;
    -    Define TESTUSEOPTION function1.2;
    -    Define PRINT_USE_OPTION function1.3;
    +    Define NO_USE_OPTIONS1.1;
    +    Define TESTUSEOPTION function1.2;
    +    Define PRINT_USE_OPTION function1.3;
     }
     

    §1.1. Define NO_USE_OPTIONS1.1 = @@ -100,7 +100,7 @@ of packages of type _use_opti inter_name *iname = HierarchyLocations::find(I, NO_USE_OPTIONS_HL); Produce::numeric_constant(I, iname, K_value, (inter_ti) (TreeLists::len(inv->use_option_nodes))); -

    +

    §1.2. A relatively late addition to the design of use options was to make them values at runtime, of the kind "use option". We need to provide two functions: one to test whether a given use option is currently set, one to print the @@ -112,8 +112,8 @@ name of a given use option.

         inter_name *iname = HierarchyLocations::find(I, TESTUSEOPTION_HL);
    -    Synoptic::begin_function(I, iname);
    -    inter_symbol *UO_s = Synoptic::local(I, I"UO", NULL);
    +    Synoptic::begin_function(I, iname);
    +    inter_symbol *UO_s = Synoptic::local(I, I"UO", NULL);
         for (int i=0; i<TreeLists::len(inv->use_option_nodes); i++) {
             inter_package *pack = Inter::Package::defined_by_frame(inv->use_option_nodes->list[i].node);
             inter_ti set = Metadata::read_numeric(pack, I"^active");
    @@ -133,16 +133,16 @@ name of a given use option.
             }
         }
         Produce::rfalse(I);
    -    Synoptic::end_function(I, iname);
    +    Synoptic::end_function(I, iname);
     
    - +

    §1.3. Define PRINT_USE_OPTION function1.3 =

         inter_name *iname = HierarchyLocations::find(I, PRINT_USE_OPTION_HL);
    -    Synoptic::begin_function(I, iname);
    -    inter_symbol *UO_s = Synoptic::local(I, I"UO", NULL);
    +    Synoptic::begin_function(I, iname);
    +    inter_symbol *UO_s = Synoptic::local(I, I"UO", NULL);
         Produce::inv_primitive(I, SWITCH_BIP);
         Produce::down(I);
             Produce::val_symbol(I, K_value, UO_s);
    @@ -165,11 +165,11 @@ name of a given use option.
                 }
             Produce::up(I);
         Produce::up(I);
    -    Synoptic::end_function(I, iname);
    +    Synoptic::end_function(I, iname);
     
    - +
    diff --git a/docs/pipeline-module/3-vrb.html b/docs/pipeline-module/4-vrb.html similarity index 87% rename from docs/pipeline-module/3-vrb.html rename to docs/pipeline-module/4-vrb.html index 3f70280da..448147c9d 100644 --- a/docs/pipeline-module/3-vrb.html +++ b/docs/pipeline-module/4-vrb.html @@ -70,23 +70,23 @@ function togglePopup(material_id) {
    +

    To compile the main/synoptic/verbs submodule.

    §1. Before this runs, instances of these are scattered all over the Inter tree.

    -

    As this is called, Synoptic Utilities has already formed lists of verb_form_nodes +

    As this is called, Synoptic Utilities has already formed lists of verb_form_nodes of instances having the kind K_verb.

    -void SynopticVerbs::compile(inter_tree *I, tree_inventory *inv) {
    +void SynopticVerbs::compile(inter_tree *I, tree_inventory *inv) {
         if (TreeLists::len(inv->verb_form_nodes) > 0) {
    -        TreeLists::sort(inv->verb_form_nodes, SynopticVerbs::form_order);
    +        TreeLists::sort(inv->verb_form_nodes, SynopticVerbs::form_order);
         }
     
    -    Define TABLEOFVERBS array1.1;
    +    Define TABLEOFVERBS array1.1;
     }
     
     int SynopticVerbs::form_order(const void *ent1, const void *ent2) {
    @@ -95,8 +95,8 @@ of instances having the kind 
         if (E1 == E2) return 0;
         inter_tree_node *P1 = E1->node;
         inter_tree_node *P2 = E2->node;
    -    inter_package *mod1 = Synoptic::module_containing(P1);
    -    inter_package *mod2 = Synoptic::module_containing(P2);
    +    inter_package *mod1 = Synoptic::module_containing(P1);
    +    inter_package *mod2 = Synoptic::module_containing(P2);
         inter_ti C1 = Metadata::read_optional_numeric(mod1, I"^category");
         inter_ti C2 = Metadata::read_optional_numeric(mod2, I"^category");
         int d = ((int) C2) - ((int) C1);  larger values sort earlier
    @@ -115,18 +115,18 @@ of instances having the kind 
     
     
         inter_name *iname = HierarchyLocations::find(I, TABLEOFVERBS_HL);
    -    Synoptic::begin_array(I, iname);
    +    Synoptic::begin_array(I, iname);
         for (int i=0; i<TreeLists::len(inv->verb_form_nodes); i++) {
             inter_package *pack = Inter::Package::defined_by_frame(inv->verb_form_nodes->list[i].node);
             inter_symbol *vc_s = Metadata::read_symbol(pack, I"^verb_value");
    -        Synoptic::symbol_entry(vc_s);
    +        Synoptic::symbol_entry(vc_s);
         }
    -    Synoptic::numeric_entry(0);
    -    Synoptic::end_array(I);
    +    Synoptic::numeric_entry(0);
    +    Synoptic::end_array(I);
     
    -
    • This code is used in §1.
    +
    • This code is used in §1.
    diff --git a/docs/pipeline-module/2-erl.html b/docs/pipeline-module/5-erl.html similarity index 85% rename from docs/pipeline-module/2-erl.html rename to docs/pipeline-module/5-erl.html index 99572c3e5..edcface87 100644 --- a/docs/pipeline-module/2-erl.html +++ b/docs/pipeline-module/5-erl.html @@ -70,10 +70,10 @@ function togglePopup(material_id) {
    +

    To remove labels which are defined but never jumped to.

    -
    +

    §1. Pipeline stage. I7 tends to produce a lot of labels when compiling complicated text substitutions, but many (around 2000 in a typical run) are never branched to, @@ -86,14 +86,14 @@ on the Inter functions in a repository.

    -void CodeGen::Labels::create_pipeline_stage(void) {
    -    CodeGen::Stage::new(I"eliminate-redundant-labels", CodeGen::Labels::run_pipeline_stage, NO_STAGE_ARG, FALSE);
    +void CodeGen::Labels::create_pipeline_stage(void) {
    +    ParsingPipelines::new_stage(I"eliminate-redundant-labels", CodeGen::Labels::run_pipeline_stage, NO_STAGE_ARG, FALSE);
     }
     
     int redundant_labels_removed = 0;
     int CodeGen::Labels::run_pipeline_stage(pipeline_step *step) {
         redundant_labels_removed = 0;
    -    InterTree::traverse(step->repository, CodeGen::Labels::visitor, NULL, NULL, 0);
    +    InterTree::traverse(step->ephemera.repository, CodeGen::Labels::visitor, NULL, NULL, 0);
         if (redundant_labels_removed > 0)
             LOG("%d redundant label(s) removed\n", redundant_labels_removed);
         return TRUE;
    @@ -102,7 +102,7 @@ on the Inter functions in a repository.
     void CodeGen::Labels::visitor(inter_tree *I, inter_tree_node *P, void *state) {
         if (P->W.data[ID_IFLD] == PACKAGE_IST) {
             inter_package *pack = Inter::Package::defined_by_frame(P);
    -        if (Inter::Packages::is_codelike(pack)) Perform peephole optimisation on this block1.1;
    +        if (Inter::Packages::is_codelike(pack)) Perform peephole optimisation on this block1.1;
         }
     }
     
    @@ -117,11 +117,11 @@ it does.
         inter_symbols_table *local_symbols = Inter::Packages::scope(pack);
    -    Mark all the labels for this function as being unused1.1.1;
    -    Look through the function for mentions of labels, marking those as used1.1.2;
    -    Remove the label declarations for any that are still marked unused1.1.3;
    +    Mark all the labels for this function as being unused1.1.1;
    +    Look through the function for mentions of labels, marking those as used1.1.2;
    +    Remove the label declarations for any that are still marked unused1.1.3;
     
    - +

    §1.1.1. The symbol flag USED_MARK_BIT is free for us to use, but its value for any given symbol is undefined when we begin. We'll clear it for all labels.

    @@ -134,15 +134,15 @@ any given symbol is undefined when we begin. We'll clear it for all labels. if (Inter::Symbols::is_label(S)) Inter::Symbols::clear_flag(S, USED_MARK_BIT); - +

    §1.1.2. Look through the function for mentions of labels, marking those as used1.1.2 =

         inter_tree_node *D = Inter::Packages::definition(pack);
    -    CodeGen::Labels::traverse_code_tree(D);
    +    CodeGen::Labels::traverse_code_tree(D);
     
    - +

    §1.1.3. Anything not marked used must be unused, so we can get rid of it. We do this by striking its definition; the definition of a label symbol is the line which shows where it belongs in the function (written .Example in Inter @@ -164,16 +164,16 @@ anywhere) we may as well remove it. redundant_labels_removed++; } -

    +

    §2. The following visits every line of code in the function, in the same order it would be written out in a listing.

    -void CodeGen::Labels::traverse_code_tree(inter_tree_node *P) {
    +void CodeGen::Labels::traverse_code_tree(inter_tree_node *P) {
         LOOP_THROUGH_INTER_CHILDREN(F, P) {
    -        Examine a line of code in the function2.1;
    -        CodeGen::Labels::traverse_code_tree(F);
    +        Examine a line of code in the function2.1;
    +        CodeGen::Labels::traverse_code_tree(F);
         }
     }
     
    @@ -190,9 +190,9 @@ We look for such lines. Inter::Symbols::set_flag(lab, USED_MARK_BIT); } - +
    diff --git a/docs/pipeline-module/2-erm.html b/docs/pipeline-module/5-erm.html similarity index 90% rename from docs/pipeline-module/2-erm.html rename to docs/pipeline-module/5-erm.html index 47b4f2f11..74d15c484 100644 --- a/docs/pipeline-module/2-erm.html +++ b/docs/pipeline-module/5-erm.html @@ -70,10 +70,10 @@ function togglePopup(material_id) {
    +

    To remove (for example) functions which we can prove will never be called or referred to as values.

    -
    +

    §1. Pipeline stage. Experience shows that around 20 per cent of the code generated by Inform 7 consists of functions which are never in fact needed. Probably diligent @@ -84,15 +84,15 @@ isn't used.

    -void CodeGen::Eliminate::create_pipeline_stage(void) {
    -    CodeGen::Stage::new(I"eliminate-redundant-code",
    -        CodeGen::Eliminate::run_pipeline_stage, NO_STAGE_ARG, FALSE);
    +void CodeGen::Eliminate::create_pipeline_stage(void) {
    +    ParsingPipelines::new_stage(I"eliminate-redundant-code",
    +        CodeGen::Eliminate::run_pipeline_stage, NO_STAGE_ARG, FALSE);
     }
     
     int CodeGen::Eliminate::run_pipeline_stage(pipeline_step *step) {
    -    inter_tree *I = step->repository;
    -    InterTree::traverse(I, CodeGen::Eliminate::package_preserver, NULL, NULL, PACKAGE_IST);
    -    InterTree::traverse(I, CodeGen::Eliminate::package_destroyer, NULL, NULL, PACKAGE_IST);
    +    inter_tree *I = step->ephemera.repository;
    +    InterTree::traverse(I, CodeGen::Eliminate::package_preserver, NULL, NULL, PACKAGE_IST);
    +    InterTree::traverse(I, CodeGen::Eliminate::package_destroyer, NULL, NULL, PACKAGE_IST);
         return TRUE;
     }
     
    @@ -108,26 +108,26 @@ be included.

    -void CodeGen::Eliminate::package_preserver(inter_tree *I, inter_tree_node *P, void *state) {
    +void CodeGen::Eliminate::package_preserver(inter_tree *I, inter_tree_node *P, void *state) {
         inter_package *pack = Inter::Package::defined_by_frame(P);
         inter_symbol *ptype = Inter::Packages::type(pack);
         if (ptype == command_ptype_symbol)
    -        CodeGen::Eliminate::require(pack, NULL, I"it's a _command package");
    +        CodeGen::Eliminate::require(pack, NULL, I"it's a _command package");
         else if (ptype == property_ptype_symbol) {
             text_stream *N = Inter::Packages::name(pack);
             if (Str::eq(N, I"workflag_prop"))
    -            CodeGen::Eliminate::require(pack, NULL, I"it's workflag");
    +            CodeGen::Eliminate::require(pack, NULL, I"it's workflag");
             if (Str::eq(N, I"pluralname_prop"))
    -            CodeGen::Eliminate::require(pack, NULL, I"it's pluralname");
    +            CodeGen::Eliminate::require(pack, NULL, I"it's pluralname");
             if (Str::eq(N, I"ambigpluralname_prop"))
    -            CodeGen::Eliminate::require(pack, NULL, I"it's ambigpluralname");
    +            CodeGen::Eliminate::require(pack, NULL, I"it's ambigpluralname");
             if (Str::eq(N, I"proper_prop"))
    -            CodeGen::Eliminate::require(pack, NULL, I"it's proper");
    +            CodeGen::Eliminate::require(pack, NULL, I"it's proper");
         }
         else if (ptype == function_ptype_symbol) {
             text_stream *N = Inter::Packages::name(pack);
             if (Str::eq(N, I"Main_fn"))
    -            CodeGen::Eliminate::require(pack, NULL, I"it's Main");
    +            CodeGen::Eliminate::require(pack, NULL, I"it's Main");
         }
     }
     
    @@ -135,7 +135,7 @@ be included.

    -void CodeGen::Eliminate::require(inter_package *pack, inter_package *witness, text_stream *reason) {
    +void CodeGen::Eliminate::require(inter_package *pack, inter_package *witness, text_stream *reason) {
         if ((pack->package_flags) & USED_PACKAGE_FLAG) return;
         pack->package_flags |= USED_PACKAGE_FLAG;
         if (witness) {
    @@ -143,9 +143,9 @@ be included.
         } else {
             LOGIF(ELIMINATION, "Need $6 (because %S)\n", pack, reason);
         }
    -    If you need a package, you need its parent3.1;
    -    If you need a package, you need its external dependencies3.2;
    -    If you need a function or action, you need its internal resources3.3;
    +    If you need a package, you need its parent3.1;
    +    If you need a package, you need its external dependencies3.2;
    +    If you need a function or action, you need its internal resources3.3;
     }
     

    §3.1. If you need a package, you need its parent3.1 = @@ -153,9 +153,9 @@ be included.

         inter_package *parent = Inter::Packages::parent(pack);
    -    if (parent) CodeGen::Eliminate::require(parent, pack, I"it's the parent");
    +    if (parent) CodeGen::Eliminate::require(parent, pack, I"it's the parent");
     
    - +

    §3.2. If you need a package, you need its external dependencies3.2 =

    @@ -167,11 +167,11 @@ be included. inter_symbol *to = symb; while ((to) && (to->equated_to)) to = to->equated_to; inter_package *needed = to->owning_table->owning_package; - CodeGen::Eliminate::require(needed, pack, I"it's an external symbol"); + CodeGen::Eliminate::require(needed, pack, I"it's an external symbol"); } } - +

    §3.3. If you need a function or action, you need its internal resources3.3 =

    @@ -185,17 +185,17 @@ be included. LOOP_THROUGH_INTER_CHILDREN(C, D) { if (C->W.data[ID_IFLD] == PACKAGE_IST) { inter_package *P = Inter::Package::defined_by_frame(C); - CodeGen::Eliminate::require(P, pack, rationale); + CodeGen::Eliminate::require(P, pack, rationale); } } } - +

    §4. Destruction. Whatever has not been preserved, is now destroyed.

    -void CodeGen::Eliminate::package_destroyer(inter_tree *I, inter_tree_node *P, void *state) {
    +void CodeGen::Eliminate::package_destroyer(inter_tree *I, inter_tree_node *P, void *state) {
         inter_package *pack = Inter::Package::defined_by_frame(P);
         if ((pack) && ((pack->package_flags & USED_PACKAGE_FLAG) == 0)) {
             LOGIF(ELIMINATION, "Striking unused package $6 (type %S)\n",
    @@ -205,7 +205,7 @@ be included.
     }
     
    diff --git a/docs/pipeline-module/2-ero.html b/docs/pipeline-module/5-ero.html similarity index 91% rename from docs/pipeline-module/2-ero.html rename to docs/pipeline-module/5-ero.html index eedfa9870..ae068cd2e 100644 --- a/docs/pipeline-module/2-ero.html +++ b/docs/pipeline-module/5-ero.html @@ -70,10 +70,10 @@ function togglePopup(material_id) {
    +

    To remove logical or arithmetic operations which do nothing.

    -
    +

    §1. Pipeline stage. This stage removes redundant operations, replacing each of the following with just x. This is useful mainly because the Compile Conditions (in imperative) @@ -102,15 +102,15 @@ any intended side-effects of evaluating -void CodeGen::Operations::create_pipeline_stage(void) { - CodeGen::Stage::new(I"eliminate-redundant-operations", - CodeGen::Operations::run_pipeline_stage, NO_STAGE_ARG, FALSE); +void CodeGen::Operations::create_pipeline_stage(void) { + ParsingPipelines::new_stage(I"eliminate-redundant-operations", + CodeGen::Operations::run_pipeline_stage, NO_STAGE_ARG, FALSE); } int redundant_operations_removed = 0; int CodeGen::Operations::run_pipeline_stage(pipeline_step *step) { redundant_operations_removed = 0; - InterTree::traverse(step->repository, CodeGen::Operations::visitor, NULL, NULL, 0); + InterTree::traverse(step->ephemera.repository, CodeGen::Operations::visitor, NULL, NULL, 0); if (redundant_operations_removed > 0) LOG("%d redundant operation(s) removed\n", redundant_operations_removed); return TRUE; @@ -121,7 +121,7 @@ any intended side-effects of evaluating inter_package *pack = Inter::Package::defined_by_frame(P); if (Inter::Packages::is_codelike(pack)) { inter_tree_node *D = Inter::Packages::definition(pack); - CodeGen::Operations::traverse_code_tree(D); + CodeGen::Operations::traverse_code_tree(D); } } } @@ -131,9 +131,9 @@ operations:

    -void CodeGen::Operations::traverse_code_tree(inter_tree_node *P) {
    +void CodeGen::Operations::traverse_code_tree(inter_tree_node *P) {
         PROTECTED_LOOP_THROUGH_INTER_CHILDREN(F, P) {
    -        CodeGen::Operations::traverse_code_tree(F);
    +        CodeGen::Operations::traverse_code_tree(F);
         }
         PROTECTED_LOOP_THROUGH_INTER_CHILDREN(F, P) {
             int iden[2] = { -1, -1 };
    @@ -147,7 +147,7 @@ operations:
                 if (Primitives::to_bip(P->tree, prim) == TIMES_BIP)  { iden[0] = 1; iden[1] = 1; }
                 if (Primitives::to_bip(P->tree, prim) == DIVIDE_BIP) { iden[1] = 1; }
             }
    -        if ((iden[0] >= 0) || (iden[1] >= 0)) An elimination candidate2.1;
    +        if ((iden[0] >= 0) || (iden[1] >= 0)) An elimination candidate2.1;
         }
     }
     
    @@ -174,9 +174,9 @@ operations: } } - +
    diff --git a/docs/pipeline-module/P-wtmd.html b/docs/pipeline-module/P-wtmd.html new file mode 100644 index 000000000..2891de345 --- /dev/null +++ b/docs/pipeline-module/P-wtmd.html @@ -0,0 +1,95 @@ + + + + What This Module Does + + + + + + + + + + + + + + + +
    + + +

    An overview of the pipeline module's role and abilities.

    + +
    + +

    §1. Prerequisites. The pipeline module is a part of the Inform compiler toolset. It is +presented as a literate program or "web". Before diving in: +

    + + +

    §2. Pipelines. This module provides a mechanism for working on trees of Inter code, by applying +sequences of "stages" identified by name; and it then defines a number of stages. +

    + + + +
    + + + diff --git a/docs/pipeline-module/index.html b/docs/pipeline-module/index.html index 455d73572..13a9848f0 100644 --- a/docs/pipeline-module/index.html +++ b/docs/pipeline-module/index.html @@ -63,6 +63,17 @@
  • - Chapter 2: Miscellaneous Pipeline Stages

    + Chapter 2: Pipelines

  • - Chapter 3: Synoptic Module

    + Chapter 3: Linking

    • -

      +

      + Link - + Inter often needs to assimilate or otherwise deal with architecture-neutral kits of linkable material, and this is where such requirements are noted.

      +
    • +
    • +

      + Prepare - + The Inter stage prepare.

      +
    • +
    • +

      + Linker - + To link inter from I7 with template code.

      +
    • +
    • +

      + I6 Template Reader - + Inform 6 meta-language is the language used by template files (with extension |.i6t|); we need tp be able to read it here in order to assimilate template code.

      +
    • +
    • +

      + Parse Linked Matter - + To generate the initial state of storage for variables.

      +
    • +
    • +

      + Resolving Conditional Compilation - + To generate the initial state of storage for variables.

      +
    • +
    • +

      + Assimilate Linked Matter - + To assimilate the material in parsed non-code splats.

      +
    • +
    • +

      + Resolve External Symbols - + To make sure certain symbol names translate into globally unique target symbols.

      +
    • +
    • +

      + Inspect Plugs - + To make sure certain symbol names translate into globally unique target symbols.

      +
    • +
    • +

      + Detect Indirect Calls - + To make sure certain symbol names translate into globally unique target symbols.

      +
    • +
    • +

      + Uniqueness - + To make sure certain symbol names translate into globally unique target symbols.

      +
    • +
    • +

      + Reconcile Verbs - + To reconcile clashes between assimilated and originally generated verbs.

      +
    • +
    +
  • +
  • +

    + Chapter 4: Synoptic Module

    +
      +
    • +

      Synoptic Hierarchy - The layout and naming conventions for the contents of the main/synoptic module.

    • -

      +

      Synoptic Utilities - Managing the generation of code and arrays in the synoptic module, which is put together from resources all over the Inter tree.

    • -

      +

      Extensions - To renumber the extensions and construct suitable functions and arrays.

    • -

      +

      Literal Text - To alphabetise literal texts, deduplicate them, and stote a canonical set in the main/texts linkage.

    • -

      +

      Responses - To compile the main/synoptic/responses submodule.

    • -

      +

      Rules - To compile the main/synoptic/rules and main/synoptic/rulebooks submodules.

    • -

      +

      Activities - To compile the main/synoptic/activities submodule.

    • -

      +

      Actions - To compile the main/synoptic/actions submodule.

    • -

      +

      Instances - To compile the main/synoptic/instances submodule.

    • -

      +

      Kinds - To compile the main/synoptic/kinds submodule.

    • -

      +

      Properties - To compile the main/synoptic/properties submodule.

    • -

      +

      Relations - To compile the main/synoptic/relations submodule.

    • -

      +

      Tables - To compile the main/synoptic/tables submodule.

    • -

      +

      Chronology - To compile the main/synoptic/chronology submodule.

    • -

      +

      Scenes - To compile the main/synoptic/scenes submodule.

    • -

      +

      Multimedia - To compile the main/synoptic/multimedia submodule.

    • -

      +

      Use Options - To compile the main/synoptic/use_options submodule.

    • -

      +

      Verbs - To compile the main/synoptic/verbs submodule.

    • -

      +

      Tests - To compile the main/synoptic/tests submodule.

  • +
  • +

    + Chapter 5: Optimising

    + +

  • diff --git a/docs/supervisor-module/1-ic.html b/docs/supervisor-module/1-ic.html index f09420321..49c412c7a 100644 --- a/docs/supervisor-module/1-ic.html +++ b/docs/supervisor-module/1-ic.html @@ -277,7 +277,7 @@ set appropriately. void Supervisor::set_defaults(void) { RUN_ONLY_IN_PHASE(CONFIGURATION_INBUILD_PHASE) #ifdef PIPELINE_MODULE - pipeline_vars = CodeGen::Pipeline::basic_dictionary(I"output.ulx"); + pipeline_vars = ParsingPipelines::basic_dictionary(I"output.ulx"); #endif Supervisor::set_inter_pipeline(I"compile"); } diff --git a/docs/supervisor-module/3-is.html b/docs/supervisor-module/3-is.html index d7e87ec6e..2d1b5e09a 100644 --- a/docs/supervisor-module/3-is.html +++ b/docs/supervisor-module/3-is.html @@ -129,7 +129,7 @@ or should be, so the effect is the same. if (A == NULL) internal_error("no architecture given"); pathname *kit_path = S->associated_copy->location_if_path; - dictionary *pipeline_vars = CodeGen::Pipeline::basic_dictionary(NULL); + dictionary *pipeline_vars = ParsingPipelines::basic_dictionary(NULL); inbuild_requirement *req = Requirements::any_version_of( Works::new(pipeline_genre, I"assimilate.interpipeline", NULL)); @@ -155,11 +155,11 @@ or should be, so the effect is the same. linked_list *inter_paths = NEW_LINKED_LIST(pathname); ADD_TO_LINKED_LIST(S->associated_copy->location_if_path, pathname, inter_paths); - codegen_pipeline *SS = - CodeGen::Pipeline::parse_from_file(pipeline_as_file, pipeline_vars); + inter_pipeline *SS = + ParsingPipelines::from_file(pipeline_as_file, pipeline_vars); if (SS) { linked_list *requirements_list = NEW_LINKED_LIST(inter_library); - CodeGen::Pipeline::run(NULL, SS, inter_paths, requirements_list, S->for_vm); + RunningPipelines::run(NULL, SS, NULL, inter_paths, requirements_list, S->for_vm); return TRUE; } else { Errors::nowhere("assimilate pipeline could not be parsed"); @@ -186,7 +186,7 @@ it defaults to compile if (project == NULL) internal_error("no project"); #ifdef PIPELINE_MODULE clock_t back_end = clock(); - CodeGen::Architecture::set( + RunningPipelines::set_architecture( Architectures::to_codename( TargetVMs::get_architecture(S->for_vm))); Str::copy(Dictionaries::create_text(pipeline_vars, I"*in"), I"*memory"); @@ -206,14 +206,13 @@ it defaults to compile } F = R->copy->location_if_file; } - codegen_pipeline *SS = CodeGen::Pipeline::parse_from_file(F, pipeline_vars); - if (SS == NULL) { + inter_pipeline *pipeline = ParsingPipelines::from_file(F, pipeline_vars); + if (pipeline == NULL) { Errors::nowhere("inter pipeline file could not be parsed"); return FALSE; } - CodeGen::Pipeline::set_repository(SS, Emit::tree()); - CodeGen::Pipeline::run(Filenames::up(S->vertex->as_file), - SS, Kits::inter_paths(Projects::nest_list(project)), + RunningPipelines::run(Filenames::up(S->vertex->as_file), + pipeline, Emit::tree(), Kits::inter_paths(Projects::nest_list(project)), Projects::list_of_link_instructions(project), S->for_vm); LOG("Back end elapsed time: %dcs\n", ((int) (clock() - back_end)) / (CLOCKS_PER_SEC/100)); diff --git a/inbuild/supervisor-module/Chapter 1/Inbuild Control.w b/inbuild/supervisor-module/Chapter 1/Inbuild Control.w index 769ac0b57..cc2516562 100644 --- a/inbuild/supervisor-module/Chapter 1/Inbuild Control.w +++ b/inbuild/supervisor-module/Chapter 1/Inbuild Control.w @@ -189,7 +189,7 @@ int rng_seed_at_start_of_play = 0; /* The seed value, or 0 if not seeded */ void Supervisor::set_defaults(void) { RUN_ONLY_IN_PHASE(CONFIGURATION_INBUILD_PHASE) #ifdef PIPELINE_MODULE - pipeline_vars = CodeGen::Pipeline::basic_dictionary(I"output.ulx"); + pipeline_vars = ParsingPipelines::basic_dictionary(I"output.ulx"); #endif Supervisor::set_inter_pipeline(I"compile"); } diff --git a/inbuild/supervisor-module/Chapter 3/Inter Skill.w b/inbuild/supervisor-module/Chapter 3/Inter Skill.w index bae6d8087..156012435 100644 --- a/inbuild/supervisor-module/Chapter 3/Inter Skill.w +++ b/inbuild/supervisor-module/Chapter 3/Inter Skill.w @@ -55,7 +55,7 @@ int InterSkill::assimilate_internally(build_skill *skill, build_step *S, if (A == NULL) internal_error("no architecture given"); pathname *kit_path = S->associated_copy->location_if_path; - dictionary *pipeline_vars = CodeGen::Pipeline::basic_dictionary(NULL); + dictionary *pipeline_vars = ParsingPipelines::basic_dictionary(NULL); inbuild_requirement *req = Requirements::any_version_of( Works::new(pipeline_genre, I"assimilate.interpipeline", NULL)); @@ -81,11 +81,11 @@ int InterSkill::assimilate_internally(build_skill *skill, build_step *S, linked_list *inter_paths = NEW_LINKED_LIST(pathname); ADD_TO_LINKED_LIST(S->associated_copy->location_if_path, pathname, inter_paths); - codegen_pipeline *SS = - CodeGen::Pipeline::parse_from_file(pipeline_as_file, pipeline_vars); + inter_pipeline *SS = + ParsingPipelines::from_file(pipeline_as_file, pipeline_vars); if (SS) { linked_list *requirements_list = NEW_LINKED_LIST(inter_library); - CodeGen::Pipeline::run(NULL, SS, inter_paths, requirements_list, S->for_vm); + RunningPipelines::run(NULL, SS, NULL, inter_paths, requirements_list, S->for_vm); return TRUE; } else { Errors::nowhere("assimilate pipeline could not be parsed"); @@ -111,7 +111,7 @@ int InterSkill::code_generate_internally(build_skill *skill, build_step *S, if (project == NULL) internal_error("no project"); #ifdef PIPELINE_MODULE clock_t back_end = clock(); - CodeGen::Architecture::set( + RunningPipelines::set_architecture( Architectures::to_codename( TargetVMs::get_architecture(S->for_vm))); Str::copy(Dictionaries::create_text(pipeline_vars, I"*in"), I"*memory"); @@ -131,14 +131,13 @@ int InterSkill::code_generate_internally(build_skill *skill, build_step *S, } F = R->copy->location_if_file; } - codegen_pipeline *SS = CodeGen::Pipeline::parse_from_file(F, pipeline_vars); - if (SS == NULL) { + inter_pipeline *pipeline = ParsingPipelines::from_file(F, pipeline_vars); + if (pipeline == NULL) { Errors::nowhere("inter pipeline file could not be parsed"); return FALSE; } - CodeGen::Pipeline::set_repository(SS, Emit::tree()); - CodeGen::Pipeline::run(Filenames::up(S->vertex->as_file), - SS, Kits::inter_paths(Projects::nest_list(project)), + RunningPipelines::run(Filenames::up(S->vertex->as_file), + pipeline, Emit::tree(), Kits::inter_paths(Projects::nest_list(project)), Projects::list_of_link_instructions(project), S->for_vm); LOG("Back end elapsed time: %dcs\n", ((int) (clock() - back_end)) / (CLOCKS_PER_SEC/100)); diff --git a/inform7/Figures/memory-diagnostics.txt b/inform7/Figures/memory-diagnostics.txt index 56b78b6a4..adb6d77bc 100644 --- a/inform7/Figures/memory-diagnostics.txt +++ b/inform7/Figures/memory-diagnostics.txt @@ -218,7 +218,7 @@ Total memory consumption was 399937K = 391 MB ---- inter_architecture 4 objects, 160 bytes ---- imperative_defn_family 4 objects, 160 bytes ---- inference_subject_family 5 objects, 160 bytes - ---- codegen_pipeline 1 object, 128 bytes + ---- inter_pipeline 1 object, 136 bytes ---- element_activation 4 objects, 128 bytes ---- inbuild_nest 3 objects, 120 bytes ---- local_block_value 2 objects, 112 bytes @@ -256,5 +256,5 @@ Total memory consumption was 399937K = 391 MB ---- code generation workspace for objects 1336 bytes in 4 claims ---- emitter array storage 161792 bytes in 2062 claims -18.7% was overhead - 76684304 bytes = 74887K = 73 MB +18.7% was overhead - 76684296 bytes = 74887K = 73 MB diff --git a/inform7/Figures/timings-diagnostics.txt b/inform7/Figures/timings-diagnostics.txt index c4140d008..5fcf3c3d8 100644 --- a/inform7/Figures/timings-diagnostics.txt +++ b/inform7/Figures/timings-diagnostics.txt @@ -1,37 +1,36 @@ 100.0% in inform7 run - 55.4% in compilation to Inter - 39.4% in //Sequence::undertake_queued_tasks// - 3.6% in //MajorNodes::pre_pass// - 2.7% in //MajorNodes::pass_1// + 55.0% in compilation to Inter + 39.9% in //Sequence::undertake_queued_tasks// + 3.3% in //MajorNodes::pre_pass// + 2.5% in //MajorNodes::pass_1// 2.0% in //RTPhrasebook::compile_entries// - 1.4% in //ImperativeDefinitions::assess_all// + 1.3% in //ImperativeDefinitions::assess_all// 1.1% in //RTKindConstructors::compile// - 0.4% in //ImperativeDefinitions::compile_first_block// 0.4% in //MajorNodes::pass_2// 0.4% in //Sequence::undertake_queued_tasks// - 0.4% in //Sequence::undertake_queued_tasks// 0.4% in //World::stage_V// + 0.2% in //ImperativeDefinitions::compile_first_block// + 0.2% in //Sequence::undertake_queued_tasks// 0.1% in //CompletionModule::compile// 0.1% in //InferenceSubjects::emit_all// 0.1% in //RTKindConstructors::compile_permissions// 0.1% in //Task::make_built_in_kind_constructors// - 0.1% in //World::stages_II_and_III// - 2.0% not specifically accounted for - 42.6% in running Inter pipeline - 12.8% in step preparation - 9.6% in inter step 7/16: consolidate-text + 2.2% not specifically accounted for + 43.0% in running Inter pipeline + 12.9% in step preparation + 9.5% in inter step 7/16: consolidate-text 7.8% in inter step 2/16: link - 6.5% in inter step 16/16: generate inform6 -> auto.inf + 6.7% in inter step 16/16: generate inform6 -> auto.inf 1.4% in inter step 11/16: make-identifiers-unique 0.4% in inter step 12/16: reconcile-verbs 0.2% in inter step 14/16: eliminate-redundant-operations 0.2% in inter step 6/16: assimilate 0.2% in inter step 8/16: resolve-external-symbols - 0.2% in inter step 9/16: inspect-plugs 0.1% in inter step 10/16: detect-indirect-calls 0.1% in inter step 13/16: eliminate-redundant-labels 0.1% in inter step 4/16: parse-linked-matter 0.1% in inter step 5/16: resolve-conditional-compilation - 2.2% not specifically accounted for + 0.1% in inter step 9/16: inspect-plugs + 2.4% not specifically accounted for 1.6% in supervisor 0.3% not specifically accounted for diff --git a/inter/Chapter 1/Main.w b/inter/Chapter 1/Main.w index e9944cb83..5bd771423 100644 --- a/inter/Chapter 1/Main.w +++ b/inter/Chapter 1/Main.w @@ -64,7 +64,7 @@ int main(int argc, char **argv) { @ = inter_file_list = NEW_LINKED_LIST(filename); - pipeline_vars = CodeGen::Pipeline::basic_dictionary(I"output.i6"); + pipeline_vars = ParsingPipelines::basic_dictionary(I"output.i6"); internal_path = Pathnames::from_text(I"inform7/Internal"); @ This pipeline is supplied built in to the installation of |inter|. In fact, @@ -73,7 +73,7 @@ is used. But at times in the past it has been useful to debug with the text form, which would be written to |*outt|. @ = - inter_architecture *A = CodeGen::Architecture::current(); + inter_architecture *A = RunningPipelines::get_architecture(); if (A == NULL) Errors::fatal("no -architecture given"); pathname *path_to_pipelines = Pathnames::down(path_to_inter, I"Pipelines"); @@ -94,13 +94,13 @@ form, which would be written to |*outt|. Errors::fatal("-pipeline-text and -pipeline-file are mutually exclusive"); linked_list *inter_paths = NEW_LINKED_LIST(pathname); if (kit_to_assimilate) ADD_TO_LINKED_LIST(kit_to_assimilate, pathname, inter_paths); - codegen_pipeline *SS; + inter_pipeline *SS; if (pipeline_as_file) - SS = CodeGen::Pipeline::parse_from_file(pipeline_as_file, pipeline_vars); + SS = ParsingPipelines::from_file(pipeline_as_file, pipeline_vars); else - SS = CodeGen::Pipeline::parse(pipeline_as_text, pipeline_vars); + SS = ParsingPipelines::from_text(pipeline_as_text, pipeline_vars); linked_list *requirements_list = NEW_LINKED_LIST(inter_library); - if (SS) CodeGen::Pipeline::run(domain_path, SS, inter_paths, requirements_list, NULL); + if (SS) RunningPipelines::run(domain_path, SS, NULL, inter_paths, requirements_list, NULL); else Errors::fatal("pipeline could not be parsed"); @ = @@ -185,7 +185,7 @@ void Main::respond(int id, int val, text_stream *arg, void *state) { case ASSIMILATE_CLSW: kit_to_assimilate = Pathnames::from_text(arg); break; case INTERNAL_CLSW: internal_path = Pathnames::from_text(arg); break; case ARCHITECTURE_CLSW: - if (CodeGen::Architecture::set(arg) == FALSE) + if (RunningPipelines::set_architecture(arg) == FALSE) Errors::fatal("no such -architecture"); break; } diff --git a/inter/building-module/Chapter 3/Produce.w b/inter/building-module/Chapter 3/Produce.w index 73c2ac4cb..33039e4df 100644 --- a/inter/building-module/Chapter 3/Produce.w +++ b/inter/building-module/Chapter 3/Produce.w @@ -547,7 +547,7 @@ inter_symbol *Produce::kind_to_symbol(kind *K) { #endif #ifndef CORE_MODULE #ifdef PIPELINE_MODULE - return CodeGen::Pipeline::uks(); + return RunningPipelines::uks(); #endif #ifndef PIPELINE_MODULE return NULL; diff --git a/inter/final-module/Chapter 2/Code Generation.w b/inter/final-module/Chapter 2/Code Generation.w index 84fc539f3..e05ccce41 100644 --- a/inter/final-module/Chapter 2/Code Generation.w +++ b/inter/final-module/Chapter 2/Code Generation.w @@ -12,17 +12,17 @@ the same function. = void CodeGen::create_pipeline_stage(void) { - CodeGen::Stage::new(I"generate", CodeGen::run_pipeline_stage, + ParsingPipelines::new_stage(I"generate", CodeGen::run_pipeline_stage, TEXT_OUT_STAGE_ARG, FALSE); - CodeGen::Stage::new(I"optionally-generate", CodeGen::run_pipeline_stage, + ParsingPipelines::new_stage(I"optionally-generate", CodeGen::run_pipeline_stage, OPTIONAL_TEXT_OUT_STAGE_ARG, FALSE); } int CodeGen::run_pipeline_stage(pipeline_step *step) { if (step->generator_argument) { - code_generation *gen = CodeGen::new_generation(step->parsed_filename, - step->to_stream, step->repository, step->package_argument, - step->generator_argument, step->for_VM, FALSE); + code_generation *gen = CodeGen::new_generation(step->ephemera.parsed_filename, + step->ephemera.to_stream, step->ephemera.repository, step->package_argument, + step->generator_argument, step->ephemera.for_VM, FALSE); Generators::go(gen); } return TRUE; diff --git a/inter/pipeline-module/Chapter 1/Pipeline Module.w b/inter/pipeline-module/Chapter 1/Pipeline Module.w index ec71e365e..4df809d60 100644 --- a/inter/pipeline-module/Chapter 1/Pipeline Module.w +++ b/inter/pipeline-module/Chapter 1/Pipeline Module.w @@ -11,7 +11,7 @@ which use this module: @ This module defines the following classes: @e I6T_intervention_CLASS -@e codegen_pipeline_CLASS +@e inter_pipeline_CLASS @e pipeline_step_CLASS @e uniqueness_count_CLASS @e text_literal_holder_CLASS @@ -23,7 +23,7 @@ which use this module: = DECLARE_CLASS(I6T_intervention) -DECLARE_CLASS(codegen_pipeline) +DECLARE_CLASS(inter_pipeline) DECLARE_CLASS(pipeline_step) DECLARE_CLASS(uniqueness_count) DECLARE_CLASS(text_literal_holder) diff --git a/inter/pipeline-module/Chapter 1/Pipelines.w b/inter/pipeline-module/Chapter 1/Pipelines.w deleted file mode 100644 index d263fa5ac..000000000 --- a/inter/pipeline-module/Chapter 1/Pipelines.w +++ /dev/null @@ -1,523 +0,0 @@ -[CodeGen::Pipeline::] Pipelines. - -To build and run through pipelines of code generation stages. - -@h Steps. -A "step" is a single step in a pipeline of commands: it consists of a -choice of stage, together with a choice of argument. The other elements here -are all temporary storage for information needed when the step is run; they -have no meaningful contents when the step is not running. - -= -typedef struct pipeline_step { - struct pipeline_stage *step_stage; - struct text_stream *step_argument; - struct code_generator *generator_argument; - int take_generator_argument_from_VM; - struct text_stream *package_URL_argument; - struct inter_package *package_argument; - struct filename *parsed_filename; - struct linked_list *the_PP; /* of |pathname| */ - int to_debugging_log; - int from_memory; - int repository_argument; - struct text_stream *to_stream; - struct linked_list *requirements_list; /* of |inter_library| */ - struct inter_tree *repository; - struct codegen_pipeline *pipeline; - struct target_vm *for_VM; - CLASS_DEFINITION -} pipeline_step; - -pipeline_step *CodeGen::Pipeline::new_step(void) { - pipeline_step *step = CREATE(pipeline_step); - step->step_stage = NULL; - step->step_argument = NULL; - step->package_URL_argument = NULL; - step->package_argument = NULL; - step->repository_argument = 0; - step->generator_argument = NULL; - step->take_generator_argument_from_VM = FALSE; - CodeGen::Pipeline::clean_step(step); - return step; -} - -@ This wipes clean the temporary storage for a step. - -= -void CodeGen::Pipeline::clean_step(pipeline_step *step) { - step->parsed_filename = NULL; - step->to_stream = NULL; - step->to_debugging_log = FALSE; - step->from_memory = FALSE; - step->the_PP = NULL; - step->repository = NULL; - step->pipeline = NULL; - step->requirements_list = NEW_LINKED_LIST(inter_library); - step->for_VM = NULL; -} - -@ Here we write a textual description to a string, which is useful for -logging: - -= -void CodeGen::Pipeline::write_step(OUTPUT_STREAM, pipeline_step *step) { - WRITE("%S", step->step_stage->stage_name); - if (step->step_stage->stage_arg != NO_STAGE_ARG) { - if (step->repository_argument > 0) { - WRITE(" %d", step->repository_argument); - if (Str::len(step->package_URL_argument) > 0) WRITE(":%S", step->package_URL_argument); - } else { - if (Str::len(step->package_URL_argument) > 0) WRITE(" %S", step->package_URL_argument); - } - if (step->step_stage->takes_repository) WRITE(" <- %S", step->step_argument); - if (step->generator_argument) WRITE(" %S -> %S", step->generator_argument->generator_name, step->step_argument); - } -} - -pipeline_step *CodeGen::Pipeline::read_step(text_stream *step, dictionary *D, - text_file_position *tfp) { - CodeGen::Stage::make_stages(); - Generators::make_all(); - pipeline_step *ST = CodeGen::Pipeline::new_step(); - match_results mr = Regexp::create_mr(); - int left_arrow_used = FALSE; - int allow_unknown_variables = FALSE; - if (Regexp::match(&mr, step, L"optionally-%c+")) allow_unknown_variables = TRUE; - if (Regexp::match(&mr, step, L"(%c+?) *<- *(%c*)")) { - if (Str::len(mr.exp[1]) > 0) { - ST->step_argument = CodeGen::Pipeline::read_parameter(mr.exp[1], D, tfp, allow_unknown_variables); - if (ST->step_argument == NULL) return NULL; - } else { - Errors::in_text_file_S(I"no source to right of arrow", tfp); - return NULL; - } - Str::copy(step, mr.exp[0]); - left_arrow_used = TRUE; - } else if (Regexp::match(&mr, step, L"(%c+?) (%C+) *-> *(%c*)")) { - code_generator *cgt = Generators::find(mr.exp[1]); - if (cgt == NULL) { - TEMPORARY_TEXT(ERR) - WRITE_TO(ERR, "no such code generation format as '%S'\n", mr.exp[1]); - Errors::in_text_file_S(ERR, tfp); - DISCARD_TEXT(ERR) - return NULL; - } else { - ST->generator_argument = cgt; - } - ST->step_argument = CodeGen::Pipeline::read_parameter(mr.exp[2], D, tfp, allow_unknown_variables); - if (ST->step_argument == NULL) return NULL; - Str::copy(step, mr.exp[0]); - } else if (Regexp::match(&mr, step, L"(%c+?) *-> *(%c*)")) { - ST->generator_argument = NULL; - ST->take_generator_argument_from_VM = TRUE; - ST->step_argument = CodeGen::Pipeline::read_parameter(mr.exp[1], D, tfp, allow_unknown_variables); - if (ST->step_argument == NULL) return NULL; - Str::copy(step, mr.exp[0]); - } - if (Regexp::match(&mr, step, L"(%C+?) (%d)")) { - ST->repository_argument = Str::atoi(mr.exp[1], 0); - Str::copy(step, mr.exp[0]); - } else if (Regexp::match(&mr, step, L"(%C+?) (%d):(%c*)")) { - ST->repository_argument = Str::atoi(mr.exp[1], 0); - if (Str::len(mr.exp[2]) > 0) { - ST->package_URL_argument = CodeGen::Pipeline::read_parameter(mr.exp[2], D, tfp, allow_unknown_variables); - if (ST->package_URL_argument == NULL) return NULL; - } - Str::copy(step, mr.exp[0]); - } else if (Regexp::match(&mr, step, L"(%C+?) (%c+)")) { - ST->package_URL_argument = CodeGen::Pipeline::read_parameter(mr.exp[1], D, tfp, allow_unknown_variables); - if (ST->package_URL_argument == NULL) return NULL; - Str::copy(step, mr.exp[0]); - } - - pipeline_stage *stage; - LOOP_OVER(stage, pipeline_stage) - if (Str::eq(step, stage->stage_name)) - ST->step_stage = stage; - if (ST->step_stage == NULL) { - TEMPORARY_TEXT(ERR) - WRITE_TO(ERR, "no such stage as '%S'\n", step); - Errors::in_text_file_S(ERR, tfp); - DISCARD_TEXT(ERR) - return NULL; - } - if (ST->step_stage->takes_repository) { - if (left_arrow_used == FALSE) { - Errors::in_text_file_S(I"this stage should take a left arrow and a source", tfp); - return NULL; - } - } else { - if (left_arrow_used) { - Errors::in_text_file_S(I"this stage should not take a left arrow and a source", tfp); - return NULL; - } - } - - Regexp::dispose_of(&mr); - return ST; -} - -text_stream *CodeGen::Pipeline::read_parameter(text_stream *from, dictionary *D, - text_file_position *tfp, int allow_unknown_variables) { - if (Str::get_first_char(from) == '*') { - text_stream *find = Dictionaries::get_text(D, from); - if (find) return Str::duplicate(find); - if (allow_unknown_variables == FALSE) { - TEMPORARY_TEXT(ERR) - WRITE_TO(ERR, "no such pipeline variable as '%S'\n", from); - Errors::in_text_file_S(ERR, tfp); - DISCARD_TEXT(ERR) - } else { - return I""; - } - } - return Str::duplicate(from); -} - -@h Pipelines. -And then a pipeline is just a linked list of steps. - -= -typedef struct codegen_pipeline { - struct dictionary *variables; - struct inter_tree *memory_repository; - struct inter_tree *repositories[10]; - struct linked_list *steps; /* of |pipeline_step| */ - int erroneous; - CLASS_DEFINITION -} codegen_pipeline; - -dictionary *CodeGen::Pipeline::basic_dictionary(text_stream *leafname) { - dictionary *D = Dictionaries::new(16, TRUE); - if (Str::len(leafname) > 0) Str::copy(Dictionaries::create_text(D, I"*out"), leafname); - Str::copy(Dictionaries::create_text(D, I"*log"), I"*log"); - return D; -} - -codegen_pipeline *CodeGen::Pipeline::new(dictionary *D) { - codegen_pipeline *S = CREATE(codegen_pipeline); - S->variables = D; - S->steps = NEW_LINKED_LIST(pipeline_step); - S->memory_repository = NULL; - S->erroneous = FALSE; - for (int i=0; i<10; i++) S->repositories[i] = NULL; - return S; -} - -codegen_pipeline *CodeGen::Pipeline::parse_from_file(filename *F, dictionary *D) { - codegen_pipeline *S = CodeGen::Pipeline::new(D); - TextFiles::read(F, FALSE, "can't open inter pipeline file", - TRUE, CodeGen::Pipeline::scan_line, NULL, (void *) S); - if (S->erroneous) return NULL; - return S; -} - -void CodeGen::Pipeline::scan_line(text_stream *line, text_file_position *tfp, void *X) { - codegen_pipeline *S = (codegen_pipeline *) X; - CodeGen::Pipeline::parse_into(S, line, tfp); -} - -codegen_pipeline *CodeGen::Pipeline::parse(text_stream *instructions, dictionary *D) { - codegen_pipeline *S = CodeGen::Pipeline::new(D); - CodeGen::Pipeline::parse_into(S, instructions, NULL); - if (S->erroneous) return NULL; - return S; -} - -void CodeGen::Pipeline::parse_into(codegen_pipeline *S, text_stream *instructions, - text_file_position *tfp) { - TEMPORARY_TEXT(T) - LOOP_THROUGH_TEXT(P, instructions) - if (Characters::is_babel_whitespace(Str::get(P))) - PUT_TO(T, ' '); - else - PUT_TO(T, Str::get(P)); - match_results mr = Regexp::create_mr(); - while (Regexp::match(&mr, T, L" *(%c+?) *,+ *(%c*?) *")) { - pipeline_step *ST = CodeGen::Pipeline::read_step(mr.exp[0], S->variables, tfp); - if (ST) ADD_TO_LINKED_LIST(ST, pipeline_step, S->steps); - else S->erroneous = TRUE; - Str::copy(T, mr.exp[1]); - } - if (Regexp::match(&mr, T, L" *(%c+?) *")) { - pipeline_step *ST = CodeGen::Pipeline::read_step(mr.exp[0], S->variables, tfp); - if (ST) ADD_TO_LINKED_LIST(ST, pipeline_step, S->steps); - else S->erroneous = TRUE; - } - Regexp::dispose_of(&mr); - DISCARD_TEXT(T) -} - -void CodeGen::Pipeline::set_repository(codegen_pipeline *S, inter_tree *I) { - S->memory_repository = I; -} - -void CodeGen::Pipeline::run(pathname *P, codegen_pipeline *S, linked_list *PP, - linked_list *requirements_list, target_vm *VM) { - if (S == NULL) return; - stopwatch_timer *within = NULL; - #ifdef CORE_MODULE - within = inform7_timer; - #endif - stopwatch_timer *pipeline_timer = - Time::start_stopwatch(within, I"running Inter pipeline"); - - int step_count = 0, step_total = 0; - pipeline_step *step; - LOOP_OVER_LINKED_LIST(step, pipeline_step, S->steps) step_total++; - - int active = TRUE; - stopwatch_timer *prep_timer = NULL; - LOOP_OVER_LINKED_LIST(step, pipeline_step, S->steps) - if (active) { - if (prep_timer == NULL) - prep_timer = Time::start_stopwatch(pipeline_timer, I"step preparation"); - else - Time::resume_stopwatch(prep_timer); - if (S->repositories[step->repository_argument] == NULL) - S->repositories[step->repository_argument] = InterTree::new(); - inter_tree *I = S->repositories[step->repository_argument]; - if (I == NULL) internal_error("no repository"); - CodeGen::Pipeline::prepare_to_run(I); - CodeGen::Pipeline::lint(I); - - CodeGen::Pipeline::clean_step(step); - step->the_PP = PP; - step->repository = I; - step->pipeline = S; - step->requirements_list = requirements_list; - step->for_VM = VM; - if ((VM) && (step->take_generator_argument_from_VM)) { - step->generator_argument = Generators::find_for(VM); - if (step->generator_argument == NULL) { - #ifdef PROBLEMS_MODULE - Problems::fatal("Unable to guess target format"); - #endif - #ifndef PROBLEMS_MODULE - Errors::fatal("Unable to guess target format"); - exit(1); - #endif - } - } - - step->package_argument = NULL; - if (Str::len(step->package_URL_argument) > 0) { - step->package_argument = - Inter::Packages::by_url(step->repository, step->package_URL_argument); - if (step->package_argument == NULL) { - CodeGen::Pipeline::error_with("no such package as '%S'", step->package_URL_argument); - continue; - } - } - - Time::stop_stopwatch(prep_timer); - - int skip_step = FALSE; - TEMPORARY_TEXT(STAGE_NAME) - WRITE_TO(STAGE_NAME, "inter step %d/%d: ", ++step_count, step_total); - CodeGen::Pipeline::write_step(STAGE_NAME, step); - Log::new_stage(STAGE_NAME); - stopwatch_timer *step_timer = - Time::start_stopwatch(pipeline_timer, STAGE_NAME); - DISCARD_TEXT(STAGE_NAME) - - if ((step->step_stage->stage_arg == FILE_STAGE_ARG) || - (step->step_stage->stage_arg == TEXT_OUT_STAGE_ARG) || - (step->step_stage->stage_arg == OPTIONAL_TEXT_OUT_STAGE_ARG) || - (step->step_stage->stage_arg == EXT_FILE_STAGE_ARG) || - (step->step_stage->stage_arg == EXT_TEXT_OUT_STAGE_ARG)) { - if (Str::len(step->step_argument) == 0) { - if (step->step_stage->stage_arg == OPTIONAL_TEXT_OUT_STAGE_ARG) { - skip_step = TRUE; - } else { - #ifdef PROBLEMS_MODULE - Problems::fatal("No filename given in pipeline step"); - #endif - #ifndef PROBLEMS_MODULE - Errors::fatal("No filename given in pipeline step"); - exit(1); - #endif - } - } else { - if (Str::eq(step->step_argument, I"*log")) { - step->to_debugging_log = TRUE; - } else if (Str::eq(step->step_argument, I"*memory")) { - S->repositories[step->repository_argument] = S->memory_repository; - skip_step = TRUE; - } else { - int slashes = FALSE; - LOOP_THROUGH_TEXT(pos, step->step_argument) - if (Str::get(pos) == '/') - slashes = TRUE; - if (slashes) step->parsed_filename = Filenames::from_text(step->step_argument); - else step->parsed_filename = Filenames::in(P, step->step_argument); - } - } - } - - text_stream text_output_struct; /* For any text file we might write */ - text_stream *T = &text_output_struct; - if (step->to_debugging_log) { - step->to_stream = DL; - } else if ((step->step_stage->stage_arg == TEXT_OUT_STAGE_ARG) || - (step->step_stage->stage_arg == OPTIONAL_TEXT_OUT_STAGE_ARG) || - (step->step_stage->stage_arg == EXT_TEXT_OUT_STAGE_ARG)) { - if ((step->parsed_filename) && - (STREAM_OPEN_TO_FILE(T, step->parsed_filename, ISO_ENC) == FALSE)) { - #ifdef PROBLEMS_MODULE - Problems::fatal_on_file("Can't open output file", step->parsed_filename); - #endif - #ifndef PROBLEMS_MODULE - Errors::fatal_with_file("Can't open output file", step->parsed_filename); - exit(1); - #endif - } - step->to_stream = T; - } - - if (skip_step == FALSE) - active = (*(step->step_stage->execute))(step); - - if (((step->step_stage->stage_arg == TEXT_OUT_STAGE_ARG) || - (step->step_stage->stage_arg == EXT_TEXT_OUT_STAGE_ARG)) && - (step->to_debugging_log == FALSE)) { - STREAM_CLOSE(T); - } - Time::stop_stopwatch(step_timer); - } - Time::stop_stopwatch(pipeline_timer); -} - -@h Following. - -= -inter_symbol *unchecked_kind_symbol = NULL; -inter_symbol *unchecked_function_symbol = NULL; -inter_symbol *typeless_int_symbol = NULL; -inter_symbol *list_of_unchecked_kind_symbol = NULL; -inter_symbol *object_kind_symbol = NULL; -inter_symbol *action_kind_symbol = NULL; -inter_symbol *truth_state_kind_symbol = NULL; -inter_symbol *direction_kind_symbol = NULL; - -inter_symbol *verb_directive_reverse_symbol = NULL; -inter_symbol *verb_directive_slash_symbol = NULL; -inter_symbol *verb_directive_divider_symbol = NULL; -inter_symbol *verb_directive_result_symbol = NULL; -inter_symbol *verb_directive_special_symbol = NULL; -inter_symbol *verb_directive_number_symbol = NULL; -inter_symbol *verb_directive_noun_symbol = NULL; -inter_symbol *verb_directive_multi_symbol = NULL; -inter_symbol *verb_directive_multiinside_symbol = NULL; -inter_symbol *verb_directive_multiheld_symbol = NULL; -inter_symbol *verb_directive_held_symbol = NULL; -inter_symbol *verb_directive_creature_symbol = NULL; -inter_symbol *verb_directive_topic_symbol = NULL; -inter_symbol *verb_directive_multiexcept_symbol = NULL; - -inter_symbol *code_ptype_symbol = NULL; -inter_symbol *plain_ptype_symbol = NULL; -inter_symbol *submodule_ptype_symbol = NULL; -inter_symbol *function_ptype_symbol = NULL; -inter_symbol *action_ptype_symbol = NULL; -inter_symbol *command_ptype_symbol = NULL; -inter_symbol *property_ptype_symbol = NULL; -inter_symbol *to_phrase_ptype_symbol = NULL; - -void CodeGen::Pipeline::prepare_to_run(inter_tree *I) { - - code_ptype_symbol = InterSymbolsTables::url_name_to_symbol(I, NULL, I"/_code"); - plain_ptype_symbol = InterSymbolsTables::url_name_to_symbol(I, NULL, I"/_plain"); - submodule_ptype_symbol = InterSymbolsTables::url_name_to_symbol(I, NULL, I"/_submodule"); - function_ptype_symbol = InterSymbolsTables::url_name_to_symbol(I, NULL, I"/_function"); - action_ptype_symbol = InterSymbolsTables::url_name_to_symbol(I, NULL, I"/_action"); - command_ptype_symbol = InterSymbolsTables::url_name_to_symbol(I, NULL, I"/_command"); - property_ptype_symbol = InterSymbolsTables::url_name_to_symbol(I, NULL, I"/_property"); - to_phrase_ptype_symbol = InterSymbolsTables::url_name_to_symbol(I, NULL, I"/_to_phrase"); - - unchecked_kind_symbol = Inter::Packages::search_resources_exhaustively(I, I"K_unchecked"); - unchecked_function_symbol = Inter::Packages::search_resources_exhaustively(I, I"K_unchecked_function"); - typeless_int_symbol = Inter::Packages::search_resources_exhaustively(I, I"K_typeless_int"); - list_of_unchecked_kind_symbol = Inter::Packages::search_resources_exhaustively(I, I"K_list_of_values"); - object_kind_symbol = Inter::Packages::search_resources_exhaustively(I, I"K_object"); - action_kind_symbol = Inter::Packages::search_resources_exhaustively(I, I"K_action_name"); - truth_state_kind_symbol = Inter::Packages::search_resources_exhaustively(I, I"K_truth_state"); - direction_kind_symbol = Inter::Packages::search_resources_exhaustively(I, I"K3_direction"); - - verb_directive_reverse_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_REVERSE"); - verb_directive_slash_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_SLASH"); - verb_directive_divider_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_DIVIDER"); - verb_directive_result_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_RESULT"); - verb_directive_special_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_SPECIAL"); - verb_directive_number_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_NUMBER"); - verb_directive_noun_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_NOUN"); - verb_directive_multi_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_MULTI"); - verb_directive_multiinside_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_MULTIINSIDE"); - verb_directive_multiheld_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_MULTIHELD"); - verb_directive_held_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_HELD"); - verb_directive_creature_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_CREATURE"); - verb_directive_topic_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_TOPIC"); - verb_directive_multiexcept_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_MULTIEXCEPT"); -} - -void CodeGen::Pipeline::lint(inter_tree *I) { - InterTree::traverse(I, CodeGen::Pipeline::visitor, NULL, NULL, -PACKAGE_IST); -} - -void CodeGen::Pipeline::visitor(inter_tree *I, inter_tree_node *P, void *state) { - inter_ti c = Inode::get_package(P)->index_n; - inter_ti a = Inode::get_package_alt(P); - if (c != a) { - LOG("Frame gives package as $6, but its location is in package $6\n", - Inode::ID_to_package(P, c), - Inode::ID_to_package(P, a)); - WRITE_TO(STDERR, "Frame gives package as %d, but its location is in package %d\n", - Inode::ID_to_package(P, c)->index_n, - Inode::ID_to_package(P, a)->index_n); - internal_error("misplaced package"); - } - - Produce::guard(Inter::Defn::verify_children_inner(P)); -} - -inter_symbol *CodeGen::Pipeline::uks(void) { - if (unchecked_kind_symbol == NULL) internal_error("no unchecked kind symbol"); - return unchecked_kind_symbol; -} - -void CodeGen::Pipeline::error(char *erm) { - #ifdef PROBLEMS_MODULE - TEMPORARY_TEXT(full) - WRITE_TO(full, "%s", erm); - do_not_locate_problems = TRUE; - Problems::quote_stream(1, full); - Problems::issue_problem_begin(NULL, erm); - Problems::issue_problem_segment("I was unable to perform final code-generation: %1"); - Problems::issue_problem_end(); - do_not_locate_problems = FALSE; - DISCARD_TEXT(full) - #endif - #ifndef PROBLEMS_MODULE - Errors::fatal(erm); - exit(1); - #endif -} - -void CodeGen::Pipeline::error_with(char *erm, text_stream *quoted) { - #ifdef PROBLEMS_MODULE - TEMPORARY_TEXT(full) - WRITE_TO(full, erm, quoted); - do_not_locate_problems = TRUE; - Problems::quote_stream(1, full); - Problems::issue_problem_begin(NULL, erm); - Problems::issue_problem_segment("I was unable to perform final code-generation: %1"); - Problems::issue_problem_end(); - do_not_locate_problems = FALSE; - DISCARD_TEXT(full) - #endif - #ifndef PROBLEMS_MODULE - Errors::fatal_with_text(erm, quoted); - exit(1); - #endif -} diff --git a/inter/pipeline-module/Chapter 1/Stages.w b/inter/pipeline-module/Chapter 1/Stages.w deleted file mode 100644 index fadab4acf..000000000 --- a/inter/pipeline-module/Chapter 1/Stages.w +++ /dev/null @@ -1,107 +0,0 @@ -[CodeGen::Stage::] Stages. - -To create the stages through which code generation proceeds. - -@h Stages. -Each possible pipeline stage is represented by a single instance of the -following. Some stages are invoked with an argument, often the filename to -write output to; others are not. - -@e NO_STAGE_ARG from 1 -@e GENERAL_STAGE_ARG -@e FILE_STAGE_ARG -@e TEXT_OUT_STAGE_ARG -@e OPTIONAL_TEXT_OUT_STAGE_ARG -@e EXT_FILE_STAGE_ARG -@e EXT_TEXT_OUT_STAGE_ARG -@e TEMPLATE_FILE_STAGE_ARG - -= -typedef struct pipeline_stage { - struct text_stream *stage_name; - int (*execute)(void *); - int stage_arg; /* one of the |*_ARG| values above */ - int takes_repository; - CLASS_DEFINITION -} pipeline_stage; - -pipeline_stage *CodeGen::Stage::new(text_stream *name, int (*X)(struct pipeline_step *), int arg, int tr) { - pipeline_stage *stage = CREATE(pipeline_stage); - stage->stage_name = Str::duplicate(name); - stage->execute = (int (*)(void *)) X; - stage->stage_arg = arg; - stage->takes_repository = tr; - return stage; -} - -@h Creation. -To add a new pipeline stage, put the code for it into a new section in -Chapter 2, and then add a call to its |create_pipeline_stage| routine -to the routine below. - -= -int stages_made = FALSE; -void CodeGen::Stage::make_stages(void) { - if (stages_made == FALSE) { - stages_made = TRUE; - CodeGen::Stage::new(I"stop", CodeGen::Stage::run_stop_stage, NO_STAGE_ARG, FALSE); - - CodeGen::Stage::new(I"wipe", CodeGen::Stage::run_wipe_stage, NO_STAGE_ARG, FALSE); - CodeGen::Stage::new(I"read", CodeGen::Stage::run_read_stage, FILE_STAGE_ARG, TRUE); - CodeGen::Stage::new(I"move", CodeGen::Stage::run_move_stage, GENERAL_STAGE_ARG, TRUE); - - CodeGen::create_pipeline_stage(); - CodeGen::Architecture::create_pipeline_stage(); - CodeGen::LinkInstructions::create_pipeline_stage(); - CodeGen::Assimilate::create_pipeline_stage(); - DetectIndirectCalls::create_pipeline_stage(); - CodeGen::Eliminate::create_pipeline_stage(); - CodeGen::Externals::create_pipeline_stage(); - CodeGen::Inspection::create_pipeline_stage(); - CodeGen::Labels::create_pipeline_stage(); - CodeGen::Operations::create_pipeline_stage(); - Synoptic::create_pipeline_stage(); - CodeGen::MergeTemplate::create_pipeline_stage(); - CodeGen::PLM::create_pipeline_stage(); - CodeGen::RCC::create_pipeline_stage(); - CodeGen::ReconcileVerbs::create_pipeline_stage(); - CodeGen::Uniqueness::create_pipeline_stage(); - } -} - -@ The "stop" stage is special, in that it always returns false, thus stopping -the pipeline: - -= -int CodeGen::Stage::run_stop_stage(pipeline_step *step) { - return FALSE; -} - -int CodeGen::Stage::run_wipe_stage(pipeline_step *step) { - Inter::Warehouse::wipe(); - return TRUE; -} - -int CodeGen::Stage::run_read_stage(pipeline_step *step) { - filename *F = step->parsed_filename; - if (Inter::Binary::test_file(F)) Inter::Binary::read(step->repository, F); - else Inter::Textual::read(step->repository, F); - return TRUE; -} - -int CodeGen::Stage::run_move_stage(pipeline_step *step) { - match_results mr = Regexp::create_mr(); - inter_package *pack = NULL; - if (Regexp::match(&mr, step->step_argument, L"(%d):(%c+)")) { - int from_rep = Str::atoi(mr.exp[0], 0); - if (step->pipeline->repositories[from_rep] == NULL) - internal_error("no such repository"); - pack = Inter::Packages::by_url( - step->pipeline->repositories[from_rep], mr.exp[1]); - } - Regexp::dispose_of(&mr); - if (pack == NULL) internal_error("not a package"); - Inter::Transmigration::move(pack, Site::main_package(step->repository), FALSE); - - return TRUE; -} diff --git a/inter/pipeline-module/Chapter 2/Parsing Pipelines.w b/inter/pipeline-module/Chapter 2/Parsing Pipelines.w new file mode 100644 index 000000000..0619f1a36 --- /dev/null +++ b/inter/pipeline-module/Chapter 2/Parsing Pipelines.w @@ -0,0 +1,338 @@ +[ParsingPipelines::] Parsing Pipelines. + +To parse pipelines from text files. + +@h How pipelines are stored. +An //inter_pipeline// is a linked list of //pipeline_step//s, together with +some associated storage used when it runs: this is for storing variables and +pointers to trees being worked on. + += +typedef struct inter_pipeline { + struct linked_list *steps; /* of |pipeline_step| */ + struct dictionary *variables; + int erroneous; /* a syntax error occurred when parsing this */ + struct pipeline_ephemera ephemera; /* temporary storage when running */ + CLASS_DEFINITION +} inter_pipeline; + +inter_pipeline *ParsingPipelines::new_pipeline(dictionary *D) { + inter_pipeline *S = CREATE(inter_pipeline); + S->variables = D; + S->steps = NEW_LINKED_LIST(pipeline_step); + S->erroneous = FALSE; + RunningPipelines::clean_pipeline(S); + return S; +} + +@ A //pipeline_step// is really only a choice of //pipeline_stage//, but comes +along with a wide variety of options and parameter settings, so that it looks +much more complicated than it actually is. + += +typedef struct pipeline_step { + struct pipeline_stage *step_stage; + struct text_stream *step_argument; + struct code_generator *generator_argument; + int take_generator_argument_from_VM; + struct text_stream *package_URL_argument; + struct inter_package *package_argument; + int repository_argument; + struct pipeline_step_ephemera ephemera; /* temporary storage when running */ + CLASS_DEFINITION +} pipeline_step; + +pipeline_step *ParsingPipelines::new_step(void) { + pipeline_step *step = CREATE(pipeline_step); + step->step_stage = NULL; + step->step_argument = NULL; + step->package_URL_argument = NULL; + step->package_argument = NULL; + step->repository_argument = 0; + step->generator_argument = NULL; + step->take_generator_argument_from_VM = FALSE; + RunningPipelines::clean_step(step); + return step; +} + +@ And a //pipeline_stage// is simply a choice of what to do. For example, +|eliminate-redundant-labels| is a pipeline stage. This would need to be +combined with details of what tree to apply to in order to become a step. + +@e NO_STAGE_ARG from 1 +@e GENERAL_STAGE_ARG +@e FILE_STAGE_ARG +@e TEXT_OUT_STAGE_ARG +@e OPTIONAL_TEXT_OUT_STAGE_ARG +@e EXT_FILE_STAGE_ARG +@e EXT_TEXT_OUT_STAGE_ARG +@e TEMPLATE_FILE_STAGE_ARG + += +typedef struct pipeline_stage { + struct text_stream *stage_name; + int (*execute)(void *); + int stage_arg; /* one of the |*_ARG| values above */ + int takes_repository; + CLASS_DEFINITION +} pipeline_stage; + +pipeline_stage *ParsingPipelines::new_stage(text_stream *name, + int (*X)(struct pipeline_step *), int arg, int tr) { + pipeline_stage *stage = CREATE(pipeline_stage); + stage->stage_name = Str::duplicate(name); + stage->execute = (int (*)(void *)) X; + stage->stage_arg = arg; + stage->takes_repository = tr; + return stage; +} + +@h Parsing. +All pipelines originate as textual descriptions, either from a text file or +supplied on the command line. Here, we turn such a description -- in effect +a program for a very simple programming language -- into an //inter_pipeline//. + += +inter_pipeline *ParsingPipelines::from_file(filename *F, dictionary *D) { + inter_pipeline *S = ParsingPipelines::new_pipeline(D); + TextFiles::read(F, FALSE, "can't open inter pipeline file", + TRUE, ParsingPipelines::scan_line, NULL, (void *) S); + if (S->erroneous) return NULL; + return S; +} + +void ParsingPipelines::scan_line(text_stream *line, text_file_position *tfp, void *X) { + inter_pipeline *S = (inter_pipeline *) X; + ParsingPipelines::parse_line(S, line, tfp); +} + +inter_pipeline *ParsingPipelines::from_text(text_stream *instructions, dictionary *D) { + inter_pipeline *S = ParsingPipelines::new_pipeline(D); + ParsingPipelines::parse_line(S, instructions, NULL); + if (S->erroneous) return NULL; + return S; +} + +@ Either way, then, a sequence of 1 or more textual lines of description is +passed to the following. It breaks down the line into 1 or more steps, divided +by commas. + += +void ParsingPipelines::parse_line(inter_pipeline *S, text_stream *instructions, + text_file_position *tfp) { + TEMPORARY_TEXT(T) + LOOP_THROUGH_TEXT(P, instructions) + if (Characters::is_babel_whitespace(Str::get(P))) + PUT_TO(T, ' '); + else + PUT_TO(T, Str::get(P)); + match_results mr = Regexp::create_mr(); + while (Regexp::match(&mr, T, L" *(%c+?) *,+ *(%c*?) *")) { + pipeline_step *ST = ParsingPipelines::parse_step(mr.exp[0], S->variables, tfp); + if (ST) ADD_TO_LINKED_LIST(ST, pipeline_step, S->steps); + else S->erroneous = TRUE; + Str::copy(T, mr.exp[1]); + } + if (Regexp::match(&mr, T, L" *(%c+?) *")) { + pipeline_step *ST = ParsingPipelines::parse_step(mr.exp[0], S->variables, tfp); + if (ST) ADD_TO_LINKED_LIST(ST, pipeline_step, S->steps); + else S->erroneous = TRUE; + } + Regexp::dispose_of(&mr); + DISCARD_TEXT(T) +} + +@ Finally, an individual textual description |S| of a dtep is turned into a +//pipeline_step//. + +For documentation on the syntax here, see //inter: Pipelines and Stages//. + += +pipeline_step *ParsingPipelines::parse_step(text_stream *S, dictionary *D, + text_file_position *tfp) { + pipeline_step *step = ParsingPipelines::new_step(); + match_results mr = Regexp::create_mr(); + + int allow_unknown = FALSE; + if (Regexp::match(&mr, S, L"optionally-%c+")) allow_unknown = TRUE; + + int left_arrow_used = FALSE; + if (Regexp::match(&mr, S, L"(%c+?) *<- *(%c*)")) @ + else if (Regexp::match(&mr, S, L"(%c+?) (%C+) *-> *(%c*)")) @ + else if (Regexp::match(&mr, S, L"(%c+?) *-> *(%c*)")) @; + + if (Regexp::match(&mr, S, L"(%C+?) (%d)")) @ + else if (Regexp::match(&mr, S, L"(%C+?) (%d):(%c*)")) @ + else if (Regexp::match(&mr, S, L"(%C+?) (%c+)")) @; + + step->step_stage = ParsingPipelines::parse_stage(S); + @; + + Regexp::dispose_of(&mr); + return step; +} + +@ = + if (Str::len(mr.exp[1]) > 0) { + step->step_argument = ParsingPipelines::text_arg(mr.exp[1], D, tfp, allow_unknown); + if (step->step_argument == NULL) return NULL; + } else { + Errors::in_text_file_S(I"no source to right of arrow", tfp); + return NULL; + } + Str::copy(S, mr.exp[0]); + left_arrow_used = TRUE; + +@ = + code_generator *cgt = Generators::find(mr.exp[1]); + if (cgt == NULL) { + TEMPORARY_TEXT(ERR) + WRITE_TO(ERR, "no such code generation format as '%S'\n", mr.exp[1]); + Errors::in_text_file_S(ERR, tfp); + DISCARD_TEXT(ERR) + return NULL; + } else { + step->generator_argument = cgt; + } + step->step_argument = ParsingPipelines::text_arg(mr.exp[2], D, tfp, allow_unknown); + if (step->step_argument == NULL) return NULL; + Str::copy(S, mr.exp[0]); + +@ = + step->generator_argument = NULL; + step->take_generator_argument_from_VM = TRUE; + step->step_argument = ParsingPipelines::text_arg(mr.exp[1], D, tfp, allow_unknown); + if (step->step_argument == NULL) return NULL; + Str::copy(S, mr.exp[0]); + +@ = + step->repository_argument = Str::atoi(mr.exp[1], 0); + Str::copy(S, mr.exp[0]); + +@ = + step->repository_argument = Str::atoi(mr.exp[1], 0); + if (Str::len(mr.exp[2]) > 0) { + step->package_URL_argument = ParsingPipelines::text_arg(mr.exp[2], D, tfp, allow_unknown); + if (step->package_URL_argument == NULL) return NULL; + } + Str::copy(S, mr.exp[0]); + +@ = + step->package_URL_argument = ParsingPipelines::text_arg(mr.exp[1], D, tfp, allow_unknown); + if (step->package_URL_argument == NULL) return NULL; + Str::copy(S, mr.exp[0]); + +@ = + if (step->step_stage == NULL) { + TEMPORARY_TEXT(ERR) + WRITE_TO(ERR, "no such stage as '%S'\n", S); + Errors::in_text_file_S(ERR, tfp); + DISCARD_TEXT(ERR) + return NULL; + } + if (step->step_stage->takes_repository) { + if (left_arrow_used == FALSE) { + Errors::in_text_file_S( + I"this stage should take a left arrow and a source", tfp); + return NULL; + } + } else { + if (left_arrow_used) { + Errors::in_text_file_S( + I"this stage should not take a left arrow and a source", tfp); + return NULL; + } + } + +@ A textual argument beginning with an asterisk means "expand to the value of +this variable", which is required to exist unless |allow_unknown| is set. +If it is, then an empty text results as the argument. + += +text_stream *ParsingPipelines::text_arg(text_stream *from, dictionary *D, + text_file_position *tfp, int allow_unknown) { + if (Str::get_first_char(from) == '*') { + text_stream *find = Dictionaries::get_text(D, from); + if (find) return Str::duplicate(find); + if (allow_unknown == FALSE) { + TEMPORARY_TEXT(ERR) + WRITE_TO(ERR, "no such pipeline variable as '%S'\n", from); + Errors::in_text_file_S(ERR, tfp); + DISCARD_TEXT(ERR) + } else { + return I""; + } + } + return Str::duplicate(from); +} + +@h Stages. +Stages are a fixed set within this compiler: there's no way for a pipeline +file to specify a new one. + += +pipeline_stage *ParsingPipelines::parse_stage(text_stream *from) { + static int stages_made = FALSE; + if (stages_made == FALSE) { + stages_made = TRUE; + SimpleStages::create_pipeline_stages(); + CodeGen::create_pipeline_stage(); + CodeGen::Architecture::create_pipeline_stage(); + CodeGen::LinkInstructions::create_pipeline_stage(); + CodeGen::Assimilate::create_pipeline_stage(); + DetectIndirectCalls::create_pipeline_stage(); + CodeGen::Eliminate::create_pipeline_stage(); + CodeGen::Externals::create_pipeline_stage(); + CodeGen::Inspection::create_pipeline_stage(); + CodeGen::Labels::create_pipeline_stage(); + CodeGen::Operations::create_pipeline_stage(); + Synoptic::create_pipeline_stage(); + CodeGen::MergeTemplate::create_pipeline_stage(); + CodeGen::PLM::create_pipeline_stage(); + CodeGen::RCC::create_pipeline_stage(); + CodeGen::ReconcileVerbs::create_pipeline_stage(); + CodeGen::Uniqueness::create_pipeline_stage(); + } + pipeline_stage *stage; + LOOP_OVER(stage, pipeline_stage) + if (Str::eq(from, stage->stage_name)) + return stage; + return NULL; +} + +@h Starting a variables dictionary. +Note that the above ways to create a pipeline all expect a dictionary of variable +names and their values to exist. These dictionaries are typically very small, +and by convention the main variable is |*out|, the leafname to write output to. +So the following utility is convenient for getting started. + += +dictionary *ParsingPipelines::basic_dictionary(text_stream *leafname) { + dictionary *D = Dictionaries::new(16, TRUE); + if (Str::len(leafname) > 0) Str::copy(Dictionaries::create_text(D, I"*out"), leafname); + Str::copy(Dictionaries::create_text(D, I"*log"), I"*log"); + return D; +} + +@h Back to text. +Here we write a textual description to a string, which is useful for logging: + += +void ParsingPipelines::write_step(OUTPUT_STREAM, pipeline_step *step) { + WRITE("%S", step->step_stage->stage_name); + if (step->step_stage->stage_arg != NO_STAGE_ARG) { + if (step->repository_argument > 0) { + WRITE(" %d", step->repository_argument); + if (Str::len(step->package_URL_argument) > 0) + WRITE(":%S", step->package_URL_argument); + } else { + if (Str::len(step->package_URL_argument) > 0) + WRITE(" %S", step->package_URL_argument); + } + if (step->step_stage->takes_repository) + WRITE(" <- %S", step->step_argument); + if (step->generator_argument) + WRITE(" %S -> %S", + step->generator_argument->generator_name, step->step_argument); + } +} diff --git a/inter/pipeline-module/Chapter 2/Read, Move, Wipe, Stop.w b/inter/pipeline-module/Chapter 2/Read, Move, Wipe, Stop.w new file mode 100644 index 000000000..b42be535f --- /dev/null +++ b/inter/pipeline-module/Chapter 2/Read, Move, Wipe, Stop.w @@ -0,0 +1,58 @@ +[SimpleStages::] Read, Move, Wipe, Stop. + +Four simple pipeline stages. + +@ = +void SimpleStages::create_pipeline_stages(void) { + ParsingPipelines::new_stage(I"stop", SimpleStages::run_stop_stage, NO_STAGE_ARG, FALSE); + ParsingPipelines::new_stage(I"wipe", SimpleStages::run_wipe_stage, NO_STAGE_ARG, FALSE); + ParsingPipelines::new_stage(I"read", SimpleStages::run_read_stage, FILE_STAGE_ARG, TRUE); + ParsingPipelines::new_stage(I"move", SimpleStages::run_move_stage, GENERAL_STAGE_ARG, TRUE); +} + +@h Read. + += +int SimpleStages::run_read_stage(pipeline_step *step) { + filename *F = step->ephemera.parsed_filename; + if (Inter::Binary::test_file(F)) Inter::Binary::read(step->ephemera.repository, F); + else Inter::Textual::read(step->ephemera.repository, F); + return TRUE; +} + +@h Move. + += +int SimpleStages::run_move_stage(pipeline_step *step) { + match_results mr = Regexp::create_mr(); + inter_package *pack = NULL; + if (Regexp::match(&mr, step->step_argument, L"(%d):(%c+)")) { + int from_rep = Str::atoi(mr.exp[0], 0); + if (step->ephemera.pipeline->ephemera.repositories[from_rep] == NULL) + internal_error("no such repository"); + pack = Inter::Packages::by_url( + step->ephemera.pipeline->ephemera.repositories[from_rep], mr.exp[1]); + } + Regexp::dispose_of(&mr); + if (pack == NULL) internal_error("not a package"); + Inter::Transmigration::move(pack, Site::main_package(step->ephemera.repository), FALSE); + + return TRUE; +} + +@h Wipe. + += +int SimpleStages::run_wipe_stage(pipeline_step *step) { + Inter::Warehouse::wipe(); + return TRUE; +} + +@h Stop. +The "stop" stage is special, in that it always returns false, thus stopping +the pipeline: + += +int SimpleStages::run_stop_stage(pipeline_step *step) { + return FALSE; +} diff --git a/inter/pipeline-module/Chapter 2/Running Pipelines.w b/inter/pipeline-module/Chapter 2/Running Pipelines.w new file mode 100644 index 000000000..36450172b --- /dev/null +++ b/inter/pipeline-module/Chapter 2/Running Pipelines.w @@ -0,0 +1,332 @@ +[RunningPipelines::] Running Pipelines. + +To run through pipelines of code generation stages. + +@h Ephemeral data. +This is temporary data meaningful only while a pipeline is running; it is +"cleaned", that is, reinitialised, at the start of each pipeline run. + += +typedef struct pipeline_ephemera { + struct inter_tree *memory_repository; + struct inter_tree *repositories[10]; +} pipeline_ephemera; + +void RunningPipelines::clean_pipeline(inter_pipeline *pl) { + pl->ephemera.memory_repository = NULL; + for (int i=0; i<10; i++) pl->ephemera.repositories[i] = NULL; +} + +@ = +typedef struct pipeline_step_ephemera { + struct filename *parsed_filename; + struct linked_list *the_PP; /* of |pathname| */ + int to_debugging_log; + int from_memory; + struct text_stream *to_stream; + struct linked_list *requirements_list; /* of |inter_library| */ + struct inter_tree *repository; + struct inter_pipeline *pipeline; + struct target_vm *for_VM; +} pipeline_step_ephemera; + +void RunningPipelines::clean_step(pipeline_step *step) { + step->ephemera.parsed_filename = NULL; + step->ephemera.to_stream = NULL; + step->ephemera.to_debugging_log = FALSE; + step->ephemera.from_memory = FALSE; + step->ephemera.the_PP = NULL; + step->ephemera.repository = NULL; + step->ephemera.pipeline = NULL; + step->ephemera.requirements_list = NEW_LINKED_LIST(inter_library); + step->ephemera.for_VM = NULL; +} + +@ This outer layer is all just instrumentation, really: we run through the +steps in turn, timing how long each one took us. + += +void RunningPipelines::run(pathname *P, inter_pipeline *S, inter_tree *I, + linked_list *PP, linked_list *requirements_list, target_vm *VM) { + if (S == NULL) return; + if (I) S->ephemera.memory_repository = I; + stopwatch_timer *within = NULL; + #ifdef CORE_MODULE + within = inform7_timer; + #endif + stopwatch_timer *pipeline_timer = + Time::start_stopwatch(within, I"running Inter pipeline"); + int step_count = 0, step_total = LinkedLists::len(S->steps); + int active = TRUE; + stopwatch_timer *prep_timer = NULL; + pipeline_step *step; + LOOP_OVER_LINKED_LIST(step, pipeline_step, S->steps) + if (active) { + if (prep_timer == NULL) + prep_timer = Time::start_stopwatch(pipeline_timer, I"step preparation"); + else + Time::resume_stopwatch(prep_timer); + @; + Time::stop_stopwatch(prep_timer); + TEMPORARY_TEXT(STAGE_NAME) + WRITE_TO(STAGE_NAME, "inter step %d/%d: ", ++step_count, step_total); + ParsingPipelines::write_step(STAGE_NAME, step); + Log::new_stage(STAGE_NAME); + stopwatch_timer *step_timer = + Time::start_stopwatch(pipeline_timer, STAGE_NAME); + DISCARD_TEXT(STAGE_NAME) + @; + Time::stop_stopwatch(step_timer); + } + Time::stop_stopwatch(pipeline_timer); +} + +@ = + if (S->ephemera.repositories[step->repository_argument] == NULL) + S->ephemera.repositories[step->repository_argument] = InterTree::new(); + inter_tree *I = S->ephemera.repositories[step->repository_argument]; + if (I == NULL) internal_error("no repository"); + RunningPipelines::prepare_to_run(I); + RunningPipelines::lint(I); + + RunningPipelines::clean_step(step); + step->ephemera.the_PP = PP; + step->ephemera.repository = I; + step->ephemera.pipeline = S; + step->ephemera.requirements_list = requirements_list; + step->ephemera.for_VM = VM; + if ((VM) && (step->take_generator_argument_from_VM)) { + step->generator_argument = Generators::find_for(VM); + if (step->generator_argument == NULL) { + #ifdef PROBLEMS_MODULE + Problems::fatal("Unable to guess target format"); + #endif + #ifndef PROBLEMS_MODULE + Errors::fatal("Unable to guess target format"); + exit(1); + #endif + } + } + + step->package_argument = NULL; + if (Str::len(step->package_URL_argument) > 0) { + step->package_argument = + Inter::Packages::by_url(step->ephemera.repository, step->package_URL_argument); + if (step->package_argument == NULL) { + RunningPipelines::error_with("no such package as '%S'", step->package_URL_argument); + continue; + } + } + +@ = + int skip_step = FALSE; + + if ((step->step_stage->stage_arg == FILE_STAGE_ARG) || + (step->step_stage->stage_arg == TEXT_OUT_STAGE_ARG) || + (step->step_stage->stage_arg == OPTIONAL_TEXT_OUT_STAGE_ARG) || + (step->step_stage->stage_arg == EXT_FILE_STAGE_ARG) || + (step->step_stage->stage_arg == EXT_TEXT_OUT_STAGE_ARG)) { + if (Str::len(step->step_argument) == 0) { + if (step->step_stage->stage_arg == OPTIONAL_TEXT_OUT_STAGE_ARG) { + skip_step = TRUE; + } else { + #ifdef PROBLEMS_MODULE + Problems::fatal("No filename given in pipeline step"); + #endif + #ifndef PROBLEMS_MODULE + Errors::fatal("No filename given in pipeline step"); + exit(1); + #endif + } + } else { + if (Str::eq(step->step_argument, I"*log")) { + step->ephemera.to_debugging_log = TRUE; + } else if (Str::eq(step->step_argument, I"*memory")) { + S->ephemera.repositories[step->repository_argument] = S->ephemera.memory_repository; + skip_step = TRUE; + } else { + int slashes = FALSE; + LOOP_THROUGH_TEXT(pos, step->step_argument) + if (Str::get(pos) == '/') + slashes = TRUE; + if (slashes) step->ephemera.parsed_filename = Filenames::from_text(step->step_argument); + else step->ephemera.parsed_filename = Filenames::in(P, step->step_argument); + } + } + } + + text_stream text_output_struct; /* For any text file we might write */ + text_stream *T = &text_output_struct; + if (step->ephemera.to_debugging_log) { + step->ephemera.to_stream = DL; + } else if ((step->step_stage->stage_arg == TEXT_OUT_STAGE_ARG) || + (step->step_stage->stage_arg == OPTIONAL_TEXT_OUT_STAGE_ARG) || + (step->step_stage->stage_arg == EXT_TEXT_OUT_STAGE_ARG)) { + if ((step->ephemera.parsed_filename) && + (STREAM_OPEN_TO_FILE(T, step->ephemera.parsed_filename, ISO_ENC) == FALSE)) { + #ifdef PROBLEMS_MODULE + Problems::fatal_on_file("Can't open output file", step->ephemera.parsed_filename); + #endif + #ifndef PROBLEMS_MODULE + Errors::fatal_with_file("Can't open output file", step->ephemera.parsed_filename); + exit(1); + #endif + } + step->ephemera.to_stream = T; + } + + if (skip_step == FALSE) + active = (*(step->step_stage->execute))(step); + + if (((step->step_stage->stage_arg == TEXT_OUT_STAGE_ARG) || + (step->step_stage->stage_arg == EXT_TEXT_OUT_STAGE_ARG)) && + (step->ephemera.to_debugging_log == FALSE)) { + STREAM_CLOSE(T); + } + +@h Following. + += +inter_symbol *unchecked_kind_symbol = NULL; +inter_symbol *unchecked_function_symbol = NULL; +inter_symbol *typeless_int_symbol = NULL; +inter_symbol *list_of_unchecked_kind_symbol = NULL; +inter_symbol *object_kind_symbol = NULL; +inter_symbol *action_kind_symbol = NULL; +inter_symbol *truth_state_kind_symbol = NULL; +inter_symbol *direction_kind_symbol = NULL; + +inter_symbol *verb_directive_reverse_symbol = NULL; +inter_symbol *verb_directive_slash_symbol = NULL; +inter_symbol *verb_directive_divider_symbol = NULL; +inter_symbol *verb_directive_result_symbol = NULL; +inter_symbol *verb_directive_special_symbol = NULL; +inter_symbol *verb_directive_number_symbol = NULL; +inter_symbol *verb_directive_noun_symbol = NULL; +inter_symbol *verb_directive_multi_symbol = NULL; +inter_symbol *verb_directive_multiinside_symbol = NULL; +inter_symbol *verb_directive_multiheld_symbol = NULL; +inter_symbol *verb_directive_held_symbol = NULL; +inter_symbol *verb_directive_creature_symbol = NULL; +inter_symbol *verb_directive_topic_symbol = NULL; +inter_symbol *verb_directive_multiexcept_symbol = NULL; + +inter_symbol *code_ptype_symbol = NULL; +inter_symbol *plain_ptype_symbol = NULL; +inter_symbol *submodule_ptype_symbol = NULL; +inter_symbol *function_ptype_symbol = NULL; +inter_symbol *action_ptype_symbol = NULL; +inter_symbol *command_ptype_symbol = NULL; +inter_symbol *property_ptype_symbol = NULL; +inter_symbol *to_phrase_ptype_symbol = NULL; + +void RunningPipelines::prepare_to_run(inter_tree *I) { + + code_ptype_symbol = InterSymbolsTables::url_name_to_symbol(I, NULL, I"/_code"); + plain_ptype_symbol = InterSymbolsTables::url_name_to_symbol(I, NULL, I"/_plain"); + submodule_ptype_symbol = InterSymbolsTables::url_name_to_symbol(I, NULL, I"/_submodule"); + function_ptype_symbol = InterSymbolsTables::url_name_to_symbol(I, NULL, I"/_function"); + action_ptype_symbol = InterSymbolsTables::url_name_to_symbol(I, NULL, I"/_action"); + command_ptype_symbol = InterSymbolsTables::url_name_to_symbol(I, NULL, I"/_command"); + property_ptype_symbol = InterSymbolsTables::url_name_to_symbol(I, NULL, I"/_property"); + to_phrase_ptype_symbol = InterSymbolsTables::url_name_to_symbol(I, NULL, I"/_to_phrase"); + + unchecked_kind_symbol = Inter::Packages::search_resources_exhaustively(I, I"K_unchecked"); + unchecked_function_symbol = Inter::Packages::search_resources_exhaustively(I, I"K_unchecked_function"); + typeless_int_symbol = Inter::Packages::search_resources_exhaustively(I, I"K_typeless_int"); + list_of_unchecked_kind_symbol = Inter::Packages::search_resources_exhaustively(I, I"K_list_of_values"); + object_kind_symbol = Inter::Packages::search_resources_exhaustively(I, I"K_object"); + action_kind_symbol = Inter::Packages::search_resources_exhaustively(I, I"K_action_name"); + truth_state_kind_symbol = Inter::Packages::search_resources_exhaustively(I, I"K_truth_state"); + direction_kind_symbol = Inter::Packages::search_resources_exhaustively(I, I"K3_direction"); + + verb_directive_reverse_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_REVERSE"); + verb_directive_slash_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_SLASH"); + verb_directive_divider_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_DIVIDER"); + verb_directive_result_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_RESULT"); + verb_directive_special_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_SPECIAL"); + verb_directive_number_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_NUMBER"); + verb_directive_noun_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_NOUN"); + verb_directive_multi_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_MULTI"); + verb_directive_multiinside_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_MULTIINSIDE"); + verb_directive_multiheld_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_MULTIHELD"); + verb_directive_held_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_HELD"); + verb_directive_creature_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_CREATURE"); + verb_directive_topic_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_TOPIC"); + verb_directive_multiexcept_symbol = Inter::Packages::search_resources_exhaustively(I, I"VERB_DIRECTIVE_MULTIEXCEPT"); +} + +void RunningPipelines::lint(inter_tree *I) { + InterTree::traverse(I, RunningPipelines::lint_visitor, NULL, NULL, -PACKAGE_IST); +} + +void RunningPipelines::lint_visitor(inter_tree *I, inter_tree_node *P, void *state) { + inter_ti c = Inode::get_package(P)->index_n; + inter_ti a = Inode::get_package_alt(P); + if (c != a) { + LOG("Frame gives package as $6, but its location is in package $6\n", + Inode::ID_to_package(P, c), + Inode::ID_to_package(P, a)); + WRITE_TO(STDERR, "Frame gives package as %d, but its location is in package %d\n", + Inode::ID_to_package(P, c)->index_n, + Inode::ID_to_package(P, a)->index_n); + internal_error("misplaced package"); + } + + Produce::guard(Inter::Defn::verify_children_inner(P)); +} + +inter_symbol *RunningPipelines::uks(void) { + if (unchecked_kind_symbol == NULL) internal_error("no unchecked kind symbol"); + return unchecked_kind_symbol; +} + +void RunningPipelines::error(char *erm) { + #ifdef PROBLEMS_MODULE + TEMPORARY_TEXT(full) + WRITE_TO(full, "%s", erm); + do_not_locate_problems = TRUE; + Problems::quote_stream(1, full); + Problems::issue_problem_begin(NULL, erm); + Problems::issue_problem_segment("I was unable to perform final code-generation: %1"); + Problems::issue_problem_end(); + do_not_locate_problems = FALSE; + DISCARD_TEXT(full) + #endif + #ifndef PROBLEMS_MODULE + Errors::fatal(erm); + exit(1); + #endif +} + +void RunningPipelines::error_with(char *erm, text_stream *quoted) { + #ifdef PROBLEMS_MODULE + TEMPORARY_TEXT(full) + WRITE_TO(full, erm, quoted); + do_not_locate_problems = TRUE; + Problems::quote_stream(1, full); + Problems::issue_problem_begin(NULL, erm); + Problems::issue_problem_segment("I was unable to perform final code-generation: %1"); + Problems::issue_problem_end(); + do_not_locate_problems = FALSE; + DISCARD_TEXT(full) + #endif + #ifndef PROBLEMS_MODULE + Errors::fatal_with_text(erm, quoted); + exit(1); + #endif +} + +@h Current architecture. + += +inter_architecture *current_architecture = NULL; +int RunningPipelines::set_architecture(text_stream *name) { + current_architecture = Architectures::from_codename(name); + if (current_architecture) return TRUE; + return FALSE; +} + +inter_architecture *RunningPipelines::get_architecture(void) { + return current_architecture; +} diff --git a/inter/pipeline-module/Chapter 2/Assimilate.w b/inter/pipeline-module/Chapter 3/Assimilate.w similarity index 99% rename from inter/pipeline-module/Chapter 2/Assimilate.w rename to inter/pipeline-module/Chapter 3/Assimilate.w index 909458c7c..dc506b393 100644 --- a/inter/pipeline-module/Chapter 2/Assimilate.w +++ b/inter/pipeline-module/Chapter 3/Assimilate.w @@ -6,7 +6,7 @@ To assimilate the material in parsed non-code splats. = void CodeGen::Assimilate::create_pipeline_stage(void) { - CodeGen::Stage::new(I"assimilate", CodeGen::Assimilate::run_pipeline_stage, NO_STAGE_ARG, FALSE); + ParsingPipelines::new_stage(I"assimilate", CodeGen::Assimilate::run_pipeline_stage, NO_STAGE_ARG, FALSE); } int current_assimilation_pass = 0; @@ -17,7 +17,7 @@ int no_assimilated_arrays = 0; int trace_AME = TRUE; int CodeGen::Assimilate::run_pipeline_stage(pipeline_step *step) { - inter_tree *I = step->repository; + inter_tree *I = step->ephemera.repository; ++current_assimilation_pass; no_assimilated_actions = 0; no_assimilated_commands = 0; diff --git a/inter/pipeline-module/Chapter 2/Detect Indirect Calls.w b/inter/pipeline-module/Chapter 3/Detect Indirect Calls.w similarity index 89% rename from inter/pipeline-module/Chapter 2/Detect Indirect Calls.w rename to inter/pipeline-module/Chapter 3/Detect Indirect Calls.w index becafe4a8..5d9e76380 100644 --- a/inter/pipeline-module/Chapter 2/Detect Indirect Calls.w +++ b/inter/pipeline-module/Chapter 3/Detect Indirect Calls.w @@ -6,11 +6,11 @@ To make sure certain symbol names translate into globally unique target symbols. = void DetectIndirectCalls::create_pipeline_stage(void) { - CodeGen::Stage::new(I"detect-indirect-calls", DetectIndirectCalls::run_pipeline_stage, NO_STAGE_ARG, FALSE); + ParsingPipelines::new_stage(I"detect-indirect-calls", DetectIndirectCalls::run_pipeline_stage, NO_STAGE_ARG, FALSE); } int DetectIndirectCalls::run_pipeline_stage(pipeline_step *step) { - InterTree::traverse(step->repository, DetectIndirectCalls::visitor, NULL, NULL, PACKAGE_IST); + InterTree::traverse(step->ephemera.repository, DetectIndirectCalls::visitor, NULL, NULL, PACKAGE_IST); return TRUE; } diff --git a/inter/pipeline-module/Chapter 2/Inspect Plugs.w b/inter/pipeline-module/Chapter 3/Inspect Plugs.w similarity index 80% rename from inter/pipeline-module/Chapter 2/Inspect Plugs.w rename to inter/pipeline-module/Chapter 3/Inspect Plugs.w index 3a06d4ad2..41bd34b4d 100644 --- a/inter/pipeline-module/Chapter 2/Inspect Plugs.w +++ b/inter/pipeline-module/Chapter 3/Inspect Plugs.w @@ -6,13 +6,13 @@ To make sure certain symbol names translate into globally unique target symbols. = void CodeGen::Inspection::create_pipeline_stage(void) { - CodeGen::Stage::new(I"inspect-plugs", CodeGen::Inspection::run_pipeline_stage, NO_STAGE_ARG, FALSE); + ParsingPipelines::new_stage(I"inspect-plugs", CodeGen::Inspection::run_pipeline_stage, NO_STAGE_ARG, FALSE); } int CodeGen::Inspection::run_pipeline_stage(pipeline_step *step) { - Inter::Connectors::stecker(step->repository); + Inter::Connectors::stecker(step->ephemera.repository); int resolution_failed = FALSE; - InterTree::traverse(step->repository, CodeGen::Inspection::visitor, &resolution_failed, NULL, PACKAGE_IST); + InterTree::traverse(step->ephemera.repository, CodeGen::Inspection::visitor, &resolution_failed, NULL, PACKAGE_IST); if (resolution_failed) internal_error("loose plug(s)"); return TRUE; } diff --git a/inter/pipeline-module/Chapter 1/Link Instructions.w b/inter/pipeline-module/Chapter 3/Link.w similarity index 78% rename from inter/pipeline-module/Chapter 1/Link Instructions.w rename to inter/pipeline-module/Chapter 3/Link.w index db0e6cf30..4f7199348 100644 --- a/inter/pipeline-module/Chapter 1/Link Instructions.w +++ b/inter/pipeline-module/Chapter 3/Link.w @@ -1,4 +1,4 @@ -[CodeGen::LinkInstructions::] Link Instructions. +[CodeGen::LinkInstructions::] Link. Inter often needs to assimilate or otherwise deal with architecture-neutral kits of linkable material, and this is where such requirements are noted. @@ -23,13 +23,13 @@ link_instruction *CodeGen::LinkInstructions::new(pathname *P, text_stream *attac = void CodeGen::LinkInstructions::create_pipeline_stage(void) { - CodeGen::Stage::new(I"link", CodeGen::LinkInstructions::run_link_stage, NO_STAGE_ARG, FALSE); + ParsingPipelines::new_stage(I"link", CodeGen::LinkInstructions::run_link_stage, NO_STAGE_ARG, FALSE); } int CodeGen::LinkInstructions::run_link_stage(pipeline_step *step) { link_instruction *req; - LOOP_OVER_LINKED_LIST(req, link_instruction, step->requirements_list) { - inter_architecture *A = CodeGen::Architecture::current(); + LOOP_OVER_LINKED_LIST(req, link_instruction, step->ephemera.requirements_list) { + inter_architecture *A = RunningPipelines::get_architecture(); if (A == NULL) Errors::fatal("no -architecture given"); filename *arch_file = Architectures::canonical_binary(req->location, A); if (TextFiles::exists(arch_file) == FALSE) internal_error("no arch file for requirement"); @@ -43,7 +43,7 @@ int CodeGen::LinkInstructions::run_link_stage(pipeline_step *step) { WRITE_TO(STDERR, "sought attachment material at: %S in %f\n", req->attachment_point, arch_file); internal_error("unable to find attachment point package"); } - Inter::Transmigration::move(pack, Site::main_package(step->repository), FALSE); + Inter::Transmigration::move(pack, Site::main_package(step->ephemera.repository), FALSE); } return TRUE; } diff --git a/inter/pipeline-module/Chapter 2/Merge Template.w b/inter/pipeline-module/Chapter 3/Merge Template.w similarity index 96% rename from inter/pipeline-module/Chapter 2/Merge Template.w rename to inter/pipeline-module/Chapter 3/Merge Template.w index 2af6e8029..0975b3166 100644 --- a/inter/pipeline-module/Chapter 2/Merge Template.w +++ b/inter/pipeline-module/Chapter 3/Merge Template.w @@ -6,15 +6,15 @@ To link inter from I7 with template code. = void CodeGen::MergeTemplate::create_pipeline_stage(void) { - CodeGen::Stage::new(I"merge-template", CodeGen::MergeTemplate::run_pipeline_stage, TEMPLATE_FILE_STAGE_ARG, TRUE); + ParsingPipelines::new_stage(I"merge-template", CodeGen::MergeTemplate::run_pipeline_stage, TEMPLATE_FILE_STAGE_ARG, TRUE); } int CodeGen::MergeTemplate::run_pipeline_stage(pipeline_step *step) { - inter_package *main_package = Site::main_package_if_it_exists(step->repository); + inter_package *main_package = Site::main_package_if_it_exists(step->ephemera.repository); inter_bookmark IBM; if (main_package) IBM = Inter::Bookmarks::at_end_of_this_package(main_package); - else IBM = Inter::Bookmarks::at_start_of_this_repository(step->repository); - CodeGen::MergeTemplate::link(&IBM, step->step_argument, step->the_PP, NULL); + else IBM = Inter::Bookmarks::at_start_of_this_repository(step->ephemera.repository); + CodeGen::MergeTemplate::link(&IBM, step->step_argument, step->ephemera.the_PP, NULL); return TRUE; } diff --git a/inter/pipeline-module/Chapter 2/Parse Linked Matter.w b/inter/pipeline-module/Chapter 3/Parse Linked Matter.w similarity index 91% rename from inter/pipeline-module/Chapter 2/Parse Linked Matter.w rename to inter/pipeline-module/Chapter 3/Parse Linked Matter.w index 94fd80a02..168913e11 100644 --- a/inter/pipeline-module/Chapter 2/Parse Linked Matter.w +++ b/inter/pipeline-module/Chapter 3/Parse Linked Matter.w @@ -6,11 +6,11 @@ To generate the initial state of storage for variables. = void CodeGen::PLM::create_pipeline_stage(void) { - CodeGen::Stage::new(I"parse-linked-matter", CodeGen::PLM::run_pipeline_stage, NO_STAGE_ARG, FALSE); + ParsingPipelines::new_stage(I"parse-linked-matter", CodeGen::PLM::run_pipeline_stage, NO_STAGE_ARG, FALSE); } int CodeGen::PLM::run_pipeline_stage(pipeline_step *step) { - InterTree::traverse(step->repository, CodeGen::PLM::visitor, NULL, NULL, 0); + InterTree::traverse(step->ephemera.repository, CodeGen::PLM::visitor, NULL, NULL, 0); return TRUE; } diff --git a/inter/pipeline-module/Chapter 1/Architecture.w b/inter/pipeline-module/Chapter 3/Prepare.w similarity index 91% rename from inter/pipeline-module/Chapter 1/Architecture.w rename to inter/pipeline-module/Chapter 3/Prepare.w index 76b2f9d51..34dd98e37 100644 --- a/inter/pipeline-module/Chapter 1/Architecture.w +++ b/inter/pipeline-module/Chapter 3/Prepare.w @@ -1,26 +1,12 @@ -[CodeGen::Architecture::] Architecture. +[CodeGen::Architecture::] Prepare. -To deal with multiple inter architectures. +The Inter stage prepare. -@h Current architecture. - -= -inter_architecture *current_architecture = NULL; -int CodeGen::Architecture::set(text_stream *name) { - current_architecture = Architectures::from_codename(name); - if (current_architecture) return TRUE; - return FALSE; -} - -inter_architecture *CodeGen::Architecture::current(void) { - return current_architecture; -} - -@h Prepare stage. +@ = void CodeGen::Architecture::create_pipeline_stage(void) { - CodeGen::Stage::new(I"prepare", CodeGen::Architecture::run_prepare_stage, GENERAL_STAGE_ARG, TRUE); + ParsingPipelines::new_stage(I"prepare", CodeGen::Architecture::run_prepare_stage, GENERAL_STAGE_ARG, TRUE); } int CodeGen::Architecture::run_prepare_stage(pipeline_step *step) { @@ -31,7 +17,7 @@ int CodeGen::Architecture::run_prepare_stage(pipeline_step *step) { } int CodeGen::Architecture::run_prepare_stage_inner(pipeline_step *step, int Z, int D) { - inter_tree *I = step->repository; + inter_tree *I = step->ephemera.repository; Packaging::outside_all_packages(I); PackageTypes::get(I, I"_plain"); PackageTypes::get(I, I"_code"); diff --git a/inter/pipeline-module/Chapter 2/Reconcile Verbs.w b/inter/pipeline-module/Chapter 3/Reconcile Verbs.w similarity index 91% rename from inter/pipeline-module/Chapter 2/Reconcile Verbs.w rename to inter/pipeline-module/Chapter 3/Reconcile Verbs.w index 051b997df..0f9885726 100644 --- a/inter/pipeline-module/Chapter 2/Reconcile Verbs.w +++ b/inter/pipeline-module/Chapter 3/Reconcile Verbs.w @@ -6,11 +6,11 @@ To reconcile clashes between assimilated and originally generated verbs. = void CodeGen::ReconcileVerbs::create_pipeline_stage(void) { - CodeGen::Stage::new(I"reconcile-verbs", CodeGen::ReconcileVerbs::run_pipeline_stage, NO_STAGE_ARG, FALSE); + ParsingPipelines::new_stage(I"reconcile-verbs", CodeGen::ReconcileVerbs::run_pipeline_stage, NO_STAGE_ARG, FALSE); } int CodeGen::ReconcileVerbs::run_pipeline_stage(pipeline_step *step) { - CodeGen::ReconcileVerbs::reconcile(step->repository); + CodeGen::ReconcileVerbs::reconcile(step->ephemera.repository); return TRUE; } diff --git a/inter/pipeline-module/Chapter 2/Resolve External Symbols.w b/inter/pipeline-module/Chapter 3/Resolve External Symbols.w similarity index 86% rename from inter/pipeline-module/Chapter 2/Resolve External Symbols.w rename to inter/pipeline-module/Chapter 3/Resolve External Symbols.w index d9b0a5aa2..1dbb84b12 100644 --- a/inter/pipeline-module/Chapter 2/Resolve External Symbols.w +++ b/inter/pipeline-module/Chapter 3/Resolve External Symbols.w @@ -6,13 +6,13 @@ To make sure certain symbol names translate into globally unique target symbols. = void CodeGen::Externals::create_pipeline_stage(void) { - CodeGen::Stage::new(I"resolve-external-symbols", CodeGen::Externals::run_pipeline_stage, NO_STAGE_ARG, FALSE); + ParsingPipelines::new_stage(I"resolve-external-symbols", CodeGen::Externals::run_pipeline_stage, NO_STAGE_ARG, FALSE); } int CodeGen::Externals::run_pipeline_stage(pipeline_step *step) { - Inter::Connectors::stecker(step->repository); + Inter::Connectors::stecker(step->ephemera.repository); int resolution_failed = FALSE; - InterTree::traverse(step->repository, CodeGen::Externals::visitor, &resolution_failed, NULL, PACKAGE_IST); + InterTree::traverse(step->ephemera.repository, CodeGen::Externals::visitor, &resolution_failed, NULL, PACKAGE_IST); if (resolution_failed) internal_error("undefined external link(s)"); return TRUE; } diff --git a/inter/pipeline-module/Chapter 2/Resolving Conditional Compilation.w b/inter/pipeline-module/Chapter 3/Resolving Conditional Compilation.w similarity index 97% rename from inter/pipeline-module/Chapter 2/Resolving Conditional Compilation.w rename to inter/pipeline-module/Chapter 3/Resolving Conditional Compilation.w index a4e5da020..7af55a50c 100644 --- a/inter/pipeline-module/Chapter 2/Resolving Conditional Compilation.w +++ b/inter/pipeline-module/Chapter 3/Resolving Conditional Compilation.w @@ -6,11 +6,11 @@ To generate the initial state of storage for variables. = void CodeGen::RCC::create_pipeline_stage(void) { - CodeGen::Stage::new(I"resolve-conditional-compilation", CodeGen::RCC::run_pipeline_stage, NO_STAGE_ARG, FALSE); + ParsingPipelines::new_stage(I"resolve-conditional-compilation", CodeGen::RCC::run_pipeline_stage, NO_STAGE_ARG, FALSE); } int CodeGen::RCC::run_pipeline_stage(pipeline_step *step) { - CodeGen::RCC::resolve(step->repository); + CodeGen::RCC::resolve(step->ephemera.repository); return TRUE; } diff --git a/inter/pipeline-module/Chapter 2/Template Reader.w b/inter/pipeline-module/Chapter 3/Template Reader.w similarity index 100% rename from inter/pipeline-module/Chapter 2/Template Reader.w rename to inter/pipeline-module/Chapter 3/Template Reader.w diff --git a/inter/pipeline-module/Chapter 2/Uniqueness.w b/inter/pipeline-module/Chapter 3/Uniqueness.w similarity index 87% rename from inter/pipeline-module/Chapter 2/Uniqueness.w rename to inter/pipeline-module/Chapter 3/Uniqueness.w index 0f811f974..79be348e3 100644 --- a/inter/pipeline-module/Chapter 2/Uniqueness.w +++ b/inter/pipeline-module/Chapter 3/Uniqueness.w @@ -6,12 +6,12 @@ To make sure certain symbol names translate into globally unique target symbols. = void CodeGen::Uniqueness::create_pipeline_stage(void) { - CodeGen::Stage::new(I"make-identifiers-unique", CodeGen::Uniqueness::run_pipeline_stage, NO_STAGE_ARG, FALSE); + ParsingPipelines::new_stage(I"make-identifiers-unique", CodeGen::Uniqueness::run_pipeline_stage, NO_STAGE_ARG, FALSE); } int CodeGen::Uniqueness::run_pipeline_stage(pipeline_step *step) { dictionary *D = Dictionaries::new(INITIAL_INTER_SYMBOLS_ID_RANGE, FALSE); - InterTree::traverse(step->repository, CodeGen::Uniqueness::visitor, D, NULL, 0); + InterTree::traverse(step->ephemera.repository, CodeGen::Uniqueness::visitor, D, NULL, 0); return TRUE; } diff --git a/inter/pipeline-module/Chapter 3/Actions.w b/inter/pipeline-module/Chapter 4/Actions.w similarity index 100% rename from inter/pipeline-module/Chapter 3/Actions.w rename to inter/pipeline-module/Chapter 4/Actions.w diff --git a/inter/pipeline-module/Chapter 3/Activities.w b/inter/pipeline-module/Chapter 4/Activities.w similarity index 100% rename from inter/pipeline-module/Chapter 3/Activities.w rename to inter/pipeline-module/Chapter 4/Activities.w diff --git a/inter/pipeline-module/Chapter 3/Chronology.w b/inter/pipeline-module/Chapter 4/Chronology.w similarity index 100% rename from inter/pipeline-module/Chapter 3/Chronology.w rename to inter/pipeline-module/Chapter 4/Chronology.w diff --git a/inter/pipeline-module/Chapter 3/Extensions.w b/inter/pipeline-module/Chapter 4/Extensions.w similarity index 100% rename from inter/pipeline-module/Chapter 3/Extensions.w rename to inter/pipeline-module/Chapter 4/Extensions.w diff --git a/inter/pipeline-module/Chapter 3/Instances.w b/inter/pipeline-module/Chapter 4/Instances.w similarity index 100% rename from inter/pipeline-module/Chapter 3/Instances.w rename to inter/pipeline-module/Chapter 4/Instances.w diff --git a/inter/pipeline-module/Chapter 3/Kinds.w b/inter/pipeline-module/Chapter 4/Kinds.w similarity index 100% rename from inter/pipeline-module/Chapter 3/Kinds.w rename to inter/pipeline-module/Chapter 4/Kinds.w diff --git a/inter/pipeline-module/Chapter 3/Literal Text.w b/inter/pipeline-module/Chapter 4/Literal Text.w similarity index 100% rename from inter/pipeline-module/Chapter 3/Literal Text.w rename to inter/pipeline-module/Chapter 4/Literal Text.w diff --git a/inter/pipeline-module/Chapter 3/Multimedia.w b/inter/pipeline-module/Chapter 4/Multimedia.w similarity index 100% rename from inter/pipeline-module/Chapter 3/Multimedia.w rename to inter/pipeline-module/Chapter 4/Multimedia.w diff --git a/inter/pipeline-module/Chapter 3/Properties.w b/inter/pipeline-module/Chapter 4/Properties.w similarity index 100% rename from inter/pipeline-module/Chapter 3/Properties.w rename to inter/pipeline-module/Chapter 4/Properties.w diff --git a/inter/pipeline-module/Chapter 3/Relations.w b/inter/pipeline-module/Chapter 4/Relations.w similarity index 100% rename from inter/pipeline-module/Chapter 3/Relations.w rename to inter/pipeline-module/Chapter 4/Relations.w diff --git a/inter/pipeline-module/Chapter 3/Responses.w b/inter/pipeline-module/Chapter 4/Responses.w similarity index 100% rename from inter/pipeline-module/Chapter 3/Responses.w rename to inter/pipeline-module/Chapter 4/Responses.w diff --git a/inter/pipeline-module/Chapter 3/Rules.w b/inter/pipeline-module/Chapter 4/Rules.w similarity index 100% rename from inter/pipeline-module/Chapter 3/Rules.w rename to inter/pipeline-module/Chapter 4/Rules.w diff --git a/inter/pipeline-module/Chapter 3/Scenes.w b/inter/pipeline-module/Chapter 4/Scenes.w similarity index 100% rename from inter/pipeline-module/Chapter 3/Scenes.w rename to inter/pipeline-module/Chapter 4/Scenes.w diff --git a/inter/pipeline-module/Chapter 3/Synoptic Hierarchy.w b/inter/pipeline-module/Chapter 4/Synoptic Hierarchy.w similarity index 100% rename from inter/pipeline-module/Chapter 3/Synoptic Hierarchy.w rename to inter/pipeline-module/Chapter 4/Synoptic Hierarchy.w diff --git a/inter/pipeline-module/Chapter 3/Synoptic Utilities.w b/inter/pipeline-module/Chapter 4/Synoptic Utilities.w similarity index 92% rename from inter/pipeline-module/Chapter 3/Synoptic Utilities.w rename to inter/pipeline-module/Chapter 4/Synoptic Utilities.w index 79b1e7235..ee2af879a 100644 --- a/inter/pipeline-module/Chapter 3/Synoptic Utilities.w +++ b/inter/pipeline-module/Chapter 4/Synoptic Utilities.w @@ -8,7 +8,7 @@ This stage... = void Synoptic::create_pipeline_stage(void) { - CodeGen::Stage::new(I"consolidate-text", + ParsingPipelines::new_stage(I"consolidate-text", Synoptic::go, NO_STAGE_ARG, FALSE); } @@ -161,25 +161,25 @@ tree_inventory *Synoptic::inv(inter_tree *I) { } int Synoptic::go(pipeline_step *step) { - tree_inventory *inv = Synoptic::inv(step->repository); + tree_inventory *inv = Synoptic::inv(step->ephemera.repository); - SynopticText::compile(step->repository, inv); - SynopticActions::compile(step->repository, inv); - SynopticActivities::compile(step->repository, inv); - SynopticChronology::compile(step->repository, inv); - SynopticExtensions::compile(step->repository, inv); - SynopticInstances::compile(step->repository, inv); - SynopticKinds::compile(step->repository, inv); - SynopticMultimedia::compile(step->repository, inv); - SynopticProperties::compile(step->repository, inv); - SynopticRelations::compile(step->repository, inv); - SynopticResponses::compile(step->repository, inv); - SynopticRules::compile(step->repository, inv); - SynopticScenes::compile(step->repository, inv); - SynopticTables::compile(step->repository, inv); - SynopticUseOptions::compile(step->repository, inv); - SynopticVerbs::compile(step->repository, inv); - SynopticTests::compile(step->repository, inv); + SynopticText::compile(step->ephemera.repository, inv); + SynopticActions::compile(step->ephemera.repository, inv); + SynopticActivities::compile(step->ephemera.repository, inv); + SynopticChronology::compile(step->ephemera.repository, inv); + SynopticExtensions::compile(step->ephemera.repository, inv); + SynopticInstances::compile(step->ephemera.repository, inv); + SynopticKinds::compile(step->ephemera.repository, inv); + SynopticMultimedia::compile(step->ephemera.repository, inv); + SynopticProperties::compile(step->ephemera.repository, inv); + SynopticRelations::compile(step->ephemera.repository, inv); + SynopticResponses::compile(step->ephemera.repository, inv); + SynopticRules::compile(step->ephemera.repository, inv); + SynopticScenes::compile(step->ephemera.repository, inv); + SynopticTables::compile(step->ephemera.repository, inv); + SynopticUseOptions::compile(step->ephemera.repository, inv); + SynopticVerbs::compile(step->ephemera.repository, inv); + SynopticTests::compile(step->ephemera.repository, inv); return TRUE; } diff --git a/inter/pipeline-module/Chapter 3/Tables.w b/inter/pipeline-module/Chapter 4/Tables.w similarity index 100% rename from inter/pipeline-module/Chapter 3/Tables.w rename to inter/pipeline-module/Chapter 4/Tables.w diff --git a/inter/pipeline-module/Chapter 3/Tests.w b/inter/pipeline-module/Chapter 4/Tests.w similarity index 100% rename from inter/pipeline-module/Chapter 3/Tests.w rename to inter/pipeline-module/Chapter 4/Tests.w diff --git a/inter/pipeline-module/Chapter 3/Use Options.w b/inter/pipeline-module/Chapter 4/Use Options.w similarity index 100% rename from inter/pipeline-module/Chapter 3/Use Options.w rename to inter/pipeline-module/Chapter 4/Use Options.w diff --git a/inter/pipeline-module/Chapter 3/Verbs.w b/inter/pipeline-module/Chapter 4/Verbs.w similarity index 100% rename from inter/pipeline-module/Chapter 3/Verbs.w rename to inter/pipeline-module/Chapter 4/Verbs.w diff --git a/inter/pipeline-module/Chapter 2/Eliminate Redundant Labels.w b/inter/pipeline-module/Chapter 5/Eliminate Redundant Labels.w similarity index 94% rename from inter/pipeline-module/Chapter 2/Eliminate Redundant Labels.w rename to inter/pipeline-module/Chapter 5/Eliminate Redundant Labels.w index 1c5021939..bd95068aa 100644 --- a/inter/pipeline-module/Chapter 2/Eliminate Redundant Labels.w +++ b/inter/pipeline-module/Chapter 5/Eliminate Redundant Labels.w @@ -13,13 +13,13 @@ on the Inter functions in a repository. = void CodeGen::Labels::create_pipeline_stage(void) { - CodeGen::Stage::new(I"eliminate-redundant-labels", CodeGen::Labels::run_pipeline_stage, NO_STAGE_ARG, FALSE); + ParsingPipelines::new_stage(I"eliminate-redundant-labels", CodeGen::Labels::run_pipeline_stage, NO_STAGE_ARG, FALSE); } int redundant_labels_removed = 0; int CodeGen::Labels::run_pipeline_stage(pipeline_step *step) { redundant_labels_removed = 0; - InterTree::traverse(step->repository, CodeGen::Labels::visitor, NULL, NULL, 0); + InterTree::traverse(step->ephemera.repository, CodeGen::Labels::visitor, NULL, NULL, 0); if (redundant_labels_removed > 0) LOG("%d redundant label(s) removed\n", redundant_labels_removed); return TRUE; diff --git a/inter/pipeline-module/Chapter 2/Eliminate Redundant Matter.w b/inter/pipeline-module/Chapter 5/Eliminate Redundant Matter.w similarity index 97% rename from inter/pipeline-module/Chapter 2/Eliminate Redundant Matter.w rename to inter/pipeline-module/Chapter 5/Eliminate Redundant Matter.w index 488f3acb5..9056d5fef 100644 --- a/inter/pipeline-module/Chapter 2/Eliminate Redundant Matter.w +++ b/inter/pipeline-module/Chapter 5/Eliminate Redundant Matter.w @@ -13,12 +13,12 @@ isn't used. = void CodeGen::Eliminate::create_pipeline_stage(void) { - CodeGen::Stage::new(I"eliminate-redundant-code", + ParsingPipelines::new_stage(I"eliminate-redundant-code", CodeGen::Eliminate::run_pipeline_stage, NO_STAGE_ARG, FALSE); } int CodeGen::Eliminate::run_pipeline_stage(pipeline_step *step) { - inter_tree *I = step->repository; + inter_tree *I = step->ephemera.repository; InterTree::traverse(I, CodeGen::Eliminate::package_preserver, NULL, NULL, PACKAGE_IST); InterTree::traverse(I, CodeGen::Eliminate::package_destroyer, NULL, NULL, PACKAGE_IST); return TRUE; diff --git a/inter/pipeline-module/Chapter 2/Eliminate Redundant Operations.w b/inter/pipeline-module/Chapter 5/Eliminate Redundant Operations.w similarity index 95% rename from inter/pipeline-module/Chapter 2/Eliminate Redundant Operations.w rename to inter/pipeline-module/Chapter 5/Eliminate Redundant Operations.w index a5a9445a3..e10f3d837 100644 --- a/inter/pipeline-module/Chapter 2/Eliminate Redundant Operations.w +++ b/inter/pipeline-module/Chapter 5/Eliminate Redundant Operations.w @@ -27,14 +27,14 @@ any intended side-effects of evaluating |x| would be lost. = void CodeGen::Operations::create_pipeline_stage(void) { - CodeGen::Stage::new(I"eliminate-redundant-operations", + ParsingPipelines::new_stage(I"eliminate-redundant-operations", CodeGen::Operations::run_pipeline_stage, NO_STAGE_ARG, FALSE); } int redundant_operations_removed = 0; int CodeGen::Operations::run_pipeline_stage(pipeline_step *step) { redundant_operations_removed = 0; - InterTree::traverse(step->repository, CodeGen::Operations::visitor, NULL, NULL, 0); + InterTree::traverse(step->ephemera.repository, CodeGen::Operations::visitor, NULL, NULL, 0); if (redundant_operations_removed > 0) LOG("%d redundant operation(s) removed\n", redundant_operations_removed); return TRUE; diff --git a/inter/pipeline-module/Contents.w b/inter/pipeline-module/Contents.w index e52cc0595..379b440a4 100644 --- a/inter/pipeline-module/Contents.w +++ b/inter/pipeline-module/Contents.w @@ -4,14 +4,20 @@ Purpose: The code generation pipeline. Language: InC Licence: Artistic License 2.0 +Preliminaries + What This Module Does + Chapter 1: Setting Up Pipeline Module - Stages - Architecture - Link Instructions - Pipelines -Chapter 2: Miscellaneous Pipeline Stages +Chapter 2: Pipelines + Parsing Pipelines + Running Pipelines + Read, Move, Wipe, Stop + +Chapter 3: Linking + Link + Prepare Merge Template Template Reader Parse Linked Matter @@ -22,11 +28,8 @@ Chapter 2: Miscellaneous Pipeline Stages Detect Indirect Calls Uniqueness Reconcile Verbs - Eliminate Redundant Matter - Eliminate Redundant Labels - Eliminate Redundant Operations -Chapter 3: Synoptic Module +Chapter 4: Synoptic Module Synoptic Hierarchy Synoptic Utilities Extensions @@ -46,3 +49,8 @@ Chapter 3: Synoptic Module Use Options Verbs Tests + +Chapter 5: Optimising + Eliminate Redundant Matter + Eliminate Redundant Labels + Eliminate Redundant Operations diff --git a/inter/pipeline-module/Preliminaries/What This Module Does.w b/inter/pipeline-module/Preliminaries/What This Module Does.w new file mode 100644 index 000000000..0454e19e3 --- /dev/null +++ b/inter/pipeline-module/Preliminaries/What This Module Does.w @@ -0,0 +1,20 @@ +What This Module Does. + +An overview of the pipeline module's role and abilities. + +@h Prerequisites. +The pipeline module is a part of the Inform compiler toolset. It is +presented as a literate program or "web". Before diving in: +(a) It helps to have some experience of reading webs: see //inweb// for more. +(b) The module is written in C, in fact ANSI C99, but this is disguised by the +fact that it uses some extension syntaxes provided by the //inweb// literate +programming tool, making it a dialect of C called InC. See //inweb// for +full details, but essentially: it's C without predeclarations or header files, +and where functions have names like |Tags::add_by_name| rather than just |add_by_name|. +(c) This module uses other modules drawn from the //compiler//, and also +uses a module of utility functions called //foundation//. +For more, see //foundation: A Brief Guide to Foundation//. + +@h Pipelines. +This module provides a mechanism for working on trees of Inter code, by applying +sequences of "stages" identified by name; and it then defines a number of stages.