diff --git a/docs/codegen-module/6-ce3.html b/docs/codegen-module/6-ce3.html index 3591dfa4a..d10a42ee9 100644 --- a/docs/codegen-module/6-ce3.html +++ b/docs/codegen-module/6-ce3.html @@ -236,21 +236,16 @@ higher up, but kinds with priority 0 do not appear in the index at all.

-    #ifdef CORE_MODULE
-    kind *K = ChartElement::cheat((int) Metadata::read_optional_numeric(pack, I"^cheat_code"));
     char *repeat = "cross", *props = "cross", *under = "cross";
     int shaded = FALSE;
-    if ((RTKindConstructors::get_highest_valid_value_as_integer(K) == 0) &&
-        (Kinds::Behaviour::indexed_grey_if_empty(K)))
-            shaded = TRUE;
-    if (Deferrals::has_finite_domain(K)) repeat = "tick";
-    if (KindSubjects::has_properties(K)) props = "tick";
-    if (RTKindConstructors::offers_I6_GPR(K)) under = "tick";
-    ChartElement::begin_chart_row(OUT);
-    ChartElement::index_kind_name_cell(OUT, shaded, K);
+    if (Metadata::read_optional_numeric(pack, I"^shaded_in_index")) shaded = TRUE;
+    if (Metadata::read_optional_numeric(pack, I"^finite_domain")) repeat = "tick";
+    if (Metadata::read_optional_numeric(pack, I"^has_properties")) props = "tick";
+    if (Metadata::read_optional_numeric(pack, I"^understandable")) under = "tick";
     if (priority == 8) { repeat = NULL; props = NULL; under = NULL; }
-    ChartElement::end_chart_row(OUT, shaded, K, repeat, props, under);
-    #endif
+    ChartElement::begin_chart_row(OUT);
+    ChartElement::index_kind_name_cell(OUT, shaded, pack);
+    ChartElement::end_chart_row(OUT, shaded, pack, repeat, props, under);
 

§2.6. Note the named anchors here, which must match those linked from the titling @@ -466,33 +461,62 @@ for instance, the sound effects row is shaded if there are none.

-#ifdef CORE_MODULE
-int ChartElement::index_kind_name_cell(OUTPUT_STREAM, int shaded, kind *K) {
+int ChartElement::index_kind_name_cell(OUTPUT_STREAM, int shaded, inter_package *pack) {
     if (shaded) HTML::begin_colour(OUT, I"808080");
+    #ifdef CORE_MODULE
+    kind *K = ChartElement::cheat((int) Metadata::read_optional_numeric(pack, I"^cheat_code"));
     ChartElement::index_kind(OUT, K, FALSE, TRUE);
-    if (Kinds::Behaviour::is_quasinumerical(K)) {
+    #endif
+    if (Metadata::read_optional_numeric(pack, I"^is_quasinumerical")) {
         WRITE(" ");
         HTML_OPEN_WITH("a", "href=\"Kinds.html?segment2\"");
         HTML_TAG_WITH("img", "border=0 src=inform:/doc_images/calc1.png");
         HTML_CLOSE("a");
     }
-    if (Kinds::Behaviour::get_documentation_reference(K))
-        Index::DocReferences::link(OUT, Kinds::Behaviour::get_documentation_reference(K));
-    int i = Instances::count(K);
+    text_stream *doc_ref = Metadata::read_optional_textual(pack, I"^documentation");
+    if (Str::len(doc_ref) > 0) Index::DocReferences::link(OUT, doc_ref);
+    int i = (int) Metadata::read_optional_numeric(pack, I"^instance_count");
     if (i >= 1) WRITE(" [%d]", i);
-    Index::below_link_numbered(OUT, Kinds::get_construct(K)->allocation_id);  a grey see below icon leading to an anchor on pass 2
+    Index::below_link_numbered(OUT, (int) Metadata::read_optional_numeric(pack, I"^cheat_code"));  a grey see below icon leading to an anchor on pass 2
     if (shaded) HTML::end_colour(OUT);
     return shaded;
 }
-#endif
 

§6. Finally we close the name cell, add the remaining cells, and close out the whole row.

+void ChartElement::end_chart_row(OUTPUT_STREAM, int shaded, inter_package *pack,
+    char *tick1, char *tick2, char *tick3) {
+    if (tick1) HTML::next_html_column(OUT, 0);
+    else HTML::next_html_column_spanning(OUT, 0, 4);
+    if (shaded) HTML::begin_colour(OUT, I"808080");
+    WRITE("%S", Metadata::read_optional_textual(pack, I"^index_default"));
+    if (shaded) HTML::end_colour(OUT);
+    if (tick1) {
+        HTML::next_html_column_centred(OUT, 0);
+        if (tick1)
+            HTML_TAG_WITH("img",
+                "border=0 alt=\"%s\" src=inform:/doc_images/%s%s.png",
+                tick1, shaded?"grey":"", tick1);
+        HTML::next_html_column_centred(OUT, 0);
+        if (tick2)
+            HTML_TAG_WITH("img",
+                "border=0 alt=\"%s\" src=inform:/doc_images/%s%s.png",
+                tick2, shaded?"grey":"", tick2);
+        HTML::next_html_column_centred(OUT, 0);
+        if (tick3)
+            HTML_TAG_WITH("img",
+                "border=0 alt=\"%s\" src=inform:/doc_images/%s%s.png",
+                tick3, shaded?"grey":"", tick3);
+    }
+    HTML::end_html_row(OUT);
+}
+
+
 #ifdef CORE_MODULE
-void ChartElement::end_chart_row(OUTPUT_STREAM, int shaded, kind *K,
+void ChartElement::old_end_chart_row(OUTPUT_STREAM, int shaded, kind *K,
     char *tick1, char *tick2, char *tick3) {
     if (tick1) HTML::next_html_column(OUT, 0);
     else HTML::next_html_column_spanning(OUT, 0, 4);
@@ -614,7 +638,7 @@ as "0 kg", "0 hectares", or whatever is appropriate.
 
 
 #ifdef CORE_MODULE
-kind *ChartElement::cheat(int id) {
+kind *ChartElement::cheat(int id) {
     kind_constructor *kc;
     LOOP_OVER(kc, kind_constructor)
         if (kc->allocation_id == id)
diff --git a/docs/index-module/2-me.html b/docs/index-module/2-me.html
index ae063df6c..bc07a2a4d 100644
--- a/docs/index-module/2-me.html
+++ b/docs/index-module/2-me.html
@@ -268,7 +268,7 @@ table of Kinds.
 
 
     if (tabulating_kinds_index)
-        ChartElement::end_chart_row(OUT, shaded, K, "tick", "tick", "tick");
+        ChartElement::old_end_chart_row(OUT, shaded, K, "tick", "tick", "tick");
     else {
         if (details) HTML_CLOSE("p");
     }
diff --git a/docs/runtime-module/2-ec.html b/docs/runtime-module/2-ec.html
index a749d40d3..2ad94966e 100644
--- a/docs/runtime-module/2-ec.html
+++ b/docs/runtime-module/2-ec.html
@@ -108,10 +108,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());
     }
     
    @@ -127,7 +127,7 @@ have made, net:

    §5. Structural.

    -void EmitCode::code(void) {
    +void EmitCode::code(void) {
         Produce::code(Emit::tree());
     }
     
    @@ -140,7 +140,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");
         inter_ti ID = Inter::Warehouse::create_text(Emit::warehouse(), Emit::package());
    @@ -153,7 +153,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, LITERAL_IVAL, N);
     }
     
    @@ -165,11 +165,11 @@ start of a function.
         Produce::val(Emit::tree(), K_truth_state, LITERAL_IVAL, 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);
     }
     
    @@ -185,7 +185,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);
     }
     
    @@ -255,7 +255,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); }
    @@ -322,11 +322,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-hrr.html b/docs/runtime-module/2-hrr.html
    index 2246cdcc3..8f745f6a8 100644
    --- a/docs/runtime-module/2-hrr.html
    +++ b/docs/runtime-module/2-hrr.html
    @@ -1108,6 +1108,7 @@ that the compiler can refer to it.
     enum KIND_PNAME_MD_HL
     enum KIND_SHOWME_MD_HL
     enum KIND_IS_BASE_MD_HL
    +enum KIND_IS_QUASINUMERICAL_MD_HL
     enum KIND_IS_DEF_MD_HL
     enum KIND_IS_OBJECT_MD_HL
     enum INDEX_SUPERKIND_MD_HL
    @@ -1126,6 +1127,12 @@ that the compiler can refer to it.
     enum MIN_VAL_INDEX_MD_HL
     enum MAX_VAL_INDEX_MD_HL
     enum DIMENSIONS_INDEX_MD_HL
    +enum KIND_SHADED_MD_HL
    +enum KIND_FINITE_DOMAIN_MD_HL
    +enum KIND_HAS_PROPERTIES_MD_HL
    +enum KIND_UNDERSTANDABLE_MD_HL
    +enum KIND_INDEX_DEFAULT_MD_HL
    +enum KIND_INSTANCE_COUNT_MD_HL
     enum WEAK_ID_HL
     enum ICOUNT_HL
     enum ILIST_HL
    @@ -1194,6 +1201,7 @@ that the compiler can refer to it.
                 H_C_U(KIND_PNAME_MD_HL,     I"^printed_name")
                 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_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")
                 H_C_U(KIND_IS_SKOO_MD_HL,   I"^is_subkind_of_object")
    @@ -1212,6 +1220,12 @@ that the compiler can refer to it.
                 H_C_U(KIND_DOCUMENTATION_MD_HL, I"^documentation")
                 H_C_U(KIND_INDEX_PRIORITY_MD_HL, I"^index_priority")
                 H_C_U(SUPERKIND_MD_HL, I"^superkind")
    +            H_C_U(KIND_SHADED_MD_HL, I"^shaded_in_index")
    +            H_C_U(KIND_FINITE_DOMAIN_MD_HL, I"^finite_domain")
    +            H_C_U(KIND_HAS_PROPERTIES_MD_HL, I"^has_properties")
    +            H_C_U(KIND_UNDERSTANDABLE_MD_HL, I"^understandable")
    +            H_C_U(KIND_INDEX_DEFAULT_MD_HL, I"^index_default")
    +            H_C_U(KIND_INSTANCE_COUNT_MD_HL, I"^instance_count")
                 H_C_I(WEAK_ID_HL)
                 H_C_I(ICOUNT_HL)
                 H_C_I(ILIST_HL)
    @@ -1971,7 +1985,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::find(Emit::tree(), id);
     }
     
    @@ -2114,7 +2128,7 @@ compilation unit is meant: that's why it's "synoptic". 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); }
    @@ -2154,12 +2168,12 @@ 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);
     }
    diff --git a/docs/runtime-module/2-kd.html b/docs/runtime-module/2-kd.html
    index 0762783aa..07911d7bd 100644
    --- a/docs/runtime-module/2-kd.html
    +++ b/docs/runtime-module/2-kd.html
    @@ -78,7 +78,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) &&
    diff --git a/docs/runtime-module/5-ins.html b/docs/runtime-module/5-ins.html
    index 84ca490ff..71be7fd24 100644
    --- a/docs/runtime-module/5-ins.html
    +++ b/docs/runtime-module/5-ins.html
    @@ -95,7 +95,7 @@ function togglePopup(material_id) {
         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;
     }
    diff --git a/docs/runtime-module/5-kc.html b/docs/runtime-module/5-kc.html
    index 4a04377a4..83cd22378 100644
    --- a/docs/runtime-module/5-kc.html
    +++ b/docs/runtime-module/5-kc.html
    @@ -266,7 +266,7 @@ of the kind which the constructor makes:
     

    §4.

    -inter_name *RTKindConstructors::get_iname(kind *K) {
    +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");
    @@ -352,21 +352,21 @@ of the kind which the constructor makes:
     package_request *RTKindConstructors::kind_package(kind *K) {
         return RTKindConstructors::package(K->construct);
     }
    -inter_name *RTKindConstructors::get_inc_iname(kind *K) {
    +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) {
    +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) {
    +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);
    @@ -443,7 +443,7 @@ not, it returns NULL
     
     
    -int RTKindConstructors::offers_I6_GPR(kind *K) {
    +int RTKindConstructors::offers_I6_GPR(kind *K) {
         if (K == NULL) return FALSE;
         return KindConstructors::offers_I6_GPR(K->construct);
     }
    @@ -490,7 +490,7 @@ parsing names of objects, but not as a grammar token in its own right.
     

    -int RTKindConstructors::get_highest_valid_value_as_integer(kind *K) {
    +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);
     }
    @@ -522,7 +522,7 @@ parsing names of objects, but not as a grammar token in its own right.
     }
     
     void RTKindConstructors::compile(void) {
    -    RTKindConstructors::assign_declaration_sequence_numbers();
    +    RTKindConstructors::assign_declaration_sequence_numbers();
         kind_constructor *kc;
         LOOP_OVER(kc, kind_constructor) {
             if ((kc == CON_KIND_VARIABLE) || (kc == CON_INTERMEDIATE)) continue;
    @@ -539,6 +539,8 @@ parsing names of objects, but not as a grammar token in its own right.
             DISCARD_TEXT(S)
             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 {
    @@ -686,7 +688,7 @@ parsing names of objects, but not as a grammar token in its own right.
             if (Kinds::eq(K, K_players_holdall))
                 Hierarchy::apply_metadata_from_number(pack, RUCKSACK_CLASS_MD_HL, 1);
     
    -        Compile data support functions10.7;
    +        Compile data support functions10.8;
     
             if (kc->compilation_data.declaration_sequence_number >= 0)
                 Produce::annotate_i(RTKindDeclarations::iname(K), DECLARATION_ORDER_IANN,
    @@ -694,23 +696,70 @@ parsing names of objects, but not as a grammar token in its own right.
     
             if ((Kinds::Behaviour::is_quasinumerical(K)) && (Kinds::is_intermediate(K) == FALSE)) {
                 TEMPORARY_TEXT(OUT)
    -            Index the minimum positive value for a quasinumerical kind10.1;
    +            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.2;
    +            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.3;
    +            Index the dimensions for a quasinumerical kind10.4;
                 Hierarchy::apply_metadata(pack, DIMENSIONS_INDEX_MD_HL, OUT);
                 DISCARD_TEXT(OUT)
             }
             Hierarchy::apply_metadata_from_number(pack, CHEAT_CODE_MD_HL,
                 (inter_ti) kc->allocation_id);
    +
    +        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) {
    +            IXInstances::index_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)
         }
    -    Compile multiplication rules for the index10.4;
    +    Compile multiplication rules for the index10.5;
     }
     
    -

    §10.1. Index the minimum positive value for a quasinumerical kind10.1 = +

    §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 = +

    + +
    +    if (LiteralPatterns::list_of_literal_forms(K))
    +        LiteralPatterns::index_value(IDV,
    +            LiteralPatterns::list_of_literal_forms(K), 0);
    +    else
    +        WRITE_TO(IDV, "--");
    +
    +
    • This code is used in §10.
    +

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

    @@ -723,7 +772,7 @@ parsing names of objects, but not as a grammar token in its own right.
         }
     
    • This code is used in §10.
    -

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

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

    @@ -744,7 +793,7 @@ parsing names of objects, but not as a grammar token in its own right.
         }
     
    • This code is used in §10.
    -

    §10.3. Index the dimensions for a quasinumerical kind10.3 = +

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

    @@ -754,7 +803,7 @@ parsing names of objects, but not as a grammar token in its own right.
         }
     
    • This code is used in §10.
    -

    §10.4. Compile multiplication rules for the index10.4 = +

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

    @@ -785,14 +834,14 @@ parsing names of objects, but not as a grammar token in its own right.
         }
     
    • This code is used in §10.
    -

    §10.5.

    +

    §10.6.

     inter_ti kind_sequence_counter = 0;
     
     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;
    @@ -811,10 +860,10 @@ parsing names of objects, but not as a grammar token in its own right.
         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.6.

    +

    §10.7.

     void RTKindConstructors::compile_permissions(void) {
    @@ -829,15 +878,15 @@ parsing names of objects, but not as a grammar token in its own right.
         }
     }
     
    -

    §10.7. Compile data support functions10.7 = +

    §10.8. Compile data support functions10.8 =

         if (Kinds::Behaviour::is_an_enumeration(K)) {
             inter_name *printing_rule_name = RTKindConstructors::get_iname(K);
    -        Compile I6 printing routine for an enumerated kind10.7.3;
    -        Compile the A and B routines for an enumerated kind10.7.4;
    -        Compile random-ranger routine for this kind10.7.5;
    +        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;
         }
         if ((Kinds::Behaviour::is_built_in(K) == FALSE) &&
             (Kinds::Behaviour::is_subkind_of_object(K) == FALSE) &&
    @@ -877,21 +926,21 @@ parsing names of objects, but not as a grammar token in its own right.
             }
             inter_name *printing_rule_name = RTKindConstructors::get_iname(K);
             if (Kinds::Behaviour::is_quasinumerical(K)) {
    -            Compile I6 printing routine for a unit kind10.7.2;
    -            Compile random-ranger routine for this kind10.7.5;
    +            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.7.1;
    +            Compile I6 printing routine for a vacant but named kind10.8.1;
             }
         }
     
    • This code is used in §10.
    -

    §10.7.1. A slightly bogus case first. If the source text declares a kind but never +

    §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.7.1 = +

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

    @@ -907,13 +956,13 @@ compilation errors.
         EmitCode::up();
         Functions::end(save);
     
    - -

    §10.7.2. A unit is printed back with its earliest-defined literal pattern used as +

    +

    §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.7.2 = +

    Compile I6 printing routine for a unit kind10.8.2 =

    @@ -930,8 +979,8 @@ but at present this can't happen.
             Functions::end(save);
         }
     
    - -

    §10.7.3. Compile I6 printing routine for an enumerated kind10.7.3 = +

    +

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

    @@ -986,8 +1035,8 @@ but at present this can't happen.
     
         Functions::end(save);
     
    - -

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

    +

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

    @@ -1000,7 +1049,7 @@ 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.7.4 = +

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

    @@ -1010,20 +1059,20 @@ to A_T1_colour(v)    inter_name *iname_i = RTKindConstructors::get_inc_iname(K);
         packaging_state save = Functions::begin(iname_i);
    -    Implement the A routine10.7.4.1;
    +    Implement the A routine10.8.4.1;
         Functions::end(save);
     
         inter_name *iname_d = RTKindConstructors::get_dec_iname(K);
         save = Functions::begin(iname_d);
    -    Implement the B routine10.7.4.2;
    +    Implement the B routine10.8.4.2;
         Functions::end(save);
     
    - -

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

    +

    §10.8.4.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.7.4.1 = +

    Implement the A routine10.8.4.1 =

    @@ -1056,11 +1105,11 @@ first function ever implemented by emitting Inter code, on 12 November 2017.
     
         EmitCode::up();
     
    - -

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

    +

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

    -

    Implement the B routine10.7.4.2 = +

    Implement the B routine10.8.4.2 =

    @@ -1106,8 +1155,8 @@ first function ever implemented by emitting Inter code, on 12 November 2017.
     
         EmitCode::up();
     
    - -

    §10.7.5. And here we add: +

    +

    §10.8.5. And here we add:

    • (a) R_T1_colour() returns a uniformly random choice of the valid @@ -1116,7 +1165,7 @@ 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.7.5 = +

    Compile random-ranger routine for this kind10.8.5 =

    @@ -1185,7 +1234,7 @@ and b inclusive
                 EmitCode::inv(RETURN_BIP);
                 EmitCode::down();
                     smaller = b_s; larger = a_s;
    -                Formula for range10.7.5.1;
    +                Formula for range10.8.5.1;
                 EmitCode::up();
             EmitCode::up();
         EmitCode::up();
    @@ -1193,13 +1242,13 @@ and b inclusive
         EmitCode::inv(RETURN_BIP);
         EmitCode::down();
             smaller = a_s; larger = b_s;
    -        Formula for range10.7.5.1;
    +        Formula for range10.8.5.1;
         EmitCode::up();
     
         Functions::end(save);
     
    -
    • This code is used in §10.7 (twice).
    -

    §10.7.5.1. Formula for range10.7.5.1 = +

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

    §10.8.5.1. Formula for range10.8.5.1 =

    @@ -1224,7 +1273,7 @@ and b inclusive
             EmitCode::up();
         EmitCode::up();
     
    - + diff --git a/docs/runtime-module/5-ki.html b/docs/runtime-module/5-ki.html index d28b7134c..f0f5b3538 100644 --- a/docs/runtime-module/5-ki.html +++ b/docs/runtime-module/5-ki.html @@ -132,7 +132,7 @@ like variables. That's what makes them intermediate.) return invented; } -inter_name *RTKindIDs::weak_iname(kind *K) { +inter_name *RTKindIDs::weak_iname(kind *K) { if (K == NULL) { return RTKindConstructors::UNKNOWN_iname(); } if (Kinds::Behaviour::is_subkind_of_object(K)) K = K_object; kind_constructor *con = Kinds::get_construct(K); diff --git a/docs/runtime-module/5-lp.html b/docs/runtime-module/5-lp.html index 5397e4c4d..33b2a1c70 100644 --- a/docs/runtime-module/5-lp.html +++ b/docs/runtime-module/5-lp.html @@ -1474,7 +1474,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/6-pp.html b/docs/runtime-module/6-pp.html
    index 4c4d095c1..baea406ab 100644
    --- a/docs/runtime-module/6-pp.html
    +++ b/docs/runtime-module/6-pp.html
    @@ -100,7 +100,7 @@ function togglePopup(material_id) {
     

    -void RTPropertyPermissions::emit_kind_permissions(kind *K) {
    +void RTPropertyPermissions::emit_kind_permissions(kind *K) {
         inference_subject *subj = KindSubjects::from_kind(K);
         int c = 0;
         property_permission *pp;
    diff --git a/docs/runtime-module/6-pv.html b/docs/runtime-module/6-pv.html
    index 5a8b7a58f..4a2d82684 100644
    --- a/docs/runtime-module/6-pv.html
    +++ b/docs/runtime-module/6-pv.html
    @@ -82,7 +82,7 @@ function togglePopup(material_id) {
         RTPropertyValues::emit_subject(Instances::as_subject(I));
     }
     
    -void RTPropertyValues::compile_values_for_kind(kind *K) {
    +void RTPropertyValues::compile_values_for_kind(kind *K) {
         RTPropertyValues::emit_subject(KindSubjects::from_kind(K));
         RTPropertyValues::check_kind_can_have_property(K);
     }
    diff --git a/inform7/Figures/memory-diagnostics.txt b/inform7/Figures/memory-diagnostics.txt
    index 7efbf467d..5c868b5fe 100644
    --- a/inform7/Figures/memory-diagnostics.txt
    +++ b/inform7/Figures/memory-diagnostics.txt
    @@ -1,28 +1,28 @@
    -Total memory consumption was 331968K = 324 MB
    +Total memory consumption was 332904K = 325 MB
     
    -62.1% was used for 1662096 objects, in 326997 frames in 258 x 800K = 206400K = 201 MB:
    +62.2% was used for 1664422 objects, in 327037 frames in 259 x 800K = 207200K = 202 MB:
     
          9.7%  inter_tree_node_array                    46 x 8192 = 376832 objects, 33162688 bytes
    -     6.7%  text_stream_array                        4045 x 100 = 404500 objects, 22781440 bytes
    +     6.7%  text_stream_array                        4057 x 100 = 405700 objects, 22849024 bytes
          4.8%  linked_list                              29551 objects, 16548560 bytes
          3.0%  parse_node                               129396 objects, 10351680 bytes
          3.0%  inter_symbol_array                       105 x 1024 = 107520 objects, 10325280 bytes
          2.1%  verb_conjugation                         160 objects, 7425280 bytes
          1.6%  parse_node_annotation_array              345 x 500 = 172500 objects, 5531040 bytes
    -     1.0%  pcalc_prop_array                         25 x 1000 = 25000 objects, 3400800 bytes
    +     0.9%  pcalc_prop_array                         25 x 1000 = 25000 objects, 3400800 bytes
          0.9%  map_data                                 670 objects, 3178480 bytes
          0.7%  kind_array                               66 x 1000 = 66000 objects, 2642112 bytes
    -     0.6%  inter_name_array                         44 x 1000 = 44000 objects, 2113408 bytes
    +     0.6%  inter_name_array                         45 x 1000 = 45000 objects, 2161440 bytes
          0.5%  inter_schema_token                       13464 objects, 1938816 bytes
          0.5%  vocabulary_entry_array                   161 x 100 = 16100 objects, 1808352 bytes
          0.4%  inter_name_generator_array               38 x 1000 = 38000 objects, 1521216 bytes
          0.4%  match_trie_array                         11 x 1000 = 11000 objects, 1496352 bytes
          0.4%  i6_schema_array                          23 x 100 = 2300 objects, 1380736 bytes
          0.3%  inter_package                            16419 objects, 1182168 bytes
    -     0.3%  dictionary                               22499 objects, 1079952 bytes
    +     0.3%  dictionary                               22511 objects, 1080528 bytes
          0.3%  id_body                                  940 objects, 1075360 bytes
          0.3%  inter_symbols_table                      16419 objects, 1050816 bytes
    -     0.3%  dict_entry_array                         319 x 100 = 31900 objects, 1031008 bytes
    +     0.3%  dict_entry_array                         320 x 100 = 32000 objects, 1034240 bytes
          0.2%  adjective_meaning                        202 objects, 1000304 bytes
          0.2%  package_request                          10995 objects, 967560 bytes
          0.2%  excerpt_meaning                          3098 objects, 966576 bytes
    @@ -43,7 +43,7 @@ Total memory consumption was 331968K = 324 MB
          ----  inter_annotation_array                   1 x 8192 objects, 196640 bytes
          ----  binary_predicate                         321 objects, 169488 bytes
          ----  linguistic_stock_item                    3315 objects, 159120 bytes
    -     ----  hierarchy_location                       1007 objects, 153064 bytes
    +     ----  hierarchy_location                       1014 objects, 154128 bytes
          ----  rule_family_data                         400 objects, 147200 bytes
          ----  nonterminal                              759 objects, 139656 bytes
          ----  nascent_array                            1948 objects, 124672 bytes
    @@ -52,7 +52,7 @@ Total memory consumption was 331968K = 324 MB
          ----  imperative_defn                          1376 objects, 99072 bytes
          ----  anl_entry_array                          2 x 1000 = 2000 objects, 96064 bytes
          ----  noun_usage                               2401 objects, 96040 bytes
    -     ----  inter_tree                               6 objects, 92736 bytes
    +     ----  inter_tree                               6 objects, 93072 bytes
          ----  preposition                              273 objects, 87360 bytes
          ----  lexical_cluster                          2516 objects, 80512 bytes
          ----  pcalc_term_array                         2 x 1000 = 2000 objects, 80064 bytes
    @@ -109,7 +109,7 @@ Total memory consumption was 331968K = 324 MB
          ----  booking_list                             407 objects, 13024 bytes
          ----  adjective_iname_holder                   320 objects, 12800 bytes
          ----  pathname                                 292 objects, 11680 bytes
    -     ----  uniqueness_count                         394 objects, 9456 bytes
    +     ----  uniqueness_count                         401 objects, 9624 bytes
          ----  stopwatch_timer                          109 objects, 8720 bytes
          ----  filename                                 208 objects, 8320 bytes
          ----  equation_node                            68 objects, 7616 bytes
    @@ -236,16 +236,16 @@ Total memory consumption was 331968K = 324 MB
          ----  by_function_bp_data                      1 object, 40 bytes
          ----  kind_template_definition                 1 object, 40 bytes
     
    -37.8% was used for memory not allocated for objects:
    +37.7% was used for memory not allocated for objects:
     
    -    17.6%  text stream storage                      60066580 bytes in 418602 claims
    -     3.6%  dictionary storage                       12434432 bytes in 22499 claims
    +    17.6%  text stream storage                      60194312 bytes in 419835 claims
    +     3.6%  dictionary storage                       12444160 bytes in 22511 claims
          ----  sorting                                  720 bytes in 3 claims
          2.1%  source text                              7200000 bytes in 3 claims
          3.1%  source text details                      10800000 bytes in 2 claims
          ----  linguistic stock array                   81920 bytes in 2 claims
          ----  small word set array                     105600 bytes in 22 claims
    -     0.8%  inter symbols storage                    2827280 bytes in 17444 claims
    +     0.8%  inter symbols storage                    2829264 bytes in 17445 claims
          4.9%  inter bytecode storage                   16802796 bytes in 14 claims
          4.7%  inter links storage                      16174208 bytes in 266 claims
          ----  inter tree location list storage         191232 bytes in 32 claims
    @@ -255,5 +255,5 @@ Total memory consumption was 331968K = 324 MB
          ----  code generation workspace for objects    9648 bytes in 9 claims
          ----  emitter array storage                    154432 bytes in 2037 claims
     
    -19.2% was overhead - 65519552 bytes = 63983K = 62 MB
    +19.4% was overhead - 66217760 bytes = 64665K = 63 MB
     
    diff --git a/inform7/Figures/timings-diagnostics.txt b/inform7/Figures/timings-diagnostics.txt
    index 93d283c81..d50d293d7 100644
    --- a/inform7/Figures/timings-diagnostics.txt
    +++ b/inform7/Figures/timings-diagnostics.txt
    @@ -1,35 +1,34 @@
     100.0% in inform7 run
    -     53.7% in compilation to Inter
    -         40.0% in //Sequence::undertake_queued_tasks//
    +     53.9% in compilation to Inter
    +         39.6% in //Sequence::undertake_queued_tasks//
               3.8% in //MajorNodes::pre_pass//
    -          2.8% in //MajorNodes::pass_1//
    +          2.9% in //MajorNodes::pass_1//
               1.5% in //ImperativeDefinitions::assess_all//
    +          1.0% in //RTKindConstructors::compile//
               0.5% in //MajorNodes::pass_2//
    -          0.5% in //RTKindConstructors::compile//
    -          0.5% in //Sequence::undertake_queued_tasks//
               0.5% in //World::stage_V//
               0.3% in //ImperativeDefinitions::compile_first_block//
    +          0.3% in //Sequence::undertake_queued_tasks//
               0.1% in //CompletionModule::compile//
               0.1% in //InferenceSubjects::emit_all//
               0.1% in //RTKindConstructors::compile_permissions//
    -          0.1% in //Sequence::undertake_queued_tasks//
               0.1% in //Task::make_built_in_kind_constructors//
               0.1% in //World::stages_II_and_III//
    -          2.1% not specifically accounted for
    -     44.2% in running Inter pipeline
    -         11.1% in inter step 7/14: consolidate-text
    -         10.8% in step preparation
    -          8.9% in inter step 2/14: link
    -          7.4% in inter step 14/14: generate inform6 -> auto.inf
    -          1.1% in inter step 10/14: make-identifiers-unique
    +          2.3% not specifically accounted for
    +     43.8% in running Inter pipeline
    +         10.9% in inter step 7/14: consolidate-text
    +         10.9% in step preparation
    +          9.0% in inter step 2/14: link
    +          7.3% in inter step 14/14: generate inform6 -> auto.inf
    +          1.2% in inter step 10/14: make-identifiers-unique
               0.3% in inter step 11/14: reconcile-verbs
               0.3% in inter step 13/14: eliminate-redundant-operations
               0.3% in inter step 6/14: assimilate
    -          0.3% in inter step 8/14: resolve-external-symbols
               0.1% in inter step 12/14: eliminate-redundant-labels
               0.1% in inter step 4/14: parse-linked-matter
               0.1% in inter step 5/14: resolve-conditional-compilation
    +          0.1% in inter step 8/14: resolve-external-symbols
               0.1% in inter step 9/14: inspect-plugs
    -          2.7% not specifically accounted for
    -      1.8% in supervisor
    -      0.2% not specifically accounted for
    +          2.3% not specifically accounted for
    +      1.7% in supervisor
    +      0.6% not specifically accounted for
    diff --git a/inform7/index-module/Chapter 2/Map Element.w b/inform7/index-module/Chapter 2/Map Element.w
    index 9749c3db4..57df08b1a 100644
    --- a/inform7/index-module/Chapter 2/Map Element.w	
    +++ b/inform7/index-module/Chapter 2/Map Element.w	
    @@ -167,7 +167,7 @@ void IXPhysicalWorld::index(OUTPUT_STREAM, instance *I, kind *K, int depth, int
     
     @ =
     	if (tabulating_kinds_index)
    -		ChartElement::end_chart_row(OUT, shaded, K, "tick", "tick", "tick");
    +		ChartElement::old_end_chart_row(OUT, shaded, K, "tick", "tick", "tick");
     	else {
     		if (details) HTML_CLOSE("p");
     	}
    diff --git a/inform7/runtime-module/Chapter 2/Hierarchy.w b/inform7/runtime-module/Chapter 2/Hierarchy.w
    index 2e1b2d8f2..bf2e39813 100644
    --- a/inform7/runtime-module/Chapter 2/Hierarchy.w	
    +++ b/inform7/runtime-module/Chapter 2/Hierarchy.w	
    @@ -969,6 +969,7 @@ void Hierarchy::establish(void) {
     @e KIND_PNAME_MD_HL
     @e KIND_SHOWME_MD_HL
     @e KIND_IS_BASE_MD_HL
    +@e KIND_IS_QUASINUMERICAL_MD_HL
     @e KIND_IS_DEF_MD_HL
     @e KIND_IS_OBJECT_MD_HL
     @e INDEX_SUPERKIND_MD_HL
    @@ -987,6 +988,12 @@ void Hierarchy::establish(void) {
     @e MIN_VAL_INDEX_MD_HL
     @e MAX_VAL_INDEX_MD_HL
     @e DIMENSIONS_INDEX_MD_HL
    +@e KIND_SHADED_MD_HL
    +@e KIND_FINITE_DOMAIN_MD_HL
    +@e KIND_HAS_PROPERTIES_MD_HL
    +@e KIND_UNDERSTANDABLE_MD_HL
    +@e KIND_INDEX_DEFAULT_MD_HL
    +@e KIND_INSTANCE_COUNT_MD_HL
     @e WEAK_ID_HL
     @e ICOUNT_HL
     @e ILIST_HL
    @@ -1055,6 +1062,7 @@ void Hierarchy::establish(void) {
     			H_C_U(KIND_PNAME_MD_HL,     I"^printed_name")
     			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_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")
     			H_C_U(KIND_IS_SKOO_MD_HL,   I"^is_subkind_of_object")
    @@ -1073,6 +1081,12 @@ void Hierarchy::establish(void) {
     			H_C_U(KIND_DOCUMENTATION_MD_HL, I"^documentation")
     			H_C_U(KIND_INDEX_PRIORITY_MD_HL, I"^index_priority")
     			H_C_U(SUPERKIND_MD_HL, I"^superkind")
    +			H_C_U(KIND_SHADED_MD_HL, I"^shaded_in_index")
    +			H_C_U(KIND_FINITE_DOMAIN_MD_HL, I"^finite_domain")
    +			H_C_U(KIND_HAS_PROPERTIES_MD_HL, I"^has_properties")
    +			H_C_U(KIND_UNDERSTANDABLE_MD_HL, I"^understandable")
    +			H_C_U(KIND_INDEX_DEFAULT_MD_HL, I"^index_default")
    +			H_C_U(KIND_INSTANCE_COUNT_MD_HL, I"^instance_count")
     			H_C_I(WEAK_ID_HL)
     			H_C_I(ICOUNT_HL)
     			H_C_I(ILIST_HL)
    diff --git a/inform7/runtime-module/Chapter 5/Kind Constructors.w b/inform7/runtime-module/Chapter 5/Kind Constructors.w
    index 8ea74db00..de682c20c 100644
    --- a/inform7/runtime-module/Chapter 5/Kind Constructors.w	
    +++ b/inform7/runtime-module/Chapter 5/Kind Constructors.w	
    @@ -458,6 +458,8 @@ void RTKindConstructors::compile(void) {
     		DISCARD_TEXT(S)
     		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 {
    @@ -625,10 +627,52 @@ void RTKindConstructors::compile(void) {
     		}
     		Hierarchy::apply_metadata_from_number(pack, CHEAT_CODE_MD_HL,
     			(inter_ti) kc->allocation_id);
    +
    +		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) {
    +			IXInstances::index_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)
     	}
     	@;
     }
     
    +@ 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 {
    diff --git a/inter/codegen-module/Chapter 6/Chart Element.w b/inter/codegen-module/Chapter 6/Chart Element.w
    index 57b3b27d9..1dc7c6f22 100644
    --- a/inter/codegen-module/Chapter 6/Chart Element.w	
    +++ b/inter/codegen-module/Chapter 6/Chart Element.w	
    @@ -140,21 +140,16 @@ void ChartElement::index_kinds(OUTPUT_STREAM, tree_inventory *inv, int pass) {
     @ And then a typical row:
     
     @ =
    -	#ifdef CORE_MODULE
    -	kind *K = ChartElement::cheat((int) Metadata::read_optional_numeric(pack, I"^cheat_code"));
     	char *repeat = "cross", *props = "cross", *under = "cross";
     	int shaded = FALSE;
    -	if ((RTKindConstructors::get_highest_valid_value_as_integer(K) == 0) &&
    -		(Kinds::Behaviour::indexed_grey_if_empty(K)))
    -			shaded = TRUE;
    -	if (Deferrals::has_finite_domain(K)) repeat = "tick";
    -	if (KindSubjects::has_properties(K)) props = "tick";
    -	if (RTKindConstructors::offers_I6_GPR(K)) under = "tick";
    -	ChartElement::begin_chart_row(OUT);
    -	ChartElement::index_kind_name_cell(OUT, shaded, K);
    +	if (Metadata::read_optional_numeric(pack, I"^shaded_in_index")) shaded = TRUE;
    +	if (Metadata::read_optional_numeric(pack, I"^finite_domain")) repeat = "tick";
    +	if (Metadata::read_optional_numeric(pack, I"^has_properties")) props = "tick";
    +	if (Metadata::read_optional_numeric(pack, I"^understandable")) under = "tick";
     	if (priority == 8) { repeat = NULL; props = NULL; under = NULL; }
    -	ChartElement::end_chart_row(OUT, shaded, K, repeat, props, under);
    -	#endif
    +	ChartElement::begin_chart_row(OUT);
    +	ChartElement::index_kind_name_cell(OUT, shaded, pack);
    +	ChartElement::end_chart_row(OUT, shaded, pack, repeat, props, under);
     
     @ Note the named anchors here, which must match those linked from the titling
     row.
    @@ -333,32 +328,61 @@ a kind which can have enumerated values but doesn't at the moment --
     for instance, the sound effects row is shaded if there are none.
     
     =
    -#ifdef CORE_MODULE
    -int ChartElement::index_kind_name_cell(OUTPUT_STREAM, int shaded, kind *K) {
    +int ChartElement::index_kind_name_cell(OUTPUT_STREAM, int shaded, inter_package *pack) {
     	if (shaded) HTML::begin_colour(OUT, I"808080");
    +	#ifdef CORE_MODULE
    +	kind *K = ChartElement::cheat((int) Metadata::read_optional_numeric(pack, I"^cheat_code"));
     	ChartElement::index_kind(OUT, K, FALSE, TRUE);
    -	if (Kinds::Behaviour::is_quasinumerical(K)) {
    +	#endif
    +	if (Metadata::read_optional_numeric(pack, I"^is_quasinumerical")) {
     		WRITE(" ");
     		HTML_OPEN_WITH("a", "href=\"Kinds.html?segment2\"");
     		HTML_TAG_WITH("img", "border=0 src=inform:/doc_images/calc1.png");
     		HTML_CLOSE("a");
     	}
    -	if (Kinds::Behaviour::get_documentation_reference(K))
    -		Index::DocReferences::link(OUT, Kinds::Behaviour::get_documentation_reference(K));
    -	int i = Instances::count(K);
    +	text_stream *doc_ref = Metadata::read_optional_textual(pack, I"^documentation");
    +	if (Str::len(doc_ref) > 0) Index::DocReferences::link(OUT, doc_ref);
    +	int i = (int) Metadata::read_optional_numeric(pack, I"^instance_count");
     	if (i >= 1) WRITE(" [%d]", i);
    -	Index::below_link_numbered(OUT, Kinds::get_construct(K)->allocation_id); /* a grey see below icon leading to an anchor on pass 2 */
    +	Index::below_link_numbered(OUT, (int) Metadata::read_optional_numeric(pack, I"^cheat_code")); /* a grey see below icon leading to an anchor on pass 2 */
     	if (shaded) HTML::end_colour(OUT);
     	return shaded;
     }
    -#endif
     
     @ Finally we close the name cell, add the remaining cells, and close out the
     whole row.
     
     =
    +void ChartElement::end_chart_row(OUTPUT_STREAM, int shaded, inter_package *pack,
    +	char *tick1, char *tick2, char *tick3) {
    +	if (tick1) HTML::next_html_column(OUT, 0);
    +	else HTML::next_html_column_spanning(OUT, 0, 4);
    +	if (shaded) HTML::begin_colour(OUT, I"808080");
    +	WRITE("%S", Metadata::read_optional_textual(pack, I"^index_default"));
    +	if (shaded) HTML::end_colour(OUT);
    +	if (tick1) {
    +		HTML::next_html_column_centred(OUT, 0);
    +		if (tick1)
    +			HTML_TAG_WITH("img",
    +				"border=0 alt=\"%s\" src=inform:/doc_images/%s%s.png",
    +				tick1, shaded?"grey":"", tick1);
    +		HTML::next_html_column_centred(OUT, 0);
    +		if (tick2)
    +			HTML_TAG_WITH("img",
    +				"border=0 alt=\"%s\" src=inform:/doc_images/%s%s.png",
    +				tick2, shaded?"grey":"", tick2);
    +		HTML::next_html_column_centred(OUT, 0);
    +		if (tick3)
    +			HTML_TAG_WITH("img",
    +				"border=0 alt=\"%s\" src=inform:/doc_images/%s%s.png",
    +				tick3, shaded?"grey":"", tick3);
    +	}
    +	HTML::end_html_row(OUT);
    +}
    +
    +
     #ifdef CORE_MODULE
    -void ChartElement::end_chart_row(OUTPUT_STREAM, int shaded, kind *K,
    +void ChartElement::old_end_chart_row(OUTPUT_STREAM, int shaded, kind *K,
     	char *tick1, char *tick2, char *tick3) {
     	if (tick1) HTML::next_html_column(OUT, 0);
     	else HTML::next_html_column_spanning(OUT, 0, 4);