- Home
- Extensions
- basicinform
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.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.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)
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 = {
- Home
- Services
- kinds
- Chapter 2: Kinds
- Using Kinds
To determine the characteristics of different kinds, enabling them to be used in practice.
-- §1. Names of kinds
- §2. Being an object
- §3. Definiteness
- §5. (A) How this came into being
- §12. (B) Constructing kinds
- §13. (C) Compatibility with other kinds
- §14. (D) How constant values of this kind are expressed
- §17. (G) Performing arithmetic
- §20. (H) An identifier name
- §21. (I) Storing values at run-time
- §26. (K) Indexing and documentation
+
- §1. Names of kinds
- §2. Being an object
- §3. Definiteness
- §5. (A) How this came into being
- §12. (B) Command parsing
- §13. (C) Compatibility with other kinds
- §14. (D) How constant values of this kind are expressed
- §17. (G) Performing arithmetic
- §20. (H) An identifier name
- §21. (I) Storing values at run-time
- §26. (K) Indexing and documentation
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++; }
+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.+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.