diff --git a/docs/core-module/13-rsfk.html b/docs/core-module/13-rsfk.html index 6b3a2c500..ef80e15ce 100644 --- a/docs/core-module/13-rsfk.html +++ b/docs/core-module/13-rsfk.html @@ -60,7 +60,7 @@ kinds being compiled to an I6 Class<

-

The function Kinds::RunTime::I6_classname is used in §27, 6/bp (§25), 6/rlt (§29.2, §29.3, §29.4, §29.5, §29.6), 12/ter (§8.6), 12/ca (§6.2), 12/dtd (§24), 13/kak (§2), 25/cii (§3.1.1.4.7.1), 26/iti (§9), 27/is (§31.8.1), 27/hl (§1).

+

The function Kinds::RunTime::I6_classname is used in §27, 6/bp (§25), 6/rlt (§29.2, §29.3, §29.4, §29.5, §29.6), 12/ter (§8.6), 12/ca (§6.2), 12/dtd (§24), 13/kak (§2), 25/cii (§3.1.1.4.7.1), 26/iti (§9), 27/is (§31.8.1), 27/hr (§5).

The function Kinds::RunTime::I6_classnumber is used in 16/ic (§6, §12.2), 27/in (§3).

@@ -1252,7 +1252,7 @@ each such kind, and needed at run-time.

-

The function Kinds::RunTime::package is used in §15, 15/epv (§2), 22/pav (§9), 27/ei (§4), 27/hl (§1).

+

The function Kinds::RunTime::package is used in §15, 15/epv (§2), 22/pav (§9), 27/ei (§4).

§24.

diff --git a/docs/core-module/17-ts.html b/docs/core-module/17-ts.html index b6c75fe0a..4f998cb98 100644 --- a/docs/core-module/17-ts.html +++ b/docs/core-module/17-ts.html @@ -117,10 +117,8 @@ to the same routines to print them. (LocalVariables::count(Frames::current_stack_frame()) > 0)) ts->local_names_existed_at_usage_time = TRUE; ts->ts_iname = Packaging::supply_iname(P, SUBSTITUTION_PR_COUNTER); - InterNames::new_in(TEXT_SUBSTITUTION_INAMEF, Modules::current()); ts->ts_routine_iname = Packaging::function(Packaging::supply_iname(P, SUBSTITUTIONF_PR_COUNTER), P, NULL); - InterNames::new_derived(TEXT_ROUTINE_INAMEF, ts->ts_iname); ts->belongs_to_module = Modules::current(); Inter::Symbols::set_flag(InterNames::to_symbol(ts->ts_iname), MAKE_NAME_UNIQUE); Inter::Symbols::set_flag(InterNames::to_symbol(ts->ts_routine_iname), MAKE_NAME_UNIQUE); diff --git a/docs/core-module/21-rl2.html b/docs/core-module/21-rl2.html index b354c4083..d6b8a3da6 100644 --- a/docs/core-module/21-rl2.html +++ b/docs/core-module/21-rl2.html @@ -297,9 +297,7 @@ built (for instance, scene endings). else package_name = InterNames::one_off(supplied, R); rb->rb_package = Packaging::request(package_name, R, rulebook_ptype); rb->rb_iname = Packaging::function(InterNames::one_off(I"run_fn", rb->rb_package), rb->rb_package, NULL); - InterNames::attach_memo(rb->rb_iname, rb->primary_name); Inter::Symbols::set_flag(InterNames::to_symbol(rb->rb_iname), MAKE_NAME_UNIQUE); - InterNames::new(RULEBOOK_INAMEF); rb->rule_list = Rules::Bookings::list_new(); diff --git a/docs/core-module/27-ei.html b/docs/core-module/27-ei.html index 8bb506c87..4898066a0 100644 --- a/docs/core-module/27-ei.html +++ b/docs/core-module/27-ei.html @@ -1233,7 +1233,7 @@ insert them into the Inter stream close to the top.

The function Emit::kind_inner is used in §3.

-

The function Emit::variable is used in 5/nv (§16), 27/hl (§1).

+

The function Emit::variable is used in 5/nv (§16), 27/hr (§5).

The function Emit::marker appears nowhere else.

@@ -1259,7 +1259,7 @@ insert them into the Inter stream close to the top.

The function Emit::named_generic_constant is used in 21/rl (§9).

-

The function Emit::named_numeric_constant is used in 6/rlt (§20.3), 13/kak (§5), 13/rsfk (§26), 21/ac (§6), 22/cs (§8), 24/ch (§8), 26/vm (§8), 26/uo (§21), 26/pl (§12), 26/ts (§10), 27/hl (§1).

+

The function Emit::named_numeric_constant is used in 6/rlt (§20.3), 13/kak (§5), 13/rsfk (§26), 21/ac (§6), 22/cs (§8), 24/ch (§8), 26/vm (§8), 26/uo (§21), 26/pl (§12), 26/ts (§10), 27/hr (§5).

The function Emit::hold_numeric_constant appears nowhere else.

diff --git a/docs/core-module/27-hl.html b/docs/core-module/27-hl.html index 7f0cb570e..933ccaf33 100644 --- a/docs/core-module/27-hl.html +++ b/docs/core-module/27-hl.html @@ -19,52 +19,48 @@ struct text_stream *function_package_name; struct text_stream *datum_package_name; struct package_request *package; + int exotic_package_identifier; struct inter_name *equates_to_iname; MEMORY_MANAGEMENT } named_resource_location; - named_resource_location *nrls_indexed_by_id[MAX_HL]; - dictionary *nrls_indexed_by_name = NULL; - - named_resource_location *HierarchyLocations::make_in(int id, text_stream *name, package_request *P) { + named_resource_location *HierarchyLocations::new(void) { named_resource_location *nrl = CREATE(named_resource_location); - nrl->access_number = id; - nrl->access_name = Str::duplicate(name); - nrl->function_package_name = NULL; - nrl->datum_package_name = NULL; - nrl->package = P; - nrl->equates_to_iname = NULL; - if (id >= 0) nrls_indexed_by_id[id] = nrl; - Dictionaries::create(nrls_indexed_by_name, name); - Dictionaries::write_value(nrls_indexed_by_name, name, (void *) nrl); - return nrl; - } - - named_resource_location *HierarchyLocations::make_as(int id, text_stream *name, inter_name *iname) { - named_resource_location *nrl = CREATE(named_resource_location); - nrl->access_number = id; - nrl->access_name = Str::duplicate(name); - nrl->function_package_name = NULL; - nrl->datum_package_name = NULL; - nrl->package = iname->eventual_owner; - nrl->equates_to_iname = iname; - if (id >= 0) nrls_indexed_by_id[id] = nrl; - Dictionaries::create(nrls_indexed_by_name, name); - Dictionaries::write_value(nrls_indexed_by_name, name, (void *) nrl); - return nrl; - } - - named_resource_location *HierarchyLocations::make_on_demand(int id, text_stream *name) { - named_resource_location *nrl = CREATE(named_resource_location); - nrl->access_number = id; - nrl->access_name = Str::duplicate(name); + nrl->access_number = -1; + nrl->access_name = NULL; nrl->function_package_name = NULL; nrl->datum_package_name = NULL; nrl->package = NULL; nrl->equates_to_iname = NULL; - if (id >= 0) nrls_indexed_by_id[id] = nrl; - Dictionaries::create(nrls_indexed_by_name, name); - Dictionaries::write_value(nrls_indexed_by_name, name, (void *) nrl); + nrl->exotic_package_identifier = -1; + return nrl; + } + + named_resource_location *HierarchyLocations::make_in(int id, text_stream *name, package_request *P) { + named_resource_location *nrl = HierarchyLocations::new(); + nrl->access_number = id; + nrl->access_name = Str::duplicate(name); + nrl->package = P; + HierarchyLocations::index(nrl); + return nrl; + } + + named_resource_location *HierarchyLocations::make_in_exotic(int id, text_stream *name, int x) { + named_resource_location *nrl = HierarchyLocations::new(); + nrl->access_number = id; + nrl->access_name = Str::duplicate(name); + nrl->exotic_package_identifier = x; + HierarchyLocations::index(nrl); + return nrl; + } + + named_resource_location *HierarchyLocations::make_as(int id, text_stream *name, inter_name *iname) { + named_resource_location *nrl = HierarchyLocations::new(); + nrl->access_number = id; + nrl->access_name = Str::duplicate(name); + nrl->package = iname->eventual_owner; + nrl->equates_to_iname = iname; + HierarchyLocations::index(nrl); return nrl; } @@ -73,12 +69,18 @@ nrl->access_number = id; nrl->access_name = Str::duplicate(call_name); nrl->function_package_name = Str::duplicate(name); - nrl->datum_package_name = NULL; nrl->package = P; - nrl->equates_to_iname = NULL; - if (id >= 0) nrls_indexed_by_id[id] = nrl; - Dictionaries::create(nrls_indexed_by_name, call_name); - Dictionaries::write_value(nrls_indexed_by_name, call_name, (void *) nrl); + HierarchyLocations::index(nrl); + return nrl; + } + + named_resource_location *HierarchyLocations::make_function_in_exotic(int id, text_stream *name, text_stream *call_name, int x) { + named_resource_location *nrl = CREATE(named_resource_location); + nrl->access_number = id; + nrl->access_name = Str::duplicate(call_name); + nrl->function_package_name = Str::duplicate(name); + nrl->exotic_package_identifier = x; + HierarchyLocations::index(nrl); return nrl; } @@ -86,16 +88,25 @@ named_resource_location *nrl = CREATE(named_resource_location); nrl->access_number = id; nrl->access_name = Str::duplicate(datum_name); - nrl->function_package_name = NULL; nrl->datum_package_name = Str::duplicate(name); nrl->package = P; - nrl->equates_to_iname = NULL; - if (id >= 0) nrls_indexed_by_id[id] = nrl; - Dictionaries::create(nrls_indexed_by_name, datum_name); - Dictionaries::write_value(nrls_indexed_by_name, datum_name, (void *) nrl); + HierarchyLocations::index(nrl); return nrl; } + named_resource_location *HierarchyLocations::make_datum_in_exotic(int id, text_stream *name, text_stream *datum_name, int x) { + named_resource_location *nrl = CREATE(named_resource_location); + nrl->access_number = id; + nrl->access_name = Str::duplicate(datum_name); + nrl->datum_package_name = Str::duplicate(name); + nrl->exotic_package_identifier = x; + HierarchyLocations::index(nrl); + return nrl; + } + + named_resource_location *nrls_indexed_by_id[MAX_HL]; + dictionary *nrls_indexed_by_name = NULL; + int nrls_created = FALSE; void HierarchyLocations::create_nrls(void) { nrls_created = TRUE; @@ -104,6 +115,13 @@ Hierarchy::establish(); } + void HierarchyLocations::index(named_resource_location *nrl) { + if (nrls_created == FALSE) HierarchyLocations::create_nrls(); + if (nrl->access_number >= 0) nrls_indexed_by_id[nrl->access_number] = nrl; + Dictionaries::create(nrls_indexed_by_name, nrl->access_name); + Dictionaries::write_value(nrls_indexed_by_name, nrl->access_name, (void *) nrl); + } + inter_name *HierarchyLocations::find(int id) { if (nrls_created == FALSE) HierarchyLocations::create_nrls(); if ((id < 0) || (id >= MAX_HL) || (nrls_indexed_by_id[id] == NULL)) @@ -129,100 +147,33 @@ inter_name *HierarchyLocations::nrl_to_iname(named_resource_location *nrl) { if (nrl->equates_to_iname == NULL) { + if (nrl->package == NULL) { + if (nrl->exotic_package_identifier >= 0) + nrl->package = Hierarchy::exotic_package(nrl->exotic_package_identifier); + else internal_error("package can't be found'"); + } + if (nrl->package == Packaging::request_template()) { packaging_state save = Packaging::enter(nrl->package); nrl->equates_to_iname = InterNames::one_off(nrl->access_name, Packaging::request_template()); nrl->equates_to_iname->symbol = Emit::extern(nrl->access_name, K_value); Packaging::exit(save); - return nrl->equates_to_iname; - } - if (Str::len(nrl->function_package_name) > 0) { + } else if (Str::len(nrl->function_package_name) > 0) { nrl->equates_to_iname = Packaging::function_text( InterNames::one_off(nrl->function_package_name, nrl->package), nrl->package, nrl->access_name); - nrl->package = Packaging::home_of(nrl->equates_to_iname); - } - if (Str::len(nrl->datum_package_name) > 0) { + } else if (Str::len(nrl->datum_package_name) > 0) { nrl->equates_to_iname = Packaging::datum_text( InterNames::one_off(nrl->datum_package_name, nrl->package), nrl->package, nrl->access_name); - nrl->package = Packaging::home_of(nrl->equates_to_iname); - } - if ((nrl->package) && (nrl->equates_to_iname == NULL)) + } else if ((nrl->package) && (nrl->equates_to_iname == NULL)) { nrl->equates_to_iname = InterNames::one_off(nrl->access_name, nrl->package); - switch (nrl->access_number) { - case THESAME_HL: - case PLURALFOUND_HL: - case PARENT_HL: - case CHILD_HL: - case SIBLING_HL: - case THEDARK_HL: - case FLOAT_NAN_HL: - case RESPONSETEXTS_HL: { - packaging_state save = Packaging::enter_home_of(nrl->equates_to_iname); - Emit::named_numeric_constant(nrl->equates_to_iname, 0); - Packaging::exit(save); - break; - } - case SELF_HL: { - packaging_state save = Packaging::enter_home_of(nrl->equates_to_iname); - Emit::variable(nrl->equates_to_iname, K_value, UNDEF_IVAL, 0, I"self"); - Packaging::exit(save); - break; - } + } - case NOTHING_HL: - nrl->package = Kinds::Behaviour::package(K_object); - break; - case OBJECT_HL: - nrl->equates_to_iname = Kinds::RunTime::I6_classname(K_object); - break; - case TESTUSEOPTION_HL: - nrl->equates_to_iname = HierarchyLocations::function( - Kinds::RunTime::package(K_use_option), I"test_fn", nrl->access_name); - break; - case TABLEOFTABLES_HL: - nrl->package = Kinds::Behaviour::package(K_table); - break; - case TABLEOFVERBS_HL: - nrl->package = Kinds::Behaviour::package(K_verb); - break; - case CAPSHORTNAME_HL: - nrl->package = Kinds::Behaviour::package(K_object); - break; - case RESOURCEIDSOFFIGURES_HL: - nrl->package = Kinds::Behaviour::package(K_figure_name); - break; - case RESOURCEIDSOFSOUNDS_HL: - nrl->package = Kinds::Behaviour::package(K_sound_name); - break; - case NO_USE_OPTIONS_HL: - nrl->package = Kinds::Behaviour::package(K_use_option); - break; - case DECIMAL_TOKEN_INNER_HL: - nrl->equates_to_iname = HierarchyLocations::function( - Kinds::RunTime::package(K_number), I"gpr_fn", nrl->access_name); - break; - case TIME_TOKEN_INNER_HL: - nrl->equates_to_iname = HierarchyLocations::function( - Kinds::RunTime::package(K_time), I"gpr_fn", nrl->access_name); - break; - case TRUTH_STATE_TOKEN_INNER_HL: - nrl->equates_to_iname = HierarchyLocations::function( - Kinds::RunTime::package(K_truth_state), I"gpr_fn", nrl->access_name); - break; - case COMMANDPROMPTTEXT_HL: - nrl->equates_to_iname = HierarchyLocations::function( - Packaging::home_of(NonlocalVariables::iname(command_prompt_VAR)), - I"command_prompt_text_fn", nrl->access_name); - break; - } - if (nrl->equates_to_iname == NULL) - nrl->equates_to_iname = InterNames::one_off(nrl->access_name, nrl->package); - if (nrl->package == NULL) - nrl->package = Packaging::home_of(nrl->equates_to_iname); + nrl->equates_to_iname = Hierarchy::post_process(nrl->access_number, nrl->equates_to_iname); + nrl->package = Packaging::home_of(nrl->equates_to_iname); } return nrl->equates_to_iname; } @@ -230,21 +181,29 @@

-

The function HierarchyLocations::make_in is used in 27/hr (§2.2, §2.4, §2.6, §2.8, §2.10, §2.12, §2.14, §2.16, §2.18, §2.20, §2.21, §2.23, §2.25, §2.29, §2.31, §2.33, §2.35, §2.37, §2.43, §4).

+

The function HierarchyLocations::new appears nowhere else.

-

The function HierarchyLocations::make_as is used in 27/hr (§4).

+

The function HierarchyLocations::make_in is used in 27/hr (§2.2, §2.4, §2.6, §2.8, §2.10, §2.12, §2.14, §2.16, §2.18, §2.20, §2.21, §2.23, §2.25, §2.29, §2.31, §2.33, §2.35, §2.37, §2.43, §6).

-

The function HierarchyLocations::make_on_demand is used in 27/hr (§2.41).

+

The function HierarchyLocations::make_in_exotic is used in 27/hr (§2.41).

+ +

The function HierarchyLocations::make_as is used in 27/hr (§6).

The function HierarchyLocations::make_function is used in 27/hr (§2.10, §2.14, §2.18, §2.21, §2.25, §2.27, §2.29, §2.31, §2.33, §2.35, §2.39).

+

The function HierarchyLocations::make_function_in_exotic is used in 27/hr (§2.41).

+

The function HierarchyLocations::make_datum is used in 27/hr (§2.37).

+

The function HierarchyLocations::make_datum_in_exotic appears nowhere else.

+

The function HierarchyLocations::create_nrls appears nowhere else.

-

The function HierarchyLocations::find is used in 27/hr (§4).

+

The function HierarchyLocations::index appears nowhere else.

-

The function HierarchyLocations::find_by_name is used in 27/hr (§4).

+

The function HierarchyLocations::find is used in 27/hr (§6).

+ +

The function HierarchyLocations::find_by_name is used in 27/hr (§6).

The function HierarchyLocations::function appears nowhere else.

diff --git a/docs/core-module/27-hr.html b/docs/core-module/27-hr.html index 039f0d867..9e7119a08 100644 --- a/docs/core-module/27-hr.html +++ b/docs/core-module/27-hr.html @@ -740,6 +740,16 @@
+    enum K_OBJECT_XPACKAGE from 0
+    enum K_NUMBER_XPACKAGE
+    enum K_TIME_XPACKAGE
+    enum K_TRUTH_STATE_XPACKAGE
+    enum K_TABLE_XPACKAGE
+    enum K_VERB_XPACKAGE
+    enum K_FIGURE_NAME_XPACKAGE
+    enum K_SOUND_NAME_XPACKAGE
+    enum K_USE_OPTION_XPACKAGE
+    enum V_COMMAND_PROMPT_XPACKAGE
     enum NOTHING_HL
     enum OBJECT_HL
     enum TESTUSEOPTION_HL
@@ -760,19 +770,28 @@
 
 
 
-        HierarchyLocations::make_on_demand(OBJECT_HL, I"Object");
-        HierarchyLocations::make_on_demand(NOTHING_HL, I"nothing");
-        HierarchyLocations::make_on_demand(TESTUSEOPTION_HL, I"TestUseOption");
-        HierarchyLocations::make_on_demand(TABLEOFTABLES_HL, I"TableOfTables");
-        HierarchyLocations::make_on_demand(TABLEOFVERBS_HL, I"TableOfVerbs");
-        HierarchyLocations::make_on_demand(CAPSHORTNAME_HL, I"cap_short_name");
-        HierarchyLocations::make_on_demand(COMMANDPROMPTTEXT_HL, I"CommandPromptText");
-        HierarchyLocations::make_on_demand(DECIMAL_TOKEN_INNER_HL, I"DECIMAL_TOKEN_INNER");
-        HierarchyLocations::make_on_demand(NO_USE_OPTIONS_HL, I"NO_USE_OPTIONS");
-        HierarchyLocations::make_on_demand(RESOURCEIDSOFFIGURES_HL, I"ResourceIDsOfFigures");
-        HierarchyLocations::make_on_demand(RESOURCEIDSOFSOUNDS_HL, I"ResourceIDsOfSounds");
-        HierarchyLocations::make_on_demand(TIME_TOKEN_INNER_HL, I"TIME_TOKEN_INNER");
-        HierarchyLocations::make_on_demand(TRUTH_STATE_TOKEN_INNER_HL, I"TRUTH_STATE_TOKEN_INNER");
+        HierarchyLocations::make_in_exotic(OBJECT_HL, I"Object", K_OBJECT_XPACKAGE);
+        HierarchyLocations::make_in_exotic(NOTHING_HL, I"nothing", K_OBJECT_XPACKAGE);
+        HierarchyLocations::make_in_exotic(CAPSHORTNAME_HL, I"cap_short_name", K_OBJECT_XPACKAGE);
+
+        HierarchyLocations::make_function_in_exotic(DECIMAL_TOKEN_INNER_HL, I"gpr_fn", I"DECIMAL_TOKEN_INNER", K_NUMBER_XPACKAGE);
+
+        HierarchyLocations::make_function_in_exotic(TIME_TOKEN_INNER_HL, I"gpr_fn", I"TIME_TOKEN_INNER", K_TIME_XPACKAGE);
+
+        HierarchyLocations::make_function_in_exotic(TRUTH_STATE_TOKEN_INNER_HL, I"gpr_fn", I"TRUTH_STATE_TOKEN_INNER", K_TRUTH_STATE_XPACKAGE);
+
+        HierarchyLocations::make_in_exotic(TABLEOFTABLES_HL, I"TableOfTables", K_TABLE_XPACKAGE);
+
+        HierarchyLocations::make_in_exotic(TABLEOFVERBS_HL, I"TableOfVerbs", K_VERB_XPACKAGE);
+
+        HierarchyLocations::make_in_exotic(RESOURCEIDSOFFIGURES_HL, I"ResourceIDsOfFigures", K_FIGURE_NAME_XPACKAGE);
+
+        HierarchyLocations::make_in_exotic(RESOURCEIDSOFSOUNDS_HL, I"ResourceIDsOfSounds", K_SOUND_NAME_XPACKAGE);
+
+        HierarchyLocations::make_in_exotic(NO_USE_OPTIONS_HL, I"NO_USE_OPTIONS", K_USE_OPTION_XPACKAGE);
+        HierarchyLocations::make_function_in_exotic(TESTUSEOPTION_HL, I"test_fn", I"TestUseOption", K_USE_OPTION_XPACKAGE);
+
+        HierarchyLocations::make_function_in_exotic(COMMANDPROMPTTEXT_HL, I"command_prompt_text_fn", I"CommandPromptText", V_COMMAND_PROMPT_XPACKAGE);
 

@@ -1272,6 +1291,70 @@

§4.

+
+    package_request *Hierarchy::exotic_package(int x) {
+        switch (x) {
+            case K_OBJECT_XPACKAGE: return Kinds::Behaviour::package(K_object);
+            case K_NUMBER_XPACKAGE: return Kinds::Behaviour::package(K_number);
+            case K_TIME_XPACKAGE: return Kinds::Behaviour::package(K_time);
+            case K_TRUTH_STATE_XPACKAGE: return Kinds::Behaviour::package(K_truth_state);
+            case K_TABLE_XPACKAGE: return Kinds::Behaviour::package(K_table);
+            case K_VERB_XPACKAGE: return Kinds::Behaviour::package(K_verb);
+            case K_FIGURE_NAME_XPACKAGE: return Kinds::Behaviour::package(K_figure_name);
+            case K_SOUND_NAME_XPACKAGE: return Kinds::Behaviour::package(K_sound_name);
+            case K_USE_OPTION_XPACKAGE: return Kinds::Behaviour::package(K_use_option);
+            case V_COMMAND_PROMPT_XPACKAGE:
+                return Packaging::home_of(NonlocalVariables::iname(command_prompt_VAR));
+        }
+        internal_error("unknown exotic package");
+        return NULL;
+    }
+
+ +

+ +

The function Hierarchy::exotic_package is used in 27/hl (§1).

+ +

§5.

+ + +
+    inter_name *Hierarchy::post_process(int HL_id, inter_name *iname) {
+        switch (HL_id) {
+            case THESAME_HL:
+            case PLURALFOUND_HL:
+            case PARENT_HL:
+            case CHILD_HL:
+            case SIBLING_HL:
+            case THEDARK_HL:
+            case FLOAT_NAN_HL:
+            case RESPONSETEXTS_HL: {
+                packaging_state save = Packaging::enter_home_of(iname);
+                Emit::named_numeric_constant(iname, 0);
+                Packaging::exit(save);
+                break;
+            }
+            case SELF_HL: {
+                packaging_state save = Packaging::enter_home_of(iname);
+                Emit::variable(iname, K_value, UNDEF_IVAL, 0, I"self");
+                Packaging::exit(save);
+                break;
+            }
+            case OBJECT_HL:
+                iname = Kinds::RunTime::I6_classname(K_object);
+                break;
+        }
+        return iname;
+    }
+
+ +

+ +

The function Hierarchy::post_process is used in 27/hl (§1).

+ +

§6.

+ +
     inter_name *Hierarchy::find(int id) {
         return HierarchyLocations::find(id);
diff --git a/docs/core-module/27-in.html b/docs/core-module/27-in.html
index bb7c1b499..56a5a638b 100644
--- a/docs/core-module/27-in.html
+++ b/docs/core-module/27-in.html
@@ -328,9 +328,9 @@
 
 

The function InterNames::one_off is used in 5/un (§1), 6/bp (§32), 6/rlt (§9, §9.13, §20, §20.3), 12/cdp (§5), 13/rsfk (§13.1.1, §15), 15/pr (§27), 15/ma (§11.3), 17/tl (§14.2), 17/rs (§5, §6.1), 19/tc (§9), 19/tb (§9), 20/eq (§10.1), 21/rl (§9, §19), 21/rl2 (§10, §14), 21/fao (§10), 21/ac (§8), 22/ph (§11), 22/pu (§6), 22/pav (§7, §9), 22/tp (§7), 24/ch (§3), 26/lt (§3), 26/jl (§3), 26/rt (§4), 26/ts (§9.1), 27/cm (§2), 27/pc (§7, §7.1, §8), 27/hl (§1).

-

The function InterNames::attach_memo is used in §3, 5/un (§1), 5/nv (§16), 13/rsfk (§13.1.1), 15/pr (§27), 15/ep (§4), 15/vp (§3), 19/tb (§20), 21/rl2 (§10), 21/fao (§10), 21/ac (§6).

+

The function InterNames::attach_memo is used in §3, 5/un (§1), 5/nv (§16), 13/rsfk (§13.1.1), 15/pr (§27), 15/ep (§4), 15/vp (§3), 19/tb (§20), 21/fao (§10), 21/ac (§6).

-

The function InterNames::to_symbol is used in §4, 4/am (§6, §43), 5/lp (§19, §19.3.1, §19.3.1.1, §19.3.2, §19.2.1), 5/un (§1), 5/ins (§14), 5/nv (§12), 6/bp (§32, §33), 6/rlt (§9, §9.13, §15, §15.1.2, §15.1.3, §15.2.1, §15.2.5.1, §15.2.6, §15.2.10, §15.2.11, §15.2.12, §15.2.9.1, §15.2.10.1, §15.2.12.1, §20, §20.3, §29.5, §29.6), 6/nv (§17, §18, §18.2), 12/dtd (§4, §7.1.2, §11, §17, §27), 12/cdp (§2.1.6.1.8, §2.1.6.1.2.2.3, §2.1.6.1.9, §5), 13/ca (§1, §1.2, §1.3, §1.4, §1.5, §1.6, §1.7, §1.8, §1.9, §1.11, §1.12), 13/rsfk (§5, §7, §9, §12, §13.1.1, §15, §19, §20, §26.6.1, §26.6.2, §26.6.3, §26.6.4, §26.6.5, §26.6.6), 14/lv (§14.3, §14.4, §14.5), 14/cfs (§7), 15/pr (§21, §22.1, §27), 15/ma (§11.3), 16/ic (§10), 17/tl (§7, §10.2.1, §13, §14.2), 17/ts (§5, §7, §8), 17/rs (§5, §6.1, §6.2, §7.2), 18/lc (§11), 19/tc (§8, §9), 19/tb (§9, §20), 20/eq (§10.1, §48), 21/rl (§9, §11.2, §22, §22.1), 21/rb (§24.1.3.1), 21/rl2 (§10, §14), 21/fao (§10), 21/sv (§3.2), 21/ac (§6, §8, §14), 22/prcd (§10, §10.1.1.1), 22/pav (§7, §9, §9.2), 24/lv (§41), 24/ch (§4), 25/ci (§3.2.3.6), 25/ciac (§2), 25/cii (§3.1.1.4.7.1, §3.1.1.4.9, §3.1.1.4.10, §3.5.3, §3.5.8, §3.5.8.1), 25/cp (§6), 26/vm (§8), 26/lt (§3), 26/jl (§3), 26/rt (§4, §4.1.2, §4.1.3, §4.1.4), 26/iti (§9), 26/ts (§9.1, §10, §12), 27/is (§32), 27/ei (§3, §4, §5), 27/pc (§8), 27/hl (§1), 27/hr (§4).

+

The function InterNames::to_symbol is used in §4, 4/am (§6, §43), 5/lp (§19, §19.3.1, §19.3.1.1, §19.3.2, §19.2.1), 5/un (§1), 5/ins (§14), 5/nv (§12), 6/bp (§32, §33), 6/rlt (§9, §9.13, §15, §15.1.2, §15.1.3, §15.2.1, §15.2.5.1, §15.2.6, §15.2.10, §15.2.11, §15.2.12, §15.2.9.1, §15.2.10.1, §15.2.12.1, §20, §20.3, §29.5, §29.6), 6/nv (§17, §18, §18.2), 12/dtd (§4, §7.1.2, §11, §17, §27), 12/cdp (§2.1.6.1.8, §2.1.6.1.2.2.3, §2.1.6.1.9, §5), 13/ca (§1, §1.2, §1.3, §1.4, §1.5, §1.6, §1.7, §1.8, §1.9, §1.11, §1.12), 13/rsfk (§5, §7, §9, §12, §13.1.1, §15, §19, §20, §26.6.1, §26.6.2, §26.6.3, §26.6.4, §26.6.5, §26.6.6), 14/lv (§14.3, §14.4, §14.5), 14/cfs (§7), 15/pr (§21, §22.1, §27), 15/ma (§11.3), 16/ic (§10), 17/tl (§7, §10.2.1, §13, §14.2), 17/ts (§5, §7, §8), 17/rs (§5, §6.1, §6.2, §7.2), 18/lc (§11), 19/tc (§8, §9), 19/tb (§9, §20), 20/eq (§10.1, §48), 21/rl (§9, §11.2, §22, §22.1), 21/rb (§24.1.3.1), 21/rl2 (§10, §14), 21/fao (§10), 21/sv (§3.2), 21/ac (§6, §8, §14), 22/prcd (§10, §10.1.1.1), 22/pav (§7, §9, §9.2), 24/lv (§41), 24/ch (§4), 25/ci (§3.2.3.6), 25/ciac (§2), 25/cii (§3.1.1.4.7.1, §3.1.1.4.9, §3.1.1.4.10, §3.5.3, §3.5.8, §3.5.8.1), 25/cp (§6), 26/vm (§8), 26/lt (§3), 26/jl (§3), 26/rt (§4, §4.1.2, §4.1.3, §4.1.4), 26/iti (§9), 26/ts (§9.1, §10, §12), 27/is (§32), 27/ei (§3, §4, §5), 27/pc (§8), 27/hl (§1), 27/hr (§6).

The function InterNames::to_text is used in 15/vp (§3).

@@ -570,9 +570,9 @@

-

The function InterNames::new is used in §4, 5/nv (§16), 6/bp (§42), 13/rsfk (§13.1.1), 15/ma (§11.3), 17/tl (§14.2), 21/rl (§19), 21/rl2 (§10), 21/ac (§6), 22/ph (§11), 24/ch (§3), 26/lt (§3).

+

The function InterNames::new is used in §4, 5/nv (§16), 6/bp (§42), 13/rsfk (§13.1.1), 15/ma (§11.3), 17/tl (§14.2), 21/rl (§19), 21/ac (§6), 22/ph (§11), 24/ch (§3), 26/lt (§3).

-

The function InterNames::new_in is used in 17/ts (§5), 22/pu (§6), 22/tp (§7), 26/rt (§4), 27/ei (§4).

+

The function InterNames::new_in is used in 22/pu (§6), 22/tp (§7), 26/rt (§4), 27/ei (§4).

The function InterNames::mark appears nowhere else.

@@ -584,7 +584,7 @@

The function InterNames::new_overridden appears nowhere else.

-

The function InterNames::new_derived is used in 17/ts (§5).

+

The function InterNames::new_derived appears nowhere else.

The function InterNames::icount_name is used in 13/rsfk (§26).

diff --git a/docs/core-module/27-pc.html b/docs/core-module/27-pc.html index 6f9d30447..3c8de6ef3 100644 --- a/docs/core-module/27-pc.html +++ b/docs/core-module/27-pc.html @@ -246,9 +246,9 @@

The function Packaging::stateless is used in 15/epv (§2).

-

The function Packaging::home_of is used in 12/cdp (§5), 27/hl (§1).

+

The function Packaging::home_of is used in 12/cdp (§5), 27/hl (§1), 27/hr (§4).

-

The function Packaging::enter_home_of is used in 6/bp (§42), 6/rlt (§14, §15.1, §20, §20.3), 6/nv (§18), 12/cdp (§2.1.1), 13/kak (§5), 13/rsfk (§16.2, §26), 15/pr (§27), 15/epv (§1.1.2), 17/tl (§14.1, §14.2), 17/ts (§11), 17/rs (§7.3), 18/lc (§12.1), 19/rsft (§1.1.1.1, §1.1.1.1.1, §1.2, §1.3), 21/rl2 (§14, §20), 21/fao (§10), 21/ac (§6, §8, §14), 22/cs (§8), 22/pav (§8.1), 22/tp2 (§4), 24/ch (§6, §8), 26/vm (§8), 26/uo (§21), 26/lt (§4.1), 26/jl (§6), 26/rt (§1), 26/iti (§10), 26/pl (§12), 26/ts (§10), 27/ei (§4), 27/hl (§1).

+

The function Packaging::enter_home_of is used in 6/bp (§42), 6/rlt (§14, §15.1, §20, §20.3), 6/nv (§18), 12/cdp (§2.1.1), 13/kak (§5), 13/rsfk (§16.2, §26), 15/pr (§27), 15/epv (§1.1.2), 17/tl (§14.1, §14.2), 17/ts (§11), 17/rs (§7.3), 18/lc (§12.1), 19/rsft (§1.1.1.1, §1.1.1.1.1, §1.2, §1.3), 21/rl2 (§14, §20), 21/fao (§10), 21/ac (§6, §8, §14), 22/cs (§8), 22/pav (§8.1), 22/tp2 (§4), 24/ch (§6, §8), 26/vm (§8), 26/uo (§21), 26/lt (§4.1), 26/jl (§6), 26/rt (§1), 26/iti (§10), 26/pl (§12), 26/ts (§10), 27/ei (§4), 27/hr (§5).

The function Packaging::enter_current_enclosure is used in 13/rsfk (§4), 17/tl (§16), 17/ts (§8.1), 18/lc (§11).

@@ -343,7 +343,7 @@

The function Packaging::enter is used in §5, 4/am (§34.2), 5/ins (§34), 5/nv (§16), 13/rsfk (§16.1, §26), 15/epv (§2), 16/ic (§10), 17/rs (§6.1, §7.1), 21/rl (§9), 21/rl2 (§20), 22/ph (§12), 27/ei (§3, §4), 27/hl (§1).

-

The function Packaging::exit is used in 5/ins (§34), 5/nv (§16), 6/bp (§42), 6/rlt (§14, §15.1, §20, §20.3), 6/nv (§18), 12/cdp (§2.1.1), 13/kak (§5), 13/rsfk (§4, §16.1, §16.2, §26), 15/pr (§27), 15/epv (§1.1.2, §2), 16/ic (§10), 17/tl (§14.1, §14.2, §16), 17/ts (§8.1, §11), 17/rs (§6.1, §7.1, §7.3), 18/lc (§11, §12.1), 19/rsft (§1.1.1.1, §1.1.1.1.1, §1.2, §1.3), 21/rl (§9), 21/rl2 (§14, §20), 21/fao (§10), 21/ac (§6, §8, §14), 22/cs (§8), 22/ph (§12), 22/pav (§8.1), 22/tp2 (§4), 24/ch (§6, §8), 26/vm (§8), 26/uo (§21), 26/lt (§4.1), 26/jl (§6), 26/rt (§4), 26/iti (§10), 26/pl (§12), 26/ts (§10), 27/ei (§3, §4), 27/hl (§1).

+

The function Packaging::exit is used in 5/ins (§34), 5/nv (§16), 6/bp (§42), 6/rlt (§14, §15.1, §20, §20.3), 6/nv (§18), 12/cdp (§2.1.1), 13/kak (§5), 13/rsfk (§4, §16.1, §16.2, §26), 15/pr (§27), 15/epv (§1.1.2, §2), 16/ic (§10), 17/tl (§14.1, §14.2, §16), 17/ts (§8.1, §11), 17/rs (§6.1, §7.1, §7.3), 18/lc (§11, §12.1), 19/rsft (§1.1.1.1, §1.1.1.1.1, §1.2, §1.3), 21/rl (§9), 21/rl2 (§14, §20), 21/fao (§10), 21/ac (§6, §8, §14), 22/cs (§8), 22/ph (§12), 22/pav (§8.1), 22/tp2 (§4), 24/ch (§6, §8), 26/vm (§8), 26/uo (§21), 26/lt (§4.1), 26/jl (§6), 26/rt (§4), 26/iti (§10), 26/pl (§12), 26/ts (§10), 27/ei (§3, §4), 27/hl (§1), 27/hr (§5).

The function Packaging::incarnate is used in 21/rl (§9), 27/ei (§3).

@@ -459,7 +459,7 @@

The function Packaging::request_generic appears nowhere else.

-

The function Packaging::request_template is used in 15/ep (§4), 27/ei (§3), 27/hl (§1), 27/hr (§2.43, §4).

+

The function Packaging::request_template is used in 15/ep (§4), 27/ei (§3), 27/hl (§1), 27/hr (§2.43, §6).

The function Packaging::request_synoptic appears nowhere else.

diff --git a/docs/core-module/5-nv.html b/docs/core-module/5-nv.html index b5b9f3f9b..c15898341 100644 --- a/docs/core-module/5-nv.html +++ b/docs/core-module/5-nv.html @@ -631,7 +631,7 @@ there's very little to say.

-

The function NonlocalVariables::iname is used in §12, 26/rt (§4.1.2, §4.1.4), 26/iti (§9), 27/hl (§1).

+

The function NonlocalVariables::iname is used in §12, 26/rt (§4.1.2, §4.1.4), 26/iti (§9), 27/hr (§4).

The function NonlocalVariables::SUBJ_compile_all is used in 16/is (§30).

diff --git a/inform7/core-module/Chapter 17/Text Substitutions.w b/inform7/core-module/Chapter 17/Text Substitutions.w index 54064c522..813358f10 100644 --- a/inform7/core-module/Chapter 17/Text Substitutions.w +++ b/inform7/core-module/Chapter 17/Text Substitutions.w @@ -81,10 +81,8 @@ text_substitution *Strings::TextSubstitutions::new_text_substitution(wording W, (LocalVariables::count(Frames::current_stack_frame()) > 0)) ts->local_names_existed_at_usage_time = TRUE; ts->ts_iname = Packaging::supply_iname(P, SUBSTITUTION_PR_COUNTER); - // InterNames::new_in(TEXT_SUBSTITUTION_INAMEF, Modules::current()); ts->ts_routine_iname = Packaging::function(Packaging::supply_iname(P, SUBSTITUTIONF_PR_COUNTER), P, NULL); - // InterNames::new_derived(TEXT_ROUTINE_INAMEF, ts->ts_iname); ts->belongs_to_module = Modules::current(); Inter::Symbols::set_flag(InterNames::to_symbol(ts->ts_iname), MAKE_NAME_UNIQUE); Inter::Symbols::set_flag(InterNames::to_symbol(ts->ts_routine_iname), MAKE_NAME_UNIQUE); diff --git a/inform7/core-module/Chapter 21/Rulebooks.w b/inform7/core-module/Chapter 21/Rulebooks.w index 984470862..218f5c596 100644 --- a/inform7/core-module/Chapter 21/Rulebooks.w +++ b/inform7/core-module/Chapter 21/Rulebooks.w @@ -219,9 +219,7 @@ rulebook *Rulebooks::new(kind *create_as, wording W, package_request *R, text_st else package_name = InterNames::one_off(supplied, R); rb->rb_package = Packaging::request(package_name, R, rulebook_ptype); rb->rb_iname = Packaging::function(InterNames::one_off(I"run_fn", rb->rb_package), rb->rb_package, NULL); - // InterNames::attach_memo(rb->rb_iname, rb->primary_name); Inter::Symbols::set_flag(InterNames::to_symbol(rb->rb_iname), MAKE_NAME_UNIQUE); - // InterNames::new(RULEBOOK_INAMEF); rb->rule_list = Rules::Bookings::list_new(); diff --git a/inform7/core-module/Chapter 27/Hierarchy Locations.w b/inform7/core-module/Chapter 27/Hierarchy Locations.w index caef0c834..aec90be67 100644 --- a/inform7/core-module/Chapter 27/Hierarchy Locations.w +++ b/inform7/core-module/Chapter 27/Hierarchy Locations.w @@ -9,52 +9,48 @@ typedef struct named_resource_location { struct text_stream *function_package_name; struct text_stream *datum_package_name; struct package_request *package; + int exotic_package_identifier; struct inter_name *equates_to_iname; MEMORY_MANAGEMENT } named_resource_location; -named_resource_location *nrls_indexed_by_id[MAX_HL]; -dictionary *nrls_indexed_by_name = NULL; - -named_resource_location *HierarchyLocations::make_in(int id, text_stream *name, package_request *P) { +named_resource_location *HierarchyLocations::new(void) { named_resource_location *nrl = CREATE(named_resource_location); - nrl->access_number = id; - nrl->access_name = Str::duplicate(name); - nrl->function_package_name = NULL; - nrl->datum_package_name = NULL; - nrl->package = P; - nrl->equates_to_iname = NULL; - if (id >= 0) nrls_indexed_by_id[id] = nrl; - Dictionaries::create(nrls_indexed_by_name, name); - Dictionaries::write_value(nrls_indexed_by_name, name, (void *) nrl); - return nrl; -} - -named_resource_location *HierarchyLocations::make_as(int id, text_stream *name, inter_name *iname) { - named_resource_location *nrl = CREATE(named_resource_location); - nrl->access_number = id; - nrl->access_name = Str::duplicate(name); - nrl->function_package_name = NULL; - nrl->datum_package_name = NULL; - nrl->package = iname->eventual_owner; - nrl->equates_to_iname = iname; - if (id >= 0) nrls_indexed_by_id[id] = nrl; - Dictionaries::create(nrls_indexed_by_name, name); - Dictionaries::write_value(nrls_indexed_by_name, name, (void *) nrl); - return nrl; -} - -named_resource_location *HierarchyLocations::make_on_demand(int id, text_stream *name) { - named_resource_location *nrl = CREATE(named_resource_location); - nrl->access_number = id; - nrl->access_name = Str::duplicate(name); + nrl->access_number = -1; + nrl->access_name = NULL; nrl->function_package_name = NULL; nrl->datum_package_name = NULL; nrl->package = NULL; nrl->equates_to_iname = NULL; - if (id >= 0) nrls_indexed_by_id[id] = nrl; - Dictionaries::create(nrls_indexed_by_name, name); - Dictionaries::write_value(nrls_indexed_by_name, name, (void *) nrl); + nrl->exotic_package_identifier = -1; + return nrl; +} + +named_resource_location *HierarchyLocations::make_in(int id, text_stream *name, package_request *P) { + named_resource_location *nrl = HierarchyLocations::new(); + nrl->access_number = id; + nrl->access_name = Str::duplicate(name); + nrl->package = P; + HierarchyLocations::index(nrl); + return nrl; +} + +named_resource_location *HierarchyLocations::make_in_exotic(int id, text_stream *name, int x) { + named_resource_location *nrl = HierarchyLocations::new(); + nrl->access_number = id; + nrl->access_name = Str::duplicate(name); + nrl->exotic_package_identifier = x; + HierarchyLocations::index(nrl); + return nrl; +} + +named_resource_location *HierarchyLocations::make_as(int id, text_stream *name, inter_name *iname) { + named_resource_location *nrl = HierarchyLocations::new(); + nrl->access_number = id; + nrl->access_name = Str::duplicate(name); + nrl->package = iname->eventual_owner; + nrl->equates_to_iname = iname; + HierarchyLocations::index(nrl); return nrl; } @@ -63,12 +59,18 @@ named_resource_location *HierarchyLocations::make_function(int id, text_stream * nrl->access_number = id; nrl->access_name = Str::duplicate(call_name); nrl->function_package_name = Str::duplicate(name); - nrl->datum_package_name = NULL; nrl->package = P; - nrl->equates_to_iname = NULL; - if (id >= 0) nrls_indexed_by_id[id] = nrl; - Dictionaries::create(nrls_indexed_by_name, call_name); - Dictionaries::write_value(nrls_indexed_by_name, call_name, (void *) nrl); + HierarchyLocations::index(nrl); + return nrl; +} + +named_resource_location *HierarchyLocations::make_function_in_exotic(int id, text_stream *name, text_stream *call_name, int x) { + named_resource_location *nrl = CREATE(named_resource_location); + nrl->access_number = id; + nrl->access_name = Str::duplicate(call_name); + nrl->function_package_name = Str::duplicate(name); + nrl->exotic_package_identifier = x; + HierarchyLocations::index(nrl); return nrl; } @@ -76,16 +78,25 @@ named_resource_location *HierarchyLocations::make_datum(int id, text_stream *nam named_resource_location *nrl = CREATE(named_resource_location); nrl->access_number = id; nrl->access_name = Str::duplicate(datum_name); - nrl->function_package_name = NULL; nrl->datum_package_name = Str::duplicate(name); nrl->package = P; - nrl->equates_to_iname = NULL; - if (id >= 0) nrls_indexed_by_id[id] = nrl; - Dictionaries::create(nrls_indexed_by_name, datum_name); - Dictionaries::write_value(nrls_indexed_by_name, datum_name, (void *) nrl); + HierarchyLocations::index(nrl); return nrl; } +named_resource_location *HierarchyLocations::make_datum_in_exotic(int id, text_stream *name, text_stream *datum_name, int x) { + named_resource_location *nrl = CREATE(named_resource_location); + nrl->access_number = id; + nrl->access_name = Str::duplicate(datum_name); + nrl->datum_package_name = Str::duplicate(name); + nrl->exotic_package_identifier = x; + HierarchyLocations::index(nrl); + return nrl; +} + +named_resource_location *nrls_indexed_by_id[MAX_HL]; +dictionary *nrls_indexed_by_name = NULL; + int nrls_created = FALSE; void HierarchyLocations::create_nrls(void) { nrls_created = TRUE; @@ -94,6 +105,13 @@ void HierarchyLocations::create_nrls(void) { Hierarchy::establish(); } +void HierarchyLocations::index(named_resource_location *nrl) { + if (nrls_created == FALSE) HierarchyLocations::create_nrls(); + if (nrl->access_number >= 0) nrls_indexed_by_id[nrl->access_number] = nrl; + Dictionaries::create(nrls_indexed_by_name, nrl->access_name); + Dictionaries::write_value(nrls_indexed_by_name, nrl->access_name, (void *) nrl); +} + inter_name *HierarchyLocations::find(int id) { if (nrls_created == FALSE) HierarchyLocations::create_nrls(); if ((id < 0) || (id >= MAX_HL) || (nrls_indexed_by_id[id] == NULL)) @@ -119,100 +137,33 @@ inter_name *HierarchyLocations::function(package_request *R, text_stream *name, inter_name *HierarchyLocations::nrl_to_iname(named_resource_location *nrl) { if (nrl->equates_to_iname == NULL) { + if (nrl->package == NULL) { + if (nrl->exotic_package_identifier >= 0) + nrl->package = Hierarchy::exotic_package(nrl->exotic_package_identifier); + else internal_error("package can't be found'"); + } + if (nrl->package == Packaging::request_template()) { packaging_state save = Packaging::enter(nrl->package); nrl->equates_to_iname = InterNames::one_off(nrl->access_name, Packaging::request_template()); nrl->equates_to_iname->symbol = Emit::extern(nrl->access_name, K_value); Packaging::exit(save); - return nrl->equates_to_iname; - } - if (Str::len(nrl->function_package_name) > 0) { + } else if (Str::len(nrl->function_package_name) > 0) { nrl->equates_to_iname = Packaging::function_text( InterNames::one_off(nrl->function_package_name, nrl->package), nrl->package, nrl->access_name); - nrl->package = Packaging::home_of(nrl->equates_to_iname); - } - if (Str::len(nrl->datum_package_name) > 0) { + } else if (Str::len(nrl->datum_package_name) > 0) { nrl->equates_to_iname = Packaging::datum_text( InterNames::one_off(nrl->datum_package_name, nrl->package), nrl->package, nrl->access_name); - nrl->package = Packaging::home_of(nrl->equates_to_iname); - } - if ((nrl->package) && (nrl->equates_to_iname == NULL)) + } else if ((nrl->package) && (nrl->equates_to_iname == NULL)) { nrl->equates_to_iname = InterNames::one_off(nrl->access_name, nrl->package); - switch (nrl->access_number) { - case THESAME_HL: - case PLURALFOUND_HL: - case PARENT_HL: - case CHILD_HL: - case SIBLING_HL: - case THEDARK_HL: - case FLOAT_NAN_HL: - case RESPONSETEXTS_HL: { - packaging_state save = Packaging::enter_home_of(nrl->equates_to_iname); - Emit::named_numeric_constant(nrl->equates_to_iname, 0); - Packaging::exit(save); - break; - } - case SELF_HL: { - packaging_state save = Packaging::enter_home_of(nrl->equates_to_iname); - Emit::variable(nrl->equates_to_iname, K_value, UNDEF_IVAL, 0, I"self"); - Packaging::exit(save); - break; - } - - case NOTHING_HL: - nrl->package = Kinds::Behaviour::package(K_object); - break; - case OBJECT_HL: - nrl->equates_to_iname = Kinds::RunTime::I6_classname(K_object); - break; - case TESTUSEOPTION_HL: - nrl->equates_to_iname = HierarchyLocations::function( - Kinds::RunTime::package(K_use_option), I"test_fn", nrl->access_name); - break; - case TABLEOFTABLES_HL: - nrl->package = Kinds::Behaviour::package(K_table); - break; - case TABLEOFVERBS_HL: - nrl->package = Kinds::Behaviour::package(K_verb); - break; - case CAPSHORTNAME_HL: - nrl->package = Kinds::Behaviour::package(K_object); - break; - case RESOURCEIDSOFFIGURES_HL: - nrl->package = Kinds::Behaviour::package(K_figure_name); - break; - case RESOURCEIDSOFSOUNDS_HL: - nrl->package = Kinds::Behaviour::package(K_sound_name); - break; - case NO_USE_OPTIONS_HL: - nrl->package = Kinds::Behaviour::package(K_use_option); - break; - case DECIMAL_TOKEN_INNER_HL: - nrl->equates_to_iname = HierarchyLocations::function( - Kinds::RunTime::package(K_number), I"gpr_fn", nrl->access_name); - break; - case TIME_TOKEN_INNER_HL: - nrl->equates_to_iname = HierarchyLocations::function( - Kinds::RunTime::package(K_time), I"gpr_fn", nrl->access_name); - break; - case TRUTH_STATE_TOKEN_INNER_HL: - nrl->equates_to_iname = HierarchyLocations::function( - Kinds::RunTime::package(K_truth_state), I"gpr_fn", nrl->access_name); - break; - case COMMANDPROMPTTEXT_HL: - nrl->equates_to_iname = HierarchyLocations::function( - Packaging::home_of(NonlocalVariables::iname(command_prompt_VAR)), - I"command_prompt_text_fn", nrl->access_name); - break; } - if (nrl->equates_to_iname == NULL) - nrl->equates_to_iname = InterNames::one_off(nrl->access_name, nrl->package); - if (nrl->package == NULL) - nrl->package = Packaging::home_of(nrl->equates_to_iname); + + nrl->equates_to_iname = Hierarchy::post_process(nrl->access_number, nrl->equates_to_iname); + nrl->package = Packaging::home_of(nrl->equates_to_iname); } return nrl->equates_to_iname; } diff --git a/inform7/core-module/Chapter 27/Hierarchy.w b/inform7/core-module/Chapter 27/Hierarchy.w index e267e8aaa..e05255eca 100644 --- a/inform7/core-module/Chapter 27/Hierarchy.w +++ b/inform7/core-module/Chapter 27/Hierarchy.w @@ -474,6 +474,17 @@ void Hierarchy::establish(void) { @ +@e K_OBJECT_XPACKAGE from 0 +@e K_NUMBER_XPACKAGE +@e K_TIME_XPACKAGE +@e K_TRUTH_STATE_XPACKAGE +@e K_TABLE_XPACKAGE +@e K_VERB_XPACKAGE +@e K_FIGURE_NAME_XPACKAGE +@e K_SOUND_NAME_XPACKAGE +@e K_USE_OPTION_XPACKAGE +@e V_COMMAND_PROMPT_XPACKAGE + @e NOTHING_HL @e OBJECT_HL @e TESTUSEOPTION_HL @@ -491,19 +502,28 @@ void Hierarchy::establish(void) { @ @ = - HierarchyLocations::make_on_demand(OBJECT_HL, I"Object"); - HierarchyLocations::make_on_demand(NOTHING_HL, I"nothing"); - HierarchyLocations::make_on_demand(TESTUSEOPTION_HL, I"TestUseOption"); - HierarchyLocations::make_on_demand(TABLEOFTABLES_HL, I"TableOfTables"); - HierarchyLocations::make_on_demand(TABLEOFVERBS_HL, I"TableOfVerbs"); - HierarchyLocations::make_on_demand(CAPSHORTNAME_HL, I"cap_short_name"); - HierarchyLocations::make_on_demand(COMMANDPROMPTTEXT_HL, I"CommandPromptText"); - HierarchyLocations::make_on_demand(DECIMAL_TOKEN_INNER_HL, I"DECIMAL_TOKEN_INNER"); - HierarchyLocations::make_on_demand(NO_USE_OPTIONS_HL, I"NO_USE_OPTIONS"); - HierarchyLocations::make_on_demand(RESOURCEIDSOFFIGURES_HL, I"ResourceIDsOfFigures"); - HierarchyLocations::make_on_demand(RESOURCEIDSOFSOUNDS_HL, I"ResourceIDsOfSounds"); - HierarchyLocations::make_on_demand(TIME_TOKEN_INNER_HL, I"TIME_TOKEN_INNER"); - HierarchyLocations::make_on_demand(TRUTH_STATE_TOKEN_INNER_HL, I"TRUTH_STATE_TOKEN_INNER"); + HierarchyLocations::make_in_exotic(OBJECT_HL, I"Object", K_OBJECT_XPACKAGE); + HierarchyLocations::make_in_exotic(NOTHING_HL, I"nothing", K_OBJECT_XPACKAGE); + HierarchyLocations::make_in_exotic(CAPSHORTNAME_HL, I"cap_short_name", K_OBJECT_XPACKAGE); + + HierarchyLocations::make_function_in_exotic(DECIMAL_TOKEN_INNER_HL, I"gpr_fn", I"DECIMAL_TOKEN_INNER", K_NUMBER_XPACKAGE); + + HierarchyLocations::make_function_in_exotic(TIME_TOKEN_INNER_HL, I"gpr_fn", I"TIME_TOKEN_INNER", K_TIME_XPACKAGE); + + HierarchyLocations::make_function_in_exotic(TRUTH_STATE_TOKEN_INNER_HL, I"gpr_fn", I"TRUTH_STATE_TOKEN_INNER", K_TRUTH_STATE_XPACKAGE); + + HierarchyLocations::make_in_exotic(TABLEOFTABLES_HL, I"TableOfTables", K_TABLE_XPACKAGE); + + HierarchyLocations::make_in_exotic(TABLEOFVERBS_HL, I"TableOfVerbs", K_VERB_XPACKAGE); + + HierarchyLocations::make_in_exotic(RESOURCEIDSOFFIGURES_HL, I"ResourceIDsOfFigures", K_FIGURE_NAME_XPACKAGE); + + HierarchyLocations::make_in_exotic(RESOURCEIDSOFSOUNDS_HL, I"ResourceIDsOfSounds", K_SOUND_NAME_XPACKAGE); + + HierarchyLocations::make_in_exotic(NO_USE_OPTIONS_HL, I"NO_USE_OPTIONS", K_USE_OPTION_XPACKAGE); + HierarchyLocations::make_function_in_exotic(TESTUSEOPTION_HL, I"test_fn", I"TestUseOption", K_USE_OPTION_XPACKAGE); + + HierarchyLocations::make_function_in_exotic(COMMANDPROMPTTEXT_HL, I"command_prompt_text_fn", I"CommandPromptText", V_COMMAND_PROMPT_XPACKAGE); @ @@ -983,6 +1003,58 @@ void Hierarchy::establish(void) { @ += +package_request *Hierarchy::exotic_package(int x) { + switch (x) { + case K_OBJECT_XPACKAGE: return Kinds::Behaviour::package(K_object); + case K_NUMBER_XPACKAGE: return Kinds::Behaviour::package(K_number); + case K_TIME_XPACKAGE: return Kinds::Behaviour::package(K_time); + case K_TRUTH_STATE_XPACKAGE: return Kinds::Behaviour::package(K_truth_state); + case K_TABLE_XPACKAGE: return Kinds::Behaviour::package(K_table); + case K_VERB_XPACKAGE: return Kinds::Behaviour::package(K_verb); + case K_FIGURE_NAME_XPACKAGE: return Kinds::Behaviour::package(K_figure_name); + case K_SOUND_NAME_XPACKAGE: return Kinds::Behaviour::package(K_sound_name); + case K_USE_OPTION_XPACKAGE: return Kinds::Behaviour::package(K_use_option); + case V_COMMAND_PROMPT_XPACKAGE: + return Packaging::home_of(NonlocalVariables::iname(command_prompt_VAR)); + } + internal_error("unknown exotic package"); + return NULL; +} + +@ + += +inter_name *Hierarchy::post_process(int HL_id, inter_name *iname) { + switch (HL_id) { + case THESAME_HL: + case PLURALFOUND_HL: + case PARENT_HL: + case CHILD_HL: + case SIBLING_HL: + case THEDARK_HL: + case FLOAT_NAN_HL: + case RESPONSETEXTS_HL: { + packaging_state save = Packaging::enter_home_of(iname); + Emit::named_numeric_constant(iname, 0); + Packaging::exit(save); + break; + } + case SELF_HL: { + packaging_state save = Packaging::enter_home_of(iname); + Emit::variable(iname, K_value, UNDEF_IVAL, 0, I"self"); + Packaging::exit(save); + break; + } + case OBJECT_HL: + iname = Kinds::RunTime::I6_classname(K_object); + break; + } + return iname; +} + +@ + = inter_name *Hierarchy::find(int id) { return HierarchyLocations::find(id);