diff --git a/.gitignore b/.gitignore index f38d563f4..9bc3db47d 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ makefile tags *.glkdata +resources/App HTML/ resources/Changes/Output/ resources/Changes/Output/META-INF/ resources/Changes/Output/OEBPS/ diff --git a/README.md b/README.md index 769a24554..9cc2b4938 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Inform 7 -[Version](notes/versioning.md): 10.2.0-beta+6W62 'Krypton' (12 June 2023) +[Version](notes/versioning.md): 10.2.0-beta+6W67 'Krypton' (26 June 2023) ## About Inform @@ -136,8 +136,8 @@ The following webs are the source for kits of Inter code shipped with Inform (at The following webs are the source for the two most important extensions shipped with Inform: -* [Basic Inform by Graham Nelson](inform7/extensions/basic_inform) - __v1__ - [★ Web](https://ganelson.github.io/inform/basic_inform/index.html) -* [Standard Rules by Graham Nelson](inform7/extensions/standard_rules) - __v6__ - [★ Web](https://ganelson.github.io/inform/standard_rules/index.html) +* [Basic Inform by Graham Nelson](inform7/extensions/basic_inform) - __v2__ - [★ Web](https://ganelson.github.io/inform/basic_inform/index.html) +* [Standard Rules by Graham Nelson](inform7/extensions/standard_rules) - __v7__ - [★ Web](https://ganelson.github.io/inform/standard_rules/index.html) Other extensions shipped with Inform are not presented as webs, but as single files: @@ -146,14 +146,14 @@ Other extensions shipped with Inform are not presented as webs, but as single fi * [Complex Listing by Emily Short]() - __v9__ * [Glulx Image Centering by Emily Short]() - __v4__ * [Glulx Text Effects by Emily Short]() - __v6__ -* [Inanimate Listeners by Emily Short]() - __v1__ -* [Locksmith by Emily Short]() - __v13__ +* [Inanimate Listeners by Emily Short]() - __v2__ +* [Locksmith by Emily Short]() - __v14__ * [Menus by Emily Short]() - __v3__ * [Punctuation Removal by Emily Short]() - __v6__ * [Skeleton Keys by Emily Short]() - __v1__ * [Epistemology by Eric Eve]() - __v9__ * [Approximate Metric Units by Graham Nelson]() - __v1__ -* [English Language by Graham Nelson]() - __v1__ +* [English Language by Graham Nelson]() - __v2__ * [Metric Units by Graham Nelson]() - __v2__ * [Rideable Vehicles by Graham Nelson]() - __v3__ diff --git a/build.txt b/build.txt index 6adf3f890..3ec1bc46d 100644 --- a/build.txt +++ b/build.txt @@ -1,3 +1,3 @@ Prerelease: beta -Build Date: 12 June 2023 -Build Number: 6W62 +Build Date: 26 June 2023 +Build Number: 6W67 diff --git a/docs/BasicInformKit/S-rlb.html b/docs/BasicInformKit/S-rlb.html index bb561604a..e666131e1 100644 --- a/docs/BasicInformKit/S-rlb.html +++ b/docs/BasicInformKit/S-rlb.html @@ -65,7 +65,7 @@ MathJax = {

To work through the rules in a rulebook until a decision is made.

-
+

§1. Latest Rule Result. This used to be a large data structure which kept track of the effect of procedural rules, but in January 2011 procedurals were abolished. It retains @@ -277,20 +277,13 @@ call it.) if (K) return DefaultValueOfKOV(K); return 0; ]; + +[ RulebookOutcomePrintingRule nro; + if (nro == 0) print "(no outcome)"; + else print (string) nro; +]; -

§5. Printing Rule Names. This is the I6 printing rule used for a value of kind "rule", which as -noted above can either be rulebook ID numbers in the range 0 to \(N-1\) or -are addresses of individual rules. -

- -

Names of rules and rulebooks take up a fair amount of space, and one of the -main memory economies enforced by the "Use memory economy" option is to -omit the necessary arrays. (It's not the text which is the problem so -much as the table of addresses pointing to that text, which has to live in -precious readable memory on the Z-machine.) -

- -

§6. Casting. Nothing needs to be done to a rulebook value to make it a rule value. +

§5. Casting. Nothing needs to be done to a rulebook value to make it a rule value.

@@ -298,7 +291,7 @@ precious readable memory on the Z-machine.)
     return r;
 ];
 
-

§7. Debugging. Two modest routines to print out the names of rules and rulebooks when they +

§6. Debugging. Two modest routines to print out the names of rules and rulebooks when they occur, in so far as memory economy allows this.

@@ -323,7 +316,7 @@ occur, in so far as memory economy allows this. print ").]^"; ]; -

§8. The Default Rule and Rulebook.

+

§7. The Default Rule and Rulebook.

 [ LITTLE_USED_DO_NOTHING_R; rfalse; ];
diff --git a/docs/BasicInformKit/S-txt.html b/docs/BasicInformKit/S-txt.html
index 3534d124c..995b0bbdc 100644
--- a/docs/BasicInformKit/S-txt.html
+++ b/docs/BasicInformKit/S-txt.html
@@ -475,11 +475,7 @@ printed in ZSCII rather than Unicode.
     for (i=0: i<dsize: i++) {
         ch = BlkValueRead(txt, i);
         if (ch == 0) break;
-        #ifdef TARGET_ZCODE;
         print (char) ch;
-        #ifnot; TARGET_ZCODE
-        @streamunichar ch;
-        #endif;
     }
     if (i == 0) rfalse;
     rtrue;
diff --git a/docs/BasicInformKit/S-utl.html b/docs/BasicInformKit/S-utl.html
index 2d9aa250e..d6084cdc5 100644
--- a/docs/BasicInformKit/S-utl.html
+++ b/docs/BasicInformKit/S-utl.html
@@ -65,7 +65,7 @@ MathJax = {
     
 

Miscellaneous utility routines for some fundamental I6 needs.

-
+

§1. Miscellany.

@@ -235,7 +235,57 @@ allows us to divide the paragraph or not accordingly. return kind-->(2+n); ];
-

§9. GenerateRandomNumber. The following uses the virtual machine's RNG (via the I6 built-in function +

§9. Non-standard enumerations. This is for enumerations whose values are scattered: say, for a kind where +the valid runtime values are 3, 15 and 421. Next after 3 is 15; previous +is 421, and so on. +

+ +

The instances array supplied has the extent in word 0, which is in effect +the number of valid instances. This is guaranteed to be at least 1. +

+ +
+[ NextEnumVal inst instances i count;
+    count = instances-->0;
+    for (i=1: i<=count: i++)
+        if (instances-->i == inst)
+            return instances-->(i%count + 1);
+    return instances-->1; Should not ever happen
+];
+
+[ PrevEnumVal inst instances i count;
+    count = instances-->0;
+    for (i=1: i<=count: i++)
+        if (instances-->i == inst)
+            return instances-->((i+count-2)%count + 1);
+    return instances-->1; Should not ever happen
+];
+
+[ RandomEnumVal instances a b count a_index b_index c;
+    count = instances-->0;
+    if (a == b) {
+        if (a == 0) return instances-->(random(count));
+        return a;
+    }
+    for (c = 1: c <= count: c++) {
+        if (instances-->c == a)
+            a_index = c;
+        if (instances-->c == b)
+            b_index = c;
+    }
+    if (a_index > b_index) { c = a_index; a_index = b_index; b_index = c; }
+    return instances-->(a_index + random(b_index - a_index + 1) - 1);
+];
+
+[ IndexOfEnumVal instances a count c;
+    count = instances-->0;
+    for (c = 1: c <= count: c++)
+        if (instances-->c == a)
+            return c;
+    return 0;
+];
+
+

§10. GenerateRandomNumber. The following uses the virtual machine's RNG (via the I6 built-in function random) to produce a uniformly random integer in the range \(n\) to \(m\) inclusive, where \(n\) and \(m\) are allowed to be either way around; so that a random number between 17 and 4 is the same thing as a random number @@ -253,7 +303,7 @@ to an empty range of values. Constant R_DecimalNumber = GenerateRandomNumber; Constant R_PrintTimeOfDay = GenerateRandomNumber; -

§10. PrintSpaces. Which prints a row of \(n\) spaces, for \(n\geq 0\). +

§11. PrintSpaces. Which prints a row of \(n\) spaces, for \(n\geq 0\).

@@ -264,7 +314,7 @@ to an empty range of values.
     }
 ];
 
-

§11. SwapWorkflags. Recall that we have two general-purpose temporary attributes for each object: +

§12. SwapWorkflags. Recall that we have two general-purpose temporary attributes for each object: workflag and workflag2. The following swaps their values over for every object at once.

@@ -281,12 +331,12 @@ object at once. } ]; -

§12. TestUseOption. This routine, compiled by Inform, returns true if the supplied argument is the +

§13. TestUseOption. This routine, compiled by Inform, returns true if the supplied argument is the number of a use option in force for the current run of Inform, and false otherwise.

-

§13. ZRegion. I7 contains many relics from I6, but here's a relic from I5: a routine which +

§14. ZRegion. I7 contains many relics from I6, but here's a relic from I5: a routine which used to determine the metaclass of a value, before that concept was given a name. In I6 code, it can be implemented simply using metaclass, as the following shows. (The name is from "region of the Z-machine".) @@ -302,7 +352,7 @@ following shows. (The name is from "region of the Z-machine".) } ]; -

§14. Arrcpy. This is not quite so efficient as Memcpy, but not terrible. +

§15. Arrcpy. This is not quite so efficient as Memcpy, but not terrible.

@@ -318,7 +368,7 @@ following shows. (The name is from "region of the Z-machine".)
     } else "*** Arrcpy doesn't support this ***";
 ];
 
-

§15. Verbs as Values.

+

§16. Verbs as Values.

 [ PrintVerbAsValue vb;
@@ -336,7 +386,7 @@ following shows. (The name is from "region of the Z-machine".)
     rfalse;
 ];
 
-

§16. Seed Random Number Generator Rule. Unless a seed is provided by Inform, and it won't be for released story files, +

§17. Seed Random Number Generator Rule. Unless a seed is provided by Inform, and it won't be for released story files, the VM's interpreter is supposed to start up with a good seed in its random number generator: something usually derived from, say, the milliseconds part of the current time of day, which is unlikely to repeat or show any pattern @@ -357,7 +407,7 @@ of course, in a state of sin" (von Neumann). rfalse; ]; -

§17. Regarding. These are used with adaptive text. +

§18. Regarding. These are used with adaptive text.

@@ -373,7 +423,7 @@ of course, in a state of sin" (von Neumann).
     prior_named_noun = nothing;
 ];
 
-

§18. Say One Of. These routines are described in the Extensions chapter of the Inform +

§19. Say One Of. These routines are described in the Extensions chapter of the Inform documentation.

@@ -419,7 +469,7 @@ documentation. return v + ct*base + ssd*base*base; ]; -

§19. Rounding. The following rounds a numerical value t1 to the nearest unit of t2; +

§20. Rounding. The following rounds a numerical value t1 to the nearest unit of t2; for instance, if t2 is 5 then it rounds to the nearest 5. The name is an anachronism, as it's used for all kinds of value.

@@ -430,7 +480,7 @@ anachronism, as it's used for all kinds of value. return -((-t1+t2/2)/t2)*t2; ]; -

§20. Doing nothing. Surprisingly, this function has a use. +

§21. Doing nothing. Surprisingly, this function has a use.

diff --git a/docs/WorldModelKit/S-mpr.html b/docs/WorldModelKit/S-mpr.html
index ceda3cc92..17c9f2a72 100644
--- a/docs/WorldModelKit/S-mpr.html
+++ b/docs/WorldModelKit/S-mpr.html
@@ -152,9 +152,6 @@ by enumerating them in the property 
-Constant NUM_DOORS = ICOUNT_DOOR;
-Constant NUM_ROOMS = ICOUNT_ROOM;
-
 Array DoorRoutingViable -> NUM_DOORS+1;
 
 Global map_has_changed = true;
diff --git a/docs/arch-module/3-fm.html b/docs/arch-module/3-fm.html
index 2a89c5e3f..fc3def629 100644
--- a/docs/arch-module/3-fm.html
+++ b/docs/arch-module/3-fm.html
@@ -227,8 +227,7 @@ yet be working, and so on.)
     if ((allow_activation_functions_to_be_run) && (F) &&
         (F->activation_function_run == FALSE)) {
         F->activation_function_run = TRUE;
-        void (*start)() = (void (*)()) F->activation_function;
-        if (start) (*start)();
+        if (F->activation_function) (*(F->activation_function))();
     }
 }
 
diff --git a/docs/assertions-module/6-act.html b/docs/assertions-module/6-act.html index 1e193904b..8b659495d 100644 --- a/docs/assertions-module/6-act.html +++ b/docs/assertions-module/6-act.html @@ -178,7 +178,6 @@ special Preform of its own; here is the subject phrase: av->after_rules = Activities::make_rulebook(av, 2); PluginCalls::new_activity_notify(av); - return av; } diff --git a/docs/basic_inform/S-pd.html b/docs/basic_inform/S-pd.html index 4834baf46..8d7e82bef 100644 --- a/docs/basic_inform/S-pd.html +++ b/docs/basic_inform/S-pd.html @@ -928,7 +928,7 @@ BASIC's for loo To repeat with (loopvar - nonexisting K variable) running from (v - enumerated value of kind K) to (w - K) begin -- end loop (documented at ph_repeat): - (- for ({loopvar}={v}: {loopvar}<={w}: {loopvar}++) -). + (- for ({loopvar}={v}: {loopvar}<={w}: {loopvar}={-next-routine:K}({loopvar})) -). To repeat with (loopvar - nonexisting K variable) running through (OS - description of values of kind K) begin -- end loop (documented at ph_runthrough): @@ -1028,6 +1028,9 @@ randomness below. To decide which number is number of (S - description of values) (documented at ph_numberof): (- {-primitive-definition:number-of} -). +To decide what number is the numerical value of (X - enumerated value): (- {X} -). +To decide what number is the sequence number of (X - enumerated value of kind K): + (- {-indexing-routine:K}({X}) -). To decide which K is (name of kind of enumerated value K) after (X - K) (documented at ph_enumafter): (- {-next-routine:K}({X}) -). diff --git a/docs/basic_inform/index.html b/docs/basic_inform/index.html index e6d394a5b..f37b46407 100644 --- a/docs/basic_inform/index.html +++ b/docs/basic_inform/index.html @@ -45,7 +45,7 @@
-

The Basic Inform extension, included in all projects. This is version 1.

+

The Basic Inform extension, included in all projects. This is version 2.


    diff --git a/docs/building-module/2-is.html b/docs/building-module/2-is.html index 98805e0f9..c1d90b92e 100644 --- a/docs/building-module/2-is.html +++ b/docs/building-module/2-is.html @@ -411,6 +411,7 @@ compilation process, and never survive into the final schema: enum next_routine_ISINC enum previous_routine_ISINC enum ranger_routine_ISINC +enum indexing_routine_ISINC enum strong_kind_ISINC enum weak_kind_ISINC enum backspace_ISINC diff --git a/docs/building-module/2-tkn.html b/docs/building-module/2-tkn.html index adb52bf1d..919212f81 100644 --- a/docs/building-module/2-tkn.html +++ b/docs/building-module/2-tkn.html @@ -347,6 +347,8 @@ a bracing. c = printing_routine_ISINC; } else if (Str::eq_wide_string(t->command, L"ranger-routine")) { c = ranger_routine_ISINC; + } else if (Str::eq_wide_string(t->command, L"indexing-routine")) { + c = indexing_routine_ISINC; } else if (Str::eq_wide_string(t->command, L"next-routine")) { c = next_routine_ISINC; } else if (Str::eq_wide_string(t->command, L"previous-routine")) { diff --git a/docs/bytecode-module/3-iibf.html b/docs/bytecode-module/3-iibf.html index 41e575dd7..3c0fa9d09 100644 --- a/docs/bytecode-module/3-iibf.html +++ b/docs/bytecode-module/3-iibf.html @@ -79,7 +79,8 @@ these words would be 5, 2 and 4 respectively.
     int BinaryInter::test_file(filename *F) {
         int verdict = TRUE;
    -    FILE *fh = BinaryFiles::open_for_reading(F);
    +    FILE *fh = BinaryFiles::try_to_open_for_reading(F);
    +    if (fh == NULL) return FALSE;
         unsigned int X = 0;
         if ((BinaryFiles::read_int32(fh, &X) == FALSE) ||
             ((inter_ti) X != INTER_SHIBBOLETH)) verdict = FALSE;
    @@ -95,7 +96,8 @@ file, or else a null semver if the file isn't binary Inter:
     
     
     semantic_version_number BinaryInter::test_file_version(filename *F) {
    -    FILE *fh = BinaryFiles::open_for_reading(F);
    +    FILE *fh = BinaryFiles::try_to_open_for_reading(F);
    +    if (fh == NULL) return VersionNumbers::null();
         unsigned int X = 0;
         if ((BinaryFiles::read_int32(fh, &X) == FALSE) ||
             ((inter_ti) X != INTER_SHIBBOLETH) ||
    diff --git a/docs/calculus-module/3-cs.html b/docs/calculus-module/3-cs.html
    index 6da3f0aee..2dbf1663f 100644
    --- a/docs/calculus-module/3-cs.html
    +++ b/docs/calculus-module/3-cs.html
    @@ -248,17 +248,11 @@ so it would not be safe to store only the textual identifier.
                 #ifdef CORE_MODULE
                 RTKindIDs::write_weak_identifier(OUT, va_arg(ap, kind *));
                 #endif
    -            #ifndef CORE_MODULE
    -            WRITE("{%u}", va_arg(ap, kind *));
    -            #endif
                 break;
             case 'L':
                 #ifdef CORE_MODULE
                 WRITE("%~L", va_arg(ap, local_variable *)); break;
                 #endif
    -            #ifndef CORE_MODULE
    -            WRITE("%08x", va_arg(ap, void *)); break;
    -            #endif
                 break;
             case 'n': {
                 int N = sch->no_quoted_inames++;
    diff --git a/docs/core-module/1-htc.html b/docs/core-module/1-htc.html
    index 522b0db74..a8ddea0b9 100644
    --- a/docs/core-module/1-htc.html
    +++ b/docs/core-module/1-htc.html
    @@ -208,6 +208,7 @@ so on. Those absolute basics are made here.
         BENCH(Task::make_built_in_kind_constructors);
         BENCH(BinaryPredicateFamilies::first_stock)
         BENCH(BootVerbs::make_built_in)
    +    BENCH(Instances::make_instances_from_Neptune);
     
    • This code is used in §2.

    §2.4. Pass three times through the major nodes2.4 = @@ -304,6 +305,7 @@ here, which only happens when special runs are made for compiler testing. BENCH(RTUseOptions::compile) BENCH(RTCommandGrammars::compile_non_generic_constants) BENCH(Interventions::make_all) + BENCH(RTKindConstructors::assign_declaration_sequence_numbers) BENCH(RTKindConstructors::compile) BENCH(RTLiteralPatterns::compile)

    diff --git a/docs/if-module/4-anl.html b/docs/if-module/4-anl.html index 2ac65934c..e68d1efc1 100644 --- a/docs/if-module/4-anl.html +++ b/docs/if-module/4-anl.html @@ -471,6 +471,7 @@ the text leading to a list: anl_parsing_data parsing_data; parsing_data.anl_clauses = NULL; parsing_data.abbreviation_level = 0; + parsing_data.word_position = -1; return parsing_data; } diff --git a/docs/if-module/5-cgt.html b/docs/if-module/5-cgt.html index 20c7a42c2..2e73ef614 100644 --- a/docs/if-module/5-cgt.html +++ b/docs/if-module/5-cgt.html @@ -676,7 +676,7 @@ be a description which is true or false for any given value, so: if ((K_understanding) && (Kinds::Behaviour::is_object(K) == FALSE) && (Kinds::eq(K, K_understanding) == FALSE) && - (RTKindConstructors::request_I6_GPR(K) == FALSE)) { + (Kinds::Behaviour::is_understandable(K) == FALSE)) { Problems::quote_source(1, current_sentence); Problems::quote_wording(2, CGTokens::text(cgt)); StandardProblems::handmade_problem(Task::syntax_tree(), _p_(PM_UnparsableKind)); diff --git a/docs/if-module/5-pp.html b/docs/if-module/5-pp.html index 716de3507..1b2fe1298 100644 --- a/docs/if-module/5-pp.html +++ b/docs/if-module/5-pp.html @@ -83,6 +83,7 @@ chapter. PluginCalls::plug(COMPLETE_MODEL_PLUG, ParsingPlugin::complete_model); RTLiteralPatterns::enable_parsing(); + RTKindConstructors::enable_parsing(); }

    §2. This will also need extensive amounts of run-time code, and the sequence diff --git a/docs/if-module/5-us.html b/docs/if-module/5-us.html index 6ebb42946..9b4d561b6 100644 --- a/docs/if-module/5-us.html +++ b/docs/if-module/5-us.html @@ -794,11 +794,12 @@ it, one at a time, by previous Understand sentences. "and this refers to something which is not an object."); return; } + kind *PK = ValueProperties::kind(pr); if ((Properties::is_either_or(pr) == FALSE) && - (Str::len(RTKindConstructors::get_recognition_only_GPR(ValueProperties::kind(pr))) == 0) && - ((Kinds::Behaviour::is_object(ValueProperties::kind(pr))) || - (RTKindConstructors::request_I6_GPR(ValueProperties::kind(pr)) == FALSE))) { - if (Kinds::Behaviour::is_object(ValueProperties::kind(pr))) + (RTKindConstructors::recognition_only_GPR_provided_by_kit(PK) == FALSE) && + ((Kinds::Behaviour::is_object(PK)) || + (Kinds::Behaviour::is_understandable(PK) == FALSE))) { + if (Kinds::Behaviour::is_object(PK)) StandardProblems::sentence_problem(Task::syntax_tree(), _p_(PM_ThingReferringProperty), "the value of that property is itself a kind of object", @@ -1039,7 +1040,7 @@ and add it to a suitably chosen CG with "make sense."); return; } - if (RTKindConstructors::request_I6_GPR(K) == FALSE) { + if (Kinds::Behaviour::is_understandable(K) == FALSE) { StandardProblems::sentence_problem(Task::syntax_tree(), _p_(PM_UnderstandAsBadValue), "'understand ... as ...' gives text meaning a value whose kind " diff --git a/docs/imperative-module/2-cl.html b/docs/imperative-module/2-cl.html index f62238121..1bed537b6 100644 --- a/docs/imperative-module/2-cl.html +++ b/docs/imperative-module/2-cl.html @@ -114,7 +114,6 @@ storage at runtime. (This can be accessed from a schema.) local_variable *lvar = Node::get_constant_local_variable(spec_found); inter_symbol *lvar_s = LocalVariables::declare(lvar); if (lvar == NULL) { - LOG("Bad: %08x\n", spec_found); internal_error("Compiled never-specified LOCAL VARIABLE SP"); } EmitCode::val_symbol(K_value, lvar_s); diff --git a/docs/imperative-module/2-cr.html b/docs/imperative-module/2-cr.html index df99afdd2..437b64f51 100644 --- a/docs/imperative-module/2-cr.html +++ b/docs/imperative-module/2-cr.html @@ -72,6 +72,8 @@ function togglePopup(material_id) { case CONSTANT_NT: { kind *kind_of_constant = Node::get_kind_of_value(value); int ccm = Kinds::Behaviour::get_constant_compilation_method(kind_of_constant); + if ((ccm == NONE_CCM) && (Kinds::Behaviour::is_an_enumeration(kind_of_constant))) + ccm = NAMED_CONSTANT_CCM; switch(ccm) { case NONE_CCM: constant values of this kind cannot exist LOG("SP: $P; kind: %u\n", value, kind_of_constant); diff --git a/docs/imperative-module/3-sf.html b/docs/imperative-module/3-sf.html index 4734515a9..8610c6964 100644 --- a/docs/imperative-module/3-sf.html +++ b/docs/imperative-module/3-sf.html @@ -497,7 +497,7 @@ following, without having to worry about how any of this works: void Frames::log(stack_frame *frame) { if (frame == NULL) { LOG("<null stack frame>\n"); return; } LOG("Stack frame at %08x: it:%s, dpc:%s\n", - frame, + (unsigned int)(pointer_sized_int)frame, (frame->local_variables.it_variable_exists)?"yes":"no", (frame->determines_past_conditions)?"yes":"no"); local_variable *lvar; diff --git a/docs/imperative-module/4-cl.html b/docs/imperative-module/4-cl.html index c52a02200..173047fac 100644 --- a/docs/imperative-module/4-cl.html +++ b/docs/imperative-module/4-cl.html @@ -335,9 +335,16 @@ performance. return TRUE; } if (Kinds::Behaviour::is_an_enumeration(K)) { - Calculus::Schemas::modify(sch, - "for (*1=1: *1<=%d: *1++)", - RTKindConstructors::get_highest_valid_value_as_integer(K)); + if (RTKindConstructors::is_nonstandard_enumeration(K)) { + inter_name *lname = RTKindConstructors::instances_array_iname(K); + Calculus::Schemas::modify(sch, + "for (*2=1, *1=%n-->*2: *2<=%d: *2++, *1=%n-->*2)", + lname, RTKindConstructors::enumeration_size(K), lname); + } else { + Calculus::Schemas::modify(sch, + "for (*1=1: *1<=%d: *1++)", + RTKindConstructors::enumeration_size(K)); + } return TRUE; } text_stream *p = K->construct->loop_domain_schema; diff --git a/docs/imperative-module/4-cp.html b/docs/imperative-module/4-cp.html index 14be626c9..a076ba5c9 100644 --- a/docs/imperative-module/4-cp.html +++ b/docs/imperative-module/4-cp.html @@ -328,7 +328,7 @@ longer possible to know at compile-time. EmitCode::inv(INDIRECT0_BIP); EmitCode::down(); EmitCode::val_iname(K_value, - RTKindConstructors::get_ranger_iname(K)); + RTKindConstructors::random_value_fn_iname(K)); EmitCode::up(); return; } diff --git a/docs/imperative-module/4-cs.html b/docs/imperative-module/4-cs.html index 39bc2b575..586755c82 100644 --- a/docs/imperative-module/4-cs.html +++ b/docs/imperative-module/4-cs.html @@ -271,7 +271,7 @@ of four things can happen to the term arising from a token:

         inter_name *cr;
         if (pt->term_checked_as_kind)
    -        cr = RTKindConstructors::get_comparison_fn_iname(pt->term_checked_as_kind->construct);
    +        cr = RTKindConstructors::comparison_fn_iname(pt->term_checked_as_kind);
         else
             cr = Hierarchy::find(SIGNEDCOMPARE_HL);
         EmitCode::val_iname(K_value, cr);
    diff --git a/docs/imperative-module/5-cii.html b/docs/imperative-module/5-cii.html
    index 05cb9dbba..8be354c8f 100644
    --- a/docs/imperative-module/5-cii.html
    +++ b/docs/imperative-module/5-cii.html
    @@ -881,10 +881,11 @@ invocation-language so baroque.
         if (C == new_list_of_ISINC)      Inline command "new-list-of"6.3.2;
         if (C == printing_routine_ISINC) Inline command "printing-routine"6.3.5;
         if (C == ranger_routine_ISINC)   Inline command "ranger-routine"6.3.6;
    +    if (C == indexing_routine_ISINC) Inline command "indexing-routine"6.3.7;
         if (C == next_routine_ISINC)     Inline command "next-routine"6.3.3;
         if (C == previous_routine_ISINC) Inline command "previous-routine"6.3.4;
    -    if (C == strong_kind_ISINC)      Inline command "strong-kind"6.3.7;
    -    if (C == weak_kind_ISINC)        Inline command "weak-kind"6.3.8;
    +    if (C == strong_kind_ISINC)      Inline command "strong-kind"6.3.8;
    +    if (C == weak_kind_ISINC)        Inline command "weak-kind"6.3.9;
     
    • This code is used in §6.

    §6.3.1. The following produces a new value of the given kind. If it's stored as a @@ -948,7 +949,7 @@ proposition.

         kind *K = CSIInline::parse_bracing_operand_as_kind(ist->operand,
             Node::get_kind_variable_declarations(inv));
    -    if (K) EmitCode::val_iname(K_value, RTKindConstructors::get_inc_iname(K));
    +    if (K) EmitCode::val_iname(K_value, RTKindConstructors::increment_fn_iname(K));
         else Issue an inline no-such-kind problem6.3.1.2;
         return;
     
    @@ -959,7 +960,7 @@ proposition.
         kind *K = CSIInline::parse_bracing_operand_as_kind(ist->operand,
             Node::get_kind_variable_declarations(inv));
    -    if (K) EmitCode::val_iname(K_value, RTKindConstructors::get_dec_iname(K));
    +    if (K) EmitCode::val_iname(K_value, RTKindConstructors::decrement_fn_iname(K));
         else Issue an inline no-such-kind problem6.3.1.2;
         return;
     
    @@ -970,7 +971,7 @@ proposition.
         kind *K = CSIInline::parse_bracing_operand_as_kind(ist->operand,
             Node::get_kind_variable_declarations(inv));
    -    if (K) EmitCode::val_iname(K_value, RTKindConstructors::get_iname(K));
    +    if (K) EmitCode::val_iname(K_value, RTKindConstructors::printing_fn_iname(K));
         else Issue an inline no-such-kind problem6.3.1.2;
         return;
     
    @@ -984,12 +985,23 @@ proposition. if ((Kinds::eq(K, K_number)) || (Kinds::eq(K, K_time))) EmitCode::val_iname(K_value, Hierarchy::find(GENERATERANDOMNUMBER_HL)); - else if (K) EmitCode::val_iname(K_value, RTKindConstructors::get_ranger_iname(K)); + else if (K) EmitCode::val_iname(K_value, RTKindConstructors::random_value_fn_iname(K)); else Issue an inline no-such-kind problem6.3.1.2; return;
    • This code is used in §6.3.
    -

    §6.3.7. Inline command "strong-kind"6.3.7 = +

    §6.3.7. Inline command "indexing-routine"6.3.7 = +

    + +
    +    kind *K = CSIInline::parse_bracing_operand_as_kind(ist->operand,
    +        Node::get_kind_variable_declarations(inv));
    +    if (K) EmitCode::val_iname(K_value, RTKindConstructors::indexing_fn_iname(K));
    +    else Issue an inline no-such-kind problem6.3.1.2;
    +    return;
    +
    +
    • This code is used in §6.3.
    +

    §6.3.8. Inline command "strong-kind"6.3.8 =

    @@ -1000,7 +1012,7 @@ proposition.
         return;
     
    • This code is used in §6.3.
    -

    §6.3.8. Inline command "weak-kind"6.3.8 = +

    §6.3.9. Inline command "weak-kind"6.3.9 =

    @@ -1019,7 +1031,7 @@ proposition.
             ist->owner->parent_schema->converted_from,
             "I don't know any kind called '%4'.");
     
    - +

    §6.4. Typographic commands. These rather clumsy commands are a residue from earlier forms of the markup language, really. {-open-brace} and {-close-brace} are handled for us elsewhere, so we need do nothing. The other two have actually been withdrawn. @@ -1689,7 +1701,7 @@ result would be the same without the optimisation. if (Kinds::eq(K, K_number)) Inline say number6.6.8.2; if (Kinds::eq(K, K_unicode_character)) Inline say unicode character6.6.8.3; if (K) { - EmitCode::call(RTKindConstructors::get_iname(K)); + EmitCode::call(RTKindConstructors::printing_fn_iname(K)); EmitCode::down(); CompileValues::to_code_val_of_kind(to_say, K); EmitCode::up(); @@ -1715,7 +1727,7 @@ result would be the same without the optimisation. EmitCode::up(); } else { kind *K = Specifications::to_kind(to_say); - EmitCode::call(RTKindConstructors::get_iname(K)); + EmitCode::call(RTKindConstructors::printing_fn_iname(K)); EmitCode::down(); CompileValues::to_code_val_of_kind(to_say, K); EmitCode::up(); @@ -2077,7 +2089,7 @@ which would safely abandon any attempt to define a value like this: (- return {-new:return-kind}; -).

    -kind *CSIInline::parse_bracing_operand_as_kind(text_stream *operand,
    +kind *CSIInline::parse_bracing_operand_as_kind(text_stream *operand,
         kind_variable_declaration *kvd) {
         if (Str::eq_wide_string(operand, L"return-kind"))
             return Frames::get_kind_returned();
    @@ -2292,7 +2304,7 @@ representation. This is the functionality I would most like to remove from Infor
                 EmitCode::val_number(1);
             EmitCode::up();
         } else {
    -        EmitCode::call(RTKindConstructors::get_iname(K));
    +        EmitCode::call(RTKindConstructors::printing_fn_iname(K));
             EmitCode::down();
                 CompileValues::to_code_val(spec);
             EmitCode::up();
    diff --git a/docs/index-module/2-lxc.html b/docs/index-module/2-lxc.html
    index fe73b6d4e..6ef9cac11 100644
    --- a/docs/index-module/2-lxc.html
    +++ b/docs/index-module/2-lxc.html
    @@ -179,8 +179,7 @@ order, then sorted.
     
         inter_package *pack;
         LOOP_OVER_INVENTORY_PACKAGES(pack, i, inv->kind_nodes)
    -        if ((Metadata::read_optional_numeric(pack, I"^is_base")) &&
    -            (Metadata::read_optional_numeric(pack, I"^is_subkind_of_object"))) {
    +        if (Metadata::read_optional_numeric(pack, I"^is_subkind_of_object")) {
                 index_lexicon_entry *lex = IndexLexicon::new_entry(
                     Metadata::required_textual(pack, I"^name"), COMMON_NOUN_TLEXE);
                 lex->link_to = (int) Metadata::read_numeric(pack, I"^at");
    diff --git a/docs/index-module/3-ce2.html b/docs/index-module/3-ce2.html
    index 1198ce994..761e0f68e 100644
    --- a/docs/index-module/3-ce2.html
    +++ b/docs/index-module/3-ce2.html
    @@ -102,8 +102,7 @@ higher up, but kinds with priority 0 do not appear in the index at all.
         for (int priority = 1; priority <= LOWEST_INDEX_PRIORITY; priority++) {
             inter_package *pack;
             LOOP_OVER_INVENTORY_PACKAGES(pack, i, inv->kind_nodes)
    -            if ((Metadata::read_optional_numeric(pack, I"^is_base")) &&
    -                (Metadata::read_optional_numeric(pack, I"^is_subkind_of_object") == 0) &&
    +            if ((Metadata::read_optional_numeric(pack, I"^is_subkind_of_object") == 0) &&
                     (priority == (int) Metadata::read_optional_numeric(pack, I"^index_priority"))) {
                     if ((priority == 8) || (Metadata::read_optional_numeric(pack, I"^is_definite"))) {
                         Index this kind package1.1.2;
    @@ -416,8 +415,7 @@ whole row.
         int depth, int pass, index_session *session) {
         inter_package *subkind_pack;
         LOOP_OVER_INVENTORY_PACKAGES(subkind_pack, i, inv->kind_nodes)
    -        if ((Metadata::read_optional_numeric(subkind_pack, I"^is_base")) &&
    -            (Metadata::read_optional_numeric(subkind_pack, I"^is_subkind_of_object"))) {
    +        if (Metadata::read_optional_numeric(subkind_pack, I"^is_subkind_of_object")) {
                 inter_symbol *super_weak = Metadata::optional_symbol(subkind_pack, I"^superkind");
                 if ((super_weak) && (InterPackage::container(super_weak->definition) == pack))
                     ChartElement::index_object_kind(OUT, inv, subkind_pack, depth, pass, session);
    diff --git a/docs/kinds-module/1-km.html b/docs/kinds-module/1-km.html
    index 2f3d97665..decfe51f5 100644
    --- a/docs/kinds-module/1-km.html
    +++ b/docs/kinds-module/1-km.html
    @@ -78,6 +78,7 @@ which use this module:
     enum kind_constructor_comparison_schema_CLASS
     enum kind_constructor_casting_rule_CLASS
     enum kind_constructor_instance_CLASS
    +enum kind_constructor_instance_rule_CLASS
     enum unit_sequence_CLASS
     enum star_invention_CLASS
     
    @@ -91,6 +92,7 @@ which use this module: DECLARE_CLASS_ALLOCATED_IN_ARRAYS(kind_constructor_casting_rule, 100) DECLARE_CLASS_ALLOCATED_IN_ARRAYS(kind_constructor_comparison_schema, 100) DECLARE_CLASS_ALLOCATED_IN_ARRAYS(kind_constructor_instance, 100) +DECLARE_CLASS_ALLOCATED_IN_ARRAYS(kind_constructor_instance_rule, 100) DECLARE_CLASS_ALLOCATED_IN_ARRAYS(unit_sequence, 50) DECLARE_CLASS(star_invention)
    diff --git a/docs/kinds-module/2-dk.html b/docs/kinds-module/2-dk.html index 21b9f3ce9..3dfc45de7 100644 --- a/docs/kinds-module/2-dk.html +++ b/docs/kinds-module/2-dk.html @@ -339,7 +339,7 @@ addition. <k-kind-construction> internal { kind_constructor *con; LOOP_OVER(con, kind_constructor) - if (KindConstructors::arity(con) > 0) { + if (KindConstructors::arity(con) > 0) { wording X = W; wording Y = EMPTY_WORDING; if (Kinds::Textual::parse_constructor_name(con, &X, &Y)) @@ -368,19 +368,19 @@ unspecified because a short form of the constructor is used (e.g., kind *KX = K_value, *KY = K_value; if (con->variance[0] == CONTRAVARIANT) KX = K_nil; - if ((KindConstructors::arity(con) == 2) && (con->variance[1] == CONTRAVARIANT)) + if ((KindConstructors::arity(con) == 2) && (con->variance[1] == CONTRAVARIANT)) KY = K_nil; The rule and rulebook constructors default to actions for X12.1.1; if (Wordings::nonempty(X)) { - int tupling = KindConstructors::tupling(con, 0); + int tupling = KindConstructors::tupling(con, 0); if ((tupling == 0) && (<k-single-term>(X))) KX = <<rp>>; else if ((tupling == 1) && (<k-optional-term>(X))) KX = <<rp>>; else if ((tupling >= 2) && (<k-tupled-term>(X))) KX = <<rp>>; else KX = NULL; } if (Wordings::nonempty(Y)) { - int tupling = KindConstructors::tupling(con, 1); + int tupling = KindConstructors::tupling(con, 1); if ((tupling == 0) && (<k-single-term>(Y))) KY = <<rp>>; else if ((tupling == 1) && (<k-optional-term>(Y))) KY = <<rp>>; else if ((tupling >= 2) && (<k-tupled-term>(Y))) KY = <<rp>>; @@ -388,10 +388,10 @@ unspecified because a short form of the constructor is used (e.g., } The relation constructor defaults to Y matching X, if X is specified12.1.2; - if ((KindConstructors::arity(con) == 1) && (KX)) { + if ((KindConstructors::arity(con) == 1) && (KX)) { ==> { -, Kinds::unary_con(con, KX) }; return TRUE; } - if ((KindConstructors::arity(con) == 2) && (KX) && (KY)) { + if ((KindConstructors::arity(con) == 2) && (KX) && (KY)) { ==> { -, Kinds::binary_con(con, KX, KY) }; return TRUE; } @@ -474,7 +474,7 @@ and returns TRUEint Kinds::Textual::parse_constructor_name(kind_constructor *con, wording *KW, wording *LW) { wording W = *KW; for (int p=1; p<=2; p++) { - wording NW = KindConstructors::get_name(con, (p==1)?FALSE:TRUE); + wording NW = KindConstructors::get_name(con, (p==1)?FALSE:TRUE); if (Wordings::nonempty(NW)) { int full_length = Wordings::length(NW); int k1 = Wordings::first_wn(NW); @@ -799,7 +799,7 @@ to miss out on this detail.
         kind *first_base = NULL, *second_base = NULL;
    -    if (KindConstructors::arity(con) == 1)
    +    if (KindConstructors::arity(con) == 1)
             first_base = Kinds::unary_construction_material(K);
         else
             Kinds::binary_construction_material(K, &first_base, &second_base);
    @@ -846,7 +846,7 @@ usage.
         if ((con == CON_property) && (Kinds::eq(first_base, K_value))) k_present = 0;
         if ((con == CON_table_column) && (Kinds::eq(first_base, K_value))) k_present = 0;
         if ((con == CON_relation) && (Kinds::eq(first_base, second_base))) l_present = 0;
    -    if (KindConstructors::arity(con) == 1) l_present = 0;
    +    if (KindConstructors::arity(con) == 1) l_present = 0;
         else if (Kinds::eq(second_base, K_nil)) l_present = 0;
         else if (Kinds::eq(second_base, K_void)) l_present = 0;
         if (choice_from[k_present][l_present] == -1) {
    @@ -913,7 +913,7 @@ usage.
         if (K == K_nil) { WRITE("nothing"); return; }
         if (K == K_void) { WRITE("nothing"); return; }
         int pluralised = TRUE;
    -    int tupled = KindConstructors::tupling(con, b);
    +    int tupled = KindConstructors::tupling(con, b);
         int bracketed = FALSE;
         if ((tupled > 1) && (Kinds::get_construct(K) == CON_TUPLE_ENTRY)) {
             kind *first_base = NULL, *second_base = NULL;
    diff --git a/docs/kinds-module/2-fk.html b/docs/kinds-module/2-fk.html
    index a3eb6c7f2..6ec56cfe1 100644
    --- a/docs/kinds-module/2-fk.html
    +++ b/docs/kinds-module/2-fk.html
    @@ -242,7 +242,7 @@ it is. There is no need for speed here.
         if ((sn) && (Str::eq_narrow_string(sn, text_of_I6_name))) return what_have_you;
     
    -kind_constructor **FamiliarKinds::known_con(text_stream *sn) {
    +kind_constructor **FamiliarKinds::known_con(text_stream *sn) {
         IDENTIFIERS_CORRESPOND("ACTIVITY_TY", &CON_activity);
         IDENTIFIERS_CORRESPOND("COMBINATION_TY", &CON_combination);
         IDENTIFIERS_CORRESPOND("DESCRIPTION_OF_TY", &CON_description);
    @@ -263,7 +263,7 @@ it is. There is no need for speed here.
         return NULL;
     }
     
    -kind **FamiliarKinds::known_kind(text_stream *sn) {
    +kind **FamiliarKinds::known_kind(text_stream *sn) {
         IDENTIFIERS_CORRESPOND("ARITHMETIC_VALUE_TY", &K_arithmetic_value);
         IDENTIFIERS_CORRESPOND("ENUMERATED_VALUE_TY", &K_enumerated_value);
         IDENTIFIERS_CORRESPOND("EQUATION_TY", &K_equation);
    @@ -318,7 +318,7 @@ but are indexed together.
     
     void FamiliarKinds::notice_new_kind(kind *K, wording W) {
         if (<notable-linguistic-kinds>(W)) {
    -        KindConstructors::mark_as_linguistic(K->construct);
    +        KindConstructors::mark_as_linguistic(K->construct);
             switch (<<r>>) {
                 case 0: K_natural_language = K;
                     #ifdef NOTIFY_NATURAL_LANGUAGE_KINDS_CALLBACK
    diff --git a/docs/kinds-module/2-knd.html b/docs/kinds-module/2-knd.html
    index 0e59f8965..9aafb730c 100644
    --- a/docs/kinds-module/2-knd.html
    +++ b/docs/kinds-module/2-knd.html
    @@ -174,17 +174,17 @@ we can then use that same pointer on all subsequent requests.
     

    -kind *Kinds::base_construction(kind_constructor *con) {
    +kind *Kinds::base_construction(kind_constructor *con) {
         if (con == NULL) internal_error("impossible construction");
         if ((con == CON_KIND_VARIABLE) || (con == CON_INTERMEDIATE))
             internal_error("forbidden construction");
    -    switch (KindConstructors::arity(con)) {
    +    switch (KindConstructors::arity(con)) {
             case 1:
                 if (con == CON_list_of) return Kinds::unary_con(con, NULL);
                 return Kinds::unary_con(con, K_value);
             case 2: return Kinds::binary_con(con, K_value, K_value);
         }
    -    kind **cache = KindConstructors::cache_location(con);
    +    kind **cache = KindConstructors::cache_location(con);
         if (cache) { if (*cache) return *cache; }
         kind *K;
         Create a raw kind structure6.4;
    @@ -247,7 +247,7 @@ practice wasted.
     
     kind *Kinds::unary_con(kind_constructor *con, kind *X) {
         kind *K;
    -    if (KindConstructors::arity(con) != 1) internal_error("bad unary construction");
    +    if (KindConstructors::arity(con) != 1) internal_error("bad unary construction");
         Create a raw kind structure6.4;
         K->construct = con; K->kc_args[0] = X;
         no_constructed_kinds_created++;
    @@ -256,7 +256,7 @@ practice wasted.
     
     kind *Kinds::binary_con(kind_constructor *con, kind *X, kind *Y) {
         kind *K;
    -    if (KindConstructors::arity(con) != 2) internal_error("bad binary construction");
    +    if (KindConstructors::arity(con) != 2) internal_error("bad binary construction");
         Create a raw kind structure6.4;
         K->construct = con; K->kc_args[0] = X; K->kc_args[1] = Y;
         no_constructed_kinds_created++;
    @@ -365,7 +365,7 @@ drawing up the index, and so on.
     

    -kind_constructor *Kinds::get_construct(kind *K) {
    +kind_constructor *Kinds::get_construct(kind *K) {
         if (K) return K->construct;
         return NULL;
     }
    @@ -399,7 +399,7 @@ drawing up the index, and so on.
     }
     
     int Kinds::arity_of_constructor(kind *K) {
    -    if (K) return KindConstructors::arity(K->construct);
    +    if (K) return KindConstructors::arity(K->construct);
         return 0;
     }
     
    @@ -475,15 +475,15 @@ assuming that it was originally if (a == 1) { X = Kinds::unary_construction_material(K); X_after = Kinds::substitute_inner(X, meanings, &tx, contra, - KindConstructors::variance(Kinds::get_construct(K), 0)); + KindConstructors::variance(Kinds::get_construct(K), 0)); if (tx) { *changed = TRUE; return Kinds::unary_con(K->construct, X_after); } } else { Kinds::binary_construction_material(K, &X, &Y); - int vx = KindConstructors::variance(Kinds::get_construct(K), 0); - int vy = KindConstructors::variance(Kinds::get_construct(K), 1); + int vx = KindConstructors::variance(Kinds::get_construct(K), 0); + int vy = KindConstructors::variance(Kinds::get_construct(K), 1); if (Kinds::get_construct(K) == CON_TUPLE_ENTRY) { vx = way_in; vy = way_in; } @@ -564,7 +564,7 @@ is the super-kind ("value", "thing"). #endif kind *K = Kinds::base_construction( - KindConstructors::new(Kinds::get_construct(super), NULL, I"#NEW", + KindConstructors::new(Kinds::get_construct(super), NULL, I"#NEW", BASE_CONSTRUCTOR_GRP)); Use the source-text name to attach a noun to the constructor20.1; @@ -594,7 +594,7 @@ is the super-kind ("value", "thing"). ADD_TO_LEXICON_NTOPT + WITH_PLURAL_FORMS_NTOPT, KIND_SLOW_MC, STORE_POINTER_kind_constructor(K->construct), NULL); #endif - KindConstructors::attach_noun(K->construct, nt); + KindConstructors::attach_noun(K->construct, nt);
    • This code is used in §20.

    §21. Making subkinds. This does not need to be done at creation time. diff --git a/docs/kinds-module/2-tlok.html b/docs/kinds-module/2-tlok.html index 7e7346b38..fd058ae0e 100644 --- a/docs/kinds-module/2-tlok.html +++ b/docs/kinds-module/2-tlok.html @@ -219,19 +219,19 @@ function is what tells us that the superkind of kind *S = HIERARCHY_GET_SUPER_KINDS_CALLBACK(K); if (S) return S; #endif - if (KindConstructors::compatible(K->construct, K_real_arithmetic_value->construct, FALSE)) + if (KindConstructors::compatible(K->construct, K_real_arithmetic_value->construct, FALSE)) return K_real_arithmetic_value; - if (KindConstructors::compatible(K->construct, K_enumerated_value->construct, FALSE)) + if (KindConstructors::compatible(K->construct, K_enumerated_value->construct, FALSE)) return K_enumerated_value; - if (KindConstructors::compatible(K->construct, K_arithmetic_value->construct, FALSE)) + if (KindConstructors::compatible(K->construct, K_arithmetic_value->construct, FALSE)) return K_arithmetic_value; - if (KindConstructors::compatible(K->construct, K_pointer_value->construct, FALSE)) + if (KindConstructors::compatible(K->construct, K_pointer_value->construct, FALSE)) return K_pointer_value; - if (KindConstructors::compatible(K->construct, K_understandable_value->construct, FALSE)) + if (KindConstructors::compatible(K->construct, K_understandable_value->construct, FALSE)) return K_understandable_value; - if (KindConstructors::compatible(K->construct, K_sayable_value->construct, FALSE)) + if (KindConstructors::compatible(K->construct, K_sayable_value->construct, FALSE)) return K_sayable_value; - if (KindConstructors::compatible(K->construct, K_stored_value->construct, FALSE)) + if (KindConstructors::compatible(K->construct, K_stored_value->construct, FALSE)) return K_stored_value; return K_value; } @@ -266,8 +266,8 @@ such a list can't be constructed as data. if (K1 == NULL) return K2; if (K2 == NULL) return K1; kind_constructor *con = K1->construct; - int a1 = KindConstructors::arity(con); - int a2 = KindConstructors::arity(K2->construct); + int a1 = KindConstructors::arity(con); + int a2 = KindConstructors::arity(K2->construct); if ((a1 > 0) || (a2 > 0)) { if (K2->construct != con) return K_value; kind *ka[MAX_KIND_CONSTRUCTION_ARITY] = { NULL, }; @@ -508,8 +508,8 @@ and, of course, "value".

    -    int f_a = KindConstructors::arity(from->construct);
    -    int t_a = KindConstructors::arity(to->construct);
    +    int f_a = KindConstructors::arity(from->construct);
    +    int t_a = KindConstructors::arity(to->construct);
         int arity = (f_a < t_a)?f_a:t_a;
         int o = ALWAYS_MATCH;
         if (from->construct != to->construct)
    @@ -518,7 +518,7 @@ and, of course, "value".
         for (i=0; i<arity; i++) {
             if ((Latticework::vacuous(from->kc_args[i])) && (Latticework::vacuous(to->kc_args[i])))
                 continue;
    -        if (KindConstructors::variance(from->construct, i) == COVARIANT)
    +        if (KindConstructors::variance(from->construct, i) == COVARIANT)
                 this_o = Latticework::order_relation(from->kc_args[i], to->kc_args[i], allow_casts);
             else {
                 this_o = Latticework::order_relation(to->kc_args[i], from->kc_args[i], allow_casts);
    @@ -549,7 +549,7 @@ and, of course, "value".
             if (Kinds::eq(K, to)) return ALWAYS_MATCH;
             K = Latticework::super(K);
         }
    -    if ((allow_casts) && (KindConstructors::find_cast(from->construct, to->construct)))
    +    if ((allow_casts) && (KindConstructors::find_cast(from->construct, to->construct)))
             return ALWAYS_MATCH;
         K = to;
         while (K) {
    diff --git a/docs/kinds-module/2-uk.html b/docs/kinds-module/2-uk.html
    index bc03d6223..f03a2fd75 100644
    --- a/docs/kinds-module/2-uk.html
    +++ b/docs/kinds-module/2-uk.html
    @@ -73,20 +73,20 @@ MathJax = {
         

To determine the characteristics of different kinds, enabling them to be used in practice.

-
+

§1. Names of kinds.

 wording Kinds::Behaviour::get_name(kind *K, int plural_form) {
     if (K == NULL) return EMPTY_WORDING;
-    return KindConstructors::get_name(K->construct, plural_form);
+    return KindConstructors::get_name(K->construct, plural_form);
 }
 
 wording Kinds::Behaviour::get_name_in_play(kind *K, int plural_form,
     NATURAL_LANGUAGE_WORDS_TYPE *nl) {
     if (K == NULL) return EMPTY_WORDING;
-    return KindConstructors::get_name_in_play(K->construct, plural_form, nl);
+    return KindConstructors::get_name_in_play(K->construct, plural_form, nl);
 }
 
 noun *Kinds::Behaviour::get_noun(kind *K) {
@@ -147,8 +147,8 @@ checks that we aren't doing that:
 
 int Kinds::Behaviour::definite(kind *K) {
     if (K == NULL) return TRUE;
-    if (KindConstructors::is_definite(K->construct) == FALSE) return FALSE;
-    int arity = KindConstructors::arity(K->construct);
+    if (KindConstructors::is_definite(K->construct) == FALSE) return FALSE;
+    int arity = KindConstructors::arity(K->construct);
     for (int i=0; i<arity; i++)
         if (Kinds::Behaviour::definite(K->kc_args[i]) == FALSE)
             return FALSE;
@@ -159,8 +159,8 @@ checks that we aren't doing that:
     if (K == NULL) return TRUE;
     if (K->construct == CON_KIND_VARIABLE) return TRUE;
     if (K->construct == CON_NIL) return FALSE;
-    if (KindConstructors::is_definite(K->construct) == FALSE) return FALSE;
-    int arity = KindConstructors::arity(K->construct);
+    if (KindConstructors::is_definite(K->construct) == FALSE) return FALSE;
+    int arity = KindConstructors::arity(K->construct);
     if ((K->construct == CON_TUPLE_ENTRY) && (Kinds::eq(K->kc_args[1], K_void))) arity = 1;
     if ((K->construct == CON_phrase) || (K->construct == CON_activity)) {
         for (int i=0; i<arity; i++)
@@ -179,7 +179,7 @@ checks that we aren't doing that:
     if (K == NULL) return FALSE;
     if ((K->construct == CON_KIND_VARIABLE) && (v == K->kind_variable_number))
         return TRUE;
-    int i, arity = KindConstructors::arity(K->construct);
+    int i, arity = KindConstructors::arity(K->construct);
     for (i=0; i<arity; i++)
         if (Kinds::Behaviour::involves_var(K->kc_args[i], v))
             return TRUE;
@@ -227,7 +227,7 @@ has been used, the matter is settled and there is no going back.
 
 int Kinds::Behaviour::is_an_enumeration(kind *K) {
     if (K == NULL) return FALSE;
-    return KindConstructors::is_an_enumeration(K->construct);
+    return KindConstructors::is_an_enumeration(K->construct);
 }
 

§8. And here we perform the conversion to a unit. The return value is TRUE @@ -238,7 +238,7 @@ if the kind was already a unit or was successfully converted into one,

 int Kinds::Behaviour::convert_to_unit(kind *K) {
     if (K == NULL) return FALSE;
-    return KindConstructors::convert_to_unit(K->construct);
+    return KindConstructors::convert_to_unit(K->construct);
 }
 

§9. And similarly: @@ -246,7 +246,7 @@ if the kind was already a unit or was successfully converted into one,

 void Kinds::Behaviour::convert_to_enumeration(kind *K) {
-    if (K) KindConstructors::convert_to_enumeration(K->construct);
+    if (K) KindConstructors::convert_to_enumeration(K->construct);
 }
 

§10. And similarly to switch from integer to real arithmetic. @@ -254,7 +254,7 @@ if the kind was already a unit or was successfully converted into one,

 void Kinds::Behaviour::convert_to_real(kind *K) {
-    if (K) KindConstructors::convert_to_real(K->construct);
+    if (K) KindConstructors::convert_to_real(K->construct);
 }
 

§11. The instances of an enumeration have the values \(1, 2, 3, ..., N\) at @@ -269,6 +269,24 @@ by the next instance to be created. return K->construct->next_free_value++; }

+

§12. (B) Command parsing.

+ +
+int Kinds::Behaviour::is_understandable(kind *K) {
+    if (K == NULL) return FALSE;
+    return KindConstructors::is_understandable(K->construct);
+}
+
+text_stream *Kinds::Behaviour::GPR_identifier(kind *K) {
+    if (K == NULL) return NULL;
+    return K->construct->explicit_GPR_identifier;
+}
+
+text_stream *Kinds::Behaviour::recognition_only_GPR_identifier(kind *K) {
+    if (K == NULL) return NULL;
+    return K->construct->recognition_routine;
+}
+

§13. (C) Compatibility with other kinds.

@@ -325,12 +343,12 @@ we have to.
 
 int Kinds::Behaviour::uses_signed_comparisons(kind *K) {
     if (K == NULL) return FALSE;
-    return KindConstructors::uses_signed_comparisons(K->construct);
+    return KindConstructors::uses_signed_comparisons(K->construct);
 }
 
 text_stream *Kinds::Behaviour::get_comparison_routine(kind *K) {
     if (K == NULL) return NULL;
-    return KindConstructors::get_comparison_fn_identifier(K->construct);
+    return KindConstructors::get_comparison_fn_identifier(K->construct);
 }
 

§18. See "Dimensions.w" for a full account of these ideas. In theory, our @@ -343,7 +361,7 @@ track of dimensions, and the following routines connect the code in the

 int Kinds::Behaviour::is_quasinumerical(kind *K) {
     if (K == NULL) return FALSE;
-    return KindConstructors::is_arithmetic(K->construct);
+    return KindConstructors::is_arithmetic(K->construct);
 }
 
 unit_sequence *Kinds::Behaviour::get_dimensional_form(kind *K) {
@@ -387,6 +405,12 @@ operations can be applied, and if so, what kind the result has.
 

§20. (H) An identifier name.

+int Kinds::Behaviour::comes_from_Neptune(kind *K) {
+    if (K == NULL) return FALSE;
+    if (Str::len(K->construct->explicit_identifier) > 0) return TRUE;
+    return FALSE;
+}
+
 text_stream *Kinds::Behaviour::get_identifier(kind *K) {
     if (K == NULL) return I"UNKNOWN_NT";
     return K->construct->explicit_identifier;
@@ -402,7 +426,7 @@ takes depends on its kind:
 
 int Kinds::Behaviour::uses_block_values(kind *K) {
     if (K == NULL) return FALSE;
-    return KindConstructors::uses_block_values(K->construct);
+    return KindConstructors::uses_block_values(K->construct);
 }
 

§22. Exactly how large the small block is: diff --git a/docs/kinds-module/3-dmn.html b/docs/kinds-module/3-dmn.html index d4c9a0288..a01788e96 100644 --- a/docs/kinds-module/3-dmn.html +++ b/docs/kinds-module/3-dmn.html @@ -357,7 +357,7 @@ order of creation.

-void Kinds::Dimensions::dim_initialise(dimensional_rules *dimrs) {
+void Kinds::Dimensions::dim_initialise(dimensional_rules *dimrs) {
     dimrs->multiplications = NULL;
 }
 
@@ -478,7 +478,7 @@ derived and dimensionless, though, so that comes out as the empty sequence.

-unit_sequence Kinds::Dimensions::fundamental_unit_sequence(kind *B) {
+unit_sequence Kinds::Dimensions::fundamental_unit_sequence(kind *B) {
     unit_sequence us;
     if (B == NULL) {
         us.no_unit_pairs = 0;
diff --git a/docs/kinds-module/3-fv.html b/docs/kinds-module/3-fv.html
index 2411ffbba..859922309 100644
--- a/docs/kinds-module/3-fv.html
+++ b/docs/kinds-module/3-fv.html
@@ -85,7 +85,7 @@ have integer equivalents.
 
 int Kinds::FloatingPoint::uses_floating_point(kind *K) {
     if (K == NULL) return FALSE;
-    return KindConstructors::is_arithmetic_and_real(K->construct);
+    return KindConstructors::is_arithmetic_and_real(K->construct);
 }
 

§3. Inform's equations system has to handle promotion (from int to real) or diff --git a/docs/kinds-module/4-kc.html b/docs/kinds-module/4-kc.html index 4f78bad65..6a5dbf5ad 100644 --- a/docs/kinds-module/4-kc.html +++ b/docs/kinds-module/4-kc.html @@ -153,7 +153,7 @@ function togglePopup(material_id) { return; } if (tcc == conforms_to_KCC) { - kind_constructor_instance *dti = CREATE(kind_constructor_instance); + kind_constructor_instance_rule *dti = CREATE(kind_constructor_instance_rule); dti->next_instance_rule = con->first_instance_rule; con->first_instance_rule = dti; dti->instance_of_this_unparsed = Str::duplicate(stc.constructor_argument); @@ -169,6 +169,36 @@ function togglePopup(material_id) { dtcs->comparison_schema = Str::duplicate(stc.textual_argument); return; } + if (tcc == instance_KCC) { + match_results mr = Regexp::create_mr(); + if (Regexp::match(&mr, stc.textual_argument, L" *(%c+?) *= *(%C+) *= *(%C+) *")) { + kind_constructor_instance *kci = CREATE(kind_constructor_instance); + kci->natural_language_name = Str::duplicate(mr.exp[0]); + kci->identifier = Str::duplicate(mr.exp[1]); + int bad = FALSE; + kci->value = KindCommands::parse_literal_number(mr.exp[2], &bad); + kci->value_specified = TRUE; + if (bad) { + NeptuneFiles::error(stc.textual_argument, + I"value after the final '=' is not a valid Inform 6 literal", stc.origin); + kci->value = 0; + kci->value_specified = FALSE; + } + ADD_TO_LINKED_LIST(kci, kind_constructor_instance, con->instances); + } else if (Regexp::match(&mr, stc.textual_argument, L" *(%c+?) *= *(%C+) *")) { + kind_constructor_instance *kci = CREATE(kind_constructor_instance); + kci->natural_language_name = Str::duplicate(mr.exp[0]); + kci->identifier = Str::duplicate(mr.exp[1]); + kci->value = 0; + kci->value_specified = FALSE; + ADD_TO_LINKED_LIST(kci, kind_constructor_instance, con->instances); + } else { + NeptuneFiles::error(stc.textual_argument, + I"instance not in form NAME = IDENTIFIER = VALUE", stc.origin); + } + Regexp::dispose_of(&mr); + return; + }

  • This code is used in §1.

§1.4. And the rest fill in fields in the constructor structure in miscellaneous other ways1.4 = @@ -265,6 +295,44 @@ function togglePopup(material_id) { con->constructor_arity = c+1;

  • This code is used in §1.4.
+

§2. This is used for parsing the values of enumeration members in instance +commands: +

+ +
+int KindCommands::parse_literal_number(text_stream *S, int *bad) {
+    *bad = FALSE;
+    int sign = 1, base = 10, from = 0, to = Str::len(S)-1;
+    if ((Str::get_at(S, from) == '(') && (Str::get_at(S, to) == ')')) { from++; to--; }
+    while (Characters::is_whitespace(Str::get_at(S, from))) from++;
+    while (Characters::is_whitespace(Str::get_at(S, to))) to--;
+    if (Str::get_at(S, from) == '-') { sign = -1; from++; }
+    else if (Str::get_at(S, from) == '$') {
+        from++; base = 16;
+        if (Str::get_at(S, from) == '$') {
+            from++; base = 2;
+        }
+    }
+    long long int N = 0;
+    LOOP_THROUGH_TEXT(pos, S) {
+        if (pos.index < from) continue;
+        if (pos.index > to) continue;
+        int c = Str::get(pos), d = 0;
+        if ((c >= 'a') && (c <= 'z')) d = c-'a'+10;
+        else if ((c >= 'A') && (c <= 'Z')) d = c-'A'+10;
+        else if ((c >= '0') && (c <= '9')) d = c-'0';
+        else { *bad = TRUE; break; }
+        if (d > base) { *bad = TRUE; break; }
+        N = base*N + (long long int) d;
+        if (pos.index > 34) { *bad = TRUE; break; }
+    }
+    if (*bad == FALSE) {
+        N = sign*N;
+        return (int) N;
+    }
+    return -1;
+}
+
diff --git a/docs/kinds-module/4-kc2.html b/docs/kinds-module/4-kc2.html index b4884c64b..b542581a4 100644 --- a/docs/kinds-module/4-kc2.html +++ b/docs/kinds-module/4-kc2.html @@ -59,7 +59,7 @@ function togglePopup(material_id) {

The mechanism by which Inform records the characteristics of different kinds.

-
+

§1. Constructors are divided into four groups:

@@ -99,7 +99,7 @@ set by commands in Neptune files, others set by calls from Inform. C: compatibility with other kinds struct parse_node *superkind_set_at; where it says, e.g., "A rabbit is a kind of animal" struct kind_constructor_casting_rule *first_casting_rule; list of these - struct kind_constructor_instance *first_instance_rule; list of these + struct kind_constructor_instance_rule *first_instance_rule; list of these D: how constant values of this kind are expressed struct literal_pattern *ways_to_write_literals; list of ways to write this @@ -137,6 +137,7 @@ set by commands in Neptune files, others set by calls from Inform. struct text_stream *distinguishing_routine; Inter routine to see if values distinguishable struct kind_constructor_comparison_schema *first_comparison_schema; list of these struct text_stream *loop_domain_schema; how to compile a loop over the instances + struct linked_list *instances; if enumerated explicitly in a Neptune file J: printing and parsing values at run-time struct text_stream *print_identifier; an Inter identifier used for compiling printing rules @@ -171,7 +172,18 @@ the following are also needed. } kind_constructor_casting_rule;
  • The structure kind_constructor_casting_rule is accessed in 4/kc and here.
-

§4. And this is the analogous structure for giving Inter schemas to compare +

§4. And this is the analogous structure for recording conformance: +

+ +
+typedef struct kind_constructor_instance_rule {
+    struct text_stream *instance_of_this_unparsed;
+    struct kind_constructor *instance_of_this;
+    struct kind_constructor_instance_rule *next_instance_rule;
+} kind_constructor_instance_rule;
+
+
  • The structure kind_constructor_instance_rule is accessed in 4/kc and here.
+

§5. And this is the analogous structure for giving Inter schemas to compare data of two different kinds:

@@ -184,19 +196,19 @@ data of two different kinds: } kind_constructor_comparison_schema;
  • The structure kind_constructor_comparison_schema is accessed in 4/kc.
-

§5. And this is the analogous structure for giving Inter schemas to compare -data of two different kinds: +

§6. And this is where explicit instances are recorded:

 typedef struct kind_constructor_instance {
-    struct text_stream *instance_of_this_unparsed;
-    struct kind_constructor *instance_of_this;
-    struct kind_constructor_instance *next_instance_rule;
+    struct text_stream *natural_language_name;
+    struct text_stream *identifier;
+    int value;
+    int value_specified;
 } kind_constructor_instance;
 
-
  • The structure kind_constructor_instance is accessed in 4/kc and here.
-

§6. The "tupling" of an argument is the extent to which an argument can be +

  • The structure kind_constructor_instance is accessed in 4/kc.
+

§7. The "tupling" of an argument is the extent to which an argument can be allowed to hold a variable-length list of kinds, rather than a single one. There aren't actually many possibilities.

@@ -205,7 +217,7 @@ There aren't actually many possibilities. define ALLOW_NOTHING_TUPLING 1 a single kind, or "nothing" define ARBITRARY_TUPLING 10000 a list of kinds of any length
-

§7. Constant compilation modes are: +

§8. Constant compilation modes are:

define NONE_CCM 1  constant values of this kind cannot exist
@@ -213,14 +225,14 @@ There aren't actually many possibilities.
 define NAMED_CONSTANT_CCM 3  an instance annotation decides the value
 define SPECIAL_CCM 4  special code specific to the kind of value is needed
 
-

§8. We keep track of the newest-created base kind of value (which isn't a kind +

§9. We keep track of the newest-created base kind of value (which isn't a kind of object) here:

 kind *latest_base_kind_of_value = NULL;
 
-

§9. Creation. Constructors come from two sources. Built-in ones like number or +

§10. Creation. Constructors come from two sources. Built-in ones like number or list of K come from commands in Neptune Files, while source-created ones ("Air pressure is a kind of value") result in calls here from Kinds::new_base — which, as the name suggests, can only make @@ -251,8 +263,8 @@ then CON_VALUE if (pC) *pC = con; int copied = FALSE; - if (super == Kinds::get_construct(K_value)) Fill in a new constructor9.1 - else { Copy the new constructor from its superconstructor9.2; copied = TRUE; } + if (super == Kinds::get_construct(K_value)) Fill in a new constructor10.1 + else { Copy the new constructor from its superconstructor10.2; copied = TRUE; } con->group = group; con->explicit_identifier = Str::duplicate(source_name); @@ -267,14 +279,14 @@ then CON_VALUE return con; } -

§9.1. If our new constructor is wholly new, and isn't a subkind of something else, +

§10.1. If our new constructor is wholly new, and isn't a subkind of something else, we need to initialise the entire data structure; but note that, having done so, we apply any defaults set in Neptune files.

default LOWEST_INDEX_PRIORITY 100
 
-

Fill in a new constructor9.1 = +

Fill in a new constructor10.1 =

@@ -339,6 +351,7 @@ we apply any defaults set in Neptune files.
     con->first_comparison_schema = NULL;
     con->distinguishing_routine = NULL;
     con->loop_domain_schema = NULL;
+    con->instances = NEW_LINKED_LIST(kind_constructor_instance);
 
      J: printing and parsing values at run-time
     con->print_identifier = Str::new();
@@ -372,8 +385,8 @@ we apply any defaults set in Neptune files.
     if (Str::len(initialisation_macro) > 0)
         NeptuneMacros::play_back(NeptuneMacros::parse_name(initialisation_macro), con, NULL);
 
-
  • This code is used in §9.
-

§9.2. However, if we create our constructor as a subkind, like so: +

  • This code is used in §10.
+

§10.2. However, if we create our constructor as a subkind, like so:

@@ -387,7 +400,7 @@ we apply any defaults set in Neptune files. It means that all kinds of object share the same weak ID as "object".

-

Copy the new constructor from its superconstructor9.2 = +

Copy the new constructor from its superconstructor10.2 =

@@ -401,8 +414,8 @@ It means that all kinds of object share the same weak ID as "object".
     con->cached_kind = NULL;  otherwise the superkind's cache is used by mistake
     con->explicit_identifier = Str::new();  otherwise this will be called OBJECT_TY by mistake
 
-
  • This code is used in §9.
-

§10. The noun. It's a requirement that the following be called soon after the creation +

  • This code is used in §10.
+

§11. The noun. It's a requirement that the following be called soon after the creation of the constructor:

@@ -438,12 +451,12 @@ of the constructor: return con->explicit_identifier; } -

§11. We also need to parse this, occasionally (if we needed this more than a +

§12. We also need to parse this, occasionally (if we needed this more than a small and bounded number of times we'd want a faster method, but we don't):

-kind_constructor *KindConstructors::parse(text_stream *sn) {
+kind_constructor *KindConstructors::parse(text_stream *sn) {
     if (sn == NULL) return NULL;
     kind_constructor *con;
     LOOP_OVER(con, kind_constructor)
@@ -452,7 +465,7 @@ small and bounded number of times we'd want a faster method, but we don't):
     return NULL;
 }
 
-

§12. Transformations. Conversions of an existing constructor to make it a unit or enumeration also +

§13. Transformations. Conversions of an existing constructor to make it a unit or enumeration also require running macros in the kind interpreter:

@@ -462,7 +475,7 @@ require running macros in the kind interpreter: NeptuneMacros::play_back(NeptuneMacros::parse_name(I"#UNIT"), con, NULL); return TRUE; } - if (KindConstructors::is_arithmetic(con)) return TRUE; i.e., if it succeeded + if (KindConstructors::is_arithmetic(con)) return TRUE; i.e., if it succeeded return FALSE; } @@ -473,11 +486,11 @@ require running macros in the kind interpreter: NeptuneMacros::play_back(NeptuneMacros::parse_name(I"#LINGUISTIC"), con, NULL); return TRUE; } - if (KindConstructors::is_an_enumeration(con)) return TRUE; i.e., if it succeeded + if (KindConstructors::is_an_enumeration(con)) return TRUE; i.e., if it succeeded return FALSE; } -

§13. And similarly: +

§14. And similarly:

@@ -485,7 +498,7 @@ require running macros in the kind interpreter:
     NeptuneMacros::play_back(NeptuneMacros::parse_name(I"#REAL"), con, NULL);
 }
 
-

§14. A few base kinds are marked as "linguistic", which simply enables us to fence +

§15. A few base kinds are marked as "linguistic", which simply enables us to fence them tidily off in the index.

@@ -494,7 +507,7 @@ them tidily off in the index. con->linguistic = TRUE; } -

§15. For construction purposes.

+

§16. For construction purposes.

 kind **KindConstructors::cache_location(kind_constructor *con) {
@@ -515,13 +528,25 @@ them tidily off in the index.
 int KindConstructors::variance(kind_constructor *con, int b) {
     return con->variance[b];
 }
+
+int KindConstructors::is_base(kind_constructor *con) {
+    if (con == NULL) return FALSE;
+    if (con->group == BASE_CONSTRUCTOR_GRP) return TRUE;
+    return FALSE;
+}
+
+int KindConstructors::is_proper_constructor(kind_constructor *con) {
+    if (con == NULL) return FALSE;
+    if (con->group == PROPER_CONSTRUCTOR_GRP) return TRUE;
+    return FALSE;
+}
 
-

§16. Questions about constructors. The rest of Inform is not encouraged to poke at constructors directly; it +

§17. Questions about constructors. The rest of Inform is not encouraged to poke at constructors directly; it ought to ask questions about kinds instead (see "Using Kinds"). However:

-int KindConstructors::is_definite(kind_constructor *con) {
+int KindConstructors::is_definite(kind_constructor *con) {
     if ((con->group == BASE_CONSTRUCTOR_GRP) ||
         (con->group == PROPER_CONSTRUCTOR_GRP))
             return TRUE;
@@ -530,69 +555,69 @@ ought to ask questions about kinds instead (see "Using Kinds"). However:
     return FALSE;
 }
 
-int KindConstructors::offers_I6_GPR(kind_constructor *con) {
+int KindConstructors::is_understandable(kind_constructor *con) {
     if (con == NULL) return FALSE;
-    if ((KindConstructors::is_definite(con)) &&
-        (KindConstructors::compatible(con,
+    if ((KindConstructors::is_definite(con)) &&
+        (KindConstructors::compatible(con,
             Kinds::get_construct(K_understandable_value), FALSE))) return TRUE;
     return FALSE;
 }
 
-int KindConstructors::is_arithmetic(kind_constructor *con) {
+int KindConstructors::is_arithmetic(kind_constructor *con) {
     if (con == NULL) return FALSE;
-    if ((KindConstructors::is_definite(con)) &&
-        (KindConstructors::compatible(con,
+    if ((KindConstructors::is_definite(con)) &&
+        (KindConstructors::compatible(con,
             Kinds::get_construct(K_arithmetic_value), FALSE))) return TRUE;
     return FALSE;
 }
 
-int KindConstructors::is_arithmetic_and_real(kind_constructor *con) {
+int KindConstructors::is_arithmetic_and_real(kind_constructor *con) {
     if (con == NULL) return FALSE;
-    if ((KindConstructors::is_definite(con)) &&
-        (KindConstructors::compatible(con,
+    if ((KindConstructors::is_definite(con)) &&
+        (KindConstructors::compatible(con,
             Kinds::get_construct(K_real_arithmetic_value), FALSE))) return TRUE;
     return FALSE;
 }
 
-int KindConstructors::is_an_enumeration(kind_constructor *con) {
+int KindConstructors::is_an_enumeration(kind_constructor *con) {
     if (con == NULL) return FALSE;
-    if ((KindConstructors::is_definite(con)) &&
-        (KindConstructors::compatible(con,
+    if ((KindConstructors::is_definite(con)) &&
+        (KindConstructors::compatible(con,
             Kinds::get_construct(K_enumerated_value), FALSE))) return TRUE;
     return FALSE;
 }
 
-

§17. All floating-point kinds use a common comparison function: the one for +

§18. All floating-point kinds use a common comparison function: the one for K_real_number.

-int KindConstructors::uses_signed_comparisons(kind_constructor *kc) {
+int KindConstructors::uses_signed_comparisons(kind_constructor *kc) {
     if (kc == NULL) return FALSE;
     if (Str::eq_wide_string(kc->comparison_routine, L"signed")) return TRUE;
     return FALSE;
 }
 
-text_stream *KindConstructors::get_comparison_fn_identifier(kind_constructor *kc) {
+text_stream *KindConstructors::get_comparison_fn_identifier(kind_constructor *kc) {
     if (kc == NULL) return NULL;
-    if ((KindConstructors::is_arithmetic_and_real(kc)) && (K_real_number))
+    if ((KindConstructors::is_arithmetic_and_real(kc)) && (K_real_number))
         return K_real_number->construct->comparison_routine;
     if (Str::eq_wide_string(kc->comparison_routine, L"signed")) return NULL;
     return kc->comparison_routine;
 }
 
-

§18. Cast and instance lists. Each constructor has a list of other constructors (all of the PROTOCOL_GRP +

§19. Cast and instance lists. Each constructor has a list of other constructors (all of the PROTOCOL_GRP group) which it's an instance of: value, word value, arithmetic value, and so on.

-int KindConstructors::find_cast(kind_constructor *from, kind_constructor *to) {
+int KindConstructors::find_cast(kind_constructor *from, kind_constructor *to) {
     if (to) {
         kind_constructor_casting_rule *dtcr;
         for (dtcr = to->first_casting_rule; dtcr; dtcr = dtcr->next_casting_rule) {
             if (Str::len(dtcr->cast_from_kind_unparsed) > 0) {
                 dtcr->cast_from_kind =
-                    KindConstructors::parse(dtcr->cast_from_kind_unparsed);
+                    KindConstructors::parse(dtcr->cast_from_kind_unparsed);
                 Str::clear(dtcr->cast_from_kind_unparsed);
             }
             if (from == dtcr->cast_from_kind)
@@ -602,55 +627,65 @@ group) which it's an instance of: value, word value, arithmetic value, and so on
     return FALSE;
 }
 
-

§19. Each constructor has a list of other constructors (all of the BASE_CONSTRUCTOR_GRP +

§20. Each constructor has a list of other constructors (all of the BASE_CONSTRUCTOR_GRP group or PROPER_CONSTRUCTOR_GRP) which it can cast to.

-int KindConstructors::find_instance(kind_constructor *from, kind_constructor *to) {
-    kind_constructor_instance *dti;
+int KindConstructors::find_instance(kind_constructor *from, kind_constructor *to) {
+    kind_constructor_instance_rule *dti;
     for (dti = from->first_instance_rule; dti; dti = dti->next_instance_rule) {
         if (Str::len(dti->instance_of_this_unparsed) > 0) {
             dti->instance_of_this =
-                KindConstructors::parse(dti->instance_of_this_unparsed);
+                KindConstructors::parse(dti->instance_of_this_unparsed);
             Str::clear(dti->instance_of_this_unparsed);
         }
         if (dti->instance_of_this == to) return TRUE;
-        if (KindConstructors::find_instance(dti->instance_of_this, to)) return TRUE;
+        if (KindConstructors::find_instance(dti->instance_of_this, to)) return TRUE;
     }
     return FALSE;
 }
 
-

§20. Compatibility. The following tests if from is compatible with to. +

§21. Each constructor has a list of explicitly-named instances from the Neptune +file creating it (if any were: by default this will be empty):

-int KindConstructors::compatible(kind_constructor *from, kind_constructor *to,
+linked_list *KindConstructors::instances(kind_constructor *kc) {
+    if (kc == NULL) return FALSE;
+    return kc->instances;
+}
+
+

§22. Compatibility. The following tests if from is compatible with to. +

+ +
+int KindConstructors::compatible(kind_constructor *from, kind_constructor *to,
     int allow_casts) {
     if (to == from) return TRUE;
     if ((to == NULL) || (from == NULL)) return FALSE;
-    if ((allow_casts) && (KindConstructors::find_cast(from, to))) return TRUE;
-    if (KindConstructors::find_instance(from, to)) return TRUE;
+    if ((allow_casts) && (KindConstructors::find_cast(from, to))) return TRUE;
+    if (KindConstructors::find_instance(from, to)) return TRUE;
     return FALSE;
 }
 
-

§21. And more elaborately: +

§23. And more elaborately:

-int KindConstructors::uses_block_values(kind_constructor *con) {
+int KindConstructors::uses_block_values(kind_constructor *con) {
     if (con == NULL) return FALSE;
-    if ((KindConstructors::is_definite(con)) &&
-        (KindConstructors::compatible(con, Kinds::get_construct(K_pointer_value), FALSE)))
+    if ((KindConstructors::is_definite(con)) &&
+        (KindConstructors::compatible(con, Kinds::get_construct(K_pointer_value), FALSE)))
             return TRUE;
     return FALSE;
 }
 
 int KindConstructors::allow_word_as_pointer(kind_constructor *left,
     kind_constructor *right) {
-    if (KindConstructors::uses_block_values(left) == FALSE) return FALSE;
-    if (KindConstructors::uses_block_values(right) == TRUE) return FALSE;
-    if (KindConstructors::compatible(right, left, TRUE)) return TRUE;
+    if (KindConstructors::uses_block_values(left) == FALSE) return FALSE;
+    if (KindConstructors::uses_block_values(right) == TRUE) return FALSE;
+    if (KindConstructors::compatible(right, left, TRUE)) return TRUE;
     return FALSE;
 }
 
diff --git a/docs/kinds-module/4-mcr.html b/docs/kinds-module/4-mcr.html index 1144a60fd..0bfa359c3 100644 --- a/docs/kinds-module/4-mcr.html +++ b/docs/kinds-module/4-mcr.html @@ -80,7 +80,7 @@ function togglePopup(material_id) { return tmd; } -kind_macro_definition *NeptuneMacros::parse_name(text_stream *name) { +kind_macro_definition *NeptuneMacros::parse_name(text_stream *name) { kind_macro_definition *tmd; LOOP_OVER(tmd, kind_macro_definition) if (Str::eq(name, tmd->kind_macro_name)) @@ -121,7 +121,7 @@ commands in sequence to the relevant kind.

-void NeptuneMacros::play_back(kind_macro_definition *macro,
+void NeptuneMacros::play_back(kind_macro_definition *macro,
     kind_constructor *con, text_file_position *tfp) {
     if (macro == NULL) NeptuneFiles::error(NULL, I"no such kind macro to play back", tfp);
     LOGIF(KIND_CREATIONS, "Macro %S on %S (%d lines)\n",
diff --git a/docs/kinds-module/4-nf.html b/docs/kinds-module/4-nf.html
index 24c290ae2..7a55c458a 100644
--- a/docs/kinds-module/4-nf.html
+++ b/docs/kinds-module/4-nf.html
@@ -107,7 +107,7 @@ the Inform GUI can at least display them, if not very elegantly.
 

-void NeptuneFiles::error(text_stream *command, text_stream *error,
+void NeptuneFiles::error(text_stream *command, text_stream *error,
     text_file_position *tfp) {
     TEMPORARY_TEXT(E)
     if (tfp)
diff --git a/docs/kinds-module/4-ns.html b/docs/kinds-module/4-ns.html
index 48e321845..ae5dffbe6 100644
--- a/docs/kinds-module/4-ns.html
+++ b/docs/kinds-module/4-ns.html
@@ -120,6 +120,7 @@ function togglePopup(material_id) {
 enum specification_text_KCC
 enum small_block_size_KCC
 enum terms_KCC
+enum instance_KCC
 
 kind_command_definition table_of_kind_commands[] = {
@@ -160,6 +161,8 @@ function togglePopup(material_id) {
 
     { "invent-source-text",             invent_source_text_KCC,             TEMPLATE_KCA },
 
+    { "instance",                       instance_KCC,                       TEXT_KCA },
+
     { "apply-macro",                    apply_macro_KCC,                    MACRO_KCA },
 
     { NULL, -1, NO_KCA }
@@ -297,7 +300,7 @@ function togglePopup(material_id) {
     if ((do_know == TRUE) && (should_know == FALSE))
         NeptuneFiles::error(whole_command, I"kind command describes already-known kind", tfp);
     constructor_described =
-        KindConstructors::new(Kinds::get_construct(K_value), name, NULL, group);
+        KindConstructors::new(Kinds::get_construct(K_value), name, NULL, group);
     #ifdef NEW_BASE_KINDS_CALLBACK
     if ((constructor_described != CON_KIND_VARIABLE) &&
         (constructor_described != CON_INTERMEDIATE)) {
diff --git a/docs/kinds-module/4-st.html b/docs/kinds-module/4-st.html
index 7c742691e..f08c6c2b6 100644
--- a/docs/kinds-module/4-st.html
+++ b/docs/kinds-module/4-st.html
@@ -282,9 +282,9 @@ not matter, since such things never come into kind definitions.
 void StarTemplates::transcribe_constructor_name(OUTPUT_STREAM, kind_constructor *con,
     int lower_case) {
     wording W = EMPTY_WORDING;
-    if (con->dt_tag) W = KindConstructors::get_name(con, FALSE);
+    if (con->dt_tag) W = KindConstructors::get_name(con, FALSE);
     if (Wordings::nonempty(W)) {
-        if (KindConstructors::arity(con) > 0) {
+        if (KindConstructors::arity(con) > 0) {
             int full_length = Wordings::length(W);
             int i, w1 = Wordings::first_wn(W);
             for (i=0; i<full_length; i++) {
diff --git a/docs/knowledge-module/1-ap.html b/docs/knowledge-module/1-ap.html
index 986521610..44cbf196d 100644
--- a/docs/knowledge-module/1-ap.html
+++ b/docs/knowledge-module/1-ap.html
@@ -95,7 +95,7 @@ subject is supplied to stand as \(x\), the thing the proposition is discussing.
 

-void Assert::true(pcalc_prop *prop, int certitude) {
+void Assert::true(pcalc_prop *prop, int certitude) {
     Assert::inner(prop, NULL, certitude);
 }
 
diff --git a/docs/knowledge-module/2-ins.html b/docs/knowledge-module/2-ins.html
index 3565bab09..cba7f79f2 100644
--- a/docs/knowledge-module/2-ins.html
+++ b/docs/knowledge-module/2-ins.html
@@ -64,7 +64,7 @@ function togglePopup(material_id) {
     
 

To manage constant values of enumerated kinds or kinds of object.

-
+

§1. Instances are named constants giving a finite range of possible values of a kind,1 where these are chosen by the author.2 Instances are can have @@ -124,7 +124,7 @@ hierarchy. See Instances::to_kind

 instance *latest_instance = NULL;
 
-instance *Instances::latest(void) {
+instance *Instances::latest(void) {
     return latest_instance;
 }
 
@@ -132,7 +132,7 @@ hierarchy. See Instances::to_kind

-instance *Instances::new(wording W, kind *K) {
+instance *Instances::new(wording W, kind *K) {
     PROTECTED_MODEL_PROCEDURE;
     Simplify the initial kind of the instance4.1;
     instance *I = CREATE(instance);
@@ -208,12 +208,12 @@ be done later on: see Ins
 

§5. Name and number.

-wording Instances::get_name(instance *I, int plural) {
+wording Instances::get_name(instance *I, int plural) {
     if ((I == NULL) || (I->as_noun == NULL)) return EMPTY_WORDING;
     return Nouns::nominative(I->as_noun, plural);
 }
 
-wording Instances::get_name_in_play(instance *I, int plural) {
+wording Instances::get_name_in_play(instance *I, int plural) {
     if ((I == NULL) || (I->as_noun == NULL)) return EMPTY_WORDING;
     return Nouns::nominative_in_language(I->as_noun, plural,
         Projects::get_language_of_play(Task::project()));
@@ -223,7 +223,7 @@ be done later on: see Ins
     return I->as_noun;
 }
 
-int Instances::get_numerical_value(instance *I) {
+int Instances::get_numerical_value(instance *I) {
     return I->enumeration_index;
 }
 
@@ -243,7 +243,7 @@ be done later on: see Ins
 

§6. Subject and source references.

-inference_subject *Instances::as_subject(instance *I) {
+inference_subject *Instances::as_subject(instance *I) {
     if (I == NULL) return NULL;
     return I->as_subject;
 }
@@ -276,7 +276,7 @@ and the property "colour", whose names coincide:
 

-void Instances::make_kind_coincident(kind *K, property *P) {
+void Instances::make_kind_coincident(kind *K, property *P) {
     Properties::mark_kind_as_having_same_name_as(K, P);
     Instances::update_adjectival_forms(P);
     if (Kinds::eq(K, K_grammatical_gender)) P_grammatical_gender = P;
@@ -294,7 +294,7 @@ use of colour turns up subsequently, e.g., in response to:
 
-void Instances::update_adjectival_forms(property *P) {
+void Instances::update_adjectival_forms(property *P) {
     if (Properties::is_either_or(P) == TRUE) return;
     kind *K = ValueProperties::kind(P);
     if (P == Properties::property_with_same_name_as(K)) {
@@ -314,7 +314,7 @@ turns up subsequently, e.g., in response to
 
 
 
-void Instances::register_as_adjectival_constant(instance *I, property *P) {
+void Instances::register_as_adjectival_constant(instance *I, property *P) {
     property_permission *pp;
     LOOP_OVER_PERMISSIONS_FOR_PROPERTY(pp, P) {
         inference_subject *infs = PropertyPermissions::get_subject(pp);
@@ -340,13 +340,13 @@ specialised than which other ones, and by making a call, we can find out.
 

-kind *Instances::to_kind(instance *I) {
+kind *Instances::to_kind(instance *I) {
     if (I == NULL) return NULL;
     inference_subject *inherits_from = InferenceSubjects::narrowest_broader_subject(I->as_subject);
     return KindSubjects::to_kind(inherits_from);
 }
 
-int Instances::of_kind(instance *I, kind *match) {
+int Instances::of_kind(instance *I, kind *match) {
     if ((I == NULL) || (match == NULL)) return FALSE;
     return Kinds::conforms_to(Instances::to_kind(I), match);
 }
@@ -358,7 +358,7 @@ are allowed to refine it. Such revisions are allowed to specialise the kind
 

-void Instances::set_kind(instance *I, kind *new) {
+void Instances::set_kind(instance *I, kind *new) {
     PROTECTED_MODEL_PROCEDURE;
     if (I == NULL) {
         LOG("Tried to set kind to %u\n", new);
@@ -447,16 +447,55 @@ so we keep track of them here.
     return grammatical_genders[g-1];
 }
 
-void Instances::new_grammatical(instance *I) {
+void Instances::new_grammatical(instance *I) {
     if (no_ggs_recorded < NO_GRAMMATICAL_GENDERS)
         grammatical_genders[no_ggs_recorded++] = I;
 }
 
-

§15. Logging.

+

§15. Instances specified in Neptune files.

+ +
+void Instances::make_instances_from_Neptune(void) {
+    kind_constructor *kc;
+    LOOP_OVER(kc, kind_constructor) {
+        linked_list *L = KindConstructors::instances(kc);
+        kind_constructor_instance *kci;
+        inter_ti current_val = 1;
+        int first_val = TRUE;
+        LOOP_OVER_LINKED_LIST(kci, kind_constructor_instance, L) {
+            wording W = Feeds::feed_text(kci->natural_language_name);
+            kind *K = Kinds::base_construction(kc);
+            pcalc_prop *prop = Propositions::Abstract::to_create_something(K, W);
+            Assert::true(prop, CERTAIN_CE);
+            instance *I = Instances::latest();
+            if (kci->value_specified) {
+                if ((current_val >= (inter_ti) kci->value) && (first_val == FALSE)) {
+                    Problems::quote_object(1, I);
+                    Problems::quote_kind(2, K);
+                    StandardProblems::handmade_problem(Task::syntax_tree(), _p_(Untestable));
+                    Problems::issue_problem_segment(
+                        "A kit defined an instance %1 of a kind called %2, but this "
+                        "has a numerical value which is equal to or greater than that "
+                        "of its predecessor. Instances in a kit have to be defined "
+                        "in evaluation order.");
+                    Problems::issue_problem_end();
+                }
+                current_val = (inter_ti) kci->value;
+            }
+            RTKindConstructors::set_explicit_runtime_instance_value(K, I, current_val);
+            RTInstances::set_translation(I, kci->identifier);
+             LOG("From kit: %W = %S = %d -> $O\n", W, kci->identifier, current_val, I);
+            current_val++;
+            first_val = FALSE;
+        }
+    }
+}
+
+

§16. Logging.

 void Instances::log(instance *I) {
-    Instances::write(DL, I);
+    Instances::write(DL, I);
 }
 
 void Instances::write(OUTPUT_STREAM, instance *I) {
@@ -470,7 +509,7 @@ so we keep track of them here.
     }
 }
 
-

§16. Writer.

+

§17. Writer.

 void Instances::writer(OUTPUT_STREAM, char *format_string, void *vI) {
@@ -478,8 +517,8 @@ so we keep track of them here.
     if (I == NULL) WRITE("nothing");
     else switch (format_string[0]) {
         case 'I':  bare %I means the same as %+I, so fall through to...
-        case '+': Write the instance raw16.1; break;
-        case '-': Write the instance with normalised casing16.2; break;
+        case '+': Write the instance raw17.1; break;
+        case '-': Write the instance with normalised casing17.2; break;
         case '~': {
             inter_name *N = RTInstances::value_iname(I);
             if (Str::len(NounIdentifiers::identifier(I->as_noun)) > 0)
@@ -491,7 +530,7 @@ so we keep track of them here.
     }
 }
 
-

§16.1. Write the instance raw16.1 = +

§17.1. Write the instance raw17.1 =

@@ -504,8 +543,8 @@ so we keep track of them here.
         if (Wordings::nonempty(W)) WRITE("%+W", W);
     }
 
-
  • This code is used in §16.
-

§16.2. Write the instance with normalised casing16.2 = +

  • This code is used in §17.
+

§17.2. Write the instance with normalised casing17.2 =

@@ -518,7 +557,7 @@ so we keep track of them here.
         if (Wordings::nonempty(W)) WRITE("%W", W);
     }
 
-
  • This code is used in §16.
+
  • This code is used in §17.
diff --git a/docs/knowledge-module/4-ks.html b/docs/knowledge-module/4-ks.html index 403102d4a..e9f3e83f2 100644 --- a/docs/knowledge-module/4-ks.html +++ b/docs/knowledge-module/4-ks.html @@ -123,7 +123,7 @@ a little trickier than for other subject families: return K->construct->base_as_infs; } -kind *KindSubjects::to_kind(inference_subject *infs) { +kind *KindSubjects::to_kind(inference_subject *infs) { if ((infs) && (infs->infs_family == kinds_family)) { kind *K = Kinds::base_construction( RETRIEVE_POINTER_kind_constructor(infs->represents)); @@ -179,6 +179,12 @@ concerning our kind.
 void KindSubjects::new_permission_granted(inference_subject_family *f,
     inference_subject *from, property_permission *pp) {
+    kind *K = KindSubjects::to_kind(from);
+    if (RTKindConstructors::is_nonstandard_enumeration(K))
+        StandardProblems::sentence_problem(Task::syntax_tree(),
+            _p_(Untestable),
+            "this kind cannot have properties",
+            "since it is an enumeration provided by a kit.");
     RTPropertyPermissions::new_storage(pp);
 }
 
diff --git a/docs/lexicon-module/2-em.html b/docs/lexicon-module/2-em.html index 1349855ac..4e3155a54 100644 --- a/docs/lexicon-module/2-em.html +++ b/docs/lexicon-module/2-em.html @@ -209,7 +209,7 @@ as yet. int i = 0; excerpt_meaning *em; LOOP_OVER(em, excerpt_meaning) - LOG("%02d: %08x $M\n", i++, (pointer_sized_int) em, em); + LOG("%02d: $M\n", i++, em); }

§7. Hashing excerpts. For excerpts (w1, w2), we need a form of hash function which makes it diff --git a/docs/lexicon-module/P-wtmd.html b/docs/lexicon-module/P-wtmd.html index 5a53509ce..15b8412d1 100644 --- a/docs/lexicon-module/P-wtmd.html +++ b/docs/lexicon-module/P-wtmd.html @@ -181,21 +181,21 @@ than the number with correct ones number of successes.

-Size of lexicon: 3127 excerpt meanings
-  Stored among 845 words out of total vocabulary of 10732
-  715 words have a start list: longest belongs to report (with 293 meanings)
+Size of lexicon: 3129 excerpt meanings
+  Stored among 846 words out of total vocabulary of 10735
+  716 words have a start list: longest belongs to report (with 293 meanings)
   15 words have an end list: longest belongs to case (with 6 meanings)
   29 words have a middle list: longest belongs to to (with 4 meanings)
   108 words have a subset list: longest belongs to street (with 4 meanings)
 
-Number of attempts to retrieve: 110340
-  of which unsuccessful: 92203
-  of which successful: 18137
+Number of attempts to retrieve: 110344
+  of which unsuccessful: 92205
+  of which successful: 18139
 
-Total attempts to match against excerpt meanings: 276468
-  of which, total with incorrect hash codes: 253733
-  of which, total with correct hash codes: 22735
-  of which, total which matched: 19904
+Total attempts to match against excerpt meanings: 276472
+  of which, total with incorrect hash codes: 253735
+  of which, total with correct hash codes: 22737
+  of which, total which matched: 19906
 
-inter_symbol *RunningPipelines::get_symbol(pipeline_step *step, int id) {
+inter_symbol *RunningPipelines::get_symbol(pipeline_step *step, int id) {
     if ((id < 0) || (id >= MAX_RPSYM)) internal_error("bad ID");
     if (step == NULL) internal_error("no step");
     inter_tree *I = step->ephemera.tree;
diff --git a/docs/pipeline-module/4-tsk.html b/docs/pipeline-module/4-tsk.html
index 9d894db57..27caa7b2f 100644
--- a/docs/pipeline-module/4-tsk.html
+++ b/docs/pipeline-module/4-tsk.html
@@ -159,6 +159,7 @@ comprehensive list of what is there.)
 enum GPROPERTY_HL
 enum HASHLISTRELATIONHANDLER_HL
 enum I7SFRAME_HL
+enum INDEX_OF_ENUM_VAL_HL
 enum INTEGERDIVIDE_HL
 enum INTEGERREMAINDER_HL
 enum KINDATOMIC_HL
@@ -175,6 +176,7 @@ comprehensive list of what is there.)
 enum MSTVO_HL
 enum MSTVON_HL
 enum NAME_HL
+enum NEXT_ENUM_VAL_HL
 enum NOTHING_HL
 enum NUMBER_TY_ABS_HL
 enum NUMBER_TY_TO_REAL_NUMBER_TY_HL
@@ -182,12 +184,14 @@ comprehensive list of what is there.)
 enum PACKED_TEXT_STORAGE_HL
 enum PARACONTENT_HL
 enum PARAMETER_VALUE_HL
+enum PREV_ENUM_VAL_HL
 enum PRINTORRUN_HL
 enum PRIOR_NAMED_LIST_GENDER_HL
 enum PRIOR_NAMED_LIST_HL
 enum PRIOR_NAMED_NOUN_HL
 enum PROPERTY_LOOP_SIGN_HL
 enum PROPERTY_TO_BE_TOTALLED_HL
+enum RANDOM_ENUM_VAL_HL
 enum REAL_NUMBER_TY_ABS_HL
 enum REAL_NUMBER_TY_APPROXIMATE_HL
 enum REAL_NUMBER_TY_COMPARE_HL
@@ -305,6 +309,7 @@ comprehensive list of what is there.)
     KIT_PROVIDED(GPROPERTY_HL,                        I"GProperty")
     KIT_PROVIDED(HASHLISTRELATIONHANDLER_HL,          I"HashListRelationHandler")
     KIT_PROVIDED(I7SFRAME_HL,                         I"I7SFRAME")
+    KIT_PROVIDED(INDEX_OF_ENUM_VAL_HL,                I"IndexOfEnumVal");
     KIT_PROVIDED(INTEGERDIVIDE_HL,                    I"IntegerDivide")
     KIT_PROVIDED(INTEGERREMAINDER_HL,                 I"IntegerRemainder")
     KIT_PROVIDED(KINDATOMIC_HL,                       I"KindAtomic")
@@ -321,6 +326,7 @@ comprehensive list of what is there.)
     KIT_PROVIDED(MSTVO_HL,                            I"MstVO")
     KIT_PROVIDED(MSTVON_HL,                           I"MstVON")
     KIT_PROVIDED(NAME_HL,                             I"name")
+    KIT_PROVIDED(NEXT_ENUM_VAL_HL,                    I"NextEnumVal");
     KIT_PROVIDED(NOTHING_HL,                          I"nothing")
     KIT_PROVIDED(NUMBER_TY_ABS_HL,                    I"NUMBER_TY_Abs")
     KIT_PROVIDED(NUMBER_TY_TO_REAL_NUMBER_TY_HL,      I"NUMBER_TY_to_REAL_NUMBER_TY")
@@ -328,12 +334,14 @@ comprehensive list of what is there.)
     KIT_PROVIDED(PACKED_TEXT_STORAGE_HL,              I"PACKED_TEXT_STORAGE")
     KIT_PROVIDED(PARACONTENT_HL,                      I"ParaContent")
     KIT_PROVIDED(PARAMETER_VALUE_HL,                  I"parameter_value")
+    KIT_PROVIDED(PREV_ENUM_VAL_HL,                    I"PrevEnumVal");
     KIT_PROVIDED(PRINTORRUN_HL,                       I"PrintOrRun")
     KIT_PROVIDED(PRIOR_NAMED_LIST_GENDER_HL,          I"prior_named_list_gender")
     KIT_PROVIDED(PRIOR_NAMED_LIST_HL,                 I"prior_named_list")
     KIT_PROVIDED(PRIOR_NAMED_NOUN_HL,                 I"prior_named_noun")
     KIT_PROVIDED(PROPERTY_LOOP_SIGN_HL,               I"property_loop_sign")
     KIT_PROVIDED(PROPERTY_TO_BE_TOTALLED_HL,          I"property_to_be_totalled")
+    KIT_PROVIDED(RANDOM_ENUM_VAL_HL,                  I"RandomEnumVal");
     KIT_PROVIDED(REAL_NUMBER_TY_ABS_HL,               I"REAL_NUMBER_TY_Abs")
     KIT_PROVIDED(REAL_NUMBER_TY_APPROXIMATE_HL,       I"REAL_NUMBER_TY_Approximate")
     KIT_PROVIDED(REAL_NUMBER_TY_COMPARE_HL,           I"REAL_NUMBER_TY_Compare")
diff --git a/docs/pipeline-module/5-knd.html b/docs/pipeline-module/5-knd.html
index b8a922d6c..628a81b23 100644
--- a/docs/pipeline-module/5-knd.html
+++ b/docs/pipeline-module/5-knd.html
@@ -85,16 +85,17 @@ the list inv->derived_kind
         InterNodeList::array_sort(inv->derived_kind_nodes, MakeSynopticModuleStage::module_order);
     Define BASE_KIND_HWM1.2;
     Define DEFAULTVALUEFINDER function1.3;
-    Define DEFAULTVALUEOFKOV function1.4;
-    Define PRINTKINDVALUEPAIR function1.5;
-    Define KOVCOMPARISONFUNCTION function1.6;
-    Define KOVDOMAINSIZE function1.7;
-    Define KOVISBLOCKVALUE function1.8;
-    Define I7_KIND_NAME function1.9;
-    Define KOVSUPPORTFUNCTION function1.10;
-    Define SHOWMEKINDDETAILS function1.11;
-    Define RUCKSACK_CLASS constant1.12;
-    Define KINDHIERARCHY array1.13;
+    Define VALUESFINDER function1.4;
+    Define DEFAULTVALUEOFKOV function1.5;
+    Define PRINTKINDVALUEPAIR function1.6;
+    Define KOVCOMPARISONFUNCTION function1.7;
+    Define KOVDOMAINSIZE function1.8;
+    Define KOVISBLOCKVALUE function1.9;
+    Define I7_KIND_NAME function1.10;
+    Define KOVSUPPORTFUNCTION function1.11;
+    Define SHOWMEKINDDETAILS function1.12;
+    Define RUCKSACK_CLASS constant1.13;
+    Define KINDHIERARCHY array1.14;
 }
 

§1.1. Each base kind package contains a numeric constant with the symbol name strong_id. @@ -166,12 +167,46 @@ or higher is therefore that of a derived kind. Synoptic::end_function(I, step, iname);

  • This code is used in §1.
-

§1.4. DefaultValueOfKOV(K) returns the default value for kind K: it's needed, +

§1.4. Define VALUESFINDER function1.4 = +

+ +
+    inter_name *iname = HierarchyLocations::iname(I, VALUESFINDER_HL);
+    Synoptic::begin_function(I, iname);
+    inter_symbol *k_s = Synoptic::local(I, I"k", NULL);
+    for (int i=0; i<InterNodeList::array_len(inv->kind_nodes); i++) {
+        inter_package *pack =
+            PackageInstruction::at_this_head(inv->kind_nodes->list[i].node);
+        inter_symbol *ea_s = Metadata::optional_symbol(pack, I"^enumeration_array");
+        if (ea_s) {
+            inter_symbol *id_s = Metadata::required_symbol(pack, I"^strong_id");
+            Produce::inv_primitive(I, IF_BIP);
+            Produce::down(I);
+                Produce::inv_primitive(I, EQ_BIP);
+                Produce::down(I);
+                    Produce::val_symbol(I, K_value, k_s);
+                    Produce::val_symbol(I, K_value, id_s);
+                Produce::up(I);
+                Produce::code(I);
+                Produce::down(I);
+                    Produce::inv_primitive(I, RETURN_BIP);
+                    Produce::down(I);
+                        Produce::val_symbol(I, K_value, ea_s);
+                    Produce::up(I);
+                Produce::up(I);
+            Produce::up(I);
+        }
+    }
+    Produce::rfalse(I);
+    Synoptic::end_function(I, step, iname);
+
+
  • This code is used in §1.
+

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

-

Define DEFAULTVALUEOFKOV function1.4 = +

Define DEFAULTVALUEOFKOV function1.5 =

@@ -219,10 +254,10 @@ which have to be given some type-safe value to start out at.
     Synoptic::end_function(I, step, iname);
 
  • This code is used in §1.
-

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

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

-

Define PRINTKINDVALUEPAIR function1.5 = +

Define PRINTKINDVALUEPAIR function1.6 =

@@ -245,8 +280,7 @@ which have to be given some type-safe value to start out at.
         Produce::down(I);
         for (int i=0; i<InterNodeList::array_len(inv->kind_nodes); i++) {
             inter_package *pack = PackageInstruction::at_this_head(inv->kind_nodes->list[i].node);
-            if ((Metadata::read_optional_numeric(pack, I"^is_base")) &&
-                (Metadata::optional_symbol(pack, I"^print_fn")) &&
+            if ((Metadata::optional_symbol(pack, I"^print_fn")) &&
                 (Metadata::read_optional_numeric(pack, I"^is_subkind_of_object") == FALSE)) {
                 inter_symbol *id_s = Metadata::required_symbol(pack, I"^strong_id");
                 inter_symbol *print_fn_s = Metadata::required_symbol(pack, I"^print_fn");
@@ -278,7 +312,7 @@ which have to be given some type-safe value to start out at.
     Synoptic::end_function(I, step, iname);
 
  • This code is used in §1.
-

§1.6. KOVComparisonFunction(K) returns either the address of a function to +

§1.7. KOVComparisonFunction(K) returns either the address of a function to perform a comparison between two values, or else 0 to signal that no special sort of comparison is needed. (In which case signed numerical comparison will be used.) The function F may be used in a sorting algorithm, @@ -287,7 +321,7 @@ so it must have no side-effects. Define KOVCOMPARISONFUNCTION function1.6 = +

Define KOVCOMPARISONFUNCTION function1.7 =

@@ -331,7 +365,7 @@ unless the two values are genuinely equal.
     Synoptic::end_function(I, step, iname);
 
  • This code is used in §1.
-

§1.7. Define KOVDOMAINSIZE function1.7 = +

§1.8. Define KOVDOMAINSIZE function1.8 =

@@ -375,11 +409,11 @@ unless the two values are genuinely equal.
     Synoptic::end_function(I, step, iname);
 
  • This code is used in §1.
-

§1.8. KOVIsBlockValue(k) is true if and only if k is the (strong or weak) ID of +

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

-

Define KOVISBLOCKVALUE function1.8 = +

Define KOVISBLOCKVALUE function1.9 =

@@ -421,7 +455,7 @@ a kind storing pointers to blocks of data.
     Synoptic::end_function(I, step, iname);
 
  • This code is used in §1.
-

§1.9. Define I7_KIND_NAME function1.9 = +

§1.10. Define I7_KIND_NAME function1.10 =

@@ -453,12 +487,12 @@ a kind storing pointers to blocks of data.
     Synoptic::end_function(I, step, iname);
 
  • This code is used in §1.
-

§1.10. KOVSupportFunction(K) returns the address of the specific support function +

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

-

Define KOVSUPPORTFUNCTION function1.10 = +

Define KOVSUPPORTFUNCTION function1.11 =

@@ -518,7 +552,7 @@ such a function does, see "BlockValues.i6t".
     Synoptic::end_function(I, step, iname);
 
  • This code is used in §1.
-

§1.11. Define SHOWMEKINDDETAILS function1.11 = +

§1.12. Define SHOWMEKINDDETAILS function1.12 =

@@ -552,7 +586,7 @@ such a function does, see "BlockValues.i6t".
     Synoptic::end_function(I, step, iname);
 
  • This code is used in §1.
-

§1.12. This goes right back to a curious feature of Inform 1, in 1993. To enable +

§1.13. This goes right back to a curious feature of Inform 1, in 1993. To enable the use of player's holdalls, we must declare a constant RUCKSACK_CLASS to tell some code in WorldModelKit to use possessions with this Inter class as the rucksack pro tem. This is all a bit of a hack, and isn't really fully @@ -560,7 +594,7 @@ general: only the player has the benefit of a "player's holdall" (hence the name), with other actors oblivious.

-

Define RUCKSACK_CLASS constant1.12 = +

Define RUCKSACK_CLASS constant1.13 =

@@ -579,7 +613,7 @@ name), with other actors oblivious.
     if (found == FALSE) Produce::numeric_constant(I, iname, K_value, 0);
 
  • This code is used in §1.
-

§1.13. The kind inheritance tree is represented by an array providing metadata on +

§1.14. The kind inheritance tree is represented by an array providing metadata on the kinds of object: there are just two words per kind — the class, then the instance count for its own kind. For instance, "door" is usually kind number 4, so it occupies record 4 in this array — words 8 and 9. Word @@ -587,7 +621,7 @@ kind number 4, so it occupies record 4 in this array — words 8 and 9. Word "thing". This tells us that a door is a kind of thing.

-

Define KINDHIERARCHY array1.13 = +

Define KINDHIERARCHY array1.14 =

@@ -634,7 +668,7 @@ kind number 4, so it occupies record 4 in this array — words 8 and 9. Word
 

§2.

-inter_ti SynopticKinds::kind_of_object_count(pipeline_step *step, inter_symbol *kind_name) {
+inter_ti SynopticKinds::kind_of_object_count(pipeline_step *step, inter_symbol *kind_name) {
     if ((kind_name == NULL) ||
         (kind_name == RunningPipelines::get_symbol(step, object_kind_RPSYM))) return 0;
     int N = SymbolAnnotation::get_i(kind_name, OBJECT_KIND_COUNTER_IANN);
diff --git a/docs/pipeline-module/5-sh.html b/docs/pipeline-module/5-sh.html
index d1a77c016..9d8afabd9 100644
--- a/docs/pipeline-module/5-sh.html
+++ b/docs/pipeline-module/5-sh.html
@@ -59,7 +59,7 @@ function togglePopup(material_id) {
     
 

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

-
+

§1. This section gives a map of what resources will be made in the synoptic module. The definitions here enable code generated by inform7 or inter @@ -254,6 +254,7 @@ fuller explanation.

enum DEFAULTVALUEOFKOV_HL
 enum DEFAULTVALUEFINDER_HL
+enum VALUESFINDER_HL
 enum PRINTKINDVALUEPAIR_HL
 enum KOVCOMPARISONFUNCTION_HL
 enum KOVDOMAINSIZE_HL
@@ -273,6 +274,7 @@ fuller explanation.
         SYN_CONST(BASE_KIND_HWM_HL,               I"BASE_KIND_HWM")
         SYN_FUNCT(DEFAULTVALUEOFKOV_HL,           I"defaultvalue_fn", I"DefaultValueOfKOV")
         SYN_FUNCT(DEFAULTVALUEFINDER_HL,          I"defaultvaluefinder_fn", I"DefaultValueFinder")
+        SYN_FUNCT(VALUESFINDER_HL,                I"valuesfinder_fn", I"ValuesFinder")
         SYN_FUNCT(PRINTKINDVALUEPAIR_HL,          I"printkindvaluepair_fn", I"PrintKindValuePair")
         SYN_FUNCT(KOVCOMPARISONFUNCTION_HL,       I"comparison_fn", I"KOVComparisonFunction")
         SYN_FUNCT(KOVDOMAINSIZE_HL,               I"domainsize_fn", I"KOVDomainSize")
@@ -453,6 +455,18 @@ fuller explanation.
         SYN_CONST(USE_OPTION_VALUES_HL,           I"USE_OPTION_VALUES")
 
  • This code is used in §1.
+

§2. Synoptic printing functions.

+ +
+#ifdef CORE_MODULE
+inter_name *SynopticHierarchy::printing_function_iname(inter_tree *I, kind *K) {
+    if (Kinds::eq(K, K_use_option)) return HierarchyLocations::iname(I, PRINT_USE_OPTION_HL);
+    if (Kinds::eq(K, K_table)) return HierarchyLocations::iname(I, PRINT_TABLE_HL);
+    if (Kinds::eq(K, K_response)) return HierarchyLocations::iname(I, PRINT_RESPONSE_HL);
+    return NULL;
+}
+#endif
+
diff --git a/docs/pipeline-module/5-su.html b/docs/pipeline-module/5-su.html index 8a93855aa..51caeb744 100644 --- a/docs/pipeline-module/5-su.html +++ b/docs/pipeline-module/5-su.html @@ -91,6 +91,10 @@ does exist, it must have a definition, and we return that.

+inter_symbol *Synoptic::get_optional_symbol(inter_package *pack, text_stream *name) {
+    return InterSymbolsTable::symbol_from_name(InterPackage::scope(pack), name);
+}
+
 inter_tree_node *Synoptic::get_optional_definition(inter_package *pack, text_stream *name) {
     inter_symbol *def_s = InterSymbolsTable::symbol_from_name(InterPackage::scope(pack), name);
     if (def_s == NULL) return NULL;
@@ -122,10 +126,10 @@ does exist, it must have a definition, and we return that.
 
 inter_package *synoptic_fn_package = NULL;
 packaging_state synoptic_fn_ps;
-void Synoptic::begin_function(inter_tree *I, inter_name *iname) {
+void Synoptic::begin_function(inter_tree *I, inter_name *iname) {
     synoptic_fn_package = Produce::function_body(I, &synoptic_fn_ps, iname);
 }
-void Synoptic::end_function(inter_tree *I, pipeline_step *step, inter_name *iname) {
+void Synoptic::end_function(inter_tree *I, pipeline_step *step, inter_name *iname) {
     Produce::end_function_body(I);
     Packaging::exit(I, synoptic_fn_ps);
 }
@@ -134,7 +138,7 @@ does exist, it must have a definition, and we return that.
 

-inter_symbol *Synoptic::local(inter_tree *I, text_stream *name, text_stream *comment) {
+inter_symbol *Synoptic::local(inter_tree *I, text_stream *name, text_stream *comment) {
     return Produce::local(I, K_value, name, comment);
 }
 
@@ -144,7 +148,7 @@ does exist, it must have a definition, and we return that. inter_tree_node *synoptic_array_node = NULL; packaging_state synoptic_array_ps; -void Synoptic::begin_array(inter_tree *I, pipeline_step *step, inter_name *iname) { +void Synoptic::begin_array(inter_tree *I, pipeline_step *step, inter_name *iname) { Synoptic::begin_array_inner(I, step, iname, CONST_LIST_FORMAT_WORDS); } @@ -168,7 +172,7 @@ does exist, it must have a definition, and we return that. (inter_ti) InterBookmark::baseline(Packaging::at(I)) + 1); } -void Synoptic::end_array(inter_tree *I) { +void Synoptic::end_array(inter_tree *I) { inter_error_message *E = VerifyingInter::instruction( InterBookmark::package(Packaging::at(I)), synoptic_array_node); if (E) { @@ -183,12 +187,12 @@ does exist, it must have a definition, and we return that.

-void Synoptic::numeric_entry(inter_ti N) {
+void Synoptic::numeric_entry(inter_ti N) {
     Inode::extend_instruction_by(synoptic_array_node, 2);
     InterValuePairs::set(synoptic_array_node, synoptic_array_node->W.extent-2,
         InterValuePairs::number(N));
 }
-void Synoptic::symbol_entry(inter_symbol *S) {
+void Synoptic::symbol_entry(inter_symbol *S) {
     Inode::extend_instruction_by(synoptic_array_node, 2);
     inter_package *pack = InterPackage::container(synoptic_array_node);
     inter_symbol *local_S = InterSymbolsTable::create_with_unique_name(
diff --git a/docs/runtime-module/2-dv.html b/docs/runtime-module/2-dv.html
index 848f688f0..0b37c86c6 100644
--- a/docs/runtime-module/2-dv.html
+++ b/docs/runtime-module/2-dv.html
@@ -93,7 +93,7 @@ messages.
     EmitArrays::generic_entry(val);
     return rv;
 }
-int DefaultValues::val(kind *K, wording W, char *storage_name) {
+int DefaultValues::val(kind *K, wording W, char *storage_name) {
     value_holster VH = Holsters::new(INTER_DATA_VHMODE);
     int rv = DefaultValues::to_holster(&VH, K, W, storage_name, FALSE);
     Holsters::unholster_to_code_val(Emit::tree(), &VH);
diff --git a/docs/runtime-module/2-ea.html b/docs/runtime-module/2-ea.html
index 210dbf137..0c0496d30 100644
--- a/docs/runtime-module/2-ea.html
+++ b/docs/runtime-module/2-ea.html
@@ -79,7 +79,7 @@ enforced; it's fine to store arbitrary data with 
 
 
-packaging_state EmitArrays::begin_word(inter_name *name, kind *K) {
+packaging_state EmitArrays::begin_word(inter_name *name, kind *K) {
     packaging_state save = Packaging::enter_home_of(name);
     EmitArrays::begin_inner(name, K, FALSE, CONST_LIST_FORMAT_WORDS);
     return save;
@@ -151,11 +151,11 @@ which would be a typesafe list in I7, so they can be absolutely any data.
 

-void EmitArrays::numeric_entry(inter_ti N) {
+void EmitArrays::numeric_entry(inter_ti N) {
     EmitArrays::entry_inner(InterValuePairs::number(N));
 }
 
-void EmitArrays::iname_entry(inter_name *iname) {
+void EmitArrays::iname_entry(inter_name *iname) {
     inter_symbol *alias;
     if (iname == NULL) alias = InterNames::to_symbol(Hierarchy::find(NOTHING_HL));
     else alias = InterNames::to_symbol(iname);
@@ -189,7 +189,7 @@ which would be a typesafe list in I7, so they can be absolutely any data.
 

-void EmitArrays::end(packaging_state save) {
+void EmitArrays::end(packaging_state save) {
     EmitArrays::end_inner();
     Packaging::exit(Emit::tree(), save);
 }
diff --git a/docs/runtime-module/2-ec.html b/docs/runtime-module/2-ec.html
index 0d991fb57..fffb57fd3 100644
--- a/docs/runtime-module/2-ec.html
+++ b/docs/runtime-module/2-ec.html
@@ -95,10 +95,10 @@ instruction last emitted, not after it.
 
  • EmitCode::up then returns us back to where we were.
  • -void EmitCode::up(void) {
    +void EmitCode::up(void) {
         Produce::up(Emit::tree());
     }
    -void EmitCode::down(void) {
    +void EmitCode::down(void) {
         Produce::down(Emit::tree());
     }
     
    @@ -114,7 +114,7 @@ have made, net:

    §5. Structural.

    -void EmitCode::code(void) {
    +void EmitCode::code(void) {
         Produce::code(Emit::tree());
     }
     
    @@ -127,7 +127,7 @@ start of a function.
     

    -void EmitCode::comment(text_stream *text) {
    +void EmitCode::comment(text_stream *text) {
         if (Functions::a_function_is_being_compiled() == FALSE)
             internal_error("code comment emitted outside function");
         Produce::guard(CommentInstruction::new(EmitCode::at(), text, NULL,
    @@ -145,7 +145,7 @@ start of a function.
     

    -void EmitCode::val_number(inter_ti N) {
    +void EmitCode::val_number(inter_ti N) {
         Produce::val(Emit::tree(), K_number, InterValuePairs::number(N));
     }
     
    @@ -153,15 +153,15 @@ start of a function.
         Produce::val(Emit::tree(), K_truth_state, InterValuePairs::number(1));
     }
     
    -void EmitCode::val_false(void) {
    +void EmitCode::val_false(void) {
         Produce::val(Emit::tree(), K_truth_state, InterValuePairs::number(0));
     }
     
    -void EmitCode::val_iname(kind *K, inter_name *iname) {
    +void EmitCode::val_iname(kind *K, inter_name *iname) {
         Produce::val_iname(Emit::tree(), K, iname);
     }
     
    -void EmitCode::val_text(text_stream *text) {
    +void EmitCode::val_text(text_stream *text) {
         Produce::val_text(Emit::tree(), text);
     }
     
    @@ -177,7 +177,7 @@ start of a function.
         Produce::val_nothing(Emit::tree());
     }
     
    -void EmitCode::val_symbol(kind *K, inter_symbol *S) {
    +void EmitCode::val_symbol(kind *K, inter_symbol *S) {
         Produce::val_symbol(Emit::tree(), K, S);
     }
     
    @@ -217,7 +217,7 @@ this can be achieved with an Inter -void EmitCode::cast(kind *F, kind *T) { +void EmitCode::cast(kind *F, kind *T) { Produce::cast(Emit::tree(), F, T); }
    @@ -284,11 +284,11 @@ in such cases, this function must exist in the kits somewhere.

    -void EmitCode::inv(inter_ti bip) {
    +void EmitCode::inv(inter_ti bip) {
         Produce::inv_primitive(Emit::tree(), bip);
     }
     
    -void EmitCode::call(inter_name *fn_iname) {
    +void EmitCode::call(inter_name *fn_iname) {
         Produce::inv_call_iname(Emit::tree(), fn_iname);
     }
     
    diff --git a/docs/runtime-module/2-emt.html b/docs/runtime-module/2-emt.html
    index 5f028e07e..dadea117b 100644
    --- a/docs/runtime-module/2-emt.html
    +++ b/docs/runtime-module/2-emt.html
    @@ -79,7 +79,7 @@ creates the main    LargeScale::begin_new_tree(main_emission_tree);
         return main_emission_tree;
     }
    -inter_tree *Emit::tree(void) {
    +inter_tree *Emit::tree(void) {
         return main_emission_tree;
     }
     
    @@ -193,7 +193,7 @@ it represents an actual number at run-time, the second if not:
     

    -inter_name *Emit::numeric_constant(inter_name *con_iname, inter_ti val) {
    +inter_name *Emit::numeric_constant(inter_name *con_iname, inter_ti val) {
         return Emit::numeric_constant_inner(con_iname,
             InterValuePairs::number_in_base(val, 10), INT32_ITCONC);
     }
    @@ -255,7 +255,7 @@ it represents an actual number at run-time, the second if not:
     

    -inter_name *Emit::iname_constant(inter_name *con_iname, kind *K, inter_name *val_iname) {
    +inter_name *Emit::iname_constant(inter_name *con_iname, kind *K, inter_name *val_iname) {
         packaging_state save = Packaging::enter_home_of(con_iname);
         inter_symbol *con_s = InterNames::to_symbol(con_iname);
         inter_symbol *val_s = (val_iname)?InterNames::to_symbol(val_iname):NULL;
    @@ -324,10 +324,10 @@ of a "variable" and define it as a constant:
     

    §12. Instances.

    -void Emit::instance(inter_name *inst_iname, kind *K, int v) {
    +void Emit::instance(inter_name *inst_iname, kind *K, inter_ti v, int has_value) {
         packaging_state save = Packaging::enter_home_of(inst_iname);
         inter_symbol *inst_s = InterNames::to_symbol(inst_iname);
    -    inter_pair val = v ? InterValuePairs::number((inter_ti) v) : InterValuePairs::undef();
    +    inter_pair val = has_value ? InterValuePairs::number(v) : InterValuePairs::undef();
         Produce::guard(InstanceInstruction::new(Emit::at(), inst_s,
             Produce::kind_to_symbol(K), val, Emit::baseline(), NULL));
         Packaging::exit(Emit::tree(), save);
    diff --git a/docs/runtime-module/2-hrr.html b/docs/runtime-module/2-hrr.html
    index 4e415aa1a..93662ea07 100644
    --- a/docs/runtime-module/2-hrr.html
    +++ b/docs/runtime-module/2-hrr.html
    @@ -1308,6 +1308,7 @@ and The Standard Kits (
     enum KIND_INDEX_PLURAL_MD_HL
     enum KIND_SHOWME_MD_HL
     enum KIND_IS_BASE_MD_HL
    +enum KIND_IS_PROPER_MD_HL
     enum KIND_IS_QUASINUMERICAL_MD_HL
     enum KIND_IS_DEF_MD_HL
     enum KIND_IS_OBJECT_MD_HL
    @@ -1340,7 +1341,9 @@ and The Standard Kits (
     enum WEAK_ID_HL
     enum ICOUNT_HL
     enum FWMATRIX_SIZE_HL
    -enum ILIST_HL
    +enum NUM_DOORS_HL
    +enum NUM_ROOMS_HL
    +enum ENUMERATION_ARRAY_MD_HL
     enum KIND_XREF_SYMBOL_HL
     enum DECREMENT_FN_HL
     enum INCREMENT_FN_HL
    @@ -1348,24 +1351,26 @@ and The Standard Kits (
     enum PRINT_DASH_FN_HL
     enum MKDEF_FN_HL
     enum RANGER_FN_HL
    +enum INDEXING_FN_HL
     enum DEFAULT_CLOSURE_FN_HL
     enum GPR_FN_HL
     enum SHOWME_FN_HL
     enum INSTANCE_GPR_FN_HL
     enum INSTANCE_LIST_HL
     enum FIRST_INSTANCE_HL
    +enum INSTANCES_ARRAY_HL
     enum NEXT_INSTANCE_HL
    -enum COUNT_INSTANCE_1_HL
    -enum COUNT_INSTANCE_2_HL
    -enum COUNT_INSTANCE_3_HL
    -enum COUNT_INSTANCE_4_HL
    -enum COUNT_INSTANCE_5_HL
    -enum COUNT_INSTANCE_6_HL
    -enum COUNT_INSTANCE_7_HL
    -enum COUNT_INSTANCE_8_HL
    -enum COUNT_INSTANCE_9_HL
    -enum COUNT_INSTANCE_10_HL
    -enum COUNT_INSTANCE_HL
    +enum BASE_IK_1_HL
    +enum BASE_IK_2_HL
    +enum BASE_IK_3_HL
    +enum BASE_IK_4_HL
    +enum BASE_IK_5_HL
    +enum BASE_IK_6_HL
    +enum BASE_IK_7_HL
    +enum BASE_IK_8_HL
    +enum BASE_IK_9_HL
    +enum BASE_IK_10_HL
    +enum BASE_IK_HL
     enum KIND_INLINE_PROPERTIES_HAP
     enum KIND_INLINE_PROPERTY_HL
     enum KIND_PROPERTIES_HAP
    @@ -1376,7 +1381,6 @@ and The Standard Kits (
     enum DK_STRONG_ID_HL
     enum DK_KIND_HL
     enum DK_DEFAULT_VALUE_HL
    -enum KIND_USAGE_HAP
     enum KIND_CLASS_HL
     enum MULTIPLICATION_RULE_HAP
     enum SET_AT_MD_HL
    @@ -1416,6 +1420,7 @@ and The Standard Kits (
                 H_C_U(KIND_INDEX_VARIANCE_MD_HL,  I"^variance")
                 H_C_U(KIND_SHOWME_MD_HL,          I"^showme_fn")
                 H_C_U(KIND_IS_BASE_MD_HL,         I"^is_base")
    +            H_C_U(KIND_IS_PROPER_MD_HL,       I"^is_proper")
                 H_C_U(KIND_IS_QUASINUMERICAL_MD_HL, I"^is_quasinumerical")
                 H_C_U(KIND_IS_DEF_MD_HL,          I"^is_definite")
                 H_C_U(KIND_IS_OBJECT_MD_HL,       I"^is_object")
    @@ -1447,8 +1452,10 @@ and The Standard Kits (
                 H_C_U(KIND_INFERENCES_MD_HL,      I"^inferences")
                 H_C_I(WEAK_ID_HL)
                 H_C_I(ICOUNT_HL)
    -            H_C_I(ILIST_HL)
    +            H_C_U(ENUMERATION_ARRAY_MD_HL,    I"^enumeration_array")
                 H_C_U(FWMATRIX_SIZE_HL,           I"FWMATRIX_SIZE")
    +            H_C_U(NUM_DOORS_HL,               I"NUM_DOORS")
    +            H_C_U(NUM_ROOMS_HL,               I"NUM_ROOMS")
                 H_C_U(KIND_XREF_SYMBOL_HL,        I"kind_ref")
                 H_F_U(MKDEF_FN_HL,                I"mkdef_fn")
                 H_F_U(DECREMENT_FN_HL,            I"decrement_fn")
    @@ -1456,6 +1463,7 @@ and The Standard Kits (
                 H_F_U(PRINT_FN_HL,                I"print_fn")
                 H_F_G(PRINT_DASH_FN_HL,           I"print_fn", I"E")
                 H_F_U(RANGER_FN_HL,               I"ranger_fn")
    +            H_F_U(INDEXING_FN_HL,             I"indexing_fn")
                 H_F_U(DEFAULT_CLOSURE_FN_HL,      I"default_closure_fn")
                 H_F_U(GPR_FN_HL,                  I"gpr_fn")
                 H_F_U(INSTANCE_GPR_FN_HL,         I"instance_gpr_fn")
    @@ -1463,17 +1471,18 @@ and The Standard Kits (
                 H_F_U(SHOWME_FN_HL,               I"showme_fn")
                 H_C_S(FIRST_INSTANCE_HL,          I"_First")
                 H_C_S(NEXT_INSTANCE_HL,           I"_Next")
    -            H_C_T(COUNT_INSTANCE_1_HL,        I"IK1_Count")
    -            H_C_T(COUNT_INSTANCE_2_HL,        I"IK2_Count")
    -            H_C_T(COUNT_INSTANCE_3_HL,        I"IK3_Count")
    -            H_C_T(COUNT_INSTANCE_4_HL,        I"IK4_Count")
    -            H_C_T(COUNT_INSTANCE_5_HL,        I"IK5_Count")
    -            H_C_T(COUNT_INSTANCE_6_HL,        I"IK6_Count")
    -            H_C_T(COUNT_INSTANCE_7_HL,        I"IK7_Count")
    -            H_C_T(COUNT_INSTANCE_8_HL,        I"IK8_Count")
    -            H_C_T(COUNT_INSTANCE_9_HL,        I"IK9_Count")
    -            H_C_T(COUNT_INSTANCE_10_HL,       I"IK10_Count")
    -            H_C_S(COUNT_INSTANCE_HL,          I"_Count")
    +            H_C_S(INSTANCES_ARRAY_HL,         I"_Array")
    +            H_C_T(BASE_IK_1_HL,               I"IK1_Count")
    +            H_C_T(BASE_IK_2_HL,               I"IK2_Count")
    +            H_C_T(BASE_IK_3_HL,               I"IK3_Count")
    +            H_C_T(BASE_IK_4_HL,               I"IK4_Count")
    +            H_C_T(BASE_IK_5_HL,               I"IK5_Count")
    +            H_C_T(BASE_IK_6_HL,               I"IK6_Count")
    +            H_C_T(BASE_IK_7_HL,               I"IK7_Count")
    +            H_C_T(BASE_IK_8_HL,               I"IK8_Count")
    +            H_C_T(BASE_IK_9_HL,               I"IK9_Count")
    +            H_C_T(BASE_IK_10_HL,              I"IK10_Count")
    +            H_C_S(BASE_IK_HL,                 I"_Count")
                 H_C_G(KIND_CLASS_HL,              I"K")
                 H_BEGIN_AP(KIND_INLINE_PROPERTIES_HAP, I"inline_property", I"_inline_property")
                     H_C_U(KIND_INLINE_PROPERTY_HL, I"inline")
    @@ -1493,8 +1502,6 @@ and The Standard Kits (
         H_END
     
         H_BEGIN(LocationRequirements::completion_submodule(I, kinds))
    -        H_BEGIN_AP(KIND_USAGE_HAP,            I"kind_usage", I"_kind_usage")
    -        H_END
             H_BEGIN_AP(MULTIPLICATION_RULE_HAP,   I"multiplication_rule", I"_multiplication_rule")
                 H_C_U(SET_AT_MD_HL,               I"^at")
                 H_C_U(LEFT_OPERAND_MD_HL,         I"^left_operand")
    @@ -2130,33 +2137,10 @@ and The Standard Kits (
     enum K_NUMBER_XPACKAGE
     enum K_TIME_XPACKAGE
     enum K_TRUTH_STATE_XPACKAGE
    -enum K_TABLE_XPACKAGE
    -enum K_FIGURE_NAME_XPACKAGE
    -enum K_SOUND_NAME_XPACKAGE
    -enum K_USE_OPTION_XPACKAGE
    -enum K_EXTERNAL_FILE_XPACKAGE
    -enum K_INTERNAL_FILE_XPACKAGE
    -enum K_RULEBOOK_OUTCOME_XPACKAGE
    -enum K_RESPONSE_XPACKAGE
    -enum K_SCENE_XPACKAGE
    -enum K_DIALOGUE_BEAT_XPACKAGE
    -enum K_DIALOGUE_LINE_XPACKAGE
    -enum K_DIALOGUE_CHOICE_XPACKAGE
    -enum K_PERFORMANCE_STYLE_XPACKAGE
     enum CAPSHORTNAME_HL
     enum DECIMAL_TOKEN_INNER_HL
     enum TIME_TOKEN_INNER_HL
     enum TRUTH_STATE_TOKEN_INNER_HL
    -enum PRINT_RULEBOOK_OUTCOME_HL
    -enum PRINT_FIGURE_NAME_HL
    -enum PRINT_SOUND_NAME_HL
    -enum PRINT_EXTERNAL_FILE_NAME_HL
    -enum PRINT_INTERNAL_FILE_NAME_HL
    -enum PRINT_SCENE_HL
    -enum PRINT_DIALOGUE_BEAT_HL
    -enum PRINT_DIALOGUE_LINE_HL
    -enum PRINT_DIALOGUE_CHOICE_HL
    -enum PRINT_PERFORMANCE_STYLE_HL
     

    §8.1.54. The rest8.1.54 =

    @@ -2177,46 +2161,6 @@ and The Standard Kits ( H_BEGIN(LocationRequirements::this_exotic_package(K_TRUTH_STATE_XPACKAGE)) H_F_T(TRUTH_STATE_TOKEN_INNER_HL, I"gpr_fn", I"TRUTH_STATE_TOKEN_INNER") H_END - - H_BEGIN(LocationRequirements::this_exotic_package(K_FIGURE_NAME_XPACKAGE)) - H_F_T(PRINT_FIGURE_NAME_HL, I"print_fn", I"PrintFigureName") - H_END - - H_BEGIN(LocationRequirements::this_exotic_package(K_SOUND_NAME_XPACKAGE)) - H_F_T(PRINT_SOUND_NAME_HL, I"print_fn", I"PrintSoundName") - H_END - - H_BEGIN(LocationRequirements::this_exotic_package(K_EXTERNAL_FILE_XPACKAGE)) - H_F_T(PRINT_EXTERNAL_FILE_NAME_HL, I"print_fn", I"PrintExternalFileName") - H_END - - H_BEGIN(LocationRequirements::this_exotic_package(K_INTERNAL_FILE_XPACKAGE)) - H_F_T(PRINT_INTERNAL_FILE_NAME_HL, I"print_fn", I"PrintInternalFileName") - H_END - - H_BEGIN(LocationRequirements::this_exotic_package(K_RULEBOOK_OUTCOME_XPACKAGE)) - H_F_T(PRINT_RULEBOOK_OUTCOME_HL, I"print_fn", I"RulebookOutcomePrintingRule") - H_END - - H_BEGIN(LocationRequirements::this_exotic_package(K_SCENE_XPACKAGE)) - H_F_T(PRINT_SCENE_HL, I"print_fn", I"PrintSceneName") - H_END - - H_BEGIN(LocationRequirements::this_exotic_package(K_DIALOGUE_BEAT_XPACKAGE)) - H_F_T(PRINT_DIALOGUE_BEAT_HL, I"print_fn", I"PrintDialogueBeatName") - H_END - - H_BEGIN(LocationRequirements::this_exotic_package(K_DIALOGUE_LINE_XPACKAGE)) - H_F_T(PRINT_DIALOGUE_LINE_HL, I"print_fn", I"PrintDialogueLineName") - H_END - - H_BEGIN(LocationRequirements::this_exotic_package(K_DIALOGUE_CHOICE_XPACKAGE)) - H_F_T(PRINT_DIALOGUE_CHOICE_HL, I"print_fn", I"PrintDialogueChoiceName") - H_END - - H_BEGIN(LocationRequirements::this_exotic_package(K_PERFORMANCE_STYLE_XPACKAGE)) - H_F_T(PRINT_PERFORMANCE_STYLE_HL, I"print_fn", I"PrintPerformanceStyleName") - H_END

    §8.2.1. Architectural symbols. These are built-in constants (and one built-in variable, self) which come @@ -2321,23 +2265,10 @@ exotic, but which are locations not easily falling into patterns. Here they are:

     package_request *Hierarchy::exotic_package(int x) {
         switch (x) {
    -        case K_OBJECT_XPACKAGE:            return RTKindConstructors::kind_package(K_object);
    -        case K_NUMBER_XPACKAGE:            return RTKindConstructors::kind_package(K_number);
    -        case K_TIME_XPACKAGE:              return RTKindConstructors::kind_package(K_time);
    -        case K_TRUTH_STATE_XPACKAGE:       return RTKindConstructors::kind_package(K_truth_state);
    -        case K_TABLE_XPACKAGE:             return RTKindConstructors::kind_package(K_table);
    -        case K_FIGURE_NAME_XPACKAGE:       return RTKindConstructors::kind_package(K_figure_name);
    -        case K_SOUND_NAME_XPACKAGE:        return RTKindConstructors::kind_package(K_sound_name);
    -        case K_USE_OPTION_XPACKAGE:        return RTKindConstructors::kind_package(K_use_option);
    -        case K_EXTERNAL_FILE_XPACKAGE:     return RTKindConstructors::kind_package(K_external_file);
    -        case K_INTERNAL_FILE_XPACKAGE:     return RTKindConstructors::kind_package(K_internal_file);
    -        case K_RULEBOOK_OUTCOME_XPACKAGE:  return RTKindConstructors::kind_package(K_rulebook_outcome);
    -        case K_RESPONSE_XPACKAGE:          return RTKindConstructors::kind_package(K_response);
    -        case K_SCENE_XPACKAGE:             return RTKindConstructors::kind_package(K_scene);
    -        case K_DIALOGUE_BEAT_XPACKAGE:     return RTKindConstructors::kind_package(K_dialogue_beat);
    -        case K_DIALOGUE_LINE_XPACKAGE:     return RTKindConstructors::kind_package(K_dialogue_line);
    -        case K_DIALOGUE_CHOICE_XPACKAGE:   return RTKindConstructors::kind_package(K_dialogue_choice);
    -        case K_PERFORMANCE_STYLE_XPACKAGE: return RTKindConstructors::kind_package(K_performance_style);
    +        case K_OBJECT_XPACKAGE:            return RTKindConstructors::kind_package(K_object);
    +        case K_NUMBER_XPACKAGE:            return RTKindConstructors::kind_package(K_number);
    +        case K_TIME_XPACKAGE:              return RTKindConstructors::kind_package(K_time);
    +        case K_TRUTH_STATE_XPACKAGE:       return RTKindConstructors::kind_package(K_truth_state);
         }
         internal_error("unknown exotic package");
         return NULL;
    @@ -2348,7 +2279,7 @@ at which this array should be placed, by calling, e.g., 
     
     
    -inter_name *Hierarchy::find(int id) {
    +inter_name *Hierarchy::find(int id) {
         return HierarchyLocations::iname(Emit::tree(), id);
     }
     
    @@ -2371,7 +2302,7 @@ package holding it. (P

    -inter_name *Hierarchy::make_iname_in(int id, package_request *P) {
    +inter_name *Hierarchy::make_iname_in(int id, package_request *P) {
         return HierarchyLocations::make_iname_in(Emit::tree(), id, P);
     }
     
    @@ -2414,7 +2345,7 @@ it (e.g. by adding a prefix or suffix), the following should be used: return HierarchyLocations::derive_iname_in(Emit::tree(), id, from, P); } -inter_name *Hierarchy::derive_iname_in_translating(int id, inter_name *from, package_request *P) { +inter_name *Hierarchy::derive_iname_in_translating(int id, inter_name *from, package_request *P) { return HierarchyLocations::derive_iname_in_translating(Emit::tree(), id, from, P); }
    @@ -2423,7 +2354,7 @@ supply the translated name, the following should be used:

    -inter_name *Hierarchy::make_iname_with_specific_translation(int id, text_stream *name,
    +inter_name *Hierarchy::make_iname_with_specific_translation(int id, text_stream *name,
         package_request *P) {
         return HierarchyLocations::make_iname_with_specific_translation(Emit::tree(),
             id, name, P);
    @@ -2437,7 +2368,7 @@ available", using the following, which creates a socket. Again, see
     

    -void Hierarchy::make_available(inter_name *iname) {
    +void Hierarchy::make_available(inter_name *iname) {
         text_stream *ma_as = InterNames::get_translation(iname);
         if (Str::len(ma_as) == 0) ma_as = InterNames::to_text(iname);
         LargeScale::package_type(Emit::tree(), I"_linkage");
    @@ -2490,7 +2421,7 @@ such _kind pack
         return Hierarchy::local_package_to(hap_id, current_sentence);
     }
     
    -package_request *Hierarchy::local_package_to(int hap_id, parse_node *at) {
    +package_request *Hierarchy::local_package_to(int hap_id, parse_node *at) {
         return Hierarchy::package(CompilationUnits::find(at), hap_id);
     }
     
    @@ -2499,11 +2430,11 @@ compilation unit is meant: that's why it's "synoptic".

    -package_request *Hierarchy::synoptic_package(int hap_id) {
    +package_request *Hierarchy::synoptic_package(int hap_id) {
         return HierarchyLocations::attach_new_package(Emit::tree(), NULL, NULL, hap_id);
     }
     
    -package_request *Hierarchy::completion_package(int hap_id) {
    +package_request *Hierarchy::completion_package(int hap_id) {
         return HierarchyLocations::attach_new_package(Emit::tree(), NULL, NULL, hap_id);
     }
     
    @@ -2526,7 +2457,7 @@ will automatically trip, in order to enforce the layout rules.

    -package_request *Hierarchy::package_within(int hap_id, package_request *super) {
    +package_request *Hierarchy::package_within(int hap_id, package_request *super) {
         return HierarchyLocations::attach_new_package(Emit::tree(), NULL, super, hap_id);
     }
     
    @@ -2543,29 +2474,29 @@ point system, and for those:

    -void Hierarchy::apply_metadata(package_request *P, int id, text_stream *value) {
    +void Hierarchy::apply_metadata(package_request *P, int id, text_stream *value) {
         inter_name *iname = Hierarchy::make_iname_in(id, P);
         Emit::text_constant(iname, value);
     }
     
    -void Hierarchy::apply_metadata_from_number(package_request *P, int id, inter_ti N) {
    +void Hierarchy::apply_metadata_from_number(package_request *P, int id, inter_ti N) {
         inter_name *iname = Hierarchy::make_iname_in(id, P);
         Emit::numeric_constant(iname, N);
     }
     
    -void Hierarchy::apply_metadata_from_iname(package_request *P, int id, inter_name *val) {
    +void Hierarchy::apply_metadata_from_iname(package_request *P, int id, inter_name *val) {
         inter_name *iname = Hierarchy::make_iname_in(id, P);
         Emit::iname_constant(iname, K_value, val);
     }
     
    -void Hierarchy::apply_metadata_from_wording(package_request *P, int id, wording W) {
    +void Hierarchy::apply_metadata_from_wording(package_request *P, int id, wording W) {
         TEMPORARY_TEXT(ANT)
         WRITE_TO(ANT, "%W", W);
         Hierarchy::apply_metadata(P, id, ANT);
         DISCARD_TEXT(ANT)
     }
     
    -void Hierarchy::apply_metadata_from_raw_wording(package_request *P, int id, wording W) {
    +void Hierarchy::apply_metadata_from_raw_wording(package_request *P, int id, wording W) {
         TEMPORARY_TEXT(ANT)
         WRITE_TO(ANT, "%+W", W);
         Hierarchy::apply_metadata(P, id, ANT);
    diff --git a/docs/runtime-module/2-ic.html b/docs/runtime-module/2-ic.html
    index bb5c34a86..87ddbc2a9 100644
    --- a/docs/runtime-module/2-ic.html
    +++ b/docs/runtime-module/2-ic.html
    @@ -217,7 +217,7 @@ the same set of objects, but in the same order.
     creates an explicit player.
     

    -instance *InstanceCounting::next_in_IK_sequence(instance *I, kind *k) {
    +instance *InstanceCounting::next_in_IK_sequence(instance *I, kind *k) {
         if (k == NULL) return NULL;
         int resuming = TRUE;
         if (I == NULL) { I = FIRST_IN_INSTANCE_ORDERING; resuming = FALSE; }
    @@ -248,7 +248,7 @@ compile time.
         kind *K;
         LOOP_OVER_BASE_KINDS(K)
             if (Kinds::Behaviour::is_subkind_of_object(K)) {
    -            inter_name *iname = RTKindConstructors::first_instance_iname(K);
    +            inter_name *iname = RTKindConstructors::first_instance_iname(K);
                 instance *next = InstanceCounting::next_in_IK_sequence(NULL, K);
                 if (next) {
                     Emit::iname_constant(iname, K_object, RTInstances::value_iname(next));
    @@ -328,9 +328,8 @@ property values: one for (red car, thing), one for (red car, vehicle). The
     properties in question are the IK_count_prop for thing and vehicle.
     

    -

    Similarly for the next terms in the IK-sequences, where the properties are -the -

    +

    Similarly for the next terms in the IK-sequences. +

    Create the two instance properties for each kind of object10.2 =

    @@ -340,16 +339,16 @@ the LOOP_OVER_BASE_KINDS(K) if (Kinds::Behaviour::is_subkind_of_object(K)) { inference_subject *subj = KindSubjects::from_kind(K); - inter_name *count_iname = RTKindConstructors::instance_count_iname(K); + inter_name *count_iname = RTKindConstructors::base_IK_iname(K); COUNTING_DATA(subj)->IK_count_prop = ValueProperties::new_nameless_using(K_number, - RTKindConstructors::kind_package(K), count_iname); + RTKindConstructors::kind_package(K), count_iname); - inter_name *next_iname = RTKindConstructors::next_instance_iname(K); + inter_name *next_iname = RTKindConstructors::next_instance_iname(K); COUNTING_DATA(subj)->next_in_IK_sequence_prop = ValueProperties::new_nameless_using(K_object, - RTKindConstructors::kind_package(K), next_iname); + RTKindConstructors::kind_package(K), next_iname); }
    • This code is used in §10.
    @@ -440,8 +439,8 @@ misleading to a human reader. Calculus::Schemas::modify(sch, "for (*1=nothing: false: )"); } else { - inter_name *first_iname = RTKindConstructors::first_instance_iname(K); - inter_name *next_iname = RTKindConstructors::next_instance_iname(K); + inter_name *first_iname = RTKindConstructors::first_instance_iname(K); + inter_name *next_iname = RTKindConstructors::next_instance_iname(K); Calculus::Schemas::modify(sch, "for (*1=%n: *1: *1=*1.%n)", first_iname, next_iname); } return TRUE; diff --git a/docs/runtime-module/2-kd.html b/docs/runtime-module/2-kd.html index e5b81a448..e658c1075 100644 --- a/docs/runtime-module/2-kd.html +++ b/docs/runtime-module/2-kd.html @@ -65,7 +65,7 @@ function togglePopup(material_id) {

    -int RTKindDeclarations::base_represented_in_Inter(kind *K) {
    +int RTKindDeclarations::base_represented_in_Inter(kind *K) {
         if ((Kinds::Behaviour::is_kind_of_kind(K) == FALSE) &&
             (Kinds::is_proper_constructor(K) == FALSE) &&
             (K != K_void) &&
    @@ -130,7 +130,7 @@ the kind in Inter, ensuring that it has been declared exactly once.
     

    -inter_name *RTKindDeclarations::iname(kind *K) {
    +inter_name *RTKindDeclarations::iname(kind *K) {
         if (RTKindDeclarations::base_represented_in_Inter(K)) {
             noun *nt = Kinds::Behaviour::get_noun(K);
             if ((nt) && (NounIdentifiers::iname_set(nt) == FALSE))
    @@ -166,7 +166,7 @@ sequence in which declarations are made here.
     
     
     inter_name *RTKindDeclarations::create_iname(kind *K) {
    -    package_request *R = RTKindConstructors::package(K->construct);
    +    package_request *R = RTKindConstructors::package(K->construct);
         TEMPORARY_TEXT(KT)
         Kinds::Textual::write(KT, K);
         wording W = Feeds::feed_text(KT);
    diff --git a/docs/runtime-module/2-sc.html b/docs/runtime-module/2-sc.html
    index 82fb4c896..823676516 100644
    --- a/docs/runtime-module/2-sc.html
    +++ b/docs/runtime-module/2-sc.html
    @@ -71,7 +71,7 @@ plugged in.
         SHOWME_is_active = TRUE;
     }
     
    -int RTShowmeCommand::needed_for_kind(kind *K) {
    +int RTShowmeCommand::needed_for_kind(kind *K) {
         if (SHOWME_is_active == FALSE) return FALSE;
         inference_subject *subj = KindSubjects::from_kind(K);
         property *prn;
    @@ -108,7 +108,7 @@ properties.
     

    -void RTShowmeCommand::compile_kind_showme_fn(inter_name *iname, kind *K) {
    +void RTShowmeCommand::compile_kind_showme_fn(inter_name *iname, kind *K) {
         packaging_state save = Functions::begin(iname);
         inter_symbol *which_s = LocalVariables::new_other_as_symbol(I"which");
         inter_symbol *na_s = LocalVariables::new_other_as_symbol(I"na");
    @@ -420,7 +420,7 @@ routine for colours; and the best thing is to print nothing at all.
     
         EmitCode::inv(INDIRECT1V_BIP);
         EmitCode::down();
    -        EmitCode::val_iname(K_value, RTKindConstructors::get_iname(K));
    +        EmitCode::val_iname(K_value, RTKindConstructors::printing_fn_iname(K));
             EmitCode::call(Hierarchy::find(GPROPERTY_HL));
             EmitCode::down();
                 RTKindIDs::emit_weak_ID_as_val(K_object);
    diff --git a/docs/runtime-module/2-sn.html b/docs/runtime-module/2-sn.html
    index 83ea786cd..e47f53b41 100644
    --- a/docs/runtime-module/2-sn.html
    +++ b/docs/runtime-module/2-sn.html
    @@ -70,7 +70,7 @@ It can be conjured into being by calling this function:
         if (P_cap_short_name == NULL) {
             inter_name *property_iname = Hierarchy::find(CAPSHORTNAME_HL);
             P_cap_short_name = ValueProperties::new_nameless_using(
    -            K_text, RTKindConstructors::kind_package(K_object), property_iname);
    +            K_text, RTKindConstructors::kind_package(K_object), property_iname);
             Hierarchy::make_available(property_iname);
         }
         return P_cap_short_name;
    diff --git a/docs/runtime-module/4-ll.html b/docs/runtime-module/4-ll.html
    index cb6f37e65..1a7fd14c5 100644
    --- a/docs/runtime-module/4-ll.html
    +++ b/docs/runtime-module/4-ll.html
    @@ -215,28 +215,11 @@ for the number of instances it has:
     
     
     int ListLiterals::extent_of_instance_list(kind *K) {
    -    int N = -1;
    -    if (Kinds::Behaviour::is_an_enumeration(K)) Count entries for an enumeration6.1;
    -    if (Kinds::Behaviour::is_subkind_of_object(K)) Count entries for a kind of object6.2;
    -    return N;
    +    if (Kinds::Behaviour::is_an_enumeration(K)) return RTKindConstructors::enumeration_size(K);
    +    if (Kinds::Behaviour::is_subkind_of_object(K)) return Instances::count(K);
    +    return -1;
     }
     
    -

    §6.1. Count entries for an enumeration6.1 = -

    - -
    -    N = RTKindConstructors::get_highest_valid_value_as_integer(K);
    -
    -
    • This code is used in §6.
    -

    §6.2. Count entries for a kind of object6.2 = -

    - -
    -    N = 0;
    -    instance *I;
    -    LOOP_OVER_INSTANCES(I, K) N++;
    -
    -
    • This code is used in §6.

    §7. And the following then constructs the literal list, on demand:

    @@ -244,39 +227,25 @@ for the number of instances it has: inter_name *ListLiterals::get_instance_list(kind *K) { int N = ListLiterals::extent_of_instance_list(K); if (N < 0) return NULL; - inter_name *large_block_iname = RTKindConstructors::list_iname(Kinds::get_construct(K)); + inter_name *large_block_iname = RTKindConstructors::list_iname(Kinds::get_construct(K)); if (large_block_iname == NULL) { large_block_iname = - Hierarchy::make_iname_in(INSTANCE_LIST_HL, RTKindConstructors::kind_package(K)); + Hierarchy::make_iname_in(INSTANCE_LIST_HL, RTKindConstructors::kind_package(K)); packaging_state save = ListLiterals::begin_large_block( large_block_iname, Kinds::unary_con(CON_list_of, K), N); - if (Kinds::Behaviour::is_an_enumeration(K)) Compile entries for an enumeration7.1; - if (Kinds::Behaviour::is_subkind_of_object(K)) Compile entries for a kind of object7.2; + if (Kinds::Behaviour::is_an_enumeration(K)) RTKindConstructors::make_enumeration_entries(K); + if (Kinds::Behaviour::is_subkind_of_object(K)) Compile entries for a kind of object7.1; ListLiterals::end_large_block(save); - RTKindConstructors::set_list_iname(Kinds::get_construct(K), large_block_iname); + RTKindConstructors::set_list_iname(Kinds::get_construct(K), large_block_iname); } return ListLiterals::small_block(large_block_iname); }
    -

    §7.1. A little dubiously, for an enumeration ("Colour is a kind of value. The -colours are red, green and blue."), the entries are just the numbers 1, 2, 3, ... -That never seems a good use of memory, but it is still more efficient to store -one copy of this than to have to construct it frequently at runtime. -

    - -

    Compile entries for an enumeration7.1 = -

    - -
    -    for (int i = 1; i <= N; i++)
    -        EmitArrays::numeric_entry((inter_ti) i);
    -
    -
    • This code is used in §7.
    -

    §7.2. Note that the instances are given in the order preferred by Instance Counting, +

    §7.1. Note that the instances are given in the order preferred by Instance Counting, not in creation order, as a simple LOOP_OVER_INSTANCES would have done.

    -

    Compile entries for a kind of object7.2 = +

    Compile entries for a kind of object7.1 =

    diff --git a/docs/runtime-module/4-rsp.html b/docs/runtime-module/4-rsp.html
    index 45e8b7dc8..ad0389414 100644
    --- a/docs/runtime-module/4-rsp.html
    +++ b/docs/runtime-module/4-rsp.html
    @@ -163,7 +163,6 @@ through a sentence like:
         text_stream *desc = Str::new();
         WRITE_TO(desc, "response (%c) to '%W'", 'A'+marker, R->name);
         Sequence::queue(&Responses::compilation_agent, STORE_POINTER_response_message(resp), desc);
    -
         return resp;
     }
     
    diff --git a/docs/runtime-module/5-act2.html b/docs/runtime-module/5-act2.html index 9f7c51445..9db479694 100644 --- a/docs/runtime-module/5-act2.html +++ b/docs/runtime-module/5-act2.html @@ -495,7 +495,7 @@ the function is attached to. var = InterNames::to_symbol(Hierarchy::find(PARSED_NUMBER_HL)); EmitCode::inv(INDIRECT1V_BIP); EmitCode::down(); - EmitCode::val_iname(K_value, RTKindConstructors::get_debug_print_fn_iname(K)); + EmitCode::val_iname(K_value, RTKindConstructors::debug_print_fn_iname(K)); if ((K_understanding) && (Kinds::eq(K, K_understanding))) { EmitCode::inv(PLUS_BIP); EmitCode::down(); diff --git a/docs/runtime-module/5-ins.html b/docs/runtime-module/5-ins.html index 41d99f4cb..4a450a6e7 100644 --- a/docs/runtime-module/5-ins.html +++ b/docs/runtime-module/5-ins.html @@ -71,6 +71,8 @@ function togglePopup(material_id) { struct inter_name *instance_iname; struct linked_list *usages; of parse_node int declaration_sequence_number; + int has_explicit_runtime_value; + inter_ti explicit_runtime_value; } instance_compilation_data; instance_compilation_data RTInstances::new_compilation_data(instance *I) { @@ -80,13 +82,15 @@ function togglePopup(material_id) { icd.instance_iname = Hierarchy::make_iname_with_memo(INSTANCE_HL, icd.instance_package, W); icd.declaration_sequence_number = -1; + icd.has_explicit_runtime_value = FALSE; + icd.explicit_runtime_value = 0; icd.usages = NEW_LINKED_LIST(parse_node); NounIdentifiers::set_iname(I->as_noun, icd.instance_iname); Hierarchy::make_available_one_per_name_only(icd.instance_iname); return icd; } -inter_name *RTInstances::value_iname(instance *I) { +inter_name *RTInstances::value_iname(instance *I) { if (I == NULL) return NULL; return I->compilation_data.instance_iname; } @@ -175,7 +179,7 @@ using Inter's INSTANCE_IST Hierarchy::apply_metadata(pack, INSTANCE_PRINTED_NAME_MD_HL, name); DISCARD_TEXT(pname) TEMPORARY_TEXT(abbrev) - Compose the abbreviated name4.2; + Compose the abbreviated name4.3; Hierarchy::apply_metadata(pack, INSTANCE_ABBREVIATION_MD_HL, abbrev); DISCARD_TEXT(abbrev) Hierarchy::apply_metadata_from_number(pack, INSTANCE_AT_MD_HL, @@ -218,7 +222,7 @@ using Inter's INSTANCE_IST RTKindIDs::define_constant_as_strong_id(kn_iname, K); Hierarchy::apply_metadata_from_iname(pack, INSTANCE_KIND_XREF_MD_HL, - RTKindConstructors::xref_iname(K->construct)); + RTKindConstructors::xref_iname(K->construct)); if (Kinds::Behaviour::is_subkind_of_object(K)) Hierarchy::apply_metadata_from_number(pack, INSTANCE_IS_OBJECT_MD_HL, 1); @@ -353,7 +357,12 @@ using Inter's INSTANCE_IST INST_SHOWME_MD_HL, iname); } - Emit::instance(RTInstances::value_iname(I), Instances::to_kind(I), I->enumeration_index); + inter_ti val = (inter_ti) I->enumeration_index; + int has_value = TRUE; + if (val == 0) has_value = FALSE; + if (I->compilation_data.has_explicit_runtime_value) + val = I->compilation_data.explicit_runtime_value; + Emit::instance(RTInstances::value_iname(I), Instances::to_kind(I), val, has_value); if (I->compilation_data.declaration_sequence_number >= 0) { inter_name *iname = RTInstances::value_iname(I); package_request *req = InterNames::location(iname); @@ -382,7 +391,33 @@ using Inter's INSTANCE_IST RTInstances::value_iname(X)); }
    -

    §4.1. When names are abbreviated for use on the World Index map (for instance, +

    §4.1. Explicit instance numbering is used for enumerative kinds provided by kits, +which exist for the benefit of the Inter layer. Such kinds might have an erratic +series of values such as 2, 6, 17, ... rather than 1, 2, 3, ..., and if so then +an instance with an unexpected runtime value is called "out of place". +

    + +
    +void RTInstances::set_explicit_runtime_value(instance *I, inter_ti val) {
    +    I->compilation_data.has_explicit_runtime_value = TRUE;
    +    I->compilation_data.explicit_runtime_value = val;
    +}
    +
    +int RTInstances::out_of_place(instance *I) {
    +    if (I->compilation_data.has_explicit_runtime_value == FALSE) return FALSE;
    +    if (I->compilation_data.explicit_runtime_value == (inter_ti) I->enumeration_index)
    +        return FALSE;
    +    return TRUE;
    +}
    +
    +void RTInstances::set_translation(instance *I, text_stream *identifier) {
    +    inter_name *iname = RTInstances::value_iname(I);
    +    InterNames::set_translation(iname, identifier);
    +    InterNames::clear_flag(iname, MAKE_NAME_UNIQUE_ISYMF);
    +    Hierarchy::make_available(iname);
    +}
    +
    +

    §4.2. When names are abbreviated for use on the World Index map (for instance, "Marble Hallway" becomes "MH") each word is tested against the following nonterminal; those which match are omitted. So, for instance, "Queen Of The South" comes out as "QS". @@ -397,7 +432,7 @@ South" comes out as "QS". <article>

    -

    §4.2. Compose the abbreviated name4.2 = +

    §4.3. Compose the abbreviated name4.3 =

    diff --git a/docs/runtime-module/5-kc.html b/docs/runtime-module/5-kc.html
    index 03e952f18..283c7a8dd 100644
    --- a/docs/runtime-module/5-kc.html
    +++ b/docs/runtime-module/5-kc.html
    @@ -59,386 +59,243 @@ function togglePopup(material_id) {
         
     

    Each kind constructor has an Inter package of resources.

    -
    +
    -

    §1. Inter identifiers.

    +

    §1. Compilation data.

     typedef struct kind_constructor_compilation_data {
    -    struct inter_name *xref_iname;
    -    struct inter_name *con_iname;
    -    struct inter_name *list_iname;
         struct package_request *kc_package;
    -    struct inter_name *kind_GPR_iname;
    -    int needs_GPR;  a GPR is actually required to be compiled
    -    struct inter_name *instance_GPR_iname;
    +    struct inter_name *xref_iname;
    +
    +    struct inter_name *weak_ID_iname;
    +
         struct inter_name *first_instance_iname;
         struct inter_name *next_instance_iname;
    -    struct inter_name *instance_count_iname;
    -    struct inter_name *pr_iname;
    -    struct inter_name *inc_iname;
    -    struct inter_name *dec_iname;
    -    struct inter_name *mkdef_iname;
    -    struct inter_name *ranger_iname;
    +    struct inter_name *base_IK_iname;
    +    struct inter_name *icount_iname;
    +    struct inter_name *instances_array_iname;
    +    struct inter_name *instance_list_iname;
    +    struct inter_name *indexing_fn_iname;
    +
    +    struct inter_name *increment_fn_iname;
    +    struct inter_name *decrement_fn_iname;
    +    struct inter_name *default_value_fn_iname;
    +    struct inter_name *random_value_fn_iname;
    +    struct inter_name *comparison_fn_iname;
    +    struct inter_name *support_fn_iname;
    +
    +    struct inter_name *print_fn_iname;
         struct inter_name *debug_print_fn_iname;
    -    struct package_request *usage_package;
    +    struct inter_name *showme_fn_iname;
    +
    +    struct inter_name *GPR_iname;
    +    struct inter_name *instance_GPR_iname;
    +    struct inter_name *recognition_only_GPR_iname;
    +    struct inter_name *distinguisher_function_iname;
    +
         int declaration_sequence_number;
    +    int nonstandard_enumeration;
     } kind_constructor_compilation_data;
     
     kind_constructor_compilation_data RTKindConstructors::new_compilation_data(kind_constructor *kc) {
         kind_constructor_compilation_data kccd;
    -    kccd.xref_iname = NULL;
    -    kccd.con_iname = NULL;
         kccd.kc_package = NULL;
    -    kccd.list_iname = NULL;
    -    kccd.kind_GPR_iname = NULL;
    -    kccd.needs_GPR = FALSE;
    -    kccd.instance_GPR_iname = NULL;
    +    kccd.xref_iname = NULL;
    +
    +    kccd.weak_ID_iname = NULL;
    +
         kccd.first_instance_iname = NULL;
         kccd.next_instance_iname = NULL;
    -    kccd.instance_count_iname = NULL;
    -    kccd.pr_iname = NULL;
    -    kccd.inc_iname = NULL;
    -    kccd.dec_iname = NULL;
    -    kccd.mkdef_iname = NULL;
    -    kccd.ranger_iname = NULL;
    +    kccd.base_IK_iname = NULL;
    +    kccd.icount_iname = NULL;
    +    kccd.instances_array_iname = NULL;
    +    kccd.instance_list_iname = NULL;
    +    kccd.indexing_fn_iname = NULL;
    +
    +    kccd.increment_fn_iname = NULL;
    +    kccd.decrement_fn_iname = NULL;
    +    kccd.default_value_fn_iname = NULL;
    +    kccd.random_value_fn_iname = NULL;
    +    kccd.comparison_fn_iname = NULL;
    +    kccd.support_fn_iname = NULL;
    +
    +    kccd.print_fn_iname = NULL;
         kccd.debug_print_fn_iname = NULL;
    -    kccd.usage_package = NULL;
    +    kccd.showme_fn_iname = NULL;
    +
    +    kccd.GPR_iname = NULL;
    +    kccd.instance_GPR_iname = NULL;
    +    kccd.recognition_only_GPR_iname = NULL;
    +    kccd.distinguisher_function_iname = NULL;
    +
         kccd.declaration_sequence_number = -1;
    +    kccd.nonstandard_enumeration = FALSE;
         return kccd;
     }
    +
    +
    • The structure kind_constructor_compilation_data is accessed in 5/ins, 5/lp, 7/cg, 7/cgl and here.
    +

    §2. The package. The Inter package for a kind constructor — either a base kind, like "door" +or "number", or a derived kind like "list of ..." — can appear more or less +anywhere in the Inter tree without making any real difference to the meaning +of the program, but we try to be tidy about where to put it. +

    -package_request *RTKindConstructors::package(kind_constructor *kc) { +
    +package_request *RTKindConstructors::kind_package(kind *K) {
    +    return RTKindConstructors::package(K->construct);
    +}
    +
    +package_request *RTKindConstructors::package(kind_constructor *kc) {
         if (kc->compilation_data.kc_package == NULL) {
    +        package_request *pack = NULL;
             if (kc->where_defined_in_source_text) {
    -            kc->compilation_data.kc_package = Hierarchy::local_package_to(KIND_HAP,
    -                kc->where_defined_in_source_text);
    +            pack = Hierarchy::local_package_to(KIND_HAP, kc->where_defined_in_source_text);
             } else if (kc->superkind_set_at) {
    -            kc->compilation_data.kc_package = Hierarchy::local_package_to(KIND_HAP,
    -                kc->superkind_set_at);
    +            pack = Hierarchy::local_package_to(KIND_HAP, kc->superkind_set_at);
             } else {
    -            kc->compilation_data.kc_package = Hierarchy::synoptic_package(KIND_HAP);
    +            pack = Hierarchy::synoptic_package(KIND_HAP);
             }
    -        wording W = KindConstructors::get_name(kc, FALSE);
    -        if (Wordings::nonempty(W))
    -            Hierarchy::apply_metadata_from_wording(kc->compilation_data.kc_package, KIND_NAME_MD_HL, W);
    -        else if (Str::len(kc->explicit_identifier) > 0)
    -            Hierarchy::apply_metadata(kc->compilation_data.kc_package, KIND_NAME_MD_HL,
    -                kc->explicit_identifier);
    -        else
    -            Hierarchy::apply_metadata(kc->compilation_data.kc_package, KIND_NAME_MD_HL, I"(anonymous kind)");
    -        if (kc->where_defined_in_source_text)
    -            Hierarchy::apply_metadata_from_number(kc->compilation_data.kc_package, KIND_AT_MD_HL,
    -                (inter_ti) Wordings::first_wn(Node::get_text(kc->where_defined_in_source_text)));
    +        kc->compilation_data.kc_package = pack;
         }
         return kc->compilation_data.kc_package;
     }
    +
    +

    §3. Neptune definitions of kinds refer to Inter functions by identifier name, +so we will need a way to turn those into inames: +

    -package_request *RTKindConstructors::usage_package(kind_constructor *kc) { - if (kc->compilation_data.usage_package == NULL) - kc->compilation_data.usage_package = - Hierarchy::completion_package(KIND_USAGE_HAP); - return kc->compilation_data.usage_package; -} - -inter_name *RTKindConstructors::xref_iname(kind_constructor *kc) { - if (kc->compilation_data.xref_iname == NULL) - kc->compilation_data.xref_iname = - Hierarchy::make_iname_in(KIND_XREF_SYMBOL_HL, RTKindConstructors::package(kc)); - return kc->compilation_data.xref_iname; +
    +inter_name *RTKindConstructors::iname_of_kit_function(kind *K, text_stream *identifier) {
    +    inter_name *iname = HierarchyLocations::find_by_name(Emit::tree(), identifier);
    +    if (iname == NULL) {
    +        StandardProblems::handmade_problem(Task::syntax_tree(), _p_(Untestable));
    +        Problems::quote_kind(1, K);
    +        Problems::quote_stream(2, identifier);
    +        Problems::issue_problem_segment(
    +            "The kind %1 is declared in a Neptune file to make use of a "
    +            "function called '%2', but this does not seem to exist.");
    +        Problems::issue_problem_end();
    +    }
    +    return iname;
     }
     
    -
    • The structure kind_constructor_compilation_data is accessed in 5/ins, 7/cg, 7/cgl and here.
    -

    §2. An identifier like WHATEVER_TY, then, begins life in a definition inside an +

    §4. These macros are convenient for caching the results of iname creation or lookup, +so that they need be done only once per kind: +

    + +
    define RETURN_INAME_IN(kc, iname, creator)
    +    if (kc->compilation_data.iname == NULL) {
    +        kc->compilation_data.iname = creator;
    +    }
    +    return kc->compilation_data.iname;
    +define RETURN_AVAILABLE_INAME_IN(kc, iname, creator)
    +    if (kc->compilation_data.iname == NULL) {
    +        kc->compilation_data.iname = creator;
    +        Hierarchy::make_available(kc->compilation_data.iname);
    +    }
    +    return kc->compilation_data.iname;
    +
    +

    §5. The "cross-reference iname" is used as a device to allow metadata from some +other package to point to this package without inconvenient namespace clashes. +A symbol is defined at this iname: only its location is meaningful, and its +value is never used. +

    + +
    +inter_name *RTKindConstructors::xref_iname(kind_constructor *kc) {
    +    RETURN_INAME_IN(kc, xref_iname,
    +        Hierarchy::make_iname_in(KIND_XREF_SYMBOL_HL, RTKindConstructors::package(kc)))
    +}
    +
    +

    §6. Iname for the weak ID. The "weak ID" for a kind is a runtime value identifying only its constructor. +This distinguishes base kinds — for example, "number" and "text" have different +weak IDs — but not derived kinds — for example, "list of numbers" and +"list of texts" have the same weak ID. (For that, the "strong ID" is needed.) +

    + +

    An identifier like NUMBER_TY, then, begins life in a definition inside an Neptune file; becomes attached to a constructor here; and finally winds up back in Inter code, because we define it as the constant for the weak kind ID of the kind which the constructor makes:

    -inter_name *RTKindConstructors::weak_ID_iname(kind_constructor *kc) {
    -    if (kc->compilation_data.con_iname == NULL) {
    -        kc->compilation_data.con_iname =
    -            Hierarchy::make_iname_with_specific_translation(WEAK_ID_HL,
    -                RTKindIDs::identifier_for_weak_ID(kc), RTKindConstructors::package(kc));
    -        Hierarchy::make_available(kc->compilation_data.con_iname);
    -    }
    -    return kc->compilation_data.con_iname;
    -}
    -
    -inter_name *RTKindConstructors::UNKNOWN_iname(void) {
    -    return CON_UNKNOWN->compilation_data.con_iname;
    -}
    -
    -inter_name *RTKindConstructors::list_iname(kind_constructor *kc) {
    -    return kc->compilation_data.list_iname;
    -}
    -void RTKindConstructors::set_list_iname(kind_constructor *kc, inter_name *iname) {
    -    kc->compilation_data.list_iname = iname;
    -}
    -
    -inter_name *RTKindConstructors::first_instance_iname(kind *K) {
    -    kind_constructor *kc = Kinds::get_construct(K);
    -    if (kc->compilation_data.first_instance_iname == NULL)
    -        kc->compilation_data.first_instance_iname =
    -            Hierarchy::derive_iname_in_translating(FIRST_INSTANCE_HL,
    -                RTKindDeclarations::iname(K), RTKindConstructors::package(kc));
    -    return kc->compilation_data.first_instance_iname;
    -}
    -
    -inter_name *RTKindConstructors::next_instance_iname(kind *K) {
    -    kind_constructor *kc = Kinds::get_construct(K);
    -    if (kc->compilation_data.next_instance_iname == NULL)
    -        kc->compilation_data.next_instance_iname =
    -            Hierarchy::derive_iname_in_translating(NEXT_INSTANCE_HL,
    -                RTKindDeclarations::iname(K), RTKindConstructors::package(kc));
    -    return kc->compilation_data.next_instance_iname;
    -}
    -
    -inter_name *RTKindConstructors::instance_count_iname(kind *K) {
    -    kind_constructor *kc = Kinds::get_construct(K);
    -    if (kc->compilation_data.instance_count_iname == NULL) {
    -        int N = Kinds::Behaviour::get_range_number(K), hl = -1;
    -        switch (N) {
    -            case 1: hl = COUNT_INSTANCE_1_HL; break;
    -            case 2: hl = COUNT_INSTANCE_2_HL; break;
    -            case 3: hl = COUNT_INSTANCE_3_HL; break;
    -            case 4: hl = COUNT_INSTANCE_4_HL; break;
    -            case 5: hl = COUNT_INSTANCE_5_HL; break;
    -            case 6: hl = COUNT_INSTANCE_6_HL; break;
    -            case 7: hl = COUNT_INSTANCE_7_HL; break;
    -            case 8: hl = COUNT_INSTANCE_8_HL; break;
    -            case 9: hl = COUNT_INSTANCE_9_HL; break;
    -            case 10: hl = COUNT_INSTANCE_10_HL; break;
    -        }
    -        if (hl == -1)
    -            kc->compilation_data.instance_count_iname =
    -                Hierarchy::derive_iname_in_translating(COUNT_INSTANCE_HL, RTKindDeclarations::iname(K),
    -                    RTKindConstructors::kind_package(K));
    -        else
    -            kc->compilation_data.instance_count_iname =
    -                Hierarchy::make_iname_in(hl, RTKindConstructors::kind_package(K));
    -    }
    -    return kc->compilation_data.instance_count_iname;
    +inter_name *RTKindConstructors::weak_ID_iname(kind_constructor *kc) {
    +    RETURN_AVAILABLE_INAME_IN(kc, weak_ID_iname,
    +        Hierarchy::make_iname_with_specific_translation(WEAK_ID_HL,
    +            RTKindIDs::identifier_for_weak_ID(kc), RTKindConstructors::package(kc)))
     }
     
    -

    §3. Convenient storage for some names. +

    §7. Inames to do with the range of values.

    + +
    +inter_name *RTKindConstructors::increment_fn_iname(kind *K) {
    +    kind_constructor *kc = Kinds::get_construct(K);
    +    RETURN_INAME_IN(kc, increment_fn_iname,
    +        Hierarchy::make_iname_in(INCREMENT_FN_HL, RTKindConstructors::package(kc)))
    +}
    +
    +inter_name *RTKindConstructors::decrement_fn_iname(kind *K) {
    +    kind_constructor *kc = Kinds::get_construct(K);
    +    RETURN_INAME_IN(kc, decrement_fn_iname,
    +        Hierarchy::make_iname_in(DECREMENT_FN_HL, RTKindConstructors::package(kc)))
    +}
    +
    +inter_name *RTKindConstructors::default_value_fn_iname(kind_constructor *kc) {
    +    RETURN_INAME_IN(kc, default_value_fn_iname,
    +        Hierarchy::make_iname_in(MKDEF_FN_HL, RTKindConstructors::package(kc)))
    +}
    +
    +inter_name *RTKindConstructors::random_value_fn_iname(kind *K) {
    +    kind_constructor *kc = Kinds::get_construct(K);
    +    RETURN_INAME_IN(kc, random_value_fn_iname,
    +        Hierarchy::make_iname_in(RANGER_FN_HL, RTKindConstructors::package(kc)))
    +}
    +
    +

    §8. A comparison function, testing whether two runtime values of the kind are +equal, can be provided by a kit (defining a kind with a Neptune file), but +is not otherwise created:

    -inter_name *RTKindConstructors::get_kind_GPR_iname(kind *K) {
    -    if (K == NULL) return NULL;
    -    kind_constructor *kc = Kinds::get_construct(K);
    -    if (kc->compilation_data.kind_GPR_iname == NULL) {
    -        package_request *R = RTKindConstructors::kind_package(K);
    -        kc->compilation_data.kind_GPR_iname =
    -            Hierarchy::make_iname_in(GPR_FN_HL, R);
    -    }
    -    return kc->compilation_data.kind_GPR_iname;
    +int RTKindConstructors::comparison_function_provided_by_kit(kind *K) {
    +    if (K == NULL) return FALSE;
    +    text_stream *identifier = Kinds::Behaviour::get_comparison_routine(K);
    +    if (Str::len(identifier) > 0) return TRUE;
    +    return FALSE;
     }
     
    -inter_name *RTKindConstructors::get_exp_kind_GPR_iname(kind *K) {
    -    inter_name *GPR = NULL;
    -    text_stream *GPR_fn_identifier = RTKindConstructors::get_explicit_I6_GPR(K);
    -    if (Str::len(GPR_fn_identifier) > 0)
    -        GPR = HierarchyLocations::find_by_name(Emit::tree(), GPR_fn_identifier);
    -    else
    -        GPR = RTKindConstructors::get_kind_GPR_iname(K);
    -    return GPR;
    -}
    -
    -inter_name *RTKindConstructors::get_instance_GPR_iname(kind *K) {
    -    if (K == NULL) return NULL;
    +inter_name *RTKindConstructors::comparison_fn_iname(kind *K) {
    +    if (RTKindConstructors::comparison_function_provided_by_kit(K) == FALSE)
    +        return NULL;
         kind_constructor *kc = Kinds::get_construct(K);
    -    if (kc->compilation_data.instance_GPR_iname == NULL) {
    -        package_request *R = RTKindConstructors::kind_package(K);
    -        kc->compilation_data.instance_GPR_iname =
    -            Hierarchy::make_iname_in(INSTANCE_GPR_FN_HL, R);
    -    }
    -    return kc->compilation_data.instance_GPR_iname;
    +    RETURN_INAME_IN(kc, comparison_fn_iname,
    +        RTKindConstructors::iname_of_kit_function(K,
    +            Kinds::Behaviour::get_comparison_routine(K)))
     }
     
    -

    §4.

    +

    §9. And similarly for a support function, which can carry out a range of useful +tasks to do with block values (creating values, copying values and so on). +This too exists only if a kit provides it, but (anomalously) the kit does not +need to specify its name in a Neptune file: instead the name is that of the +kind's weak ID plus _Support. For example, TEXT_TY_Support. +

    -inter_name *RTKindConstructors::get_iname(kind *K) {
    -    if (K == NULL) {
    -        if (K_number) return RTKindConstructors::get_iname(K_number);
    -        internal_error("null kind has no printing routine");
    -    }
    -    K = Kinds::weaken(K, K_object);
    -    if (K->construct->compilation_data.pr_iname)
    -        return K->construct->compilation_data.pr_iname;
    -    if (Str::len(K->construct->explicit_identifier) == 0) {
    -        package_request *R = RTKindConstructors::package(K->construct);
    -        K->construct->compilation_data.pr_iname = Hierarchy::make_iname_in(PRINT_DASH_FN_HL, R);
    -        return K->construct->compilation_data.pr_iname;
    -    }
    -
    -    if (Kinds::eq(K, K_use_option)) {
    -        K->construct->compilation_data.pr_iname = Hierarchy::find(PRINT_USE_OPTION_HL);
    -        Hierarchy::make_available(K->construct->compilation_data.pr_iname);
    -        return K->construct->compilation_data.pr_iname;
    -    }
    -    if (Kinds::eq(K, K_table))  {
    -        K->construct->compilation_data.pr_iname = Hierarchy::find(PRINT_TABLE_HL);
    -        Hierarchy::make_available(K->construct->compilation_data.pr_iname);
    -        return K->construct->compilation_data.pr_iname;
    -    }
    -    if (Kinds::eq(K, K_rulebook_outcome))  {
    -        K->construct->compilation_data.pr_iname = Hierarchy::find(PRINT_RULEBOOK_OUTCOME_HL);
    -        Hierarchy::make_available(K->construct->compilation_data.pr_iname);
    -        return K->construct->compilation_data.pr_iname;
    -    }
    -    if (Kinds::eq(K, K_response))  {
    -        K->construct->compilation_data.pr_iname = Hierarchy::find(PRINT_RESPONSE_HL);
    -        Hierarchy::make_available(K->construct->compilation_data.pr_iname);
    -        return K->construct->compilation_data.pr_iname;
    -    }
    -    if (Kinds::eq(K, K_figure_name))  {
    -        K->construct->compilation_data.pr_iname = Hierarchy::find(PRINT_FIGURE_NAME_HL);
    -        Hierarchy::make_available(K->construct->compilation_data.pr_iname);
    -        return K->construct->compilation_data.pr_iname;
    -    }
    -    if (Kinds::eq(K, K_sound_name))  {
    -        K->construct->compilation_data.pr_iname = Hierarchy::find(PRINT_SOUND_NAME_HL);
    -        Hierarchy::make_available(K->construct->compilation_data.pr_iname);
    -        return K->construct->compilation_data.pr_iname;
    -    }
    -    if (Kinds::eq(K, K_external_file))  {
    -        K->construct->compilation_data.pr_iname = Hierarchy::find(PRINT_EXTERNAL_FILE_NAME_HL);
    -        Hierarchy::make_available(K->construct->compilation_data.pr_iname);
    -        return K->construct->compilation_data.pr_iname;
    -    }
    -    if (Kinds::eq(K, K_internal_file))  {
    -        K->construct->compilation_data.pr_iname = Hierarchy::find(PRINT_INTERNAL_FILE_NAME_HL);
    -        Hierarchy::make_available(K->construct->compilation_data.pr_iname);
    -        return K->construct->compilation_data.pr_iname;
    -    }
    -    if (Kinds::eq(K, K_scene))  {
    -        K->construct->compilation_data.pr_iname = Hierarchy::find(PRINT_SCENE_HL);
    -        Hierarchy::make_available(K->construct->compilation_data.pr_iname);
    -        return K->construct->compilation_data.pr_iname;
    -    }
    -    if (Kinds::eq(K, K_dialogue_beat))  {
    -        K->construct->compilation_data.pr_iname = Hierarchy::find(PRINT_DIALOGUE_BEAT_HL);
    -        Hierarchy::make_available(K->construct->compilation_data.pr_iname);
    -        return K->construct->compilation_data.pr_iname;
    -    }
    -    if (Kinds::eq(K, K_dialogue_line))  {
    -        K->construct->compilation_data.pr_iname = Hierarchy::find(PRINT_DIALOGUE_LINE_HL);
    -        Hierarchy::make_available(K->construct->compilation_data.pr_iname);
    -        return K->construct->compilation_data.pr_iname;
    -    }
    -    if (Kinds::eq(K, K_dialogue_choice))  {
    -        K->construct->compilation_data.pr_iname = Hierarchy::find(PRINT_DIALOGUE_CHOICE_HL);
    -        Hierarchy::make_available(K->construct->compilation_data.pr_iname);
    -        return K->construct->compilation_data.pr_iname;
    -    }
    -    if (Kinds::eq(K, K_performance_style))  {
    -        K->construct->compilation_data.pr_iname = Hierarchy::find(PRINT_PERFORMANCE_STYLE_HL);
    -        Hierarchy::make_available(K->construct->compilation_data.pr_iname);
    -        return K->construct->compilation_data.pr_iname;
    -    }
    -
    -    package_request *R = NULL;
    -    int external = TRUE;
    -    if ((Kinds::get_construct(K) == CON_rule) ||
    -        (Kinds::get_construct(K) == CON_rulebook)) external = TRUE;
    -    if (Kinds::Behaviour::is_an_enumeration(K)) {
    -        R = RTKindConstructors::kind_package(K); external = FALSE;
    -    }
    -    text_stream *X = K->construct->print_identifier;
    -    if (Kinds::Behaviour::is_quasinumerical(K)) {
    -        R = RTKindConstructors::kind_package(K); external = FALSE;
    -    }
    -    if (Kinds::eq(K, K_time)) external = TRUE;
    -    if (Kinds::eq(K, K_number)) external = TRUE;
    -    if (Kinds::eq(K, K_real_number)) external = TRUE;
    -    if (Str::len(X) == 0) X = I"DecimalNumber";
    -
    -    if (R) {
    -        if (external) {
    -            K->construct->compilation_data.pr_iname = Hierarchy::make_iname_in(PRINT_FN_HL, R);
    -            inter_name *actual_iname = HierarchyLocations::find_by_name(Emit::tree(), X);
    -            Emit::iname_constant(K->construct->compilation_data.pr_iname, K_value, actual_iname);
    -        } else {
    -            WRITE_TO(STDERR, "identifier: '%S'\n", X);
    -            internal_error("internal but unknown kind printing routine");
    -        }
    -    } else {
    -        if (external) K->construct->compilation_data.pr_iname = HierarchyLocations::find_by_name(Emit::tree(), X);
    -        else internal_error("internal but unpackaged kind printing routine");
    -    }
    -    return K->construct->compilation_data.pr_iname;
    -}
    -package_request *RTKindConstructors::kind_package(kind *K) {
    -    return RTKindConstructors::package(K->construct);
    -}
    -inter_name *RTKindConstructors::get_inc_iname(kind *K) {
    -    if (K == NULL) internal_error("null kind has no inc routine");
    -    if (K->construct->compilation_data.inc_iname) return K->construct->compilation_data.inc_iname;
    -    package_request *R = RTKindConstructors::kind_package(K);
    -    K->construct->compilation_data.inc_iname = Hierarchy::make_iname_in(DECREMENT_FN_HL, R);
    -    return K->construct->compilation_data.inc_iname;
    -}
    -inter_name *RTKindConstructors::get_dec_iname(kind *K) {
    -    if (K == NULL) internal_error("null kind has no dec routine");
    -    if (K->construct->compilation_data.dec_iname) return K->construct->compilation_data.dec_iname;
    -    package_request *R = RTKindConstructors::kind_package(K);
    -    K->construct->compilation_data.dec_iname = Hierarchy::make_iname_in(INCREMENT_FN_HL, R);
    -    return K->construct->compilation_data.dec_iname;
    -}
    -inter_name *RTKindConstructors::get_ranger_iname(kind *K) {
    -    if (K == NULL) internal_error("null kind has no ranger fn");
    -    if (K->construct->compilation_data.ranger_iname) return K->construct->compilation_data.ranger_iname;
    -    package_request *R = RTKindConstructors::kind_package(K);
    -    K->construct->compilation_data.ranger_iname = Hierarchy::make_iname_in(RANGER_FN_HL, R);
    -    return K->construct->compilation_data.ranger_iname;
    -}
    -inter_name *RTKindConstructors::get_mkdef_iname(kind_constructor *kc) {
    -    if (kc->compilation_data.mkdef_iname == NULL)
    -        kc->compilation_data.mkdef_iname =
    -            Hierarchy::make_iname_in(MKDEF_FN_HL, RTKindConstructors::package(kc));
    -    return kc->compilation_data.mkdef_iname;
    -}
    -inter_name *RTKindConstructors::get_debug_print_fn_iname(kind *K) {
    -    if (K == NULL) K = K_number;
    -    if (K->construct->compilation_data.debug_print_fn_iname)
    -        return K->construct->compilation_data.debug_print_fn_iname;
    -    if (Str::len(K->construct->explicit_identifier) == 0) {
    -        K->construct->compilation_data.debug_print_fn_iname = RTKindConstructors::get_iname(K);
    -        return K->construct->compilation_data.debug_print_fn_iname;
    -    }
    -
    -    if (Str::len(K->construct->ACTIONS_identifier) > 0)
    -        K->construct->compilation_data.debug_print_fn_iname =
    -            HierarchyLocations::find_by_name(Emit::tree(), K->construct->ACTIONS_identifier);
    -    else
    -        K->construct->compilation_data.debug_print_fn_iname =
    -            HierarchyLocations::find_by_name(Emit::tree(), I"DA_Name");
    -    return K->construct->compilation_data.debug_print_fn_iname;
    +int RTKindConstructors::support_function_provided_by_kit(kind *K) {
    +    if (K == NULL) return FALSE;
    +    if (RTKindConstructors::support_fn_iname(K)) return TRUE;
    +    return FALSE;
     }
     
    -inter_name *RTKindConstructors::get_explicit_I6_GPR_iname(kind *K) {
    -    if (K == NULL) internal_error("RTKindConstructors::get_explicit_I6_GPR on null kind");
    -    if (Str::len(K->construct->explicit_GPR_identifier) > 0)
    -        return HierarchyLocations::find_by_name(Emit::tree(), K->construct->explicit_GPR_identifier);
    -    return NULL;
    +inter_name *RTKindConstructors::support_fn_iname(kind *K) {
    +    kind_constructor *kc = Kinds::get_construct(K);
    +    RETURN_INAME_IN(kc, support_fn_iname,
    +        RTKindConstructors::create_support_fn_iname(kc))
     }
     
    -inter_name *RTKindConstructors::get_distinguisher_iname(kind *K) {
    -    text_stream *N = Kinds::Behaviour::get_distinguisher(K);
    -    if (N == NULL) return NULL;
    -    return HierarchyLocations::find_by_name(Emit::tree(), N);
    -}
    -
    -inter_name *RTKindConstructors::get_comparison_fn_iname(kind_constructor *kc) {
    -    return HierarchyLocations::find_by_name(Emit::tree(),
    -        KindConstructors::get_comparison_fn_identifier(kc));
    -}
    -
    -inter_name *RTKindConstructors::get_support_fn_iname(kind_constructor *kc) {
    +inter_name *RTKindConstructors::create_support_fn_iname(kind_constructor *kc) {
         TEMPORARY_TEXT(N)
         WRITE_TO(N, "%S_Support", kc->explicit_identifier);
         inter_name *iname = HierarchyLocations::find_by_name(Emit::tree(), N);
    @@ -446,558 +303,428 @@ of the kind which the constructor makes:
         return iname;
     }
     
    -

    §5. Moving on to understanding: some kinds can be used as tokens in Understand -sentences, others can't. Thus "[time]" is a valid Understand token, but -"[stored action]" is not. -

    - -

    Some kinds provide have a GPR ("general parsing routine", an I6 piece of -jargon) defined in some Inter kit: if so, this returns the GPR's name; if -not, it returns NULL. +

    §10. Inames to do with enumerative kinds. For kinds of object, constants for the first instance, and a property for the +next instance: this enables rapid looping through all instances at runtime.

    -text_stream *RTKindConstructors::get_explicit_I6_GPR(kind *K) {
    -    if (K == NULL) internal_error("RTKindConstructors::get_explicit_I6_GPR on null kind");
    -    return K->construct->explicit_GPR_identifier;
    +inter_name *RTKindConstructors::first_instance_iname(kind *K) {
    +    kind_constructor *kc = Kinds::get_construct(K);
    +    RETURN_INAME_IN(kc, first_instance_iname,
    +        Hierarchy::derive_iname_in_translating(FIRST_INSTANCE_HL,
    +            RTKindDeclarations::iname(K), RTKindConstructors::package(kc)))
    +}
    +
    +inter_name *RTKindConstructors::next_instance_iname(kind *K) {
    +    kind_constructor *kc = Kinds::get_construct(K);
    +    RETURN_INAME_IN(kc, next_instance_iname,
    +        Hierarchy::derive_iname_in_translating(NEXT_INSTANCE_HL,
    +            RTKindDeclarations::iname(K), RTKindConstructors::package(kc)))
     }
     
    -

    §6. Can the kind have a GPR of any kind in the final code? +

    §11. The "base IK iname" is not in fact used as the definition of anything: it +exists for other inames to be derived from it. See Instance Counting.

    -int RTKindConstructors::offers_I6_GPR(kind *K) {
    -    if (K == NULL) return FALSE;
    -    return KindConstructors::offers_I6_GPR(K->construct);
    +inter_name *RTKindConstructors::base_IK_iname(kind *K) {
    +    kind_constructor *kc = Kinds::get_construct(K);
    +    RETURN_INAME_IN(kc, base_IK_iname,
    +        RTKindConstructors::create_base_IK_iname(K))
     }
    -
    -

    §7. Request that a GPR be compiled for this kind; the return value tell us whether -this will be allowed or not. -

    -
    -int RTKindConstructors::request_I6_GPR(kind *K) {
    -    if (RTKindConstructors::offers_I6_GPR(K) == FALSE) return FALSE;  can't oblige
    -    if (K->construct->compilation_data.needs_GPR == FALSE) {
    -        text_stream *desc = Str::new();
    -        WRITE_TO(desc, "GPR for kind %u", K);
    -        if (Kinds::Behaviour::is_an_enumeration(K)) {
    -            K->construct->compilation_data.needs_GPR = TRUE;
    -            Sequence::queue(&KindGPRs::enumeration_agent, STORE_POINTER_kind(K), desc);
    -        } else if (Kinds::Behaviour::is_quasinumerical(K)) {
    -            K->construct->compilation_data.needs_GPR = TRUE;
    -            Sequence::queue(&KindGPRs::quasinumerical_agent, STORE_POINTER_kind(K), desc);
    -        }
    -        return TRUE;
    +inter_name *RTKindConstructors::create_base_IK_iname(kind *K) {
    +    package_request *pack = RTKindConstructors::kind_package(K);
    +    int N = Kinds::Behaviour::get_range_number(K), hl = -1;
    +    switch (N) {
    +        case 1: hl = BASE_IK_1_HL; break;
    +        case 2: hl = BASE_IK_2_HL; break;
    +        case 3: hl = BASE_IK_3_HL; break;
    +        case 4: hl = BASE_IK_4_HL; break;
    +        case 5: hl = BASE_IK_5_HL; break;
    +        case 6: hl = BASE_IK_6_HL; break;
    +        case 7: hl = BASE_IK_7_HL; break;
    +        case 8: hl = BASE_IK_8_HL; break;
    +        case 9: hl = BASE_IK_9_HL; break;
    +        case 10: hl = BASE_IK_10_HL; break;
         }
    -    return TRUE;
    +    if (hl >= 1) return Hierarchy::make_iname_in(hl, pack);
    +
    +    return Hierarchy::derive_iname_in_translating(BASE_IK_HL,
    +        RTKindDeclarations::iname(K), pack);
     }
     
    -

    §8. A recognition-only GPR is used for matching specific data in the course of -parsing names of objects, but not as a grammar token in its own right. +

    §12. The "icount" is a genuine constant, currently defined for each enumeration +and each kind of object. The naming system here is potentially problematic: +"figure name" counts out as ICOUNT_FIGURE_NAME, "door" as ICOUNT_DOOR, +and so on. This is potentially open to namespace clashes, given the truncation +to 31 characters, but for kinds whose names fit into that length without +truncation, there should never be any problem. +

    + +

    All the same,icounts should probably be used only when necessary, and WorldModelKit +no longer uses the icounts for any kinds of object, where clashes are more +plausible.

    -text_stream *RTKindConstructors::get_recognition_only_GPR(kind *K) {
    +inter_name *RTKindConstructors::icount_iname(kind *K) {
    +    kind_constructor *kc = Kinds::get_construct(K);
    +    RETURN_INAME_IN(kc, icount_iname,
    +        RTKindConstructors::create_icount_iname(K))
    +}
    +
    +inter_name *RTKindConstructors::create_icount_iname(kind *K) {
    +    package_request *pack = RTKindConstructors::kind_package(K);
    +    TEMPORARY_TEXT(ICN)
    +    WRITE_TO(ICN, "ICOUNT_");
    +    Kinds::Textual::write(ICN, K);
    +    Str::truncate(ICN, 31);
    +    LOOP_THROUGH_TEXT(pos, ICN) {
    +        Str::put(pos, Characters::toupper(Str::get(pos)));
    +        if (Characters::isalnum(Str::get(pos)) == FALSE) Str::put(pos, '_');
    +    }
    +    inter_name *iname = Hierarchy::make_iname_with_specific_translation(ICOUNT_HL,
    +        InterSymbolsTable::render_identifier_unique(LargeScale::main_scope(Emit::tree()), ICN),
    +        pack);
    +    Hierarchy::make_available(iname);
    +    DISCARD_TEXT(ICN)
    +    return iname;
    +}
    +
    +

    §13. For nonstandard enumerations, we need an array holding the valid values. +

    + +
    +inter_name *RTKindConstructors::instances_array_iname(kind *K) {
    +    kind_constructor *kc = Kinds::get_construct(K);
    +    RETURN_INAME_IN(kc, instances_array_iname,
    +        Hierarchy::derive_iname_in_translating(INSTANCES_ARRAY_HL,
    +            RTKindDeclarations::iname(K), RTKindConstructors::package(kc)))
    +}
    +
    +

    §14. Sometimes we want to cache the constant list produced by "list of doors", +say — an Inform 7 list. This means that if there are multiple mentions of +the "list of doors", we will only compile the constant once. It goes here: +

    + +
    +inter_name *RTKindConstructors::list_iname(kind_constructor *kc) {
    +    return kc->compilation_data.instance_list_iname;
    +}
    +void RTKindConstructors::set_list_iname(kind_constructor *kc, inter_name *iname) {
    +    kc->compilation_data.instance_list_iname = iname;
    +}
    +
    +

    §15. Non-standard enumerations need a function which, given a value, returns its +sequence position in the enumeration: +

    + +
    +inter_name *RTKindConstructors::indexing_fn_iname(kind *K) {
    +    kind_constructor *kc = Kinds::get_construct(K);
    +    RETURN_INAME_IN(kc, indexing_fn_iname,
    +        Hierarchy::make_iname_in(INDEXING_FN_HL, RTKindConstructors::package(kc)))
    +}
    +
    +

    §16. Inames to do with printing. Note that all kinds of object share a common print function. +

    + +
    +inter_name *RTKindConstructors::printing_fn_iname(kind *K) {
    +    if (K == NULL) K = K_number;
    +    if (K == NULL) internal_error("null kind has no printing routine");
    +    K = Kinds::weaken(K, K_object);
    +
    +    kind_constructor *kc = Kinds::get_construct(K);
    +    RETURN_INAME_IN(kc, print_fn_iname,
    +        RTKindConstructors::obtain_printing_fn_iname(K))
    +}
    +
    +

    §17. This innocuous-looking function has been the cause of considerable grief over +the years because of the overlapping alternatives in play (where the kind came +from, who should write the function, where it should be in the Inter tree, who +gets to choose its identifier, and whether it is available to kit code through +the linker). This is the cleanest expression I can get: +

    + +
    +inter_name *RTKindConstructors::obtain_printing_fn_iname(kind *K) {
    +    kind_constructor *kc = Kinds::get_construct(K);
    +    package_request *pack = RTKindConstructors::package(kc);
    +    text_stream *X = kc->print_identifier;
    +
    +    If the synoptic module wants to compile this printing function, let it17.1;
    +
    +    if ((Kinds::Behaviour::comes_from_Neptune(K) == FALSE) ||
    +        (Kinds::Behaviour::is_an_enumeration(K)))
    +        This runtime module will compile the printing function17.2
    +    else
    +        The printing function can be found in a kit17.3;
    +}
    +
    +

    §17.1. For example, "use option" currently falls into this case: +

    + +

    If the synoptic module wants to compile this printing function, let it17.1 = +

    + +
    +    inter_name *synoptic_iname =
    +        SynopticHierarchy::printing_function_iname(Emit::tree(), K);
    +    if (synoptic_iname) return synoptic_iname;
    +
    +
    • This code is used in §17.
    +

    §17.2. For example, "scene" currently falls into this case: +

    + +

    This runtime module will compile the printing function17.2 = +

    + +
    +    if (Str::len(X) > 0) {
    +        inter_name *iname = Hierarchy::make_iname_in(PRINT_FN_HL, pack);
    +        InterNames::set_translation(iname, X);
    +        Hierarchy::make_available(iname);
    +        return iname;
    +    } else {
    +        return Hierarchy::make_iname_in(PRINT_DASH_FN_HL, pack);
    +    }
    +
    +
    • This code is used in §17.
    +

    §17.3. For example, "rulebook outcome" currently falls into this case: +

    + +

    The printing function can be found in a kit17.3 = +

    + +
    +    inter_name *iname = NULL;
    +    if (Str::len(X) > 0) {
    +        return iname = RTKindConstructors::iname_of_kit_function(K, X);
    +    } else {
    +        return iname = RTKindConstructors::iname_of_kit_function(K, I"DecimalNumber");
    +    }
    +
    +
    • This code is used in §17.
    +

    §18. This is the variant used when printing values as part of the output of the +ACTIONS debugging command, for example. It's the same as the regular printing +function unless the Neptune definition for a kind says otherwise. +

    + +
    +inter_name *RTKindConstructors::debug_print_fn_iname(kind *K) {
    +    if (K == NULL) K = K_number;
    +    if (K == NULL) internal_error("null kind has no printing routine");
    +    K = Kinds::weaken(K, K_object);
    +
    +    kind_constructor *kc = Kinds::get_construct(K);
    +    RETURN_INAME_IN(kc, debug_print_fn_iname,
    +        RTKindConstructors::obtain_debug_print_fn_iname(K))
    +}
    +
    +inter_name *RTKindConstructors::obtain_debug_print_fn_iname(kind *K) {
    +    text_stream *identifier = K->construct->ACTIONS_identifier;
    +    if (Str::len(identifier) > 0)
    +        return RTKindConstructors::iname_of_kit_function(K, identifier);
    +    return RTKindConstructors::printing_fn_iname(K);
    +}
    +
    +

    §19. And a few kinds also need a special function to improve the results of +SHOWME, or the phrase "showme", also for debugging purposes. +

    + +
    +inter_name *RTKindConstructors::showme_fn_iname(kind *K) {
         if (K == NULL) return NULL;
    -    return K->construct->recognition_routine;
    -}
    -
    -inter_name *RTKindConstructors::get_recognition_only_GPR_as_iname(kind *K) {
    -    text_stream *N = RTKindConstructors::get_recognition_only_GPR(K);
    -    if (N == NULL) return NULL;
    -    return HierarchyLocations::find_by_name(Emit::tree(), N);
    +    kind_constructor *kc = Kinds::get_construct(K);
    +    RETURN_INAME_IN(kc, showme_fn_iname,
    +        Hierarchy::make_iname_in(SHOWME_FN_HL, RTKindConstructors::kind_package(K)))
     }
     
    -

    §9. The following is used only when the kind has named instances. +

    §20. Inames to do with the command parser. The command parser is not present in Basic Inform projects, so we do nothing +in this area unless the parsing plugin activates and calls the following:

    -int RTKindConstructors::get_highest_valid_value_as_integer(kind *K) {
    -    if (K == NULL) return 0;
    -    return RTKindConstructors::get_highest_valid_value_as_integer_kc(K->construct);
    -}
    +int GPR_compilation_enabled = FALSE;
     
    -int RTKindConstructors::get_highest_valid_value_as_integer_kc(kind_constructor *kc) {
    -    if (kc == NULL) return 0;
    -    if (kc == CON_activity) return NUMBER_CREATED(activity);
    -    if (kc == Kinds::get_construct(K_equation)) return NUMBER_CREATED(equation);
    -    if (kc == CON_rule) return NUMBER_CREATED(booking);
    -    if (kc == CON_rulebook) return NUMBER_CREATED(rulebook);
    -    if (kc == Kinds::get_construct(K_table)) return NUMBER_CREATED(table) + 1;
    -    if (kc == Kinds::get_construct(K_use_option)) return NUMBER_CREATED(use_option);
    -    if (kc == Kinds::get_construct(K_response)) return NUMBER_CREATED(response_message);
    -    return kc->next_free_value - 1;
    +void RTKindConstructors::enable_parsing(void) {
    +    GPR_compilation_enabled = TRUE;
    +}
    +int RTKindConstructors::GPR_compilation_enabled(void) {
    +    return GPR_compilation_enabled;
     }
     
    -

    §10. Compilation.

    +

    §21. "GPR" is old Inform jargon for "general parsing routine", a function which +examines words produced by the command parser to match them as the name of +an instance of the kind. See Kind GPRs for more. +

    + +

    When kits create kinds using Neptune files, they will often supply their own +GPR functions, and if they do then we use those rather than construct our own. +

    -int RTKindConstructors::is_subkind_of_object(kind_constructor *kc) {
    +int RTKindConstructors::GPR_provided_by_kit(kind *K) {
    +    if (K == NULL) return FALSE;
    +    text_stream *identifier = Kinds::Behaviour::GPR_identifier(K);
    +    if (Str::len(identifier) > 0) return TRUE;
    +    return FALSE;
    +}
    +
    +inter_name *RTKindConstructors::GPR_iname(kind *K) {
    +    if (K == NULL) return NULL;
    +    kind_constructor *kc = Kinds::get_construct(K);
    +    RETURN_INAME_IN(kc, GPR_iname, RTKindConstructors::create_GPR_iname(K))
    +}
    +
    +inter_name *RTKindConstructors::create_GPR_iname(kind *K) {
    +    if (RTKindConstructors::GPR_provided_by_kit(K))
    +        return RTKindConstructors::iname_of_kit_function(K,
    +            Kinds::Behaviour::GPR_identifier(K));
    +    kind_constructor *kc = Kinds::get_construct(K);
    +    return Hierarchy::make_iname_in(GPR_FN_HL, RTKindConstructors::package(kc));
    +}
    +
    +

    §22. Some kinds have a few supplementary GPRs as well. Enumerations have the +following, for parsing non-standard names for instances: +

    + +
    +inter_name *RTKindConstructors::instance_GPR_iname(kind *K) {
    +    if (K == NULL) return NULL;
    +    kind_constructor *kc = Kinds::get_construct(K);
    +    RETURN_INAME_IN(kc, instance_GPR_iname,
    +        Hierarchy::make_iname_in(INSTANCE_GPR_FN_HL, RTKindConstructors::package(kc)))
    +}
    +
    +

    §23. A recognition-only GPR is used for matching specific data in the course of +parsing names of objects, but not as a grammar token in its own right. If this +exists at all, it is provided by a kit and named in a Neptune command. +

    + +
    +int RTKindConstructors::recognition_only_GPR_provided_by_kit(kind *K) {
    +    if (K == NULL) return FALSE;
    +    text_stream *identifier = Kinds::Behaviour::recognition_only_GPR_identifier(K);
    +    if (Str::len(identifier) > 0) return TRUE;
    +    return FALSE;
    +}
    +
    +inter_name *RTKindConstructors::recognition_only_GPR_iname(kind *K) {
    +    if (RTKindConstructors::recognition_only_GPR_provided_by_kit(K) == FALSE)
    +        return NULL;
    +    kind_constructor *kc = Kinds::get_construct(K);
    +    RETURN_INAME_IN(kc, recognition_only_GPR_iname,
    +        RTKindConstructors::iname_of_kit_function(K,
    +            Kinds::Behaviour::recognition_only_GPR_identifier(K)))
    +}
    +
    +

    §24. Same exact deal with the "distinguisher function" for a kind, also used +in parsing. See Parse Name Properties. +

    + +
    +int RTKindConstructors::distinguisher_function_provided_by_kit(kind *K) {
    +    if (K == NULL) return FALSE;
    +    text_stream *identifier = Kinds::Behaviour::get_distinguisher(K);
    +    if (Str::len(identifier) > 0) return TRUE;
    +    return FALSE;
    +}
    +
    +inter_name *RTKindConstructors::distinguisher_function_iname(kind *K) {
    +    if (RTKindConstructors::distinguisher_function_provided_by_kit(K) == FALSE)
    +        return NULL;
    +    kind_constructor *kc = Kinds::get_construct(K);
    +    RETURN_INAME_IN(kc, distinguisher_function_iname,
    +        RTKindConstructors::iname_of_kit_function(K,
    +            Kinds::Behaviour::get_distinguisher(K)))
    +}
    +
    +

    §25. Miscellaneous utility functions.

    + +
    +int RTKindConstructors::is_subkind_of_object(kind_constructor *kc) {
         if (Kinds::Behaviour::is_subkind_of_object(Kinds::base_construction(kc)))
             return TRUE;
         return FALSE;
     }
     
    -int RTKindConstructors::is_object(kind_constructor *kc) {
    +int RTKindConstructors::is_object(kind_constructor *kc) {
         if (Kinds::Behaviour::is_object(Kinds::base_construction(kc))) return TRUE;
         return FALSE;
     }
    +
    +

    §26. The following works for all enumerations, standard or not: +

    -void RTKindConstructors::compile(void) { - RTKindConstructors::assign_declaration_sequence_numbers(); - kind_constructor *kc; - LOOP_OVER(kc, kind_constructor) { - if ((kc == CON_KIND_VARIABLE) || (kc == CON_INTERMEDIATE)) continue; - kind *K = Kinds::base_construction(kc); - package_request *pack = RTKindConstructors::package(kc); - - Emit::numeric_constant(RTKindConstructors::xref_iname(kc), 561); - - Emit::numeric_constant(RTKindConstructors::weak_ID_iname(kc), 0); - Hierarchy::make_available(RTKindConstructors::weak_ID_iname(kc)); - - TEMPORARY_TEXT(S) - WRITE_TO(S, "%+W", KindConstructors::get_name(kc, FALSE)); - Hierarchy::apply_metadata(pack, - KIND_PNAME_MD_HL, S); - DISCARD_TEXT(S) - - inference *inf; - int made_exp = FALSE; - KNOWLEDGE_LOOP(inf, KindSubjects::from_kind(K), property_inf) - if (PropertyInferences::get_property(inf) == P_specification) { - parse_node *spec = PropertyInferences::get_value(inf); - TEMPORARY_TEXT(exp) - IndexUtilities::dequote(exp, Lexer::word_raw_text(Wordings::first_wn(Node::get_text(spec)))); - Hierarchy::apply_metadata(pack, KIND_SPECIFICATION_MD_HL, exp); - DISCARD_TEXT(exp) - made_exp = TRUE; - break; - } - if ((made_exp == FALSE) && (RTKindConstructors::is_subkind_of_object(kc) == FALSE)) { - text_stream *exp = Kinds::Behaviour::get_specification_text(K); - if (Str::len(exp) > 0) - Hierarchy::apply_metadata(pack, KIND_SPECIFICATION_MD_HL, exp); - } - Hierarchy::apply_metadata_from_number(pack, - KIND_IS_BASE_MD_HL, 1); - if (KindConstructors::is_arithmetic(kc)) - Hierarchy::apply_metadata_from_number(pack, KIND_IS_QUASINUMERICAL_MD_HL, 1); - if (RTKindConstructors::is_object(kc)) { - Hierarchy::apply_metadata_from_number(pack, KIND_IS_OBJECT_MD_HL, 1); - } else { - Hierarchy::apply_metadata_from_number(pack, KIND_IS_OBJECT_MD_HL, 0); - } - if (RTKindConstructors::is_subkind_of_object(kc)) { - kind *super_K = Latticework::super(K); - Hierarchy::apply_metadata_from_number(pack, KIND_IS_SKOO_MD_HL, 1); - TEMPORARY_TEXT(SK) - WRITE_TO(SK, "%u", super_K); - Hierarchy::apply_metadata(pack, INDEX_SUPERKIND_MD_HL, SK); - DISCARD_TEXT(SK) - Hierarchy::apply_metadata_from_iname(pack, SUPERKIND_MD_HL, - RTKindConstructors::weak_ID_iname(super_K->construct)); - } else { - Hierarchy::apply_metadata_from_number(pack, KIND_IS_SKOO_MD_HL, 0); - } - if (Kinds::Behaviour::is_subkind_of_object(K)) { - wording W = Kinds::Behaviour::get_name(K, FALSE); - if (Wordings::nonempty(W)) { - TEMPORARY_TEXT(temp) - WRITE_TO(temp, "kind_%N", Wordings::first_wn(W)); - if (DocReferences::validate_if_possible(temp)) - Kinds::Behaviour::set_documentation_reference(K, temp); - DISCARD_TEXT(temp) - } - } - text_stream *DR = Kinds::Behaviour::get_documentation_reference(K); - if (Str::len(DR) > 0) - Hierarchy::apply_metadata(pack, KIND_DOCUMENTATION_MD_HL, DR); - if (Kinds::is_proper_constructor(K)) { - TEMPORARY_TEXT(CONS) - int i, a = KindConstructors::arity(Kinds::get_construct(K)); - if ((a == 2) && - (KindConstructors::variance(Kinds::get_construct(K), 0) == - KindConstructors::variance(Kinds::get_construct(K), 1))) - a = 1; - for (i=0; i<a; i++) { - if (i > 0) WRITE_TO(CONS, ", "); - if (KindConstructors::variance(Kinds::get_construct(K), i) > 0) - WRITE_TO(CONS, "covariant"); - else - WRITE_TO(CONS, "contravariant"); - if (a > 1) WRITE_TO(CONS, " in %c", 'K'+i); - } - Hierarchy::apply_metadata(pack, KIND_INDEX_VARIANCE_MD_HL, CONS); - DISCARD_TEXT(CONS) - } - - - Hierarchy::apply_metadata_from_number(pack, KIND_INDEX_PRIORITY_MD_HL, - (inter_ti) Kinds::Behaviour::get_index_priority(K)); - if (RTKindConstructors::is_subkind_of_object(kc)) { - Hierarchy::apply_metadata_from_iname(pack, - KIND_CLASS_MD_HL, RTKindDeclarations::iname(Kinds::base_construction(kc))); - } - if (KindConstructors::is_definite(kc)) { - Hierarchy::apply_metadata_from_number(pack, - KIND_IS_DEF_MD_HL, 1); - } else { - Hierarchy::apply_metadata_from_number(pack, - KIND_IS_DEF_MD_HL, 0); - } - if (KindConstructors::uses_block_values(kc)) { - Hierarchy::apply_metadata_from_number(pack, - KIND_HAS_BV_MD_HL, 1); - } else { - Hierarchy::apply_metadata_from_number(pack, - KIND_HAS_BV_MD_HL, 0); - } - inter_name *weak_iname = RTKindIDs::weak_iname_of_constructor(kc); - if (weak_iname == NULL) internal_error("no iname for weak ID"); - Hierarchy::apply_metadata_from_iname(pack, - KIND_WEAK_ID_MD_HL, weak_iname); - Hierarchy::apply_metadata_from_iname(pack, - KIND_STRONG_ID_MD_HL, RTKindConstructors::weak_ID_iname(kc)); - if (KindConstructors::uses_block_values(kc)) { - inter_name *sf_iname = RTKindConstructors::get_support_fn_iname(kc); - if (sf_iname) - Hierarchy::apply_metadata_from_iname(pack, - KIND_SUPPORT_FN_MD_HL, sf_iname); - else internal_error("kind with block values but no support function"); - } - - if ((RTKindConstructors::is_subkind_of_object(kc) == FALSE) && - (KindConstructors::is_definite(kc)) && - (KindConstructors::uses_signed_comparisons(kc) == FALSE)) { - inter_name *cf_iname = RTKindConstructors::get_comparison_fn_iname(kc); - if (cf_iname) - Hierarchy::apply_metadata_from_iname(pack, - KIND_CMP_FN_MD_HL, cf_iname); - else internal_error("kind with no comparison function"); - } - if (Kinds::Behaviour::definite(Kinds::base_construction(kc))) { - inter_name *mkdef_iname = RTKindConstructors::get_mkdef_iname(kc); - Hierarchy::apply_metadata_from_iname(pack, - KIND_MKDEF_FN_MD_HL, mkdef_iname); - } - if (RTKindConstructors::is_subkind_of_object(kc) == FALSE) { - inter_name *printing_rule_name = - RTKindConstructors::get_iname(Kinds::base_construction(kc)); - if (printing_rule_name) - Hierarchy::apply_metadata_from_iname(pack, - KIND_PRINT_FN_MD_HL, printing_rule_name); - } - if ((RTKindConstructors::is_subkind_of_object(kc) == FALSE) && - (KindConstructors::is_an_enumeration(kc))) - Hierarchy::apply_metadata_from_number(pack, - KIND_DSIZE_MD_HL, - (inter_ti) RTKindConstructors::get_highest_valid_value_as_integer_kc(kc)); - - if (Kinds::Behaviour::definite(Kinds::base_construction(kc))) { - inter_name *mkdef_iname = RTKindConstructors::get_mkdef_iname(kc); - packaging_state save = Functions::begin(mkdef_iname); - inter_symbol *sk_s = LocalVariables::new_other_as_symbol(I"sk"); - EmitCode::inv(RETURN_BIP); - EmitCode::down(); - if (KindConstructors::uses_block_values(kc)) { - inter_name *iname = Hierarchy::find(BLKVALUECREATE_HL); - EmitCode::call(iname); - EmitCode::down(); - EmitCode::val_symbol(K_value, sk_s); - EmitCode::up(); - } else { - if (RTKindConstructors::is_subkind_of_object(kc)) - EmitCode::val_false(); - else - DefaultValues::val(Kinds::base_construction(kc), - EMPTY_WORDING, "default value"); - } - EmitCode::up(); - Functions::end(save); - } - - if ((Kinds::Behaviour::is_an_enumeration(K)) || (Kinds::Behaviour::is_object(K))) { - TEMPORARY_TEXT(ICN) - WRITE_TO(ICN, "ICOUNT_"); - Kinds::Textual::write(ICN, K); - Str::truncate(ICN, 31); - LOOP_THROUGH_TEXT(pos, ICN) { - Str::put(pos, Characters::toupper(Str::get(pos))); - if (Characters::isalnum(Str::get(pos)) == FALSE) Str::put(pos, '_'); - } - inter_name *iname = Hierarchy::make_iname_with_specific_translation(ICOUNT_HL, - InterSymbolsTable::render_identifier_unique(LargeScale::main_scope(Emit::tree()), ICN), - RTKindConstructors::kind_package(K)); - Hierarchy::make_available(iname); - DISCARD_TEXT(ICN) - Emit::numeric_constant(iname, (inter_ti) Instances::count(K)); - - if (Kinds::eq(K, K_room)) { - inter_name *iname = - Hierarchy::make_iname_in(FWMATRIX_SIZE_HL, RTKindConstructors::kind_package(K)); - Hierarchy::make_available(iname); - inter_ti val = 0; - if (TargetVMs::is_16_bit(Task::vm()) == FALSE) - val = (inter_ti) (Instances::count(K)*Instances::count(K)); - if (global_compilation_settings.fast_route_finding) - val = (inter_ti) (Instances::count(K)*Instances::count(K)); - if (global_compilation_settings.slow_route_finding) - val = 0; - if (val <= 1) val = 2; - Emit::numeric_constant(iname, (inter_ti) val); - } - } - if (Kinds::Behaviour::is_object(K)) { - Hierarchy::apply_metadata_from_number(RTKindConstructors::kind_package(K), - KIND_IS_OBJECT_MD_HL, 1); - } else { - Hierarchy::apply_metadata_from_number(RTKindConstructors::kind_package(K), - KIND_IS_OBJECT_MD_HL, 0); - } - - if (Kinds::Behaviour::is_object(K)) { - if (RTShowmeCommand::needed_for_kind(K)) { - inter_name *iname = Hierarchy::make_iname_in(SHOWME_FN_HL, - RTKindConstructors::kind_package(K)); - RTShowmeCommand::compile_kind_showme_fn(iname, K); - Hierarchy::apply_metadata_from_iname(RTKindConstructors::kind_package(K), - KIND_SHOWME_MD_HL, iname); - } - } - - if (Kinds::eq(K, K_players_holdall)) - Hierarchy::apply_metadata_from_number(pack, RUCKSACK_CLASS_MD_HL, 1); - - Compile data support functions10.8; - - if (kc->compilation_data.declaration_sequence_number >= 0) - Hierarchy::apply_metadata_from_number(pack, KIND_DECLARATION_ORDER_MD_HL, - (inter_ti) kc->compilation_data.declaration_sequence_number); - - if ((Kinds::Behaviour::is_quasinumerical(K)) && (Kinds::is_intermediate(K) == FALSE)) { - TEMPORARY_TEXT(OUT) - Index the minimum positive value for a quasinumerical kind10.2; - Hierarchy::apply_metadata(pack, MIN_VAL_INDEX_MD_HL, OUT); - Str::clear(OUT); - Index the maximum positive value for a quasinumerical kind10.3; - Hierarchy::apply_metadata(pack, MAX_VAL_INDEX_MD_HL, OUT); - Str::clear(OUT); - Index the dimensions for a quasinumerical kind10.4; - Hierarchy::apply_metadata(pack, DIMENSIONS_INDEX_MD_HL, OUT); - DISCARD_TEXT(OUT) - } - - if ((RTKindConstructors::get_highest_valid_value_as_integer(K) == 0) && - (Kinds::Behaviour::indexed_grey_if_empty(K))) - Hierarchy::apply_metadata_from_number(pack, KIND_SHADED_MD_HL, 1); - if (Deferrals::has_finite_domain(K)) - Hierarchy::apply_metadata_from_number(pack, KIND_FINITE_DOMAIN_MD_HL, 1); - if (KindSubjects::has_properties(K)) - Hierarchy::apply_metadata_from_number(pack, KIND_HAS_PROPERTIES_MD_HL, 1); - if (RTKindConstructors::offers_I6_GPR(K)) - Hierarchy::apply_metadata_from_number(pack, KIND_UNDERSTANDABLE_MD_HL, 1); - if (Instances::count(K) > 0) - Hierarchy::apply_metadata_from_number(pack, KIND_INSTANCE_COUNT_MD_HL, - (inter_ti) Instances::count(K)); - TEMPORARY_TEXT(IDV) - int found = FALSE; - instance *inst; - LOOP_OVER_INSTANCES(inst, K) { - Instances::write_name(IDV, inst); - found = TRUE; - break; - } - if (found == FALSE) { - text_stream *p = Kinds::Behaviour::get_index_default_value(K); - if (Str::eq_wide_string(p, L"<0-in-literal-pattern>")) - Index the constant 0 but use the default literal pattern10.1 - else if (Str::eq_wide_string(p, L"<first-constant>")) - WRITE_TO(IDV, "--"); - else WRITE_TO(IDV, "%S", p); - } - Hierarchy::apply_metadata(pack, KIND_INDEX_DEFAULT_MD_HL, IDV); - DISCARD_TEXT(IDV) - - TEMPORARY_TEXT(SN) - RTKindConstructors::index_name(SN, K, FALSE); - if (Str::len(SN) > 0) Hierarchy::apply_metadata(pack, KIND_INDEX_SINGULAR_MD_HL, SN); - DISCARD_TEXT(SN) - - TEMPORARY_TEXT(PN) - RTKindConstructors::index_name(PN, K, TRUE); - if (Str::len(PN) > 0) Hierarchy::apply_metadata(pack, KIND_INDEX_PLURAL_MD_HL, PN); - DISCARD_TEXT(PN) - - kind *K2; - LOOP_OVER_BASE_KINDS(K2) { - if ((Kinds::Behaviour::is_kind_of_kind(K2)) && (Kinds::conforms_to(K, K2)) - && (Kinds::eq(K2, K_pointer_value) == FALSE) - && (Kinds::eq(K2, K_stored_value) == FALSE)) { - package_request *R = - Hierarchy::package_within(KIND_CONFORMANCE_HAP, pack); - Hierarchy::apply_metadata_from_iname(R, CONFORMED_TO_MD_HL, - RTKindConstructors::xref_iname(K2->construct)); - } - } - - if (LiteralPatterns::list_of_literal_forms(K)) { - TEMPORARY_TEXT(LF) - LiteralPatterns::index_all(LF, K); - Hierarchy::apply_metadata(pack, KIND_INDEX_NOTATION_MD_HL, LF); - DISCARD_TEXT(LF) - } - - RTInferences::index(pack, KIND_BRIEF_INFERENCES_MD_HL, KindSubjects::from_kind(K), TRUE); - RTInferences::index(pack, KIND_INFERENCES_MD_HL, KindSubjects::from_kind(K), FALSE); - } - Compile multiplication rules for the index10.5; +
    +int RTKindConstructors::enumeration_size(kind *K) {
    +    if (K == NULL) return 0;
    +    kind_constructor *kc = Kinds::get_construct(K);
    +    if (KindConstructors::is_an_enumeration(kc)) return kc->next_free_value - 1;
    +    return 0;
     }
     
    -

    §10.1. For every quasinumeric kind the default value is 0, but we don't want to -index just "0" because that means 0-as-a-number: we want it to come out -as "0 kg", "0 hectares", or whatever is appropriate. -

    - -

    Index the constant 0 but use the default literal pattern10.1 = +

    §27. Non-standard enumeration occurs when a kit defines an enumerative kind with +runtime values other than 1, 2, 3, ...; an instance which has other than the +expected runtime value is called "out of order", and a kind is a "non-standard +enumeration" if it has an out of order instance.

    -    if (LiteralPatterns::list_of_literal_forms(K))
    -        LiteralPatterns::index_value(IDV,
    -            LiteralPatterns::list_of_literal_forms(K), 0);
    -    else
    -        WRITE_TO(IDV, "--");
    +void RTKindConstructors::set_explicit_runtime_instance_value(kind *K, instance *I,
    +    inter_ti val) {
    +    kind_constructor *kc = Kinds::get_construct(K);
    +    RTInstances::set_explicit_runtime_value(I, val);
    +    if (RTInstances::out_of_place(I))
    +        kc->compilation_data.nonstandard_enumeration = TRUE;
    +}
    +
    +int RTKindConstructors::is_nonstandard_enumeration(kind *K) {
    +    kind_constructor *kc = Kinds::get_construct(K);
    +    return kc->compilation_data.nonstandard_enumeration;
    +}
     
    -
    • This code is used in §10.
    -

    §10.2. Index the minimum positive value for a quasinumerical kind10.2 = +

    §28. The following function is useful when compiling lists of the valid values +for an enumeration. +

    + +

    A little dubiously, for a standard enumeration ("Colour is a kind of value. The +colours are red, green and blue."), the entries are just the numbers 1, 2, 3, ... +That never seems a good use of memory, but it is still more efficient to store +one copy of this than to have to construct it frequently at runtime. +

    + +

    For a nonstandard enumeration, the entries are more interesting. They essentially +duplicate the instances array, but again, it's more efficient to take the memory +overhead.

    -    if (Kinds::eq(K, K_number)) WRITE("1");
    -    else {
    -        text_stream *p = Kinds::Behaviour::get_index_minimum_value(K);
    -        if (Str::len(p) > 0) WRITE("%S", p);
    -        else LiteralPatterns::index_value(OUT,
    -            LiteralPatterns::list_of_literal_forms(K), 1);
    -    }
    -
    -
    • This code is used in §10.
    -

    §10.3. Index the maximum positive value for a quasinumerical kind10.3 = -

    - -
    -    if (Kinds::eq(K, K_number)) {
    -        if (TargetVMs::is_16_bit(Task::vm())) WRITE("32767");
    -        else WRITE("2147483647");
    +void RTKindConstructors::make_enumeration_entries(kind *K) {
    +    if (RTKindConstructors::is_nonstandard_enumeration(K)) {
    +        instance *I;
    +        LOOP_OVER_INSTANCES(I, K)
    +            EmitArrays::iname_entry(RTInstances::value_iname(I));
         } else {
    -        text_stream *p = Kinds::Behaviour::get_index_maximum_value(K);
    -        if (Str::len(p) > 0) WRITE("%S", p);
    -        else {
    -            if (TargetVMs::is_16_bit(Task::vm()))
    -                LiteralPatterns::index_value(OUT,
    -                    LiteralPatterns::list_of_literal_forms(K), 32767);
    -            else
    -                LiteralPatterns::index_value(OUT,
    -                    LiteralPatterns::list_of_literal_forms(K), 2147483647);
    -        }
    -    }
    -
    -
    • This code is used in §10.
    -

    §10.4. Index the dimensions for a quasinumerical kind10.4 = -

    - -
    -    if (Kinds::Dimensions::dimensionless(K) == FALSE) {
    -        unit_sequence *deriv = Kinds::Behaviour::get_dimensional_form(K);
    -        Kinds::Dimensions::index_unit_sequence(OUT, deriv, TRUE);
    -    }
    -
    -
    • This code is used in §10.
    -

    §10.5. Compile multiplication rules for the index10.5 = -

    - -
    -    kind *L, *R, *O;
    -    int wn;
    -    LOOP_OVER_MULTIPLICATIONS(L, R, O, wn) {
    -        package_request *pack = Hierarchy::completion_package(MULTIPLICATION_RULE_HAP);
    -        if (wn >= 0) Hierarchy::apply_metadata_from_number(pack, SET_AT_MD_HL, (inter_ti) wn);
    -        TEMPORARY_TEXT(OUT)
    -        WRITE_TO(OUT, "%u", L);
    -        Hierarchy::apply_metadata(pack, LEFT_OPERAND_MD_HL, OUT);
    -        Str::clear(OUT);
    -        WRITE_TO(OUT, "%u", R);
    -        Hierarchy::apply_metadata(pack, RIGHT_OPERAND_MD_HL, OUT);
    -        Str::clear(OUT);
    -        WRITE_TO(OUT, "%u", O);
    -        Hierarchy::apply_metadata(pack, RESULT_MD_HL, OUT);
    -        Str::clear(OUT);
    -        LiteralPatterns::index_benchmark_value(OUT, L);
    -        Hierarchy::apply_metadata(pack, LEFT_OPERAND_BM_MD_HL, OUT);
    -        Str::clear(OUT);
    -        LiteralPatterns::index_benchmark_value(OUT, R);
    -        Hierarchy::apply_metadata(pack, RIGHT_OPERAND_BM_MD_HL, OUT);
    -        Str::clear(OUT);
    -        LiteralPatterns::index_benchmark_value(OUT, O);
    -        Hierarchy::apply_metadata(pack, RESULT_BM_MD_HL, OUT);
    -        DISCARD_TEXT(OUT)
    -    }
    -
    -
    • This code is used in §10.
    -

    §11.

    - -
    -void RTKindConstructors::index_name(OUTPUT_STREAM, kind *K, int plural) {
    -    wording W = Kinds::Behaviour::get_name(K, plural);
    -    if (Wordings::nonempty(W)) {
    -        if (Kinds::is_proper_constructor(K)) {
    -            Index the constructor text11.1;
    -        } else {
    -            WRITE("%W", W);
    -        }
    +        int N = RTKindConstructors::enumeration_size(K);
    +        for (int i = 1; i <= N; i++)
    +            EmitArrays::numeric_entry((inter_ti) i);
         }
     }
     
    -

    §11.1. Index the constructor text11.1 = +

    §29. Assigning declaration sequence numbers. These provide a sequencing useful to code-generators, with superkinds earlier +in the sequence than subkinds — which may not be true of source code ordering.

    -
    -    int length = Wordings::length(W), w1 = Wordings::first_wn(W), tinted = TRUE;
    -    int i, first_stroke = -1, last_stroke = -1;
    -    for (i=0; i<length; i++) {
    -        if (Lexer::word(w1+i) == STROKE_V) {
    -            if (first_stroke == -1) first_stroke = i;
    -            last_stroke = i;
    -        }
    -    }
    -    int from = 0, to = length-1;
    -    if (last_stroke >= 0) from = last_stroke+1; else tinted = FALSE;
    -    if (tinted) HTML::begin_span(OUT, I"indexgrey");
    -    for (i=from; i<=to; i++) {
    -        int j, untinted = FALSE;
    -        for (j=0; j<first_stroke; j++)
    -            if (Lexer::word(w1+j) == Lexer::word(w1+i))
    -                untinted = TRUE;
    -        if (untinted) HTML::end_span(OUT);
    -        if (i>from) WRITE(" ");
    -        if (Lexer::word(w1+i) == CAPITAL_K_V) WRITE("K");
    -        else if (Lexer::word(w1+i) == CAPITAL_L_V) WRITE("L");
    -        else WRITE("%V", Lexer::word(w1+i));
    -        if (untinted) HTML::begin_span(OUT, I"indexgrey");
    -    }
    -    if (tinted) HTML::end_span(OUT);
    -
    -
    • This code is used in §11.
    -

    §10.6.

    -
     inter_ti kind_sequence_counter = 0;
     
    -void RTKindConstructors::assign_declaration_sequence_numbers(void) {
    +void RTKindConstructors::assign_declaration_sequence_numbers(void) {
         int N = 0;
    -    RTKindConstructors::assign_dsn_r(&N, KindSubjects::from_kind(K_object));
    +    RTKindConstructors::assign_dsn_r(&N, KindSubjects::from_kind(K_object));
         kind_constructor *kc;
         LOOP_OVER(kc, kind_constructor) {
             if ((kc == CON_KIND_VARIABLE) || (kc == CON_INTERMEDIATE)) continue;
    @@ -1016,183 +743,366 @@ as "0 kg", "0 hectares", or whatever is appropriate.
         LOOP_OVER(subj, inference_subject)
             if ((InferenceSubjects::narrowest_broader_subject(subj) == within) &&
                 (InferenceSubjects::is_a_kind_of_object(subj)))
    -            RTKindConstructors::assign_dsn_r(N, subj);
    +            RTKindConstructors::assign_dsn_r(N, subj);
     }
     
    -

    §10.7.

    +

    §30. Compilation. Deep breath now... +

    -void RTKindConstructors::compile_permissions(void) {
    +void RTKindConstructors::compile(void) {
         kind_constructor *kc;
         LOOP_OVER(kc, kind_constructor) {
             if ((kc == CON_KIND_VARIABLE) || (kc == CON_INTERMEDIATE)) continue;
             kind *K = Kinds::base_construction(kc);
    -        if (RTKindDeclarations::base_represented_in_Inter(K)) {
    -            RTPropertyPermissions::emit_kind_permissions(K);
    -            RTPropertyValues::compile_values_for_kind(K);
    -        }
    +        package_request *pack = RTKindConstructors::package(kc);
    +        Make identification constants30.1;
    +        Apply general metadata30.2;
    +        Make constants, arrays and functions as needed30.3;
    +        Apply further metadata needed only for indexing30.4;
         }
    +    RTKindConstructors::apply_multiplication_rule_metadata();
     }
     
    -

    §10.8. Compile data support functions10.8 = +

    §30.1. Part I: Identification. Make identification constants30.1 =

    +    Make cross-referencing constant30.1.2;
    +    Make weak ID constant30.1.1;
    +
    +
    • This code is used in §30.
    +

    §30.1.1. Make weak ID constant30.1.1 = +

    + +
    +    Emit::numeric_constant(RTKindConstructors::weak_ID_iname(kc), 0);
    +    Hierarchy::make_available(RTKindConstructors::weak_ID_iname(kc));
    +
    + +

    §30.1.2. See above: the value of this constant can be anything at all, since only +its position in the Inter hierarchy matters. But 561 is the smallest Carmichael +number, which is good enough for me. +

    + +

    Make cross-referencing constant30.1.2 = +

    + +
    +    Emit::numeric_constant(RTKindConstructors::xref_iname(kc), 561);
    +
    + +

    §30.2. Part II: General metadata. Apply general metadata30.2 = +

    + +
    +    Make weak and strong ID metadata30.2.1;
    +    Apply conformance metadata30.2.11;
    +    Apply name metadata30.2.2;
    +    Apply location metadata, for kinds created in the source text30.2.3;
    +    Apply declaration sequence number metadata30.2.4;
    +    Apply specification metadata30.2.5;
    +    Apply metadata categorising this kind in various ways30.2.6;
    +    if (RTKindConstructors::is_subkind_of_object(kc)) {
    +        Apply kind metadata30.2.7;
    +        Apply superkind metadata30.2.8;
    +    }
    +    if (KindConstructors::is_an_enumeration(kc)) {
    +        Apply domain size metadata30.2.9;
    +    }
    +    if ((Kinds::Behaviour::is_an_enumeration(K)) || (Kinds::Behaviour::is_object(K))) {
    +        Apply instance count metadata30.2.10;
    +    }
    +
    +
    • This code is used in §30.
    +

    §30.2.1. Make weak and strong ID metadata30.2.1 = +

    + +
    +    inter_name *weak_iname = RTKindIDs::weak_iname_of_constructor(kc);
    +    if (weak_iname == NULL) internal_error("no iname for weak ID");
    +    Hierarchy::apply_metadata_from_iname(pack, KIND_WEAK_ID_MD_HL, weak_iname);
    +    Hierarchy::apply_metadata_from_iname(pack, KIND_STRONG_ID_MD_HL,
    +        RTKindConstructors::weak_ID_iname(kc));
    +
    + +

    §30.2.2. Four forms of the name: one always present, and a best effort to describe the +constructor wherever it came from; the second only present if a natural-language +form of the name exists; and the other two are more prettily printed for the index. +

    + +

    Apply name metadata30.2.2 = +

    + +
    +    wording W = KindConstructors::get_name(kc, FALSE);
    +    if (Wordings::nonempty(W)) {
    +        Hierarchy::apply_metadata_from_wording(pack, KIND_NAME_MD_HL, W);
    +        Hierarchy::apply_metadata_from_raw_wording(pack, KIND_PNAME_MD_HL, W);
    +    } else if (Str::len(kc->explicit_identifier) > 0) {
    +        Hierarchy::apply_metadata(pack, KIND_NAME_MD_HL, kc->explicit_identifier);
    +    } else {
    +        Hierarchy::apply_metadata(pack, KIND_NAME_MD_HL, I"(anonymous kind)");
    +    }
    +    TEMPORARY_TEXT(SN)
    +    RTKindConstructors::index_name(SN, K, FALSE);
    +    if (Str::len(SN) > 0) Hierarchy::apply_metadata(pack, KIND_INDEX_SINGULAR_MD_HL, SN);
    +    DISCARD_TEXT(SN)
    +    TEMPORARY_TEXT(PN)
    +    RTKindConstructors::index_name(PN, K, TRUE);
    +    if (Str::len(PN) > 0) Hierarchy::apply_metadata(pack, KIND_INDEX_PLURAL_MD_HL, PN);
    +    DISCARD_TEXT(PN)
    +
    + +

    §30.2.3. Apply location metadata, for kinds created in the source text30.2.3 = +

    + +
    +    if (kc->where_defined_in_source_text)
    +        Hierarchy::apply_metadata_from_number(pack, KIND_AT_MD_HL,
    +            (inter_ti) Wordings::first_wn(Node::get_text(kc->where_defined_in_source_text)));
    +
    + +

    §30.2.4. Apply declaration sequence number metadata30.2.4 = +

    + +
    +    if (kc->compilation_data.declaration_sequence_number >= 0)
    +        Hierarchy::apply_metadata_from_number(pack, KIND_DECLARATION_ORDER_MD_HL,
    +            (inter_ti) kc->compilation_data.declaration_sequence_number);
    +
    + +

    §30.2.5. This text can come either from the value of the specification pseudo-property, +or can come from the Neptune file creating a kind. +

    + +

    Apply specification metadata30.2.5 = +

    + +
    +    inference *inf;
    +    int made_exp = FALSE;
    +    KNOWLEDGE_LOOP(inf, KindSubjects::from_kind(K), property_inf)
    +        if (PropertyInferences::get_property(inf) == P_specification) {
    +            parse_node *spec = PropertyInferences::get_value(inf);
    +            TEMPORARY_TEXT(exp)
    +            IndexUtilities::dequote(exp,
    +                Lexer::word_raw_text(Wordings::first_wn(Node::get_text(spec))));
    +            Hierarchy::apply_metadata(pack, KIND_SPECIFICATION_MD_HL, exp);
    +            DISCARD_TEXT(exp)
    +            made_exp = TRUE;
    +            break;
    +        }
    +    if ((made_exp == FALSE) && (RTKindConstructors::is_subkind_of_object(kc) == FALSE)) {
    +        text_stream *exp = Kinds::Behaviour::get_specification_text(K);
    +        if (Str::len(exp) > 0)
    +            Hierarchy::apply_metadata(pack, KIND_SPECIFICATION_MD_HL, exp);
    +    }
    +
    + +

    §30.2.6. Apply metadata categorising this kind in various ways30.2.6 = +

    + +
    +    if (KindConstructors::is_base(kc))
    +        Hierarchy::apply_metadata_from_number(pack, KIND_IS_BASE_MD_HL, 1);
    +    if (KindConstructors::is_proper_constructor(kc))
    +        Hierarchy::apply_metadata_from_number(pack, KIND_IS_PROPER_MD_HL, 1);
    +    if (KindConstructors::is_arithmetic(kc))
    +        Hierarchy::apply_metadata_from_number(pack, KIND_IS_QUASINUMERICAL_MD_HL, 1);
    +    if (RTKindConstructors::is_object(kc))
    +        Hierarchy::apply_metadata_from_number(pack, KIND_IS_OBJECT_MD_HL, 1);
    +    if (RTKindConstructors::is_subkind_of_object(kc))
    +        Hierarchy::apply_metadata_from_number(pack, KIND_IS_SKOO_MD_HL, 1);
    +    if (KindConstructors::is_definite(kc))
    +        Hierarchy::apply_metadata_from_number(pack, KIND_IS_DEF_MD_HL, 1);
    +    if (KindConstructors::uses_block_values(kc))
    +        Hierarchy::apply_metadata_from_number(pack, KIND_HAS_BV_MD_HL, 1);
    +    if (Deferrals::has_finite_domain(K))
    +        Hierarchy::apply_metadata_from_number(pack, KIND_FINITE_DOMAIN_MD_HL, 1);
    +    if ((KindSubjects::has_properties(K)) &&
    +        (RTKindConstructors::is_nonstandard_enumeration(K) == FALSE))
    +        Hierarchy::apply_metadata_from_number(pack, KIND_HAS_PROPERTIES_MD_HL, 1);
    +    if (Kinds::Behaviour::is_understandable(K))
    +        Hierarchy::apply_metadata_from_number(pack, KIND_UNDERSTANDABLE_MD_HL, 1);
    +    if (Kinds::eq(K, K_players_holdall))
    +        Hierarchy::apply_metadata_from_number(pack, RUCKSACK_CLASS_MD_HL, 1);
    +
    + +

    §30.2.7. Apply kind metadata30.2.7 = +

    + +
    +    Hierarchy::apply_metadata_from_iname(pack,
    +        KIND_CLASS_MD_HL, RTKindDeclarations::iname(Kinds::base_construction(kc)));
    +
    + +

    §30.2.8. Apply superkind metadata30.2.8 = +

    + +
    +    kind *super_K = Latticework::super(K);
    +    TEMPORARY_TEXT(SK)
    +    WRITE_TO(SK, "%u", super_K);
    +    Hierarchy::apply_metadata(pack, INDEX_SUPERKIND_MD_HL, SK);
    +    DISCARD_TEXT(SK)
    +    Hierarchy::apply_metadata_from_iname(pack, SUPERKIND_MD_HL,
    +        RTKindConstructors::weak_ID_iname(super_K->construct));
    +
    + +

    §30.2.9. Apply domain size metadata30.2.9 = +

    + +
    +    Hierarchy::apply_metadata_from_number(pack, KIND_DSIZE_MD_HL,
    +        (inter_ti) RTKindConstructors::enumeration_size(K));
    +
    + +

    §30.2.10. Apply instance count metadata30.2.10 = +

    + +
    +    if (Instances::count(K) > 0)
    +        Hierarchy::apply_metadata_from_number(pack, KIND_INSTANCE_COUNT_MD_HL,
    +            (inter_ti) Instances::count(K));
    +
    + +

    §30.3. Part III: Constants, arrays and functions. Make constants, arrays and functions as needed30.3 = +

    + +
    +    if ((Kinds::Behaviour::is_an_enumeration(K)) || (Kinds::Behaviour::is_object(K))) {
    +        Make icount constant30.3.1;
    +        if (RTKindConstructors::is_nonstandard_enumeration(K)) {
    +            Make instances array30.3.2;
    +        }
    +        if (Kinds::eq(K, K_room)) {
    +            Make FW-matrix size constant30.3.3;
    +            Make NUM_ROOMS constant30.3.5;
    +        }
    +        if (Kinds::eq(K, K_door)) {
    +            Make NUM_DOORS constant30.3.4;
    +        }
    +    }
         if (Kinds::Behaviour::is_an_enumeration(K)) {
    -        inter_name *printing_rule_name = RTKindConstructors::get_iname(K);
    -        Compile I6 printing routine for an enumerated kind10.8.3;
    -        Compile the A and B routines for an enumerated kind10.8.4;
    -        Compile random-ranger routine for this kind10.8.5;
    +        Compile the increment and decrement functions for an enumerated kind30.3.6;
    +        Compile random-value function for this kind30.3.7;
    +        Compile indexing function for this kind30.3.8;
         }
         if ((Kinds::Behaviour::is_built_in(K) == FALSE) &&
    -        (Kinds::Behaviour::is_subkind_of_object(K) == FALSE) &&
    -        (Kinds::Behaviour::is_an_enumeration(K) == FALSE)) {
    -        if (Kinds::eq(K, K_use_option)) {
    -            inter_name *printing_rule_name = RTKindConstructors::get_iname(K);
    -            packaging_state save = Functions::begin(printing_rule_name);
    -            inter_symbol *value_s = LocalVariables::new_other_as_symbol(I"value");
    -            EmitCode::call(Hierarchy::find(PRINT_USE_OPTION_HL));
    -            EmitCode::down();
    -                EmitCode::val_symbol(K_value, value_s);
    -            EmitCode::up();
    -            Functions::end(save);
    -            continue;
    -        }
    -        if (Kinds::eq(K, K_table)) {
    -            inter_name *printing_rule_name = RTKindConstructors::get_iname(K);
    -            packaging_state save = Functions::begin(printing_rule_name);
    -            inter_symbol *value_s = LocalVariables::new_other_as_symbol(I"value");
    -            EmitCode::call(Hierarchy::find(PRINT_TABLE_HL));
    -            EmitCode::down();
    -                EmitCode::val_symbol(K_value, value_s);
    -            EmitCode::up();
    -            Functions::end(save);
    -            continue;
    -        }
    -        if (Kinds::eq(K, K_response)) {
    -            inter_name *printing_rule_name = RTKindConstructors::get_iname(K);
    -            packaging_state save = Functions::begin(printing_rule_name);
    -            inter_symbol *value_s = LocalVariables::new_other_as_symbol(I"value");
    -            EmitCode::call(Hierarchy::find(PRINT_RESPONSE_HL));
    -            EmitCode::down();
    -                EmitCode::val_symbol(K_value, value_s);
    -            EmitCode::up();
    -            Functions::end(save);
    -            continue;
    -        }
    -        inter_name *printing_rule_name = RTKindConstructors::get_iname(K);
    -        if (Kinds::Behaviour::is_quasinumerical(K)) {
    -            Compile I6 printing routine for a unit kind10.8.2;
    -            Compile random-ranger routine for this kind10.8.5;
    -        } else {
    -            Compile I6 printing routine for a vacant but named kind10.8.1;
    -        }
    +        (Kinds::Behaviour::is_quasinumerical(K))) {
    +        Compile random-value function for this kind30.3.7;
         }
    -
    -
    • This code is used in §10.
    -

    §10.8.1. A slightly bogus case first. If the source text declares a kind but never -gives any enumerated values or literal patterns, then such values will never -appear at run-time; but we need the printing routine to exist to avoid -compilation errors. -

    - -

    Compile I6 printing routine for a vacant but named kind10.8.1 = -

    - -
    -    packaging_state save = Functions::begin(printing_rule_name);
    -    inter_symbol *value_s = LocalVariables::new_other_as_symbol(I"value");
    -    TEMPORARY_TEXT(C)
    -    WRITE_TO(C, "weak kind ID: %n\n", RTKindIDs::weak_iname(K));
    -    EmitCode::comment(C);
    -    DISCARD_TEXT(C)
    -    EmitCode::inv(PRINT_BIP);
    -    EmitCode::down();
    -        EmitCode::val_symbol(K_value, value_s);
    -    EmitCode::up();
    -    Functions::end(save);
    -
    - -

    §10.8.2. A unit is printed back with its earliest-defined literal pattern used as -notation. If it had no literal patterns, it would come out as decimal numbers, -but at present this can't happen. -

    - -

    Compile I6 printing routine for a unit kind10.8.2 = -

    - -
    -    if (LiteralPatterns::list_of_literal_forms(K))
    -        RTLiteralPatterns::printing_routine(printing_rule_name,
    -            LiteralPatterns::list_of_literal_forms(K));
    -    else {
    -        packaging_state save = Functions::begin(printing_rule_name);
    -        inter_symbol *value_s = LocalVariables::new_other_as_symbol(I"value");
    -        EmitCode::inv(PRINT_BIP);
    -        EmitCode::down();
    -            EmitCode::val_symbol(K_value, value_s);
    -        EmitCode::up();
    -        Functions::end(save);
    +    if (KindConstructors::uses_block_values(kc)) {
    +        Apply support function metadata30.3.9;
         }
    -
    - -

    §10.8.3. Compile I6 printing routine for an enumerated kind10.8.3 = -

    - -
    -    packaging_state save = Functions::begin(printing_rule_name);
    -    inter_symbol *value_s = LocalVariables::new_other_as_symbol(I"value");
    -
    -    EmitCode::inv(SWITCH_BIP);
    -    EmitCode::down();
    -        EmitCode::val_symbol(K_value, value_s);
    -        EmitCode::code();
    -        EmitCode::down();
    -            instance *I;
    -            LOOP_OVER_INSTANCES(I, K) {
    -                EmitCode::inv(CASE_BIP);
    -                EmitCode::down();
    -                    EmitCode::val_iname(K_value, RTInstances::value_iname(I));
    -                    EmitCode::code();
    -                    EmitCode::down();
    -                        EmitCode::inv(PRINT_BIP);
    -                        EmitCode::down();
    -                            TEMPORARY_TEXT(CT)
    -                            wording NW = Instances::get_name_in_play(I, FALSE);
    -                            LOOP_THROUGH_WORDING(k, NW) {
    -                                TranscodeText::from_wide_string(CT, Lexer::word_raw_text(k), CT_RAW);
    -                                if (k < Wordings::last_wn(NW)) WRITE_TO(CT, " ");
    -                            }
    -                            EmitCode::val_text(CT);
    -                            DISCARD_TEXT(CT)
    -                        EmitCode::up();
    -                    EmitCode::up();
    -                EmitCode::up();
    +    if ((RTKindConstructors::is_subkind_of_object(kc) == FALSE) &&
    +        (KindConstructors::is_definite(kc)) &&
    +        (KindConstructors::uses_signed_comparisons(kc) == FALSE)) {
    +        Apply comparison function metadata30.3.10;
    +    }
    +    if (Kinds::Behaviour::definite(K)) {
    +        Apply make-default-value function metadata30.3.11;
    +        Compile make-default-value function30.3.12;
    +    }
    +    if (RTKindConstructors::is_subkind_of_object(kc) == FALSE) {
    +        Apply printing function metadata30.3.13;
    +        if (Kinds::Behaviour::is_an_enumeration(K)) {
    +            Compile printing function for an enumerated kind30.3.16;
    +        }
    +        if ((Kinds::Behaviour::is_built_in(K) == FALSE) &&
    +            (Kinds::Behaviour::is_an_enumeration(K) == FALSE)) {
    +            if (Kinds::Behaviour::is_quasinumerical(K)) {
    +                Compile printing function for a unit kind30.3.15;
    +            } else {
    +                Compile printing function for a vacant but named kind30.3.14;
                 }
    -            EmitCode::inv(DEFAULT_BIP);  this default case should never be needed, unless the user has blundered at the I6 level:
    -            EmitCode::down();
    -                EmitCode::code();
    -                EmitCode::down();
    -                    EmitCode::inv(PRINT_BIP);
    -                    EmitCode::down();
    -                        TEMPORARY_TEXT(DT)
    -                        wording W = Kinds::Behaviour::get_name(K, FALSE);
    -                        WRITE_TO(DT, "<illegal ");
    -                        if (Wordings::nonempty(W)) WRITE_TO(DT, "%W", W);
    -                        else WRITE_TO(DT, "value");
    -                        WRITE_TO(DT, ">");
    -                        EmitCode::val_text(DT);
    -                        DISCARD_TEXT(DT)
    -                    EmitCode::up();
    -                EmitCode::up();
    -            EmitCode::up();
    -        EmitCode::up();
    -    EmitCode::up();
    -
    -    Functions::end(save);
    +        }
    +    }
    +    if ((Kinds::Behaviour::is_object(K)) && (RTShowmeCommand::needed_for_kind(K))) {
    +        Apply SHOWME function metadata30.3.17;
    +        Compile SHOWME function30.3.18;
    +    }
    +    if ((RTKindConstructors::GPR_compilation_enabled()) &&
    +        (RTKindConstructors::GPR_provided_by_kit(K) == FALSE)) {
    +        if (Kinds::Behaviour::is_an_enumeration(K)) {
    +            Compile enumeration GPR30.3.19;
    +        } else if (Kinds::Behaviour::is_quasinumerical(K)) {
    +            Compile quasinumerical GPR30.3.20;
    +        }
    +    }
     
    - -

    §10.8.4. The suite of standard routines provided for enumerative types is a little +

    • This code is used in §30.
    +

    §30.3.1. Make icount constant30.3.1 = +

    + +
    +    inter_name *iname = RTKindConstructors::icount_iname(K);
    +    Emit::numeric_constant(iname, (inter_ti) Instances::count(K));
    +
    + +

    §30.3.2. Make instances array30.3.2 = +

    + +
    +    inter_name *array_iname = RTKindConstructors::instances_array_iname(K);
    +    Hierarchy::make_available(array_iname);
    +    packaging_state save = EmitArrays::begin_word(array_iname, K_value);
    +    EmitArrays::numeric_entry((inter_ti) Instances::count(K));
    +    RTKindConstructors::make_enumeration_entries(K);
    +    EmitArrays::numeric_entry(0);
    +    EmitArrays::end(save);
    +    Hierarchy::apply_metadata_from_iname(RTKindConstructors::kind_package(K),
    +        ENUMERATION_ARRAY_MD_HL, array_iname);
    +
    + +

    §30.3.3. This improbable-looking constant is the size of storage to allocate for the +route-finding algorithm in WorldModelKit. If the fast algorithm is used, +more storage is needed than for the slow one, and the default choice is fast +on 32-bit platforms, slow on 16-bit, where memory is scarcer. We're declaring +the constant here because this is too tricky a bit of conditional compilation +to be handled inside the kit itself. +

    + +

    Make FW-matrix size constant30.3.3 = +

    + +
    +    inter_name *iname =
    +        Hierarchy::make_iname_in(FWMATRIX_SIZE_HL, RTKindConstructors::kind_package(K));
    +    Hierarchy::make_available(iname);
    +    inter_ti val = 0;
    +    if (TargetVMs::is_16_bit(Task::vm()) == FALSE)
    +        val = (inter_ti) (Instances::count(K)*Instances::count(K));
    +    if (global_compilation_settings.fast_route_finding)
    +        val = (inter_ti) (Instances::count(K)*Instances::count(K));
    +    if (global_compilation_settings.slow_route_finding)
    +        val = 0;
    +    if (val <= 1) val = 2;
    +    Emit::numeric_constant(iname, (inter_ti) val);
    +
    + +

    §30.3.4. Make NUM_DOORS constant30.3.4 = +

    + +
    +    inter_name *iname =
    +        Hierarchy::make_iname_in(NUM_DOORS_HL, RTKindConstructors::kind_package(K));
    +    Hierarchy::make_available(iname);
    +    Emit::numeric_constant(iname, (inter_ti) Instances::count(K));
    +
    + +

    §30.3.5. Make NUM_ROOMS constant30.3.5 = +

    + +
    +    inter_name *iname =
    +        Hierarchy::make_iname_in(NUM_ROOMS_HL, RTKindConstructors::kind_package(K));
    +    Hierarchy::make_available(iname);
    +    Emit::numeric_constant(iname, (inter_ti) Instances::count(K));
    +
    + +

    §30.3.6. The suite of standard routines provided for enumerative types is a little like the one in Ada (T'Succ, T'Pred, and so on).

    @@ -1205,30 +1115,28 @@ wrapping around to the first from the last; wrapping around to the last from the first, so that it is the inverse function to A_T1_colour(v). -

    Compile the A and B routines for an enumerated kind10.8.4 = +

    Compile the increment and decrement functions for an enumerated kind30.3.6 =

    -    int instance_count = 0;
    -    instance *I;
    -    LOOP_OVER_INSTANCES(I, K) instance_count++;
    +    int instance_count = Instances::count(K);
     
    -    inter_name *iname_i = RTKindConstructors::get_inc_iname(K);
    +    inter_name *iname_i = RTKindConstructors::increment_fn_iname(K);
         packaging_state save = Functions::begin(iname_i);
    -    Implement the A routine10.8.4.1;
    +    Implement the A routine30.3.6.1;
         Functions::end(save);
     
    -    inter_name *iname_d = RTKindConstructors::get_dec_iname(K);
    +    inter_name *iname_d = RTKindConstructors::decrement_fn_iname(K);
         save = Functions::begin(iname_d);
    -    Implement the B routine10.8.4.2;
    +    Implement the B routine30.3.6.2;
         Functions::end(save);
     
    - -

    §10.8.4.1. There should be a blue historical plaque on the wall here: this was the +

    +

    §30.3.6.1. There should be a blue historical plaque on the wall here: this was the first function ever implemented by emitting Inter code, on 12 November 2017.

    -

    Implement the A routine10.8.4.1 = +

    Implement the A routine30.3.6.1 =

    @@ -1241,6 +1149,12 @@ first function ever implemented by emitting Inter code, on 12 November 2017.
     
         if (instance_count <= 1) {
             EmitCode::val_symbol(K, x);
    +    } else if (RTKindConstructors::is_nonstandard_enumeration(K)) {
    +        EmitCode::call(Hierarchy::find(NEXT_ENUM_VAL_HL));
    +        EmitCode::down();
    +            EmitCode::val_symbol(K, x);
    +            EmitCode::val_iname(K_value, RTKindConstructors::instances_array_iname(K));
    +        EmitCode::up();
         } else {
             EmitCode::cast(K_number, K);
             EmitCode::down();
    @@ -1261,11 +1175,11 @@ first function ever implemented by emitting Inter code, on 12 November 2017.
     
         EmitCode::up();
     
    - -

    §10.8.4.2. And this was the second, a few minutes later. +

    +

    §30.3.6.2. And this was the second, a few minutes later.

    -

    Implement the B routine10.8.4.2 = +

    Implement the B routine30.3.6.2 =

    @@ -1278,6 +1192,12 @@ first function ever implemented by emitting Inter code, on 12 November 2017.
     
         if (instance_count <= 1) {
             EmitCode::val_symbol(K, x);
    +    } else if (RTKindConstructors::is_nonstandard_enumeration(K)) {
    +        EmitCode::call(Hierarchy::find(PREV_ENUM_VAL_HL));
    +        EmitCode::down();
    +            EmitCode::val_symbol(K, x);
    +            EmitCode::val_iname(K_value, RTKindConstructors::instances_array_iname(K));
    +        EmitCode::up();
         } else {
             EmitCode::cast(K_number, K);
             EmitCode::down();
    @@ -1311,8 +1231,8 @@ first function ever implemented by emitting Inter code, on 12 November 2017.
     
         EmitCode::up();
     
    - -

    §10.8.5. And here we add: +

    +

    §30.3.7. And here we add:

    • (a) R_T1_colour() returns a uniformly random choice of the valid @@ -1321,90 +1241,101 @@ value, which will probably not be useful.)
    • (b) R_T1_colour(a, b) returns a uniformly random choice in between a and b inclusive.
    -

    Compile random-ranger routine for this kind10.8.5 = +

    Compile random-value function for this kind30.3.7 =

    -    inter_name *iname_r = RTKindConstructors::get_ranger_iname(K);
    +    inter_name *iname_r = RTKindConstructors::random_value_fn_iname(K);
         packaging_state save = Functions::begin(iname_r);
         inter_symbol *a_s = LocalVariables::new_other_as_symbol(I"a");
         inter_symbol *b_s = LocalVariables::new_other_as_symbol(I"b");
     
    -    EmitCode::inv(IF_BIP);
    -    EmitCode::down();
    -        EmitCode::inv(AND_BIP);
    +    if (RTKindConstructors::is_nonstandard_enumeration(K)) {
    +        EmitCode::inv(RETURN_BIP);
    +        EmitCode::down();
    +            EmitCode::call(Hierarchy::find(RANDOM_ENUM_VAL_HL));
    +            EmitCode::down();
    +                EmitCode::val_iname(K_value, RTKindConstructors::instances_array_iname(K));
    +                EmitCode::val_symbol(K_value, a_s);
    +                EmitCode::val_symbol(K_value, b_s);
    +            EmitCode::up();
    +        EmitCode::up();
    +    } else {
    +        EmitCode::inv(IF_BIP);
    +        EmitCode::down();
    +            EmitCode::inv(AND_BIP);
    +            EmitCode::down();
    +                EmitCode::inv(EQ_BIP);
    +                EmitCode::down();
    +                    EmitCode::val_symbol(K_value, a_s);
    +                    EmitCode::val_number(0);
    +                EmitCode::up();
    +                EmitCode::inv(EQ_BIP);
    +                EmitCode::down();
    +                    EmitCode::val_symbol(K_value, b_s);
    +                    EmitCode::val_number(0);
    +                EmitCode::up();
    +            EmitCode::up();
    +            EmitCode::code();
    +            EmitCode::down();
    +                EmitCode::inv(RETURN_BIP);
    +                EmitCode::down();
    +                    EmitCode::inv(RANDOM_BIP);
    +                    EmitCode::down();
    +                        if (Kinds::Behaviour::is_quasinumerical(K))
    +                            EmitCode::val_iname(K_value, Hierarchy::find(MAX_POSITIVE_NUMBER_HL));
    +                        else
    +                            EmitCode::val_number((inter_ti) RTKindConstructors::enumeration_size(K));
    +                    EmitCode::up();
    +                EmitCode::up();
    +            EmitCode::up();
    +        EmitCode::up();
    +
    +        EmitCode::inv(IF_BIP);
             EmitCode::down();
                 EmitCode::inv(EQ_BIP);
                 EmitCode::down();
                     EmitCode::val_symbol(K_value, a_s);
    -                EmitCode::val_number(0);
    -            EmitCode::up();
    -            EmitCode::inv(EQ_BIP);
    -            EmitCode::down();
                     EmitCode::val_symbol(K_value, b_s);
    -                EmitCode::val_number(0);
                 EmitCode::up();
    -        EmitCode::up();
    -        EmitCode::code();
    -        EmitCode::down();
    -            EmitCode::inv(RETURN_BIP);
    +            EmitCode::code();
                 EmitCode::down();
    -                EmitCode::inv(RANDOM_BIP);
    +                EmitCode::inv(RETURN_BIP);
                     EmitCode::down();
    -                    if (Kinds::Behaviour::is_quasinumerical(K))
    -                        EmitCode::val_iname(K_value, Hierarchy::find(MAX_POSITIVE_NUMBER_HL));
    -                    else
    -                        EmitCode::val_number((inter_ti) RTKindConstructors::get_highest_valid_value_as_integer(K));
    +                    EmitCode::val_symbol(K_value, b_s);
                     EmitCode::up();
                 EmitCode::up();
             EmitCode::up();
    -    EmitCode::up();
     
    -    EmitCode::inv(IF_BIP);
    -    EmitCode::down();
    -        EmitCode::inv(EQ_BIP);
    +        inter_symbol *smaller = NULL, *larger = NULL;
    +
    +        EmitCode::inv(IF_BIP);
             EmitCode::down();
    -            EmitCode::val_symbol(K_value, a_s);
    -            EmitCode::val_symbol(K_value, b_s);
    -        EmitCode::up();
    -        EmitCode::code();
    -        EmitCode::down();
    -            EmitCode::inv(RETURN_BIP);
    +            EmitCode::inv(GT_BIP);
                 EmitCode::down();
    +                EmitCode::val_symbol(K_value, a_s);
                     EmitCode::val_symbol(K_value, b_s);
                 EmitCode::up();
    -        EmitCode::up();
    -    EmitCode::up();
    -
    -    inter_symbol *smaller = NULL, *larger = NULL;
    -
    -    EmitCode::inv(IF_BIP);
    -    EmitCode::down();
    -        EmitCode::inv(GT_BIP);
    -        EmitCode::down();
    -            EmitCode::val_symbol(K_value, a_s);
    -            EmitCode::val_symbol(K_value, b_s);
    -        EmitCode::up();
    -        EmitCode::code();
    -        EmitCode::down();
    -            EmitCode::inv(RETURN_BIP);
    +            EmitCode::code();
                 EmitCode::down();
    -                smaller = b_s; larger = a_s;
    -                Formula for range10.8.5.1;
    +                EmitCode::inv(RETURN_BIP);
    +                EmitCode::down();
    +                    smaller = b_s; larger = a_s;
    +                    Formula for range30.3.7.1;
    +                EmitCode::up();
                 EmitCode::up();
             EmitCode::up();
    -    EmitCode::up();
    -
    -    EmitCode::inv(RETURN_BIP);
    -    EmitCode::down();
    -        smaller = a_s; larger = b_s;
    -        Formula for range10.8.5.1;
    -    EmitCode::up();
     
    +        EmitCode::inv(RETURN_BIP);
    +        EmitCode::down();
    +            smaller = a_s; larger = b_s;
    +            Formula for range30.3.7.1;
    +        EmitCode::up();
    +    }
         Functions::end(save);
     
    -
    • This code is used in §10.8 (twice).
    -

    §10.8.5.1. Formula for range10.8.5.1 = +

    • This code is used in §30.3 (twice).
    +

    §30.3.7.1. Formula for range30.3.7.1 =

    @@ -1429,7 +1360,573 @@ and b inclusive
             EmitCode::up();
         EmitCode::up();
     
    - + +

    §30.3.8. Compile indexing function for this kind30.3.8 = +

    + +
    +    inter_name *iname_r = RTKindConstructors::indexing_fn_iname(K);
    +    packaging_state save = Functions::begin(iname_r);
    +    inter_symbol *a_s = LocalVariables::new_other_as_symbol(I"a");
    +
    +    if (RTKindConstructors::is_nonstandard_enumeration(K)) {
    +        EmitCode::inv(RETURN_BIP);
    +        EmitCode::down();
    +            EmitCode::call(Hierarchy::find(INDEX_OF_ENUM_VAL_HL));
    +            EmitCode::down();
    +                EmitCode::val_iname(K_value, RTKindConstructors::instances_array_iname(K));
    +                EmitCode::val_symbol(K_value, a_s);
    +            EmitCode::up();
    +        EmitCode::up();
    +    } else {
    +        EmitCode::inv(IF_BIP);
    +        EmitCode::down();
    +            EmitCode::inv(OR_BIP);
    +            EmitCode::down();
    +                EmitCode::inv(LT_BIP);
    +                EmitCode::down();
    +                    EmitCode::val_symbol(K_value, a_s);
    +                    EmitCode::val_number(0);
    +                EmitCode::up();
    +                EmitCode::inv(GT_BIP);
    +                EmitCode::down();
    +                    EmitCode::val_symbol(K_value, a_s);
    +                    EmitCode::val_number((inter_ti) RTKindConstructors::enumeration_size(K));
    +                EmitCode::up();
    +            EmitCode::up();
    +            EmitCode::code();
    +            EmitCode::down();
    +                EmitCode::inv(RETURN_BIP);
    +                EmitCode::down();
    +                    EmitCode::val_number(0);
    +                EmitCode::up();
    +            EmitCode::up();
    +        EmitCode::up();
    +
    +        EmitCode::inv(RETURN_BIP);
    +        EmitCode::down();
    +            EmitCode::val_symbol(K_value, a_s);
    +        EmitCode::up();
    +    }
    +    Functions::end(save);
    +
    + +

    §30.3.9. Apply support function metadata30.3.9 = +

    + +
    +    inter_name *iname = RTKindConstructors::support_fn_iname(K);
    +    if (iname) Hierarchy::apply_metadata_from_iname(pack, KIND_SUPPORT_FN_MD_HL, iname);
    +    else internal_error("kind with block values but no support function");
    +
    + +

    §30.3.10. Apply comparison function metadata30.3.10 = +

    + +
    +    inter_name *iname = RTKindConstructors::comparison_fn_iname(K);
    +    if (iname) Hierarchy::apply_metadata_from_iname(pack, KIND_CMP_FN_MD_HL, iname);
    +    else internal_error("kind with no comparison function");
    +
    + +

    §30.3.11. Apply make-default-value function metadata30.3.11 = +

    + +
    +    inter_name *iname = RTKindConstructors::default_value_fn_iname(kc);
    +    Hierarchy::apply_metadata_from_iname(pack, KIND_MKDEF_FN_MD_HL, iname);
    +
    + +

    §30.3.12. Compile make-default-value function30.3.12 = +

    + +
    +    inter_name *default_value_fn_iname = RTKindConstructors::default_value_fn_iname(kc);
    +    packaging_state save = Functions::begin(default_value_fn_iname);
    +    inter_symbol *sk_s = LocalVariables::new_other_as_symbol(I"sk");
    +    EmitCode::inv(RETURN_BIP);
    +    EmitCode::down();
    +        if (KindConstructors::uses_block_values(kc)) {
    +            inter_name *iname = Hierarchy::find(BLKVALUECREATE_HL);
    +            EmitCode::call(iname);
    +            EmitCode::down();
    +                EmitCode::val_symbol(K_value, sk_s);
    +            EmitCode::up();
    +        } else {
    +            if (RTKindConstructors::is_subkind_of_object(kc))
    +                EmitCode::val_false();
    +            else
    +                DefaultValues::val(Kinds::base_construction(kc),
    +                    EMPTY_WORDING, "default value");
    +        }
    +    EmitCode::up();
    +    Functions::end(save);
    +
    + +

    §30.3.13. Apply printing function metadata30.3.13 = +

    + +
    +    inter_name *printing_rule_name =
    +        RTKindConstructors::printing_fn_iname(Kinds::base_construction(kc));
    +    if (printing_rule_name)
    +        Hierarchy::apply_metadata_from_iname(pack, KIND_PRINT_FN_MD_HL,
    +            printing_rule_name);
    +
    + +

    §30.3.14. A slightly bogus printing function first. If the source text declares a kind +but never gives any enumerated values or literal patterns, then such values will +never appear at run-time; but we need the printing routine to exist to avoid +compilation errors. +

    + +

    Compile printing function for a vacant but named kind30.3.14 = +

    + +
    +    inter_name *printing_rule_name = RTKindConstructors::printing_fn_iname(K);
    +    packaging_state save = Functions::begin(printing_rule_name);
    +    inter_symbol *value_s = LocalVariables::new_other_as_symbol(I"value");
    +    TEMPORARY_TEXT(C)
    +    WRITE_TO(C, "weak kind ID: %n\n", RTKindIDs::weak_iname(K));
    +    EmitCode::comment(C);
    +    DISCARD_TEXT(C)
    +    EmitCode::inv(PRINT_BIP);
    +    EmitCode::down();
    +        EmitCode::val_symbol(K_value, value_s);
    +    EmitCode::up();
    +    Functions::end(save);
    +
    + +

    §30.3.15. A unit is printed back with its earliest-defined literal pattern used as +notation. If it had no literal patterns, it would come out as decimal numbers, +but at present this can't happen. +

    + +

    Compile printing function for a unit kind30.3.15 = +

    + +
    +    inter_name *printing_rule_name = RTKindConstructors::printing_fn_iname(K);
    +    if (LiteralPatterns::list_of_literal_forms(K))
    +        RTLiteralPatterns::printing_routine(printing_rule_name,
    +            LiteralPatterns::list_of_literal_forms(K));
    +    else {
    +        packaging_state save = Functions::begin(printing_rule_name);
    +        inter_symbol *value_s = LocalVariables::new_other_as_symbol(I"value");
    +        EmitCode::inv(PRINT_BIP);
    +        EmitCode::down();
    +            EmitCode::val_symbol(K_value, value_s);
    +        EmitCode::up();
    +        Functions::end(save);
    +    }
    +
    + +

    §30.3.16. Compile printing function for an enumerated kind30.3.16 = +

    + +
    +    inter_name *printing_rule_name = RTKindConstructors::printing_fn_iname(K);
    +    packaging_state save = Functions::begin(printing_rule_name);
    +    inter_symbol *value_s = LocalVariables::new_other_as_symbol(I"value");
    +
    +    EmitCode::inv(SWITCH_BIP);
    +    EmitCode::down();
    +        EmitCode::val_symbol(K_value, value_s);
    +        EmitCode::code();
    +        EmitCode::down();
    +            instance *I;
    +            LOOP_OVER_INSTANCES(I, K) {
    +                EmitCode::inv(CASE_BIP);
    +                EmitCode::down();
    +                    EmitCode::val_iname(K_value, RTInstances::value_iname(I));
    +                    EmitCode::code();
    +                    EmitCode::down();
    +                        EmitCode::inv(PRINT_BIP);
    +                        EmitCode::down();
    +                            TEMPORARY_TEXT(CT)
    +                            wording NW = Instances::get_name_in_play(I, FALSE);
    +                            LOOP_THROUGH_WORDING(k, NW) {
    +                                TranscodeText::from_wide_string(CT, Lexer::word_raw_text(k), CT_RAW);
    +                                if (k < Wordings::last_wn(NW)) WRITE_TO(CT, " ");
    +                            }
    +                            EmitCode::val_text(CT);
    +                            DISCARD_TEXT(CT)
    +                        EmitCode::up();
    +                    EmitCode::up();
    +                EmitCode::up();
    +            }
    +            EmitCode::inv(DEFAULT_BIP);  this default case should never be needed
    +            EmitCode::down();
    +                EmitCode::code();
    +                EmitCode::down();
    +                    EmitCode::inv(PRINT_BIP);
    +                    EmitCode::down();
    +                        TEMPORARY_TEXT(DT)
    +                        wording W = Kinds::Behaviour::get_name(K, FALSE);
    +                        WRITE_TO(DT, "<illegal ");
    +                        if (Wordings::nonempty(W)) WRITE_TO(DT, "%W", W);
    +                        else WRITE_TO(DT, "value");
    +                        WRITE_TO(DT, ">");
    +                        EmitCode::val_text(DT);
    +                        DISCARD_TEXT(DT)
    +                    EmitCode::up();
    +                EmitCode::up();
    +            EmitCode::up();
    +        EmitCode::up();
    +    EmitCode::up();
    +
    +    Functions::end(save);
    +
    + +

    §30.3.17. Apply SHOWME function metadata30.3.17 = +

    + +
    +    inter_name *iname = RTKindConstructors::showme_fn_iname(K);
    +    Hierarchy::apply_metadata_from_iname(RTKindConstructors::kind_package(K),
    +        KIND_SHOWME_MD_HL, iname);
    +
    + +

    §30.3.18. Compile SHOWME function30.3.18 = +

    + +
    +    inter_name *iname = RTKindConstructors::showme_fn_iname(K);
    +    RTShowmeCommand::compile_kind_showme_fn(iname, K);
    +
    + +

    §30.3.19. Compile enumeration GPR30.3.19 = +

    + +
    +    text_stream *desc = Str::new();
    +    WRITE_TO(desc, "GPR for enumeration kind %u", K);
    +    Sequence::queue(&KindGPRs::enumeration_agent, STORE_POINTER_kind(K), desc);
    +
    + +

    §30.3.20. Compile quasinumerical GPR30.3.20 = +

    + +
    +    text_stream *desc = Str::new();
    +    WRITE_TO(desc, "GPR for quasinumerical kind %u", K);
    +    Sequence::queue(&KindGPRs::quasinumerical_agent, STORE_POINTER_kind(K), desc);
    +
    + +

    §30.2.11. Apply conformance metadata30.2.11 = +

    + +
    +    kind *K2;
    +    LOOP_OVER_BASE_KINDS(K2) {
    +        if ((Kinds::Behaviour::is_kind_of_kind(K2)) && (Kinds::conforms_to(K, K2))
    +             && (Kinds::eq(K2, K_pointer_value) == FALSE)
    +             && (Kinds::eq(K2, K_stored_value) == FALSE)) {
    +            package_request *R =
    +                Hierarchy::package_within(KIND_CONFORMANCE_HAP, pack);
    +            Hierarchy::apply_metadata_from_iname(R, CONFORMED_TO_MD_HL,
    +                RTKindConstructors::xref_iname(K2->construct));
    +        }
    +    }
    +
    + +

    §30.4. Part IV: Indexing metadata. Apply further metadata needed only for indexing30.4 = +

    + +
    +    Apply documentation reference metadata30.4.1;
    +    if (Kinds::is_proper_constructor(K)) {
    +        Apply variance metadata for the index30.4.2;
    +    }
    +    Apply priority metadata for the index30.4.3;
    +    Apply shading metadata for the index30.4.4;
    +    Apply default value metadata for the index30.4.5;
    +    if ((Kinds::Behaviour::is_quasinumerical(K)) && (Kinds::is_intermediate(K) == FALSE)) {
    +        Apply maximum and minimum values metadata for the index30.4.6;
    +        Apply dimensions metadata for the index30.4.7;
    +    }
    +    Apply literal notation metadata for the index30.4.8;
    +    Apply inferences metadata for the index30.4.9;
    +
    +
    • This code is used in §30.
    +

    §30.4.1. A documentation reference can be supplied literally by a Neptune file, or +can be implicit in the name of the kind. +

    + +

    Apply documentation reference metadata30.4.1 = +

    + +
    +    if (Kinds::Behaviour::is_subkind_of_object(K)) {
    +        wording W = Kinds::Behaviour::get_name(K, FALSE);
    +        if (Wordings::nonempty(W)) {
    +            TEMPORARY_TEXT(temp)
    +            WRITE_TO(temp, "kind_%N", Wordings::first_wn(W));
    +            if (DocReferences::validate_if_possible(temp))
    +                Kinds::Behaviour::set_documentation_reference(K, temp);
    +            DISCARD_TEXT(temp)
    +        }
    +    }
    +    text_stream *DR = Kinds::Behaviour::get_documentation_reference(K);
    +    if (Str::len(DR) > 0)
    +        Hierarchy::apply_metadata(pack, KIND_DOCUMENTATION_MD_HL, DR);
    +
    + +

    §30.4.2. This is just a textual description of what's going on with the terms +in a constructor, for the index. +

    + +

    Apply variance metadata for the index30.4.2 = +

    + +
    +    TEMPORARY_TEXT(CONS)
    +    int i, a = KindConstructors::arity(Kinds::get_construct(K));
    +    if ((a == 2) &&
    +        (KindConstructors::variance(Kinds::get_construct(K), 0) ==
    +            KindConstructors::variance(Kinds::get_construct(K), 1)))
    +        a = 1;
    +    for (i=0; i<a; i++) {
    +        if (i > 0) WRITE_TO(CONS, ", ");
    +        if (KindConstructors::variance(Kinds::get_construct(K), i) > 0)
    +            WRITE_TO(CONS, "covariant");
    +        else
    +            WRITE_TO(CONS, "contravariant");
    +        if (a > 1) WRITE_TO(CONS, " in %c", 'K'+i);
    +    }
    +    Hierarchy::apply_metadata(pack, KIND_INDEX_VARIANCE_MD_HL, CONS);
    +    DISCARD_TEXT(CONS)
    +
    + +

    §30.4.3. Apply priority metadata for the index30.4.3 = +

    + +
    +    Hierarchy::apply_metadata_from_number(pack, KIND_INDEX_PRIORITY_MD_HL,
    +        (inter_ti) Kinds::Behaviour::get_index_priority(K));
    +
    + +

    §30.4.4. Apply shading metadata for the index30.4.4 = +

    + +
    +    if ((RTKindConstructors::enumeration_size(K) == 0) &&
    +        (Kinds::Behaviour::indexed_grey_if_empty(K)))
    +        Hierarchy::apply_metadata_from_number(pack, KIND_SHADED_MD_HL, 1);
    +
    + +

    §30.4.5. Apply default value metadata for the index30.4.5 = +

    + +
    +    TEMPORARY_TEXT(IDV)
    +    instance *I;
    +    LOOP_OVER_INSTANCES(I, K) {
    +        Instances::write_name(IDV, I);
    +        break;
    +    }
    +    if (Str::len(IDV) == 0) {
    +        text_stream *text = Kinds::Behaviour::get_index_default_value(K);
    +        if (Str::eq(text, I"<0-in-literal-pattern>"))
    +            Index the constant 0 but use the default literal pattern30.4.5.1
    +        else if (Str::eq(text, I"<first-constant>"))
    +            WRITE_TO(IDV, "--");
    +        else
    +            WRITE_TO(IDV, "%S", text);
    +    }
    +    Hierarchy::apply_metadata(pack, KIND_INDEX_DEFAULT_MD_HL, IDV);
    +    DISCARD_TEXT(IDV)
    +
    + +

    §30.4.5.1. For every quasinumeric kind the default value is 0, but we don't want to +index just "0" because that means 0-as-a-number: we want it to come out +as "0 kg", "0 hectares", or whatever is appropriate. +

    + +

    Index the constant 0 but use the default literal pattern30.4.5.1 = +

    + +
    +    if (LiteralPatterns::list_of_literal_forms(K))
    +        LiteralPatterns::index_value(IDV,
    +            LiteralPatterns::list_of_literal_forms(K), 0);
    +    else
    +        WRITE_TO(IDV, "--");
    +
    + +

    §30.4.6. Apply maximum and minimum values metadata for the index30.4.6 = +

    + +
    +    TEMPORARY_TEXT(OUT)
    +    Index the minimum positive value for a quasinumerical kind30.4.6.1;
    +    Hierarchy::apply_metadata(pack, MIN_VAL_INDEX_MD_HL, OUT);
    +    Str::clear(OUT);
    +    Index the maximum positive value for a quasinumerical kind30.4.6.2;
    +    Hierarchy::apply_metadata(pack, MAX_VAL_INDEX_MD_HL, OUT);
    +    Str::clear(OUT);
    +    DISCARD_TEXT(OUT)
    +
    + +

    §30.4.6.1. Index the minimum positive value for a quasinumerical kind30.4.6.1 = +

    + +
    +    if (Kinds::eq(K, K_number)) WRITE("1");
    +    else {
    +        text_stream *p = Kinds::Behaviour::get_index_minimum_value(K);
    +        if (Str::len(p) > 0) WRITE("%S", p);
    +        else LiteralPatterns::index_value(OUT,
    +            LiteralPatterns::list_of_literal_forms(K), 1);
    +    }
    +
    + +

    §30.4.6.2. Index the maximum positive value for a quasinumerical kind30.4.6.2 = +

    + +
    +    if (Kinds::eq(K, K_number)) {
    +        if (TargetVMs::is_16_bit(Task::vm())) WRITE("32767");
    +        else WRITE("2147483647");
    +    } else {
    +        text_stream *p = Kinds::Behaviour::get_index_maximum_value(K);
    +        if (Str::len(p) > 0) WRITE("%S", p);
    +        else {
    +            if (TargetVMs::is_16_bit(Task::vm()))
    +                LiteralPatterns::index_value(OUT,
    +                    LiteralPatterns::list_of_literal_forms(K), 32767);
    +            else
    +                LiteralPatterns::index_value(OUT,
    +                    LiteralPatterns::list_of_literal_forms(K), 2147483647);
    +        }
    +    }
    +
    + +

    §30.4.7. Apply dimensions metadata for the index30.4.7 = +

    + +
    +    TEMPORARY_TEXT(OUT)
    +    if (Kinds::Dimensions::dimensionless(K) == FALSE) {
    +        unit_sequence *deriv = Kinds::Behaviour::get_dimensional_form(K);
    +        Kinds::Dimensions::index_unit_sequence(OUT, deriv, TRUE);
    +    }
    +    Hierarchy::apply_metadata(pack, DIMENSIONS_INDEX_MD_HL, OUT);
    +    DISCARD_TEXT(OUT)
    +
    + +

    §30.4.8. Apply literal notation metadata for the index30.4.8 = +

    + +
    +    if (LiteralPatterns::list_of_literal_forms(K)) {
    +        TEMPORARY_TEXT(LF)
    +        LiteralPatterns::index_all(LF, K);
    +        Hierarchy::apply_metadata(pack, KIND_INDEX_NOTATION_MD_HL, LF);
    +        DISCARD_TEXT(LF)
    +    }
    +
    + +

    §30.4.9. Apply inferences metadata for the index30.4.9 = +

    + +
    +    RTInferences::index(pack, KIND_BRIEF_INFERENCES_MD_HL, KindSubjects::from_kind(K), TRUE);
    +    RTInferences::index(pack, KIND_INFERENCES_MD_HL, KindSubjects::from_kind(K), FALSE);
    +
    + +

    §31. Pretty-printing names for the index.

    + +
    +void RTKindConstructors::index_name(OUTPUT_STREAM, kind *K, int plural) {
    +    wording W = Kinds::Behaviour::get_name(K, plural);
    +    if (Wordings::nonempty(W)) {
    +        if (Kinds::is_proper_constructor(K)) {
    +            Index the constructor text31.1;
    +        } else {
    +            WRITE("%W", W);
    +        }
    +    }
    +}
    +
    +

    §31.1. Index the constructor text31.1 = +

    + +
    +    int length = Wordings::length(W), w1 = Wordings::first_wn(W), tinted = TRUE;
    +    int i, first_stroke = -1, last_stroke = -1;
    +    for (i=0; i<length; i++) {
    +        if (Lexer::word(w1+i) == STROKE_V) {
    +            if (first_stroke == -1) first_stroke = i;
    +            last_stroke = i;
    +        }
    +    }
    +    int from = 0, to = length-1;
    +    if (last_stroke >= 0) from = last_stroke+1; else tinted = FALSE;
    +    if (tinted) HTML::begin_span(OUT, I"indexgrey");
    +    for (i=from; i<=to; i++) {
    +        int j, untinted = FALSE;
    +        for (j=0; j<first_stroke; j++)
    +            if (Lexer::word(w1+j) == Lexer::word(w1+i))
    +                untinted = TRUE;
    +        if (untinted) HTML::end_span(OUT);
    +        if (i>from) WRITE(" ");
    +        if (Lexer::word(w1+i) == CAPITAL_K_V) WRITE("K");
    +        else if (Lexer::word(w1+i) == CAPITAL_L_V) WRITE("L");
    +        else WRITE("%V", Lexer::word(w1+i));
    +        if (untinted) HTML::begin_span(OUT, I"indexgrey");
    +    }
    +    if (tinted) HTML::end_span(OUT);
    +
    +
    • This code is used in §31.
    +

    §32. Metadata about multiplication. This is used only for indexing. +

    + +
    +void RTKindConstructors::apply_multiplication_rule_metadata(void) {
    +    kind *L, *R, *O;
    +    int wn;
    +    LOOP_OVER_MULTIPLICATIONS(L, R, O, wn) {
    +        package_request *pack = Hierarchy::completion_package(MULTIPLICATION_RULE_HAP);
    +        if (wn >= 0) Hierarchy::apply_metadata_from_number(pack, SET_AT_MD_HL, (inter_ti) wn);
    +        TEMPORARY_TEXT(OUT)
    +        WRITE_TO(OUT, "%u", L);
    +        Hierarchy::apply_metadata(pack, LEFT_OPERAND_MD_HL, OUT);
    +        Str::clear(OUT);
    +        WRITE_TO(OUT, "%u", R);
    +        Hierarchy::apply_metadata(pack, RIGHT_OPERAND_MD_HL, OUT);
    +        Str::clear(OUT);
    +        WRITE_TO(OUT, "%u", O);
    +        Hierarchy::apply_metadata(pack, RESULT_MD_HL, OUT);
    +        Str::clear(OUT);
    +        LiteralPatterns::index_benchmark_value(OUT, L);
    +        Hierarchy::apply_metadata(pack, LEFT_OPERAND_BM_MD_HL, OUT);
    +        Str::clear(OUT);
    +        LiteralPatterns::index_benchmark_value(OUT, R);
    +        Hierarchy::apply_metadata(pack, RIGHT_OPERAND_BM_MD_HL, OUT);
    +        Str::clear(OUT);
    +        LiteralPatterns::index_benchmark_value(OUT, O);
    +        Hierarchy::apply_metadata(pack, RESULT_BM_MD_HL, OUT);
    +        DISCARD_TEXT(OUT)
    +    }
    +}
    +
    +

    §33. Property permissions for kinds.

    + +
    +void RTKindConstructors::compile_permissions(void) {
    +    kind_constructor *kc;
    +    LOOP_OVER(kc, kind_constructor) {
    +        if ((kc == CON_KIND_VARIABLE) || (kc == CON_INTERMEDIATE)) continue;
    +        kind *K = Kinds::base_construction(kc);
    +        if (RTKindDeclarations::base_represented_in_Inter(K)) {
    +            RTPropertyPermissions::emit_kind_permissions(K);
    +            RTPropertyValues::compile_values_for_kind(K);
    +        }
    +    }
    +}
    +
    diff --git a/docs/runtime-module/5-ki.html b/docs/runtime-module/5-ki.html index 920f0e225..5b9713a68 100644 --- a/docs/runtime-module/5-ki.html +++ b/docs/runtime-module/5-ki.html @@ -111,30 +111,29 @@ like variables. That's what makes them intermediate.)

    -text_stream *RTKindIDs::identifier_for_weak_ID(kind_constructor *kc) {
    -    if (Str::len(kc->explicit_identifier) > 0)
    -        return kc->explicit_identifier;
    +text_stream *RTKindIDs::identifier_for_weak_ID(kind_constructor *kc) {
    +    if (Str::len(kc->explicit_identifier) > 0) return kc->explicit_identifier;
         text_stream *invented = Str::new();
         WRITE_TO(invented, "WEAK_ID_%d", kc->allocation_id);
         return invented;
     }
     
    -inter_name *RTKindIDs::weak_iname(kind *K) {
    -    if (K == NULL) { return RTKindConstructors::UNKNOWN_iname(); }
    +inter_name *RTKindIDs::weak_iname(kind *K) {
    +    if (K == NULL) return RTKindConstructors::weak_ID_iname(CON_UNKNOWN);
         if (Kinds::Behaviour::is_subkind_of_object(K)) K = K_object;
         kind_constructor *con = Kinds::get_construct(K);
    -    inter_name *iname = RTKindConstructors::weak_ID_iname(con);
    +    inter_name *iname = RTKindConstructors::weak_ID_iname(con);
         if (iname) return iname;
         LOG("%u has no weak ID iname\n", K);
         internal_error("kind has no weak ID iname");
         return NULL;
     }
     
    -inter_name *RTKindIDs::weak_iname_of_constructor(kind_constructor *kc) {
    -    if (kc == NULL) return RTKindConstructors::UNKNOWN_iname();
    +inter_name *RTKindIDs::weak_iname_of_constructor(kind_constructor *kc) {
    +    if (kc == NULL) return RTKindConstructors::weak_ID_iname(CON_UNKNOWN);
         if (Kinds::Behaviour::is_subkind_of_object(Kinds::base_construction(kc)))
             return RTKindIDs::weak_iname(K_object);
    -    return RTKindConstructors::weak_ID_iname(kc);
    +    return RTKindConstructors::weak_ID_iname(kc);
     }
     

    §2. And the following compiles an easier-on-the-eye form of the weak ID, but diff --git a/docs/runtime-module/5-lp.html b/docs/runtime-module/5-lp.html index 870811ebf..e237a0fac 100644 --- a/docs/runtime-module/5-lp.html +++ b/docs/runtime-module/5-lp.html @@ -81,7 +81,7 @@ function togglePopup(material_id) { return lpcd; }

    -
    • The structure literal_pattern_compilation_data is accessed in 3/uo, 5/mlt, 5/tbl, 5/dbi, 5/dli, 5/dci, 5/prp, 5/act2, 5/nap and here.
    +
    • The structure literal_pattern_compilation_data is accessed in 3/uo, 5/mlt, 5/tbl, 5/dbi, 5/dli, 5/dci, 5/prp, 5/kc, 5/act2, 5/nap and here.

    §2. And each gives rise to a package, though it contains only two functions: one to print, one to parse from a player's command. (So in Basic Inform, only the first function appears.) @@ -1467,7 +1467,7 @@ sets the parsed_number

    §5. Printing the I6 variable |value| out in an LP's notation at run-time.

    -void RTLiteralPatterns::printing_routine(inter_name *iname, literal_pattern *lp_list) {
    +void RTLiteralPatterns::printing_routine(inter_name *iname, literal_pattern *lp_list) {
         packaging_state save = Functions::begin(iname);
     
         literal_pattern_name *lpn;
    diff --git a/docs/runtime-module/5-rlb.html b/docs/runtime-module/5-rlb.html
    index 1a7614bbf..b3aca842c 100644
    --- a/docs/runtime-module/5-rlb.html
    +++ b/docs/runtime-module/5-rlb.html
    @@ -849,33 +849,6 @@ questionable arrangement, but there it is).
     }
     
     void RTRulebooks::RulebookOutcomePrintingRule(void) {
    -    inter_name *printing_rule_name = RTKindConstructors::get_iname(K_rulebook_outcome);
    -    packaging_state save = Functions::begin(printing_rule_name);
    -    inter_symbol *rbnov_s = LocalVariables::new_other_as_symbol(I"nro");
    -    EmitCode::inv(IFELSE_BIP);
    -    EmitCode::down();
    -        EmitCode::inv(EQ_BIP);
    -        EmitCode::down();
    -            EmitCode::val_symbol(K_value, rbnov_s);
    -            EmitCode::val_number(0);
    -        EmitCode::up();
    -        EmitCode::code();
    -        EmitCode::down();
    -            EmitCode::inv(PRINT_BIP);
    -            EmitCode::down();
    -                EmitCode::val_text(I"(no outcome)");
    -            EmitCode::up();
    -        EmitCode::up();
    -        EmitCode::code();
    -        EmitCode::down();
    -            EmitCode::inv(PRINTSTRING_BIP);
    -            EmitCode::down();
    -                EmitCode::val_symbol(K_value, rbnov_s);
    -            EmitCode::up();
    -            EmitCode::rfalse();
    -        EmitCode::up();
    -    EmitCode::up();
    -    Functions::end(save);
     }
     
    -

    The Standard Rules extension, included in all interactive fiction projects. This is version 6.

    +

    The Standard Rules extension, included in all interactive fiction projects. This is version 7.


      diff --git a/docs/supervisor-module/2-cps.html b/docs/supervisor-module/2-cps.html index 469668568..e67c064b4 100644 --- a/docs/supervisor-module/2-cps.html +++ b/docs/supervisor-module/2-cps.html @@ -231,8 +231,7 @@ such newcomers are graphed too.
       build_vertex *Copies::construct_project_graph(inbuild_copy *C) {
      -    build_vertex *V = C->vertex;
      -    VOID_METHOD_CALL(C->edition->work->genre, GENRE_BUILDING_SOON_MTID, C, &V);
      +    build_vertex *V = Copies::building_soon(C);
           Copies::graph_everything();
           return V;
       }
      @@ -241,6 +240,12 @@ such newcomers are graphed too.
           inbuild_copy *C;
           LOOP_OVER(C, inbuild_copy) Copies::construct_graph(C);
       }
      +
      +build_vertex *Copies::building_soon(inbuild_copy *C) {
      +    build_vertex *V = C->vertex;
      +    VOID_METHOD_CALL(C->edition->work->genre, GENRE_BUILDING_SOON_MTID, C, &V);
      +    return V;
      +}
       

      §10. Sorting. The command-line inbuild uses this when sorting search results.

      diff --git a/docs/supervisor-module/3-bg.html b/docs/supervisor-module/3-bg.html index 8acc1caa8..5a7a1c6d4 100644 --- a/docs/supervisor-module/3-bg.html +++ b/docs/supervisor-module/3-bg.html @@ -177,7 +177,7 @@ at most one edge of each colour. ADD_TO_LINKED_LIST(to, build_vertex, from->build_edges); } -void Graphs::need_this_to_use(build_vertex *from, build_vertex *to) { +void Graphs::need_this_to_use(build_vertex *from, build_vertex *to) { if (from == NULL) internal_error("no from"); if (to == NULL) internal_error("no to"); if (from == to) internal_error("graph node depends on itself"); diff --git a/docs/supervisor-module/3-bs2.html b/docs/supervisor-module/3-bs2.html index 752dd9c7d..4cafd17f2 100644 --- a/docs/supervisor-module/3-bs2.html +++ b/docs/supervisor-module/3-bs2.html @@ -116,7 +116,7 @@ to access any of inbuild CLASS_DEFINITION } build_step;
    -
    • The structure build_step is accessed in 2/cps, 3/bg, 3/is, 3/is2, 3/is3, 3/is4, 4/em, 4/ebm, 4/km, 5/ks, 5/ps2, 6/hdn, 6/inc and here.
    +
    • The structure build_step is accessed in 2/cps, 3/bg, 3/is, 3/is2, 3/is3, 3/is4, 4/em, 4/ebm, 4/km, 5/es, 5/ks, 5/ps2, 6/hdn, 6/inc and here.

    §4. We build scripts for a vertex by attaching one step at a time to it:

    diff --git a/docs/supervisor-module/3-ib.html b/docs/supervisor-module/3-ib.html index b42447d93..9dadde635 100644 --- a/docs/supervisor-module/3-ib.html +++ b/docs/supervisor-module/3-ib.html @@ -330,16 +330,16 @@ created during the same second. if (last_up_to_date_at == Platform::never_time()) needs_building = TRUE; else { - if (T) { WRITE_TO(T, "Last built at: %08x\n", last_up_to_date_at); } + if (T) { WRITE_TO(T, "Last built at: %s\n", ctime(&last_up_to_date_at)); } if (gb & BUILD_DEPENDENCIES_MATTER_GB) { time_t t = IncrementalBuild::time_of_latest_build_dependency(V); - if (T) { WRITE_TO(T, "Most recent build dependency: %08x\n", t); } + if (T) { WRITE_TO(T, "Most recent build dependency: %s\n", ctime(&t)); } if (IncrementalBuild::timecmp(t, last_up_to_date_at) >= 0) needs_building = TRUE; } if (gb & USE_DEPENDENCIES_MATTER_GB) { time_t t = IncrementalBuild::time_of_latest_use_dependency(V); - if (T) { WRITE_TO(T, "Most recent use dependency: %08x\n", t); } + if (T) { WRITE_TO(T, "Most recent use dependency: %s\n", ctime(&t)); } if (IncrementalBuild::timecmp(t, last_up_to_date_at) >= 0) needs_building = TRUE; } diff --git a/docs/supervisor-module/4-em.html b/docs/supervisor-module/4-em.html index 3d6cd41cf..3173e9b22 100644 --- a/docs/supervisor-module/4-em.html +++ b/docs/supervisor-module/4-em.html @@ -309,7 +309,8 @@ the current VM settings. Extensions::construct_graph(ExtensionManager::from_copy(C)); build_vertex *V; LOOP_OVER_LINKED_LIST(V, build_vertex, C->vertex->use_edges) - ExtensionManager::ensure_graphed(V->as_copy); + if (ExtensionManager::from_copy(V->as_copy)) + ExtensionManager::ensure_graphed(V->as_copy); }

    §9. Source text.

    diff --git a/docs/supervisor-module/5-es.html b/docs/supervisor-module/5-es.html index 9837af7f4..1f3b719c1 100644 --- a/docs/supervisor-module/5-es.html +++ b/docs/supervisor-module/5-es.html @@ -783,7 +783,7 @@ in a minimal sort of way, with just an return P; } -inbuild_nest *Extensions::materials_nest(inform_extension *E) { +inbuild_nest *Extensions::materials_nest(inform_extension *E) { pathname *P = Extensions::materials_path(E); if ((E->materials_nest == NULL) && (P)) { E->materials_nest = Nests::new(P); @@ -956,6 +956,14 @@ no project involved, we must take action ourselves.) Copies::get_source_text(E->as_copy); Sentences::set_start_of_source(sfsm, -1); Inclusions::traverse(E->as_copy, E->syntax_tree); + linked_list *L = NEW_LINKED_LIST(inbuild_nest); + inbuild_nest *N = Extensions::materials_nest(E); + ADD_TO_LINKED_LIST(N, inbuild_nest, L); + inbuild_requirement *req; + LOOP_OVER_LINKED_LIST(req, inbuild_requirement, E->kits) { + inform_kit *K = Kits::find_by_name(req->work->raw_title, L, NULL); + if (K) Graphs::need_this_to_use(E->as_copy->vertex, K->as_copy->vertex); + } }

    §10. Read source text. The scan only skimmed the surface of the file, and didn't try to parse it as diff --git a/docs/supervisor-module/5-ks.html b/docs/supervisor-module/5-ks.html index 4ed3ad299..a7bffe8a2 100644 --- a/docs/supervisor-module/5-ks.html +++ b/docs/supervisor-module/5-ks.html @@ -373,7 +373,7 @@ a kit, going only on a name such as -inform_kit *Kits::find_by_name(text_stream *name, linked_list *nest_list, +inform_kit *Kits::find_by_name(text_stream *name, linked_list *nest_list, inbuild_requirement *req) { if (req == NULL) req = Requirements::any_version_of(Works::new(kit_genre, name, I"")); inbuild_search_result *R = Nests::search_for_best(req, nest_list); diff --git a/docs/values-module/3-lp.html b/docs/values-module/3-lp.html index 558a59f9d..c73e81560 100644 --- a/docs/values-module/3-lp.html +++ b/docs/values-module/3-lp.html @@ -1693,7 +1693,6 @@ For instance, the dollars-and-cents example compiles:

         if (lp->no_lp_elements > 0) {
             feed_t id = Feeds::begin();
    -        TEMPORARY_TEXT(print_rule_buff)
             Feeds::feed_C_string(L"To decide which ");
             Feeds::feed_text(TEMP);
             Feeds::feed_C_string(L" is ");
    @@ -1701,19 +1700,21 @@ For instance, the dollars-and-cents example compiles:
             Feeds::feed_C_string(L" with ");
             for (int i=0; i<lp->no_lp_elements; i++) {
                 literal_pattern_element *lpe = &(lp->lp_elements[i]);
    +            TEMPORARY_TEXT(print_rule_buff)
                 WRITE_TO(print_rule_buff, " part%d ", i);
                 Feeds::feed_wording(lpe->element_name);
                 Feeds::feed_C_string(L" part ( ");
                 Feeds::feed_text(print_rule_buff);
                 Feeds::feed_C_string(L" - a number ) ");
    +            DISCARD_TEXT(print_rule_buff)
             }
             wording XW = Feeds::end(id);
    -        if (Wordings::phrasual_length(XW) >= MAX_WORDS_PER_PHRASE + 5)
    +        if (Wordings::phrasual_length(XW) >= MAX_WORDS_PER_PHRASE + 5) {
                 Issue a problem for overly long part names28.1.1
    -        else {
    +        } else {
                 Sentences::make_node(Task::syntax_tree(), XW, ':');
                 id = Feeds::begin();
    -            Str::clear(print_rule_buff);
    +            TEMPORARY_TEXT(print_rule_buff)
                 WRITE_TO(print_rule_buff, " (- (");
                 for (int i=0; i<lp->no_lp_elements; i++) {
                     literal_pattern_element *lpe = &(lp->lp_elements[i]);
    @@ -1725,9 +1726,9 @@ For instance, the dollars-and-cents example compiles:
                 WRITE_TO(print_rule_buff, ") -) ");
                 Feeds::feed_text(print_rule_buff);
                 XW = Feeds::end(id);
    +            DISCARD_TEXT(print_rule_buff)
                 Sentences::make_node(Task::syntax_tree(), XW, '.');
             }
    -        DISCARD_TEXT(print_rule_buff)
         }
     
    • This code is used in §28.
    diff --git a/inbuild/supervisor-module/Chapter 2/Copies.w b/inbuild/supervisor-module/Chapter 2/Copies.w index 05d47692e..31892051b 100644 --- a/inbuild/supervisor-module/Chapter 2/Copies.w +++ b/inbuild/supervisor-module/Chapter 2/Copies.w @@ -165,8 +165,7 @@ such newcomers are graphed too. = build_vertex *Copies::construct_project_graph(inbuild_copy *C) { - build_vertex *V = C->vertex; - VOID_METHOD_CALL(C->edition->work->genre, GENRE_BUILDING_SOON_MTID, C, &V); + build_vertex *V = Copies::building_soon(C); Copies::graph_everything(); return V; } @@ -176,6 +175,12 @@ void Copies::graph_everything(void) { LOOP_OVER(C, inbuild_copy) Copies::construct_graph(C); } +build_vertex *Copies::building_soon(inbuild_copy *C) { + build_vertex *V = C->vertex; + VOID_METHOD_CALL(C->edition->work->genre, GENRE_BUILDING_SOON_MTID, C, &V); + return V; +} + @h Sorting. The command-line //inbuild// uses this when sorting search results. diff --git a/inbuild/supervisor-module/Chapter 3/Incremental Building.w b/inbuild/supervisor-module/Chapter 3/Incremental Building.w index a90ef50d1..f89dc132a 100644 --- a/inbuild/supervisor-module/Chapter 3/Incremental Building.w +++ b/inbuild/supervisor-module/Chapter 3/Incremental Building.w @@ -239,16 +239,16 @@ created during the same second. if (last_up_to_date_at == Platform::never_time()) needs_building = TRUE; else { - if (T) { WRITE_TO(T, "Last built at: %08x\n", last_up_to_date_at); } + if (T) { WRITE_TO(T, "Last built at: %s\n", ctime(&last_up_to_date_at)); } if (gb & BUILD_DEPENDENCIES_MATTER_GB) { time_t t = IncrementalBuild::time_of_latest_build_dependency(V); - if (T) { WRITE_TO(T, "Most recent build dependency: %08x\n", t); } + if (T) { WRITE_TO(T, "Most recent build dependency: %s\n", ctime(&t)); } if (IncrementalBuild::timecmp(t, last_up_to_date_at) >= 0) needs_building = TRUE; } if (gb & USE_DEPENDENCIES_MATTER_GB) { time_t t = IncrementalBuild::time_of_latest_use_dependency(V); - if (T) { WRITE_TO(T, "Most recent use dependency: %08x\n", t); } + if (T) { WRITE_TO(T, "Most recent use dependency: %s\n", ctime(&t)); } if (IncrementalBuild::timecmp(t, last_up_to_date_at) >= 0) needs_building = TRUE; } diff --git a/inbuild/supervisor-module/Chapter 4/Extension Manager.w b/inbuild/supervisor-module/Chapter 4/Extension Manager.w index cb2475497..989104d1b 100644 --- a/inbuild/supervisor-module/Chapter 4/Extension Manager.w +++ b/inbuild/supervisor-module/Chapter 4/Extension Manager.w @@ -241,7 +241,8 @@ void ExtensionManager::ensure_graphed(inbuild_copy *C) { Extensions::construct_graph(ExtensionManager::from_copy(C)); build_vertex *V; LOOP_OVER_LINKED_LIST(V, build_vertex, C->vertex->use_edges) - ExtensionManager::ensure_graphed(V->as_copy); + if (ExtensionManager::from_copy(V->as_copy)) + ExtensionManager::ensure_graphed(V->as_copy); } @h Source text. diff --git a/inbuild/supervisor-module/Chapter 5/Extension Services.w b/inbuild/supervisor-module/Chapter 5/Extension Services.w index 00d89dd85..763c81906 100644 --- a/inbuild/supervisor-module/Chapter 5/Extension Services.w +++ b/inbuild/supervisor-module/Chapter 5/Extension Services.w @@ -778,6 +778,14 @@ void Extensions::construct_graph(inform_extension *E) { Copies::get_source_text(E->as_copy); Sentences::set_start_of_source(sfsm, -1); Inclusions::traverse(E->as_copy, E->syntax_tree); + linked_list *L = NEW_LINKED_LIST(inbuild_nest); + inbuild_nest *N = Extensions::materials_nest(E); + ADD_TO_LINKED_LIST(N, inbuild_nest, L); + inbuild_requirement *req; + LOOP_OVER_LINKED_LIST(req, inbuild_requirement, E->kits) { + inform_kit *K = Kits::find_by_name(req->work->raw_title, L, NULL); + if (K) Graphs::need_this_to_use(E->as_copy->vertex, K->as_copy->vertex); + } } @h Read source text. diff --git a/inform7/.gitignore b/inform7/.gitignore index 2ab5ecaa4..e927e4171 100644 --- a/inform7/.gitignore +++ b/inform7/.gitignore @@ -56,9 +56,9 @@ Tests/Test Problems/_Results_Actual/ Tests/Test Filings/_Results_Actual/ Tests/Documentation/ +**/*.interb Internal/Inter/Architecture16Kit/*.interb Internal/Inter/Architecture32Kit/*.interb -Internal/Inter/BasicInformExtrasKit/*.interb Internal/Inter/BasicInformKit/*.interb Internal/Inter/CommandParserKit/*.interb Internal/Inter/DialogueKit/*.interb diff --git a/inform7/Downloads/excerpts-diagnostics.txt b/inform7/Downloads/excerpts-diagnostics.txt index 2ad394478..70bb0c48d 100644 --- a/inform7/Downloads/excerpts-diagnostics.txt +++ b/inform7/Downloads/excerpts-diagnostics.txt @@ -1,15 +1,15 @@ -Size of lexicon: 3127 excerpt meanings - Stored among 845 words out of total vocabulary of 10732 - 715 words have a start list: longest belongs to report (with 293 meanings) +Size of lexicon: 3129 excerpt meanings + Stored among 846 words out of total vocabulary of 10735 + 716 words have a start list: longest belongs to report (with 293 meanings) 15 words have an end list: longest belongs to case (with 6 meanings) 29 words have a middle list: longest belongs to to (with 4 meanings) 108 words have a subset list: longest belongs to street (with 4 meanings) -Number of attempts to retrieve: 110340 - of which unsuccessful: 92203 - of which successful: 18137 +Number of attempts to retrieve: 110344 + of which unsuccessful: 92205 + of which successful: 18139 -Total attempts to match against excerpt meanings: 276468 - of which, total with incorrect hash codes: 253733 - of which, total with correct hash codes: 22735 - of which, total which matched: 19904 +Total attempts to match against excerpt meanings: 276472 + of which, total with incorrect hash codes: 253735 + of which, total with correct hash codes: 22737 + of which, total which matched: 19906 diff --git a/inform7/Downloads/preform-diagnostics.txt b/inform7/Downloads/preform-diagnostics.txt index 8d9bc4e21..45689c68b 100644 --- a/inform7/Downloads/preform-diagnostics.txt +++ b/inform7/Downloads/preform-diagnostics.txt @@ -1,6 +1,6 @@ internal nti 6 constraint (none) extremes [1, 1] - internal hits 1271/8464 nti 7 constraint (none) extremes [0, 0] + internal hits 1271/8468 nti 7 constraint (none) extremes [0, 0] internal hits 4004/8232 nti 8 constraint (none) extremes [0, 0] @@ -16,7 +16,7 @@ internal nti 10 constraint (none) extremes [1, 1] - internal hits 3000/26136 nti 11 constraint (none) extremes [1, 1] + internal hits 3000/26140 nti 11 constraint (none) extremes [1, 1] internal nti 12 constraint (none) extremes [1, 1] @@ -24,7 +24,7 @@ internal nti 14 constraint (none) extremes [1, 1] - internal hits 2/13752 nti 15 constraint (none) extremes [0, 0] + internal hits 2/13760 nti 15 constraint (none) extremes [0, 0] hits 0/18 nti 16 constraint DS = {16} extremes [3, infinity) English: @@ -76,12 +76,12 @@ * : {...} constraint DS = {21} extremes [3, infinity) - hits 448/2588 nti 23 constraint DS = {22, 23} extremes [6, infinity) + hits 448/2596 nti 23 constraint DS = {22, 23} extremes [6, infinity) English: {...} ( ) - (hits 425/883) (matched long text) constraint DS = {22, 23} extremes [6, infinity) + (hits 425/887) (matched long text) constraint DS = {22, 23} extremes [6, infinity) {...} -- -- - (hits 23/458) (matched long text) constraint DS = {22, 23} extremes [6, infinity) + (hits 23/462) (matched long text) constraint DS = {22, 23} extremes [6, infinity) hits 481/1192 nti 22 constraint DS = {22} extremes [3, 3] English: @@ -4772,23 +4772,23 @@ {...} constraint (none) extremes [1, infinity) - hits 86201/172402 nti 29 constraint (none) extremes [1, infinity) + hits 86205/172410 nti 29 constraint (none) extremes [1, infinity) English:
    {...} - (hits 16328/49247) (matched long text) constraint (none) extremes [2, infinity) + (hits 16328/49251) (matched long text) constraint (none) extremes [2, infinity) {...} - (hits 69873/69873) (matched long text) constraint (none) extremes [1, infinity) + (hits 69877/69877) (matched long text) constraint (none) extremes [1, infinity) nti 30 constraint (none) extremes [2, infinity) English:
    {...} constraint (none) extremes [2, infinity) -
    internal hits 16857/102740 nti r2 constraint (none) extremes [1, 1] +
    internal hits 16857/102752 nti r2 constraint (none) extremes [1, 1] - internal hits 20758/244732 nti r2 constraint (none) extremes [1, 1] + internal hits 20758/244740 nti r2 constraint (none) extremes [1, 1] - internal hits 2341/44110 nti r2 constraint (none) extremes [1, 1] + internal hits 2341/44114 nti r2 constraint (none) extremes [1, 1] nti r2 constraint CS = {r2} extremes [6, 6] English: @@ -5293,9 +5293,9 @@ grammatical case (hits 1/1) (matched: 'grammatical case') constraint CS = {14} extremes [2, 2] - internal hits 2494/44380 nti 16 constraint (none) extremes [0, 0] + internal hits 2504/44400 nti 16 constraint (none) extremes [0, 0] - internal hits 167/334 nti 17 constraint (none) extremes [1, infinity) + internal hits 169/338 nti 17 constraint (none) extremes [1, infinity) hits 24/68 nti 16 constraint DS = {16} extremes [3, infinity) English: @@ -5319,16 +5319,16 @@ (hits 5/5) (matched: 'value of kind k') constraint (none) extremes [1, infinity) - hits 5878/107440 nti r5 constraint (none) extremes [1, infinity) + hits 5883/107450 nti r5 constraint (none) extremes [1, infinity) English: ( ) - (hits 0/2331) constraint DS = {r5} & CW = {r2, r5} extremes [3, infinity) + (hits 0/2332) constraint DS = {r5} & CW = {r2, r5} extremes [3, infinity) ^ - (hits 1594/11892) (matched: 'k') constraint CW = {r2, r5} extremes [1, infinity) + (hits 1594/11897) (matched: 'k') constraint CW = {r2, r5} extremes [1, infinity) - (hits 201/10298) (matched: 'sayable value of kind k') constraint CW = {r2, r5} extremes [1, infinity) + (hits 202/10303) (matched: 'sayable value of kind k') constraint CW = {r2, r5} extremes [1, infinity) - (hits 3722/10097) (matched: 'an ice cream cone') constraint CW = {r2, r5} extremes [1, infinity) + (hits 3726/10101) (matched: 'an ice cream cone') constraint CW = {r2, r5} extremes [1, infinity) (hits 2/16834) (matched: 'object-based rulebook') constraint DS = {r5} extremes [2, infinity) @@ -5341,14 +5341,14 @@ (hits 8/137) (matched: 'room') constraint (none) extremes [1, infinity) - hits 201/2494 nti r5 constraint CW = {r2, r5} extremes [1, infinity) + hits 202/2504 nti r5 constraint CW = {r2, r5} extremes [1, infinity) English: - (hits 120/614) (matched: 'k') constraint CW = {r2, r5} extremes [1, 1] + (hits 120/616) (matched: 'k') constraint CW = {r2, r5} extremes [1, 1] of kind - (hits 81/315) (matched: 'sayable value of kind k') constraint DS = {r5} & CW = {r2, r5} extremes [4, infinity) + (hits 82/316) (matched: 'sayable value of kind k') constraint DS = {r5} & CW = {r2, r5} extremes [4, infinity) - internal hits 3722/20194 nti r5 constraint CW = {r2, r5} extremes [1, infinity) + internal hits 3726/20202 nti r5 constraint CW = {r2, r5} extremes [1, infinity) hits 2/33668 nti r5 constraint DS = {r5} extremes [2, infinity) English: @@ -5419,14 +5419,14 @@ (hits 7/7) (matched: 'value of kind l') constraint (none) extremes [1, infinity) - hits 100/448 nti r5 constraint (none) extremes [1, infinity) + hits 101/450 nti r5 constraint (none) extremes [1, infinity) English: - (hits 100/224) (matched: 'sayable value') constraint (none) extremes [1, infinity) + (hits 101/225) (matched: 'sayable value') constraint (none) extremes [1, infinity) internal hits 1594/21290 nti r5 constraint CW = {r2, r5} extremes [1, 1] - internal hits 220/1428 nti r5 constraint CW = {r2, r5} extremes [1, 1] + internal hits 221/1434 nti r5 constraint CW = {r2, r5} extremes [1, 1] internal hits 0/774 nti 19 constraint (none) extremes [1, 1] @@ -5496,12 +5496,12 @@ internal nti 21 constraint (none) extremes [1, infinity) - hits 208/10844 nti 22 constraint DW = {18, 19} extremes [2, infinity) + hits 208/10852 nti 22 constraint DW = {18, 19} extremes [2, infinity) English: - (hits 200/4218) (matched long text) constraint DS = {18} extremes [2, infinity) + (hits 200/4220) (matched long text) constraint DS = {18} extremes [2, infinity) - (hits 8/3857) (matched long text) constraint DS = {19} extremes [3, infinity) + (hits 8/3859) (matched long text) constraint DS = {19} extremes [3, infinity) hits 200/2514 nti 18 constraint DS = {18} extremes [2, infinity) English: @@ -5520,35 +5520,35 @@ section {...} (hits 158/1215) (matched long text) constraint DS = {18} extremes [2, infinity) - hits 8/7714 nti 19 constraint DS = {19} extremes [3, infinity) + hits 8/7718 nti 19 constraint DS = {19} extremes [3, infinity) English: {...} begin/begins here - (hits 4/3857) (matched long text) constraint DS = {19} extremes [3, infinity) + (hits 4/3859) (matched long text) constraint DS = {19} extremes [3, infinity) {...} end/ends here - (hits 4/3853) (matched: 'the standard rules end here') constraint DS = {19} extremes [3, infinity) + (hits 4/3855) (matched: 'the standard rules end here') constraint DS = {19} extremes [3, infinity) - hits 32/13752 nti 21 constraint (none) extremes [1, infinity) + hits 32/13760 nti 21 constraint (none) extremes [1, infinity) English: (hits 0/20) constraint (none) extremes [1, 1] {...} - (hits 0/6856) constraint (none) extremes [2, infinity) + (hits 0/6860) constraint (none) extremes [2, infinity) - (hits 0/6650) constraint DS = {20} extremes [4, infinity) + (hits 0/6654) constraint DS = {20} extremes [4, infinity) * constraint CS = {21} extremes [1, 1] * constraint DS = {21} extremes [2, 2] table {...} - (hits 14/6745) (matched long text) constraint DS = {21} extremes [2, infinity) + (hits 14/6749) (matched long text) constraint DS = {21} extremes [2, infinity) equation {...} - (hits 0/6731) constraint DS = {21} extremes [2, infinity) + (hits 0/6735) constraint DS = {21} extremes [2, infinity) include the {...} by {...} - (hits 0/6662) constraint DS = {21} extremes [5, infinity) + (hits 0/6666) constraint DS = {21} extremes [5, infinity) include {...} by {...} - (hits 18/6731) (matched long text) constraint DS = {21} extremes [4, infinity) + (hits 18/6735) (matched long text) constraint DS = {21} extremes [4, infinity) include (- {...} - (hits 0/6713) constraint DS = {21} extremes [3, infinity) + (hits 0/6717) constraint DS = {21} extremes [3, infinity) hits 9/2928 nti 22 constraint DS = {22} extremes [2, infinity) English: @@ -5563,12 +5563,12 @@ when {...} (hits 4/1412) (matched: 'when scene begins is a scene based rulebook') constraint DS = {22} extremes [2, infinity) - hits 0/13300 nti 20 constraint DS = {20} extremes [4, infinity) + hits 0/13308 nti 20 constraint DS = {20} extremes [4, infinity) English: include (- {###} in the preform grammar (hits 0/116) constraint DS = {20} extremes [7, 7] use {...} language element/elements - (hits 0/6650) constraint DS = {20} extremes [4, infinity) + (hits 0/6654) constraint DS = {20} extremes [4, infinity) hits 37/474 nti 28 constraint DS = {28} extremes [2, infinity) English: @@ -5669,9 +5669,9 @@ hits 10/20 nti 8 constraint (none) extremes [1, infinity) English: version of - (hits 1/3) (matched: 'version 6 of the standard rules') constraint DS = {8} extremes [5, infinity) + (hits 1/3) (matched: 'version 7 of the standard rules') constraint DS = {8} extremes [5, infinity) version of - (hits 3/3) (matched: 'version 1 of basic inform') constraint DS = {8} extremes [4, infinity) + (hits 3/3) (matched: 'version 2 of basic inform') constraint DS = {8} extremes [4, infinity) (hits 0/5) constraint (none) extremes [2, infinity) @@ -5705,7 +5705,7 @@ the {...} (hits 1/1) (matched: 'the standard rules') constraint DS = {10} extremes [2, infinity) - hits 2957/19342 nti 11 constraint DS = {11} extremes [1, infinity) + hits 2957/19354 nti 11 constraint DS = {11} extremes [1, infinity) English: if {...} is begin (hits 0/4792) constraint DS = {11} extremes [4, infinity) @@ -5728,7 +5728,7 @@ -- {...} (hits 0/3128) constraint DS = {11} extremes [2, infinity) - hits 22/12340 nti 12 constraint CS = {12} extremes [2, 2] + hits 22/12348 nti 12 constraint CS = {12} extremes [2, 2] English: end if/unless (hits 20/22) (matched: 'end if') constraint CS = {12} extremes [2, 2] @@ -5737,7 +5737,7 @@ end repeat constraint CS = {12} extremes [2, 2] - hits 785/14924 nti 13 constraint DS = {13} extremes [2, infinity) + hits 785/14928 nti 13 constraint DS = {13} extremes [2, infinity) English: say {...} (hits 604/2929) (matched long text) constraint DS = {13} extremes [2, infinity) @@ -5749,7 +5749,7 @@ {......} , {......} (hits 2324/2543) (matched long text) constraint DS = {14} extremes [3, infinity) - hits 30/10134 nti 15 constraint DS = {15} extremes [2, infinity) + hits 30/10138 nti 15 constraint DS = {15} extremes [2, infinity) English: instead {...} (hits 0/1914) constraint DS = {15} extremes [2, infinity) @@ -6813,14 +6813,14 @@ {***} {***} (hits 0/953) constraint (none) extremes [1, infinity) - hits 0/1656 nti 6 constraint (none) extremes [1, infinity) + hits 0/1660 nti 6 constraint (none) extremes [1, infinity) English: - (hits 0/680) constraint (none) extremes [1, 1] + (hits 0/682) constraint (none) extremes [1, 1] {***} (/)/{/}/,/. {***} (hits 0/33) constraint DS = {6} extremes [1, infinity) {***} {***} - (hits 0/828) constraint (none) extremes [1, infinity) + (hits 0/830) constraint (none) extremes [1, infinity) hits 0/84 nti 7 constraint (none) extremes [1, infinity) English: @@ -6834,7 +6834,7 @@ {***} something {***} constraint DS = {8} extremes [1, infinity) - hits 436/1438 nti 9 constraint DS = {9} extremes [2, infinity) + hits 438/1442 nti 9 constraint DS = {9} extremes [2, infinity) English: (- {###} - in to only (hits 17/27) (matched: '(- rtrue; - in to only') constraint DS = {9} extremes [6, 6] @@ -6843,11 +6843,11 @@ (- {###} - in to decide only (hits 0/7) constraint DS = {9} extremes [7, 7] (- {###} - (hits 415/449) (matched: '(- {-say:val:K} ') constraint DS = {9} extremes [2, 2] + (hits 417/451) (matched: '(- {-say:val:K} ') constraint DS = {9} extremes [2, 2] (- {###} {...} (hits 0/66) constraint DS = {9} extremes [3, infinity) - hits 48/2786 nti 10 constraint CS = {10} extremes [1, 1] + hits 48/2790 nti 10 constraint CS = {10} extremes [1, 1] English: definition (hits 48/48) (matched: 'definition') constraint CS = {10} extremes [1, 1] @@ -6882,172 +6882,172 @@ {...} (hits 28/28) (matched: 'going on') constraint (none) extremes [1, infinity) - hits 504/2690 nti 15 constraint DS = {15} extremes [1, infinity) + hits 506/2694 nti 15 constraint DS = {15} extremes [1, infinity) English: {to} constraint CS = {15} extremes [1, 1] to {...} ( called {...} ) - (hits 0/810) constraint DS = {15} extremes [6, infinity) + (hits 0/812) constraint DS = {15} extremes [6, infinity) {to ...} ( this is the {### function} inverse to {###} ) - (hits 16/686) (matched long text) constraint DS = {15} extremes [12, infinity) + (hits 16/688) (matched long text) constraint DS = {15} extremes [12, infinity) {to ...} ( this is the {### function} ) - (hits 4/728) (matched long text) constraint DS = {15} extremes [9, infinity) + (hits 4/730) (matched long text) constraint DS = {15} extremes [9, infinity) {to ...} ( this is {...} ) - (hits 0/773) constraint DS = {15} extremes [7, infinity) + (hits 0/775) constraint DS = {15} extremes [7, infinity) {to ...} - (hits 484/853) (matched long text) constraint DS = {15} extremes [2, infinity) + (hits 486/855) (matched long text) constraint DS = {15} extremes [2, infinity) - hits 1/1008 nti 16 constraint DS = {16} extremes [3, infinity) + hits 1/1012 nti 16 constraint DS = {16} extremes [3, infinity) English: to now {...} - (hits 1/500) (matched: 'to now ( cn - condition )') constraint DS = {16} extremes [3, infinity) + (hits 1/502) (matched: 'to now ( cn - condition )') constraint DS = {16} extremes [3, infinity) - hits 0/1008 nti 17 constraint CS = {17} extremes [2, 2] + hits 0/1012 nti 17 constraint CS = {17} extremes [2, 2] English: to begin constraint CS = {17} extremes [2, 2] - hits 524/1048 nti 18 constraint DS = {18} extremes [2, infinity) + hits 526/1052 nti 18 constraint DS = {18} extremes [2, infinity) English: to {decide yes/no} (hits 2/2) (matched: 'to decide yes') constraint CS = {18} extremes [3, 3] to {decide on ...} - (hits 1/475) (matched: 'to decide on ( something - value )') constraint DS = {18} extremes [4, infinity) + (hits 1/477) (matched: 'to decide on ( something - value )') constraint DS = {18} extremes [4, infinity) to decide whether/if the {...} - (hits 12/461) (matched long text) constraint DS = {18} extremes [5, infinity) + (hits 12/463) (matched long text) constraint DS = {18} extremes [5, infinity) to decide whether/if {...} - (hits 39/462) (matched long text) constraint DS = {18} extremes [4, infinity) + (hits 39/464) (matched long text) constraint DS = {18} extremes [4, infinity) to decide what/which is the {...} - (hits 88/388) (matched long text) constraint DS = {18} extremes [7, infinity) + (hits 90/390) (matched long text) constraint DS = {18} extremes [7, infinity) to decide what/which is {...} (hits 74/310) (matched long text) constraint DS = {18} extremes [6, infinity) to {...} (hits 308/308) (matched long text) constraint DS = {18} extremes [2, infinity) - hits 162/324 nti 7 constraint (none) extremes [1, infinity) + hits 164/328 nti 7 constraint (none) extremes [1, infinity) English: - (hits 162/162) (matched: 'relation of objects') constraint (none) extremes [1, infinity) + (hits 164/164) (matched: 'relation of objects') constraint (none) extremes [1, infinity) {...} constraint (none) extremes [1, infinity) - hits 525/1050 nti 21 constraint (none) extremes [1, infinity) + hits 527/1054 nti 21 constraint (none) extremes [1, infinity) English: ( deprecated ) - (hits 1/442) (matched long text) constraint DS = {21} extremes [4, infinity) + (hits 1/444) (matched long text) constraint DS = {21} extremes [4, infinity) - (hits 139/485) (matched long text) constraint DS = {19} extremes [2, infinity) + (hits 139/487) (matched long text) constraint DS = {19} extremes [2, infinity) - (hits 385/385) (matched long text) constraint (none) extremes [1, infinity) + (hits 387/387) (matched long text) constraint (none) extremes [1, infinity) - hits 407/814 nti 20 constraint (none) extremes [1, infinity) + hits 409/818 nti 20 constraint (none) extremes [1, infinity) English: ( arithmetic operation ) - (hits 16/351) (matched long text) constraint DS = {20} extremes [6, infinity) + (hits 16/353) (matched long text) constraint DS = {20} extremes [6, infinity) ( assignment operation ) - (hits 6/340) (matched long text) constraint DS = {20} extremes [5, infinity) + (hits 6/342) (matched long text) constraint DS = {20} extremes [5, infinity) {let ... be given by ...} - (hits 2/329) (matched long text) constraint DS = {20} extremes [6, infinity) + (hits 2/331) (matched long text) constraint DS = {20} extremes [6, infinity) {let ...} - (hits 4/347) (matched long text) constraint DS = {20} extremes [2, infinity) + (hits 4/349) (matched long text) constraint DS = {20} extremes [2, infinity) {...} -- end - (hits 0/341) constraint DS = {20} extremes [3, infinity) + (hits 0/343) constraint DS = {20} extremes [3, infinity) {...} -- end conditional - (hits 3/335) (matched long text) constraint DS = {20} extremes [4, infinity) + (hits 3/337) (matched long text) constraint DS = {20} extremes [4, infinity) {...} -- end loop - (hits 10/332) (matched long text) constraint DS = {20} extremes [4, infinity) + (hits 10/334) (matched long text) constraint DS = {20} extremes [4, infinity) {...} -- in loop - (hits 2/322) (matched: 'break -- in loop') constraint DS = {20} extremes [4, infinity) + (hits 2/324) (matched: 'break -- in loop') constraint DS = {20} extremes [4, infinity) {...} -- in {###} - (hits 0/320) constraint DS = {20} extremes [4, infinity) + (hits 0/322) constraint DS = {20} extremes [4, infinity) {...} - (hits 364/364) (matched long text) constraint (none) extremes [1, infinity) + (hits 366/366) (matched long text) constraint (none) extremes [1, infinity) - hits 155/1002 nti 19 constraint DS = {19} extremes [2, infinity) + hits 155/1006 nti 19 constraint DS = {19} extremes [2, infinity) English: -- running on - (hits 16/447) (matched long text) constraint DS = {19} extremes [4, infinity) + (hits 16/449) (matched long text) constraint DS = {19} extremes [4, infinity) {say otherwise/else} (hits 2/5) (matched: 'say otherwise') constraint CS = {19} extremes [2, 2] {say otherwise/else if/unless ...} - (hits 0/431) constraint DS = {19} extremes [4, infinity) + (hits 0/433) constraint DS = {19} extremes [4, infinity) {say if/unless ...} - (hits 2/443) (matched: 'say if ( c - condition )') constraint DS = {19} extremes [3, infinity) + (hits 2/445) (matched: 'say if ( c - condition )') constraint DS = {19} extremes [3, infinity) {say end if/unless} (hits 2/2) (matched: 'say end if') constraint CS = {19} extremes [3, 3] {say ...} -- beginning {###} - (hits 2/411) (matched: 'say one of -- beginning say_one_of') constraint DS = {19} extremes [5, infinity) + (hits 2/413) (matched: 'say one of -- beginning say_one_of') constraint DS = {19} extremes [5, infinity) {say ...} -- continuing {###} - (hits 1/409) (matched: 'say or -- continuing say_one_of') constraint DS = {19} extremes [5, infinity) + (hits 1/411) (matched: 'say or -- continuing say_one_of') constraint DS = {19} extremes [5, infinity) {say ...} -- ending {###} with marker {###} - (hits 9/355) (matched long text) constraint DS = {19} extremes [8, infinity) + (hits 9/357) (matched long text) constraint DS = {19} extremes [8, infinity) {say ...} -- ending {###} - (hits 1/399) (matched: 'say only -- ending say_first_time') constraint DS = {19} extremes [5, infinity) + (hits 1/401) (matched: 'say only -- ending say_first_time') constraint DS = {19} extremes [5, infinity) {say ...} - (hits 120/466) (matched long text) constraint DS = {19} extremes [2, infinity) + (hits 120/468) (matched long text) constraint DS = {19} extremes [2, infinity) - hits 0/1048 nti 22 constraint DS = {13, 22} extremes [8, infinity) + hits 0/1052 nti 22 constraint DS = {13, 22} extremes [8, infinity) English: ( {......} ) {} ( {......} ) - (hits 0/343) constraint DS = {13, 22} extremes [8, infinity) + (hits 0/345) constraint DS = {13, 22} extremes [8, infinity) - hits 2279/4558 nti 24 constraint (none) extremes [1, infinity) + hits 2287/4574 nti 24 constraint (none) extremes [1, infinity) English: ( ) {***} - (hits 0/1777) constraint DS = {24} extremes [2, infinity) + (hits 0/1785) constraint DS = {24} extremes [2, infinity) ( ) {***} - (hits 587/1750) (matched long text) constraint DS = {24} extremes [3, infinity) + (hits 589/1758) (matched long text) constraint DS = {24} extremes [3, infinity) ( {***} - (hits 0/1201) constraint DS = {24} extremes [1, infinity) + (hits 0/1207) constraint DS = {24} extremes [1, infinity) ) {***} - (hits 0/1201) constraint DS = {24} extremes [1, infinity) + (hits 0/1207) constraint DS = {24} extremes [1, infinity) {###} {***} - (hits 1692/1692) (matched long text) constraint (none) extremes [1, infinity) + (hits 1698/1698) (matched long text) constraint (none) extremes [1, infinity) - hits 587/1184 nti 23 constraint (none) extremes [1, infinity) + hits 589/1188 nti 23 constraint (none) extremes [1, infinity) English: {***} ( {***} - {......} - (hits 0/570) constraint DS = {23} extremes [3, infinity) + (hits 0/572) constraint DS = {23} extremes [3, infinity) {......} - a nonexisting variable - (hits 0/177) constraint DS = {23} extremes [5, infinity) + (hits 0/178) constraint DS = {23} extremes [5, infinity) {......} - a nonexisting variable - (hits 0/85) constraint DS = {23} extremes [6, infinity) + (hits 0/86) constraint DS = {23} extremes [6, infinity) {......} - a nonexisting that/which varies - (hits 0/57) constraint DS = {23} extremes [7, infinity) + (hits 0/58) constraint DS = {23} extremes [7, infinity) {......} - nonexisting variable - (hits 4/344) (matched: 't - nonexisting variable') constraint DS = {23} extremes [4, infinity) + (hits 4/346) (matched: 't - nonexisting variable') constraint DS = {23} extremes [4, infinity) {......} - nonexisting variable - (hits 5/177) (matched: 'loopvar - nonexisting k variable') constraint DS = {23} extremes [5, infinity) + (hits 5/178) (matched: 'loopvar - nonexisting k variable') constraint DS = {23} extremes [5, infinity) {......} - nonexisting that/which varies - (hits 0/85) constraint DS = {23} extremes [6, infinity) + (hits 0/86) constraint DS = {23} extremes [6, infinity) {......} - {an existing variable} - (hits 0/172) constraint DS = {23} extremes [5, infinity) + (hits 0/173) constraint DS = {23} extremes [5, infinity) {......} - {an existing variable} - (hits 0/85) constraint DS = {23} extremes [6, infinity) + (hits 0/86) constraint DS = {23} extremes [6, infinity) {......} - {an existing that/which varies} - (hits 0/57) constraint DS = {23} extremes [7, infinity) + (hits 0/58) constraint DS = {23} extremes [7, infinity) {......} - {existing variable} - (hits 2/335) (matched: 't - existing variable') constraint DS = {23} extremes [4, infinity) + (hits 2/337) (matched: 't - existing variable') constraint DS = {23} extremes [4, infinity) {......} - {existing variable} - (hits 0/172) constraint DS = {23} extremes [5, infinity) + (hits 0/173) constraint DS = {23} extremes [5, infinity) {......} - {existing that/which varies} - (hits 0/85) constraint DS = {23} extremes [6, infinity) + (hits 0/86) constraint DS = {23} extremes [6, infinity) {......} - a condition - (hits 0/333) constraint DS = {23} extremes [4, infinity) + (hits 0/335) constraint DS = {23} extremes [4, infinity) {......} - condition - (hits 9/559) (matched: 'c - condition') constraint DS = {23} extremes [3, infinity) + (hits 9/561) (matched: 'c - condition') constraint DS = {23} extremes [3, infinity) {......} - a phrase - (hits 0/333) constraint DS = {23} extremes [4, infinity) + (hits 0/335) constraint DS = {23} extremes [4, infinity) {......} - phrase - (hits 0/550) constraint DS = {23} extremes [3, infinity) + (hits 0/552) constraint DS = {23} extremes [3, infinity) {......} - storage - (hits 4/550) (matched: 's - storage') constraint DS = {23} extremes [3, infinity) + (hits 4/552) (matched: 's - storage') constraint DS = {23} extremes [3, infinity) {......} - a table-reference - (hits 0/333) constraint DS = {23} extremes [4, infinity) + (hits 0/335) constraint DS = {23} extremes [4, infinity) {......} - table-reference - (hits 3/546) (matched: 'tr - table-reference') constraint DS = {23} extremes [3, infinity) + (hits 3/548) (matched: 'tr - table-reference') constraint DS = {23} extremes [3, infinity) {......} - - (hits 536/543) (matched long text) constraint DS = {23} extremes [3, infinity) + (hits 538/545) (matched long text) constraint DS = {23} extremes [3, infinity) {......} - (hits 2/7) (matched long text) constraint DS = {23} extremes [3, infinity) {......} - {......} @@ -7818,9 +7818,9 @@ internal hits 1979/5290 nti 22 constraint (none) extremes [1, infinity) - internal hits 1280/3076 nti 23 constraint (none) extremes [1, infinity) + internal hits 1282/3080 nti 23 constraint (none) extremes [1, infinity) - internal hits 536/1086 nti 24 constraint (none) extremes [1, infinity) + internal hits 538/1090 nti 24 constraint (none) extremes [1, infinity) hits 249/1760 nti 25 constraint (none) extremes [1, infinity) English: @@ -7871,21 +7871,21 @@ internal hits 818/22078 nti 10 constraint (none) extremes [1, infinity) - hits 705/22526 nti 11 constraint (none) extremes [1, infinity) + hits 705/22530 nti 11 constraint (none) extremes [1, infinity) English: - (hits 705/11263) (matched: 'unmarked for listing') constraint (none) extremes [1, infinity) + (hits 705/11265) (matched: 'unmarked for listing') constraint (none) extremes [1, infinity) - hits 1512/28318 nti 28 constraint (none) extremes [1, infinity) + hits 1512/28322 nti 28 constraint (none) extremes [1, infinity) English: not - (hits 0/3012) constraint DS = {28} extremes [3, infinity) + (hits 0/3013) constraint DS = {28} extremes [3, infinity) - (hits 0/7114) constraint (none) extremes [2, infinity) + (hits 0/7116) constraint (none) extremes [2, infinity) - (hits 1512/14159) (matched: 'marked for listing other') constraint (none) extremes [1, infinity) + (hits 1512/14161) (matched: 'marked for listing other') constraint (none) extremes [1, infinity) - hits 1583/30576 nti 27 constraint (none) extremes [1, infinity) + hits 1583/30580 nti 27 constraint (none) extremes [1, infinity) English: not (hits 12/4538) (matched: 'not lockable') constraint DS = {27} extremes [2, infinity) @@ -7894,9 +7894,9 @@ not (hits 0/2752) constraint DS = {27} extremes [3, infinity) - (hits 71/7443) (matched: 'marked for listing other') constraint (none) extremes [2, infinity) + (hits 71/7445) (matched: 'marked for listing other') constraint (none) extremes [2, infinity) - internal hits 2299/19596 nti r3 constraint CS = {r3} extremes [1, infinity) + internal hits 2299/19600 nti r3 constraint CS = {r3} extremes [1, infinity) hits 3751/93856 nti 12 constraint (none) extremes [1, infinity) English: @@ -8041,14 +8041,14 @@ (hits 1838/2321) (matched long text) constraint (none) extremes [1, infinity) - hits 3150/7870 nti 12 constraint (none) extremes [1, infinity) + hits 3152/7874 nti 12 constraint (none) extremes [1, infinity) English: variable/variables - (hits 2/618) (matched: 'text variables') constraint DS = {12} extremes [2, infinity) + (hits 2/620) (matched: 'text variables') constraint DS = {12} extremes [2, infinity) that/which vary/varies - (hits 60/423) (matched: 'action based rule producing nothing that varies') constraint DS = {12} extremes [3, infinity) + (hits 60/424) (matched: 'action based rule producing nothing that varies') constraint DS = {12} extremes [3, infinity) - (hits 2459/3873) (matched long text) constraint (none) extremes [1, infinity) + (hits 2461/3875) (matched long text) constraint (none) extremes [1, infinity) (hits 221/1414) (matched: 'Represents geographical locations, both indoor and outdoor, which are not necessarily areas in a building. A player in one @@ -8065,19 +8065,19 @@ (hits 0/26) constraint CW = {r2, r4} extremes [1, infinity) - hits 1260/3036 nti 30 constraint (none) extremes [1, infinity) + hits 1262/3040 nti 30 constraint (none) extremes [1, infinity) English:
    - (hits 167/798) (matched: 'an ice cream cone') constraint (none) extremes [2, infinity) + (hits 167/800) (matched: 'an ice cream cone') constraint (none) extremes [2, infinity) - (hits 1093/1351) (matched long text) constraint (none) extremes [1, infinity) + (hits 1095/1353) (matched long text) constraint (none) extremes [1, infinity) - hits 1260/3036 nti 6 constraint (none) extremes [1, infinity) + hits 1262/3040 nti 6 constraint (none) extremes [1, infinity) English: - (hits 74/1518) (matched: 'unmarked for listing') constraint (none) extremes [1, infinity) + (hits 74/1520) (matched: 'unmarked for listing') constraint (none) extremes [1, infinity) - (hits 1186/1444) (matched long text) constraint (none) extremes [1, infinity) + (hits 1188/1446) (matched long text) constraint (none) extremes [1, infinity) hits 62/126 nti 11 constraint (none) extremes [1, infinity) English: diff --git a/inform7/Figures/memory-diagnostics.txt b/inform7/Figures/memory-diagnostics.txt index 499053483..d71c9f999 100644 --- a/inform7/Figures/memory-diagnostics.txt +++ b/inform7/Figures/memory-diagnostics.txt @@ -1,50 +1,50 @@ -Total memory consumption was 135423K = 132 MB +Total memory consumption was 135610K = 132 MB - ---- was used for 2099578 objects, in 372265 frames in 0 x 800K = 0K = 0 MB: + ---- was used for 2111059 objects, in 373571 frames in 0 x 800K = 0K = 0 MB: - 30.6% inter_tree_node_array 59 x 8192 = 483328 objects, 42534752 bytes - 19.4% text_stream_array 4789 x 100 = 478900 objects, 26971648 bytes - 18.0% linked_list 44801 objects, 25088560 bytes + 31.1% inter_tree_node_array 60 x 8192 = 491520 objects, 43255680 bytes + 19.4% text_stream_array 4802 x 100 = 480200 objects, 27044864 bytes + 18.2% linked_list 45247 objects, 25338320 bytes 10.2% inter_symbol_array 134 x 1024 = 137216 objects, 14274752 bytes 10.0% inter_error_stash_array 106 x 1024 = 108544 objects, 13897024 bytes - 7.6% parse_node 133423 objects, 10673840 bytes + 7.6% parse_node 133440 objects, 10675200 bytes 5.4% verb_conjugation 164 objects, 7610912 bytes - 4.1% parse_node_annotation_array 356 x 500 = 178000 objects, 5707392 bytes - 2.7% scan_directory 915 objects, 3777120 bytes + 4.1% parse_node_annotation_array 357 x 500 = 178500 objects, 5723424 bytes + 3.4% scan_directory 1148 objects, 4738944 bytes 2.5% pcalc_prop_array 26 x 1000 = 26000 objects, 3536832 bytes 2.3% inter_name_array 67 x 1000 = 67000 objects, 3218144 bytes 1.9% kind_array 68 x 1000 = 68000 objects, 2722176 bytes 1.5% inter_schema_token 14157 objects, 2151864 bytes 1.4% inter_name_generator_array 51 x 1000 = 51000 objects, 2041632 bytes - 1.3% package_request 21235 objects, 1868680 bytes + 1.3% package_request 21270 objects, 1871760 bytes 1.3% vocabulary_entry_array 164 x 100 = 16400 objects, 1842048 bytes - 1.1% dict_entry_array 482 x 100 = 48200 objects, 1557824 bytes - 1.0% inter_symbols_table 26763 objects, 1498728 bytes + 1.1% dict_entry_array 483 x 100 = 48300 objects, 1561056 bytes + 1.0% inter_symbols_table 26838 objects, 1502928 bytes 1.0% match_trie_array 11 x 1000 = 11000 objects, 1496352 bytes 1.0% i6_schema_array 24 x 100 = 2400 objects, 1440768 bytes - 0.9% inter_package 26763 objects, 1284624 bytes + 0.9% inter_package 26838 objects, 1288224 bytes 0.8% map_data 672 objects, 1128960 bytes - 0.7% id_body 955 objects, 1092520 bytes + 0.7% id_body 957 objects, 1094808 bytes 0.7% adjective_meaning 208 objects, 1030016 bytes 0.7% inter_schema_node 9050 objects, 1013600 bytes - 0.7% excerpt_meaning 3127 objects, 975624 bytes + 0.7% excerpt_meaning 3129 objects, 976248 bytes 0.6% production 3973 objects, 921736 bytes 0.6% ptoken 8643 objects, 898872 bytes 0.6% grammatical_usage 3641 objects, 873840 bytes 0.6% individual_form 2574 objects, 864864 bytes 0.4% unary_predicate_array 17 x 1000 = 17000 objects, 680544 bytes - 0.3% local_variable_array 48 x 100 = 4800 objects, 462336 bytes + 0.3% local_variable_array 49 x 100 = 4900 objects, 471968 bytes 0.2% verb_usage 1148 objects, 394912 bytes + 0.2% dictionary 7726 objects, 370848 bytes 0.2% rule 472 objects, 370048 bytes - 0.2% dictionary 7702 objects, 369696 bytes 0.2% verb_form 388 objects, 350752 bytes 0.2% noun 2389 objects, 286680 bytes - 0.1% compilation_subtask 3369 objects, 269520 bytes + 0.1% compilation_subtask 3380 objects, 270400 bytes 0.1% inter_annotation_array 2 x 8192 = 16384 objects, 262208 bytes 0.1% inference_subject 667 objects, 261464 bytes - 0.1% vanilla_function 3755 objects, 240320 bytes + 0.1% vanilla_function 3794 objects, 242816 bytes 0.1% binary_predicate 326 objects, 172128 bytes - 0.1% hierarchy_location 1180 objects, 169920 bytes + 0.1% hierarchy_location 1181 objects, 170064 bytes 0.1% linguistic_stock_item 3332 objects, 159936 bytes 0.1% rule_family_data 403 objects, 148304 bytes 0.1% nonterminal 774 objects, 142416 bytes @@ -53,10 +53,10 @@ Total memory consumption was 135423K = 132 MB ---- pcalc_term_array 3 x 1000 = 3000 objects, 120096 bytes ---- documentation_ref 1270 objects, 111760 bytes ---- inter_schema 1539 objects, 110808 bytes - ---- imperative_defn 1393 objects, 100296 bytes + ---- imperative_defn 1395 objects, 100440 bytes ---- noun_usage 2412 objects, 96480 bytes ---- anl_entry_array 2 x 1000 = 2000 objects, 96064 bytes - ---- inter_tree 7 objects, 95760 bytes + ---- inter_tree 7 objects, 95704 bytes ---- preposition 274 objects, 87680 bytes ---- lexical_cluster 2529 objects, 80928 bytes ---- kind_variable_declaration 1656 objects, 79488 bytes @@ -64,11 +64,11 @@ Total memory consumption was 135423K = 132 MB ---- label_namespace 1480 objects, 71040 bytes ---- spatial_data 672 objects, 64512 bytes ---- linked_list_item_array 4 x 1000 = 4000 objects, 64128 bytes + ---- kind_constructor 78 objects, 63648 bytes ---- kind_macro_definition 9 objects, 62280 bytes ---- booking 863 objects, 62136 bytes - ---- scenes_rcd_data 1910 objects, 61120 bytes - ---- actions_rcd_data 1910 objects, 61120 bytes - ---- kind_constructor 78 objects, 59280 bytes + ---- actions_rcd_data 1914 objects, 61248 bytes + ---- scenes_rcd_data 1914 objects, 61248 bytes ---- command_grammar 130 objects, 58240 bytes ---- table 7 objects, 56672 bytes ---- pcalc_func_array 1 x 1000 objects, 56032 bytes @@ -80,7 +80,7 @@ Total memory consumption was 135423K = 132 MB ---- HTML_tag_array 1 x 1000 objects, 48032 bytes ---- heading 207 objects, 46368 bytes ---- text_substitution 438 objects, 42048 bytes - ---- to_family_data 504 objects, 40320 bytes + ---- to_family_data 506 objects, 40480 bytes ---- anl_clause_array 1 x 1000 objects, 40032 bytes ---- activity_list_array 1 x 1000 objects, 40032 bytes ---- shared_variable_access_list_array 12 x 100 = 1200 objects, 38784 bytes @@ -89,59 +89,59 @@ Total memory consumption was 135423K = 132 MB ---- regions_data 672 objects, 32256 bytes ---- counting_data 672 objects, 32256 bytes ---- property_permission 96 objects, 31488 bytes + ---- filename 767 objects, 30680 bytes + ---- parse_node_tree 34 objects, 29648 bytes ---- stack_frame_box 307 objects, 29472 bytes ---- verb_sense 407 objects, 29304 bytes - ---- parse_node_tree 33 objects, 28776 bytes ---- action_pattern_array 7 x 100 = 700 objects, 28224 bytes - ---- filename 621 objects, 24840 bytes + ---- pathname 659 objects, 26360 bytes ---- shared_variable_set_array 6 x 100 = 600 objects, 24192 bytes ---- property 146 objects, 22192 bytes ---- backdrops_data 672 objects, 21504 bytes - ---- pathname 522 objects, 20880 bytes ---- inter_node_list 646 objects, 20672 bytes ---- nonlocal_variable 94 objects, 20304 bytes ---- pipeline_step 15 objects, 20280 bytes ---- action_name 90 objects, 20160 bytes - ---- build_vertex 163 objects, 19560 bytes + ---- build_vertex 164 objects, 19680 bytes ---- timed_rules_rfd_data 403 objects, 19344 bytes ---- method 398 objects, 19104 bytes + ---- instance 162 objects, 18144 bytes ---- pcalc_prop_deferral 86 objects, 17888 bytes ---- to_phrase_request 63 objects, 17136 bytes - ---- instance 162 objects, 16848 bytes ---- understanding_reference_array 2 x 100 = 200 objects, 16064 bytes ---- action_name_list_array 1 x 1000 objects, 16032 bytes ---- match_avinue_array 1 x 1000 objects, 16032 bytes ---- adjective 140 objects, 15680 bytes - ---- JSON_value 163 objects, 14344 bytes + ---- JSON_value 174 objects, 15312 bytes ---- booking_list 407 objects, 13024 bytes ---- web_bibliographic_datum 203 objects, 12992 bytes ---- adjective_iname_holder 323 objects, 12920 bytes - ---- uniqueness_count 474 objects, 11376 bytes + ---- uniqueness_count 481 objects, 11544 bytes ---- inter_construct 32 objects, 11008 bytes - ---- heading_tree 33 objects, 10296 bytes - ---- stopwatch_timer 121 objects, 9680 bytes - ---- inbuild_work 135 objects, 8640 bytes - ---- inbuild_copy 65 objects, 7800 bytes + ---- heading_tree 34 objects, 10608 bytes + ---- stopwatch_timer 123 objects, 9840 bytes + ---- inbuild_work 138 objects, 8832 bytes + ---- inbuild_copy 66 objects, 7920 bytes ---- equation_node 68 objects, 7616 bytes ---- understanding_item_array 3 x 100 = 300 objects, 7296 bytes ---- shared_variable_array 1 x 100 objects, 7232 bytes ---- determiner 22 objects, 7216 bytes - ---- inbuild_edition 97 objects, 6984 bytes + ---- inbuild_edition 99 objects, 7128 bytes ---- verb 109 objects, 6976 bytes - ---- hierarchy_attachment_point 78 objects, 6864 bytes - ---- inform_extension 32 objects, 6656 bytes + ---- inform_extension 33 objects, 6864 bytes + ---- hierarchy_attachment_point 77 objects, 6776 bytes ---- text_literal_holder 163 objects, 6520 bytes ---- section_md 62 objects, 5952 bytes ---- parsed_use_option_setting 80 objects, 5760 bytes - ---- compatibility_specification 113 objects, 5424 bytes - ---- build_script 163 objects, 5216 bytes + ---- compatibility_specification 115 objects, 5520 bytes + ---- build_script 164 objects, 5248 bytes ---- activity 35 objects, 5040 bytes ---- explicit_action_array 1 x 100 objects, 4832 bytes ---- value_property_data 84 objects, 4704 bytes ---- parsing_pp_data 96 objects, 4608 bytes ---- command_line_switch 55 objects, 4400 bytes + ---- semver_range 42 objects, 4368 bytes ---- use_option 32 objects, 4352 bytes - ---- semver_range 41 objects, 4264 bytes ---- either_or_property_data 62 objects, 3968 bytes ---- parse_node_annotation_type 119 objects, 3808 bytes ---- method_set 108 objects, 3456 bytes @@ -152,21 +152,21 @@ Total memory consumption was 135423K = 132 MB ---- target_vm 20 objects, 2880 bytes ---- JSON_type 39 objects, 2808 bytes ---- JSON_single_requirement 55 objects, 2640 bytes - ---- part_of_inference_data 79 objects, 2528 bytes ---- parentage_inference_data 79 objects, 2528 bytes + ---- part_of_inference_data 79 objects, 2528 bytes + ---- kind_constructor_instance_rule_array 1 x 100 objects, 2432 bytes ---- kind_constructor_casting_rule_array 1 x 100 objects, 2432 bytes - ---- kind_constructor_instance_array 1 x 100 objects, 2432 bytes ---- equation_symbol 30 objects, 2400 bytes ---- scene 1 object, 2352 bytes ---- build_step 28 objects, 2016 bytes - ---- pronoun_usage 42 objects, 1680 bytes ---- compiler_feature 30 objects, 1680 bytes + ---- pronoun_usage 42 objects, 1680 bytes ---- table_contribution_array 1 x 100 objects, 1632 bytes ---- inform_pipeline 24 objects, 1536 bytes - ---- inbuild_requirement 36 objects, 1440 bytes + ---- inbuild_requirement 37 objects, 1480 bytes ---- noun_filter_token 22 objects, 1408 bytes - ---- special_meaning_holder 35 objects, 1400 bytes ---- inter_node_array 35 objects, 1400 bytes + ---- special_meaning_holder 35 objects, 1400 bytes ---- JSON_requirement 42 objects, 1344 bytes ---- table_column 16 objects, 1280 bytes ---- constant_phrase 20 objects, 1280 bytes @@ -178,32 +178,32 @@ Total memory consumption was 135423K = 132 MB ---- runtime_kind_structure 13 objects, 1040 bytes ---- quantifier 16 objects, 1024 bytes ---- web_md 7 objects, 1008 bytes - ---- pipeline_stage 20 objects, 960 bytes ---- named_rulebook_outcome 15 objects, 960 bytes + ---- pipeline_stage 20 objects, 960 bytes ---- JSON_pair_requirement 29 objects, 928 bytes ---- control_structure_phrase 12 objects, 864 bytes - ---- cached_understanding 21 objects, 840 bytes ---- kit_configuration 21 objects, 840 bytes + ---- cached_understanding 21 objects, 840 bytes ---- phrase_option_array 1 x 100 objects, 824 bytes - ---- inform_kit 7 objects, 784 bytes ---- copy_error 7 objects, 784 bytes + ---- inform_kit 7 objects, 784 bytes ---- internal_test 15 objects, 720 bytes ---- relation_guard 5 objects, 640 bytes ---- implication 13 objects, 624 bytes ---- chapter_md 7 objects, 616 bytes ---- code_generation 1 object, 576 bytes ---- inter_annotation_form 14 objects, 560 bytes - ---- generated_segment 14 objects, 560 bytes ---- module 7 objects, 560 bytes ---- inter_warehouse_room 10 objects, 560 bytes + ---- generated_segment 14 objects, 560 bytes ---- rulebook_outcome 17 objects, 544 bytes ---- small_word_set 11 objects, 528 bytes ---- i6_memory_setting 15 objects, 480 bytes ---- equation 4 objects, 480 bytes ---- bp_family 14 objects, 448 bytes ---- inference_family 11 objects, 440 bytes - ---- inbuild_genre 8 objects, 384 bytes ---- article_usage 8 objects, 384 bytes + ---- inbuild_genre 8 objects, 384 bytes ---- source_file 5 objects, 360 bytes ---- tree_inventory 1 object, 320 bytes ---- grammatical_category 8 objects, 320 bytes @@ -214,8 +214,8 @@ Total memory consumption was 135423K = 132 MB ---- inter_pipeline 1 object, 312 bytes ---- up_family 9 objects, 288 bytes ---- explicit_bp_data 5 objects, 280 bytes - ---- compilation_unit 5 objects, 280 bytes ---- contents_entry 7 objects, 280 bytes + ---- compilation_unit 5 objects, 280 bytes ---- door_to_notice 5 objects, 280 bytes ---- verb_usage_tier 5 objects, 240 bytes ---- kit_dependency 5 objects, 240 bytes @@ -225,42 +225,42 @@ Total memory consumption was 135423K = 132 MB ---- test_scenario 1 object, 216 bytes ---- release_instructions 1 object, 208 bytes ---- build_skill 5 objects, 200 bytes - ---- code_generator 5 objects, 200 bytes ---- attachment_instruction 5 objects, 200 bytes - ---- plural_dictionary_entry 4 objects, 192 bytes + ---- code_generator 5 objects, 200 bytes ---- element_activation 6 objects, 192 bytes + ---- plural_dictionary_entry 4 objects, 192 bytes ---- inference_subject_family 5 objects, 160 bytes ---- imperative_defn_family 4 objects, 160 bytes ---- inter_architecture 4 objects, 160 bytes ---- inbuild_nest 3 objects, 120 bytes ---- inform_language 1 object, 104 bytes ---- group_together_function 2 objects, 80 bytes - ---- article 2 objects, 80 bytes ---- compile_task_data 1 object, 80 bytes + ---- article 2 objects, 80 bytes + ---- build_methodology 1 object, 56 bytes ---- inter_warehouse 1 object, 56 bytes ---- figures_data 1 object, 56 bytes - ---- build_methodology 1 object, 56 bytes - ---- star_invention 1 object, 48 bytes ---- inform_kit_ittt 1 object, 48 bytes ---- HTML_file_state 1 object, 48 bytes - ---- kind_template_definition 1 object, 40 bytes - ---- target_pragma_setting 1 object, 40 bytes - ---- by_function_bp_data 1 object, 40 bytes + ---- star_invention 1 object, 48 bytes ---- loop_over_scope 1 object, 40 bytes ---- I6_generation_data 1 object, 40 bytes + ---- target_pragma_setting 1 object, 40 bytes + ---- kind_template_definition 1 object, 40 bytes + ---- by_function_bp_data 1 object, 40 bytes 100.0% was used for memory not allocated for objects: - 61.3% text stream storage 85093092 bytes in 498645 claims - 3.8% dictionary storage 5357056 bytes in 7702 claims - ---- sorting 2792 bytes in 403 claims + 61.4% text stream storage 85280548 bytes in 499960 claims + 3.8% dictionary storage 5364736 bytes in 7726 claims + ---- sorting 3320 bytes in 547 claims 5.1% source text 7200000 bytes in 3 claims 7.7% source text details 10800000 bytes in 2 claims 0.1% documentation fragments 262144 bytes in 1 claim ---- linguistic stock array 81920 bytes in 2 claims ---- small word set array 105600 bytes in 22 claims - 3.2% inter symbols storage 4565968 bytes in 28141 claims - 12.0% inter bytecode storage 16763624 bytes in 15 claims + 3.2% inter symbols storage 4566640 bytes in 28213 claims + 12.0% inter bytecode storage 16757840 bytes in 15 claims 4.4% inter links storage 6222976 bytes in 11 claims 0.1% inter tree location list storage 191232 bytes in 32 claims 1.2% instance-of-kind counting 1705636 bytes in 1 claim @@ -269,5 +269,5 @@ Total memory consumption was 135423K = 132 MB ---- code generation workspace for objects 3480 bytes in 19 claims 0.2% emitter array storage 280672 bytes in 2002 claims --138.-6% was overhead - -192270800 bytes = -187764K = -183 MB +-139.-9% was overhead - -194346184 bytes = -189791K = -185 MB diff --git a/inform7/Figures/syntax-summary.txt b/inform7/Figures/syntax-summary.txt index 9672fcf3d..62428f3ad 100644 --- a/inform7/Figures/syntax-summary.txt +++ b/inform7/Figures/syntax-summary.txt @@ -1,17 +1,17 @@ ROOT_NT HEADING_NT'implied inclusions' {under: H0'implied inclusions'} {heading 0} {implied} INCLUSION_NT'include basic inform by graham nelson' - HEADING_NT'version 1 of basic inform by graham nelson begins here' {heading 0} {under: H0'version 1 of basic inform by graham nelson begins here'} {includes: Basic Inform by Graham Nelson v1 } {unit: 0} - BEGINHERE_NT'version 1 of basic inform by graham nelson' {unit: 0} + HEADING_NT'version 2 of basic inform by graham nelson begins here' {heading 0} {under: H0'version 2 of basic inform by graham nelson begins here'} {includes: Basic Inform by Graham Nelson v2 } {unit: 0} + BEGINHERE_NT'version 2 of basic inform by graham nelson' {unit: 0} ... INCLUSION_NT'include english language by graham nelson' - HEADING_NT'version 1 of english language by graham nelson begins here' {heading 0} {under: H0'version 1 of english language by graham nelson begins here'} {includes: English Language by Graham Nelson v1 } {unit: 1} - BEGINHERE_NT'version 1 of english language by graham nelson' {unit: 1} + HEADING_NT'version 2 of english language by graham nelson begins here' {heading 0} {under: H0'version 2 of english language by graham nelson begins here'} {includes: English Language by Graham Nelson v2 } {unit: 1} + BEGINHERE_NT'version 2 of english language by graham nelson' {unit: 1} ... INCLUSION_NT'include english language by graham nelson' INCLUSION_NT'include standard rules by graham nelson' - HEADING_NT'version 6 of the standard rules by graham nelson begins here' {heading 0} {under: H0'version 6 of the standard rules by graham nelson begins here'} {includes: Standard Rules by Graham Nelson v6 } {unit: 2} - BEGINHERE_NT'version 6 of the standard rules by graham nelson' {unit: 2} + HEADING_NT'version 7 of the standard rules by graham nelson begins here' {heading 0} {under: H0'version 7 of the standard rules by graham nelson begins here'} {includes: Standard Rules by Graham Nelson v7 } {unit: 2} + BEGINHERE_NT'version 7 of the standard rules by graham nelson' {unit: 2} ... INCLUSION_NT'include standard rules by graham nelson' HEADING_NT'use the serial comma and no scoring' {heading 0} {under: H0'use the serial comma and no scoring'} {unit: 3} @@ -28,8 +28,8 @@ ROOT_NT VERB_NT'is' {verb 'be' 3p s act IS_TENSE +ve} {special meaning: new-action} UNPARSED_NOUN_NT'asking for information' UNPARSED_NOUN_NT'out of world' - IMPERATIVE_NT'carry out asking for information' {unit: 3} {imperative definition: 813} - IMPERATIVE_NT'when play begins' {unit: 3} {imperative definition: 814} + IMPERATIVE_NT'carry out asking for information' {unit: 3} {imperative definition: 815} + IMPERATIVE_NT'when play begins' {unit: 3} {imperative definition: 816} HEADING_NT'section 1 - errands' {heading 5} {under: H5'section 1 - errands'} {unit: 3} SENTENCE_NT'the current actor is a person which varies' {unit: 3} {classified} VERB_NT'is' {verb 'be' 3p s act IS_TENSE +ve} @@ -39,8 +39,8 @@ ROOT_NT VERB_NT'is' {verb 'be' 3p s act IS_TENSE +ve} PROPER_NOUN_NT'current owner' {definite 'the' n/m/f s/p nom/acc} {refined} {eval: NONLOCAL_VARIABLE_NT'current owner' {nonlocal: 'current owner'(var)person}} {created here} COMMON_NOUN_NT'person which varies' {indefinite 'a' n/m/f nom/acc s} {refined} {refers: infs'values variable-pointer'-k} {creation: << kind=people variable-pointer(x) >>} {eval: TEST_VALUE_NT} - IMPERATIVE_NT'every turn' {unit: 3} {imperative definition: 815} - IMPERATIVE_NT'every turn' {unit: 3} {imperative definition: 816} + IMPERATIVE_NT'every turn' {unit: 3} {imperative definition: 817} + IMPERATIVE_NT'every turn' {unit: 3} {imperative definition: 818} SENTENCE_NT'a person can be active or passive' {unit: 3} {classified} VERB_NT'can be' {verb 'be able to be' s/p 3p act IS_TENSE +ve} {special meaning: can-be} COMMON_NOUN_NT'a person' {refined} {refers: infs'person'} {creation: << kind=person(x) >>} {eval: TEST_VALUE_NT} @@ -56,34 +56,34 @@ ROOT_NT VERB_NT'are' {verb 'be' 3p p act IS_TENSE +ve} PROPER_NOUN_NT'character movement rules' {definite 'the' n/m/f s/p nom/acc} {refined} {eval: CONSTANT_NT {kind: rulebook} {rulebook: character movement}} {created here} COMMON_NOUN_NT'rulebook' {indefinite 'a' n/m/f nom/acc s} {refined} {refers: infs'values based rulebook producing values'-k} {creation: << kind=rulebook(x) >>} {eval: TEST_VALUE_NT} - IMPERATIVE_NT'the first character movement rule' {unit: 3} {imperative definition: 817} - IMPERATIVE_NT'a character movement rule' {unit: 3} {imperative definition: 818} - IMPERATIVE_NT'a character movement rule' {unit: 3} {imperative definition: 819} - IMPERATIVE_NT'to decide whether movement has not yet occurred' {unit: 3} {imperative definition: 820} - IMPERATIVE_NT'definition' {unit: 3} {imperative definition: 821} - IMPERATIVE_NT'definition' {unit: 3} {imperative definition: 822} + IMPERATIVE_NT'the first character movement rule' {unit: 3} {imperative definition: 819} + IMPERATIVE_NT'a character movement rule' {unit: 3} {imperative definition: 820} + IMPERATIVE_NT'a character movement rule' {unit: 3} {imperative definition: 821} + IMPERATIVE_NT'to decide whether movement has not yet occurred' {unit: 3} {imperative definition: 822} + IMPERATIVE_NT'definition' {unit: 3} {imperative definition: 823} + IMPERATIVE_NT'definition' {unit: 3} {imperative definition: 824} SENTENCE_NT'the shopowner rules is a rulebook' {unit: 3} {classified} {clears pronouns} VERB_NT'is' {verb 'be' 3p s act IS_TENSE +ve} PROPER_NOUN_NT'shopowner rules' {definite 'the' n/m/f s/p nom/acc} {refined} {eval: CONSTANT_NT {kind: rulebook} {rulebook: shopowner}} {created here} COMMON_NOUN_NT'rulebook' {indefinite 'a' n/m/f nom/acc s} {refined} {refers: infs'values based rulebook producing values'-k} {creation: << kind=rulebook(x) >>} {eval: TEST_VALUE_NT} - IMPERATIVE_NT'a shopowner rule' {unit: 3} {imperative definition: 823} - IMPERATIVE_NT'report someone closing a door when the person asked owns the' {unit: 3} {imperative definition: 824} - IMPERATIVE_NT'report vanessa closing the metal door when the metal door is' {unit: 3} {imperative definition: 825} - IMPERATIVE_NT'a shopowner rule' {unit: 3} {imperative definition: 826} + IMPERATIVE_NT'a shopowner rule' {unit: 3} {imperative definition: 825} + IMPERATIVE_NT'report someone closing a door when the person asked owns the' {unit: 3} {imperative definition: 826} + IMPERATIVE_NT'report vanessa closing the metal door when the metal door is' {unit: 3} {imperative definition: 827} + IMPERATIVE_NT'a shopowner rule' {unit: 3} {imperative definition: 828} SENTENCE_NT'filing is an action applying to one thing' {unit: 3} {classified} VERB_NT'is' {verb 'be' 3p s act IS_TENSE +ve} {special meaning: new-action} UNPARSED_NOUN_NT'filing' UNPARSED_NOUN_NT'applying to one thing' - IMPERATIVE_NT'before someone filing something which is not carried by the ' {unit: 3} {imperative definition: 827} - IMPERATIVE_NT'carry out someone filing' {unit: 3} {imperative definition: 828} - IMPERATIVE_NT'report someone filing' {unit: 3} {imperative definition: 829} + IMPERATIVE_NT'before someone filing something which is not carried by the ' {unit: 3} {imperative definition: 829} + IMPERATIVE_NT'carry out someone filing' {unit: 3} {imperative definition: 830} + IMPERATIVE_NT'report someone filing' {unit: 3} {imperative definition: 831} SENTENCE_NT'the shopper rules is a rulebook' {unit: 3} {classified} {clears pronouns} VERB_NT'is' {verb 'be' 3p s act IS_TENSE +ve} PROPER_NOUN_NT'shopper rules' {definite 'the' n/m/f s/p nom/acc} {refined} {eval: CONSTANT_NT {kind: rulebook} {rulebook: shopper}} {created here} COMMON_NOUN_NT'rulebook' {indefinite 'a' n/m/f nom/acc s} {refined} {refers: infs'values based rulebook producing values'-k} {creation: << kind=rulebook(x) >>} {eval: TEST_VALUE_NT} - IMPERATIVE_NT'a shopper rule' {unit: 3} {imperative definition: 830} - IMPERATIVE_NT'a shopper rule' {unit: 3} {imperative definition: 831} - IMPERATIVE_NT'definition' {unit: 3} {imperative definition: 832} + IMPERATIVE_NT'a shopper rule' {unit: 3} {imperative definition: 832} + IMPERATIVE_NT'a shopper rule' {unit: 3} {imperative definition: 833} + IMPERATIVE_NT'definition' {unit: 3} {imperative definition: 834} DEFN_CONT_NT'a room is air-conditioned' {unit: 3} CODE_BLOCK_NT CODE_BLOCK_NT {control structure: IF} @@ -141,8 +141,8 @@ ROOT_NT COMMON_NOUN_NT'artwork' {indefinite 'an' n/m/f nom/acc s} {refined} {creation: << kind=artwork(x) >>} {refers: infs'artwork'} {eval: TEST_VALUE_NT} {created here} KIND_NT'kind of thing' {refined} {refers: infs'thing'} COMMON_NOUN_NT'thing' {refined} {refers: infs'thing'} {creation: << kind=thing(x) >>} {eval: TEST_VALUE_NT} - IMPERATIVE_NT'before printing the name of an artwork' {unit: 3} {imperative definition: 833} - IMPERATIVE_NT'after printing the name of an artwork' {unit: 3} {imperative definition: 834} + IMPERATIVE_NT'before printing the name of an artwork' {unit: 3} {imperative definition: 835} + IMPERATIVE_NT'after printing the name of an artwork' {unit: 3} {imperative definition: 836} SENTENCE_NT'an artwork can be submitted or reserved' {unit: 3} {classified} VERB_NT'can be' {verb 'be able to be' s/p 3p act IS_TENSE +ve} {special meaning: can-be} COMMON_NOUN_NT'an artwork' {refined} {refers: infs'artwork'} {creation: << kind=artwork(x) >>} {eval: TEST_VALUE_NT} @@ -155,49 +155,49 @@ ROOT_NT COMMON_NOUN_NT'book' {indefinite 'a' n/m/f nom/acc s} {refined} {creation: << kind=book(x) >>} {refers: infs'book'} {eval: TEST_VALUE_NT} {created here} KIND_NT'kind of artwork' {refined} {refers: infs'artwork'} COMMON_NOUN_NT'artwork' {refined} {refers: infs'artwork'} {creation: << kind=artwork(x) >>} {eval: TEST_VALUE_NT} - IMPERATIVE_NT'before someone resolving a book when the person asked is not' {unit: 3} {imperative definition: 835} - IMPERATIVE_NT'carry out someone resolving a book' {unit: 3} {imperative definition: 836} - IMPERATIVE_NT'report someone resolving a book' {unit: 3} {imperative definition: 837} - IMPERATIVE_NT'before listing contents' {unit: 3} {imperative definition: 838} - IMPERATIVE_NT'before grouping together books' {unit: 3} {imperative definition: 839} + IMPERATIVE_NT'before someone resolving a book when the person asked is not' {unit: 3} {imperative definition: 837} + IMPERATIVE_NT'carry out someone resolving a book' {unit: 3} {imperative definition: 838} + IMPERATIVE_NT'report someone resolving a book' {unit: 3} {imperative definition: 839} + IMPERATIVE_NT'before listing contents' {unit: 3} {imperative definition: 840} + IMPERATIVE_NT'before grouping together books' {unit: 3} {imperative definition: 841} SENTENCE_NT'a stamped envelope is a kind of thing' {unit: 3} {classified} {interpretation of subject: infs'book'} VERB_NT'is' {verb 'be' 3p s act IS_TENSE +ve} COMMON_NOUN_NT'stamped envelope' {indefinite 'a' n/m/f nom/acc s} {refined} {creation: << kind=stamped envelope(x) >>} {refers: infs'stamped envelope'} {eval: TEST_VALUE_NT} {created here} KIND_NT'kind of thing' {refined} {refers: infs'thing'} COMMON_NOUN_NT'thing' {refined} {refers: infs'thing'} {creation: << kind=thing(x) >>} {eval: TEST_VALUE_NT} - IMPERATIVE_NT'before someone resolving a stamped envelope when the person ' {unit: 3} {imperative definition: 840} - IMPERATIVE_NT'carry out someone resolving a stamped envelope' {unit: 3} {imperative definition: 841} - IMPERATIVE_NT'report someone resolving a stamped envelope' {unit: 3} {imperative definition: 842} - IMPERATIVE_NT'instead of someone resolving a stamped envelope when the per' {unit: 3} {imperative definition: 843} + IMPERATIVE_NT'before someone resolving a stamped envelope when the person ' {unit: 3} {imperative definition: 842} + IMPERATIVE_NT'carry out someone resolving a stamped envelope' {unit: 3} {imperative definition: 843} + IMPERATIVE_NT'report someone resolving a stamped envelope' {unit: 3} {imperative definition: 844} + IMPERATIVE_NT'instead of someone resolving a stamped envelope when the per' {unit: 3} {imperative definition: 845} SENTENCE_NT'a dvd is a kind of artwork' {unit: 3} {classified} {interpretation of subject: infs'stamped envelope'} VERB_NT'is' {verb 'be' 3p s act IS_TENSE +ve} COMMON_NOUN_NT'dvd' {indefinite 'a' n/m/f nom/acc s} {refined} {creation: << kind=dvd(x) >>} {refers: infs'dvd'} {eval: TEST_VALUE_NT} {created here} KIND_NT'kind of artwork' {refined} {refers: infs'artwork'} COMMON_NOUN_NT'artwork' {refined} {refers: infs'artwork'} {creation: << kind=artwork(x) >>} {eval: TEST_VALUE_NT} - IMPERATIVE_NT'before someone resolving a dvd when the person asked is not ' {unit: 3} {imperative definition: 844} - IMPERATIVE_NT'carry out someone resolving a dvd' {unit: 3} {imperative definition: 845} - IMPERATIVE_NT'report someone resolving a dvd' {unit: 3} {imperative definition: 846} - IMPERATIVE_NT'instead of someone resolving a dvd when the person asked car' {unit: 3} {imperative definition: 847} - IMPERATIVE_NT'before listing contents' {unit: 3} {imperative definition: 848} - IMPERATIVE_NT'before grouping together dvds' {unit: 3} {imperative definition: 849} + IMPERATIVE_NT'before someone resolving a dvd when the person asked is not ' {unit: 3} {imperative definition: 846} + IMPERATIVE_NT'carry out someone resolving a dvd' {unit: 3} {imperative definition: 847} + IMPERATIVE_NT'report someone resolving a dvd' {unit: 3} {imperative definition: 848} + IMPERATIVE_NT'instead of someone resolving a dvd when the person asked car' {unit: 3} {imperative definition: 849} + IMPERATIVE_NT'before listing contents' {unit: 3} {imperative definition: 850} + IMPERATIVE_NT'before grouping together dvds' {unit: 3} {imperative definition: 851} SENTENCE_NT'approaching is an action applying to one thing' {unit: 3} {classified} VERB_NT'is' {verb 'be' 3p s act IS_TENSE +ve} {special meaning: new-action} UNPARSED_NOUN_NT'approaching' UNPARSED_NOUN_NT'applying to one thing' - IMPERATIVE_NT'carry out someone approaching' {unit: 3} {imperative definition: 850} + IMPERATIVE_NT'carry out someone approaching' {unit: 3} {imperative definition: 852} SENTENCE_NT'a coupon is a kind of thing' {unit: 3} {classified} {interpretation of subject: infs'dvd'} VERB_NT'is' {verb 'be' 3p s act IS_TENSE +ve} COMMON_NOUN_NT'coupon' {indefinite 'a' n/m/f nom/acc s} {refined} {creation: << kind=coupon(x) >>} {refers: infs'coupon'} {eval: TEST_VALUE_NT} {created here} KIND_NT'kind of thing' {refined} {refers: infs'thing'} COMMON_NOUN_NT'thing' {refined} {refers: infs'thing'} {creation: << kind=thing(x) >>} {eval: TEST_VALUE_NT} - IMPERATIVE_NT'carry out someone resolving a coupon' {unit: 3} {imperative definition: 851} + IMPERATIVE_NT'carry out someone resolving a coupon' {unit: 3} {imperative definition: 853} SENTENCE_NT'the block giving rule is not listed in any rulebook' {unit: 3} {classified} VERB_NT'is' {verb 'be' 3p s act IS_TENSE +ve} {rule placement sense: negative} {special meaning: rule-listed-in} UNPARSED_NOUN_NT'the block giving rule' UNPARSED_NOUN_NT'in any rulebook' - IMPERATIVE_NT'check giving something to someone ( this is the block player' {unit: 3} {imperative definition: 852} - IMPERATIVE_NT'before someone resolving a coupon when the person asked is n' {unit: 3} {imperative definition: 853} - IMPERATIVE_NT'after someone giving a coupon to vanessa' {unit: 3} {imperative definition: 854} + IMPERATIVE_NT'check giving something to someone ( this is the block player' {unit: 3} {imperative definition: 854} + IMPERATIVE_NT'before someone resolving a coupon when the person asked is n' {unit: 3} {imperative definition: 855} + IMPERATIVE_NT'after someone giving a coupon to vanessa' {unit: 3} {imperative definition: 856} SENTENCE_NT'infection color is a kind of value' {unit: 3} {classified} {interpretation of subject: infs'coupon'} VERB_NT'is' {verb 'be' 3p s act IS_TENSE +ve} COMMON_NOUN_NT'infection color' {refined} {creation: << kind=infection color(x) >>} {refers: infs'object'-k} {eval: TEST_VALUE_NT} {created here} @@ -257,7 +257,7 @@ ROOT_NT AND_NT',' {refined} PROPER_NOUN_NT'saffron silk' {refined} {refers: infs'saffron silk'} {eval: CONSTANT_NT'saffron silk' {kind: infection color} {instance: I81'saffron silk'[infection color]} {enumeration: 25}} {created here} PROPER_NOUN_NT'cookie dough cream' {refined} {refers: infs'cookie dough cream'} {eval: CONSTANT_NT'cookie dough cream' {kind: infection color} {instance: I82'cookie dough cream'[infection color]} {enumeration: 26}} {created here} - IMPERATIVE_NT'to say list of flavors' {unit: 3} {imperative definition: 855} + IMPERATIVE_NT'to say list of flavors' {unit: 3} {imperative definition: 857} SENTENCE_NT'understand "ask vanessa for [flavored ice cream]" as buying ' {unit: 3} {classified} VERB_NT'understand' {verb 'understand' 3p p act IS_TENSE +ve} {prep2: as} {special meaning: understand-as} UNPARSED_NOUN_NT'"ask vanessa for [flavored ice cream]"' @@ -270,8 +270,8 @@ ROOT_NT VERB_NT'is' {verb 'be' 3p s act IS_TENSE +ve} {special meaning: new-action} UNPARSED_NOUN_NT'buying the flavor' UNPARSED_NOUN_NT'applying to one infection color' - IMPERATIVE_NT'check buying the flavor' {unit: 3} {imperative definition: 856} - IMPERATIVE_NT'carry out buying the flavor' {unit: 3} {imperative definition: 857} + IMPERATIVE_NT'check buying the flavor' {unit: 3} {imperative definition: 858} + IMPERATIVE_NT'carry out buying the flavor' {unit: 3} {imperative definition: 859} SENTENCE_NT'understand "ice cream" or "cream" or "ice" or "sherbet" or "' {unit: 3} {classified} VERB_NT'understand' {verb 'understand' 3p p act IS_TENSE +ve} {prep2: as} {special meaning: understand-as} UNPARSED_NOUN_NT'"ice cream" or "cream" or "ice" or "sherbet" or "sorbet"' @@ -305,12 +305,12 @@ ROOT_NT VERB_NT'understand' {verb 'understand' 3p p act IS_TENSE +ve} {prep2: as} {special meaning: understand-as} UNPARSED_NOUN_NT'the infection color property' UNPARSED_NOUN_NT'referring to an ice cream cone' - IMPERATIVE_NT'carry out someone resolving an ice cream cone' {unit: 3} {imperative definition: 858} - IMPERATIVE_NT'instead of someone eating a fresh ice cream cone' {unit: 3} {imperative definition: 859} - IMPERATIVE_NT'report someone eating an ice cream cone' {unit: 3} {imperative definition: 860} - IMPERATIVE_NT'before printing the name of an ice cream cone' {unit: 3} {imperative definition: 861} + IMPERATIVE_NT'carry out someone resolving an ice cream cone' {unit: 3} {imperative definition: 860} + IMPERATIVE_NT'instead of someone eating a fresh ice cream cone' {unit: 3} {imperative definition: 861} + IMPERATIVE_NT'report someone eating an ice cream cone' {unit: 3} {imperative definition: 862} + IMPERATIVE_NT'before printing the name of an ice cream cone' {unit: 3} {imperative definition: 863} HEADING_NT'section 2 - infection rules' {heading 5} {under: H5'section 2 - infection rules'} {unit: 3} - IMPERATIVE_NT'this is the infection rule' {unit: 3} {imperative definition: 862} + IMPERATIVE_NT'this is the infection rule' {unit: 3} {imperative definition: 864} SENTENCE_NT'a person can be infected or clean' {unit: 3} {classified} VERB_NT'can be' {verb 'be able to be' s/p 3p act IS_TENSE +ve} {special meaning: can-be} COMMON_NOUN_NT'a person' {refined} {refers: infs'person'} {creation: << kind=person(x) >>} {eval: TEST_VALUE_NT} @@ -323,11 +323,11 @@ ROOT_NT COMMON_NOUN_NT'person' {indefinite 'a' n/m/f nom/acc s} {refined} {refers: infs'person'} {creation: << kind=person(x) >>} {eval: TEST_VALUE_NT} ALLOWED_NT'has' {refined} UNPARSED_NOUN_NT'infection color' {indefinite 'an' n/m/f nom/acc s} {refined} - IMPERATIVE_NT'every turn' {unit: 3} {imperative definition: 863} - IMPERATIVE_NT'definition' {unit: 3} {imperative definition: 864} - IMPERATIVE_NT'definition' {unit: 3} {imperative definition: 865} - IMPERATIVE_NT'when play begins' {unit: 3} {imperative definition: 866} - IMPERATIVE_NT'every turn' {unit: 3} {imperative definition: 867} + IMPERATIVE_NT'every turn' {unit: 3} {imperative definition: 865} + IMPERATIVE_NT'definition' {unit: 3} {imperative definition: 866} + IMPERATIVE_NT'definition' {unit: 3} {imperative definition: 867} + IMPERATIVE_NT'when play begins' {unit: 3} {imperative definition: 868} + IMPERATIVE_NT'every turn' {unit: 3} {imperative definition: 869} SENTENCE_NT'understand "sneeze on [something]" as sneezing on' {unit: 3} {classified} VERB_NT'understand' {verb 'understand' 3p p act IS_TENSE +ve} {prep2: as} {special meaning: understand-as} UNPARSED_NOUN_NT'"sneeze on [something]"' @@ -336,11 +336,11 @@ ROOT_NT VERB_NT'is' {verb 'be' 3p s act IS_TENSE +ve} {special meaning: new-action} UNPARSED_NOUN_NT'sneezing on' UNPARSED_NOUN_NT'applying to one thing' - IMPERATIVE_NT'check sneezing on' {unit: 3} {imperative definition: 868} - IMPERATIVE_NT'carry out sneezing on' {unit: 3} {imperative definition: 869} - IMPERATIVE_NT'carry out someone sneezing on' {unit: 3} {imperative definition: 870} - IMPERATIVE_NT'report sneezing on' {unit: 3} {imperative definition: 871} - IMPERATIVE_NT'report someone sneezing on' {unit: 3} {imperative definition: 872} + IMPERATIVE_NT'check sneezing on' {unit: 3} {imperative definition: 870} + IMPERATIVE_NT'carry out sneezing on' {unit: 3} {imperative definition: 871} + IMPERATIVE_NT'carry out someone sneezing on' {unit: 3} {imperative definition: 872} + IMPERATIVE_NT'report sneezing on' {unit: 3} {imperative definition: 873} + IMPERATIVE_NT'report someone sneezing on' {unit: 3} {imperative definition: 874} SENTENCE_NT'understand "inject [someone] with [something]" as injecting ' {unit: 3} {classified} VERB_NT'understand' {verb 'understand' 3p p act IS_TENSE +ve} {prep2: as} {special meaning: understand-as} UNPARSED_NOUN_NT'"inject [someone] with [something]"' @@ -361,14 +361,14 @@ ROOT_NT VERB_NT'is' {verb 'be' 3p s act IS_TENSE +ve} {special meaning: new-action} UNPARSED_NOUN_NT'injecting it with' UNPARSED_NOUN_NT'applying to two things' - IMPERATIVE_NT'check injecting it with' {unit: 3} {imperative definition: 873} - IMPERATIVE_NT'carry out injecting it with' {unit: 3} {imperative definition: 874} - IMPERATIVE_NT'after injecting the player with something' {unit: 3} {imperative definition: 875} - IMPERATIVE_NT'report injecting it with' {unit: 3} {imperative definition: 876} + IMPERATIVE_NT'check injecting it with' {unit: 3} {imperative definition: 875} + IMPERATIVE_NT'carry out injecting it with' {unit: 3} {imperative definition: 876} + IMPERATIVE_NT'after injecting the player with something' {unit: 3} {imperative definition: 877} + IMPERATIVE_NT'report injecting it with' {unit: 3} {imperative definition: 878} HEADING_NT'section 3 - geography' {heading 5} {under: H5'section 3 - geography'} {unit: 3} INCLUSION_NT'include locksmith by emily short' {unit: 3} - HEADING_NT'version 13 of locksmith by emily short begins here' {heading 0} {under: H0'version 13 of locksmith by emily short begins here'} {includes: Locksmith by Emily Short v13 } {unit: 3} - BEGINHERE_NT'version 13 of locksmith by emily short' {unit: 3} + HEADING_NT'version 14 of locksmith by emily short begins here' {heading 0} {under: H0'version 14 of locksmith by emily short begins here'} {includes: Locksmith by Emily Short v14 } {unit: 3} + BEGINHERE_NT'version 14 of locksmith by emily short' {unit: 3} ... SENTENCE_NT'understand "go to/toward/into [any room]" as going toward' {unit: 3} {classified} VERB_NT'understand' {verb 'understand' 3p p act IS_TENSE +ve} {prep2: as} {special meaning: understand-as} @@ -389,9 +389,9 @@ ROOT_NT VERB_NT'is' {verb 'be' 3p s act IS_TENSE +ve} {special meaning: new-action} UNPARSED_NOUN_NT'going toward' UNPARSED_NOUN_NT'applying to one thing' - IMPERATIVE_NT'check going toward' {unit: 3} {imperative definition: 914} - IMPERATIVE_NT'carry out going toward' {unit: 3} {imperative definition: 915} - IMPERATIVE_NT'instead of waiting when the destination of the player is not' {unit: 3} {imperative definition: 916} + IMPERATIVE_NT'check going toward' {unit: 3} {imperative definition: 916} + IMPERATIVE_NT'carry out going toward' {unit: 3} {imperative definition: 917} + IMPERATIVE_NT'instead of waiting when the destination of the player is not' {unit: 3} {imperative definition: 918} SENTENCE_NT'understand "stop" or "cease" as stopping' {unit: 3} {classified} VERB_NT'understand' {verb 'understand' 3p p act IS_TENSE +ve} {prep2: as} {special meaning: understand-as} UNPARSED_NOUN_NT'"stop" or "cease"' @@ -400,11 +400,11 @@ ROOT_NT VERB_NT'is' {verb 'be' 3p s act IS_TENSE +ve} {special meaning: new-action} UNPARSED_NOUN_NT'stopping' UNPARSED_NOUN_NT'applying to nothing' - IMPERATIVE_NT'carry out stopping' {unit: 3} {imperative definition: 917} - IMPERATIVE_NT'report stopping' {unit: 3} {imperative definition: 918} - IMPERATIVE_NT'after going to an air-conditioned room' {unit: 3} {imperative definition: 919} - IMPERATIVE_NT'after going from an air-conditioned room' {unit: 3} {imperative definition: 920} - IMPERATIVE_NT'instead of listening to an air-conditioned room' {unit: 3} {imperative definition: 921} + IMPERATIVE_NT'carry out stopping' {unit: 3} {imperative definition: 919} + IMPERATIVE_NT'report stopping' {unit: 3} {imperative definition: 920} + IMPERATIVE_NT'after going to an air-conditioned room' {unit: 3} {imperative definition: 921} + IMPERATIVE_NT'after going from an air-conditioned room' {unit: 3} {imperative definition: 922} + IMPERATIVE_NT'instead of listening to an air-conditioned room' {unit: 3} {imperative definition: 923} SENTENCE_NT'the alfred cralle pool hall is a room' {unit: 3} {classified} {interpretation of subject: infs'person'} VERB_NT'is' {verb 'be' 3p s act IS_TENSE +ve} PROPER_NOUN_NT'alfred cralle pool hall' {definite 'the' n/m/f s/p nom/acc} {refined} {refers: infs'alfred cralle pool hall'} {eval: CONSTANT_NT'alfred cralle pool hall' {kind: object} {instance: I83'alfred cralle pool hall'} {enumeration: 0}} {created here} @@ -446,7 +446,7 @@ ROOT_NT PROPER_NOUN_NT'felt door' {definite 'the' n/m/f s/p nom/acc} {refined} {refers: infs'felt door'} {eval: CONSTANT_NT'felt door' {kind: door} {instance: I85'felt door'} {enumeration: 0}} PROPER_NOUN_NT'description' {refined} {eval: CONSTANT_NT {kind: texts valued property} {property: 'description'=text}} PROPER_NOUN_NT'"It has a prominent lock, designed for an old-fashioned key.' {refined} {eval: CONSTANT_NT'"It has a prominent lock, designed for an old-fashioned key.' {kind: text}} - IMPERATIVE_NT'after locking a door with something in the presence of an ot' {unit: 3} {imperative definition: 922} + IMPERATIVE_NT'after locking a door with something in the presence of an ot' {unit: 3} {imperative definition: 924} SENTENCE_NT'nancy johnson memorial square is west of the felt door' {unit: 3} {classified} {interpretation of subject: infs'key to the city'} VERB_NT'is west of' {verb 'be' 3p s act IS_TENSE +ve} {prep1: west of} PROPER_NOUN_NT'nancy johnson memorial square' {refined} {refers: infs'nancy johnson memorial square'} {eval: CONSTANT_NT'nancy johnson memorial square' {kind: object} {instance: I87'nancy johnson memorial square'} {enumeration: 0}} {created here} @@ -508,8 +508,8 @@ ROOT_NT VERB_NT'is' {verb 'be' 3p s act IS_TENSE +ve} PROPER_NOUN_NT'slot' {definite 'the' n/m/f s/p nom/acc} {refined} {refers: infs'slot'} {eval: CONSTANT_NT'slot' {kind: object} {instance: I92'slot'} {enumeration: 0}} COMMON_NOUN_NT'container' {indefinite 'a' n/m/f nom/acc s} {refined} {refers: infs'container'} {creation: << kind=container(x) >>} {eval: TEST_VALUE_NT} - IMPERATIVE_NT'carry out inserting something into the slot' {unit: 3} {imperative definition: 923} - IMPERATIVE_NT'report inserting something into the slot' {unit: 3} {imperative definition: 924} + IMPERATIVE_NT'carry out inserting something into the slot' {unit: 3} {imperative definition: 925} + IMPERATIVE_NT'report inserting something into the slot' {unit: 3} {imperative definition: 926} SENTENCE_NT'hamwi street is northeast of an iron gate' {unit: 3} {classified} {interpretation of subject: infs'slot'} VERB_NT'is northeast of' {verb 'be' 3p s act IS_TENSE +ve} {prep1: northeast of} PROPER_NOUN_NT'hamwi street' {refined} {refers: infs'hamwi street'} {eval: CONSTANT_NT'hamwi street' {kind: object} {instance: I93'hamwi street'} {enumeration: 0}} {created here} @@ -533,7 +533,7 @@ ROOT_NT AND_NT'and' {refined} ADJECTIVE_NT'lockable' {refined} {predicate: lockable} {creation: << lockable(x) ^ lockable(x) >>} ADJECTIVE_NT'unlocked' {refined} {predicate: unlocked} {creation: << unlocked(x) ^ unlocked(x) >>} - IMPERATIVE_NT'before printing the name of the iron gate while not opening ' {unit: 3} {imperative definition: 925} + IMPERATIVE_NT'before printing the name of the iron gate while not opening ' {unit: 3} {imperative definition: 927} SENTENCE_NT'cold comfort ice cream is north of a metal door' {unit: 3} {classified} {interpretation of subject: infs'iron gate'} VERB_NT'is north of' {verb 'be' 3p s act IS_TENSE +ve} {prep1: north of} PROPER_NOUN_NT'cold comfort ice cream' {refined} {refers: infs'cold comfort ice cream'} {eval: CONSTANT_NT'cold comfort ice cream' {kind: object} {instance: I95'cold comfort ice cream'} {enumeration: 0}} {created here} @@ -639,8 +639,8 @@ ROOT_NT VERB_NT'understand' {verb 'understand' 3p p act IS_TENSE +ve} {prep2: as} {special meaning: understand-as} UNPARSED_NOUN_NT'"glass"' UNPARSED_NOUN_NT'the box' - IMPERATIVE_NT'instead of attacking the closed emergency box' {unit: 3} {imperative definition: 926} - IMPERATIVE_NT'instead of attacking the open emergency box' {unit: 3} {imperative definition: 927} + IMPERATIVE_NT'instead of attacking the closed emergency box' {unit: 3} {imperative definition: 928} + IMPERATIVE_NT'instead of attacking the open emergency box' {unit: 3} {imperative definition: 929} SENTENCE_NT'the syringe is in the emergency box' {unit: 3} {classified} {interpretation of subject: infs'emergency box'} VERB_NT'is in' {verb 'be' 3p s act IS_TENSE +ve} {prep1: in} PROPER_NOUN_NT'syringe' {definite 'the' n/m/f s/p nom/acc} {refined} {refers: infs'syringe'} {eval: CONSTANT_NT'syringe' {kind: object} {instance: I104'syringe'} {enumeration: 0}} {created here} @@ -743,8 +743,8 @@ ROOT_NT SENTENCE_NT'use full-length room descriptions' {unit: 3} {classified} VERB_NT'use' {verb 'use' 3p p act IS_TENSE +ve} {special meaning: use} UNPARSED_NOUN_NT'full-length room descriptions' - IMPERATIVE_NT'after looking in an outdoors room' {unit: 3} {imperative definition: 928} - IMPERATIVE_NT'definition' {unit: 3} {imperative definition: 929} + IMPERATIVE_NT'after looking in an outdoors room' {unit: 3} {imperative definition: 930} + IMPERATIVE_NT'definition' {unit: 3} {imperative definition: 931} DEFN_CONT_NT'a door is proximate' {unit: 3} CODE_BLOCK_NT CODE_BLOCK_NT {control structure: IF} @@ -765,7 +765,7 @@ ROOT_NT INVOCATION_NT'yes' {phrase invoked: } INVOCATION_LIST_NT'no' {unit: 3} INVOCATION_NT'no' {phrase invoked: } - IMPERATIVE_NT'before exiting when the player is in an indoors room' {unit: 3} {imperative definition: 930} + IMPERATIVE_NT'before exiting when the player is in an indoors room' {unit: 3} {imperative definition: 932} SENTENCE_NT'blank is a room' {unit: 3} {classified} {interpretation of subject: infs'key to the city'} VERB_NT'is' {verb 'be' 3p s act IS_TENSE +ve} PROPER_NOUN_NT'blank' {refined} {refers: infs'blank'} {eval: CONSTANT_NT'blank' {kind: object} {instance: I108'blank'} {enumeration: 0}} {created here} @@ -991,15 +991,15 @@ ROOT_NT PROPER_NOUN_NT'ned' {refined} {refers: infs'ned'} {eval: CONSTANT_NT'ned' {kind: man} {instance: I161'ned'} {enumeration: 0}} RELATIONSHIP_NT'owns' {meaning: ownership-r} {refined} PROPER_NOUN_NT'movie rental' {definite 'the' n/m/f s/p nom/acc} {refined} {refers: infs'movie rental store'} {eval: CONSTANT_NT'movie rental store' {kind: object} {instance: I99'movie rental store'} {enumeration: 0}} - IMPERATIVE_NT'after printing the name of someone ( called target ) while l' {unit: 3} {imperative definition: 931} + IMPERATIVE_NT'after printing the name of someone ( called target ) while l' {unit: 3} {imperative definition: 933} SENTENCE_NT'the description of a person is usually "[The noun] [if the n' {unit: 3} {classified} {interpretation of subject: infs'ned'} VERB_NT'is usually' {certainty:likely} {verb 'be' 3p s act IS_TENSE +ve} X_OF_Y_NT'description of a person' {definite 'the' n/m/f s/p nom/acc} {refined} COMMON_NOUN_NT'person' {indefinite 'a' n/m/f nom/acc s} {refined} {refers: infs'person'} {creation: << kind=person(x) >>} {eval: TEST_VALUE_NT} PROPER_NOUN_NT'description' {refined} {eval: CONSTANT_NT {kind: texts valued property} {property: 'description'=text}} PROPER_NOUN_NT'"[The noun] [if the noun is clean]looks healthy[otherwise]is' {refined} {eval: CONSTANT_NT'"[The noun] [if the noun is clean]looks healthy[otherwise]is' {kind: text}} - IMPERATIVE_NT'after examining another person who is carrying something' {unit: 3} {imperative definition: 932} - IMPERATIVE_NT'when play begins' {unit: 3} {imperative definition: 933} + IMPERATIVE_NT'after examining another person who is carrying something' {unit: 3} {imperative definition: 934} + IMPERATIVE_NT'when play begins' {unit: 3} {imperative definition: 935} HEADING_NT'section 5 - conversation' {heading 5} {under: H5'section 5 - conversation'} {unit: 3} SENTENCE_NT'a person has a table name called conversation' {unit: 3} {classified} VERB_NT'has' {verb 'have' 3p s act IS_TENSE +ve} @@ -1008,8 +1008,8 @@ ROOT_NT PROPERTYCALLED_NT'called' UNPARSED_NOUN_NT'table name' {indefinite 'a' n/m/f nom/acc s} UNPARSED_NOUN_NT'conversation' - IMPERATIVE_NT'instead of asking someone about something' {unit: 3} {imperative definition: 934} - IMPERATIVE_NT'instead of telling someone about something' {unit: 3} {imperative definition: 935} + IMPERATIVE_NT'instead of asking someone about something' {unit: 3} {imperative definition: 936} + IMPERATIVE_NT'instead of telling someone about something' {unit: 3} {imperative definition: 937} SENTENCE_NT'understand "recap" or "recall" or "review" as recalling conv' {unit: 3} {classified} VERB_NT'understand' {verb 'understand' 3p p act IS_TENSE +ve} {prep2: as} {special meaning: understand-as} UNPARSED_NOUN_NT'"recap" or "recall" or "review"' @@ -1018,7 +1018,7 @@ ROOT_NT VERB_NT'is' {verb 'be' 3p s act IS_TENSE +ve} {special meaning: new-action} UNPARSED_NOUN_NT'recalling conversations' UNPARSED_NOUN_NT'applying to nothing' - IMPERATIVE_NT'carry out recalling conversations' {unit: 3} {imperative definition: 936} + IMPERATIVE_NT'carry out recalling conversations' {unit: 3} {imperative definition: 938} SENTENCE_NT'the conversation of a person is usually table of general chi' {unit: 3} {classified} {interpretation of subject: infs'person'} VERB_NT'is usually' {certainty:likely} {verb 'be' 3p s act IS_TENSE +ve} X_OF_Y_NT'conversation of a person' {definite 'the' n/m/f s/p nom/acc} {refined} @@ -1033,7 +1033,7 @@ ROOT_NT PROPER_NOUN_NT'conversation' {refined} {eval: CONSTANT_NT {kind: table names valued property} {property: 'conversation'=table name}} PROPER_NOUN_NT'table of vanessa chatter' {definite 'the' n/m/f s/p nom/acc} {refined} {eval: CONSTANT_NT'table of vanessa chatter' {kind: table name} {table: table_data} {meaning: {table of vanessa chatter = TABLE_MC}}} TABLE_NT'table of vanessa chatter topic reply summary turn stamp char' {unit: 3} - IMPERATIVE_NT'after reading a command' {unit: 3} {imperative definition: 937} + IMPERATIVE_NT'after reading a command' {unit: 3} {imperative definition: 939} HEADING_NT'section 6 - movement description' {heading 5} {under: H5'section 6 - movement description'} {unit: 3} SENTENCE_NT'a person has some text called walk style' {unit: 3} {classified} VERB_NT'has' {verb 'have' 3p s act IS_TENSE +ve} @@ -1080,8 +1080,8 @@ ROOT_NT PROPER_NOUN_NT'"sashay"' {refined} {eval: CONSTANT_NT'"sashay"' {kind: text}} TABLE_NT'table of visible exits character second third heading chosen' {unit: 3} TABLE_NT'table of visible entrances character second third heading ch' {unit: 3} - IMPERATIVE_NT'to clear ( current table - a table name )' {unit: 3} {imperative definition: 938} - IMPERATIVE_NT'to tidy departures of ( current table - a table name )' {unit: 3} {imperative definition: 939} + IMPERATIVE_NT'to clear ( current table - a table name )' {unit: 3} {imperative definition: 940} + IMPERATIVE_NT'to tidy departures of ( current table - a table name )' {unit: 3} {imperative definition: 941} SENTENCE_NT'a door has a person called last opener' {unit: 3} {classified} {interpretation of subject: infs'person'} VERB_NT'has' {verb 'have' 3p s act IS_TENSE +ve} COMMON_NOUN_NT'door' {indefinite 'a' n/m/f nom/acc s} {refined} {refers: infs'door'} {creation: << kind=door(x) >>} {eval: TEST_VALUE_NT} @@ -1089,21 +1089,21 @@ ROOT_NT PROPERTYCALLED_NT'called' UNPARSED_NOUN_NT'person' {indefinite 'a' n/m/f nom/acc s} UNPARSED_NOUN_NT'last opener' - IMPERATIVE_NT'report someone opening a door' {unit: 3} {imperative definition: 940} - IMPERATIVE_NT'report someone going through a door ( called route )' {unit: 3} {imperative definition: 941} + IMPERATIVE_NT'report someone opening a door' {unit: 3} {imperative definition: 942} + IMPERATIVE_NT'report someone going through a door ( called route )' {unit: 3} {imperative definition: 943} SENTENCE_NT'the last thing named is a thing that varies' {unit: 3} {classified} {interpretation of subject: infs'door'} VERB_NT'is' {verb 'be' 3p s act IS_TENSE +ve} PROPER_NOUN_NT'last thing named' {definite 'the' n/m/f s/p nom/acc} {refined} {eval: NONLOCAL_VARIABLE_NT'last thing named' {nonlocal: 'last thing named'(var)thing}} {created here} COMMON_NOUN_NT'thing that varies' {indefinite 'a' n/m/f nom/acc s} {refined} {refers: infs'values variable-pointer'-k} {creation: << kind=things variable-pointer(x) >>} {eval: TEST_VALUE_NT} - IMPERATIVE_NT'before printing the name of something ( called target ) whic' {unit: 3} {imperative definition: 942} - IMPERATIVE_NT'report someone going a direction' {unit: 3} {imperative definition: 943} - IMPERATIVE_NT'this is the movement reporting rule' {unit: 3} {imperative definition: 944} - IMPERATIVE_NT'to generate descriptions from ( current table - a table name' {unit: 3} {imperative definition: 945} + IMPERATIVE_NT'before printing the name of something ( called target ) whic' {unit: 3} {imperative definition: 944} + IMPERATIVE_NT'report someone going a direction' {unit: 3} {imperative definition: 945} + IMPERATIVE_NT'this is the movement reporting rule' {unit: 3} {imperative definition: 946} + IMPERATIVE_NT'to generate descriptions from ( current table - a table name' {unit: 3} {imperative definition: 947} SENTENCE_NT'the last person named is a person that varies' {unit: 3} {classified} {interpretation of subject: infs'door'} VERB_NT'is' {verb 'be' 3p s act IS_TENSE +ve} PROPER_NOUN_NT'last person named' {definite 'the' n/m/f s/p nom/acc} {refined} {eval: NONLOCAL_VARIABLE_NT'last person named' {nonlocal: 'last person named'(var)person}} {created here} COMMON_NOUN_NT'person that varies' {indefinite 'a' n/m/f nom/acc s} {refined} {refers: infs'values variable-pointer'-k} {creation: << kind=people variable-pointer(x) >>} {eval: TEST_VALUE_NT} - IMPERATIVE_NT'before printing the name of a person ( called target )' {unit: 3} {imperative definition: 946} + IMPERATIVE_NT'before printing the name of a person ( called target )' {unit: 3} {imperative definition: 948} SENTENCE_NT'group size is a number that varies' {unit: 3} {classified} {interpretation of subject: infs'door'} VERB_NT'is' {verb 'be' 3p s act IS_TENSE +ve} PROPER_NOUN_NT'group size' {refined} {eval: NONLOCAL_VARIABLE_NT'group size' {nonlocal: 'group size'(var)number}} {created here} @@ -1112,19 +1112,19 @@ ROOT_NT VERB_NT'is' {verb 'be' 3p s act IS_TENSE +ve} PROPER_NOUN_NT'group size' {refined} {eval: NONLOCAL_VARIABLE_NT'group size' {nonlocal: 'group size'(var)number} {meaning: {group size = VARIABLE_MC}}} PROPER_NOUN_NT'1' {refined} {eval: CONSTANT_NT'1' {kind: number} {explicit literal} {number: 1}} - IMPERATIVE_NT'to clear marked people' {unit: 3} {imperative definition: 947} - IMPERATIVE_NT'before listing nondescript items' {unit: 3} {imperative definition: 948} - IMPERATIVE_NT'to describe patients' {unit: 3} {imperative definition: 949} - IMPERATIVE_NT'to say ( named character - a man ) as pronoun' {unit: 3} {imperative definition: 950} - IMPERATIVE_NT'to say ( named character - a woman ) as pronoun' {unit: 3} {imperative definition: 951} - IMPERATIVE_NT'to say looks as though dipped in for ( index - a number )' {unit: 3} {imperative definition: 952} + IMPERATIVE_NT'to clear marked people' {unit: 3} {imperative definition: 949} + IMPERATIVE_NT'before listing nondescript items' {unit: 3} {imperative definition: 950} + IMPERATIVE_NT'to describe patients' {unit: 3} {imperative definition: 951} + IMPERATIVE_NT'to say ( named character - a man ) as pronoun' {unit: 3} {imperative definition: 952} + IMPERATIVE_NT'to say ( named character - a woman ) as pronoun' {unit: 3} {imperative definition: 953} + IMPERATIVE_NT'to say looks as though dipped in for ( index - a number )' {unit: 3} {imperative definition: 954} TABLE_NT'table of dipping phrases dipping "looks as though dipped in"' {unit: 3} SENTENCE_NT'a door is usually scenery' {unit: 3} {classified} {interpretation of subject: infs'door'} VERB_NT'is usually' {certainty:likely} {verb 'be' 3p s act IS_TENSE +ve} COMMON_NOUN_NT'door' {indefinite 'a' n/m/f nom/acc s} {refined} {refers: infs'door'} {creation: << kind=door(x) >>} {eval: TEST_VALUE_NT} ADJECTIVE_NT'scenery' {refined} {predicate: scenery} {creation: << scenery(x) ^ scenery(x) >>} - IMPERATIVE_NT'to make delimiter ( index - a number ) of ( count - a number' {unit: 3} {imperative definition: 953} - IMPERATIVE_NT'to say optional comma' {unit: 3} {imperative definition: 954} + IMPERATIVE_NT'to make delimiter ( index - a number ) of ( count - a number' {unit: 3} {imperative definition: 955} + IMPERATIVE_NT'to say optional comma' {unit: 3} {imperative definition: 956} SENTENCE_NT'test me with go to cold comfort / z / z / z / z / ask vaness' {unit: 3} {classified} VERB_NT'test' {verb 'test' 3p p act IS_TENSE +ve} {prep2: with} {special meaning: test-with} UNPARSED_NOUN_NT'me' diff --git a/inform7/Figures/timings-diagnostics.txt b/inform7/Figures/timings-diagnostics.txt index 2345915f2..7c879ca1e 100644 --- a/inform7/Figures/timings-diagnostics.txt +++ b/inform7/Figures/timings-diagnostics.txt @@ -1,32 +1,29 @@ 100.0% in inform7 run - 70.3% in compilation to Inter - 50.2% in //Sequence::undertake_queued_tasks// + 67.6% in compilation to Inter + 45.7% in //Sequence::undertake_queued_tasks// 4.6% in //MajorNodes::pre_pass// - 3.3% in //MajorNodes::pass_1// - 1.7% in //ImperativeDefinitions::assess_all// - 1.5% in //RTPhrasebook::compile_entries// - 1.3% in //RTKindConstructors::compile// - 0.9% in //Sequence::lint_inter// - 0.5% in //ImperativeDefinitions::compile_first_block// - 0.5% in //Sequence::undertake_queued_tasks// - 0.5% in //World::stage_V// - 0.3% in //InferenceSubjects::emit_all// + 3.8% in //MajorNodes::pass_1// + 1.5% in //ImperativeDefinitions::assess_all// + 1.5% in //RTKindConstructors::compile// + 1.1% in //RTPhrasebook::compile_entries// + 1.1% in //Sequence::lint_inter// + 0.3% in //CompletionModule::compile// + 0.3% in //ImperativeDefinitions::compile_first_block// 0.3% in //MajorNodes::pass_2// + 0.3% in //RTKindConstructors::compile_permissions// 0.3% in //Sequence::undertake_queued_tasks// - 0.1% in //CompletionModule::compile// - 0.1% in //RTKindConstructors::compile_permissions// - 0.1% in //Task::make_built_in_kind_constructors// - 2.9% not specifically accounted for - 26.1% in running Inter pipeline - 10.7% in step 14/15: generate inform6 -> auto.inf - 5.8% in step 5/15: load-binary-kits - 5.0% in step 6/15: make-synoptic-module - 1.7% in step 9/15: make-identifiers-unique + 0.3% in //Sequence::undertake_queued_tasks// + 0.3% in //World::stage_V// + 5.3% not specifically accounted for + 28.0% in running Inter pipeline + 9.6% in step 14/15: generate inform6 -> auto.inf + 7.3% in step 5/15: load-binary-kits + 5.7% in step 6/15: make-synoptic-module + 1.9% in step 9/15: make-identifiers-unique 0.3% in step 12/15: eliminate-redundant-operations 0.3% in step 4/15: compile-splats 0.3% in step 7/15: shorten-wiring 0.3% in step 8/15: detect-indirect-calls - 0.1% in step 11/15: eliminate-redundant-labels - 1.0% not specifically accounted for - 2.9% in supervisor - 0.6% not specifically accounted for + 1.9% not specifically accounted for + 3.4% in supervisor + 0.8% not specifically accounted for diff --git a/inform7/Internal/Extensions/Emily Short/Inanimate Listeners.i7x b/inform7/Internal/Extensions/Emily Short/Inanimate Listeners.i7x index d85fcbfea..bef1f55ff 100644 --- a/inform7/Internal/Extensions/Emily Short/Inanimate Listeners.i7x +++ b/inform7/Internal/Extensions/Emily Short/Inanimate Listeners.i7x @@ -1,4 +1,4 @@ -Version 1 of Inanimate Listeners by Emily Short begins here. +Version 2 of Inanimate Listeners by Emily Short begins here. "Allows the player to address inanimate objects such as a talking computer, microphone, or telephone in a form such as ASK COMPUTER ABOUT COORDINATES." diff --git a/inform7/Internal/Extensions/Emily Short/Locksmith.i7x b/inform7/Internal/Extensions/Emily Short/Locksmith.i7x index a895e4244..fa0a9877b 100644 --- a/inform7/Internal/Extensions/Emily Short/Locksmith.i7x +++ b/inform7/Internal/Extensions/Emily Short/Locksmith.i7x @@ -1,4 +1,4 @@ -Version 13 of Locksmith by Emily Short begins here. +Version 14 of Locksmith by Emily Short begins here. "Implicit handling of doors and containers so that lock manipulation is automatic if the player has the necessary keys." diff --git a/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7x b/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7x index ee211a2ef..53ea85c50 100644 --- a/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7x +++ b/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7x @@ -1,4 +1,4 @@ -Version 1 of Basic Inform by Graham Nelson begins here. +Version 2 of Basic Inform by Graham Nelson begins here. "Basic Inform, included in every project, defines the basic framework of Inform as a programming language." @@ -661,7 +661,7 @@ To repeat with (loopvar - nonexisting K variable) To repeat with (loopvar - nonexisting K variable) running from (v - enumerated value of kind K) to (w - K) begin -- end loop (documented at ph_repeat): - (- for ({loopvar}={v}: {loopvar}<={w}: {loopvar}++) -). + (- for ({loopvar}={v}: {loopvar}<={w}: {loopvar}={-next-routine:K}({loopvar})) -). To repeat with (loopvar - nonexisting K variable) running through (OS - description of values of kind K) begin -- end loop (documented at ph_runthrough): @@ -734,6 +734,9 @@ Section 1 - Enumerations To decide which number is number of (S - description of values) (documented at ph_numberof): (- {-primitive-definition:number-of} -). +To decide what number is the numerical value of (X - enumerated value): (- {X} -). +To decide what number is the sequence number of (X - enumerated value of kind K): + (- {-indexing-routine:K}({X}) -). To decide which K is (name of kind of enumerated value K) after (X - K) (documented at ph_enumafter): (- {-next-routine:K}({X}) -). diff --git a/inform7/Internal/Extensions/Graham Nelson/English Language.i7x b/inform7/Internal/Extensions/Graham Nelson/English Language.i7x index 5dfbd472a..4ccaccb30 100644 --- a/inform7/Internal/Extensions/Graham Nelson/English Language.i7x +++ b/inform7/Internal/Extensions/Graham Nelson/English Language.i7x @@ -1,4 +1,4 @@ -Version 1 of English Language by Graham Nelson begins here. +Version 2 of English Language by Graham Nelson begins here. "To make English the language of play." diff --git a/inform7/Internal/Inter/Architecture16Kit/kit_metadata.json b/inform7/Internal/Inter/Architecture16Kit/kit_metadata.json index 5772cf15d..074ff0206 100644 --- a/inform7/Internal/Inter/Architecture16Kit/kit_metadata.json +++ b/inform7/Internal/Inter/Architecture16Kit/kit_metadata.json @@ -2,7 +2,7 @@ "is": { "type": "kit", "title": "Architecture16Kit", - "version": "10.2.0-beta+6W62" + "version": "10.2.0-beta+6W67" }, "compatibility": "16-bit", "kit-details": { diff --git a/inform7/Internal/Inter/Architecture32Kit/kit_metadata.json b/inform7/Internal/Inter/Architecture32Kit/kit_metadata.json index aba358dc3..034fe8a30 100644 --- a/inform7/Internal/Inter/Architecture32Kit/kit_metadata.json +++ b/inform7/Internal/Inter/Architecture32Kit/kit_metadata.json @@ -2,7 +2,7 @@ "is": { "type": "kit", "title": "Architecture32Kit", - "version": "10.2.0-beta+6W62" + "version": "10.2.0-beta+6W67" }, "compatibility": "32-bit", "kit-details": { diff --git a/inform7/Internal/Inter/BasicInformKit/Sections/Rulebooks.i6t b/inform7/Internal/Inter/BasicInformKit/Sections/Rulebooks.i6t index 759e3f6b6..2c4aa50b4 100644 --- a/inform7/Internal/Inter/BasicInformKit/Sections/Rulebooks.i6t +++ b/inform7/Internal/Inter/BasicInformKit/Sections/Rulebooks.i6t @@ -207,16 +207,10 @@ And here is how to tell what the results were. return 0; ]; -@h Printing Rule Names. -This is the I6 printing rule used for a value of kind "rule", which as -noted above can either be rulebook ID numbers in the range 0 to $N-1$ or -are addresses of individual rules. - -Names of rules and rulebooks take up a fair amount of space, and one of the -main memory economies enforced by the "Use memory economy" option is to -omit the necessary arrays. (It's not the text which is the problem so -much as the table of addresses pointing to that text, which has to live in -precious readable memory on the Z-machine.) +[ RulebookOutcomePrintingRule nro; + if (nro == 0) print "(no outcome)"; + else print (string) nro; +]; @h Casting. Nothing needs to be done to a rulebook value to make it a rule value. diff --git a/inform7/Internal/Inter/BasicInformKit/Sections/Text.i6t b/inform7/Internal/Inter/BasicInformKit/Sections/Text.i6t index cf07cd7f0..3c6603d35 100644 --- a/inform7/Internal/Inter/BasicInformKit/Sections/Text.i6t +++ b/inform7/Internal/Inter/BasicInformKit/Sections/Text.i6t @@ -418,11 +418,7 @@ printed in ZSCII rather than Unicode. for (i=0: i(2+n); ]; +@h Non-standard enumerations. +This is for enumerations whose values are scattered: say, for a kind where +the valid runtime values are 3, 15 and 421. Next after 3 is 15; previous +is 421, and so on. + +The instances array supplied has the extent in word 0, which is in effect +the number of valid instances. This is guaranteed to be at least 1. + += +[ NextEnumVal inst instances i count; + count = instances-->0; + for (i=1: i<=count: i++) + if (instances-->i == inst) + return instances-->(i%count + 1); + return instances-->1; ! Should not ever happen +]; + +[ PrevEnumVal inst instances i count; + count = instances-->0; + for (i=1: i<=count: i++) + if (instances-->i == inst) + return instances-->((i+count-2)%count + 1); + return instances-->1; ! Should not ever happen +]; + +[ RandomEnumVal instances a b count a_index b_index c; + count = instances-->0; + if (a == b) { + if (a == 0) return instances-->(random(count)); + return a; + } + for (c = 1: c <= count: c++) { + if (instances-->c == a) + a_index = c; + if (instances-->c == b) + b_index = c; + } + if (a_index > b_index) { c = a_index; a_index = b_index; b_index = c; } + return instances-->(a_index + random(b_index - a_index + 1) - 1); +]; + +[ IndexOfEnumVal instances a count c; + count = instances-->0; + for (c = 1: c <= count: c++) + if (instances-->c == a) + return c; + return 0; +]; + @h GenerateRandomNumber. The following uses the virtual machine's RNG (via the I6 built-in function |random|) to produce a uniformly random integer in the range $n$ to $m$ diff --git a/inform7/Internal/Inter/BasicInformKit/kinds/Core.neptune b/inform7/Internal/Inter/BasicInformKit/kinds/Core.neptune index da24c91ca..2587d8201 100644 --- a/inform7/Internal/Inter/BasicInformKit/kinds/Core.neptune +++ b/inform7/Internal/Inter/BasicInformKit/kinds/Core.neptune @@ -186,7 +186,7 @@ builtin base TABLE_TY { documentation-reference: kind_tablename index-priority: 6 index-default-value: a table with no rows or columns - indexed-grey-if-empty: yes + indexed-grey-if-empty: no specification-text: Like tables of information in a book or newspaper, tables in Inform hold values which have been organised into rows and columns. A table name is just a single value, identifying which table is meant - say, 'Table of US Presidents' might be a table name value. } @@ -275,7 +275,7 @@ builtin constructor RULE_TY { documentation-reference: kind_rule index-default-value: the little-used do nothing rule - indexed-grey-if-empty: yes + indexed-grey-if-empty: no specification-text: One of many, many rules which determine what happens during play. Rules can be triggered by scenes beginning or ending, by certain actions, at certain times, or in the course of carrying out certain activities. } diff --git a/inform7/Internal/Inter/BasicInformKit/kit_metadata.json b/inform7/Internal/Inter/BasicInformKit/kit_metadata.json index d0840aea7..be5d18e98 100644 --- a/inform7/Internal/Inter/BasicInformKit/kit_metadata.json +++ b/inform7/Internal/Inter/BasicInformKit/kit_metadata.json @@ -2,7 +2,7 @@ "is": { "type": "kit", "title": "BasicInformKit", - "version": "10.2.0-beta+6W62" + "version": "10.2.0-beta+6W67" }, "needs": [ { "need": { diff --git a/inform7/Internal/Inter/CommandParserKit/kit_metadata.json b/inform7/Internal/Inter/CommandParserKit/kit_metadata.json index 6e3c60a97..6d6afb957 100644 --- a/inform7/Internal/Inter/CommandParserKit/kit_metadata.json +++ b/inform7/Internal/Inter/CommandParserKit/kit_metadata.json @@ -2,7 +2,7 @@ "is": { "type": "kit", "title": "CommandParserKit", - "version": "10.2.0-beta+6W62" + "version": "10.2.0-beta+6W67" }, "needs": [ { "need": { diff --git a/inform7/Internal/Inter/EnglishLanguageKit/kit_metadata.json b/inform7/Internal/Inter/EnglishLanguageKit/kit_metadata.json index d0c5e38ab..0ebf6a52d 100644 --- a/inform7/Internal/Inter/EnglishLanguageKit/kit_metadata.json +++ b/inform7/Internal/Inter/EnglishLanguageKit/kit_metadata.json @@ -2,7 +2,7 @@ "is": { "type": "kit", "title": "EnglishLanguageKit", - "version": "10.2.0-beta+6W62" + "version": "10.2.0-beta+6W67" }, "needs": [ { "need": { diff --git a/inform7/Internal/Inter/WorldModelKit/Sections/MapRouteFinding.i6t b/inform7/Internal/Inter/WorldModelKit/Sections/MapRouteFinding.i6t index 8c582b456..81e2792b5 100644 --- a/inform7/Internal/Inter/WorldModelKit/Sections/MapRouteFinding.i6t +++ b/inform7/Internal/Inter/WorldModelKit/Sections/MapRouteFinding.i6t @@ -81,9 +81,6 @@ by enumerating them in the property |room_index| and by the flags in the |DoorRoutingViable| array respectively. = -Constant NUM_DOORS = ICOUNT_DOOR; -Constant NUM_ROOMS = ICOUNT_ROOM; - Array DoorRoutingViable -> NUM_DOORS+1; Global map_has_changed = true; diff --git a/inform7/Internal/Inter/WorldModelKit/kit_metadata.json b/inform7/Internal/Inter/WorldModelKit/kit_metadata.json index cccba3d8a..98be09f91 100644 --- a/inform7/Internal/Inter/WorldModelKit/kit_metadata.json +++ b/inform7/Internal/Inter/WorldModelKit/kit_metadata.json @@ -2,7 +2,7 @@ "is": { "type": "kit", "title": "WorldModelKit", - "version": "10.2.0-beta+6W62" + "version": "10.2.0-beta+6W67" }, "needs": [ { "need": { diff --git a/inform7/Tests/Extensions/Araminta Intest/Directorial Testing-v2_7.i7xd/Materials/Inter/TestKit/Contents.w b/inform7/Tests/Extensions/Araminta Intest/Directorial Testing-v2_7.i7xd/Materials/Inter/TestKit/Contents.w new file mode 100644 index 000000000..51a2e0062 --- /dev/null +++ b/inform7/Tests/Extensions/Araminta Intest/Directorial Testing-v2_7.i7xd/Materials/Inter/TestKit/Contents.w @@ -0,0 +1,9 @@ +Title: TestKit +Author: Araminta Intest +Purpose: Testing. +Language: Inform 6 +Licence: Artistic License 2.0 +Web Syntax Version: 2 + +Sections + Test diff --git a/inform7/Tests/Extensions/Araminta Intest/Directorial Testing-v2_7.i7xd/Materials/Inter/TestKit/Sections/Test.i6t b/inform7/Tests/Extensions/Araminta Intest/Directorial Testing-v2_7.i7xd/Materials/Inter/TestKit/Sections/Test.i6t new file mode 100644 index 000000000..47abf44e3 --- /dev/null +++ b/inform7/Tests/Extensions/Araminta Intest/Directorial Testing-v2_7.i7xd/Materials/Inter/TestKit/Sections/Test.i6t @@ -0,0 +1,13 @@ +Test Template. + +Stuff. + +@h Misc. + += +Constant TEST_TEMPLATE_CONSTANT = 13; + +[ TestFunction; + print "The red is ", RED_COL, "^"; + print "The mauve is ", MAUVE_COL, "^"; +]; diff --git a/inform7/Tests/Extensions/Araminta Intest/Directorial Testing-v2_7.i7xd/Materials/Inter/TestKit/kinds/Testy.neptune b/inform7/Tests/Extensions/Araminta Intest/Directorial Testing-v2_7.i7xd/Materials/Inter/TestKit/kinds/Testy.neptune new file mode 100644 index 000000000..d7051161f --- /dev/null +++ b/inform7/Tests/Extensions/Araminta Intest/Directorial Testing-v2_7.i7xd/Materials/Inter/TestKit/kinds/Testy.neptune @@ -0,0 +1,9 @@ +new base COLOUR_TY { + conforms-to: ENUMERATED_VALUE_TY + singular: colour + plural: colours + + instance: red = RED_COL = 7 + instance: purple = PURPLE_COL = $1f + instance: chartreusey lavender = MAUVE_COL = $$1100101 +} diff --git a/inform7/Tests/Extensions/Araminta Intest/Directorial Testing-v2_7.i7xd/Materials/Inter/TestKit/kit_metadata.json b/inform7/Tests/Extensions/Araminta Intest/Directorial Testing-v2_7.i7xd/Materials/Inter/TestKit/kit_metadata.json new file mode 100644 index 000000000..f196a4c90 --- /dev/null +++ b/inform7/Tests/Extensions/Araminta Intest/Directorial Testing-v2_7.i7xd/Materials/Inter/TestKit/kit_metadata.json @@ -0,0 +1,9 @@ +{ + "is": { + "type": "kit", + "title": "TestKit" + }, + "kit-details": { + "provides-kinds": [ "Testy.neptune" ] + } +} \ No newline at end of file diff --git a/inform7/Tests/Extensions/Araminta Intest/Directorial Testing-v2_7.i7xd/Source/Directorial Testing.i7x b/inform7/Tests/Extensions/Araminta Intest/Directorial Testing-v2_7.i7xd/Source/Directorial Testing.i7x new file mode 100644 index 000000000..9a696d569 --- /dev/null +++ b/inform7/Tests/Extensions/Araminta Intest/Directorial Testing-v2_7.i7xd/Source/Directorial Testing.i7x @@ -0,0 +1,6 @@ +Version 2.7 of Directorial Testing by Araminta Intest begins here. + +When play begins: + say "This rule originated from the extension source." + +Directorial Testing ends here. diff --git a/inform7/Tests/Extensions/Araminta Intest/Directorial Testing-v2_7.i7xd/extension_metadata.json b/inform7/Tests/Extensions/Araminta Intest/Directorial Testing-v2_7.i7xd/extension_metadata.json new file mode 100644 index 000000000..3c0e64089 --- /dev/null +++ b/inform7/Tests/Extensions/Araminta Intest/Directorial Testing-v2_7.i7xd/extension_metadata.json @@ -0,0 +1,14 @@ +{ + "is": { + "type": "extension", + "title": "Directorial Testing", + "author": "Araminta Intest", + "version": "2.7" + }, + "needs": [ { + "need": { + "type": "kit", + "title": "TestKit" + } + } ] +} \ No newline at end of file diff --git a/inform7/Tests/Test Cases/KitEnumerations.txt b/inform7/Tests/Test Cases/KitEnumerations.txt new file mode 100644 index 000000000..61308dc9f --- /dev/null +++ b/inform7/Tests/Test Cases/KitEnumerations.txt @@ -0,0 +1,45 @@ +Include Directorial Testing by Araminta Intest. + +Laboratory is a room. + +A room has a colour called colour scheme. + +After looking: say "The wallpaper has a somewhat [colour scheme of the location] tint." + +Definition: A colour (called C) is valid if the sequence number of C is not 0. + +When play begins: + say "This is an uninitialised colour variable - "; + let C be a colour; + showme C; + say "Iterating..."; + repeat with D running through colours: + showme D; + showme the colour after D; + showme the colour before D; + showme the sequence number of D; + showme the numerical value of D; + showme whether or not D is valid; + say "Done."; + say "Now for a limited-span repeat..."; + repeat with D running from red to purple: + showme D; + say "Done."; + showme the list of colours; + showme the first value of colour; + showme the last value of colour; + showme the colour scheme of the Laboratory; + say "This tests bracket-plus..."; + test out bracket-plus; + say "Now for some random values..."; + repeat with N running from 1 to 100: + say "[a random colour]; "; + say "... enough!"; + repeat with N running from 1 to 100: + say "[a random colour from red to purple]; "; + say "... enough!"; + +To test out bracket-plus: (- + TestFunction(); + print MAUVE_COL, " = ", (+ chartreusey lavender +), "^"; +-). diff --git a/inform7/Tests/Test Cases/RuleSubstitutions.txt b/inform7/Tests/Test Cases/RuleSubstitutions.txt new file mode 100644 index 000000000..678104600 --- /dev/null +++ b/inform7/Tests/Test Cases/RuleSubstitutions.txt @@ -0,0 +1,16 @@ +Lab is a room. +The box is in the Lab. + +Before doing anything when the player does not carry the box (this is the yow rule): say "yow." + +This is the zow rule: say "zow.". + +Every turn (this is the kow rule): say "kow." + +This is the pow rule: say "pow." + +The zow rule substitutes for the yow rule when the player carries the box. + +The pow rule substitutes for the kow rule. + +Test me with "z / get box / z / drop box / z". diff --git a/inform7/Tests/Test Cases/_Results_Ideal/KitEnumerations.txt b/inform7/Tests/Test Cases/_Results_Ideal/KitEnumerations.txt new file mode 100644 index 000000000..d5f0791ea --- /dev/null +++ b/inform7/Tests/Test Cases/_Results_Ideal/KitEnumerations.txt @@ -0,0 +1,50 @@ + Laboratory + This rule originated from the extension source. + + This is an uninitialised colour variable - "C" = colour: red + Iterating... + "D" = colour: red + "colour after D" = colour: purple + "colour before D" = colour: chartreusey lavender + "sequence number of D" = number: 1 + "numerical value of D" = number: 7 + "whether or not D is valid" = truth state: true + "D" = colour: purple + "colour after D" = colour: chartreusey lavender + "colour before D" = colour: red + "sequence number of D" = number: 2 + "numerical value of D" = number: 31 + "whether or not D is valid" = truth state: true + "D" = colour: chartreusey lavender + "colour after D" = colour: red + "colour before D" = colour: purple + "sequence number of D" = number: 3 + "numerical value of D" = number: 101 + "whether or not D is valid" = truth state: true + Done. + Now for a limited-span repeat... + "D" = colour: red + "D" = colour: purple + Done. + "list of colours" = list of colours: {red, purple, chartreusey lavender} + "first value of colour" = colour: red + "last value of colour" = colour: chartreusey lavender + "colour scheme of the Laboratory" = colour: red + This tests bracket-plus... + The red is 7 + The mauve is 101 + 101 = 101 + Now for some random values... + purple; purple; chartreusey lavender; purple; red; red; chartreusey lavender; purple; chartreusey lavender; red; purple; chartreusey lavender; chartreusey lavender; purple; chartreusey lavender; red; purple; purple; red; purple; red; chartreusey lavender; purple; chartreusey lavender; chartreusey lavender; chartreusey lavender; purple; red; red; red; purple; purple; purple; red; purple; chartreusey lavender; red; purple; purple; purple; chartreusey lavender; purple; chartreusey lavender; chartreusey lavender; red; purple; red; red; red; red; chartreusey lavender; purple; purple; chartreusey lavender; purple; purple; chartreusey lavender; red; red; purple; purple; chartreusey lavender; chartreusey lavender; red; red; red; red; red; red; purple; red; chartreusey lavender; purple; red; purple; red; chartreusey lavender; purple; purple; chartreusey lavender; red; red; chartreusey lavender; chartreusey lavender; chartreusey lavender; chartreusey lavender; purple; purple; purple; purple; + chartreusey lavender; chartreusey lavender; purple; red; red; red; purple; chartreusey lavender; red; red; ... enough! + red; purple; red; purple; red; red; purple; red; purple; purple; red; red; purple; red; purple; purple; red; purple; red; red; purple; red; red; purple; purple; purple; purple; red; red; purple; red; purple; red; red; red; red; purple; purple; red; red; purple; purple; red; purple; purple; purple; purple; red; purple; purple; purple; red; red; red; purple; red; red; purple; purple; purple; purple; purple; red; red; purple; red; red; purple; purple; red; red; purple; red; red; purple; red; purple; purple; red; red; purple; red; red; red; purple; red; purple; red; purple; red; red; purple; red; purple; purple; purple; red; purple; purple; purple; ... enough! + + Welcome + An Interactive Fiction + Release 1 / Serial number 160428 / Inform 7 v10.2.0 / D + + Laboratory + The wallpaper has a somewhat red tint. + +> > Laboratory +> Are you sure you want to quit? \ No newline at end of file diff --git a/inform7/Tests/Test Cases/_Results_Ideal/RuleSubstitutions.txt b/inform7/Tests/Test Cases/_Results_Ideal/RuleSubstitutions.txt new file mode 100644 index 000000000..d458d296f --- /dev/null +++ b/inform7/Tests/Test Cases/_Results_Ideal/RuleSubstitutions.txt @@ -0,0 +1,49 @@ + Lab + Welcome + An Interactive Fiction + Release 1 / Serial number 160428 / Inform 7 v10.2.0 / D + + yow. + + Lab + You can see a box here. + +> > Lab + (Testing.) + + >[1] z + yow. + + Time passes. + + pow. + + >[2] get box + yow. + + Taken. + + pow. + + >[3] z + zow. + + Time passes. + + pow. + + >[4] drop box + zow. + + Dropped. + + pow. + + >[5] z + yow. + + Time passes. + + pow. + +> > \ No newline at end of file diff --git a/inform7/Tests/Test Internals/_Results_Ideal/Index-Chart.txt b/inform7/Tests/Test Internals/_Results_Ideal/Index-Chart.txt index 21ec18af9..38767a3c0 100644 --- a/inform7/Tests/Test Internals/_Results_Ideal/Index-Chart.txt +++ b/inform7/Tests/Test Internals/_Results_Ideal/Index-Chart.txt @@ -76,7 +76,7 @@ - object [15]      + object [15]      north  @@ -370,7 +370,7 @@ - number        + number        0  @@ -387,7 +387,7 @@ - real number        + real number        0  @@ -404,7 +404,7 @@ - time        + time        9:00 AM  @@ -421,7 +421,7 @@ - truth state       + truth state       false  @@ -438,7 +438,7 @@ - text      + text      ""  @@ -455,7 +455,7 @@ - snippet       + snippet       word 1 of command  @@ -472,7 +472,7 @@ - unicode character      + unicode character      unicode 32 (a space)  @@ -489,7 +489,7 @@ - action       + action       waiting  @@ -506,7 +506,7 @@ - scene  [1]      + scene  [1]      Entire Game  @@ -523,7 +523,7 @@ - command parser error [25]      + command parser error [25]      didn't understand error  @@ -540,7 +540,7 @@ - dynasty  [4]      + dynasty  [4]      Stuart  @@ -557,7 +557,7 @@ - use option      + use option      the ineffectual option  @@ -574,7 +574,7 @@ - response      + response      ?  @@ -591,7 +591,7 @@ - verb       + verb       verb be  @@ -608,7 +608,7 @@ - table name       + table name       a table with no rows or columns  @@ -625,7 +625,7 @@ - equation name      + equation name      an equation doing nothing  @@ -642,7 +642,7 @@ - rulebook outcome      + rulebook outcome      allow access  @@ -659,7 +659,7 @@ - external file       + external file       a non-file  @@ -676,7 +676,7 @@ - internal file      + internal file      a non-file  @@ -693,7 +693,7 @@ - action name       + action name       waiting action  @@ -710,7 +710,7 @@ - figure name  [1]      + figure name  [1]      Figure of cover  @@ -727,7 +727,7 @@ - sound name       + sound name       a silent non-sound  @@ -749,7 +749,7 @@ - natural language [1]      + natural language [1]      English language  @@ -766,7 +766,7 @@ - grammatical tense  [5]      + grammatical tense  [5]      present tense  @@ -783,7 +783,7 @@ - narrative viewpoint  [6]      + narrative viewpoint  [6]      first person singular  @@ -800,7 +800,7 @@ - grammatical case  [2]      + grammatical case  [2]      nominative  @@ -817,7 +817,7 @@ - grammatical gender  [3]      + grammatical gender  [3]      neuter gender  @@ -861,7 +861,7 @@ - list of K       + list of K       { } @@ -869,7 +869,7 @@ - phrase K -> L      + phrase K -> L      always the default value of L @@ -877,7 +877,7 @@ - relation of K      + relation of K      a relation never holding @@ -885,7 +885,7 @@ - K based rule producing L       + K based rule producing L       the little-used do nothing rule @@ -893,7 +893,7 @@ - K based rulebook producing L       + K based rulebook producing L       the action-processing rules @@ -901,7 +901,7 @@ - activity on K       + activity on K       printing the name @@ -909,7 +909,7 @@ - description of K       + description of K       matching nothing @@ -917,7 +917,7 @@ - K valued property      + K valued property      -- @@ -925,7 +925,7 @@ - K valued table column      + K valued table column      -- diff --git a/inform7/Tests/Test Internals/_Results_Ideal/Index-Innards.txt b/inform7/Tests/Test Internals/_Results_Ideal/Index-Innards.txt index 12fa5d041..d92af215f 100644 --- a/inform7/Tests/Test Internals/_Results_Ideal/Index-Innards.txt +++ b/inform7/Tests/Test Internals/_Results_Ideal/Index-Innards.txt @@ -1,7 +1,7 @@ 1. In

    Story file format:  Inform6/16d/v8

    The following use options are in force:

    -

    Set from Basic Inform version 1 by Graham Nelson:

    +

    Set from Basic Inform version 2 by Graham Nelson:

    Use dynamic memory allocation

    Whereas these are not in force:

     ineffectual American dialect,  serial comma,  memory economy,  engineering notation,  printed engineering notation,  predictable randomisation,  numbered rules,  telemetry recordings,  no deprecated features,  command line echoing,  dictionary resolution,  no automatic plural synonyms,  maximum text length,  index figure thumbnails,  full-length room descriptions,  abbreviated room descriptions,  VERBOSE room descriptions,  BRIEF room descriptions,  SUPERBRIEF room descriptions,  no scoring,  scoring,  default route-finding,  fast route-finding,  slow route-finding,  maximum things understood at once,  manual pronouns,  undo prevention,  unabbreviated object names,

    diff --git a/inform7/Tests/Test Problems/_Results_Ideal/PM_HeadingInPlaceOfUnknown.txt b/inform7/Tests/Test Problems/_Results_Ideal/PM_HeadingInPlaceOfUnknown.txt index f1b92ef7e..73ee22781 100644 --- a/inform7/Tests/Test Problems/_Results_Ideal/PM_HeadingInPlaceOfUnknown.txt +++ b/inform7/Tests/Test Problems/_Results_Ideal/PM_HeadingInPlaceOfUnknown.txt @@ -1,13 +1,13 @@ -Inform 7.10.1 build 6Q21 has started. +Inform 7 v10.2.0 has started. I've now read your source text, which is 28 words long. -I've also read Basic Inform by Graham Nelson, which is 1603 words long. -I've also read Standard Rules by Graham Nelson, which is 41696 words long. -I've also read English Language by Graham Nelson, which is 2328 words long. +I've also read version 2 of Basic Inform by Graham Nelson, which is 7938 words long. +I've also read version 2 of English Language by Graham Nelson, which is 2330 words long. +I've also read version 7 of Standard Rules by Graham Nelson, which is 35035 words long. Problem__ PM_HeadingInPlaceOfUnknown >--> In the sentence 'Section of Minimal Grammar (in place of Section SR4/10 - Mythical Stuff in Standard Rules by Graham Nelson)' (source text, line 3), it looks as if you intend to replace a section of source text from the extension 'Standard Rules by Graham Nelson', but that extension does not seem to have any heading called 'Section SR4/10 - Mythical Stuff'. (The - version I loaded was 6.) -Inform 7 has finished: 10 centiseconds used. + version I loaded was 7.) +Inform 7 has finished. diff --git a/inform7/assertions-module/Chapter 6/Activities.w b/inform7/assertions-module/Chapter 6/Activities.w index 12db59308..6e9b25798 100644 --- a/inform7/assertions-module/Chapter 6/Activities.w +++ b/inform7/assertions-module/Chapter 6/Activities.w @@ -107,7 +107,6 @@ activity *Activities::new(kind *K, wording W) { av->after_rules = Activities::make_rulebook(av, 2); PluginCalls::new_activity_notify(av); - return av; } diff --git a/inform7/core-module/Chapter 1/How To Compile.w b/inform7/core-module/Chapter 1/How To Compile.w index 16d584ea2..15d9e31d6 100644 --- a/inform7/core-module/Chapter 1/How To Compile.w +++ b/inform7/core-module/Chapter 1/How To Compile.w @@ -131,6 +131,7 @@ so on. Those absolute basics are made here. BENCH(Task::make_built_in_kind_constructors); BENCH(BinaryPredicateFamilies::first_stock) BENCH(BootVerbs::make_built_in) + BENCH(Instances::make_instances_from_Neptune); @ = Task::advance_stage_to(SEMANTIC_ANALYSIS_CSEQ, I"Pre-pass through major nodes", @@ -197,6 +198,7 @@ here, which only happens when special runs are made for compiler testing. BENCH(RTUseOptions::compile) BENCH(RTCommandGrammars::compile_non_generic_constants) BENCH(Interventions::make_all) + BENCH(RTKindConstructors::assign_declaration_sequence_numbers) BENCH(RTKindConstructors::compile) BENCH(RTLiteralPatterns::compile) diff --git a/inform7/extensions/basic_inform/Contents.w b/inform7/extensions/basic_inform/Contents.w index 77ca1051f..fa67f8f0d 100644 --- a/inform7/extensions/basic_inform/Contents.w +++ b/inform7/extensions/basic_inform/Contents.w @@ -1,7 +1,7 @@ Title: basicinform Author: Graham Nelson Purpose: The Basic Inform extension, included in all projects. -Version Number: 1 +Version Number: 2 Language: Inform 7 Web Syntax Version: 2 Licence: Artistic License 2.0 diff --git a/inform7/extensions/basic_inform/Sections/Phrase Definitions.w b/inform7/extensions/basic_inform/Sections/Phrase Definitions.w index eee8571c1..4b0de23dd 100644 --- a/inform7/extensions/basic_inform/Sections/Phrase Definitions.w +++ b/inform7/extensions/basic_inform/Sections/Phrase Definitions.w @@ -820,7 +820,7 @@ To repeat with (loopvar - nonexisting K variable) To repeat with (loopvar - nonexisting K variable) running from (v - enumerated value of kind K) to (w - K) begin -- end loop (documented at ph_repeat): - (- for ({loopvar}={v}: {loopvar}<={w}: {loopvar}++) -). + (- for ({loopvar}={v}: {loopvar}<={w}: {loopvar}={-next-routine:K}({loopvar})) -). To repeat with (loopvar - nonexisting K variable) running through (OS - description of values of kind K) begin -- end loop (documented at ph_runthrough): @@ -915,6 +915,9 @@ Section 1 - Enumerations To decide which number is number of (S - description of values) (documented at ph_numberof): (- {-primitive-definition:number-of} -). +To decide what number is the numerical value of (X - enumerated value): (- {X} -). +To decide what number is the sequence number of (X - enumerated value of kind K): + (- {-indexing-routine:K}({X}) -). To decide which K is (name of kind of enumerated value K) after (X - K) (documented at ph_enumafter): (- {-next-routine:K}({X}) -). diff --git a/inform7/extensions/standard_rules/Contents.w b/inform7/extensions/standard_rules/Contents.w index 3989de8d7..3882b4090 100644 --- a/inform7/extensions/standard_rules/Contents.w +++ b/inform7/extensions/standard_rules/Contents.w @@ -1,7 +1,7 @@ Title: srules Author: Graham Nelson Purpose: The Standard Rules extension, included in all interactive fiction projects. -Version Number: 6 +Version Number: 7 Language: Inform 7 Web Syntax Version: 2 Licence: Artistic License 2.0 diff --git a/inform7/if-module/Chapter 4/Action Name Lists.w b/inform7/if-module/Chapter 4/Action Name Lists.w index ff41c555f..68ef03030 100644 --- a/inform7/if-module/Chapter 4/Action Name Lists.w +++ b/inform7/if-module/Chapter 4/Action Name Lists.w @@ -373,6 +373,7 @@ anl_parsing_data ActionNameLists::new_parsing_data(int at) { anl_parsing_data parsing_data; parsing_data.anl_clauses = NULL; parsing_data.abbreviation_level = 0; + parsing_data.word_position = -1; return parsing_data; } diff --git a/inform7/if-module/Chapter 5/Command Grammar Tokens.w b/inform7/if-module/Chapter 5/Command Grammar Tokens.w index 13c3ca2fc..99c7c5868 100644 --- a/inform7/if-module/Chapter 5/Command Grammar Tokens.w +++ b/inform7/if-module/Chapter 5/Command Grammar Tokens.w @@ -540,7 +540,7 @@ be a description which is true or false for any given value, so: if ((K_understanding) && (Kinds::Behaviour::is_object(K) == FALSE) && (Kinds::eq(K, K_understanding) == FALSE) && - (RTKindConstructors::request_I6_GPR(K) == FALSE)) { + (Kinds::Behaviour::is_understandable(K) == FALSE)) { Problems::quote_source(1, current_sentence); Problems::quote_wording(2, CGTokens::text(cgt)); StandardProblems::handmade_problem(Task::syntax_tree(), _p_(PM_UnparsableKind)); diff --git a/inform7/if-module/Chapter 5/Parsing Plugin.w b/inform7/if-module/Chapter 5/Parsing Plugin.w index a0e283b77..204eaa277 100644 --- a/inform7/if-module/Chapter 5/Parsing Plugin.w +++ b/inform7/if-module/Chapter 5/Parsing Plugin.w @@ -19,6 +19,7 @@ void ParsingPlugin::start(void) { PluginCalls::plug(COMPLETE_MODEL_PLUG, ParsingPlugin::complete_model); RTLiteralPatterns::enable_parsing(); + RTKindConstructors::enable_parsing(); } @ This will also need extensive amounts of run-time code, and the sequence diff --git a/inform7/if-module/Chapter 5/Understand Sentences.w b/inform7/if-module/Chapter 5/Understand Sentences.w index f82af21ee..cb1b8e70c 100644 --- a/inform7/if-module/Chapter 5/Understand Sentences.w +++ b/inform7/if-module/Chapter 5/Understand Sentences.w @@ -594,11 +594,12 @@ void Understand::property_block(property *pr, int level, inference_subject *subj "and this refers to something which is not an object."); return; } + kind *PK = ValueProperties::kind(pr); if ((Properties::is_either_or(pr) == FALSE) && - (Str::len(RTKindConstructors::get_recognition_only_GPR(ValueProperties::kind(pr))) == 0) && - ((Kinds::Behaviour::is_object(ValueProperties::kind(pr))) || - (RTKindConstructors::request_I6_GPR(ValueProperties::kind(pr)) == FALSE))) { - if (Kinds::Behaviour::is_object(ValueProperties::kind(pr))) + (RTKindConstructors::recognition_only_GPR_provided_by_kit(PK) == FALSE) && + ((Kinds::Behaviour::is_object(PK)) || + (Kinds::Behaviour::is_understandable(PK) == FALSE))) { + if (Kinds::Behaviour::is_object(PK)) StandardProblems::sentence_problem(Task::syntax_tree(), _p_(PM_ThingReferringProperty), "the value of that property is itself a kind of object", @@ -804,7 +805,7 @@ void Understand::text_block(wording W, understanding_reference *ur) { "make sense."); return; } - if (RTKindConstructors::request_I6_GPR(K) == FALSE) { + if (Kinds::Behaviour::is_understandable(K) == FALSE) { StandardProblems::sentence_problem(Task::syntax_tree(), _p_(PM_UnderstandAsBadValue), "'understand ... as ...' gives text meaning a value whose kind " diff --git a/inform7/imperative-module/Chapter 2/Compile Lvalues.w b/inform7/imperative-module/Chapter 2/Compile Lvalues.w index 09d7dbaf3..169465757 100644 --- a/inform7/imperative-module/Chapter 2/Compile Lvalues.w +++ b/inform7/imperative-module/Chapter 2/Compile Lvalues.w @@ -46,7 +46,6 @@ void CompileLvalues::compile_in_mode(value_holster *VH, parse_node *spec_found, local_variable *lvar = Node::get_constant_local_variable(spec_found); inter_symbol *lvar_s = LocalVariables::declare(lvar); if (lvar == NULL) { - LOG("Bad: %08x\n", spec_found); internal_error("Compiled never-specified LOCAL VARIABLE SP"); } EmitCode::val_symbol(K_value, lvar_s); diff --git a/inform7/imperative-module/Chapter 2/Compile Rvalues.w b/inform7/imperative-module/Chapter 2/Compile Rvalues.w index 932646ef3..1ae953f3d 100644 --- a/inform7/imperative-module/Chapter 2/Compile Rvalues.w +++ b/inform7/imperative-module/Chapter 2/Compile Rvalues.w @@ -14,6 +14,8 @@ void CompileRvalues::compile(value_holster *VH, parse_node *value) { case CONSTANT_NT: { kind *kind_of_constant = Node::get_kind_of_value(value); int ccm = Kinds::Behaviour::get_constant_compilation_method(kind_of_constant); + if ((ccm == NONE_CCM) && (Kinds::Behaviour::is_an_enumeration(kind_of_constant))) + ccm = NAMED_CONSTANT_CCM; switch(ccm) { case NONE_CCM: /* constant values of this kind cannot exist */ LOG("SP: $P; kind: %u\n", value, kind_of_constant); diff --git a/inform7/imperative-module/Chapter 3/Stack Frames.w b/inform7/imperative-module/Chapter 3/Stack Frames.w index 5c23a1949..2eb6d043f 100644 --- a/inform7/imperative-module/Chapter 3/Stack Frames.w +++ b/inform7/imperative-module/Chapter 3/Stack Frames.w @@ -413,7 +413,7 @@ void Frames::emit_new_local_value(kind *K) { void Frames::log(stack_frame *frame) { if (frame == NULL) { LOG("\n"); return; } LOG("Stack frame at %08x: it:%s, dpc:%s\n", - frame, + (unsigned int)(pointer_sized_int)frame, (frame->local_variables.it_variable_exists)?"yes":"no", (frame->determines_past_conditions)?"yes":"no"); local_variable *lvar; diff --git a/inform7/imperative-module/Chapter 4/Compile Loops.w b/inform7/imperative-module/Chapter 4/Compile Loops.w index 82b8909bf..96cdac6ae 100644 --- a/inform7/imperative-module/Chapter 4/Compile Loops.w +++ b/inform7/imperative-module/Chapter 4/Compile Loops.w @@ -229,9 +229,16 @@ int CompileLoops::schema(i6_schema *sch, kind *K) { return TRUE; } if (Kinds::Behaviour::is_an_enumeration(K)) { - Calculus::Schemas::modify(sch, - "for (*1=1: *1<=%d: *1++)", - RTKindConstructors::get_highest_valid_value_as_integer(K)); + if (RTKindConstructors::is_nonstandard_enumeration(K)) { + inter_name *lname = RTKindConstructors::instances_array_iname(K); + Calculus::Schemas::modify(sch, + "for (*2=1, *1=%n-->*2: *2<=%d: *2++, *1=%n-->*2)", + lname, RTKindConstructors::enumeration_size(K), lname); + } else { + Calculus::Schemas::modify(sch, + "for (*1=1: *1<=%d: *1++)", + RTKindConstructors::enumeration_size(K)); + } return TRUE; } text_stream *p = K->construct->loop_domain_schema; diff --git a/inform7/imperative-module/Chapter 4/Compile Propositions.w b/inform7/imperative-module/Chapter 4/Compile Propositions.w index 342f0a8ac..75d0c768e 100644 --- a/inform7/imperative-module/Chapter 4/Compile Propositions.w +++ b/inform7/imperative-module/Chapter 4/Compile Propositions.w @@ -243,7 +243,7 @@ void CompilePropositions::to_random_match(parse_node *desc) { EmitCode::inv(INDIRECT0_BIP); EmitCode::down(); EmitCode::val_iname(K_value, - RTKindConstructors::get_ranger_iname(K)); + RTKindConstructors::random_value_fn_iname(K)); EmitCode::up(); return; } diff --git a/inform7/imperative-module/Chapter 4/Compile Schemas.w b/inform7/imperative-module/Chapter 4/Compile Schemas.w index 3e93d38b4..724c97032 100644 --- a/inform7/imperative-module/Chapter 4/Compile Schemas.w +++ b/inform7/imperative-module/Chapter 4/Compile Schemas.w @@ -177,7 +177,7 @@ void CompileSchemas::compile_term_of_token(pcalc_term *pt, int m, kind *cast_to, @ = inter_name *cr; if (pt->term_checked_as_kind) - cr = RTKindConstructors::get_comparison_fn_iname(pt->term_checked_as_kind->construct); + cr = RTKindConstructors::comparison_fn_iname(pt->term_checked_as_kind); else cr = Hierarchy::find(SIGNEDCOMPARE_HL); EmitCode::val_iname(K_value, cr); diff --git a/inform7/imperative-module/Chapter 5/Compile Invocations Inline.w b/inform7/imperative-module/Chapter 5/Compile Invocations Inline.w index dfe3096ff..bf0f800b4 100644 --- a/inform7/imperative-module/Chapter 5/Compile Invocations Inline.w +++ b/inform7/imperative-module/Chapter 5/Compile Invocations Inline.w @@ -667,6 +667,7 @@ We'll start with a suite of details about kinds: if (C == new_list_of_ISINC) @; if (C == printing_routine_ISINC) @; if (C == ranger_routine_ISINC) @; + if (C == indexing_routine_ISINC) @; if (C == next_routine_ISINC) @; if (C == previous_routine_ISINC) @; if (C == strong_kind_ISINC) @; @@ -714,21 +715,21 @@ proposition. @ = kind *K = CSIInline::parse_bracing_operand_as_kind(ist->operand, Node::get_kind_variable_declarations(inv)); - if (K) EmitCode::val_iname(K_value, RTKindConstructors::get_inc_iname(K)); + if (K) EmitCode::val_iname(K_value, RTKindConstructors::increment_fn_iname(K)); else @; return; @ = kind *K = CSIInline::parse_bracing_operand_as_kind(ist->operand, Node::get_kind_variable_declarations(inv)); - if (K) EmitCode::val_iname(K_value, RTKindConstructors::get_dec_iname(K)); + if (K) EmitCode::val_iname(K_value, RTKindConstructors::decrement_fn_iname(K)); else @; return; @ = kind *K = CSIInline::parse_bracing_operand_as_kind(ist->operand, Node::get_kind_variable_declarations(inv)); - if (K) EmitCode::val_iname(K_value, RTKindConstructors::get_iname(K)); + if (K) EmitCode::val_iname(K_value, RTKindConstructors::printing_fn_iname(K)); else @; return; @@ -738,7 +739,14 @@ proposition. if ((Kinds::eq(K, K_number)) || (Kinds::eq(K, K_time))) EmitCode::val_iname(K_value, Hierarchy::find(GENERATERANDOMNUMBER_HL)); - else if (K) EmitCode::val_iname(K_value, RTKindConstructors::get_ranger_iname(K)); + else if (K) EmitCode::val_iname(K_value, RTKindConstructors::random_value_fn_iname(K)); + else @; + return; + +@ = + kind *K = CSIInline::parse_bracing_operand_as_kind(ist->operand, + Node::get_kind_variable_declarations(inv)); + if (K) EmitCode::val_iname(K_value, RTKindConstructors::indexing_fn_iname(K)); else @; return; @@ -1271,7 +1279,7 @@ result would be the same without the optimisation. if (Kinds::eq(K, K_number)) @; if (Kinds::eq(K, K_unicode_character)) @; if (K) { - EmitCode::call(RTKindConstructors::get_iname(K)); + EmitCode::call(RTKindConstructors::printing_fn_iname(K)); EmitCode::down(); CompileValues::to_code_val_of_kind(to_say, K); EmitCode::up(); @@ -1293,7 +1301,7 @@ result would be the same without the optimisation. EmitCode::up(); } else { kind *K = Specifications::to_kind(to_say); - EmitCode::call(RTKindConstructors::get_iname(K)); + EmitCode::call(RTKindConstructors::printing_fn_iname(K)); EmitCode::down(); CompileValues::to_code_val_of_kind(to_say, K); EmitCode::up(); @@ -1796,7 +1804,7 @@ void CSIInline::emit_showme(parse_node *spec) { EmitCode::val_number(1); EmitCode::up(); } else { - EmitCode::call(RTKindConstructors::get_iname(K)); + EmitCode::call(RTKindConstructors::printing_fn_iname(K)); EmitCode::down(); CompileValues::to_code_val(spec); EmitCode::up(); diff --git a/inform7/inform7.giscript b/inform7/inform7.giscript index 10e0eaf9c..6f5696d92 100644 --- a/inform7/inform7.giscript +++ b/inform7/inform7.giscript @@ -54,6 +54,7 @@ Tests/Test Problems/_Results_Actual/ Tests/Test Filings/_Results_Actual/ Tests/Documentation/ +**/*.interb Internal/Inter/Architecture16Kit/*.interb Internal/Inter/Architecture32Kit/*.interb Internal/Inter/BasicInformKit/*.interb diff --git a/inform7/knowledge-module/Chapter 2/Instances.w b/inform7/knowledge-module/Chapter 2/Instances.w index 1142fe287..b83bed307 100644 --- a/inform7/knowledge-module/Chapter 2/Instances.w +++ b/inform7/knowledge-module/Chapter 2/Instances.w @@ -342,6 +342,45 @@ void Instances::new_grammatical(instance *I) { grammatical_genders[no_ggs_recorded++] = I; } +@h Instances specified in Neptune files. + += +void Instances::make_instances_from_Neptune(void) { + kind_constructor *kc; + LOOP_OVER(kc, kind_constructor) { + linked_list *L = KindConstructors::instances(kc); + kind_constructor_instance *kci; + inter_ti current_val = 1; + int first_val = TRUE; + LOOP_OVER_LINKED_LIST(kci, kind_constructor_instance, L) { + wording W = Feeds::feed_text(kci->natural_language_name); + kind *K = Kinds::base_construction(kc); + pcalc_prop *prop = Propositions::Abstract::to_create_something(K, W); + Assert::true(prop, CERTAIN_CE); + instance *I = Instances::latest(); + if (kci->value_specified) { + if ((current_val >= (inter_ti) kci->value) && (first_val == FALSE)) { + Problems::quote_object(1, I); + Problems::quote_kind(2, K); + StandardProblems::handmade_problem(Task::syntax_tree(), _p_(Untestable)); + Problems::issue_problem_segment( + "A kit defined an instance %1 of a kind called %2, but this " + "has a numerical value which is equal to or greater than that " + "of its predecessor. Instances in a kit have to be defined " + "in evaluation order."); + Problems::issue_problem_end(); + } + current_val = (inter_ti) kci->value; + } + RTKindConstructors::set_explicit_runtime_instance_value(K, I, current_val); + RTInstances::set_translation(I, kci->identifier); + // LOG("From kit: %W = %S = %d -> $O\n", W, kci->identifier, current_val, I); + current_val++; + first_val = FALSE; + } + } +} + @h Logging. = diff --git a/inform7/knowledge-module/Chapter 4/Kind Subjects.w b/inform7/knowledge-module/Chapter 4/Kind Subjects.w index 014f54d59..6690e088e 100644 --- a/inform7/knowledge-module/Chapter 4/Kind Subjects.w +++ b/inform7/knowledge-module/Chapter 4/Kind Subjects.w @@ -112,6 +112,12 @@ concerning our kind. = void KindSubjects::new_permission_granted(inference_subject_family *f, inference_subject *from, property_permission *pp) { + kind *K = KindSubjects::to_kind(from); + if (RTKindConstructors::is_nonstandard_enumeration(K)) + StandardProblems::sentence_problem(Task::syntax_tree(), + _p_(Untestable), + "this kind cannot have properties", + "since it is an enumeration provided by a kit."); RTPropertyPermissions::new_storage(pp); } diff --git a/inform7/runtime-module/Chapter 2/Emit.w b/inform7/runtime-module/Chapter 2/Emit.w index e84827637..5e937c15f 100644 --- a/inform7/runtime-module/Chapter 2/Emit.w +++ b/inform7/runtime-module/Chapter 2/Emit.w @@ -259,10 +259,10 @@ void Emit::named_generic_constant(inter_name *con_iname, inter_pair val) { @h Instances. = -void Emit::instance(inter_name *inst_iname, kind *K, int v) { +void Emit::instance(inter_name *inst_iname, kind *K, inter_ti v, int has_value) { packaging_state save = Packaging::enter_home_of(inst_iname); inter_symbol *inst_s = InterNames::to_symbol(inst_iname); - inter_pair val = v ? InterValuePairs::number((inter_ti) v) : InterValuePairs::undef(); + inter_pair val = has_value ? InterValuePairs::number(v) : InterValuePairs::undef(); Produce::guard(InstanceInstruction::new(Emit::at(), inst_s, Produce::kind_to_symbol(K), val, Emit::baseline(), NULL)); Packaging::exit(Emit::tree(), save); diff --git a/inform7/runtime-module/Chapter 2/Hierarchy.w b/inform7/runtime-module/Chapter 2/Hierarchy.w index 26d77c90f..2ae1bd4e9 100644 --- a/inform7/runtime-module/Chapter 2/Hierarchy.w +++ b/inform7/runtime-module/Chapter 2/Hierarchy.w @@ -1177,6 +1177,7 @@ void Hierarchy::establish(void) { @e KIND_INDEX_PLURAL_MD_HL @e KIND_SHOWME_MD_HL @e KIND_IS_BASE_MD_HL +@e KIND_IS_PROPER_MD_HL @e KIND_IS_QUASINUMERICAL_MD_HL @e KIND_IS_DEF_MD_HL @e KIND_IS_OBJECT_MD_HL @@ -1209,7 +1210,9 @@ void Hierarchy::establish(void) { @e WEAK_ID_HL @e ICOUNT_HL @e FWMATRIX_SIZE_HL -@e ILIST_HL +@e NUM_DOORS_HL +@e NUM_ROOMS_HL +@e ENUMERATION_ARRAY_MD_HL @e KIND_XREF_SYMBOL_HL @e DECREMENT_FN_HL @e INCREMENT_FN_HL @@ -1217,24 +1220,26 @@ void Hierarchy::establish(void) { @e PRINT_DASH_FN_HL @e MKDEF_FN_HL @e RANGER_FN_HL +@e INDEXING_FN_HL @e DEFAULT_CLOSURE_FN_HL @e GPR_FN_HL @e SHOWME_FN_HL @e INSTANCE_GPR_FN_HL @e INSTANCE_LIST_HL @e FIRST_INSTANCE_HL +@e INSTANCES_ARRAY_HL @e NEXT_INSTANCE_HL -@e COUNT_INSTANCE_1_HL -@e COUNT_INSTANCE_2_HL -@e COUNT_INSTANCE_3_HL -@e COUNT_INSTANCE_4_HL -@e COUNT_INSTANCE_5_HL -@e COUNT_INSTANCE_6_HL -@e COUNT_INSTANCE_7_HL -@e COUNT_INSTANCE_8_HL -@e COUNT_INSTANCE_9_HL -@e COUNT_INSTANCE_10_HL -@e COUNT_INSTANCE_HL +@e BASE_IK_1_HL +@e BASE_IK_2_HL +@e BASE_IK_3_HL +@e BASE_IK_4_HL +@e BASE_IK_5_HL +@e BASE_IK_6_HL +@e BASE_IK_7_HL +@e BASE_IK_8_HL +@e BASE_IK_9_HL +@e BASE_IK_10_HL +@e BASE_IK_HL @e KIND_INLINE_PROPERTIES_HAP @e KIND_INLINE_PROPERTY_HL @e KIND_PROPERTIES_HAP @@ -1248,7 +1253,6 @@ void Hierarchy::establish(void) { @e DK_KIND_HL @e DK_DEFAULT_VALUE_HL -@e KIND_USAGE_HAP @e KIND_CLASS_HL @e MULTIPLICATION_RULE_HAP @@ -1286,6 +1290,7 @@ void Hierarchy::establish(void) { H_C_U(KIND_INDEX_VARIANCE_MD_HL, I"^variance") H_C_U(KIND_SHOWME_MD_HL, I"^showme_fn") H_C_U(KIND_IS_BASE_MD_HL, I"^is_base") + H_C_U(KIND_IS_PROPER_MD_HL, I"^is_proper") H_C_U(KIND_IS_QUASINUMERICAL_MD_HL, I"^is_quasinumerical") H_C_U(KIND_IS_DEF_MD_HL, I"^is_definite") H_C_U(KIND_IS_OBJECT_MD_HL, I"^is_object") @@ -1317,8 +1322,10 @@ void Hierarchy::establish(void) { H_C_U(KIND_INFERENCES_MD_HL, I"^inferences") H_C_I(WEAK_ID_HL) H_C_I(ICOUNT_HL) - H_C_I(ILIST_HL) + H_C_U(ENUMERATION_ARRAY_MD_HL, I"^enumeration_array") H_C_U(FWMATRIX_SIZE_HL, I"FWMATRIX_SIZE") + H_C_U(NUM_DOORS_HL, I"NUM_DOORS") + H_C_U(NUM_ROOMS_HL, I"NUM_ROOMS") H_C_U(KIND_XREF_SYMBOL_HL, I"kind_ref") H_F_U(MKDEF_FN_HL, I"mkdef_fn") H_F_U(DECREMENT_FN_HL, I"decrement_fn") @@ -1326,6 +1333,7 @@ void Hierarchy::establish(void) { H_F_U(PRINT_FN_HL, I"print_fn") H_F_G(PRINT_DASH_FN_HL, I"print_fn", I"E") H_F_U(RANGER_FN_HL, I"ranger_fn") + H_F_U(INDEXING_FN_HL, I"indexing_fn") H_F_U(DEFAULT_CLOSURE_FN_HL, I"default_closure_fn") H_F_U(GPR_FN_HL, I"gpr_fn") H_F_U(INSTANCE_GPR_FN_HL, I"instance_gpr_fn") @@ -1333,17 +1341,18 @@ void Hierarchy::establish(void) { H_F_U(SHOWME_FN_HL, I"showme_fn") H_C_S(FIRST_INSTANCE_HL, I"_First") H_C_S(NEXT_INSTANCE_HL, I"_Next") - H_C_T(COUNT_INSTANCE_1_HL, I"IK1_Count") - H_C_T(COUNT_INSTANCE_2_HL, I"IK2_Count") - H_C_T(COUNT_INSTANCE_3_HL, I"IK3_Count") - H_C_T(COUNT_INSTANCE_4_HL, I"IK4_Count") - H_C_T(COUNT_INSTANCE_5_HL, I"IK5_Count") - H_C_T(COUNT_INSTANCE_6_HL, I"IK6_Count") - H_C_T(COUNT_INSTANCE_7_HL, I"IK7_Count") - H_C_T(COUNT_INSTANCE_8_HL, I"IK8_Count") - H_C_T(COUNT_INSTANCE_9_HL, I"IK9_Count") - H_C_T(COUNT_INSTANCE_10_HL, I"IK10_Count") - H_C_S(COUNT_INSTANCE_HL, I"_Count") + H_C_S(INSTANCES_ARRAY_HL, I"_Array") + H_C_T(BASE_IK_1_HL, I"IK1_Count") + H_C_T(BASE_IK_2_HL, I"IK2_Count") + H_C_T(BASE_IK_3_HL, I"IK3_Count") + H_C_T(BASE_IK_4_HL, I"IK4_Count") + H_C_T(BASE_IK_5_HL, I"IK5_Count") + H_C_T(BASE_IK_6_HL, I"IK6_Count") + H_C_T(BASE_IK_7_HL, I"IK7_Count") + H_C_T(BASE_IK_8_HL, I"IK8_Count") + H_C_T(BASE_IK_9_HL, I"IK9_Count") + H_C_T(BASE_IK_10_HL, I"IK10_Count") + H_C_S(BASE_IK_HL, I"_Count") H_C_G(KIND_CLASS_HL, I"K") H_BEGIN_AP(KIND_INLINE_PROPERTIES_HAP, I"inline_property", I"_inline_property") H_C_U(KIND_INLINE_PROPERTY_HL, I"inline") @@ -1363,8 +1372,6 @@ void Hierarchy::establish(void) { H_END H_BEGIN(LocationRequirements::completion_submodule(I, kinds)) - H_BEGIN_AP(KIND_USAGE_HAP, I"kind_usage", I"_kind_usage") - H_END H_BEGIN_AP(MULTIPLICATION_RULE_HAP, I"multiplication_rule", I"_multiplication_rule") H_C_U(SET_AT_MD_HL, I"^at") H_C_U(LEFT_OPERAND_MD_HL, I"^left_operand") @@ -1958,36 +1965,12 @@ void Hierarchy::establish(void) { @e K_NUMBER_XPACKAGE @e K_TIME_XPACKAGE @e K_TRUTH_STATE_XPACKAGE -@e K_TABLE_XPACKAGE -@e K_FIGURE_NAME_XPACKAGE -@e K_SOUND_NAME_XPACKAGE -@e K_USE_OPTION_XPACKAGE -@e K_EXTERNAL_FILE_XPACKAGE -@e K_INTERNAL_FILE_XPACKAGE -@e K_RULEBOOK_OUTCOME_XPACKAGE -@e K_RESPONSE_XPACKAGE -@e K_SCENE_XPACKAGE -@e K_DIALOGUE_BEAT_XPACKAGE -@e K_DIALOGUE_LINE_XPACKAGE -@e K_DIALOGUE_CHOICE_XPACKAGE -@e K_PERFORMANCE_STYLE_XPACKAGE @e CAPSHORTNAME_HL @e DECIMAL_TOKEN_INNER_HL @e TIME_TOKEN_INNER_HL @e TRUTH_STATE_TOKEN_INNER_HL -@e PRINT_RULEBOOK_OUTCOME_HL -@e PRINT_FIGURE_NAME_HL -@e PRINT_SOUND_NAME_HL -@e PRINT_EXTERNAL_FILE_NAME_HL -@e PRINT_INTERNAL_FILE_NAME_HL -@e PRINT_SCENE_HL -@e PRINT_DIALOGUE_BEAT_HL -@e PRINT_DIALOGUE_LINE_HL -@e PRINT_DIALOGUE_CHOICE_HL -@e PRINT_PERFORMANCE_STYLE_HL - @ = H_BEGIN(LocationRequirements::this_exotic_package(K_OBJECT_XPACKAGE)) H_C_T(CAPSHORTNAME_HL, I"cap_short_name") @@ -2005,46 +1988,6 @@ void Hierarchy::establish(void) { H_F_T(TRUTH_STATE_TOKEN_INNER_HL, I"gpr_fn", I"TRUTH_STATE_TOKEN_INNER") H_END - H_BEGIN(LocationRequirements::this_exotic_package(K_FIGURE_NAME_XPACKAGE)) - H_F_T(PRINT_FIGURE_NAME_HL, I"print_fn", I"PrintFigureName") - H_END - - H_BEGIN(LocationRequirements::this_exotic_package(K_SOUND_NAME_XPACKAGE)) - H_F_T(PRINT_SOUND_NAME_HL, I"print_fn", I"PrintSoundName") - H_END - - H_BEGIN(LocationRequirements::this_exotic_package(K_EXTERNAL_FILE_XPACKAGE)) - H_F_T(PRINT_EXTERNAL_FILE_NAME_HL, I"print_fn", I"PrintExternalFileName") - H_END - - H_BEGIN(LocationRequirements::this_exotic_package(K_INTERNAL_FILE_XPACKAGE)) - H_F_T(PRINT_INTERNAL_FILE_NAME_HL, I"print_fn", I"PrintInternalFileName") - H_END - - H_BEGIN(LocationRequirements::this_exotic_package(K_RULEBOOK_OUTCOME_XPACKAGE)) - H_F_T(PRINT_RULEBOOK_OUTCOME_HL, I"print_fn", I"RulebookOutcomePrintingRule") - H_END - - H_BEGIN(LocationRequirements::this_exotic_package(K_SCENE_XPACKAGE)) - H_F_T(PRINT_SCENE_HL, I"print_fn", I"PrintSceneName") - H_END - - H_BEGIN(LocationRequirements::this_exotic_package(K_DIALOGUE_BEAT_XPACKAGE)) - H_F_T(PRINT_DIALOGUE_BEAT_HL, I"print_fn", I"PrintDialogueBeatName") - H_END - - H_BEGIN(LocationRequirements::this_exotic_package(K_DIALOGUE_LINE_XPACKAGE)) - H_F_T(PRINT_DIALOGUE_LINE_HL, I"print_fn", I"PrintDialogueLineName") - H_END - - H_BEGIN(LocationRequirements::this_exotic_package(K_DIALOGUE_CHOICE_XPACKAGE)) - H_F_T(PRINT_DIALOGUE_CHOICE_HL, I"print_fn", I"PrintDialogueChoiceName") - H_END - - H_BEGIN(LocationRequirements::this_exotic_package(K_PERFORMANCE_STYLE_XPACKAGE)) - H_F_T(PRINT_PERFORMANCE_STYLE_HL, I"print_fn", I"PrintPerformanceStyleName") - H_END - @h Architectural symbols. These are built-in constants (and one built-in variable, |self|) which come from the platform we are compiling to. See //building: Large-Scale Structure//. @@ -2138,19 +2081,6 @@ package_request *Hierarchy::exotic_package(int x) { case K_NUMBER_XPACKAGE: return RTKindConstructors::kind_package(K_number); case K_TIME_XPACKAGE: return RTKindConstructors::kind_package(K_time); case K_TRUTH_STATE_XPACKAGE: return RTKindConstructors::kind_package(K_truth_state); - case K_TABLE_XPACKAGE: return RTKindConstructors::kind_package(K_table); - case K_FIGURE_NAME_XPACKAGE: return RTKindConstructors::kind_package(K_figure_name); - case K_SOUND_NAME_XPACKAGE: return RTKindConstructors::kind_package(K_sound_name); - case K_USE_OPTION_XPACKAGE: return RTKindConstructors::kind_package(K_use_option); - case K_EXTERNAL_FILE_XPACKAGE: return RTKindConstructors::kind_package(K_external_file); - case K_INTERNAL_FILE_XPACKAGE: return RTKindConstructors::kind_package(K_internal_file); - case K_RULEBOOK_OUTCOME_XPACKAGE: return RTKindConstructors::kind_package(K_rulebook_outcome); - case K_RESPONSE_XPACKAGE: return RTKindConstructors::kind_package(K_response); - case K_SCENE_XPACKAGE: return RTKindConstructors::kind_package(K_scene); - case K_DIALOGUE_BEAT_XPACKAGE: return RTKindConstructors::kind_package(K_dialogue_beat); - case K_DIALOGUE_LINE_XPACKAGE: return RTKindConstructors::kind_package(K_dialogue_line); - case K_DIALOGUE_CHOICE_XPACKAGE: return RTKindConstructors::kind_package(K_dialogue_choice); - case K_PERFORMANCE_STYLE_XPACKAGE: return RTKindConstructors::kind_package(K_performance_style); } internal_error("unknown exotic package"); return NULL; diff --git a/inform7/runtime-module/Chapter 2/Instance Counting.w b/inform7/runtime-module/Chapter 2/Instance Counting.w index a4b05844e..8cffdf529 100644 --- a/inform7/runtime-module/Chapter 2/Instance Counting.w +++ b/inform7/runtime-module/Chapter 2/Instance Counting.w @@ -240,15 +240,14 @@ IK-count in a numerical property. So the red car, for example, would be given tw property values: one for (red car, thing), one for (red car, vehicle). The properties in question are the |IK_count_prop| for thing and vehicle. -Similarly for the next terms in the IK-sequences, where the properties are -the | +Similarly for the next terms in the IK-sequences. @ = kind *K; LOOP_OVER_BASE_KINDS(K) if (Kinds::Behaviour::is_subkind_of_object(K)) { inference_subject *subj = KindSubjects::from_kind(K); - inter_name *count_iname = RTKindConstructors::instance_count_iname(K); + inter_name *count_iname = RTKindConstructors::base_IK_iname(K); COUNTING_DATA(subj)->IK_count_prop = ValueProperties::new_nameless_using(K_number, diff --git a/inform7/runtime-module/Chapter 2/Showme Command.w b/inform7/runtime-module/Chapter 2/Showme Command.w index 18fee3407..1749e1d7a 100644 --- a/inform7/runtime-module/Chapter 2/Showme Command.w +++ b/inform7/runtime-module/Chapter 2/Showme Command.w @@ -327,7 +327,7 @@ routine for colours; and the best thing is to print nothing at all. @ = EmitCode::inv(INDIRECT1V_BIP); EmitCode::down(); - EmitCode::val_iname(K_value, RTKindConstructors::get_iname(K)); + EmitCode::val_iname(K_value, RTKindConstructors::printing_fn_iname(K)); EmitCode::call(Hierarchy::find(GPROPERTY_HL)); EmitCode::down(); RTKindIDs::emit_weak_ID_as_val(K_object); diff --git a/inform7/runtime-module/Chapter 4/List Literals.w b/inform7/runtime-module/Chapter 4/List Literals.w index bd49c1e92..41512c8b9 100644 --- a/inform7/runtime-module/Chapter 4/List Literals.w +++ b/inform7/runtime-module/Chapter 4/List Literals.w @@ -139,20 +139,11 @@ for the number of instances it has: = int ListLiterals::extent_of_instance_list(kind *K) { - int N = -1; - if (Kinds::Behaviour::is_an_enumeration(K)) @; - if (Kinds::Behaviour::is_subkind_of_object(K)) @; - return N; + if (Kinds::Behaviour::is_an_enumeration(K)) return RTKindConstructors::enumeration_size(K); + if (Kinds::Behaviour::is_subkind_of_object(K)) return Instances::count(K); + return -1; } -@ = - N = RTKindConstructors::get_highest_valid_value_as_integer(K); - -@ = - N = 0; - instance *I; - LOOP_OVER_INSTANCES(I, K) N++; - @ And the following then constructs the literal list, on demand: = @@ -165,7 +156,7 @@ inter_name *ListLiterals::get_instance_list(kind *K) { Hierarchy::make_iname_in(INSTANCE_LIST_HL, RTKindConstructors::kind_package(K)); packaging_state save = ListLiterals::begin_large_block( large_block_iname, Kinds::unary_con(CON_list_of, K), N); - if (Kinds::Behaviour::is_an_enumeration(K)) @; + if (Kinds::Behaviour::is_an_enumeration(K)) RTKindConstructors::make_enumeration_entries(K); if (Kinds::Behaviour::is_subkind_of_object(K)) @; ListLiterals::end_large_block(save); RTKindConstructors::set_list_iname(Kinds::get_construct(K), large_block_iname); @@ -173,15 +164,6 @@ inter_name *ListLiterals::get_instance_list(kind *K) { return ListLiterals::small_block(large_block_iname); } -@ A little dubiously, for an enumeration ("Colour is a kind of value. The -colours are red, green and blue."), the entries are just the numbers 1, 2, 3, ... -That never seems a good use of memory, but it is still more efficient to store -one copy of this than to have to construct it frequently at runtime. - -@ = - for (int i = 1; i <= N; i++) - EmitArrays::numeric_entry((inter_ti) i); - @ Note that the instances are given in the order preferred by //Instance Counting//, not in creation order, as a simple |LOOP_OVER_INSTANCES| would have done. diff --git a/inform7/runtime-module/Chapter 4/Responses.w b/inform7/runtime-module/Chapter 4/Responses.w index 8f594b4f6..2bd75a16b 100644 --- a/inform7/runtime-module/Chapter 4/Responses.w +++ b/inform7/runtime-module/Chapter 4/Responses.w @@ -93,7 +93,6 @@ response_message *Responses::response_cue(rule *R, int marker, wording W, stack_ text_stream *desc = Str::new(); WRITE_TO(desc, "response (%c) to '%W'", 'A'+marker, R->name); Sequence::queue(&Responses::compilation_agent, STORE_POINTER_response_message(resp), desc); - return resp; } diff --git a/inform7/runtime-module/Chapter 5/Actions.w b/inform7/runtime-module/Chapter 5/Actions.w index 8990b60c0..8386552a0 100644 --- a/inform7/runtime-module/Chapter 5/Actions.w +++ b/inform7/runtime-module/Chapter 5/Actions.w @@ -399,7 +399,7 @@ void RTActions::print_noun_or_second(action_name *an, int n, inter_symbol *n_s, var = InterNames::to_symbol(Hierarchy::find(PARSED_NUMBER_HL)); EmitCode::inv(INDIRECT1V_BIP); EmitCode::down(); - EmitCode::val_iname(K_value, RTKindConstructors::get_debug_print_fn_iname(K)); + EmitCode::val_iname(K_value, RTKindConstructors::debug_print_fn_iname(K)); if ((K_understanding) && (Kinds::eq(K, K_understanding))) { EmitCode::inv(PLUS_BIP); EmitCode::down(); diff --git a/inform7/runtime-module/Chapter 5/Instances.w b/inform7/runtime-module/Chapter 5/Instances.w index 2ee3df66a..d0827d15b 100644 --- a/inform7/runtime-module/Chapter 5/Instances.w +++ b/inform7/runtime-module/Chapter 5/Instances.w @@ -12,6 +12,8 @@ typedef struct instance_compilation_data { struct inter_name *instance_iname; struct linked_list *usages; /* of |parse_node| */ int declaration_sequence_number; + int has_explicit_runtime_value; + inter_ti explicit_runtime_value; } instance_compilation_data; instance_compilation_data RTInstances::new_compilation_data(instance *I) { @@ -21,6 +23,8 @@ instance_compilation_data RTInstances::new_compilation_data(instance *I) { icd.instance_iname = Hierarchy::make_iname_with_memo(INSTANCE_HL, icd.instance_package, W); icd.declaration_sequence_number = -1; + icd.has_explicit_runtime_value = FALSE; + icd.explicit_runtime_value = 0; icd.usages = NEW_LINKED_LIST(parse_node); NounIdentifiers::set_iname(I->as_noun, icd.instance_iname); Hierarchy::make_available_one_per_name_only(icd.instance_iname); @@ -284,8 +288,13 @@ void RTInstances::compilation_agent(compilation_subtask *t) { Hierarchy::apply_metadata_from_iname(RTInstances::package(I), INST_SHOWME_MD_HL, iname); } - - Emit::instance(RTInstances::value_iname(I), Instances::to_kind(I), I->enumeration_index); + + inter_ti val = (inter_ti) I->enumeration_index; + int has_value = TRUE; + if (val == 0) has_value = FALSE; + if (I->compilation_data.has_explicit_runtime_value) + val = I->compilation_data.explicit_runtime_value; + Emit::instance(RTInstances::value_iname(I), Instances::to_kind(I), val, has_value); if (I->compilation_data.declaration_sequence_number >= 0) { inter_name *iname = RTInstances::value_iname(I); package_request *req = InterNames::location(iname); @@ -314,6 +323,31 @@ void RTInstances::xref_metadata(instance *I, int hl, instance *X) { RTInstances::value_iname(X)); } +@ Explicit instance numbering is used for enumerative kinds provided by kits, +which exist for the benefit of the Inter layer. Such kinds might have an erratic +series of values such as 2, 6, 17, ... rather than 1, 2, 3, ..., and if so then +an instance with an unexpected runtime value is called "out of place". + += +void RTInstances::set_explicit_runtime_value(instance *I, inter_ti val) { + I->compilation_data.has_explicit_runtime_value = TRUE; + I->compilation_data.explicit_runtime_value = val; +} + +int RTInstances::out_of_place(instance *I) { + if (I->compilation_data.has_explicit_runtime_value == FALSE) return FALSE; + if (I->compilation_data.explicit_runtime_value == (inter_ti) I->enumeration_index) + return FALSE; + return TRUE; +} + +void RTInstances::set_translation(instance *I, text_stream *identifier) { + inter_name *iname = RTInstances::value_iname(I); + InterNames::set_translation(iname, identifier); + InterNames::clear_flag(iname, MAKE_NAME_UNIQUE_ISYMF); + Hierarchy::make_available(iname); +} + @ When names are abbreviated for use on the World Index map (for instance, "Marble Hallway" becomes "MH") each word is tested against the following nonterminal; those which match are omitted. So, for instance, "Queen Of The diff --git a/inform7/runtime-module/Chapter 5/Kind Constructors.w b/inform7/runtime-module/Chapter 5/Kind Constructors.w index 9ca9bf6fe..a46f2f7d9 100644 --- a/inform7/runtime-module/Chapter 5/Kind Constructors.w +++ b/inform7/runtime-module/Chapter 5/Kind Constructors.w @@ -2,381 +2,234 @@ Each kind constructor has an Inter package of resources. -@h Inter identifiers. +@h Compilation data. = typedef struct kind_constructor_compilation_data { - struct inter_name *xref_iname; - struct inter_name *con_iname; - struct inter_name *list_iname; struct package_request *kc_package; - struct inter_name *kind_GPR_iname; - int needs_GPR; /* a GPR is actually required to be compiled */ - struct inter_name *instance_GPR_iname; + struct inter_name *xref_iname; + + struct inter_name *weak_ID_iname; + struct inter_name *first_instance_iname; struct inter_name *next_instance_iname; - struct inter_name *instance_count_iname; - struct inter_name *pr_iname; - struct inter_name *inc_iname; - struct inter_name *dec_iname; - struct inter_name *mkdef_iname; - struct inter_name *ranger_iname; + struct inter_name *base_IK_iname; + struct inter_name *icount_iname; + struct inter_name *instances_array_iname; + struct inter_name *instance_list_iname; + struct inter_name *indexing_fn_iname; + + struct inter_name *increment_fn_iname; + struct inter_name *decrement_fn_iname; + struct inter_name *default_value_fn_iname; + struct inter_name *random_value_fn_iname; + struct inter_name *comparison_fn_iname; + struct inter_name *support_fn_iname; + + struct inter_name *print_fn_iname; struct inter_name *debug_print_fn_iname; - struct package_request *usage_package; + struct inter_name *showme_fn_iname; + + struct inter_name *GPR_iname; + struct inter_name *instance_GPR_iname; + struct inter_name *recognition_only_GPR_iname; + struct inter_name *distinguisher_function_iname; + int declaration_sequence_number; + int nonstandard_enumeration; } kind_constructor_compilation_data; kind_constructor_compilation_data RTKindConstructors::new_compilation_data(kind_constructor *kc) { kind_constructor_compilation_data kccd; - kccd.xref_iname = NULL; - kccd.con_iname = NULL; kccd.kc_package = NULL; - kccd.list_iname = NULL; - kccd.kind_GPR_iname = NULL; - kccd.needs_GPR = FALSE; - kccd.instance_GPR_iname = NULL; + kccd.xref_iname = NULL; + + kccd.weak_ID_iname = NULL; + kccd.first_instance_iname = NULL; kccd.next_instance_iname = NULL; - kccd.instance_count_iname = NULL; - kccd.pr_iname = NULL; - kccd.inc_iname = NULL; - kccd.dec_iname = NULL; - kccd.mkdef_iname = NULL; - kccd.ranger_iname = NULL; + kccd.base_IK_iname = NULL; + kccd.icount_iname = NULL; + kccd.instances_array_iname = NULL; + kccd.instance_list_iname = NULL; + kccd.indexing_fn_iname = NULL; + + kccd.increment_fn_iname = NULL; + kccd.decrement_fn_iname = NULL; + kccd.default_value_fn_iname = NULL; + kccd.random_value_fn_iname = NULL; + kccd.comparison_fn_iname = NULL; + kccd.support_fn_iname = NULL; + + kccd.print_fn_iname = NULL; kccd.debug_print_fn_iname = NULL; - kccd.usage_package = NULL; + kccd.showme_fn_iname = NULL; + + kccd.GPR_iname = NULL; + kccd.instance_GPR_iname = NULL; + kccd.recognition_only_GPR_iname = NULL; + kccd.distinguisher_function_iname = NULL; + kccd.declaration_sequence_number = -1; + kccd.nonstandard_enumeration = FALSE; return kccd; } +@h The package. +The Inter package for a kind constructor -- either a base kind, like "door" +or "number", or a derived kind like "list of ..." -- can appear more or less +anywhere in the Inter tree without making any real difference to the meaning +of the program, but we try to be tidy about where to put it. + += +package_request *RTKindConstructors::kind_package(kind *K) { + return RTKindConstructors::package(K->construct); +} + package_request *RTKindConstructors::package(kind_constructor *kc) { if (kc->compilation_data.kc_package == NULL) { + package_request *pack = NULL; if (kc->where_defined_in_source_text) { - kc->compilation_data.kc_package = Hierarchy::local_package_to(KIND_HAP, - kc->where_defined_in_source_text); + pack = Hierarchy::local_package_to(KIND_HAP, kc->where_defined_in_source_text); } else if (kc->superkind_set_at) { - kc->compilation_data.kc_package = Hierarchy::local_package_to(KIND_HAP, - kc->superkind_set_at); + pack = Hierarchy::local_package_to(KIND_HAP, kc->superkind_set_at); } else { - kc->compilation_data.kc_package = Hierarchy::synoptic_package(KIND_HAP); + pack = Hierarchy::synoptic_package(KIND_HAP); } - wording W = KindConstructors::get_name(kc, FALSE); - if (Wordings::nonempty(W)) - Hierarchy::apply_metadata_from_wording(kc->compilation_data.kc_package, KIND_NAME_MD_HL, W); - else if (Str::len(kc->explicit_identifier) > 0) - Hierarchy::apply_metadata(kc->compilation_data.kc_package, KIND_NAME_MD_HL, - kc->explicit_identifier); - else - Hierarchy::apply_metadata(kc->compilation_data.kc_package, KIND_NAME_MD_HL, I"(anonymous kind)"); - if (kc->where_defined_in_source_text) - Hierarchy::apply_metadata_from_number(kc->compilation_data.kc_package, KIND_AT_MD_HL, - (inter_ti) Wordings::first_wn(Node::get_text(kc->where_defined_in_source_text))); + kc->compilation_data.kc_package = pack; } return kc->compilation_data.kc_package; } -package_request *RTKindConstructors::usage_package(kind_constructor *kc) { - if (kc->compilation_data.usage_package == NULL) - kc->compilation_data.usage_package = - Hierarchy::completion_package(KIND_USAGE_HAP); - return kc->compilation_data.usage_package; +@ Neptune definitions of kinds refer to Inter functions by identifier name, +so we will need a way to turn those into inames: + += +inter_name *RTKindConstructors::iname_of_kit_function(kind *K, text_stream *identifier) { + inter_name *iname = HierarchyLocations::find_by_name(Emit::tree(), identifier); + if (iname == NULL) { + StandardProblems::handmade_problem(Task::syntax_tree(), _p_(Untestable)); + Problems::quote_kind(1, K); + Problems::quote_stream(2, identifier); + Problems::issue_problem_segment( + "The kind %1 is declared in a Neptune file to make use of a " + "function called '%2', but this does not seem to exist."); + Problems::issue_problem_end(); + } + return iname; } +@ These macros are convenient for caching the results of iname creation or lookup, +so that they need be done only once per kind: + +@d RETURN_INAME_IN(kc, iname, creator) + if (kc->compilation_data.iname == NULL) { + kc->compilation_data.iname = creator; + } + return kc->compilation_data.iname; +@d RETURN_AVAILABLE_INAME_IN(kc, iname, creator) + if (kc->compilation_data.iname == NULL) { + kc->compilation_data.iname = creator; + Hierarchy::make_available(kc->compilation_data.iname); + } + return kc->compilation_data.iname; + +@ The "cross-reference iname" is used as a device to allow metadata from some +other package to point to this package without inconvenient namespace clashes. +A symbol is defined at this iname: only its location is meaningful, and its +value is never used. + += inter_name *RTKindConstructors::xref_iname(kind_constructor *kc) { - if (kc->compilation_data.xref_iname == NULL) - kc->compilation_data.xref_iname = - Hierarchy::make_iname_in(KIND_XREF_SYMBOL_HL, RTKindConstructors::package(kc)); - return kc->compilation_data.xref_iname; + RETURN_INAME_IN(kc, xref_iname, + Hierarchy::make_iname_in(KIND_XREF_SYMBOL_HL, RTKindConstructors::package(kc))) } -@ An identifier like |WHATEVER_TY|, then, begins life in a definition inside an +@h Iname for the weak ID. +The "weak ID" for a kind is a runtime value identifying only its constructor. +This distinguishes base kinds -- for example, "number" and "text" have different +weak IDs -- but not derived kinds -- for example, "list of numbers" and +"list of texts" have the same weak ID. (For that, the "strong ID" is needed.) + +An identifier like |NUMBER_TY|, then, begins life in a definition inside an Neptune file; becomes attached to a constructor here; and finally winds up back in Inter code, because we define it as the constant for the weak kind ID of the kind which the constructor makes: = inter_name *RTKindConstructors::weak_ID_iname(kind_constructor *kc) { - if (kc->compilation_data.con_iname == NULL) { - kc->compilation_data.con_iname = - Hierarchy::make_iname_with_specific_translation(WEAK_ID_HL, - RTKindIDs::identifier_for_weak_ID(kc), RTKindConstructors::package(kc)); - Hierarchy::make_available(kc->compilation_data.con_iname); - } - return kc->compilation_data.con_iname; + RETURN_AVAILABLE_INAME_IN(kc, weak_ID_iname, + Hierarchy::make_iname_with_specific_translation(WEAK_ID_HL, + RTKindIDs::identifier_for_weak_ID(kc), RTKindConstructors::package(kc))) } -inter_name *RTKindConstructors::UNKNOWN_iname(void) { - return CON_UNKNOWN->compilation_data.con_iname; -} - -inter_name *RTKindConstructors::list_iname(kind_constructor *kc) { - return kc->compilation_data.list_iname; -} -void RTKindConstructors::set_list_iname(kind_constructor *kc, inter_name *iname) { - kc->compilation_data.list_iname = iname; -} - -inter_name *RTKindConstructors::first_instance_iname(kind *K) { - kind_constructor *kc = Kinds::get_construct(K); - if (kc->compilation_data.first_instance_iname == NULL) - kc->compilation_data.first_instance_iname = - Hierarchy::derive_iname_in_translating(FIRST_INSTANCE_HL, - RTKindDeclarations::iname(K), RTKindConstructors::package(kc)); - return kc->compilation_data.first_instance_iname; -} - -inter_name *RTKindConstructors::next_instance_iname(kind *K) { - kind_constructor *kc = Kinds::get_construct(K); - if (kc->compilation_data.next_instance_iname == NULL) - kc->compilation_data.next_instance_iname = - Hierarchy::derive_iname_in_translating(NEXT_INSTANCE_HL, - RTKindDeclarations::iname(K), RTKindConstructors::package(kc)); - return kc->compilation_data.next_instance_iname; -} - -inter_name *RTKindConstructors::instance_count_iname(kind *K) { - kind_constructor *kc = Kinds::get_construct(K); - if (kc->compilation_data.instance_count_iname == NULL) { - int N = Kinds::Behaviour::get_range_number(K), hl = -1; - switch (N) { - case 1: hl = COUNT_INSTANCE_1_HL; break; - case 2: hl = COUNT_INSTANCE_2_HL; break; - case 3: hl = COUNT_INSTANCE_3_HL; break; - case 4: hl = COUNT_INSTANCE_4_HL; break; - case 5: hl = COUNT_INSTANCE_5_HL; break; - case 6: hl = COUNT_INSTANCE_6_HL; break; - case 7: hl = COUNT_INSTANCE_7_HL; break; - case 8: hl = COUNT_INSTANCE_8_HL; break; - case 9: hl = COUNT_INSTANCE_9_HL; break; - case 10: hl = COUNT_INSTANCE_10_HL; break; - } - if (hl == -1) - kc->compilation_data.instance_count_iname = - Hierarchy::derive_iname_in_translating(COUNT_INSTANCE_HL, RTKindDeclarations::iname(K), - RTKindConstructors::kind_package(K)); - else - kc->compilation_data.instance_count_iname = - Hierarchy::make_iname_in(hl, RTKindConstructors::kind_package(K)); - } - return kc->compilation_data.instance_count_iname; -} - -@ Convenient storage for some names. +@h Inames to do with the range of values. = -inter_name *RTKindConstructors::get_kind_GPR_iname(kind *K) { - if (K == NULL) return NULL; +inter_name *RTKindConstructors::increment_fn_iname(kind *K) { kind_constructor *kc = Kinds::get_construct(K); - if (kc->compilation_data.kind_GPR_iname == NULL) { - package_request *R = RTKindConstructors::kind_package(K); - kc->compilation_data.kind_GPR_iname = - Hierarchy::make_iname_in(GPR_FN_HL, R); - } - return kc->compilation_data.kind_GPR_iname; + RETURN_INAME_IN(kc, increment_fn_iname, + Hierarchy::make_iname_in(INCREMENT_FN_HL, RTKindConstructors::package(kc))) } -inter_name *RTKindConstructors::get_exp_kind_GPR_iname(kind *K) { - inter_name *GPR = NULL; - text_stream *GPR_fn_identifier = RTKindConstructors::get_explicit_I6_GPR(K); - if (Str::len(GPR_fn_identifier) > 0) - GPR = HierarchyLocations::find_by_name(Emit::tree(), GPR_fn_identifier); - else - GPR = RTKindConstructors::get_kind_GPR_iname(K); - return GPR; -} - -inter_name *RTKindConstructors::get_instance_GPR_iname(kind *K) { - if (K == NULL) return NULL; +inter_name *RTKindConstructors::decrement_fn_iname(kind *K) { kind_constructor *kc = Kinds::get_construct(K); - if (kc->compilation_data.instance_GPR_iname == NULL) { - package_request *R = RTKindConstructors::kind_package(K); - kc->compilation_data.instance_GPR_iname = - Hierarchy::make_iname_in(INSTANCE_GPR_FN_HL, R); - } - return kc->compilation_data.instance_GPR_iname; + RETURN_INAME_IN(kc, decrement_fn_iname, + Hierarchy::make_iname_in(DECREMENT_FN_HL, RTKindConstructors::package(kc))) } -@ +inter_name *RTKindConstructors::default_value_fn_iname(kind_constructor *kc) { + RETURN_INAME_IN(kc, default_value_fn_iname, + Hierarchy::make_iname_in(MKDEF_FN_HL, RTKindConstructors::package(kc))) +} + +inter_name *RTKindConstructors::random_value_fn_iname(kind *K) { + kind_constructor *kc = Kinds::get_construct(K); + RETURN_INAME_IN(kc, random_value_fn_iname, + Hierarchy::make_iname_in(RANGER_FN_HL, RTKindConstructors::package(kc))) +} + +@ A comparison function, testing whether two runtime values of the kind are +equal, can be provided by a kit (defining a kind with a Neptune file), but +is not otherwise created: = -inter_name *RTKindConstructors::get_iname(kind *K) { - if (K == NULL) { - if (K_number) return RTKindConstructors::get_iname(K_number); - internal_error("null kind has no printing routine"); - } - K = Kinds::weaken(K, K_object); - if (K->construct->compilation_data.pr_iname) - return K->construct->compilation_data.pr_iname; - if (Str::len(K->construct->explicit_identifier) == 0) { - package_request *R = RTKindConstructors::package(K->construct); - K->construct->compilation_data.pr_iname = Hierarchy::make_iname_in(PRINT_DASH_FN_HL, R); - return K->construct->compilation_data.pr_iname; - } - - if (Kinds::eq(K, K_use_option)) { - K->construct->compilation_data.pr_iname = Hierarchy::find(PRINT_USE_OPTION_HL); - Hierarchy::make_available(K->construct->compilation_data.pr_iname); - return K->construct->compilation_data.pr_iname; - } - if (Kinds::eq(K, K_table)) { - K->construct->compilation_data.pr_iname = Hierarchy::find(PRINT_TABLE_HL); - Hierarchy::make_available(K->construct->compilation_data.pr_iname); - return K->construct->compilation_data.pr_iname; - } - if (Kinds::eq(K, K_rulebook_outcome)) { - K->construct->compilation_data.pr_iname = Hierarchy::find(PRINT_RULEBOOK_OUTCOME_HL); - Hierarchy::make_available(K->construct->compilation_data.pr_iname); - return K->construct->compilation_data.pr_iname; - } - if (Kinds::eq(K, K_response)) { - K->construct->compilation_data.pr_iname = Hierarchy::find(PRINT_RESPONSE_HL); - Hierarchy::make_available(K->construct->compilation_data.pr_iname); - return K->construct->compilation_data.pr_iname; - } - if (Kinds::eq(K, K_figure_name)) { - K->construct->compilation_data.pr_iname = Hierarchy::find(PRINT_FIGURE_NAME_HL); - Hierarchy::make_available(K->construct->compilation_data.pr_iname); - return K->construct->compilation_data.pr_iname; - } - if (Kinds::eq(K, K_sound_name)) { - K->construct->compilation_data.pr_iname = Hierarchy::find(PRINT_SOUND_NAME_HL); - Hierarchy::make_available(K->construct->compilation_data.pr_iname); - return K->construct->compilation_data.pr_iname; - } - if (Kinds::eq(K, K_external_file)) { - K->construct->compilation_data.pr_iname = Hierarchy::find(PRINT_EXTERNAL_FILE_NAME_HL); - Hierarchy::make_available(K->construct->compilation_data.pr_iname); - return K->construct->compilation_data.pr_iname; - } - if (Kinds::eq(K, K_internal_file)) { - K->construct->compilation_data.pr_iname = Hierarchy::find(PRINT_INTERNAL_FILE_NAME_HL); - Hierarchy::make_available(K->construct->compilation_data.pr_iname); - return K->construct->compilation_data.pr_iname; - } - if (Kinds::eq(K, K_scene)) { - K->construct->compilation_data.pr_iname = Hierarchy::find(PRINT_SCENE_HL); - Hierarchy::make_available(K->construct->compilation_data.pr_iname); - return K->construct->compilation_data.pr_iname; - } - if (Kinds::eq(K, K_dialogue_beat)) { - K->construct->compilation_data.pr_iname = Hierarchy::find(PRINT_DIALOGUE_BEAT_HL); - Hierarchy::make_available(K->construct->compilation_data.pr_iname); - return K->construct->compilation_data.pr_iname; - } - if (Kinds::eq(K, K_dialogue_line)) { - K->construct->compilation_data.pr_iname = Hierarchy::find(PRINT_DIALOGUE_LINE_HL); - Hierarchy::make_available(K->construct->compilation_data.pr_iname); - return K->construct->compilation_data.pr_iname; - } - if (Kinds::eq(K, K_dialogue_choice)) { - K->construct->compilation_data.pr_iname = Hierarchy::find(PRINT_DIALOGUE_CHOICE_HL); - Hierarchy::make_available(K->construct->compilation_data.pr_iname); - return K->construct->compilation_data.pr_iname; - } - if (Kinds::eq(K, K_performance_style)) { - K->construct->compilation_data.pr_iname = Hierarchy::find(PRINT_PERFORMANCE_STYLE_HL); - Hierarchy::make_available(K->construct->compilation_data.pr_iname); - return K->construct->compilation_data.pr_iname; - } - - package_request *R = NULL; - int external = TRUE; - if ((Kinds::get_construct(K) == CON_rule) || - (Kinds::get_construct(K) == CON_rulebook)) external = TRUE; - if (Kinds::Behaviour::is_an_enumeration(K)) { - R = RTKindConstructors::kind_package(K); external = FALSE; - } - text_stream *X = K->construct->print_identifier; - if (Kinds::Behaviour::is_quasinumerical(K)) { - R = RTKindConstructors::kind_package(K); external = FALSE; - } - if (Kinds::eq(K, K_time)) external = TRUE; - if (Kinds::eq(K, K_number)) external = TRUE; - if (Kinds::eq(K, K_real_number)) external = TRUE; - if (Str::len(X) == 0) X = I"DecimalNumber"; - - if (R) { - if (external) { - K->construct->compilation_data.pr_iname = Hierarchy::make_iname_in(PRINT_FN_HL, R); - inter_name *actual_iname = HierarchyLocations::find_by_name(Emit::tree(), X); - Emit::iname_constant(K->construct->compilation_data.pr_iname, K_value, actual_iname); - } else { - WRITE_TO(STDERR, "identifier: '%S'\n", X); - internal_error("internal but unknown kind printing routine"); - } - } else { - if (external) K->construct->compilation_data.pr_iname = HierarchyLocations::find_by_name(Emit::tree(), X); - else internal_error("internal but unpackaged kind printing routine"); - } - return K->construct->compilation_data.pr_iname; -} -package_request *RTKindConstructors::kind_package(kind *K) { - return RTKindConstructors::package(K->construct); -} -inter_name *RTKindConstructors::get_inc_iname(kind *K) { - if (K == NULL) internal_error("null kind has no inc routine"); - if (K->construct->compilation_data.inc_iname) return K->construct->compilation_data.inc_iname; - package_request *R = RTKindConstructors::kind_package(K); - K->construct->compilation_data.inc_iname = Hierarchy::make_iname_in(DECREMENT_FN_HL, R); - return K->construct->compilation_data.inc_iname; -} -inter_name *RTKindConstructors::get_dec_iname(kind *K) { - if (K == NULL) internal_error("null kind has no dec routine"); - if (K->construct->compilation_data.dec_iname) return K->construct->compilation_data.dec_iname; - package_request *R = RTKindConstructors::kind_package(K); - K->construct->compilation_data.dec_iname = Hierarchy::make_iname_in(INCREMENT_FN_HL, R); - return K->construct->compilation_data.dec_iname; -} -inter_name *RTKindConstructors::get_ranger_iname(kind *K) { - if (K == NULL) internal_error("null kind has no ranger fn"); - if (K->construct->compilation_data.ranger_iname) return K->construct->compilation_data.ranger_iname; - package_request *R = RTKindConstructors::kind_package(K); - K->construct->compilation_data.ranger_iname = Hierarchy::make_iname_in(RANGER_FN_HL, R); - return K->construct->compilation_data.ranger_iname; -} -inter_name *RTKindConstructors::get_mkdef_iname(kind_constructor *kc) { - if (kc->compilation_data.mkdef_iname == NULL) - kc->compilation_data.mkdef_iname = - Hierarchy::make_iname_in(MKDEF_FN_HL, RTKindConstructors::package(kc)); - return kc->compilation_data.mkdef_iname; -} -inter_name *RTKindConstructors::get_debug_print_fn_iname(kind *K) { - if (K == NULL) K = K_number; - if (K->construct->compilation_data.debug_print_fn_iname) - return K->construct->compilation_data.debug_print_fn_iname; - if (Str::len(K->construct->explicit_identifier) == 0) { - K->construct->compilation_data.debug_print_fn_iname = RTKindConstructors::get_iname(K); - return K->construct->compilation_data.debug_print_fn_iname; - } - - if (Str::len(K->construct->ACTIONS_identifier) > 0) - K->construct->compilation_data.debug_print_fn_iname = - HierarchyLocations::find_by_name(Emit::tree(), K->construct->ACTIONS_identifier); - else - K->construct->compilation_data.debug_print_fn_iname = - HierarchyLocations::find_by_name(Emit::tree(), I"DA_Name"); - return K->construct->compilation_data.debug_print_fn_iname; +int RTKindConstructors::comparison_function_provided_by_kit(kind *K) { + if (K == NULL) return FALSE; + text_stream *identifier = Kinds::Behaviour::get_comparison_routine(K); + if (Str::len(identifier) > 0) return TRUE; + return FALSE; } -inter_name *RTKindConstructors::get_explicit_I6_GPR_iname(kind *K) { - if (K == NULL) internal_error("RTKindConstructors::get_explicit_I6_GPR on null kind"); - if (Str::len(K->construct->explicit_GPR_identifier) > 0) - return HierarchyLocations::find_by_name(Emit::tree(), K->construct->explicit_GPR_identifier); - return NULL; +inter_name *RTKindConstructors::comparison_fn_iname(kind *K) { + if (RTKindConstructors::comparison_function_provided_by_kit(K) == FALSE) + return NULL; + kind_constructor *kc = Kinds::get_construct(K); + RETURN_INAME_IN(kc, comparison_fn_iname, + RTKindConstructors::iname_of_kit_function(K, + Kinds::Behaviour::get_comparison_routine(K))) } -inter_name *RTKindConstructors::get_distinguisher_iname(kind *K) { - text_stream *N = Kinds::Behaviour::get_distinguisher(K); - if (N == NULL) return NULL; - return HierarchyLocations::find_by_name(Emit::tree(), N); +@ And similarly for a support function, which can carry out a range of useful +tasks to do with block values (creating values, copying values and so on). +This too exists only if a kit provides it, but (anomalously) the kit does not +need to specify its name in a Neptune file: instead the name is that of the +kind's weak ID plus |_Support|. For example, |TEXT_TY_Support|. + += +int RTKindConstructors::support_function_provided_by_kit(kind *K) { + if (K == NULL) return FALSE; + if (RTKindConstructors::support_fn_iname(K)) return TRUE; + return FALSE; } -inter_name *RTKindConstructors::get_comparison_fn_iname(kind_constructor *kc) { - return HierarchyLocations::find_by_name(Emit::tree(), - KindConstructors::get_comparison_fn_identifier(kc)); +inter_name *RTKindConstructors::support_fn_iname(kind *K) { + kind_constructor *kc = Kinds::get_construct(K); + RETURN_INAME_IN(kc, support_fn_iname, + RTKindConstructors::create_support_fn_iname(kc)) } -inter_name *RTKindConstructors::get_support_fn_iname(kind_constructor *kc) { +inter_name *RTKindConstructors::create_support_fn_iname(kind_constructor *kc) { TEMPORARY_TEXT(N) WRITE_TO(N, "%S_Support", kc->explicit_identifier); inter_name *iname = HierarchyLocations::find_by_name(Emit::tree(), N); @@ -384,85 +237,317 @@ inter_name *RTKindConstructors::get_support_fn_iname(kind_constructor *kc) { return iname; } -@ Moving on to understanding: some kinds can be used as tokens in Understand -sentences, others can't. Thus "[time]" is a valid Understand token, but -"[stored action]" is not. - -Some kinds provide have a GPR ("general parsing routine", an I6 piece of -jargon) defined in some Inter kit: if so, this returns the GPR's name; if -not, it returns |NULL|. +@h Inames to do with enumerative kinds. +For kinds of object, constants for the first instance, and a property for the +next instance: this enables rapid looping through all instances at runtime. = -text_stream *RTKindConstructors::get_explicit_I6_GPR(kind *K) { - if (K == NULL) internal_error("RTKindConstructors::get_explicit_I6_GPR on null kind"); - return K->construct->explicit_GPR_identifier; +inter_name *RTKindConstructors::first_instance_iname(kind *K) { + kind_constructor *kc = Kinds::get_construct(K); + RETURN_INAME_IN(kc, first_instance_iname, + Hierarchy::derive_iname_in_translating(FIRST_INSTANCE_HL, + RTKindDeclarations::iname(K), RTKindConstructors::package(kc))) } -@ Can the kind have a GPR of any kind in the final code? - -= -int RTKindConstructors::offers_I6_GPR(kind *K) { - if (K == NULL) return FALSE; - return KindConstructors::offers_I6_GPR(K->construct); +inter_name *RTKindConstructors::next_instance_iname(kind *K) { + kind_constructor *kc = Kinds::get_construct(K); + RETURN_INAME_IN(kc, next_instance_iname, + Hierarchy::derive_iname_in_translating(NEXT_INSTANCE_HL, + RTKindDeclarations::iname(K), RTKindConstructors::package(kc))) } -@ Request that a GPR be compiled for this kind; the return value tell us whether -this will be allowed or not. +@ The "base IK iname" is not in fact used as the definition of anything: it +exists for other inames to be derived from it. See //Instance Counting//. = -int RTKindConstructors::request_I6_GPR(kind *K) { - if (RTKindConstructors::offers_I6_GPR(K) == FALSE) return FALSE; /* can't oblige */ - if (K->construct->compilation_data.needs_GPR == FALSE) { - text_stream *desc = Str::new(); - WRITE_TO(desc, "GPR for kind %u", K); - if (Kinds::Behaviour::is_an_enumeration(K)) { - K->construct->compilation_data.needs_GPR = TRUE; - Sequence::queue(&KindGPRs::enumeration_agent, STORE_POINTER_kind(K), desc); - } else if (Kinds::Behaviour::is_quasinumerical(K)) { - K->construct->compilation_data.needs_GPR = TRUE; - Sequence::queue(&KindGPRs::quasinumerical_agent, STORE_POINTER_kind(K), desc); - } - return TRUE; +inter_name *RTKindConstructors::base_IK_iname(kind *K) { + kind_constructor *kc = Kinds::get_construct(K); + RETURN_INAME_IN(kc, base_IK_iname, + RTKindConstructors::create_base_IK_iname(K)) +} + +inter_name *RTKindConstructors::create_base_IK_iname(kind *K) { + package_request *pack = RTKindConstructors::kind_package(K); + int N = Kinds::Behaviour::get_range_number(K), hl = -1; + switch (N) { + case 1: hl = BASE_IK_1_HL; break; + case 2: hl = BASE_IK_2_HL; break; + case 3: hl = BASE_IK_3_HL; break; + case 4: hl = BASE_IK_4_HL; break; + case 5: hl = BASE_IK_5_HL; break; + case 6: hl = BASE_IK_6_HL; break; + case 7: hl = BASE_IK_7_HL; break; + case 8: hl = BASE_IK_8_HL; break; + case 9: hl = BASE_IK_9_HL; break; + case 10: hl = BASE_IK_10_HL; break; } - return TRUE; + if (hl >= 1) return Hierarchy::make_iname_in(hl, pack); + + return Hierarchy::derive_iname_in_translating(BASE_IK_HL, + RTKindDeclarations::iname(K), pack); +} + +@ The "icount" is a genuine constant, currently defined for each enumeration +and each kind of object. The naming system here is potentially problematic: +"figure name" counts out as |ICOUNT_FIGURE_NAME|, "door" as |ICOUNT_DOOR|, +and so on. This is potentially open to namespace clashes, given the truncation +to 31 characters, but for kinds whose names fit into that length without +truncation, there should never be any problem. + +All the same,icounts should probably be used only when necessary, and |WorldModelKit| +no longer uses the icounts for any kinds of object, where clashes are more +plausible. + += +inter_name *RTKindConstructors::icount_iname(kind *K) { + kind_constructor *kc = Kinds::get_construct(K); + RETURN_INAME_IN(kc, icount_iname, + RTKindConstructors::create_icount_iname(K)) +} + +inter_name *RTKindConstructors::create_icount_iname(kind *K) { + package_request *pack = RTKindConstructors::kind_package(K); + TEMPORARY_TEXT(ICN) + WRITE_TO(ICN, "ICOUNT_"); + Kinds::Textual::write(ICN, K); + Str::truncate(ICN, 31); + LOOP_THROUGH_TEXT(pos, ICN) { + Str::put(pos, Characters::toupper(Str::get(pos))); + if (Characters::isalnum(Str::get(pos)) == FALSE) Str::put(pos, '_'); + } + inter_name *iname = Hierarchy::make_iname_with_specific_translation(ICOUNT_HL, + InterSymbolsTable::render_identifier_unique(LargeScale::main_scope(Emit::tree()), ICN), + pack); + Hierarchy::make_available(iname); + DISCARD_TEXT(ICN) + return iname; +} + +@ For nonstandard enumerations, we need an array holding the valid values. + += +inter_name *RTKindConstructors::instances_array_iname(kind *K) { + kind_constructor *kc = Kinds::get_construct(K); + RETURN_INAME_IN(kc, instances_array_iname, + Hierarchy::derive_iname_in_translating(INSTANCES_ARRAY_HL, + RTKindDeclarations::iname(K), RTKindConstructors::package(kc))) +} + +@ Sometimes we want to cache the constant list produced by "list of doors", +say -- an Inform 7 list. This means that if there are multiple mentions of +the "list of doors", we will only compile the constant once. It goes here: + += +inter_name *RTKindConstructors::list_iname(kind_constructor *kc) { + return kc->compilation_data.instance_list_iname; +} +void RTKindConstructors::set_list_iname(kind_constructor *kc, inter_name *iname) { + kc->compilation_data.instance_list_iname = iname; +} + +@ Non-standard enumerations need a function which, given a value, returns its +sequence position in the enumeration: + += +inter_name *RTKindConstructors::indexing_fn_iname(kind *K) { + kind_constructor *kc = Kinds::get_construct(K); + RETURN_INAME_IN(kc, indexing_fn_iname, + Hierarchy::make_iname_in(INDEXING_FN_HL, RTKindConstructors::package(kc))) +} + +@h Inames to do with printing. +Note that all kinds of object share a common print function. + += +inter_name *RTKindConstructors::printing_fn_iname(kind *K) { + if (K == NULL) K = K_number; + if (K == NULL) internal_error("null kind has no printing routine"); + K = Kinds::weaken(K, K_object); + + kind_constructor *kc = Kinds::get_construct(K); + RETURN_INAME_IN(kc, print_fn_iname, + RTKindConstructors::obtain_printing_fn_iname(K)) +} + +@ This innocuous-looking function has been the cause of considerable grief over +the years because of the overlapping alternatives in play (where the kind came +from, who should write the function, where it should be in the Inter tree, who +gets to choose its identifier, and whether it is available to kit code through +the linker). This is the cleanest expression I can get: + += +inter_name *RTKindConstructors::obtain_printing_fn_iname(kind *K) { + kind_constructor *kc = Kinds::get_construct(K); + package_request *pack = RTKindConstructors::package(kc); + text_stream *X = kc->print_identifier; + + @; + + if ((Kinds::Behaviour::comes_from_Neptune(K) == FALSE) || + (Kinds::Behaviour::is_an_enumeration(K))) + @ + else + @; +} + +@ For example, "use option" currently falls into this case: + +@ = + inter_name *synoptic_iname = + SynopticHierarchy::printing_function_iname(Emit::tree(), K); + if (synoptic_iname) return synoptic_iname; + +@ For example, "scene" currently falls into this case: + +@ = + if (Str::len(X) > 0) { + inter_name *iname = Hierarchy::make_iname_in(PRINT_FN_HL, pack); + InterNames::set_translation(iname, X); + Hierarchy::make_available(iname); + return iname; + } else { + return Hierarchy::make_iname_in(PRINT_DASH_FN_HL, pack); + } + +@ For example, "rulebook outcome" currently falls into this case: + +@ = + inter_name *iname = NULL; + if (Str::len(X) > 0) { + return iname = RTKindConstructors::iname_of_kit_function(K, X); + } else { + return iname = RTKindConstructors::iname_of_kit_function(K, I"DecimalNumber"); + } + +@ This is the variant used when printing values as part of the output of the +ACTIONS debugging command, for example. It's the same as the regular printing +function unless the Neptune definition for a kind says otherwise. + += +inter_name *RTKindConstructors::debug_print_fn_iname(kind *K) { + if (K == NULL) K = K_number; + if (K == NULL) internal_error("null kind has no printing routine"); + K = Kinds::weaken(K, K_object); + + kind_constructor *kc = Kinds::get_construct(K); + RETURN_INAME_IN(kc, debug_print_fn_iname, + RTKindConstructors::obtain_debug_print_fn_iname(K)) +} + +inter_name *RTKindConstructors::obtain_debug_print_fn_iname(kind *K) { + text_stream *identifier = K->construct->ACTIONS_identifier; + if (Str::len(identifier) > 0) + return RTKindConstructors::iname_of_kit_function(K, identifier); + return RTKindConstructors::printing_fn_iname(K); +} + +@ And a few kinds also need a special function to improve the results of +SHOWME, or the phrase "showme", also for debugging purposes. + += +inter_name *RTKindConstructors::showme_fn_iname(kind *K) { + if (K == NULL) return NULL; + kind_constructor *kc = Kinds::get_construct(K); + RETURN_INAME_IN(kc, showme_fn_iname, + Hierarchy::make_iname_in(SHOWME_FN_HL, RTKindConstructors::kind_package(K))) +} + +@h Inames to do with the command parser. +The command parser is not present in Basic Inform projects, so we do nothing +in this area unless the parsing plugin activates and calls the following: + += +int GPR_compilation_enabled = FALSE; + +void RTKindConstructors::enable_parsing(void) { + GPR_compilation_enabled = TRUE; +} +int RTKindConstructors::GPR_compilation_enabled(void) { + return GPR_compilation_enabled; +} + +@ "GPR" is old Inform jargon for "general parsing routine", a function which +examines words produced by the command parser to match them as the name of +an instance of the kind. See //Kind GPRs// for more. + +When kits create kinds using Neptune files, they will often supply their own +GPR functions, and if they do then we use those rather than construct our own. + += +int RTKindConstructors::GPR_provided_by_kit(kind *K) { + if (K == NULL) return FALSE; + text_stream *identifier = Kinds::Behaviour::GPR_identifier(K); + if (Str::len(identifier) > 0) return TRUE; + return FALSE; +} + +inter_name *RTKindConstructors::GPR_iname(kind *K) { + if (K == NULL) return NULL; + kind_constructor *kc = Kinds::get_construct(K); + RETURN_INAME_IN(kc, GPR_iname, RTKindConstructors::create_GPR_iname(K)) +} + +inter_name *RTKindConstructors::create_GPR_iname(kind *K) { + if (RTKindConstructors::GPR_provided_by_kit(K)) + return RTKindConstructors::iname_of_kit_function(K, + Kinds::Behaviour::GPR_identifier(K)); + kind_constructor *kc = Kinds::get_construct(K); + return Hierarchy::make_iname_in(GPR_FN_HL, RTKindConstructors::package(kc)); +} + +@ Some kinds have a few supplementary GPRs as well. Enumerations have the +following, for parsing non-standard names for instances: + += +inter_name *RTKindConstructors::instance_GPR_iname(kind *K) { + if (K == NULL) return NULL; + kind_constructor *kc = Kinds::get_construct(K); + RETURN_INAME_IN(kc, instance_GPR_iname, + Hierarchy::make_iname_in(INSTANCE_GPR_FN_HL, RTKindConstructors::package(kc))) } @ A recognition-only GPR is used for matching specific data in the course of -parsing names of objects, but not as a grammar token in its own right. +parsing names of objects, but not as a grammar token in its own right. If this +exists at all, it is provided by a kit and named in a Neptune command. = -text_stream *RTKindConstructors::get_recognition_only_GPR(kind *K) { - if (K == NULL) return NULL; - return K->construct->recognition_routine; +int RTKindConstructors::recognition_only_GPR_provided_by_kit(kind *K) { + if (K == NULL) return FALSE; + text_stream *identifier = Kinds::Behaviour::recognition_only_GPR_identifier(K); + if (Str::len(identifier) > 0) return TRUE; + return FALSE; } -inter_name *RTKindConstructors::get_recognition_only_GPR_as_iname(kind *K) { - text_stream *N = RTKindConstructors::get_recognition_only_GPR(K); - if (N == NULL) return NULL; - return HierarchyLocations::find_by_name(Emit::tree(), N); +inter_name *RTKindConstructors::recognition_only_GPR_iname(kind *K) { + if (RTKindConstructors::recognition_only_GPR_provided_by_kit(K) == FALSE) + return NULL; + kind_constructor *kc = Kinds::get_construct(K); + RETURN_INAME_IN(kc, recognition_only_GPR_iname, + RTKindConstructors::iname_of_kit_function(K, + Kinds::Behaviour::recognition_only_GPR_identifier(K))) } -@ The following is used only when the kind has named instances. +@ Same exact deal with the "distinguisher function" for a kind, also used +in parsing. See //Parse Name Properties//. = -int RTKindConstructors::get_highest_valid_value_as_integer(kind *K) { - if (K == NULL) return 0; - return RTKindConstructors::get_highest_valid_value_as_integer_kc(K->construct); +int RTKindConstructors::distinguisher_function_provided_by_kit(kind *K) { + if (K == NULL) return FALSE; + text_stream *identifier = Kinds::Behaviour::get_distinguisher(K); + if (Str::len(identifier) > 0) return TRUE; + return FALSE; } -int RTKindConstructors::get_highest_valid_value_as_integer_kc(kind_constructor *kc) { - if (kc == NULL) return 0; - if (kc == CON_activity) return NUMBER_CREATED(activity); - if (kc == Kinds::get_construct(K_equation)) return NUMBER_CREATED(equation); - if (kc == CON_rule) return NUMBER_CREATED(booking); - if (kc == CON_rulebook) return NUMBER_CREATED(rulebook); - if (kc == Kinds::get_construct(K_table)) return NUMBER_CREATED(table) + 1; - if (kc == Kinds::get_construct(K_use_option)) return NUMBER_CREATED(use_option); - if (kc == Kinds::get_construct(K_response)) return NUMBER_CREATED(response_message); - return kc->next_free_value - 1; +inter_name *RTKindConstructors::distinguisher_function_iname(kind *K) { + if (RTKindConstructors::distinguisher_function_provided_by_kit(K) == FALSE) + return NULL; + kind_constructor *kc = Kinds::get_construct(K); + RETURN_INAME_IN(kc, distinguisher_function_iname, + RTKindConstructors::iname_of_kit_function(K, + Kinds::Behaviour::get_distinguisher(K))) } -@h Compilation. +@h Miscellaneous utility functions. = int RTKindConstructors::is_subkind_of_object(kind_constructor *kc) { @@ -476,428 +561,63 @@ int RTKindConstructors::is_object(kind_constructor *kc) { return FALSE; } -void RTKindConstructors::compile(void) { - RTKindConstructors::assign_declaration_sequence_numbers(); - kind_constructor *kc; - LOOP_OVER(kc, kind_constructor) { - if ((kc == CON_KIND_VARIABLE) || (kc == CON_INTERMEDIATE)) continue; - kind *K = Kinds::base_construction(kc); - package_request *pack = RTKindConstructors::package(kc); - - Emit::numeric_constant(RTKindConstructors::xref_iname(kc), 561); - - Emit::numeric_constant(RTKindConstructors::weak_ID_iname(kc), 0); - Hierarchy::make_available(RTKindConstructors::weak_ID_iname(kc)); - - TEMPORARY_TEXT(S) - WRITE_TO(S, "%+W", KindConstructors::get_name(kc, FALSE)); - Hierarchy::apply_metadata(pack, - KIND_PNAME_MD_HL, S); - DISCARD_TEXT(S) - - inference *inf; - int made_exp = FALSE; - KNOWLEDGE_LOOP(inf, KindSubjects::from_kind(K), property_inf) - if (PropertyInferences::get_property(inf) == P_specification) { - parse_node *spec = PropertyInferences::get_value(inf); - TEMPORARY_TEXT(exp) - IndexUtilities::dequote(exp, Lexer::word_raw_text(Wordings::first_wn(Node::get_text(spec)))); - Hierarchy::apply_metadata(pack, KIND_SPECIFICATION_MD_HL, exp); - DISCARD_TEXT(exp) - made_exp = TRUE; - break; - } - if ((made_exp == FALSE) && (RTKindConstructors::is_subkind_of_object(kc) == FALSE)) { - text_stream *exp = Kinds::Behaviour::get_specification_text(K); - if (Str::len(exp) > 0) - Hierarchy::apply_metadata(pack, KIND_SPECIFICATION_MD_HL, exp); - } - Hierarchy::apply_metadata_from_number(pack, - KIND_IS_BASE_MD_HL, 1); - if (KindConstructors::is_arithmetic(kc)) - Hierarchy::apply_metadata_from_number(pack, KIND_IS_QUASINUMERICAL_MD_HL, 1); - if (RTKindConstructors::is_object(kc)) { - Hierarchy::apply_metadata_from_number(pack, KIND_IS_OBJECT_MD_HL, 1); - } else { - Hierarchy::apply_metadata_from_number(pack, KIND_IS_OBJECT_MD_HL, 0); - } - if (RTKindConstructors::is_subkind_of_object(kc)) { - kind *super_K = Latticework::super(K); - Hierarchy::apply_metadata_from_number(pack, KIND_IS_SKOO_MD_HL, 1); - TEMPORARY_TEXT(SK) - WRITE_TO(SK, "%u", super_K); - Hierarchy::apply_metadata(pack, INDEX_SUPERKIND_MD_HL, SK); - DISCARD_TEXT(SK) - Hierarchy::apply_metadata_from_iname(pack, SUPERKIND_MD_HL, - RTKindConstructors::weak_ID_iname(super_K->construct)); - } else { - Hierarchy::apply_metadata_from_number(pack, KIND_IS_SKOO_MD_HL, 0); - } - if (Kinds::Behaviour::is_subkind_of_object(K)) { - wording W = Kinds::Behaviour::get_name(K, FALSE); - if (Wordings::nonempty(W)) { - TEMPORARY_TEXT(temp) - WRITE_TO(temp, "kind_%N", Wordings::first_wn(W)); - if (DocReferences::validate_if_possible(temp)) - Kinds::Behaviour::set_documentation_reference(K, temp); - DISCARD_TEXT(temp) - } - } - text_stream *DR = Kinds::Behaviour::get_documentation_reference(K); - if (Str::len(DR) > 0) - Hierarchy::apply_metadata(pack, KIND_DOCUMENTATION_MD_HL, DR); - if (Kinds::is_proper_constructor(K)) { - TEMPORARY_TEXT(CONS) - int i, a = KindConstructors::arity(Kinds::get_construct(K)); - if ((a == 2) && - (KindConstructors::variance(Kinds::get_construct(K), 0) == - KindConstructors::variance(Kinds::get_construct(K), 1))) - a = 1; - for (i=0; i 0) WRITE_TO(CONS, ", "); - if (KindConstructors::variance(Kinds::get_construct(K), i) > 0) - WRITE_TO(CONS, "covariant"); - else - WRITE_TO(CONS, "contravariant"); - if (a > 1) WRITE_TO(CONS, " in %c", 'K'+i); - } - Hierarchy::apply_metadata(pack, KIND_INDEX_VARIANCE_MD_HL, CONS); - DISCARD_TEXT(CONS) - } - - - Hierarchy::apply_metadata_from_number(pack, KIND_INDEX_PRIORITY_MD_HL, - (inter_ti) Kinds::Behaviour::get_index_priority(K)); - if (RTKindConstructors::is_subkind_of_object(kc)) { - Hierarchy::apply_metadata_from_iname(pack, - KIND_CLASS_MD_HL, RTKindDeclarations::iname(Kinds::base_construction(kc))); - } - if (KindConstructors::is_definite(kc)) { - Hierarchy::apply_metadata_from_number(pack, - KIND_IS_DEF_MD_HL, 1); - } else { - Hierarchy::apply_metadata_from_number(pack, - KIND_IS_DEF_MD_HL, 0); - } - if (KindConstructors::uses_block_values(kc)) { - Hierarchy::apply_metadata_from_number(pack, - KIND_HAS_BV_MD_HL, 1); - } else { - Hierarchy::apply_metadata_from_number(pack, - KIND_HAS_BV_MD_HL, 0); - } - inter_name *weak_iname = RTKindIDs::weak_iname_of_constructor(kc); - if (weak_iname == NULL) internal_error("no iname for weak ID"); - Hierarchy::apply_metadata_from_iname(pack, - KIND_WEAK_ID_MD_HL, weak_iname); - Hierarchy::apply_metadata_from_iname(pack, - KIND_STRONG_ID_MD_HL, RTKindConstructors::weak_ID_iname(kc)); - if (KindConstructors::uses_block_values(kc)) { - inter_name *sf_iname = RTKindConstructors::get_support_fn_iname(kc); - if (sf_iname) - Hierarchy::apply_metadata_from_iname(pack, - KIND_SUPPORT_FN_MD_HL, sf_iname); - else internal_error("kind with block values but no support function"); - } - - if ((RTKindConstructors::is_subkind_of_object(kc) == FALSE) && - (KindConstructors::is_definite(kc)) && - (KindConstructors::uses_signed_comparisons(kc) == FALSE)) { - inter_name *cf_iname = RTKindConstructors::get_comparison_fn_iname(kc); - if (cf_iname) - Hierarchy::apply_metadata_from_iname(pack, - KIND_CMP_FN_MD_HL, cf_iname); - else internal_error("kind with no comparison function"); - } - if (Kinds::Behaviour::definite(Kinds::base_construction(kc))) { - inter_name *mkdef_iname = RTKindConstructors::get_mkdef_iname(kc); - Hierarchy::apply_metadata_from_iname(pack, - KIND_MKDEF_FN_MD_HL, mkdef_iname); - } - if (RTKindConstructors::is_subkind_of_object(kc) == FALSE) { - inter_name *printing_rule_name = - RTKindConstructors::get_iname(Kinds::base_construction(kc)); - if (printing_rule_name) - Hierarchy::apply_metadata_from_iname(pack, - KIND_PRINT_FN_MD_HL, printing_rule_name); - } - if ((RTKindConstructors::is_subkind_of_object(kc) == FALSE) && - (KindConstructors::is_an_enumeration(kc))) - Hierarchy::apply_metadata_from_number(pack, - KIND_DSIZE_MD_HL, - (inter_ti) RTKindConstructors::get_highest_valid_value_as_integer_kc(kc)); - - if (Kinds::Behaviour::definite(Kinds::base_construction(kc))) { - inter_name *mkdef_iname = RTKindConstructors::get_mkdef_iname(kc); - packaging_state save = Functions::begin(mkdef_iname); - inter_symbol *sk_s = LocalVariables::new_other_as_symbol(I"sk"); - EmitCode::inv(RETURN_BIP); - EmitCode::down(); - if (KindConstructors::uses_block_values(kc)) { - inter_name *iname = Hierarchy::find(BLKVALUECREATE_HL); - EmitCode::call(iname); - EmitCode::down(); - EmitCode::val_symbol(K_value, sk_s); - EmitCode::up(); - } else { - if (RTKindConstructors::is_subkind_of_object(kc)) - EmitCode::val_false(); - else - DefaultValues::val(Kinds::base_construction(kc), - EMPTY_WORDING, "default value"); - } - EmitCode::up(); - Functions::end(save); - } - - if ((Kinds::Behaviour::is_an_enumeration(K)) || (Kinds::Behaviour::is_object(K))) { - TEMPORARY_TEXT(ICN) - WRITE_TO(ICN, "ICOUNT_"); - Kinds::Textual::write(ICN, K); - Str::truncate(ICN, 31); - LOOP_THROUGH_TEXT(pos, ICN) { - Str::put(pos, Characters::toupper(Str::get(pos))); - if (Characters::isalnum(Str::get(pos)) == FALSE) Str::put(pos, '_'); - } - inter_name *iname = Hierarchy::make_iname_with_specific_translation(ICOUNT_HL, - InterSymbolsTable::render_identifier_unique(LargeScale::main_scope(Emit::tree()), ICN), - RTKindConstructors::kind_package(K)); - Hierarchy::make_available(iname); - DISCARD_TEXT(ICN) - Emit::numeric_constant(iname, (inter_ti) Instances::count(K)); - - if (Kinds::eq(K, K_room)) { - inter_name *iname = - Hierarchy::make_iname_in(FWMATRIX_SIZE_HL, RTKindConstructors::kind_package(K)); - Hierarchy::make_available(iname); - inter_ti val = 0; - if (TargetVMs::is_16_bit(Task::vm()) == FALSE) - val = (inter_ti) (Instances::count(K)*Instances::count(K)); - if (global_compilation_settings.fast_route_finding) - val = (inter_ti) (Instances::count(K)*Instances::count(K)); - if (global_compilation_settings.slow_route_finding) - val = 0; - if (val <= 1) val = 2; - Emit::numeric_constant(iname, (inter_ti) val); - } - } - if (Kinds::Behaviour::is_object(K)) { - Hierarchy::apply_metadata_from_number(RTKindConstructors::kind_package(K), - KIND_IS_OBJECT_MD_HL, 1); - } else { - Hierarchy::apply_metadata_from_number(RTKindConstructors::kind_package(K), - KIND_IS_OBJECT_MD_HL, 0); - } - - if (Kinds::Behaviour::is_object(K)) { - if (RTShowmeCommand::needed_for_kind(K)) { - inter_name *iname = Hierarchy::make_iname_in(SHOWME_FN_HL, - RTKindConstructors::kind_package(K)); - RTShowmeCommand::compile_kind_showme_fn(iname, K); - Hierarchy::apply_metadata_from_iname(RTKindConstructors::kind_package(K), - KIND_SHOWME_MD_HL, iname); - } - } - - if (Kinds::eq(K, K_players_holdall)) - Hierarchy::apply_metadata_from_number(pack, RUCKSACK_CLASS_MD_HL, 1); - - @; - - if (kc->compilation_data.declaration_sequence_number >= 0) - Hierarchy::apply_metadata_from_number(pack, KIND_DECLARATION_ORDER_MD_HL, - (inter_ti) kc->compilation_data.declaration_sequence_number); - - if ((Kinds::Behaviour::is_quasinumerical(K)) && (Kinds::is_intermediate(K) == FALSE)) { - TEMPORARY_TEXT(OUT) - @; - Hierarchy::apply_metadata(pack, MIN_VAL_INDEX_MD_HL, OUT); - Str::clear(OUT); - @; - Hierarchy::apply_metadata(pack, MAX_VAL_INDEX_MD_HL, OUT); - Str::clear(OUT); - @; - Hierarchy::apply_metadata(pack, DIMENSIONS_INDEX_MD_HL, OUT); - DISCARD_TEXT(OUT) - } - - if ((RTKindConstructors::get_highest_valid_value_as_integer(K) == 0) && - (Kinds::Behaviour::indexed_grey_if_empty(K))) - Hierarchy::apply_metadata_from_number(pack, KIND_SHADED_MD_HL, 1); - if (Deferrals::has_finite_domain(K)) - Hierarchy::apply_metadata_from_number(pack, KIND_FINITE_DOMAIN_MD_HL, 1); - if (KindSubjects::has_properties(K)) - Hierarchy::apply_metadata_from_number(pack, KIND_HAS_PROPERTIES_MD_HL, 1); - if (RTKindConstructors::offers_I6_GPR(K)) - Hierarchy::apply_metadata_from_number(pack, KIND_UNDERSTANDABLE_MD_HL, 1); - if (Instances::count(K) > 0) - Hierarchy::apply_metadata_from_number(pack, KIND_INSTANCE_COUNT_MD_HL, - (inter_ti) Instances::count(K)); - TEMPORARY_TEXT(IDV) - int found = FALSE; - instance *inst; - LOOP_OVER_INSTANCES(inst, K) { - Instances::write_name(IDV, inst); - found = TRUE; - break; - } - if (found == FALSE) { - text_stream *p = Kinds::Behaviour::get_index_default_value(K); - if (Str::eq_wide_string(p, L"<0-in-literal-pattern>")) - @ - else if (Str::eq_wide_string(p, L"")) - WRITE_TO(IDV, "--"); - else WRITE_TO(IDV, "%S", p); - } - Hierarchy::apply_metadata(pack, KIND_INDEX_DEFAULT_MD_HL, IDV); - DISCARD_TEXT(IDV) - - TEMPORARY_TEXT(SN) - RTKindConstructors::index_name(SN, K, FALSE); - if (Str::len(SN) > 0) Hierarchy::apply_metadata(pack, KIND_INDEX_SINGULAR_MD_HL, SN); - DISCARD_TEXT(SN) - - TEMPORARY_TEXT(PN) - RTKindConstructors::index_name(PN, K, TRUE); - if (Str::len(PN) > 0) Hierarchy::apply_metadata(pack, KIND_INDEX_PLURAL_MD_HL, PN); - DISCARD_TEXT(PN) - - kind *K2; - LOOP_OVER_BASE_KINDS(K2) { - if ((Kinds::Behaviour::is_kind_of_kind(K2)) && (Kinds::conforms_to(K, K2)) - && (Kinds::eq(K2, K_pointer_value) == FALSE) - && (Kinds::eq(K2, K_stored_value) == FALSE)) { - package_request *R = - Hierarchy::package_within(KIND_CONFORMANCE_HAP, pack); - Hierarchy::apply_metadata_from_iname(R, CONFORMED_TO_MD_HL, - RTKindConstructors::xref_iname(K2->construct)); - } - } - - if (LiteralPatterns::list_of_literal_forms(K)) { - TEMPORARY_TEXT(LF) - LiteralPatterns::index_all(LF, K); - Hierarchy::apply_metadata(pack, KIND_INDEX_NOTATION_MD_HL, LF); - DISCARD_TEXT(LF) - } - - RTInferences::index(pack, KIND_BRIEF_INFERENCES_MD_HL, KindSubjects::from_kind(K), TRUE); - RTInferences::index(pack, KIND_INFERENCES_MD_HL, KindSubjects::from_kind(K), FALSE); - } - @; -} - -@ For every quasinumeric kind the default value is 0, but we don't want to -index just "0" because that means 0-as-a-number: we want it to come out -as "0 kg", "0 hectares", or whatever is appropriate. - -@ = - if (LiteralPatterns::list_of_literal_forms(K)) - LiteralPatterns::index_value(IDV, - LiteralPatterns::list_of_literal_forms(K), 0); - else - WRITE_TO(IDV, "--"); - -@ = - if (Kinds::eq(K, K_number)) WRITE("1"); - else { - text_stream *p = Kinds::Behaviour::get_index_minimum_value(K); - if (Str::len(p) > 0) WRITE("%S", p); - else LiteralPatterns::index_value(OUT, - LiteralPatterns::list_of_literal_forms(K), 1); - } - -@ = - if (Kinds::eq(K, K_number)) { - if (TargetVMs::is_16_bit(Task::vm())) WRITE("32767"); - else WRITE("2147483647"); - } else { - text_stream *p = Kinds::Behaviour::get_index_maximum_value(K); - if (Str::len(p) > 0) WRITE("%S", p); - else { - if (TargetVMs::is_16_bit(Task::vm())) - LiteralPatterns::index_value(OUT, - LiteralPatterns::list_of_literal_forms(K), 32767); - else - LiteralPatterns::index_value(OUT, - LiteralPatterns::list_of_literal_forms(K), 2147483647); - } - } - -@ = - if (Kinds::Dimensions::dimensionless(K) == FALSE) { - unit_sequence *deriv = Kinds::Behaviour::get_dimensional_form(K); - Kinds::Dimensions::index_unit_sequence(OUT, deriv, TRUE); - } - -@ = - kind *L, *R, *O; - int wn; - LOOP_OVER_MULTIPLICATIONS(L, R, O, wn) { - package_request *pack = Hierarchy::completion_package(MULTIPLICATION_RULE_HAP); - if (wn >= 0) Hierarchy::apply_metadata_from_number(pack, SET_AT_MD_HL, (inter_ti) wn); - TEMPORARY_TEXT(OUT) - WRITE_TO(OUT, "%u", L); - Hierarchy::apply_metadata(pack, LEFT_OPERAND_MD_HL, OUT); - Str::clear(OUT); - WRITE_TO(OUT, "%u", R); - Hierarchy::apply_metadata(pack, RIGHT_OPERAND_MD_HL, OUT); - Str::clear(OUT); - WRITE_TO(OUT, "%u", O); - Hierarchy::apply_metadata(pack, RESULT_MD_HL, OUT); - Str::clear(OUT); - LiteralPatterns::index_benchmark_value(OUT, L); - Hierarchy::apply_metadata(pack, LEFT_OPERAND_BM_MD_HL, OUT); - Str::clear(OUT); - LiteralPatterns::index_benchmark_value(OUT, R); - Hierarchy::apply_metadata(pack, RIGHT_OPERAND_BM_MD_HL, OUT); - Str::clear(OUT); - LiteralPatterns::index_benchmark_value(OUT, O); - Hierarchy::apply_metadata(pack, RESULT_BM_MD_HL, OUT); - DISCARD_TEXT(OUT) - } - -@ +@ The following works for all enumerations, standard or not: = -void RTKindConstructors::index_name(OUTPUT_STREAM, kind *K, int plural) { - wording W = Kinds::Behaviour::get_name(K, plural); - if (Wordings::nonempty(W)) { - if (Kinds::is_proper_constructor(K)) { - @; - } else { - WRITE("%W", W); - } +int RTKindConstructors::enumeration_size(kind *K) { + if (K == NULL) return 0; + kind_constructor *kc = Kinds::get_construct(K); + if (KindConstructors::is_an_enumeration(kc)) return kc->next_free_value - 1; + return 0; +} + +@ Non-standard enumeration occurs when a kit defines an enumerative kind with +runtime values other than 1, 2, 3, ...; an instance which has other than the +expected runtime value is called "out of order", and a kind is a "non-standard +enumeration" if it has an out of order instance. + += +void RTKindConstructors::set_explicit_runtime_instance_value(kind *K, instance *I, + inter_ti val) { + kind_constructor *kc = Kinds::get_construct(K); + RTInstances::set_explicit_runtime_value(I, val); + if (RTInstances::out_of_place(I)) + kc->compilation_data.nonstandard_enumeration = TRUE; +} + +int RTKindConstructors::is_nonstandard_enumeration(kind *K) { + kind_constructor *kc = Kinds::get_construct(K); + return kc->compilation_data.nonstandard_enumeration; +} + +@ The following function is useful when compiling lists of the valid values +for an enumeration. + +A little dubiously, for a standard enumeration ("Colour is a kind of value. The +colours are red, green and blue."), the entries are just the numbers 1, 2, 3, ... +That never seems a good use of memory, but it is still more efficient to store +one copy of this than to have to construct it frequently at runtime. + +For a nonstandard enumeration, the entries are more interesting. They essentially +duplicate the instances array, but again, it's more efficient to take the memory +overhead. + += +void RTKindConstructors::make_enumeration_entries(kind *K) { + if (RTKindConstructors::is_nonstandard_enumeration(K)) { + instance *I; + LOOP_OVER_INSTANCES(I, K) + EmitArrays::iname_entry(RTInstances::value_iname(I)); + } else { + int N = RTKindConstructors::enumeration_size(K); + for (int i = 1; i <= N; i++) + EmitArrays::numeric_entry((inter_ti) i); } } -@ = - int length = Wordings::length(W), w1 = Wordings::first_wn(W), tinted = TRUE; - int i, first_stroke = -1, last_stroke = -1; - for (i=0; i= 0) from = last_stroke+1; else tinted = FALSE; - if (tinted) HTML::begin_span(OUT, I"indexgrey"); - for (i=from; i<=to; i++) { - int j, untinted = FALSE; - for (j=0; jfrom) WRITE(" "); - if (Lexer::word(w1+i) == CAPITAL_K_V) WRITE("K"); - else if (Lexer::word(w1+i) == CAPITAL_L_V) WRITE("L"); - else WRITE("%V", Lexer::word(w1+i)); - if (untinted) HTML::begin_span(OUT, I"indexgrey"); - } - if (tinted) HTML::end_span(OUT); - -@ +@h Assigning declaration sequence numbers. +These provide a sequencing useful to code-generators, with superkinds earlier +in the sequence than subkinds -- which may not be true of source code ordering. = inter_ti kind_sequence_counter = 0; @@ -926,160 +646,283 @@ void RTKindConstructors::assign_dsn_r(int *N, inference_subject *within) { RTKindConstructors::assign_dsn_r(N, subj); } -@ +@h Compilation. +Deep breath now... = -void RTKindConstructors::compile_permissions(void) { +void RTKindConstructors::compile(void) { kind_constructor *kc; LOOP_OVER(kc, kind_constructor) { if ((kc == CON_KIND_VARIABLE) || (kc == CON_INTERMEDIATE)) continue; kind *K = Kinds::base_construction(kc); - if (RTKindDeclarations::base_represented_in_Inter(K)) { - RTPropertyPermissions::emit_kind_permissions(K); - RTPropertyValues::compile_values_for_kind(K); - } + package_request *pack = RTKindConstructors::package(kc); + @; + @; + @; + @; } + RTKindConstructors::apply_multiplication_rule_metadata(); } -@ = +@h Part I: Identification. + +@ = + @; + @; + +@ = + Emit::numeric_constant(RTKindConstructors::weak_ID_iname(kc), 0); + Hierarchy::make_available(RTKindConstructors::weak_ID_iname(kc)); + +@ See above: the value of this constant can be anything at all, since only +its position in the Inter hierarchy matters. But 561 is the smallest Carmichael +number, which is good enough for me. + +@ = + Emit::numeric_constant(RTKindConstructors::xref_iname(kc), 561); + +@h Part II: General metadata. + +@ = + @; + @; + @; + @; + @; + @; + @; + if (RTKindConstructors::is_subkind_of_object(kc)) { + @; + @; + } + if (KindConstructors::is_an_enumeration(kc)) { + @; + } + if ((Kinds::Behaviour::is_an_enumeration(K)) || (Kinds::Behaviour::is_object(K))) { + @; + } + +@ = + inter_name *weak_iname = RTKindIDs::weak_iname_of_constructor(kc); + if (weak_iname == NULL) internal_error("no iname for weak ID"); + Hierarchy::apply_metadata_from_iname(pack, KIND_WEAK_ID_MD_HL, weak_iname); + Hierarchy::apply_metadata_from_iname(pack, KIND_STRONG_ID_MD_HL, + RTKindConstructors::weak_ID_iname(kc)); + +@ Four forms of the name: one always present, and a best effort to describe the +constructor wherever it came from; the second only present if a natural-language +form of the name exists; and the other two are more prettily printed for the index. + +@ = + wording W = KindConstructors::get_name(kc, FALSE); + if (Wordings::nonempty(W)) { + Hierarchy::apply_metadata_from_wording(pack, KIND_NAME_MD_HL, W); + Hierarchy::apply_metadata_from_raw_wording(pack, KIND_PNAME_MD_HL, W); + } else if (Str::len(kc->explicit_identifier) > 0) { + Hierarchy::apply_metadata(pack, KIND_NAME_MD_HL, kc->explicit_identifier); + } else { + Hierarchy::apply_metadata(pack, KIND_NAME_MD_HL, I"(anonymous kind)"); + } + TEMPORARY_TEXT(SN) + RTKindConstructors::index_name(SN, K, FALSE); + if (Str::len(SN) > 0) Hierarchy::apply_metadata(pack, KIND_INDEX_SINGULAR_MD_HL, SN); + DISCARD_TEXT(SN) + TEMPORARY_TEXT(PN) + RTKindConstructors::index_name(PN, K, TRUE); + if (Str::len(PN) > 0) Hierarchy::apply_metadata(pack, KIND_INDEX_PLURAL_MD_HL, PN); + DISCARD_TEXT(PN) + +@ = + if (kc->where_defined_in_source_text) + Hierarchy::apply_metadata_from_number(pack, KIND_AT_MD_HL, + (inter_ti) Wordings::first_wn(Node::get_text(kc->where_defined_in_source_text))); + +@ = + if (kc->compilation_data.declaration_sequence_number >= 0) + Hierarchy::apply_metadata_from_number(pack, KIND_DECLARATION_ORDER_MD_HL, + (inter_ti) kc->compilation_data.declaration_sequence_number); + +@ This text can come either from the value of the specification pseudo-property, +or can come from the Neptune file creating a kind. + +@ = + inference *inf; + int made_exp = FALSE; + KNOWLEDGE_LOOP(inf, KindSubjects::from_kind(K), property_inf) + if (PropertyInferences::get_property(inf) == P_specification) { + parse_node *spec = PropertyInferences::get_value(inf); + TEMPORARY_TEXT(exp) + IndexUtilities::dequote(exp, + Lexer::word_raw_text(Wordings::first_wn(Node::get_text(spec)))); + Hierarchy::apply_metadata(pack, KIND_SPECIFICATION_MD_HL, exp); + DISCARD_TEXT(exp) + made_exp = TRUE; + break; + } + if ((made_exp == FALSE) && (RTKindConstructors::is_subkind_of_object(kc) == FALSE)) { + text_stream *exp = Kinds::Behaviour::get_specification_text(K); + if (Str::len(exp) > 0) + Hierarchy::apply_metadata(pack, KIND_SPECIFICATION_MD_HL, exp); + } + +@ = + if (KindConstructors::is_base(kc)) + Hierarchy::apply_metadata_from_number(pack, KIND_IS_BASE_MD_HL, 1); + if (KindConstructors::is_proper_constructor(kc)) + Hierarchy::apply_metadata_from_number(pack, KIND_IS_PROPER_MD_HL, 1); + if (KindConstructors::is_arithmetic(kc)) + Hierarchy::apply_metadata_from_number(pack, KIND_IS_QUASINUMERICAL_MD_HL, 1); + if (RTKindConstructors::is_object(kc)) + Hierarchy::apply_metadata_from_number(pack, KIND_IS_OBJECT_MD_HL, 1); + if (RTKindConstructors::is_subkind_of_object(kc)) + Hierarchy::apply_metadata_from_number(pack, KIND_IS_SKOO_MD_HL, 1); + if (KindConstructors::is_definite(kc)) + Hierarchy::apply_metadata_from_number(pack, KIND_IS_DEF_MD_HL, 1); + if (KindConstructors::uses_block_values(kc)) + Hierarchy::apply_metadata_from_number(pack, KIND_HAS_BV_MD_HL, 1); + if (Deferrals::has_finite_domain(K)) + Hierarchy::apply_metadata_from_number(pack, KIND_FINITE_DOMAIN_MD_HL, 1); + if ((KindSubjects::has_properties(K)) && + (RTKindConstructors::is_nonstandard_enumeration(K) == FALSE)) + Hierarchy::apply_metadata_from_number(pack, KIND_HAS_PROPERTIES_MD_HL, 1); + if (Kinds::Behaviour::is_understandable(K)) + Hierarchy::apply_metadata_from_number(pack, KIND_UNDERSTANDABLE_MD_HL, 1); + if (Kinds::eq(K, K_players_holdall)) + Hierarchy::apply_metadata_from_number(pack, RUCKSACK_CLASS_MD_HL, 1); + +@ = + Hierarchy::apply_metadata_from_iname(pack, + KIND_CLASS_MD_HL, RTKindDeclarations::iname(Kinds::base_construction(kc))); + +@ = + kind *super_K = Latticework::super(K); + TEMPORARY_TEXT(SK) + WRITE_TO(SK, "%u", super_K); + Hierarchy::apply_metadata(pack, INDEX_SUPERKIND_MD_HL, SK); + DISCARD_TEXT(SK) + Hierarchy::apply_metadata_from_iname(pack, SUPERKIND_MD_HL, + RTKindConstructors::weak_ID_iname(super_K->construct)); + +@ = + Hierarchy::apply_metadata_from_number(pack, KIND_DSIZE_MD_HL, + (inter_ti) RTKindConstructors::enumeration_size(K)); + +@ = + if (Instances::count(K) > 0) + Hierarchy::apply_metadata_from_number(pack, KIND_INSTANCE_COUNT_MD_HL, + (inter_ti) Instances::count(K)); + +@h Part III: Constants, arrays and functions. + +@ = + if ((Kinds::Behaviour::is_an_enumeration(K)) || (Kinds::Behaviour::is_object(K))) { + @; + if (RTKindConstructors::is_nonstandard_enumeration(K)) { + @; + } + if (Kinds::eq(K, K_room)) { + @; + @; + } + if (Kinds::eq(K, K_door)) { + @; + } + } if (Kinds::Behaviour::is_an_enumeration(K)) { - inter_name *printing_rule_name = RTKindConstructors::get_iname(K); - @; - @; - @; + @; + @; + @; } if ((Kinds::Behaviour::is_built_in(K) == FALSE) && - (Kinds::Behaviour::is_subkind_of_object(K) == FALSE) && - (Kinds::Behaviour::is_an_enumeration(K) == FALSE)) { - if (Kinds::eq(K, K_use_option)) { - inter_name *printing_rule_name = RTKindConstructors::get_iname(K); - packaging_state save = Functions::begin(printing_rule_name); - inter_symbol *value_s = LocalVariables::new_other_as_symbol(I"value"); - EmitCode::call(Hierarchy::find(PRINT_USE_OPTION_HL)); - EmitCode::down(); - EmitCode::val_symbol(K_value, value_s); - EmitCode::up(); - Functions::end(save); - continue; - } - if (Kinds::eq(K, K_table)) { - inter_name *printing_rule_name = RTKindConstructors::get_iname(K); - packaging_state save = Functions::begin(printing_rule_name); - inter_symbol *value_s = LocalVariables::new_other_as_symbol(I"value"); - EmitCode::call(Hierarchy::find(PRINT_TABLE_HL)); - EmitCode::down(); - EmitCode::val_symbol(K_value, value_s); - EmitCode::up(); - Functions::end(save); - continue; - } - if (Kinds::eq(K, K_response)) { - inter_name *printing_rule_name = RTKindConstructors::get_iname(K); - packaging_state save = Functions::begin(printing_rule_name); - inter_symbol *value_s = LocalVariables::new_other_as_symbol(I"value"); - EmitCode::call(Hierarchy::find(PRINT_RESPONSE_HL)); - EmitCode::down(); - EmitCode::val_symbol(K_value, value_s); - EmitCode::up(); - Functions::end(save); - continue; - } - inter_name *printing_rule_name = RTKindConstructors::get_iname(K); - if (Kinds::Behaviour::is_quasinumerical(K)) { - @; - @; - } else { - @; - } + (Kinds::Behaviour::is_quasinumerical(K))) { + @; } - -@ A slightly bogus case first. If the source text declares a kind but never -gives any enumerated values or literal patterns, then such values will never -appear at run-time; but we need the printing routine to exist to avoid -compilation errors. - -@ = - packaging_state save = Functions::begin(printing_rule_name); - inter_symbol *value_s = LocalVariables::new_other_as_symbol(I"value"); - TEMPORARY_TEXT(C) - WRITE_TO(C, "weak kind ID: %n\n", RTKindIDs::weak_iname(K)); - EmitCode::comment(C); - DISCARD_TEXT(C) - EmitCode::inv(PRINT_BIP); - EmitCode::down(); - EmitCode::val_symbol(K_value, value_s); - EmitCode::up(); - Functions::end(save); - -@ A unit is printed back with its earliest-defined literal pattern used as -notation. If it had no literal patterns, it would come out as decimal numbers, -but at present this can't happen. - -@ = - if (LiteralPatterns::list_of_literal_forms(K)) - RTLiteralPatterns::printing_routine(printing_rule_name, - LiteralPatterns::list_of_literal_forms(K)); - else { - packaging_state save = Functions::begin(printing_rule_name); - inter_symbol *value_s = LocalVariables::new_other_as_symbol(I"value"); - EmitCode::inv(PRINT_BIP); - EmitCode::down(); - EmitCode::val_symbol(K_value, value_s); - EmitCode::up(); - Functions::end(save); + if (KindConstructors::uses_block_values(kc)) { + @; } - -@ = - packaging_state save = Functions::begin(printing_rule_name); - inter_symbol *value_s = LocalVariables::new_other_as_symbol(I"value"); - - EmitCode::inv(SWITCH_BIP); - EmitCode::down(); - EmitCode::val_symbol(K_value, value_s); - EmitCode::code(); - EmitCode::down(); - instance *I; - LOOP_OVER_INSTANCES(I, K) { - EmitCode::inv(CASE_BIP); - EmitCode::down(); - EmitCode::val_iname(K_value, RTInstances::value_iname(I)); - EmitCode::code(); - EmitCode::down(); - EmitCode::inv(PRINT_BIP); - EmitCode::down(); - TEMPORARY_TEXT(CT) - wording NW = Instances::get_name_in_play(I, FALSE); - LOOP_THROUGH_WORDING(k, NW) { - TranscodeText::from_wide_string(CT, Lexer::word_raw_text(k), CT_RAW); - if (k < Wordings::last_wn(NW)) WRITE_TO(CT, " "); - } - EmitCode::val_text(CT); - DISCARD_TEXT(CT) - EmitCode::up(); - EmitCode::up(); - EmitCode::up(); + if ((RTKindConstructors::is_subkind_of_object(kc) == FALSE) && + (KindConstructors::is_definite(kc)) && + (KindConstructors::uses_signed_comparisons(kc) == FALSE)) { + @; + } + if (Kinds::Behaviour::definite(K)) { + @; + @; + } + if (RTKindConstructors::is_subkind_of_object(kc) == FALSE) { + @; + if (Kinds::Behaviour::is_an_enumeration(K)) { + @; + } + if ((Kinds::Behaviour::is_built_in(K) == FALSE) && + (Kinds::Behaviour::is_an_enumeration(K) == FALSE)) { + if (Kinds::Behaviour::is_quasinumerical(K)) { + @; + } else { + @; } - EmitCode::inv(DEFAULT_BIP); /* this default case should never be needed, unless the user has blundered at the I6 level: */ - EmitCode::down(); - EmitCode::code(); - EmitCode::down(); - EmitCode::inv(PRINT_BIP); - EmitCode::down(); - TEMPORARY_TEXT(DT) - wording W = Kinds::Behaviour::get_name(K, FALSE); - WRITE_TO(DT, ""); - EmitCode::val_text(DT); - DISCARD_TEXT(DT) - EmitCode::up(); - EmitCode::up(); - EmitCode::up(); - EmitCode::up(); - EmitCode::up(); + } + } + if ((Kinds::Behaviour::is_object(K)) && (RTShowmeCommand::needed_for_kind(K))) { + @; + @; + } + if ((RTKindConstructors::GPR_compilation_enabled()) && + (RTKindConstructors::GPR_provided_by_kit(K) == FALSE)) { + if (Kinds::Behaviour::is_an_enumeration(K)) { + @; + } else if (Kinds::Behaviour::is_quasinumerical(K)) { + @; + } + } - Functions::end(save); +@ = + inter_name *iname = RTKindConstructors::icount_iname(K); + Emit::numeric_constant(iname, (inter_ti) Instances::count(K)); + +@ = + inter_name *array_iname = RTKindConstructors::instances_array_iname(K); + Hierarchy::make_available(array_iname); + packaging_state save = EmitArrays::begin_word(array_iname, K_value); + EmitArrays::numeric_entry((inter_ti) Instances::count(K)); + RTKindConstructors::make_enumeration_entries(K); + EmitArrays::numeric_entry(0); + EmitArrays::end(save); + Hierarchy::apply_metadata_from_iname(RTKindConstructors::kind_package(K), + ENUMERATION_ARRAY_MD_HL, array_iname); + +@ This improbable-looking constant is the size of storage to allocate for the +route-finding algorithm in |WorldModelKit|. If the fast algorithm is used, +more storage is needed than for the slow one, and the default choice is fast +on 32-bit platforms, slow on 16-bit, where memory is scarcer. We're declaring +the constant here because this is too tricky a bit of conditional compilation +to be handled inside the kit itself. + +@ = + inter_name *iname = + Hierarchy::make_iname_in(FWMATRIX_SIZE_HL, RTKindConstructors::kind_package(K)); + Hierarchy::make_available(iname); + inter_ti val = 0; + if (TargetVMs::is_16_bit(Task::vm()) == FALSE) + val = (inter_ti) (Instances::count(K)*Instances::count(K)); + if (global_compilation_settings.fast_route_finding) + val = (inter_ti) (Instances::count(K)*Instances::count(K)); + if (global_compilation_settings.slow_route_finding) + val = 0; + if (val <= 1) val = 2; + Emit::numeric_constant(iname, (inter_ti) val); + +@ = + inter_name *iname = + Hierarchy::make_iname_in(NUM_DOORS_HL, RTKindConstructors::kind_package(K)); + Hierarchy::make_available(iname); + Emit::numeric_constant(iname, (inter_ti) Instances::count(K)); + +@ = + inter_name *iname = + Hierarchy::make_iname_in(NUM_ROOMS_HL, RTKindConstructors::kind_package(K)); + Hierarchy::make_available(iname); + Emit::numeric_constant(iname, (inter_ti) Instances::count(K)); @ The suite of standard routines provided for enumerative types is a little like the one in Ada (|T'Succ|, |T'Pred|, and so on). @@ -1092,17 +935,15 @@ wrapping around to the first from the last; wrapping around to the last from the first, so that it is the inverse function to |A_T1_colour(v)|. -@ = - int instance_count = 0; - instance *I; - LOOP_OVER_INSTANCES(I, K) instance_count++; +@ = + int instance_count = Instances::count(K); - inter_name *iname_i = RTKindConstructors::get_inc_iname(K); + inter_name *iname_i = RTKindConstructors::increment_fn_iname(K); packaging_state save = Functions::begin(iname_i); @; Functions::end(save); - inter_name *iname_d = RTKindConstructors::get_dec_iname(K); + inter_name *iname_d = RTKindConstructors::decrement_fn_iname(K); save = Functions::begin(iname_d); @; Functions::end(save); @@ -1120,6 +961,12 @@ first function ever implemented by emitting Inter code, on 12 November 2017. if (instance_count <= 1) { EmitCode::val_symbol(K, x); + } else if (RTKindConstructors::is_nonstandard_enumeration(K)) { + EmitCode::call(Hierarchy::find(NEXT_ENUM_VAL_HL)); + EmitCode::down(); + EmitCode::val_symbol(K, x); + EmitCode::val_iname(K_value, RTKindConstructors::instances_array_iname(K)); + EmitCode::up(); } else { EmitCode::cast(K_number, K); EmitCode::down(); @@ -1152,6 +999,12 @@ first function ever implemented by emitting Inter code, on 12 November 2017. if (instance_count <= 1) { EmitCode::val_symbol(K, x); + } else if (RTKindConstructors::is_nonstandard_enumeration(K)) { + EmitCode::call(Hierarchy::find(PREV_ENUM_VAL_HL)); + EmitCode::down(); + EmitCode::val_symbol(K, x); + EmitCode::val_iname(K_value, RTKindConstructors::instances_array_iname(K)); + EmitCode::up(); } else { EmitCode::cast(K_number, K); EmitCode::down(); @@ -1193,83 +1046,94 @@ value, which will probably not be useful.) (b) |R_T1_colour(a, b)| returns a uniformly random choice in between |a| and |b| inclusive. -@ = - inter_name *iname_r = RTKindConstructors::get_ranger_iname(K); +@ = + inter_name *iname_r = RTKindConstructors::random_value_fn_iname(K); packaging_state save = Functions::begin(iname_r); inter_symbol *a_s = LocalVariables::new_other_as_symbol(I"a"); inter_symbol *b_s = LocalVariables::new_other_as_symbol(I"b"); - EmitCode::inv(IF_BIP); - EmitCode::down(); - EmitCode::inv(AND_BIP); + if (RTKindConstructors::is_nonstandard_enumeration(K)) { + EmitCode::inv(RETURN_BIP); + EmitCode::down(); + EmitCode::call(Hierarchy::find(RANDOM_ENUM_VAL_HL)); + EmitCode::down(); + EmitCode::val_iname(K_value, RTKindConstructors::instances_array_iname(K)); + EmitCode::val_symbol(K_value, a_s); + EmitCode::val_symbol(K_value, b_s); + EmitCode::up(); + EmitCode::up(); + } else { + EmitCode::inv(IF_BIP); + EmitCode::down(); + EmitCode::inv(AND_BIP); + EmitCode::down(); + EmitCode::inv(EQ_BIP); + EmitCode::down(); + EmitCode::val_symbol(K_value, a_s); + EmitCode::val_number(0); + EmitCode::up(); + EmitCode::inv(EQ_BIP); + EmitCode::down(); + EmitCode::val_symbol(K_value, b_s); + EmitCode::val_number(0); + EmitCode::up(); + EmitCode::up(); + EmitCode::code(); + EmitCode::down(); + EmitCode::inv(RETURN_BIP); + EmitCode::down(); + EmitCode::inv(RANDOM_BIP); + EmitCode::down(); + if (Kinds::Behaviour::is_quasinumerical(K)) + EmitCode::val_iname(K_value, Hierarchy::find(MAX_POSITIVE_NUMBER_HL)); + else + EmitCode::val_number((inter_ti) RTKindConstructors::enumeration_size(K)); + EmitCode::up(); + EmitCode::up(); + EmitCode::up(); + EmitCode::up(); + + EmitCode::inv(IF_BIP); EmitCode::down(); EmitCode::inv(EQ_BIP); EmitCode::down(); EmitCode::val_symbol(K_value, a_s); - EmitCode::val_number(0); - EmitCode::up(); - EmitCode::inv(EQ_BIP); - EmitCode::down(); EmitCode::val_symbol(K_value, b_s); - EmitCode::val_number(0); EmitCode::up(); - EmitCode::up(); - EmitCode::code(); - EmitCode::down(); - EmitCode::inv(RETURN_BIP); + EmitCode::code(); EmitCode::down(); - EmitCode::inv(RANDOM_BIP); + EmitCode::inv(RETURN_BIP); EmitCode::down(); - if (Kinds::Behaviour::is_quasinumerical(K)) - EmitCode::val_iname(K_value, Hierarchy::find(MAX_POSITIVE_NUMBER_HL)); - else - EmitCode::val_number((inter_ti) RTKindConstructors::get_highest_valid_value_as_integer(K)); + EmitCode::val_symbol(K_value, b_s); EmitCode::up(); EmitCode::up(); EmitCode::up(); - EmitCode::up(); - EmitCode::inv(IF_BIP); - EmitCode::down(); - EmitCode::inv(EQ_BIP); + inter_symbol *smaller = NULL, *larger = NULL; + + EmitCode::inv(IF_BIP); EmitCode::down(); - EmitCode::val_symbol(K_value, a_s); - EmitCode::val_symbol(K_value, b_s); - EmitCode::up(); - EmitCode::code(); - EmitCode::down(); - EmitCode::inv(RETURN_BIP); + EmitCode::inv(GT_BIP); EmitCode::down(); + EmitCode::val_symbol(K_value, a_s); EmitCode::val_symbol(K_value, b_s); EmitCode::up(); - EmitCode::up(); - EmitCode::up(); - - inter_symbol *smaller = NULL, *larger = NULL; - - EmitCode::inv(IF_BIP); - EmitCode::down(); - EmitCode::inv(GT_BIP); - EmitCode::down(); - EmitCode::val_symbol(K_value, a_s); - EmitCode::val_symbol(K_value, b_s); - EmitCode::up(); - EmitCode::code(); - EmitCode::down(); - EmitCode::inv(RETURN_BIP); + EmitCode::code(); EmitCode::down(); - smaller = b_s; larger = a_s; - @; + EmitCode::inv(RETURN_BIP); + EmitCode::down(); + smaller = b_s; larger = a_s; + @; + EmitCode::up(); EmitCode::up(); EmitCode::up(); - EmitCode::up(); - - EmitCode::inv(RETURN_BIP); - EmitCode::down(); - smaller = a_s; larger = b_s; - @; - EmitCode::up(); + EmitCode::inv(RETURN_BIP); + EmitCode::down(); + smaller = a_s; larger = b_s; + @; + EmitCode::up(); + } Functions::end(save); @ = @@ -1294,3 +1158,453 @@ and |b| inclusive. EmitCode::up(); EmitCode::up(); +@ = + inter_name *iname_r = RTKindConstructors::indexing_fn_iname(K); + packaging_state save = Functions::begin(iname_r); + inter_symbol *a_s = LocalVariables::new_other_as_symbol(I"a"); + + if (RTKindConstructors::is_nonstandard_enumeration(K)) { + EmitCode::inv(RETURN_BIP); + EmitCode::down(); + EmitCode::call(Hierarchy::find(INDEX_OF_ENUM_VAL_HL)); + EmitCode::down(); + EmitCode::val_iname(K_value, RTKindConstructors::instances_array_iname(K)); + EmitCode::val_symbol(K_value, a_s); + EmitCode::up(); + EmitCode::up(); + } else { + EmitCode::inv(IF_BIP); + EmitCode::down(); + EmitCode::inv(OR_BIP); + EmitCode::down(); + EmitCode::inv(LT_BIP); + EmitCode::down(); + EmitCode::val_symbol(K_value, a_s); + EmitCode::val_number(0); + EmitCode::up(); + EmitCode::inv(GT_BIP); + EmitCode::down(); + EmitCode::val_symbol(K_value, a_s); + EmitCode::val_number((inter_ti) RTKindConstructors::enumeration_size(K)); + EmitCode::up(); + EmitCode::up(); + EmitCode::code(); + EmitCode::down(); + EmitCode::inv(RETURN_BIP); + EmitCode::down(); + EmitCode::val_number(0); + EmitCode::up(); + EmitCode::up(); + EmitCode::up(); + + EmitCode::inv(RETURN_BIP); + EmitCode::down(); + EmitCode::val_symbol(K_value, a_s); + EmitCode::up(); + } + Functions::end(save); + +@ = + inter_name *iname = RTKindConstructors::support_fn_iname(K); + if (iname) Hierarchy::apply_metadata_from_iname(pack, KIND_SUPPORT_FN_MD_HL, iname); + else internal_error("kind with block values but no support function"); + +@ = + inter_name *iname = RTKindConstructors::comparison_fn_iname(K); + if (iname) Hierarchy::apply_metadata_from_iname(pack, KIND_CMP_FN_MD_HL, iname); + else internal_error("kind with no comparison function"); + +@ = + inter_name *iname = RTKindConstructors::default_value_fn_iname(kc); + Hierarchy::apply_metadata_from_iname(pack, KIND_MKDEF_FN_MD_HL, iname); + +@ = + inter_name *default_value_fn_iname = RTKindConstructors::default_value_fn_iname(kc); + packaging_state save = Functions::begin(default_value_fn_iname); + inter_symbol *sk_s = LocalVariables::new_other_as_symbol(I"sk"); + EmitCode::inv(RETURN_BIP); + EmitCode::down(); + if (KindConstructors::uses_block_values(kc)) { + inter_name *iname = Hierarchy::find(BLKVALUECREATE_HL); + EmitCode::call(iname); + EmitCode::down(); + EmitCode::val_symbol(K_value, sk_s); + EmitCode::up(); + } else { + if (RTKindConstructors::is_subkind_of_object(kc)) + EmitCode::val_false(); + else + DefaultValues::val(Kinds::base_construction(kc), + EMPTY_WORDING, "default value"); + } + EmitCode::up(); + Functions::end(save); + +@ = + inter_name *printing_rule_name = + RTKindConstructors::printing_fn_iname(Kinds::base_construction(kc)); + if (printing_rule_name) + Hierarchy::apply_metadata_from_iname(pack, KIND_PRINT_FN_MD_HL, + printing_rule_name); + +@ A slightly bogus printing function first. If the source text declares a kind +but never gives any enumerated values or literal patterns, then such values will +never appear at run-time; but we need the printing routine to exist to avoid +compilation errors. + +@ = + inter_name *printing_rule_name = RTKindConstructors::printing_fn_iname(K); + packaging_state save = Functions::begin(printing_rule_name); + inter_symbol *value_s = LocalVariables::new_other_as_symbol(I"value"); + TEMPORARY_TEXT(C) + WRITE_TO(C, "weak kind ID: %n\n", RTKindIDs::weak_iname(K)); + EmitCode::comment(C); + DISCARD_TEXT(C) + EmitCode::inv(PRINT_BIP); + EmitCode::down(); + EmitCode::val_symbol(K_value, value_s); + EmitCode::up(); + Functions::end(save); + +@ A unit is printed back with its earliest-defined literal pattern used as +notation. If it had no literal patterns, it would come out as decimal numbers, +but at present this can't happen. + +@ = + inter_name *printing_rule_name = RTKindConstructors::printing_fn_iname(K); + if (LiteralPatterns::list_of_literal_forms(K)) + RTLiteralPatterns::printing_routine(printing_rule_name, + LiteralPatterns::list_of_literal_forms(K)); + else { + packaging_state save = Functions::begin(printing_rule_name); + inter_symbol *value_s = LocalVariables::new_other_as_symbol(I"value"); + EmitCode::inv(PRINT_BIP); + EmitCode::down(); + EmitCode::val_symbol(K_value, value_s); + EmitCode::up(); + Functions::end(save); + } + +@ = + inter_name *printing_rule_name = RTKindConstructors::printing_fn_iname(K); + packaging_state save = Functions::begin(printing_rule_name); + inter_symbol *value_s = LocalVariables::new_other_as_symbol(I"value"); + + EmitCode::inv(SWITCH_BIP); + EmitCode::down(); + EmitCode::val_symbol(K_value, value_s); + EmitCode::code(); + EmitCode::down(); + instance *I; + LOOP_OVER_INSTANCES(I, K) { + EmitCode::inv(CASE_BIP); + EmitCode::down(); + EmitCode::val_iname(K_value, RTInstances::value_iname(I)); + EmitCode::code(); + EmitCode::down(); + EmitCode::inv(PRINT_BIP); + EmitCode::down(); + TEMPORARY_TEXT(CT) + wording NW = Instances::get_name_in_play(I, FALSE); + LOOP_THROUGH_WORDING(k, NW) { + TranscodeText::from_wide_string(CT, Lexer::word_raw_text(k), CT_RAW); + if (k < Wordings::last_wn(NW)) WRITE_TO(CT, " "); + } + EmitCode::val_text(CT); + DISCARD_TEXT(CT) + EmitCode::up(); + EmitCode::up(); + EmitCode::up(); + } + EmitCode::inv(DEFAULT_BIP); /* this default case should never be needed */ + EmitCode::down(); + EmitCode::code(); + EmitCode::down(); + EmitCode::inv(PRINT_BIP); + EmitCode::down(); + TEMPORARY_TEXT(DT) + wording W = Kinds::Behaviour::get_name(K, FALSE); + WRITE_TO(DT, ""); + EmitCode::val_text(DT); + DISCARD_TEXT(DT) + EmitCode::up(); + EmitCode::up(); + EmitCode::up(); + EmitCode::up(); + EmitCode::up(); + + Functions::end(save); + +@ = + inter_name *iname = RTKindConstructors::showme_fn_iname(K); + Hierarchy::apply_metadata_from_iname(RTKindConstructors::kind_package(K), + KIND_SHOWME_MD_HL, iname); + +@ = + inter_name *iname = RTKindConstructors::showme_fn_iname(K); + RTShowmeCommand::compile_kind_showme_fn(iname, K); + +@ = + text_stream *desc = Str::new(); + WRITE_TO(desc, "GPR for enumeration kind %u", K); + Sequence::queue(&KindGPRs::enumeration_agent, STORE_POINTER_kind(K), desc); + +@ = + text_stream *desc = Str::new(); + WRITE_TO(desc, "GPR for quasinumerical kind %u", K); + Sequence::queue(&KindGPRs::quasinumerical_agent, STORE_POINTER_kind(K), desc); + +@ = + kind *K2; + LOOP_OVER_BASE_KINDS(K2) { + if ((Kinds::Behaviour::is_kind_of_kind(K2)) && (Kinds::conforms_to(K, K2)) + && (Kinds::eq(K2, K_pointer_value) == FALSE) + && (Kinds::eq(K2, K_stored_value) == FALSE)) { + package_request *R = + Hierarchy::package_within(KIND_CONFORMANCE_HAP, pack); + Hierarchy::apply_metadata_from_iname(R, CONFORMED_TO_MD_HL, + RTKindConstructors::xref_iname(K2->construct)); + } + } + +@h Part IV: Indexing metadata. + +@ = + @; + if (Kinds::is_proper_constructor(K)) { + @; + } + @; + @; + @; + if ((Kinds::Behaviour::is_quasinumerical(K)) && (Kinds::is_intermediate(K) == FALSE)) { + @; + @; + } + @; + @; + +@ A documentation reference can be supplied literally by a Neptune file, or +can be implicit in the name of the kind. + +@ = + if (Kinds::Behaviour::is_subkind_of_object(K)) { + wording W = Kinds::Behaviour::get_name(K, FALSE); + if (Wordings::nonempty(W)) { + TEMPORARY_TEXT(temp) + WRITE_TO(temp, "kind_%N", Wordings::first_wn(W)); + if (DocReferences::validate_if_possible(temp)) + Kinds::Behaviour::set_documentation_reference(K, temp); + DISCARD_TEXT(temp) + } + } + text_stream *DR = Kinds::Behaviour::get_documentation_reference(K); + if (Str::len(DR) > 0) + Hierarchy::apply_metadata(pack, KIND_DOCUMENTATION_MD_HL, DR); + +@ This is just a textual description of what's going on with the terms +in a constructor, for the index. + +@ = + TEMPORARY_TEXT(CONS) + int i, a = KindConstructors::arity(Kinds::get_construct(K)); + if ((a == 2) && + (KindConstructors::variance(Kinds::get_construct(K), 0) == + KindConstructors::variance(Kinds::get_construct(K), 1))) + a = 1; + for (i=0; i 0) WRITE_TO(CONS, ", "); + if (KindConstructors::variance(Kinds::get_construct(K), i) > 0) + WRITE_TO(CONS, "covariant"); + else + WRITE_TO(CONS, "contravariant"); + if (a > 1) WRITE_TO(CONS, " in %c", 'K'+i); + } + Hierarchy::apply_metadata(pack, KIND_INDEX_VARIANCE_MD_HL, CONS); + DISCARD_TEXT(CONS) + +@ = + Hierarchy::apply_metadata_from_number(pack, KIND_INDEX_PRIORITY_MD_HL, + (inter_ti) Kinds::Behaviour::get_index_priority(K)); + +@ = + if ((RTKindConstructors::enumeration_size(K) == 0) && + (Kinds::Behaviour::indexed_grey_if_empty(K))) + Hierarchy::apply_metadata_from_number(pack, KIND_SHADED_MD_HL, 1); + +@ = + TEMPORARY_TEXT(IDV) + instance *I; + LOOP_OVER_INSTANCES(I, K) { + Instances::write_name(IDV, I); + break; + } + if (Str::len(IDV) == 0) { + text_stream *text = Kinds::Behaviour::get_index_default_value(K); + if (Str::eq(text, I"<0-in-literal-pattern>")) + @ + else if (Str::eq(text, I"")) + WRITE_TO(IDV, "--"); + else + WRITE_TO(IDV, "%S", text); + } + Hierarchy::apply_metadata(pack, KIND_INDEX_DEFAULT_MD_HL, IDV); + DISCARD_TEXT(IDV) + +@ For every quasinumeric kind the default value is 0, but we don't want to +index just "0" because that means 0-as-a-number: we want it to come out +as "0 kg", "0 hectares", or whatever is appropriate. + +@ = + if (LiteralPatterns::list_of_literal_forms(K)) + LiteralPatterns::index_value(IDV, + LiteralPatterns::list_of_literal_forms(K), 0); + else + WRITE_TO(IDV, "--"); + +@ = + TEMPORARY_TEXT(OUT) + @; + Hierarchy::apply_metadata(pack, MIN_VAL_INDEX_MD_HL, OUT); + Str::clear(OUT); + @; + Hierarchy::apply_metadata(pack, MAX_VAL_INDEX_MD_HL, OUT); + Str::clear(OUT); + DISCARD_TEXT(OUT) + +@ = + if (Kinds::eq(K, K_number)) WRITE("1"); + else { + text_stream *p = Kinds::Behaviour::get_index_minimum_value(K); + if (Str::len(p) > 0) WRITE("%S", p); + else LiteralPatterns::index_value(OUT, + LiteralPatterns::list_of_literal_forms(K), 1); + } + +@ = + if (Kinds::eq(K, K_number)) { + if (TargetVMs::is_16_bit(Task::vm())) WRITE("32767"); + else WRITE("2147483647"); + } else { + text_stream *p = Kinds::Behaviour::get_index_maximum_value(K); + if (Str::len(p) > 0) WRITE("%S", p); + else { + if (TargetVMs::is_16_bit(Task::vm())) + LiteralPatterns::index_value(OUT, + LiteralPatterns::list_of_literal_forms(K), 32767); + else + LiteralPatterns::index_value(OUT, + LiteralPatterns::list_of_literal_forms(K), 2147483647); + } + } + +@ = + TEMPORARY_TEXT(OUT) + if (Kinds::Dimensions::dimensionless(K) == FALSE) { + unit_sequence *deriv = Kinds::Behaviour::get_dimensional_form(K); + Kinds::Dimensions::index_unit_sequence(OUT, deriv, TRUE); + } + Hierarchy::apply_metadata(pack, DIMENSIONS_INDEX_MD_HL, OUT); + DISCARD_TEXT(OUT) + +@ = + if (LiteralPatterns::list_of_literal_forms(K)) { + TEMPORARY_TEXT(LF) + LiteralPatterns::index_all(LF, K); + Hierarchy::apply_metadata(pack, KIND_INDEX_NOTATION_MD_HL, LF); + DISCARD_TEXT(LF) + } + +@ = + RTInferences::index(pack, KIND_BRIEF_INFERENCES_MD_HL, KindSubjects::from_kind(K), TRUE); + RTInferences::index(pack, KIND_INFERENCES_MD_HL, KindSubjects::from_kind(K), FALSE); + +@h Pretty-printing names for the index. + += +void RTKindConstructors::index_name(OUTPUT_STREAM, kind *K, int plural) { + wording W = Kinds::Behaviour::get_name(K, plural); + if (Wordings::nonempty(W)) { + if (Kinds::is_proper_constructor(K)) { + @; + } else { + WRITE("%W", W); + } + } +} + +@ = + int length = Wordings::length(W), w1 = Wordings::first_wn(W), tinted = TRUE; + int i, first_stroke = -1, last_stroke = -1; + for (i=0; i= 0) from = last_stroke+1; else tinted = FALSE; + if (tinted) HTML::begin_span(OUT, I"indexgrey"); + for (i=from; i<=to; i++) { + int j, untinted = FALSE; + for (j=0; jfrom) WRITE(" "); + if (Lexer::word(w1+i) == CAPITAL_K_V) WRITE("K"); + else if (Lexer::word(w1+i) == CAPITAL_L_V) WRITE("L"); + else WRITE("%V", Lexer::word(w1+i)); + if (untinted) HTML::begin_span(OUT, I"indexgrey"); + } + if (tinted) HTML::end_span(OUT); + +@h Metadata about multiplication. +This is used only for indexing. + += +void RTKindConstructors::apply_multiplication_rule_metadata(void) { + kind *L, *R, *O; + int wn; + LOOP_OVER_MULTIPLICATIONS(L, R, O, wn) { + package_request *pack = Hierarchy::completion_package(MULTIPLICATION_RULE_HAP); + if (wn >= 0) Hierarchy::apply_metadata_from_number(pack, SET_AT_MD_HL, (inter_ti) wn); + TEMPORARY_TEXT(OUT) + WRITE_TO(OUT, "%u", L); + Hierarchy::apply_metadata(pack, LEFT_OPERAND_MD_HL, OUT); + Str::clear(OUT); + WRITE_TO(OUT, "%u", R); + Hierarchy::apply_metadata(pack, RIGHT_OPERAND_MD_HL, OUT); + Str::clear(OUT); + WRITE_TO(OUT, "%u", O); + Hierarchy::apply_metadata(pack, RESULT_MD_HL, OUT); + Str::clear(OUT); + LiteralPatterns::index_benchmark_value(OUT, L); + Hierarchy::apply_metadata(pack, LEFT_OPERAND_BM_MD_HL, OUT); + Str::clear(OUT); + LiteralPatterns::index_benchmark_value(OUT, R); + Hierarchy::apply_metadata(pack, RIGHT_OPERAND_BM_MD_HL, OUT); + Str::clear(OUT); + LiteralPatterns::index_benchmark_value(OUT, O); + Hierarchy::apply_metadata(pack, RESULT_BM_MD_HL, OUT); + DISCARD_TEXT(OUT) + } +} + +@h Property permissions for kinds. + += +void RTKindConstructors::compile_permissions(void) { + kind_constructor *kc; + LOOP_OVER(kc, kind_constructor) { + if ((kc == CON_KIND_VARIABLE) || (kc == CON_INTERMEDIATE)) continue; + kind *K = Kinds::base_construction(kc); + if (RTKindDeclarations::base_represented_in_Inter(K)) { + RTPropertyPermissions::emit_kind_permissions(K); + RTPropertyValues::compile_values_for_kind(K); + } + } +} diff --git a/inform7/runtime-module/Chapter 5/Kind IDs.w b/inform7/runtime-module/Chapter 5/Kind IDs.w index 21d194ffa..f5b3974ab 100644 --- a/inform7/runtime-module/Chapter 5/Kind IDs.w +++ b/inform7/runtime-module/Chapter 5/Kind IDs.w @@ -34,15 +34,14 @@ Weak IDs have already appeared: = text_stream *RTKindIDs::identifier_for_weak_ID(kind_constructor *kc) { - if (Str::len(kc->explicit_identifier) > 0) - return kc->explicit_identifier; + if (Str::len(kc->explicit_identifier) > 0) return kc->explicit_identifier; text_stream *invented = Str::new(); WRITE_TO(invented, "WEAK_ID_%d", kc->allocation_id); return invented; } inter_name *RTKindIDs::weak_iname(kind *K) { - if (K == NULL) { return RTKindConstructors::UNKNOWN_iname(); } + if (K == NULL) return RTKindConstructors::weak_ID_iname(CON_UNKNOWN); if (Kinds::Behaviour::is_subkind_of_object(K)) K = K_object; kind_constructor *con = Kinds::get_construct(K); inter_name *iname = RTKindConstructors::weak_ID_iname(con); @@ -53,7 +52,7 @@ inter_name *RTKindIDs::weak_iname(kind *K) { } inter_name *RTKindIDs::weak_iname_of_constructor(kind_constructor *kc) { - if (kc == NULL) return RTKindConstructors::UNKNOWN_iname(); + if (kc == NULL) return RTKindConstructors::weak_ID_iname(CON_UNKNOWN); if (Kinds::Behaviour::is_subkind_of_object(Kinds::base_construction(kc))) return RTKindIDs::weak_iname(K_object); return RTKindConstructors::weak_ID_iname(kc); diff --git a/inform7/runtime-module/Chapter 5/Relations.w b/inform7/runtime-module/Chapter 5/Relations.w index cb1e9d837..eadfc58bf 100644 --- a/inform7/runtime-module/Chapter 5/Relations.w +++ b/inform7/runtime-module/Chapter 5/Relations.w @@ -1191,8 +1191,8 @@ this is done by the function |RTRelations::relation_range| (below). EmitArrays::numeric_entry((inter_ti) left_count); EmitArrays::numeric_entry((inter_ti) right_count); - EmitArrays::iname_entry(RTKindConstructors::get_iname(left_kind)); - EmitArrays::iname_entry(RTKindConstructors::get_iname(right_kind)); + EmitArrays::iname_entry(RTKindConstructors::printing_fn_iname(left_kind)); + EmitArrays::iname_entry(RTKindConstructors::printing_fn_iname(right_kind)); EmitArrays::numeric_entry(1); /* Cache broken flag */ if ((left_count > 0) && (right_count > 0)) diff --git a/inform7/runtime-module/Chapter 5/Rulebooks.w b/inform7/runtime-module/Chapter 5/Rulebooks.w index 1e679bb9e..79b597e92 100644 --- a/inform7/runtime-module/Chapter 5/Rulebooks.w +++ b/inform7/runtime-module/Chapter 5/Rulebooks.w @@ -713,32 +713,5 @@ void RTRulebooks::compile_outcome(named_rulebook_outcome *nro) { } void RTRulebooks::RulebookOutcomePrintingRule(void) { - inter_name *printing_rule_name = RTKindConstructors::get_iname(K_rulebook_outcome); - packaging_state save = Functions::begin(printing_rule_name); - inter_symbol *rbnov_s = LocalVariables::new_other_as_symbol(I"nro"); - EmitCode::inv(IFELSE_BIP); - EmitCode::down(); - EmitCode::inv(EQ_BIP); - EmitCode::down(); - EmitCode::val_symbol(K_value, rbnov_s); - EmitCode::val_number(0); - EmitCode::up(); - EmitCode::code(); - EmitCode::down(); - EmitCode::inv(PRINT_BIP); - EmitCode::down(); - EmitCode::val_text(I"(no outcome)"); - EmitCode::up(); - EmitCode::up(); - EmitCode::code(); - EmitCode::down(); - EmitCode::inv(PRINTSTRING_BIP); - EmitCode::down(); - EmitCode::val_symbol(K_value, rbnov_s); - EmitCode::up(); - EmitCode::rfalse(); - EmitCode::up(); - EmitCode::up(); - Functions::end(save); } diff --git a/inform7/runtime-module/Chapter 5/Rules.w b/inform7/runtime-module/Chapter 5/Rules.w index bb9fcbac4..222523cfc 100644 --- a/inform7/runtime-module/Chapter 5/Rules.w +++ b/inform7/runtime-module/Chapter 5/Rules.w @@ -382,11 +382,7 @@ failing; so it doesn't terminate the following of its rulebook. EmitCode::down(); if (acl->substituted_rule) { inter_name *subbed = RTRules::iname(acl->substituted_rule); - if (PackageInstruction::is_function(InterNames::to_symbol(subbed)) == FALSE) { - EmitCode::val_number(0); - } else { - EmitCode::call(subbed); - } + EmitCode::call(subbed); } else { EmitCode::val_number(0); } diff --git a/inform7/runtime-module/Chapter 6/Inferences.w b/inform7/runtime-module/Chapter 6/Inferences.w index cbc9a93a6..4588a013a 100644 --- a/inform7/runtime-module/Chapter 6/Inferences.w +++ b/inform7/runtime-module/Chapter 6/Inferences.w @@ -32,13 +32,13 @@ void RTInferences::index(package_request *pack, int hl, inference_subject *infs, state of being boolean, and the given certainty levels: = -void RTInferences::index_provided(OUTPUT_STREAM, inference_subject *infs, int bool, int c, char *cert, int brief) { +void RTInferences::index_provided(OUTPUT_STREAM, inference_subject *infs, int boolean, int c, char *cert, int brief) { int f = TRUE; property *prn; LOOP_OVER(prn, property) { if (RTProperties::is_shown_in_index(prn) == FALSE) continue; if (RTProperties::get_indexed_already_flag(prn)) continue; - if (Properties::is_either_or(prn) != bool) continue; + if (Properties::is_either_or(prn) != boolean) continue; int state = PropertyInferences::has_or_can_have(infs, prn); if (state != c) continue; diff --git a/inform7/runtime-module/Chapter 6/Property Permissions.w b/inform7/runtime-module/Chapter 6/Property Permissions.w index fc881fd0b..e9810f5fc 100644 --- a/inform7/runtime-module/Chapter 6/Property Permissions.w +++ b/inform7/runtime-module/Chapter 6/Property Permissions.w @@ -33,6 +33,8 @@ void RTPropertyPermissions::emit_kind_permissions(kind *K) { property_permission *pp; LOOP_OVER_PERMISSIONS_FOR_INFS(pp, subj) c++; if (c == 0) return; + if (RTKindConstructors::is_nonstandard_enumeration(K)) + internal_error("nonstandard enumeration with properties"); packaging_state save = Packaging::enter(RTPropertyPermissions::home(subj)); inter_symbol *owner_s = Produce::kind_to_symbol(K); LOOP_OVER_PERMISSIONS_FOR_INFS(pp, subj) diff --git a/inform7/runtime-module/Chapter 7/Command Grammar Tokens.w b/inform7/runtime-module/Chapter 7/Command Grammar Tokens.w index 205d75717..3b0b836ff 100644 --- a/inform7/runtime-module/Chapter 7/Command Grammar Tokens.w +++ b/inform7/runtime-module/Chapter 7/Command Grammar Tokens.w @@ -826,7 +826,7 @@ object, we again use a noun-filter token: @ Here we have a token like "[number]", say. @ = - inter_name *GPR = RTKindConstructors::get_exp_kind_GPR_iname(K); + inter_name *GPR = RTKindConstructors::GPR_iname(K); if (code_mode) { EmitCode::inv(STORE_BIP); EmitCode::down(); diff --git a/inform7/runtime-module/Chapter 7/Kind GPRs.w b/inform7/runtime-module/Chapter 7/Kind GPRs.w index 573c6c3f7..2e9732907 100644 --- a/inform7/runtime-module/Chapter 7/Kind GPRs.w +++ b/inform7/runtime-module/Chapter 7/Kind GPRs.w @@ -69,7 +69,7 @@ void KindGPRs::truth_state(void) { } @ More generally, we can make a GPR for values of any enumeration or quasinumerical -kind on request: see //RTKindConstructors::request_I6_GPR//. +kind on request. This does not work for other kinds, and in particular for kinds of object. Those are handled elsewhere by //Noun Filter Tokens//. @@ -81,7 +81,7 @@ kind, trying each possible notation in turn until one matches: void KindGPRs::quasinumerical_agent(compilation_subtask *t) { kind *K = RETRIEVE_POINTER_kind(t->data); if (Kinds::Behaviour::is_quasinumerical(K) == FALSE) internal_error("miscall"); - inter_name *iname = RTKindConstructors::get_kind_GPR_iname(K); + inter_name *iname = RTKindConstructors::GPR_iname(K); packaging_state save = Functions::begin(iname); gpr_kit kit = GPRs::new_kit(); GPRs::add_original_var(&kit); @@ -160,7 +160,7 @@ For example, for a kind called "colour", it might match any of "burnt umber", "cerulean blue" or "sienna". @ = - inter_name *iname = RTKindConstructors::get_kind_GPR_iname(K); + inter_name *iname = RTKindConstructors::GPR_iname(K); packaging_state save = Functions::begin(iname); gpr_kit kit = GPRs::new_kit(); GPRs::add_original_var(&kit); @@ -182,7 +182,7 @@ is the only way to allow, say, "Understand "sooty" as burnt umber." to work -- the grammar holding "sooty" comes out only in the following function. @ = - inter_name *iname = RTKindConstructors::get_instance_GPR_iname(K); + inter_name *iname = RTKindConstructors::instance_GPR_iname(K); packaging_state save = Functions::begin(iname); gpr_kit kit = GPRs::new_kit(); GPRs::add_instance_var(&kit); diff --git a/inform7/runtime-module/Chapter 7/Noun Filter Tokens.w b/inform7/runtime-module/Chapter 7/Noun Filter Tokens.w index 1ee4b2d5b..37c947538 100644 --- a/inform7/runtime-module/Chapter 7/Noun Filter Tokens.w +++ b/inform7/runtime-module/Chapter 7/Noun Filter Tokens.w @@ -103,9 +103,7 @@ void NounFilterTokens::compilation_agent(compilation_subtask *t) { EmitCode::inv(STORE_BIP); EmitCode::down(); EmitCode::ref_symbol(K_value, v_s); - inter_name *gpr_to_ask = RTKindConstructors::get_explicit_I6_GPR_iname(K); - if (gpr_to_ask == NULL) gpr_to_ask = RTKindConstructors::get_kind_GPR_iname(K); - EmitCode::call(gpr_to_ask); + EmitCode::call(RTKindConstructors::GPR_iname(K)); EmitCode::up(); EmitCode::inv(IF_BIP); diff --git a/inform7/runtime-module/Chapter 7/Parse Name Properties.w b/inform7/runtime-module/Chapter 7/Parse Name Properties.w index de4aced87..eecdac6b4 100644 --- a/inform7/runtime-module/Chapter 7/Parse Name Properties.w +++ b/inform7/runtime-module/Chapter 7/Parse Name Properties.w @@ -793,7 +793,7 @@ void ParseName::distinguish_visible_property(gpr_kit *kit, property *prn) { EmitCode::up(); } else { kind *K = ValueProperties::kind(prn); - inter_name *distinguisher = RTKindConstructors::get_distinguisher_iname(K); + inter_name *distinguisher = RTKindConstructors::distinguisher_function_iname(K); EmitCode::inv(IF_BIP); EmitCode::down(); if (distinguisher) { @@ -939,7 +939,7 @@ void ParseName::parse_visible_property(gpr_kit *kit, EmitCode::inv(IF_BIP); EmitCode::down(); kind *K = ValueProperties::kind(prn); - inter_name *recog_gpr = RTKindConstructors::get_recognition_only_GPR_as_iname(K); + inter_name *recog_gpr = RTKindConstructors::recognition_only_GPR_iname(K); if (recog_gpr) { EmitCode::inv(EQ_BIP); EmitCode::down(); @@ -954,14 +954,13 @@ void ParseName::parse_visible_property(gpr_kit *kit, EmitCode::up(); EmitCode::val_iname(K_value, Hierarchy::find(GPR_PREPOSITION_HL)); EmitCode::up(); - } else if (RTKindConstructors::offers_I6_GPR(K)) { - inter_name *i6_gpr_name = RTKindConstructors::get_explicit_I6_GPR_iname(K); - if (i6_gpr_name) { + } else if (Kinds::Behaviour::is_understandable(K)) { + if (RTKindConstructors::GPR_provided_by_kit(K)) { EmitCode::inv(AND_BIP); EmitCode::down(); EmitCode::inv(EQ_BIP); EmitCode::down(); - EmitCode::call(i6_gpr_name); + EmitCode::call(RTKindConstructors::GPR_iname(K)); EmitCode::val_iname(K_value, Hierarchy::find(GPR_NUMBER_HL)); EmitCode::up(); EmitCode::inv(EQ_BIP); @@ -978,7 +977,7 @@ void ParseName::parse_visible_property(gpr_kit *kit, } else if (Kinds::Behaviour::is_an_enumeration(K)) { EmitCode::inv(EQ_BIP); EmitCode::down(); - EmitCode::call(RTKindConstructors::get_instance_GPR_iname(K)); + EmitCode::call(RTKindConstructors::instance_GPR_iname(K)); EmitCode::down(); EmitCode::inv(PROPERTYVALUE_BIP); EmitCode::down(); @@ -994,7 +993,7 @@ void ParseName::parse_visible_property(gpr_kit *kit, EmitCode::down(); EmitCode::inv(EQ_BIP); EmitCode::down(); - EmitCode::call(RTKindConstructors::get_kind_GPR_iname(K)); + EmitCode::call(RTKindConstructors::GPR_iname(K)); EmitCode::val_iname(K_value, Hierarchy::find(GPR_NUMBER_HL)); EmitCode::up(); EmitCode::inv(EQ_BIP); diff --git a/inform7/values-module/Chapter 3/Literal Patterns.w b/inform7/values-module/Chapter 3/Literal Patterns.w index be8861357..4e5ba90d7 100644 --- a/inform7/values-module/Chapter 3/Literal Patterns.w +++ b/inform7/values-module/Chapter 3/Literal Patterns.w @@ -1392,7 +1392,6 @@ To decide which price is price with dollars part ( part0 - a number ) cents part @ = if (lp->no_lp_elements > 0) { feed_t id = Feeds::begin(); - TEMPORARY_TEXT(print_rule_buff) Feeds::feed_C_string(L"To decide which "); Feeds::feed_text(TEMP); Feeds::feed_C_string(L" is "); @@ -1400,19 +1399,21 @@ To decide which price is price with dollars part ( part0 - a number ) cents part Feeds::feed_C_string(L" with "); for (int i=0; ino_lp_elements; i++) { literal_pattern_element *lpe = &(lp->lp_elements[i]); + TEMPORARY_TEXT(print_rule_buff) WRITE_TO(print_rule_buff, " part%d ", i); Feeds::feed_wording(lpe->element_name); Feeds::feed_C_string(L" part ( "); Feeds::feed_text(print_rule_buff); Feeds::feed_C_string(L" - a number ) "); + DISCARD_TEXT(print_rule_buff) } wording XW = Feeds::end(id); - if (Wordings::phrasual_length(XW) >= MAX_WORDS_PER_PHRASE + 5) + if (Wordings::phrasual_length(XW) >= MAX_WORDS_PER_PHRASE + 5) { @ - else { + } else { Sentences::make_node(Task::syntax_tree(), XW, ':'); id = Feeds::begin(); - Str::clear(print_rule_buff); + TEMPORARY_TEXT(print_rule_buff) WRITE_TO(print_rule_buff, " (- ("); for (int i=0; ino_lp_elements; i++) { literal_pattern_element *lpe = &(lp->lp_elements[i]); @@ -1424,9 +1425,9 @@ To decide which price is price with dollars part ( part0 - a number ) cents part WRITE_TO(print_rule_buff, ") -) "); Feeds::feed_text(print_rule_buff); XW = Feeds::end(id); + DISCARD_TEXT(print_rule_buff) Sentences::make_node(Task::syntax_tree(), XW, '.'); } - DISCARD_TEXT(print_rule_buff) } @ = diff --git a/inter/building-module/Chapter 2/Inter Schemas.w b/inter/building-module/Chapter 2/Inter Schemas.w index 7490f6939..eda65e61f 100644 --- a/inter/building-module/Chapter 2/Inter Schemas.w +++ b/inter/building-module/Chapter 2/Inter Schemas.w @@ -326,6 +326,7 @@ inter_schema_token *InterSchemas::new_token(int type, text_stream *material, @e next_routine_ISINC @e previous_routine_ISINC @e ranger_routine_ISINC +@e indexing_routine_ISINC @e strong_kind_ISINC @e weak_kind_ISINC @e backspace_ISINC diff --git a/inter/building-module/Chapter 2/Tokenisation.w b/inter/building-module/Chapter 2/Tokenisation.w index 8eeab63fc..761374d4c 100644 --- a/inter/building-module/Chapter 2/Tokenisation.w +++ b/inter/building-module/Chapter 2/Tokenisation.w @@ -247,6 +247,8 @@ a bracing. c = printing_routine_ISINC; } else if (Str::eq_wide_string(t->command, L"ranger-routine")) { c = ranger_routine_ISINC; + } else if (Str::eq_wide_string(t->command, L"indexing-routine")) { + c = indexing_routine_ISINC; } else if (Str::eq_wide_string(t->command, L"next-routine")) { c = next_routine_ISINC; } else if (Str::eq_wide_string(t->command, L"previous-routine")) { diff --git a/inter/bytecode-module/Chapter 3/Inter in Binary Files.w b/inter/bytecode-module/Chapter 3/Inter in Binary Files.w index 191012333..0d036edd7 100644 --- a/inter/bytecode-module/Chapter 3/Inter in Binary Files.w +++ b/inter/bytecode-module/Chapter 3/Inter in Binary Files.w @@ -22,7 +22,8 @@ these words would be 5, 2 and 4 respectively. = int BinaryInter::test_file(filename *F) { int verdict = TRUE; - FILE *fh = BinaryFiles::open_for_reading(F); + FILE *fh = BinaryFiles::try_to_open_for_reading(F); + if (fh == NULL) return FALSE; unsigned int X = 0; if ((BinaryFiles::read_int32(fh, &X) == FALSE) || ((inter_ti) X != INTER_SHIBBOLETH)) verdict = FALSE; @@ -37,7 +38,8 @@ file, or else a null semver if the file isn't binary Inter: = semantic_version_number BinaryInter::test_file_version(filename *F) { - FILE *fh = BinaryFiles::open_for_reading(F); + FILE *fh = BinaryFiles::try_to_open_for_reading(F); + if (fh == NULL) return VersionNumbers::null(); unsigned int X = 0; if ((BinaryFiles::read_int32(fh, &X) == FALSE) || ((inter_ti) X != INTER_SHIBBOLETH) || diff --git a/inter/index-module/Chapter 2/Lexicon.w b/inter/index-module/Chapter 2/Lexicon.w index ba84a651e..8befa6424 100644 --- a/inter/index-module/Chapter 2/Lexicon.w +++ b/inter/index-module/Chapter 2/Lexicon.w @@ -96,8 +96,7 @@ inter_lexicon *IndexLexicon::stock(inter_tree *I, tree_inventory *inv) { @ = inter_package *pack; LOOP_OVER_INVENTORY_PACKAGES(pack, i, inv->kind_nodes) - if ((Metadata::read_optional_numeric(pack, I"^is_base")) && - (Metadata::read_optional_numeric(pack, I"^is_subkind_of_object"))) { + if (Metadata::read_optional_numeric(pack, I"^is_subkind_of_object")) { index_lexicon_entry *lex = IndexLexicon::new_entry( Metadata::required_textual(pack, I"^name"), COMMON_NOUN_TLEXE); lex->link_to = (int) Metadata::read_numeric(pack, I"^at"); diff --git a/inter/index-module/Chapter 3/Chart Element.w b/inter/index-module/Chapter 3/Chart Element.w index 0dd9ea3a6..dfc278621 100644 --- a/inter/index-module/Chapter 3/Chart Element.w +++ b/inter/index-module/Chapter 3/Chart Element.w @@ -38,8 +38,7 @@ higher up, but kinds with priority 0 do not appear in the index at all. for (int priority = 1; priority <= LOWEST_INDEX_PRIORITY; priority++) { inter_package *pack; LOOP_OVER_INVENTORY_PACKAGES(pack, i, inv->kind_nodes) - if ((Metadata::read_optional_numeric(pack, I"^is_base")) && - (Metadata::read_optional_numeric(pack, I"^is_subkind_of_object") == 0) && + if ((Metadata::read_optional_numeric(pack, I"^is_subkind_of_object") == 0) && (priority == (int) Metadata::read_optional_numeric(pack, I"^index_priority"))) { if ((priority == 8) || (Metadata::read_optional_numeric(pack, I"^is_definite"))) { @; @@ -299,8 +298,7 @@ void ChartElement::index_subkinds(OUTPUT_STREAM, tree_inventory *inv, inter_pack int depth, int pass, index_session *session) { inter_package *subkind_pack; LOOP_OVER_INVENTORY_PACKAGES(subkind_pack, i, inv->kind_nodes) - if ((Metadata::read_optional_numeric(subkind_pack, I"^is_base")) && - (Metadata::read_optional_numeric(subkind_pack, I"^is_subkind_of_object"))) { + if (Metadata::read_optional_numeric(subkind_pack, I"^is_subkind_of_object")) { inter_symbol *super_weak = Metadata::optional_symbol(subkind_pack, I"^superkind"); if ((super_weak) && (InterPackage::container(super_weak->definition) == pack)) ChartElement::index_object_kind(OUT, inv, subkind_pack, depth, pass, session); diff --git a/inter/pipeline-module/Chapter 4/The Standard Kits.w b/inter/pipeline-module/Chapter 4/The Standard Kits.w index 54fe8450d..e781bc015 100644 --- a/inter/pipeline-module/Chapter 4/The Standard Kits.w +++ b/inter/pipeline-module/Chapter 4/The Standard Kits.w @@ -94,6 +94,7 @@ comprehensive list of what is there.) @e GPROPERTY_HL @e HASHLISTRELATIONHANDLER_HL @e I7SFRAME_HL +@e INDEX_OF_ENUM_VAL_HL @e INTEGERDIVIDE_HL @e INTEGERREMAINDER_HL @e KINDATOMIC_HL @@ -110,6 +111,7 @@ comprehensive list of what is there.) @e MSTVO_HL @e MSTVON_HL @e NAME_HL +@e NEXT_ENUM_VAL_HL @e NOTHING_HL @e NUMBER_TY_ABS_HL @e NUMBER_TY_TO_REAL_NUMBER_TY_HL @@ -117,12 +119,14 @@ comprehensive list of what is there.) @e PACKED_TEXT_STORAGE_HL @e PARACONTENT_HL @e PARAMETER_VALUE_HL +@e PREV_ENUM_VAL_HL @e PRINTORRUN_HL @e PRIOR_NAMED_LIST_GENDER_HL @e PRIOR_NAMED_LIST_HL @e PRIOR_NAMED_NOUN_HL @e PROPERTY_LOOP_SIGN_HL @e PROPERTY_TO_BE_TOTALLED_HL +@e RANDOM_ENUM_VAL_HL @e REAL_NUMBER_TY_ABS_HL @e REAL_NUMBER_TY_APPROXIMATE_HL @e REAL_NUMBER_TY_COMPARE_HL @@ -237,6 +241,7 @@ comprehensive list of what is there.) KIT_PROVIDED(GPROPERTY_HL, I"GProperty") KIT_PROVIDED(HASHLISTRELATIONHANDLER_HL, I"HashListRelationHandler") KIT_PROVIDED(I7SFRAME_HL, I"I7SFRAME") + KIT_PROVIDED(INDEX_OF_ENUM_VAL_HL, I"IndexOfEnumVal"); KIT_PROVIDED(INTEGERDIVIDE_HL, I"IntegerDivide") KIT_PROVIDED(INTEGERREMAINDER_HL, I"IntegerRemainder") KIT_PROVIDED(KINDATOMIC_HL, I"KindAtomic") @@ -253,6 +258,7 @@ comprehensive list of what is there.) KIT_PROVIDED(MSTVO_HL, I"MstVO") KIT_PROVIDED(MSTVON_HL, I"MstVON") KIT_PROVIDED(NAME_HL, I"name") + KIT_PROVIDED(NEXT_ENUM_VAL_HL, I"NextEnumVal"); KIT_PROVIDED(NOTHING_HL, I"nothing") KIT_PROVIDED(NUMBER_TY_ABS_HL, I"NUMBER_TY_Abs") KIT_PROVIDED(NUMBER_TY_TO_REAL_NUMBER_TY_HL, I"NUMBER_TY_to_REAL_NUMBER_TY") @@ -260,12 +266,14 @@ comprehensive list of what is there.) KIT_PROVIDED(PACKED_TEXT_STORAGE_HL, I"PACKED_TEXT_STORAGE") KIT_PROVIDED(PARACONTENT_HL, I"ParaContent") KIT_PROVIDED(PARAMETER_VALUE_HL, I"parameter_value") + KIT_PROVIDED(PREV_ENUM_VAL_HL, I"PrevEnumVal"); KIT_PROVIDED(PRINTORRUN_HL, I"PrintOrRun") KIT_PROVIDED(PRIOR_NAMED_LIST_GENDER_HL, I"prior_named_list_gender") KIT_PROVIDED(PRIOR_NAMED_LIST_HL, I"prior_named_list") KIT_PROVIDED(PRIOR_NAMED_NOUN_HL, I"prior_named_noun") KIT_PROVIDED(PROPERTY_LOOP_SIGN_HL, I"property_loop_sign") KIT_PROVIDED(PROPERTY_TO_BE_TOTALLED_HL, I"property_to_be_totalled") + KIT_PROVIDED(RANDOM_ENUM_VAL_HL, I"RandomEnumVal"); KIT_PROVIDED(REAL_NUMBER_TY_ABS_HL, I"REAL_NUMBER_TY_Abs") KIT_PROVIDED(REAL_NUMBER_TY_APPROXIMATE_HL, I"REAL_NUMBER_TY_Approximate") KIT_PROVIDED(REAL_NUMBER_TY_COMPARE_HL, I"REAL_NUMBER_TY_Compare") diff --git a/inter/pipeline-module/Chapter 5/Kinds.w b/inter/pipeline-module/Chapter 5/Kinds.w index 911f9cd4a..c3829df47 100644 --- a/inter/pipeline-module/Chapter 5/Kinds.w +++ b/inter/pipeline-module/Chapter 5/Kinds.w @@ -13,6 +13,7 @@ void SynopticKinds::compile(inter_tree *I, pipeline_step *step, tree_inventory * InterNodeList::array_sort(inv->derived_kind_nodes, MakeSynopticModuleStage::module_order); @; @; + @; @; @; @; @@ -79,6 +80,36 @@ or higher is therefore that of a derived kind. Produce::rfalse(I); Synoptic::end_function(I, step, iname); +@ = + inter_name *iname = HierarchyLocations::iname(I, VALUESFINDER_HL); + Synoptic::begin_function(I, iname); + inter_symbol *k_s = Synoptic::local(I, I"k", NULL); + for (int i=0; ikind_nodes); i++) { + inter_package *pack = + PackageInstruction::at_this_head(inv->kind_nodes->list[i].node); + inter_symbol *ea_s = Metadata::optional_symbol(pack, I"^enumeration_array"); + if (ea_s) { + inter_symbol *id_s = Metadata::required_symbol(pack, I"^strong_id"); + Produce::inv_primitive(I, IF_BIP); + Produce::down(I); + Produce::inv_primitive(I, EQ_BIP); + Produce::down(I); + Produce::val_symbol(I, K_value, k_s); + Produce::val_symbol(I, K_value, id_s); + Produce::up(I); + Produce::code(I); + Produce::down(I); + Produce::inv_primitive(I, RETURN_BIP); + Produce::down(I); + Produce::val_symbol(I, K_value, ea_s); + Produce::up(I); + Produce::up(I); + Produce::up(I); + } + } + Produce::rfalse(I); + Synoptic::end_function(I, step, iname); + @ |DefaultValueOfKOV(K)| returns the default value for kind |K|: it's needed, for instance, when increasing the size of a list of $K$ to include new entries, which have to be given some type-safe value to start out at. @@ -149,8 +180,7 @@ which have to be given some type-safe value to start out at. Produce::down(I); for (int i=0; ikind_nodes); i++) { inter_package *pack = PackageInstruction::at_this_head(inv->kind_nodes->list[i].node); - if ((Metadata::read_optional_numeric(pack, I"^is_base")) && - (Metadata::optional_symbol(pack, I"^print_fn")) && + if ((Metadata::optional_symbol(pack, I"^print_fn")) && (Metadata::read_optional_numeric(pack, I"^is_subkind_of_object") == FALSE)) { inter_symbol *id_s = Metadata::required_symbol(pack, I"^strong_id"); inter_symbol *print_fn_s = Metadata::required_symbol(pack, I"^print_fn"); diff --git a/inter/pipeline-module/Chapter 5/Synoptic Hierarchy.w b/inter/pipeline-module/Chapter 5/Synoptic Hierarchy.w index 3a8df592f..69db679f6 100644 --- a/inter/pipeline-module/Chapter 5/Synoptic Hierarchy.w +++ b/inter/pipeline-module/Chapter 5/Synoptic Hierarchy.w @@ -164,6 +164,7 @@ The |/main/synoptic/kinds| submodule. @e DEFAULTVALUEOFKOV_HL @e DEFAULTVALUEFINDER_HL +@e VALUESFINDER_HL @e PRINTKINDVALUEPAIR_HL @e KOVCOMPARISONFUNCTION_HL @e KOVDOMAINSIZE_HL @@ -180,6 +181,7 @@ The |/main/synoptic/kinds| submodule. SYN_CONST(BASE_KIND_HWM_HL, I"BASE_KIND_HWM") SYN_FUNCT(DEFAULTVALUEOFKOV_HL, I"defaultvalue_fn", I"DefaultValueOfKOV") SYN_FUNCT(DEFAULTVALUEFINDER_HL, I"defaultvaluefinder_fn", I"DefaultValueFinder") + SYN_FUNCT(VALUESFINDER_HL, I"valuesfinder_fn", I"ValuesFinder") SYN_FUNCT(PRINTKINDVALUEPAIR_HL, I"printkindvaluepair_fn", I"PrintKindValuePair") SYN_FUNCT(KOVCOMPARISONFUNCTION_HL, I"comparison_fn", I"KOVComparisonFunction") SYN_FUNCT(KOVDOMAINSIZE_HL, I"domainsize_fn", I"KOVDomainSize") @@ -324,3 +326,15 @@ The |/main/synoptic/use_options| submodule. SYN_FUNCT(TESTUSEOPTION_HL, I"test_fn", I"TestUseOption") SYN_FUNCT(PRINT_USE_OPTION_HL, I"print_fn", I"PrintUseOption") SYN_CONST(USE_OPTION_VALUES_HL, I"USE_OPTION_VALUES") + +@h Synoptic printing functions. + += +#ifdef CORE_MODULE +inter_name *SynopticHierarchy::printing_function_iname(inter_tree *I, kind *K) { + if (Kinds::eq(K, K_use_option)) return HierarchyLocations::iname(I, PRINT_USE_OPTION_HL); + if (Kinds::eq(K, K_table)) return HierarchyLocations::iname(I, PRINT_TABLE_HL); + if (Kinds::eq(K, K_response)) return HierarchyLocations::iname(I, PRINT_RESPONSE_HL); + return NULL; +} +#endif diff --git a/inter/pipeline-module/Chapter 5/Synoptic Utilities.w b/inter/pipeline-module/Chapter 5/Synoptic Utilities.w index 1d42c9544..cd5ade982 100644 --- a/inter/pipeline-module/Chapter 5/Synoptic Utilities.w +++ b/inter/pipeline-module/Chapter 5/Synoptic Utilities.w @@ -31,6 +31,10 @@ inter_tree_node *Synoptic::get_definition(inter_package *pack, text_stream *name does exist, it must have a definition, and we return that. = +inter_symbol *Synoptic::get_optional_symbol(inter_package *pack, text_stream *name) { + return InterSymbolsTable::symbol_from_name(InterPackage::scope(pack), name); +} + inter_tree_node *Synoptic::get_optional_definition(inter_package *pack, text_stream *name) { inter_symbol *def_s = InterSymbolsTable::symbol_from_name(InterPackage::scope(pack), name); if (def_s == NULL) return NULL; diff --git a/notes/release/pending.md b/notes/release/pending.md index fa6b1becc..53cd2fe2a 100644 --- a/notes/release/pending.md +++ b/notes/release/pending.md @@ -76,6 +76,9 @@ and now poses a moral rather than gender-based question. - Fix for Jira bug [I7-2267](https://inform7.atlassian.net/browse/I7-2267) "I6 inclusion for which compiler hangs (using '::' operator)" ([commit f46433c](https://github.com/ganelson/inform/commit/f46433c22cfd9d414b7c337f8ee58220fb9286cc)) +- Fix for Jira bug [I7-2265](https://inform7.atlassian.net/browse/I7-2265) + "Compiler fails on creating an instance of a specified kind with multiple parts" + ([commit af2531f](https://github.com/ganelson/inform/commit/af2531f4b2b4d1f59e4a9b45a8ddc274c94c7f77)) - Fix for Jira bug [I7-2264](https://inform7.atlassian.net/browse/I7-2264) "Cannot compile 'Verb meta' directive inside a kit" ([commit cbe7012](https://github.com/ganelson/inform/commit/cbe7012fb6950932ebf2a4b9290f80bcd5970ad1)): @@ -111,13 +114,17 @@ and now poses a moral rather than gender-based question. - Fix for Jira bug [I7-2225](https://inform7.atlassian.net/browse/I7-2225) "Translating kinds into I6 doesn't work" (Inweb: [commit d608388](https://github.com/ganelson/inweb/commit/d608388d643a85d1aa3c88cfa1710b848bd5cb7e)) +- Fix for Jira bug [I7-2142](https://inform7.atlassian.net/browse/I7-2142) + "With 'the foo rule substitutes for the bar rule when...', the bar rule is + suppressed but the foo rule isn't followed." + ([commit 11e1f75](https://github.com/ganelson/inform/commit/11e1f756c16aa17b31afd02ca2bb5f4e5abd3ac6)) - Fix for Jira bug [I7-2139](https://inform7.atlassian.net/browse/I7-2139) "Articles become part of relation name" ([commit 85110a9](https://github.com/ganelson/inform/commit/85110a981a3d2419b3778eb383408de122c301a8)) - Fix for a "very old quirk of I7 where it generates a `story.gblorb.js` file for the interpreter website, but the filename is a lie. It's the base64-encoding of the `story.ulx` file, not the `story.gblorb`." (Andrew Plotkin, not from Jira) -- Cosmetic fixes not worth linking to (I7-2319, I7-2316, I7-2315, I7-2293, I7-2270, I7-2268, I7-2221) +- Cosmetic fixes not worth linking to (I7-2350, I7-2319, I7-2316, I7-2315, I7-2293, I7-2270, I7-2268, I7-2221) ## Bugs fixed in the course of feature additions @@ -126,16 +133,25 @@ fixes a number of known anomalies in the way that the standard world model handled containment, incorporation and so on. This enabled a number of bugs to be closed: +- [I7-2296](https://inform7.atlassian.net/browse/I7-2296) + on things being privately-named causing their printed names not to be used in room description - [I7-2220](https://inform7.atlassian.net/browse/I7-2220) on the definition of holding - [I7-2219](https://inform7.atlassian.net/browse/I7-2219) on directions being held +- [I7-2178](https://inform7.atlassian.net/browse/I7-2178) + on "if x is held by a supporter" resulting in false negative +- [I7-2128](https://inform7.atlassian.net/browse/I7-2128) + on holding relation tests failing for containment, support, or incorporation - [I7-2046 = Mantis 2083](https://inform7.atlassian.net/browse/I7-2046) on when containers holding concealed items say they are "(empty)" - [I7-2036 = Mantis 2073](https://inform7.atlassian.net/browse/I7-2036) on inconsistencies when containers or supporters holding concealed items are examined -- [I7-2296](https://inform7.atlassian.net/browse/I7-2296) - on things being privately-named causing their printed names not to be used in room description + +Similarly, [(IE-0021) No automatic plural synonyms](https://github.com/ganelson/inform-evolution/blob/main/proposals/0021-no-automatic-plural-synonyms.md): + +- [I7-1980](https://inform7.atlassian.net/browse/I7-1980) + on understanding things by plural name of kind ## Note about intest diff --git a/resources/Documentation/indoc-instructions.txt b/resources/Documentation/indoc-instructions.txt index 81e89c8f3..ff5ee066f 100644 --- a/resources/Documentation/indoc-instructions.txt +++ b/resources/Documentation/indoc-instructions.txt @@ -493,6 +493,16 @@ osx_app { destination = ../Inform.app/Contents/Resources/English.lproj/ } +osx_dev_app { + # HTML documentation for the OS X app + follow: in-application-instructions.txt + assume_Public_Library = yes + support_creation = yes + retina_images = yes + declare: OSX + destination = resources/App HTML/en.lproj/ +} + windows_app { # HTML documentation for the Windows app follow: in-application-instructions.txt diff --git a/scripts/inform.giscript b/scripts/inform.giscript index d97d2c75e..ad6aa5150 100644 --- a/scripts/inform.giscript +++ b/scripts/inform.giscript @@ -16,6 +16,7 @@ makefile tags *.glkdata +resources/App HTML/ resources/Changes/Output/ resources/Changes/Output/META-INF/ resources/Changes/Output/OEBPS/ diff --git a/scripts/inform.mkscript b/scripts/inform.mkscript index a6049fa2a..18dbaa284 100644 --- a/scripts/inform.mkscript +++ b/scripts/inform.mkscript @@ -607,10 +607,23 @@ ebooks: # from the inform repository (after all is built) into a GUI app. Command-line # hackers will therefore not use these make targets. -# The rest of the file is inside "ifdef BUILTINCOMPS ... endif", which is in -# effect a test of whether any make-integration-settings.mk has been provided: -# that file has to define this symbol (see below), and the symbol will not -# otherwise have been defined. +{set name: IMAGESETLIST value: bg_images, doc_images, map_icons, outcome_images, scene_icons} + +{define: transfer-images} + mkdir -p $(BUILTINHTML) + cp -f resources/Imagery/app_images/Welcome*Background.png $(BUILTINHTML) + cp -f resources/Imagery/app_images/Welcome*Banner.png $(BUILTINHTML) + {repeat with: SET in: {IMAGESETLIST}} + mkdir -p $(BUILTINHTML)/{SET} + rm -f $(BUILTINHTML)/{SET}/* + cp -f resources/Imagery/{SET}/[A-Za-z]*.* $(BUILTINHTML)/{SET} + {end-repeat} +{end-define} + +# The next part of the file is inside "ifdef BUILTINCOMPS ... endif", which tests +# whether functional parts of the built core distribution should be copied into +# the app. If BUILTINCOMPS is defined, then BUILTINHTML should be defined too; +# but it is also legal to define just ADVICEHTML, BUILTINHTML and BUILTINHTMLINNER ifdef BUILTINCOMPS @@ -792,29 +805,6 @@ forcetransfertemplates: forcetransferotherinternals: {transfer-other-internals} -# ----------------------------------------------------------------------------- -# Copying images into the app - -# Note that make-integration-settings.mk is expected to define BUILTINHTML as -# the directory which will hold the mini-website formed by the in-app manuals. - -{set name: IMAGESETLIST value: bg_images, doc_images, map_icons, outcome_images, scene_icons} - -{define: transfer-images} - mkdir -p $(BUILTINHTML) - cp -f resources/Imagery/app_images/Welcome*Background.png $(BUILTINHTML) - cp -f resources/Imagery/app_images/Welcome*Banner.png $(BUILTINHTML) - {repeat with: SET in: {IMAGESETLIST}} - mkdir -p $(BUILTINHTML)/{SET} - rm -f $(BUILTINHTML)/{SET}/* - cp -f resources/Imagery/{SET}/[A-Za-z]*.* $(BUILTINHTML)/{SET} - {end-repeat} -{end-define} - -.PHONY: forcetransferimages -forcetransferimages: - {transfer-images} - # ----------------------------------------------------------------------------- # Incrementally copying the internal tree # This is super-awkward and probably should be dropped in favour of rsync, but @@ -857,6 +847,69 @@ $(INTERNALEXEMPLUM): \ {transfer-other-internals} {transfer-images} +# ============================================================================= + +# End of the block which is used only if make-integration-settings.mk defines +# BUILTINCOMPS + +endif + +# ============================================================================= + +ifdef BUILTINHTML + +# (alternative passage to the above, for use only if BUILTINCOMPS is not provided) + +ifndef BUILTINCOMPS + +# ----------------------------------------------------------------------------- +# Targets "integration" and "forceintegration" +# ----------------------------------------------------------------------------- + +.PHONY: integration +integration: \ + transferimages \ + transferdocumentation \ + transferoutcomepages + +.PHONY: forceintegration +forceintegration: \ + forcetransferimages \ + forcetransferdocumentation \ + forcetransferoutcomepages + +# ----------------------------------------------------------------------------- +# Incrementally copying the images +# A simplified version of the above. + +IMAGEEXEMPLUM = $(BUILTINHTML)/doc_images/index.png +IMAGEEXEMPLUMFROM = resources/Imagery/doc_images/index.png + +.PHONY: transferimages +transferimages: $(IMAGEEXEMPLUM) + +$(IMAGEEXEMPLUMFROM): + $(IMAGEEXEMPLUM) + +$(IMAGEEXEMPLUM): \ + {repeat with: SET in: {IMAGESETLIST}} + resources/Imagery/{SET}/[A-Za-z]*.* \ + {end-repeat} + resources/Imagery/app_images/[A-Za-z]*.* + touch $(IMAGEEXEMPLUMFROM) + {transfer-images} + +# (end of the alternative passage if BUILTINCOMPS is not provided) + +endif + +# ----------------------------------------------------------------------------- +# Copying images into the app + +.PHONY: forcetransferimages +forcetransferimages: + {transfer-images} + # ----------------------------------------------------------------------------- # Typesetting documentation to HTML inside the app, using indoc @@ -886,7 +939,9 @@ forcetransferadvice: {define: compile-inapp-documentation} mkdir -p $(BUILTINHTMLINNER) $(INDOCX) -from resources/Documentation -xrefs '$(INFORM7WEB)/Internal/HTML/xrefs.txt' $(INDOCOPTS) +ifdef INTERNAL cp -f $(INFORM7WEB)/Internal/HTML/xrefs.txt "$(INTERNAL)/HTML" +endif {end-define} .PHONY: transferdocumentation @@ -923,9 +978,7 @@ forcetransferoutcomepages: # ============================================================================= -# End of the block which is used only if make-integration-settings.mk is -# provided +# End of the block which is used only if make-integration-settings.mk defines +# BUILTINHTML endif - -# ----------------------------------------------------------------------------- diff --git a/services/arch-module/Chapter 3/Feature Manager.w b/services/arch-module/Chapter 3/Feature Manager.w index c40b1fac3..c6011f8c2 100644 --- a/services/arch-module/Chapter 3/Feature Manager.w +++ b/services/arch-module/Chapter 3/Feature Manager.w @@ -159,8 +159,7 @@ void Features::run_activation_function(compiler_feature *F) { if ((allow_activation_functions_to_be_run) && (F) && (F->activation_function_run == FALSE)) { F->activation_function_run = TRUE; - void (*start)() = (void (*)()) F->activation_function; - if (start) (*start)(); + if (F->activation_function) (*(F->activation_function))(); } } diff --git a/services/calculus-module/Chapter 3/Compilation Schemas.w b/services/calculus-module/Chapter 3/Compilation Schemas.w index 23ed53ac1..c22de7418 100644 --- a/services/calculus-module/Chapter 3/Compilation Schemas.w +++ b/services/calculus-module/Chapter 3/Compilation Schemas.w @@ -166,17 +166,11 @@ so it would not be safe to store only the textual identifier. #ifdef CORE_MODULE RTKindIDs::write_weak_identifier(OUT, va_arg(ap, kind *)); #endif - #ifndef CORE_MODULE - WRITE("{%u}", va_arg(ap, kind *)); - #endif break; case 'L': #ifdef CORE_MODULE WRITE("%~L", va_arg(ap, local_variable *)); break; #endif - #ifndef CORE_MODULE - WRITE("%08x", va_arg(ap, void *)); break; - #endif break; case 'n': { int N = sch->no_quoted_inames++; diff --git a/services/kinds-module/Chapter 1/Kinds Module.w b/services/kinds-module/Chapter 1/Kinds Module.w index 425109fc3..a065e4cf0 100644 --- a/services/kinds-module/Chapter 1/Kinds Module.w +++ b/services/kinds-module/Chapter 1/Kinds Module.w @@ -19,6 +19,7 @@ which use this module: @e kind_constructor_comparison_schema_CLASS @e kind_constructor_casting_rule_CLASS @e kind_constructor_instance_CLASS +@e kind_constructor_instance_rule_CLASS @e unit_sequence_CLASS @e star_invention_CLASS @@ -32,6 +33,7 @@ DECLARE_CLASS(kind_template_definition) DECLARE_CLASS_ALLOCATED_IN_ARRAYS(kind_constructor_casting_rule, 100) DECLARE_CLASS_ALLOCATED_IN_ARRAYS(kind_constructor_comparison_schema, 100) DECLARE_CLASS_ALLOCATED_IN_ARRAYS(kind_constructor_instance, 100) +DECLARE_CLASS_ALLOCATED_IN_ARRAYS(kind_constructor_instance_rule, 100) DECLARE_CLASS_ALLOCATED_IN_ARRAYS(unit_sequence, 50) DECLARE_CLASS(star_invention) diff --git a/services/kinds-module/Chapter 2/Using Kinds.w b/services/kinds-module/Chapter 2/Using Kinds.w index e19239af8..02e2dcccc 100644 --- a/services/kinds-module/Chapter 2/Using Kinds.w +++ b/services/kinds-module/Chapter 2/Using Kinds.w @@ -189,8 +189,23 @@ int Kinds::Behaviour::new_enumerated_value(kind *K) { return K->construct->next_free_value++; } -@h (B) Constructing kinds. +@h (B) Command parsing. += +int Kinds::Behaviour::is_understandable(kind *K) { + if (K == NULL) return FALSE; + return KindConstructors::is_understandable(K->construct); +} + +text_stream *Kinds::Behaviour::GPR_identifier(kind *K) { + if (K == NULL) return NULL; + return K->construct->explicit_GPR_identifier; +} + +text_stream *Kinds::Behaviour::recognition_only_GPR_identifier(kind *K) { + if (K == NULL) return NULL; + return K->construct->recognition_routine; +} @h (C) Compatibility with other kinds. @@ -306,6 +321,12 @@ dimensional_rules *Kinds::Behaviour::get_dim_rules(kind *K) { @h (H) An identifier name. = +int Kinds::Behaviour::comes_from_Neptune(kind *K) { + if (K == NULL) return FALSE; + if (Str::len(K->construct->explicit_identifier) > 0) return TRUE; + return FALSE; +} + text_stream *Kinds::Behaviour::get_identifier(kind *K) { if (K == NULL) return I"UNKNOWN_NT"; return K->construct->explicit_identifier; diff --git a/services/kinds-module/Chapter 4/Kind Commands.w b/services/kinds-module/Chapter 4/Kind Commands.w index 222945439..9a0ede688 100644 --- a/services/kinds-module/Chapter 4/Kind Commands.w +++ b/services/kinds-module/Chapter 4/Kind Commands.w @@ -83,7 +83,7 @@ void KindCommands::apply(single_kind_command stc, kind_constructor *con) { return; } if (tcc == conforms_to_KCC) { - kind_constructor_instance *dti = CREATE(kind_constructor_instance); + kind_constructor_instance_rule *dti = CREATE(kind_constructor_instance_rule); dti->next_instance_rule = con->first_instance_rule; con->first_instance_rule = dti; dti->instance_of_this_unparsed = Str::duplicate(stc.constructor_argument); @@ -99,6 +99,36 @@ void KindCommands::apply(single_kind_command stc, kind_constructor *con) { dtcs->comparison_schema = Str::duplicate(stc.textual_argument); return; } + if (tcc == instance_KCC) { + match_results mr = Regexp::create_mr(); + if (Regexp::match(&mr, stc.textual_argument, L" *(%c+?) *= *(%C+) *= *(%C+) *")) { + kind_constructor_instance *kci = CREATE(kind_constructor_instance); + kci->natural_language_name = Str::duplicate(mr.exp[0]); + kci->identifier = Str::duplicate(mr.exp[1]); + int bad = FALSE; + kci->value = KindCommands::parse_literal_number(mr.exp[2], &bad); + kci->value_specified = TRUE; + if (bad) { + NeptuneFiles::error(stc.textual_argument, + I"value after the final '=' is not a valid Inform 6 literal", stc.origin); + kci->value = 0; + kci->value_specified = FALSE; + } + ADD_TO_LINKED_LIST(kci, kind_constructor_instance, con->instances); + } else if (Regexp::match(&mr, stc.textual_argument, L" *(%c+?) *= *(%C+) *")) { + kind_constructor_instance *kci = CREATE(kind_constructor_instance); + kci->natural_language_name = Str::duplicate(mr.exp[0]); + kci->identifier = Str::duplicate(mr.exp[1]); + kci->value = 0; + kci->value_specified = FALSE; + ADD_TO_LINKED_LIST(kci, kind_constructor_instance, con->instances); + } else { + NeptuneFiles::error(stc.textual_argument, + I"instance not in form NAME = IDENTIFIER = VALUE", stc.origin); + } + Regexp::dispose_of(&mr); + return; + } @ = switch (tcc) { @@ -185,3 +215,41 @@ void KindCommands::apply(single_kind_command stc, kind_constructor *con) { DISCARD_TEXT(wd) } con->constructor_arity = c+1; + +@ This is used for parsing the values of enumeration members in |instance| +commands: + += +int KindCommands::parse_literal_number(text_stream *S, int *bad) { + *bad = FALSE; + int sign = 1, base = 10, from = 0, to = Str::len(S)-1; + if ((Str::get_at(S, from) == '(') && (Str::get_at(S, to) == ')')) { from++; to--; } + while (Characters::is_whitespace(Str::get_at(S, from))) from++; + while (Characters::is_whitespace(Str::get_at(S, to))) to--; + if (Str::get_at(S, from) == '-') { sign = -1; from++; } + else if (Str::get_at(S, from) == '$') { + from++; base = 16; + if (Str::get_at(S, from) == '$') { + from++; base = 2; + } + } + long long int N = 0; + LOOP_THROUGH_TEXT(pos, S) { + if (pos.index < from) continue; + if (pos.index > to) continue; + int c = Str::get(pos), d = 0; + if ((c >= 'a') && (c <= 'z')) d = c-'a'+10; + else if ((c >= 'A') && (c <= 'Z')) d = c-'A'+10; + else if ((c >= '0') && (c <= '9')) d = c-'0'; + else { *bad = TRUE; break; } + if (d > base) { *bad = TRUE; break; } + N = base*N + (long long int) d; + if (pos.index > 34) { *bad = TRUE; break; } + } + if (*bad == FALSE) { + N = sign*N; + return (int) N; + } + return -1; +} + diff --git a/services/kinds-module/Chapter 4/Kind Constructors.w b/services/kinds-module/Chapter 4/Kind Constructors.w index 00e55157c..0eca514c4 100644 --- a/services/kinds-module/Chapter 4/Kind Constructors.w +++ b/services/kinds-module/Chapter 4/Kind Constructors.w @@ -38,7 +38,7 @@ typedef struct kind_constructor { /* C: compatibility with other kinds */ struct parse_node *superkind_set_at; /* where it says, e.g., "A rabbit is a kind of animal" */ struct kind_constructor_casting_rule *first_casting_rule; /* list of these */ - struct kind_constructor_instance *first_instance_rule; /* list of these */ + struct kind_constructor_instance_rule *first_instance_rule; /* list of these */ /* D: how constant values of this kind are expressed */ struct literal_pattern *ways_to_write_literals; /* list of ways to write this */ @@ -76,6 +76,7 @@ typedef struct kind_constructor { struct text_stream *distinguishing_routine; /* Inter routine to see if values distinguishable */ struct kind_constructor_comparison_schema *first_comparison_schema; /* list of these */ struct text_stream *loop_domain_schema; /* how to compile a loop over the instances */ + struct linked_list *instances; /* if enumerated explicitly in a Neptune file */ /* J: printing and parsing values at run-time */ struct text_stream *print_identifier; /* an Inter identifier used for compiling printing rules */ @@ -107,6 +108,15 @@ typedef struct kind_constructor_casting_rule { struct kind_constructor_casting_rule *next_casting_rule; } kind_constructor_casting_rule; +@ And this is the analogous structure for recording conformance: + += +typedef struct kind_constructor_instance_rule { + struct text_stream *instance_of_this_unparsed; + struct kind_constructor *instance_of_this; + struct kind_constructor_instance_rule *next_instance_rule; +} kind_constructor_instance_rule; + @ And this is the analogous structure for giving Inter schemas to compare data of two different kinds: @@ -118,14 +128,14 @@ typedef struct kind_constructor_comparison_schema { struct kind_constructor_comparison_schema *next_comparison_schema; } kind_constructor_comparison_schema; -@ And this is the analogous structure for giving Inter schemas to compare -data of two different kinds: +@ And this is where explicit instances are recorded: = typedef struct kind_constructor_instance { - struct text_stream *instance_of_this_unparsed; - struct kind_constructor *instance_of_this; - struct kind_constructor_instance *next_instance_rule; + struct text_stream *natural_language_name; + struct text_stream *identifier; + int value; + int value_specified; } kind_constructor_instance; @ The "tupling" of an argument is the extent to which an argument can be @@ -258,6 +268,7 @@ we apply any defaults set in Neptune files. con->first_comparison_schema = NULL; con->distinguishing_routine = NULL; con->loop_domain_schema = NULL; + con->instances = NEW_LINKED_LIST(kind_constructor_instance); /* J: printing and parsing values at run-time */ con->print_identifier = Str::new(); @@ -422,6 +433,18 @@ int KindConstructors::variance(kind_constructor *con, int b) { return con->variance[b]; } +int KindConstructors::is_base(kind_constructor *con) { + if (con == NULL) return FALSE; + if (con->group == BASE_CONSTRUCTOR_GRP) return TRUE; + return FALSE; +} + +int KindConstructors::is_proper_constructor(kind_constructor *con) { + if (con == NULL) return FALSE; + if (con->group == PROPER_CONSTRUCTOR_GRP) return TRUE; + return FALSE; +} + @h Questions about constructors. The rest of Inform is not encouraged to poke at constructors directly; it ought to ask questions about kinds instead (see "Using Kinds"). However: @@ -436,7 +459,7 @@ int KindConstructors::is_definite(kind_constructor *con) { return FALSE; } -int KindConstructors::offers_I6_GPR(kind_constructor *con) { +int KindConstructors::is_understandable(kind_constructor *con) { if (con == NULL) return FALSE; if ((KindConstructors::is_definite(con)) && (KindConstructors::compatible(con, @@ -512,7 +535,7 @@ group or |PROPER_CONSTRUCTOR_GRP|) which it can cast to. = int KindConstructors::find_instance(kind_constructor *from, kind_constructor *to) { - kind_constructor_instance *dti; + kind_constructor_instance_rule *dti; for (dti = from->first_instance_rule; dti; dti = dti->next_instance_rule) { if (Str::len(dti->instance_of_this_unparsed) > 0) { dti->instance_of_this = @@ -525,6 +548,15 @@ int KindConstructors::find_instance(kind_constructor *from, kind_constructor *to return FALSE; } +@ Each constructor has a list of explicitly-named instances from the Neptune +file creating it (if any were: by default this will be empty): + += +linked_list *KindConstructors::instances(kind_constructor *kc) { + if (kc == NULL) return FALSE; + return kc->instances; +} + @h Compatibility. The following tests if |from| is compatible with |to|. diff --git a/services/kinds-module/Chapter 4/Neptune Syntax.w b/services/kinds-module/Chapter 4/Neptune Syntax.w index d18ac91af..067ce4cc1 100644 --- a/services/kinds-module/Chapter 4/Neptune Syntax.w +++ b/services/kinds-module/Chapter 4/Neptune Syntax.w @@ -58,6 +58,7 @@ typedef struct kind_command_definition { @e specification_text_KCC @e small_block_size_KCC @e terms_KCC +@e instance_KCC = kind_command_definition table_of_kind_commands[] = { @@ -98,6 +99,8 @@ kind_command_definition table_of_kind_commands[] = { { "invent-source-text", invent_source_text_KCC, TEMPLATE_KCA }, + { "instance", instance_KCC, TEXT_KCA }, + { "apply-macro", apply_macro_KCC, MACRO_KCA }, { NULL, -1, NO_KCA } diff --git a/services/lexicon-module/Chapter 2/Excerpt Meanings.w b/services/lexicon-module/Chapter 2/Excerpt Meanings.w index dc5ed279c..034cc8b40 100644 --- a/services/lexicon-module/Chapter 2/Excerpt Meanings.w +++ b/services/lexicon-module/Chapter 2/Excerpt Meanings.w @@ -128,7 +128,7 @@ void ExcerptMeanings::log_all(void) { int i = 0; excerpt_meaning *em; LOOP_OVER(em, excerpt_meaning) - LOG("%02d: %08x $M\n", i++, (pointer_sized_int) em, em); + LOG("%02d: $M\n", i++, em); } @h Hashing excerpts. diff --git a/services/lexicon-module/Figures/excerpts-diagnostics.txt b/services/lexicon-module/Figures/excerpts-diagnostics.txt index 2ad394478..70bb0c48d 100644 --- a/services/lexicon-module/Figures/excerpts-diagnostics.txt +++ b/services/lexicon-module/Figures/excerpts-diagnostics.txt @@ -1,15 +1,15 @@ -Size of lexicon: 3127 excerpt meanings - Stored among 845 words out of total vocabulary of 10732 - 715 words have a start list: longest belongs to report (with 293 meanings) +Size of lexicon: 3129 excerpt meanings + Stored among 846 words out of total vocabulary of 10735 + 716 words have a start list: longest belongs to report (with 293 meanings) 15 words have an end list: longest belongs to case (with 6 meanings) 29 words have a middle list: longest belongs to to (with 4 meanings) 108 words have a subset list: longest belongs to street (with 4 meanings) -Number of attempts to retrieve: 110340 - of which unsuccessful: 92203 - of which successful: 18137 +Number of attempts to retrieve: 110344 + of which unsuccessful: 92205 + of which successful: 18139 -Total attempts to match against excerpt meanings: 276468 - of which, total with incorrect hash codes: 253733 - of which, total with correct hash codes: 22735 - of which, total which matched: 19904 +Total attempts to match against excerpt meanings: 276472 + of which, total with incorrect hash codes: 253735 + of which, total with correct hash codes: 22737 + of which, total which matched: 19906