From 1c3d9c537d914e4e7460a471a8d6ea561059f9b8 Mon Sep 17 00:00:00 2001 From: Graham Nelson Date: Thu, 3 Feb 2022 15:51:44 +0000 Subject: [PATCH] Clarified symbols tables --- README.md | 2 +- build.txt | 4 +- docs/building-module/1-hl.html | 14 +- docs/building-module/1-in.html | 8 +- docs/building-module/1-ip.html | 4 +- docs/building-module/1-lr.html | 8 +- docs/building-module/1-ls.html | 99 ++- docs/building-module/1-pck.html | 20 +- docs/building-module/2-if.html | 8 +- docs/building-module/3-prd.html | 20 +- docs/building-module/P-wtmd.html | 4 +- docs/bytecode-module/1-bm.html | 4 +- docs/bytecode-module/2-bkm.html | 6 +- docs/bytecode-module/2-cnn.html | 35 +- docs/bytecode-module/2-in.html | 6 +- docs/bytecode-module/2-it.html | 10 +- docs/bytecode-module/2-pck.html | 82 +- docs/bytecode-module/2-st.html | 724 +++++++++++------- docs/bytecode-module/2-sym.html | 73 +- docs/bytecode-module/2-trn.html | 64 +- docs/bytecode-module/2-tw.html | 3 +- docs/bytecode-module/3-dfn.html | 8 +- docs/bytecode-module/3-idt.html | 8 +- docs/bytecode-module/3-ie.html | 4 +- docs/bytecode-module/3-iibf.html | 74 +- docs/bytecode-module/3-iitf.html | 42 +- docs/bytecode-module/3-mtd.html | 22 +- docs/bytecode-module/3-vi.html | 22 +- docs/bytecode-module/4-tac.html | 8 +- docs/bytecode-module/4-tcc2.html | 48 +- docs/bytecode-module/4-tdc.html | 6 +- docs/bytecode-module/4-tic.html | 14 +- docs/bytecode-module/4-tkc.html | 52 +- docs/bytecode-module/4-tpc.html | 8 +- docs/bytecode-module/4-tpc2.html | 4 +- docs/bytecode-module/4-tpc3.html | 26 +- docs/bytecode-module/4-tpc4.html | 8 +- docs/bytecode-module/4-tpc5.html | 20 +- docs/bytecode-module/4-tpc6.html | 34 +- docs/bytecode-module/4-tpc7.html | 6 +- docs/bytecode-module/4-tsc.html | 10 +- docs/bytecode-module/4-tvc2.html | 10 +- docs/bytecode-module/5-tcc2.html | 8 +- docs/bytecode-module/5-tic.html | 16 +- docs/bytecode-module/5-tlc.html | 14 +- docs/bytecode-module/5-tlc2.html | 14 +- docs/bytecode-module/5-tlc3.html | 16 +- docs/bytecode-module/5-trc.html | 14 +- docs/bytecode-module/5-tvc.html | 12 +- docs/final-module/2-cg.html | 15 +- docs/final-module/2-vc.html | 2 +- docs/final-module/2-vc2.html | 10 +- docs/final-module/2-vf.html | 6 +- docs/final-module/2-vi.html | 2 +- docs/final-module/2-vnl.html | 4 +- docs/final-module/2-vo.html | 22 +- docs/final-module/4-i6c.html | 2 +- docs/final-module/4-i6c2.html | 6 +- docs/final-module/4-i6o.html | 6 +- docs/final-module/5-cnm.html | 2 +- docs/final-module/5-com.html | 6 +- docs/imperative-module/5-cii.html | 6 +- docs/index-module/2-fi.html | 6 +- docs/index-module/3-ce.html | 2 +- docs/index-module/3-ce3.html | 2 +- docs/index-module/3-ce4.html | 2 +- docs/index-module/3-fe.html | 2 +- docs/index-module/3-ie.html | 6 +- docs/index-module/3-pe.html | 2 +- docs/index-module/3-te.html | 2 +- docs/index-module/3-te2.html | 2 +- docs/pipeline-module/2-ns.html | 32 +- docs/pipeline-module/2-rmss.html | 2 +- docs/pipeline-module/2-rp.html | 18 +- docs/pipeline-module/3-css.html | 56 +- docs/pipeline-module/3-rccs.html | 4 +- docs/pipeline-module/4-dics.html | 4 +- docs/pipeline-module/4-lbks.html | 2 +- docs/pipeline-module/4-mius.html | 7 +- docs/pipeline-module/4-rvs.html | 6 +- docs/pipeline-module/4-sws.html | 22 +- docs/pipeline-module/5-lt.html | 2 +- docs/pipeline-module/5-msms.html | 4 +- docs/pipeline-module/5-rls.html | 2 +- docs/pipeline-module/5-su.html | 22 +- docs/pipeline-module/5-tbl.html | 2 +- docs/pipeline-module/6-erls.html | 2 +- docs/pipeline-module/6-erms.html | 5 +- docs/runtime-module/2-emt.html | 2 +- docs/runtime-module/5-kc.html | 2 +- inform7/Figures/memory-diagnostics.txt | 22 +- inform7/Figures/timings-diagnostics.txt | 34 +- inform7/Tests/Test Makes/Eg4-C/textual.txt | 2 +- .../Chapter 5/Compile Invocations Inline.w | 6 +- inform7/runtime-module/Chapter 2/Emit.w | 2 +- .../Chapter 5/Kind Constructors.w | 2 +- .../Chapter 1/Inter Namespace.w | 6 +- .../Chapter 1/Inter Primitives.w | 2 +- .../Chapter 1/Large-Scale Structure.w | 28 +- .../Chapter 2/Identifier Finders.w | 8 +- inter/building-module/Chapter 3/Produce.w | 12 +- .../Chapter 1/Bytecode Module.w | 2 +- inter/bytecode-module/Chapter 2/Connectors.w | 11 +- inter/bytecode-module/Chapter 2/Packages.w | 23 +- .../Chapter 2/Symbols Tables.w | 627 +++++++++------ inter/bytecode-module/Chapter 2/Symbols.w | 21 +- .../bytecode-module/Chapter 2/The Warehouse.w | 3 +- .../Chapter 2/Transmigration.w | 48 +- .../Chapter 3/Inter Data Types.w | 8 +- .../Chapter 3/Inter in Binary Files.w | 66 +- .../Chapter 3/Inter in Text Files.w | 41 +- inter/bytecode-module/Chapter 3/Metadata.w | 22 +- .../Chapter 3/Verifying Inter.w | 12 +- .../Chapter 4/The Append Construct.w | 8 +- .../Chapter 4/The Constant Construct.w | 30 +- .../Chapter 4/The DefaultValue Construct.w | 4 +- .../Chapter 4/The Instance Construct.w | 12 +- .../Chapter 4/The Kind Construct.w | 50 +- .../Chapter 4/The Package Construct.w | 16 +- .../Chapter 4/The PackageType Construct.w | 4 +- .../Chapter 4/The Permission Construct.w | 34 +- .../Chapter 4/The Pragma Construct.w | 8 +- .../Chapter 4/The Primitive Construct.w | 6 +- .../Chapter 4/The Property Construct.w | 8 +- .../Chapter 4/The PropertyValue Construct.w | 18 +- .../Chapter 4/The Symbol Construct.w | 6 +- .../Chapter 4/The Variable Construct.w | 8 +- .../Chapter 5/The Cast Construct.w | 6 +- .../Chapter 5/The Inv Construct.w | 16 +- .../Chapter 5/The Lab Construct.w | 10 +- .../Chapter 5/The Label Construct.w | 8 +- .../Chapter 5/The Local Construct.w | 8 +- .../Chapter 5/The Ref Construct.w | 6 +- .../Chapter 5/The Val Construct.w | 6 +- .../final-module/Chapter 2/Code Generation.w | 15 +- inter/final-module/Chapter 2/Vanilla Code.w | 10 +- .../Chapter 2/Vanilla Constants.w | 2 +- .../Chapter 2/Vanilla Functions.w | 6 +- inter/final-module/Chapter 2/Vanilla IF.w | 2 +- .../final-module/Chapter 2/Vanilla Objects.w | 22 +- inter/final-module/Chapter 2/Vanilla.w | 4 +- inter/final-module/Chapter 4/Inform 6 Code.w | 6 +- .../Chapter 4/Inform 6 Constants.w | 2 +- .../final-module/Chapter 4/Inform 6 Objects.w | 6 +- inter/final-module/Chapter 5/C Namespace.w | 2 +- inter/final-module/Chapter 5/C Object Model.w | 6 +- inter/index-module/Chapter 2/Faux Instances.w | 6 +- inter/index-module/Chapter 3/Card Element.w | 2 +- .../index-module/Chapter 3/Commands Element.w | 2 +- .../index-module/Chapter 3/Contents Element.w | 2 +- .../index-module/Chapter 3/Figures Element.w | 2 +- .../index-module/Chapter 3/Innards Element.w | 6 +- .../Chapter 3/Phrasebook Element.w | 2 +- inter/index-module/Chapter 3/Tables Element.w | 2 +- inter/index-module/Chapter 3/Tokens Element.w | 2 +- inter/pipeline-module/Chapter 2/New Stage.w | 32 +- .../Chapter 2/Read, Move, Stop Stages.w | 2 +- .../Chapter 2/Running Pipelines.w | 18 +- .../Chapter 3/Compile Splats Stage.w | 56 +- .../Resolve Conditional Compilation Stage.w | 4 +- .../Chapter 4/Detect Indirect Calls Stage.w | 4 +- .../Chapter 4/Load Binary Kits Stage.w | 2 +- .../Chapter 4/Make Identifiers Unique Stage.w | 7 +- .../Chapter 4/Reconcile Verbs Stage.w | 6 +- .../Chapter 4/Shorten Wiring Stage.w | 22 +- .../pipeline-module/Chapter 5/Literal Text.w | 2 +- .../Chapter 5/Make Synoptic Module Stage.w | 4 +- inter/pipeline-module/Chapter 5/Rules.w | 2 +- .../Chapter 5/Synoptic Utilities.w | 22 +- inter/pipeline-module/Chapter 5/Tables.w | 2 +- .../Eliminate Redundant Labels Stage.w | 2 +- .../Eliminate Redundant Matter Stage.w | 5 +- 172 files changed, 2015 insertions(+), 1603 deletions(-) diff --git a/README.md b/README.md index b4622b291..0f7b6eca5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Inform 7 -v10.1.0-alpha.1+6U21 'Krypton' (2 February 2022) +v10.1.0-alpha.1+6U22 'Krypton' (3 February 2022) ## About Inform 7 diff --git a/build.txt b/build.txt index c8f8bf8be..592a3a77a 100644 --- a/build.txt +++ b/build.txt @@ -1,3 +1,3 @@ Prerelease: alpha.1 -Build Date: 2 February 2022 -Build Number: 6U21 +Build Date: 3 February 2022 +Build Number: 6U22 diff --git a/docs/building-module/1-hl.html b/docs/building-module/1-hl.html index 382e55dff..ccac5f943 100644 --- a/docs/building-module/1-hl.html +++ b/docs/building-module/1-hl.html @@ -487,7 +487,7 @@ but it is at least policed. } else if (P == NULL) { internal_error("iname in null package"); } else if (P->eventual_type != - LargeScale::package_type(I, hl->requirements.any_package_of_this_type)) { + LargeScale::package_type(I, hl->requirements.any_package_of_this_type)) { LOG("Access name: %S, function: %S\n", hl->access_name, hl->function_package_name); LOG("Have type: $3, required: %S\n", @@ -525,7 +525,7 @@ holding built-in activity or action rulebooks.) if (hl->package_type == NULL) internal_error("HL does not specify a type"); if (hl->requirements.any_package_of_this_type) { if (P->eventual_type != - LargeScale::package_type(I, hl->requirements.any_package_of_this_type)) + LargeScale::package_type(I, hl->requirements.any_package_of_this_type)) internal_error("subpackage in superpackage of wrong type"); } else if (hl->requirements.any_enclosure) { if (Inter::Symbols::read_annotation(P->eventual_type, ENCLOSING_IANN) != 1) @@ -534,7 +534,7 @@ holding built-in activity or action rulebooks.) return Packaging::request(I, InterNames::explicitly_named(hl->access_name, P), - LargeScale::package_type(I, hl->package_type)); + LargeScale::package_type(I, hl->package_type)); }

§16. Making packages systematically at attachment points. This is used a great deal. Instead of making a single iname, or a single package, @@ -601,9 +601,9 @@ inside of R; an module_request *M, package_request *R, int hap_id) { hierarchy_attachment_point *hap = HierarchyLocations::id_to_HAP(I, hap_id); if (hap->requirements.any_submodule_package_of_this_identity) { - if (M) R = LargeScale::request_submodule_of(I, M, + if (M) R = LargeScale::request_submodule_of(I, M, hap->requirements.any_submodule_package_of_this_identity); - else R = LargeScale::generic_submodule(I, + else R = LargeScale::generic_submodule(I, hap->requirements.any_submodule_package_of_this_identity); } else if (hap->requirements.this_exact_package) { R = hap->requirements.this_exact_package; @@ -616,14 +616,14 @@ inside of R; an #endif } else if (hap->requirements.any_package_of_this_type) { if ((R == NULL) || - (R->eventual_type != LargeScale::package_type(I, + (R->eventual_type != LargeScale::package_type(I, hap->requirements.any_package_of_this_type))) internal_error("subpackage in wrong superpackage"); } return Packaging::request(I, Packaging::make_iname_within(R, hap->name_stem), - LargeScale::package_type(I, hap->type)); + LargeScale::package_type(I, hap->type)); }

§19. Bookkeeping. The following is a little clumsily defined to allow for the possibility that diff --git a/docs/building-module/1-in.html b/docs/building-module/1-in.html index 465b9786d..6d97926a5 100644 --- a/docs/building-module/1-in.html +++ b/docs/building-module/1-in.html @@ -244,7 +244,7 @@ a memo to attach): return InterNames::new(InterNames::single_use_generator(name), R, W); } -inter_name *InterNames::explicitly_named(text_stream *name, package_request *R) { +inter_name *InterNames::explicitly_named(text_stream *name, package_request *R) { return InterNames::explicitly_named_with_memo(name, R, EMPTY_WORDING); } @@ -313,7 +313,7 @@ inames which are never needed are never incarnated. TEMPORARY_TEXT(identifier) WRITE_TO(identifier, "%n", iname); inter_symbols_table *T = InterNames::scope(iname); - iname->symbol = InterSymbolsTables::create_with_unique_name(T, identifier); + iname->symbol = InterSymbolsTable::create_with_unique_name(T, identifier); DISCARD_TEXT(identifier) } return iname->symbol; @@ -355,8 +355,8 @@ same as testing whether the iname has been incarnated. inter_symbol *S = InterNames::to_symbol(iname); TEMPORARY_TEXT(temp) WRITE_TO(temp, "%W", W); - Inter::Symbols::annotate_t(InterPackage::tree(S->owning_table->owning_package), - S->owning_table->owning_package, S, annot_ID, temp); + Inter::Symbols::annotate_t(InterPackage::tree(Inter::Symbols::package(S)), + Inter::Symbols::package(S), S, annot_ID, temp); DISCARD_TEXT(temp) } diff --git a/docs/building-module/1-ip.html b/docs/building-module/1-ip.html index 948845b08..2f097782b 100644 --- a/docs/building-module/1-ip.html +++ b/docs/building-module/1-ip.html @@ -568,7 +568,7 @@ the following function must be run to make sure the index is built: } void Primitives::scan_visitor(inter_tree *I, inter_tree_node *P, void *v_state) { - inter_symbol *prim = InterSymbolsTables::symbol_from_frame_data(P, DEFN_PRIM_IFLD); + inter_symbol *prim = InterSymbolsTable::symbol_from_ID_at_node(P, DEFN_PRIM_IFLD); inter_ti bip = Primitives::to_BIP(I, prim); if (bip) I->site.spridata.primitives_by_BIP[bip] = prim; } @@ -580,7 +580,7 @@ We then make various paranoid consistency checks.

-void Primitives::declare_standard_set(inter_tree *I, inter_bookmark *IBM) {
+void Primitives::declare_standard_set(inter_tree *I, inter_bookmark *IBM) {
     Primitives::prepare_standard_set_array();
     for (inter_ti i=0; i<standard_inform7_primitives_extent; i++) {
         text_stream *prim = standard_inform7_primitives[i].name;
diff --git a/docs/building-module/1-lr.html b/docs/building-module/1-lr.html
index f4b4618f9..531ff18f1 100644
--- a/docs/building-module/1-lr.html
+++ b/docs/building-module/1-lr.html
@@ -125,7 +125,7 @@ here, the following is really a union: almost all the fields will be left blank.
     return req;
 }
 
-

§4. "You can put me in any enclosing package." (See LargeScale::package_type +

§4. "You can put me in any enclosing package." (See LargeScale::package_type for what this means.)

@@ -176,7 +176,7 @@ submodule. location_requirement LocationRequirements::generic_submodule(inter_tree *I, submodule_identity *sid) { location_requirement req = LocationRequirements::blank(); - req.this_exact_package = LargeScale::generic_submodule(I, sid); + req.this_exact_package = LargeScale::generic_submodule(I, sid); return req; } @@ -187,7 +187,7 @@ submodule. location_requirement LocationRequirements::synoptic_submodule(inter_tree *I, submodule_identity *sid) { location_requirement req = LocationRequirements::blank(); - req.this_exact_package = LargeScale::synoptic_submodule(I, sid); + req.this_exact_package = LargeScale::synoptic_submodule(I, sid); return req; } @@ -198,7 +198,7 @@ submodule. location_requirement LocationRequirements::completion_submodule(inter_tree *I, submodule_identity *sid) { location_requirement req = LocationRequirements::blank(); - req.this_exact_package = LargeScale::completion_submodule(I, sid); + req.this_exact_package = LargeScale::completion_submodule(I, sid); return req; } diff --git a/docs/building-module/1-ls.html b/docs/building-module/1-ls.html index a1999b79d..01b5a8d42 100644 --- a/docs/building-module/1-ls.html +++ b/docs/building-module/1-ls.html @@ -73,7 +73,7 @@ function togglePopup(material_id) {

To manage the main, connectors and architecture packages of an Inter tree, together with its major building blocks: modules and their submodules.

-
+

§1. Structure data. See What This Module Does for a description of the conventions set by the functions below. Our task in this section is basically to make @@ -146,7 +146,7 @@ names, which cannot be used anywhere else in the tree.

-inter_package *LargeScale::main_package_if_it_exists(inter_tree *I) {
+inter_package *LargeScale::main_package_if_it_exists(inter_tree *I) {
     if (I) return I->site.strdata.main_package;
     return NULL;
 }
@@ -160,12 +160,12 @@ names, which cannot be used anywhere else in the tree.
     return NULL;
 }
 
-package_request *LargeScale::main_request(inter_tree *I) {
+package_request *LargeScale::main_request(inter_tree *I) {
     if (I->site.strdata.main_request == NULL)
         I->site.strdata.main_request =
             Packaging::request(I,
                 InterNames::explicitly_named(I"main", NULL),
-                LargeScale::package_type(I, I"_plain"));
+                LargeScale::package_type(I, I"_plain"));
     return I->site.strdata.main_request;
 }
 
@@ -207,7 +207,7 @@ a typical Inform run it is called only about 30 times, always successfully.
         I->site.strdata.connectors_request =
             Packaging::request(I,
                 InterNames::explicitly_named(I"connectors", LargeScale::main_request(I)),
-                LargeScale::package_type(I, I"_linkage"));
+                LargeScale::package_type(I, I"_linkage"));
     return I->site.strdata.connectors_request;
 }
 
@@ -220,12 +220,12 @@ section of code; so we need a bookmark for where that material goes.
 

-inter_package *LargeScale::architecture_package_if_it_exists(inter_tree *I) {
+inter_package *LargeScale::architecture_package_if_it_exists(inter_tree *I) {
     if (I) return I->site.strdata.architecture_package;
     return NULL;
 }
 
-inter_package *LargeScale::architecture_package(inter_tree *I) {
+inter_package *LargeScale::architecture_package(inter_tree *I) {
     if (I) {
         if (I->site.strdata.architecture_package == NULL)
             Packaging::incarnate(LargeScale::architecture_request(I));
@@ -234,12 +234,12 @@ section of code; so we need a bookmark for where that material goes.
     return NULL;
 }
 
-package_request *LargeScale::architecture_request(inter_tree *I) {
+package_request *LargeScale::architecture_request(inter_tree *I) {
     if (I->site.strdata.architecture_request == NULL) {
         I->site.strdata.architecture_request =
             Packaging::request(I,
                 InterNames::explicitly_named(I"architectural", LargeScale::main_request(I)),
-                LargeScale::package_type(I, I"_linkage"));
+                LargeScale::package_type(I, I"_linkage"));
         packaging_state save = Packaging::enter(I->site.strdata.architecture_request);
         I->site.strdata.architecture_bookmark = Packaging::bubble(I);
         Packaging::exit(I, save);
@@ -270,11 +270,11 @@ many more of these.)
 
 dictionary *create_these_architectural_symbols_on_demand = NULL;
 
-inter_symbol *LargeScale::find_architectural_symbol(inter_tree *I, text_stream *N,
+inter_symbol *LargeScale::find_architectural_symbol(inter_tree *I, text_stream *N,
     inter_symbol *uks) {
     inter_package *arch = LargeScale::architecture_package(I);
     inter_symbols_table *tab = InterPackage::scope(arch);
-    inter_symbol *S = InterSymbolsTables::symbol_from_name(tab, N);
+    inter_symbol *S = InterSymbolsTable::symbol_from_name(tab, N);
     if (S == NULL) {
         if (create_these_architectural_symbols_on_demand == NULL) {
             create_these_architectural_symbols_on_demand = Dictionaries::new(16, TRUE);
@@ -351,36 +351,51 @@ compilation when building kits.
 

-inter_symbol *LargeScale::arch_constant(inter_tree *I, text_stream *N,
+inter_symbol *LargeScale::arch_constant(inter_tree *I, text_stream *N,
     inter_symbol *uks, inter_ti val) {
     inter_package *arch = LargeScale::architecture_package(I);
     inter_symbols_table *tab = InterPackage::scope(arch);
-    inter_symbol *S = InterSymbolsTables::symbol_from_name_creating(tab, N);
+    inter_symbol *S = InterSymbolsTable::symbol_from_name_creating(tab, N);
     Inter::Symbols::annotate_i(S, ARCHITECTURAL_IANN, 1);
     inter_bookmark *IBM = &(I->site.strdata.architecture_bookmark);
     Produce::guard(Inter::Constant::new_numerical(IBM,
-        InterSymbolsTables::id_from_symbol(I, arch, S),
-        InterSymbolsTables::id_from_symbol(I, arch, uks),
+        InterSymbolsTable::id_from_symbol(I, arch, S),
+        InterSymbolsTable::id_from_symbol(I, arch, uks),
         LITERAL_IVAL, val,
         (inter_ti) InterBookmark::baseline(IBM) + 1, NULL));
     return S;
 }
 
-inter_symbol *LargeScale::arch_constant_hex(inter_tree *I, text_stream *N,
+inter_symbol *LargeScale::arch_constant_hex(inter_tree *I, text_stream *N,
     inter_symbol *uks, inter_ti val) {
     inter_symbol *S = LargeScale::arch_constant(I, N, uks, val);
     Inter::Symbols::annotate_i(S, HEX_IANN, 1);
     return S;
 }
 
-inter_symbol *LargeScale::arch_constant_signed(inter_tree *I, text_stream *N,
+inter_symbol *LargeScale::arch_constant_signed(inter_tree *I, text_stream *N,
     inter_symbol *uks, int val) {
     inter_symbol *S = LargeScale::arch_constant(I, N, uks, (inter_ti) val);
     Inter::Symbols::annotate_i(S, SIGNED_IANN, 1);
     return S;
 }
 
-

§11. Modules. Modules are identified by name, and each one produces an instance of the +

§11. This falls back on the main package, but really, should be used only for +things which ought to be in architectural: +

+ +
+inter_symbol *LargeScale::architectural_symbol(inter_tree *I, text_stream *name) {
+    inter_symbol *symbol = NULL;
+    inter_package *P = LargeScale::architecture_package_if_it_exists(I);
+    if (P) symbol = InterSymbolsTable::symbol_from_name(InterPackage::scope(P), name);
+    if (symbol) return symbol;
+    P = LargeScale::main_package_if_it_exists(I);
+    if (P) symbol = InterSymbolsTable::symbol_from_name(InterPackage::scope(P), name);
+    return symbol;
+}
+
+

§12. Modules. Modules are identified by name, and each one produces an instance of the following.

@@ -392,12 +407,12 @@ following. } module_request;
  • The structure module_request is private to this section.
-

§12. The tree's module dictionary is used to ensure that repeated calls with the +

§13. The tree's module dictionary is used to ensure that repeated calls with the same module name return the same module_request.

-module_request *LargeScale::module_request(inter_tree *I, text_stream *name) {
+module_request *LargeScale::module_request(inter_tree *I, text_stream *name) {
     dictionary *D = I->site.strdata.modules_indexed_by_name;
     if (Dictionaries::find(D, name))
         return (module_request *) Dictionaries::read_value(D, name);
@@ -405,14 +420,14 @@ same module name return the same     new_module->where_found =
         Packaging::request(I,
             InterNames::explicitly_named(name, LargeScale::main_request(I)),
-            LargeScale::package_type(I, I"_module"));
+            LargeScale::package_type(I, I"_module"));
     new_module->submodules = NEW_LINKED_LIST(submodule_request);
     Dictionaries::create(D, name);
     Dictionaries::write_value(D, name, (void *) new_module);
     return new_module;
 }
 
-

§13. Submodules. The idea here is that each module could define, say, some variables, placing +

§14. Submodules. The idea here is that each module could define, say, some variables, placing them in a submodule for that purpose. As a result, there will be a "variables only" submodule found in several modules. Such flavours of submodule are preset — we allow only a few of these: see Hierarchy (in runtime) for the set used by @@ -440,24 +455,24 @@ like variables }

-

§14. Armed with such an identity, the following can be called to return the relevant +

§15. Armed with such an identity, the following can be called to return the relevant submodule of a given module, creating it if it does not already exist.

-package_request *LargeScale::generic_submodule(inter_tree *I, submodule_identity *sid) {
-    return LargeScale::request_submodule_of(I, LargeScale::module_request(I, I"generic"), sid);
+package_request *LargeScale::generic_submodule(inter_tree *I, submodule_identity *sid) {
+    return LargeScale::request_submodule_of(I, LargeScale::module_request(I, I"generic"), sid);
 }
 
-package_request *LargeScale::synoptic_submodule(inter_tree *I, submodule_identity *sid) {
-    return LargeScale::request_submodule_of(I, LargeScale::module_request(I, I"synoptic"), sid);
+package_request *LargeScale::synoptic_submodule(inter_tree *I, submodule_identity *sid) {
+    return LargeScale::request_submodule_of(I, LargeScale::module_request(I, I"synoptic"), sid);
 }
 
-package_request *LargeScale::completion_submodule(inter_tree *I, submodule_identity *sid) {
-    return LargeScale::request_submodule_of(I, LargeScale::module_request(I, I"completion"), sid);
+package_request *LargeScale::completion_submodule(inter_tree *I, submodule_identity *sid) {
+    return LargeScale::request_submodule_of(I, LargeScale::module_request(I, I"completion"), sid);
 }
 
-

§15. Those in turn all make use of this back-end function: +

§16. Those in turn all make use of this back-end function:

@@ -467,7 +482,7 @@ submodule of a given module, creating it if it does not already exist.
     CLASS_DEFINITION
 } submodule_request;
 
-package_request *LargeScale::request_submodule_of(inter_tree *I, module_request *M,
+package_request *LargeScale::request_submodule_of(inter_tree *I, module_request *M,
     submodule_identity *sid) {
     submodule_request *sr;
     LOOP_OVER_LINKED_LIST(sr, submodule_request, M->submodules)
@@ -476,13 +491,13 @@ submodule of a given module, creating it if it does not already exist.
     inter_name *iname = InterNames::explicitly_named(sid->submodule_name, M->where_found);
     sr = CREATE(submodule_request);
     sr->which_submodule = sid;
-    sr->where_found = Packaging::request(I, iname, LargeScale::package_type(I, I"_submodule"));
+    sr->where_found = Packaging::request(I, iname, LargeScale::package_type(I, I"_submodule"));
     ADD_TO_LINKED_LIST(sr, submodule_request, M->submodules);
     return sr->where_found;
 }
 
-

§16. Pragmas. There's very little to say here: +

§17. Pragmas. There's very little to say here:

@@ -490,11 +505,11 @@ submodule of a given module, creating it if it does not already exist.
     inter_ti ID = InterWarehouse::create_text(InterTree::warehouse(I), InterTree::root_package(I));
     Str::copy(InterWarehouse::get_text(InterTree::warehouse(I), ID), content);
     inter_symbol *target_name =
-        InterSymbolsTables::symbol_from_name_creating(InterTree::global_scope(I), target);
+        InterSymbolsTable::symbol_from_name_creating(InterTree::global_scope(I), target);
     Produce::guard(Inter::Pragma::new(&(I->site.strdata.pragmas_bookmark), target_name, ID, 0, NULL));
 }
 
-

§17. Package types. Or indeed here. Package types are created on request; looking for _octopus +

§18. Package types. Or indeed here. Package types are created on request; looking for _octopus would create it if it didn't already exist. So although the Inform tools do use a conventional set of package types, they are not itemised here.

@@ -514,11 +529,11 @@ exception is made.

-inter_symbol *LargeScale::package_type(inter_tree *I, text_stream *name) {
+inter_symbol *LargeScale::package_type(inter_tree *I, text_stream *name) {
     inter_symbols_table *scope = InterTree::global_scope(I);
-    inter_symbol *ptype = InterSymbolsTables::symbol_from_name(scope, name);
+    inter_symbol *ptype = InterSymbolsTable::symbol_from_name(scope, name);
     if (ptype == NULL) {
-        ptype = InterSymbolsTables::create_with_unique_name(scope, name);
+        ptype = InterSymbolsTable::create_with_unique_name(scope, name);
         Produce::guard(Inter::PackageType::new_packagetype(
             &(I->site.strdata.package_types_bookmark), ptype, 0, NULL));
         if (Str::ne(name, I"_code"))
@@ -527,7 +542,7 @@ exception is made.
     return ptype;
 }
 
-

§18. Outside the packages. The Inter specification calls for just a handful of resources to be placed +

§19. Outside the packages. The Inter specification calls for just a handful of resources to be placed at the top level, outside even the main package. Using bubbles, we leave room to insert those resources, then incarnate main and enter it.

@@ -546,9 +561,9 @@ room to insert those resources, then incarnate Produce::comment(I, I"Primitives:"); Primitives::declare_standard_set(I, Packaging::at(I)); - LargeScale::package_type(I, I"_plain"); To ensure this is the first emitted ptype - LargeScale::package_type(I, I"_code"); And this the second - LargeScale::package_type(I, I"_linkage"); And this the third + LargeScale::package_type(I, I"_plain"); To ensure this is the first emitted ptype + LargeScale::package_type(I, I"_code"); And this the second + LargeScale::package_type(I, I"_linkage"); And this the third Packaging::enter(LargeScale::main_request(I)); Which we never exit } diff --git a/docs/building-module/1-pck.html b/docs/building-module/1-pck.html index 8e6bb9850..9fd8be9a4 100644 --- a/docs/building-module/1-pck.html +++ b/docs/building-module/1-pck.html @@ -99,7 +99,7 @@ though, such tools need to make good on their promises and "incarnate" them.

§2.

-package_request *Packaging::request(inter_tree *I, inter_name *name, inter_symbol *pt) {
+package_request *Packaging::request(inter_tree *I, inter_name *name, inter_symbol *pt) {
     package_request *R = CREATE(package_request);
     R->tree = I;
     R->eventual_name = name;
@@ -136,7 +136,7 @@ than forward slashes are used as dividers.
 

§4. The packaging state. At any given time, Inter code is being produced at a particular position (in some incarnated package) and in the context of a given enclosure — see -LargeScale::package_type. This is summarised by the following state: +LargeScale::package_type. This is summarised by the following state:

@@ -200,7 +200,7 @@ package is created, very early on, the enclosure is always an enclosing package.
 

-inter_bookmark *Packaging::at(inter_tree *I) {
+inter_bookmark *Packaging::at(inter_tree *I) {
     return I->site.spdata.current_state.saved_bookmark;
 }
 
@@ -212,7 +212,7 @@ package is created, very early on, the enclosure is always an enclosing package.
     return I->site.spdata.current_state.saved_enclosure;
 }
 
-void Packaging::initialise_state(inter_tree *I) {
+void Packaging::initialise_state(inter_tree *I) {
     I->site.spdata.current_state.saved_bookmark =
         Packaging::push_state(I, InterBookmark::at_start_of_this_repository(I));
     I->site.spdata.current_state.saved_enclosure = NULL;
@@ -265,7 +265,7 @@ later inserted material will be placed between them. For example:
 

-inter_bookmark Packaging::bubble(inter_tree *I) {
+inter_bookmark Packaging::bubble(inter_tree *I) {
     Produce::nop(I);
     inter_bookmark b = InterBookmark::snapshot(Packaging::at(I));
     Produce::nop(I);
@@ -298,7 +298,7 @@ package we wsnt to extend next.
 

That switching is called "entering" a package. Every entry must be followed by a matching exit, which restores the write position to where it was before the entry. (The one exception is that the very first entry, into main — -see LargeScale::begin_new_tree — is never followed by an exit.) +see LargeScale::begin_new_tree — is never followed by an exit.)

@@ -306,7 +306,7 @@ see LargeScale::begin_new_tree &md
     return Packaging::enter(InterNames::location(N));
 }
 
-packaging_state Packaging::enter(package_request *R) {
+packaging_state Packaging::enter(package_request *R) {
     LOGIF(PACKAGING, "Entering $X\n", R);
     packaging_state save = R->tree->site.spdata.current_state;
     Packaging::incarnate(R);
@@ -370,7 +370,7 @@ functions are produced by the following:
 inter_name *Packaging::function(inter_tree *I, inter_name *function_iname,
     text_stream *translation) {
     package_request *P =
-        Packaging::request(I, function_iname, LargeScale::package_type(I, I"_function"));
+        Packaging::request(I, function_iname, LargeScale::package_type(I, I"_function"));
     inter_name *iname = InterNames::explicitly_named(I"call", P);
     if (translation) InterNames::set_translation(iname, translation);
     return iname;
@@ -380,7 +380,7 @@ functions are produced by the following:
     if (iname == NULL) return FALSE;
     package_request *P = InterNames::location(iname);
     if (P == NULL) return FALSE;
-    if (P->eventual_type == LargeScale::package_type(I, I"_function")) return TRUE;
+    if (P->eventual_type == LargeScale::package_type(I, I"_function")) return TRUE;
     return FALSE;
 }
 
@@ -392,7 +392,7 @@ These are very similar. inter_name *Packaging::datum_text(inter_tree *I, inter_name *function_iname, text_stream *identifier) { package_request *P = - Packaging::request(I, function_iname, LargeScale::package_type(I, I"_data")); + Packaging::request(I, function_iname, LargeScale::package_type(I, I"_data")); inter_name *iname = InterNames::explicitly_named(identifier, P); return iname; } diff --git a/docs/building-module/2-if.html b/docs/building-module/2-if.html index 79b450564..7e6b0d890 100644 --- a/docs/building-module/2-if.html +++ b/docs/building-module/2-if.html @@ -142,7 +142,7 @@ halt with an internal error: so this must be done speculatively. Str::copy(SR, name); Str::delete_first_character(SR); Str::delete_last_character(SR); - inter_symbol *S = InterSymbolsTables::url_name_to_symbol(I, NULL, SR); + inter_symbol *S = InterSymbolsTable::URL_to_symbol(I, SR); DISCARD_TEXT(SR) if (S) return S;
@@ -157,15 +157,15 @@ So the above internal error cannot occur.
     for (int i = 0; i < finder.no_priorities; i++) {
-        inter_symbol *S = InterSymbolsTables::symbol_from_name(finder.priorities[i], name);
+        inter_symbol *S = InterSymbolsTable::symbol_from_name(finder.priorities[i], name);
         if (S) return S;
     }
     inter_symbol *S = LargeScale::find_architectural_symbol(I, name,
         Produce::kind_to_symbol(NULL));
     if (S) return S;
-    S = InterSymbolsTables::symbol_from_name(LargeScale::connectors_scope(I), name);
+    S = InterSymbolsTable::symbol_from_name(LargeScale::connectors_scope(I), name);
     if (S) return S;
-    S = InterSymbolsTables::symbol_from_name(LargeScale::main_scope(I), name);
+    S = InterSymbolsTable::symbol_from_name(LargeScale::main_scope(I), name);
     if (S) return S;
     S = InterNames::to_symbol(HierarchyLocations::find_by_name(I, name));
     if (S) return S;
diff --git a/docs/building-module/3-prd.html b/docs/building-module/3-prd.html
index 6848cd6a6..aabc1febd 100644
--- a/docs/building-module/3-prd.html
+++ b/docs/building-module/3-prd.html
@@ -289,7 +289,7 @@ standard function packages.
     else internal_error("routine outside function package");
     inter_bookmark save_ib = InterBookmark::snapshot(Packaging::at(I));
     Produce::set_function(I,
-        Produce::make_and_set_package(I, block_iname, LargeScale::package_type(I, I"_code")));
+        Produce::make_and_set_package(I, block_iname, LargeScale::package_type(I, I"_code")));
 
     Produce::guard(Inter::Code::new(Packaging::at(I),
         (int) Produce::baseline(Packaging::at(I)) + 1, NULL));
@@ -329,7 +329,7 @@ refer to local resources like these.
 
 
 inter_symbol *Produce::new_local_symbol(inter_tree *I, text_stream *name) {
-    return InterSymbolsTables::create_with_unique_name(
+    return InterSymbolsTable::create_with_unique_name(
         InterPackage::scope(I->site.sprdata.current_inter_function), name);
 }
 
@@ -361,7 +361,7 @@ internal error to halt the compiler if they occur.

-void Produce::guard(inter_error_message *ERR) {
+void Produce::guard(inter_error_message *ERR) {
     if ((ERR) && (problem_count == 0)) {
         Inter::Errors::issue(ERR); internal_error("inter error");
     }
@@ -388,7 +388,7 @@ or the baseline of the current package plus 1, if we're in a package.
 

-void Produce::version(inter_tree *I, int N) {
+void Produce::version(inter_tree *I, int N) {
     inter_bookmark *IBM = Packaging::at(I);
     Produce::guard(Inter::Version::new(IBM, N, Produce::baseline(IBM), NULL));
 }
@@ -401,7 +401,7 @@ or the baseline of the current package plus 1, if we're in a package.
     Produce::guard(Inter::Nop::new(IBM, Produce::baseline(IBM) + delta, NULL));
 }
 
-void Produce::comment(inter_tree *I, text_stream *text) {
+void Produce::comment(inter_tree *I, text_stream *text) {
     inter_bookmark *IBM = Packaging::at(I);
     inter_ti ID = InterWarehouse::create_text(
         InterTree::warehouse(I), InterBookmark::package(IBM));
@@ -419,8 +419,8 @@ or the baseline of the current package plus 1, if we're in a package.
     inter_symbol *con_s = InterNames::define(con_iname);
     inter_bookmark *IBM = Packaging::at(I);
     Produce::guard(Inter::Constant::new_numerical(IBM,
-        InterSymbolsTables::id_from_IRS_and_symbol(IBM, con_s),
-        InterSymbolsTables::id_from_IRS_and_symbol(IBM, Produce::kind_to_symbol(K)),
+        InterSymbolsTable::id_from_symbol_at_bookmark(IBM, con_s),
+        InterSymbolsTable::id_from_symbol_at_bookmark(IBM, Produce::kind_to_symbol(K)),
         LITERAL_IVAL, val, Produce::baseline(IBM), NULL));
     Packaging::exit(I, save);
     return con_iname;
@@ -439,8 +439,8 @@ or the baseline of the current package plus 1, if we're in a package.
     inter_package *pack = InterBookmark::package(IBM);
     Inter::Symbols::to_data(InterPackage::tree(pack), pack, val_s, &v1, &v2);
     Produce::guard(Inter::Constant::new_numerical(IBM,
-        InterSymbolsTables::id_from_IRS_and_symbol(IBM, con_s),
-        InterSymbolsTables::id_from_IRS_and_symbol(IBM, Produce::kind_to_symbol(K)),
+        InterSymbolsTable::id_from_symbol_at_bookmark(IBM, con_s),
+        InterSymbolsTable::id_from_symbol_at_bookmark(IBM, Produce::kind_to_symbol(K)),
         v1, v2, Produce::baseline(IBM), NULL));
     Packaging::exit(I, save);
     return con_iname;
@@ -769,7 +769,7 @@ doesn't add the name tp the current stack frame in }
 
 inter_symbol *Produce::local_exists(inter_tree *I, text_stream *lname) {
-    return InterSymbolsTables::symbol_from_name(
+    return InterSymbolsTable::symbol_from_name(
         InterPackage::scope(I->site.sprdata.current_inter_function), lname);
 }
 
diff --git a/docs/building-module/P-wtmd.html b/docs/building-module/P-wtmd.html index edd8e4b2e..f8fa61b5f 100644 --- a/docs/building-module/P-wtmd.html +++ b/docs/building-module/P-wtmd.html @@ -105,12 +105,12 @@ are ignored by the final
  • ● The following resources are stored at the root level (i.e., not inside of any package) and nowhere else: -
    • ● Package type declarations. See LargeScale::package_type. +
      • ● Package type declarations. See LargeScale::package_type.
      • ● Primitive declarations. See Inter Primitives. Again, Inter can in principle support a variety of different "instruction sets", but this module presents a single standardised instruction set.
      • ● Compiler pragmas. These are marginal tweaks on a platform-by-platform basis -and use of them is minimal, but see LargeScale::emit_pragma. +and use of them is minimal, but see LargeScale::emit_pragma.
    • ● Everything else is inside a single top-level package called main, which has package type _plain. diff --git a/docs/bytecode-module/1-bm.html b/docs/bytecode-module/1-bm.html index 7cf70dc51..18e2e67be 100644 --- a/docs/bytecode-module/1-bm.html +++ b/docs/bytecode-module/1-bm.html @@ -177,9 +177,9 @@ which use this module:
           Writers::register_logger('3', Inter::Symbols::log);
      -    Writers::register_logger('4', InterSymbolsTables::log);
      +    Writers::register_logger('4', InterSymbolsTable::log);
           Writers::register_logger('5', InterBookmark::log);
      -    Writers::register_logger('6', InterPackage::log);
      +    Writers::register_logger('6', InterPackage::log);
       
      • This code is used in §3.
  • -
    • The structure inter_package is accessed in 2/it, 2/trn, 3/dfn, 3/iibf, 4/tpc3, 4/tcc2 and here.
    +
    • The structure inter_package is accessed in 2/it, 2/st, 2/trn, 3/dfn, 3/iibf, 4/tpc3, 4/tcc2 and here.

    §3. Do not call this directly to make a new package: it needs the resource ID n to exist already, and that has to be allocated. So instead you could call InterWarehouse::create_package, which calls this. But in fact what you @@ -144,7 +144,7 @@ See InterPackage::new_package for pack->package_flags = 0; pack->package_name_t = NULL; pack->resource_ID = n; - pack->name_lookup = Dictionaries::new(INITIAL_INTER_SYMBOLS_ID_RANGE, FALSE); + pack->name_lookup = Dictionaries::new(16, FALSE); return pack; }

    @@ -162,13 +162,13 @@ outermost box, that is, the top level of the hierarchy.

    -inter_tree_node *InterPackage::head(inter_package *pack) {
    +inter_tree_node *InterPackage::head(inter_package *pack) {
         if (pack == NULL) return NULL;
    -    if (InterPackage::is_a_root_package(pack)) return NULL;
    +    if (InterPackage::is_a_root_package(pack)) return NULL;
         return pack->package_head;
     }
     
    -inter_tree *InterPackage::tree(inter_package *pack) {
    +inter_tree *InterPackage::tree(inter_package *pack) {
         if (pack == NULL) return NULL;
         return pack->package_head->tree;
     }
    @@ -184,9 +184,9 @@ finding the package with that head.
     

    -inter_package *InterPackage::parent(inter_package *pack) {
    +inter_package *InterPackage::parent(inter_package *pack) {
         if (pack) {
    -        if (InterPackage::is_a_root_package(pack)) return NULL;
    +        if (InterPackage::is_a_root_package(pack)) return NULL;
             inter_tree_node *D = InterPackage::head(pack);
             inter_tree_node *P = InterTree::parent(D);
             if (P == NULL) return NULL;
    @@ -202,7 +202,7 @@ node, or is 0 for the root package.
     
     int InterPackage::baseline(inter_package *P) {
         if (P == NULL) return 0;
    -    if (InterPackage::is_a_root_package(P)) return 0;
    +    if (InterPackage::is_a_root_package(P)) return 0;
         return Inter::Defn::get_level(InterPackage::head(P));
     }
     
    @@ -212,7 +212,7 @@ and (b) as noted above, the name symbol is not visible inside the package.

    -text_stream *InterPackage::name(inter_package *pack) {
    +text_stream *InterPackage::name(inter_package *pack) {
         if (pack == NULL) return NULL;
         return pack->package_name_t;
     }
    @@ -223,7 +223,7 @@ and (b) as noted above, the name symbol is not visible inside the package.
         P->package_name_t = Str::duplicate(N);
         if (Str::len(N) > 0) {
             LargeScale::note_package_name(I, P, N);
    -        InterPackage::add_subpackage_name(Q, P);
    +        InterPackage::add_subpackage_name(Q, P);
         }
     }
     
    @@ -236,33 +236,37 @@ and (b) as noted above, the name symbol is not visible inside the package. P->package_scope = T; if (T) T->owning_package = P; } +
    +

    §9. This function is the inverse of InterSymbolsTable::package: +

    -inter_symbols_table *InterPackage::scope(inter_package *pack) { +
    +inter_symbols_table *InterPackage::scope(inter_package *pack) {
         if (pack == NULL) return NULL;
         return pack->package_scope;
     }
     
    -

    §9. The following searches recursively: i.e., not just the package's scope, but +

    §10. The following searches recursively: i.e., not just the package's scope, but also the scope of all its subpackages. This is a slow operation, but there is no need for it to be fast: it is used only very sparingly.

     inter_symbol *InterPackage::find_symbol_slowly(inter_package *P, text_stream *S) {
    -    inter_symbol *found = InterSymbolsTables::symbol_from_name(InterPackage::scope(P), S);
    +    inter_symbol *found = InterSymbolsTable::symbol_from_name(InterPackage::scope(P), S);
         if (found) return found;
         inter_tree_node *D = InterPackage::head(P);
         LOOP_THROUGH_INTER_CHILDREN(C, D) {
             if (C->W.instruction[ID_IFLD] == PACKAGE_IST) {
                 inter_package *Q = InterPackage::at_this_head(C);
    -            found = InterPackage::find_symbol_slowly(Q, S);
    +            found = InterPackage::find_symbol_slowly(Q, S);
                 if (found) return found;
             }
         }
         return NULL;
     }
     
    -

    §10. Packages as containers. For any node, the innermost package containing that node is called its +

    §11. Packages as containers. For any node, the innermost package containing that node is called its "container"; but this is null at the root of the tree, i.e., it is never equal to the special root package.

    @@ -271,17 +275,17 @@ equal to the special root package. inter_package *InterPackage::container(inter_tree_node *P) { if (P == NULL) return NULL; inter_package *pack = Inode::get_package(P); - if (InterPackage::is_a_root_package(pack)) return NULL; + if (InterPackage::is_a_root_package(pack)) return NULL; return pack; } -inter_symbols_table *InterPackage::scope_of(inter_tree_node *P) { - inter_package *pack = InterPackage::container(P); +inter_symbols_table *InterPackage::scope_of(inter_tree_node *P) { + inter_package *pack = InterPackage::container(P); if (pack) return pack->package_scope; return Inode::globals(P); }
    -

    §11. Flags. Packages with special behaviour are marked with flags. (Flags can also be used +

    §12. Flags. Packages with special behaviour are marked with flags. (Flags can also be used as temporary markers when fooling with Inter code during pipeline processing.)

    @@ -302,17 +306,17 @@ as temporary markers when fooling with Inter code during pipeline processing.) P->package_flags = P->package_flags | f; } -void InterPackage::clear_flag(inter_package *P, int f) { +void InterPackage::clear_flag(inter_package *P, int f) { if (P == NULL) internal_error("no package"); if (P->package_flags & f) P->package_flags = P->package_flags - f; }
    -

    §12. The ROOT_PACKAGE_FLAG is given only to the root package of a tree, so there +

    §13. The ROOT_PACKAGE_FLAG is given only to the root package of a tree, so there will only ever be one of these in any given tree.

    -int InterPackage::is_a_root_package(inter_package *pack) {
    +int InterPackage::is_a_root_package(inter_package *pack) {
         if ((pack) && (pack->package_flags & ROOT_PACKAGE_FLAG)) return TRUE;
         return FALSE;
     }
    @@ -321,7 +325,7 @@ will only ever be one of these in any given tree.
         if (pack) pack->package_flags |= ROOT_PACKAGE_FLAG;
     }
     
    -

    §13. The FUNCTION_BODY_PACKAGE_FLAG is given to function bodies. Note that the code +

    §14. The FUNCTION_BODY_PACKAGE_FLAG is given to function bodies. Note that the code of each function always occupies a single package, which contains nothing else. Subsidiary parts of the function — what are called "code blocks" in C, like loop bodies — are not subpackages of this: a code package has no subpackages. @@ -337,7 +341,7 @@ loop bodies — are not subpackages of this: a code package has no subpackag if (pack) pack->package_flags |= FUNCTION_BODY_PACKAGE_FLAG; }

    -

    §14. The LINKAGE_PACKAGE_FLAG is given only to a few top-level packages which +

    §15. The LINKAGE_PACKAGE_FLAG is given only to a few top-level packages which behave differently during the transmigration process used in linking trees together. This is not the place to explain: see Large-Scale Structure (in building).

    @@ -352,7 +356,7 @@ together. This is not the place to explain: see
    if (pack) pack->package_flags |= LINKAGE_PACKAGE_FLAG; }
    -

    §15. MARK_PACKAGE_FLAG is ephemeral and typically used to mark that something +

    §16. MARK_PACKAGE_FLAG is ephemeral and typically used to mark that something has already been done on a given package, so that it won't be done twice. At the start of such a process, call this.

    @@ -361,16 +365,16 @@ At the start of such a process, call this. void InterPackage::unmark_all(void) { inter_package *pack; LOOP_OVER(pack, inter_package) - InterPackage::clear_flag(pack, MARK_PACKAGE_FLAG); + InterPackage::clear_flag(pack, MARK_PACKAGE_FLAG); } -

    §16. Subpackages and URLs. A package is uniquely identifiable (within its tree) by its textual URL, in the +

    §17. Subpackages and URLs. A package is uniquely identifiable (within its tree) by its textual URL, in the form /main/whatever/example1/this. The following goes from an inter_package to its URL, which is particularly handy for the debugging log:

    -void InterPackage::write_url_name(OUTPUT_STREAM, inter_package *P) {
    +void InterPackage::write_URL(OUTPUT_STREAM, inter_package *P) {
         if (P == NULL) { WRITE("<none>"); return; }
         inter_package *chain[MAX_URL_SYMBOL_NAME_DEPTH];
         int chain_length = 0;
    @@ -385,10 +389,10 @@ to its URL, which is particularly handy for the debugging log:
     
     void InterPackage::log(OUTPUT_STREAM, void *vp) {
         inter_package *pack = (inter_package *) vp;
    -    InterPackage::write_url_name(OUT, pack);
    +    InterPackage::write_URL(OUT, pack);
     }
     
    -

    §17. The other direction, parsing a URL into its corresponding inter_package, is +

    §18. The other direction, parsing a URL into its corresponding inter_package, is necessarily slower. But we do our best to speed this up by giving each package a dictionary (i.e., an associative hash) of names of its immediate subpackages.

    @@ -413,19 +417,19 @@ dictionary (i.e., an associative hash) of names of its immediate subpackages. if (de) Dictionaries::write_value(Q->name_lookup, N, NULL); } -

    §18. This makes rapid lookup possible. The following looks for a subpackage called +

    §19. This makes rapid lookup possible. The following looks for a subpackage called name within the parent package P:

    -inter_package *InterPackage::by_name(inter_package *P, text_stream *name) {
    +inter_package *InterPackage::from_name(inter_package *P, text_stream *name) {
         if (P == NULL) return NULL;
         dict_entry *de = Dictionaries::find(P->name_lookup, name);
         if (de) return (inter_package *) Dictionaries::read_value(P->name_lookup, name);
         return NULL;
     }
     
    -

    §19. And that is the key tool needed for the following. Note that if there is an +

    §20. And that is the key tool needed for the following. Note that if there is an initial slash, the URL is absolute, with respect to the top of the tree; and otherwise it is construed as a single name. (So searching for this/that could never succeed: without the initial slash, this would have to be the name @@ -433,7 +437,7 @@ of a single package, and slashes can't be part of package names.)

    -inter_package *InterPackage::by_url(inter_tree *I, text_stream *S) {
    +inter_package *InterPackage::from_URL(inter_tree *I, text_stream *S) {
         if (Str::get_first_char(S) == '/') {
             inter_package *at_P = I->root_package;
             TEMPORARY_TEXT(C)
    @@ -441,7 +445,7 @@ of a single package, and slashes can't be part of package names.)
                 wchar_t c = Str::get(P);
                 if (c == '/') {
                     if (Str::len(C) > 0) {
    -                    at_P = InterPackage::by_name(at_P, C);
    +                    at_P = InterPackage::from_name(at_P, C);
                         if (at_P == NULL) return NULL;
                     }
                     Str::clear(C);
    @@ -449,11 +453,11 @@ of a single package, and slashes can't be part of package names.)
                     PUT_TO(C, c);
                 }
             }
    -        inter_package *pack = InterPackage::by_name(at_P, C);
    +        inter_package *pack = InterPackage::from_name(at_P, C);
             DISCARD_TEXT(C)
             return pack;
         }
    -    return InterPackage::by_name(I->root_package, S);
    +    return InterPackage::from_name(I->root_package, S);
     }