diff --git a/docs/arch-module/1-am.html b/docs/arch-module/1-am.html index eb045f9a96..241e8ceb52 100644 --- a/docs/arch-module/1-am.html +++ b/docs/arch-module/1-am.html @@ -51,7 +51,7 @@
Setting up the use of this module.
-§1. This section simoly sets up the module in ways expected by foundation, and +
§1. This section simply sets up the module in ways expected by foundation, and contains no code of interest. The following constant exists only in tools which use this module:
diff --git a/docs/assertions-module/1-am.html b/docs/assertions-module/1-am.html index d53b090a89..50e33df1fd 100644 --- a/docs/assertions-module/1-am.html +++ b/docs/assertions-module/1-am.html @@ -51,7 +51,7 @@Setting up the use of this module.
-§1. This section simoly sets up the module in ways expected by foundation, and +
§1. This section simply sets up the module in ways expected by foundation, and contains no code of interest. The following constant exists only in tools which use this module:
diff --git a/docs/assertions-module/2-bv.html b/docs/assertions-module/2-bv.html index 85bda73d3b..189842fa25 100644 --- a/docs/assertions-module/2-bv.html +++ b/docs/assertions-module/2-bv.html @@ -230,25 +230,26 @@define EQUALITY_RELATION_NAME 0 define UNIVERSAL_RELATION_NAME 1 define MEANING_RELATION_NAME 2 -define PROVISION_RELATION_NAME 3 -define GE_RELATION_NAME 4 -define GT_RELATION_NAME 5 -define LE_RELATION_NAME 6 -define LT_RELATION_NAME 7 -define ADJACENCY_RELATION_NAME 8 -define REGIONAL_CONTAINMENT_RELATION_NAME 9 -define CONTAINMENT_RELATION_NAME 10 -define SUPPORT_RELATION_NAME 11 -define INCORPORATION_RELATION_NAME 12 -define CARRYING_RELATION_NAME 13 -define HOLDING_RELATION_NAME 14 -define WEARING_RELATION_NAME 15 -define POSSESSION_RELATION_NAME 16 -define VISIBILITY_RELATION_NAME 17 -define TOUCHABILITY_RELATION_NAME 18 -define CONCEALMENT_RELATION_NAME 19 -define ENCLOSURE_RELATION_NAME 20 -define ROOM_CONTAINMENT_RELATION_NAME 21 +define EMPTY_RELATION_NAME 3 +define PROVISION_RELATION_NAME 4 +define GE_RELATION_NAME 5 +define GT_RELATION_NAME 6 +define LE_RELATION_NAME 7 +define LT_RELATION_NAME 8 +define ADJACENCY_RELATION_NAME 9 +define REGIONAL_CONTAINMENT_RELATION_NAME 10 +define CONTAINMENT_RELATION_NAME 11 +define SUPPORT_RELATION_NAME 12 +define INCORPORATION_RELATION_NAME 13 +define CARRYING_RELATION_NAME 14 +define HOLDING_RELATION_NAME 15 +define WEARING_RELATION_NAME 16 +define POSSESSION_RELATION_NAME 17 +define VISIBILITY_RELATION_NAME 18 +define TOUCHABILITY_RELATION_NAME 19 +define CONCEALMENT_RELATION_NAME 20 +define ENCLOSURE_RELATION_NAME 21 +define ROOM_CONTAINMENT_RELATION_NAME 22
§3. These are the English names of the built-in relations. The use of hyphenation here is a fossil from the times when Inform allowed only single-word relation @@ -262,6 +263,7 @@
To define how equality behaves in the Inform language.
-void EqualityDetails::start(void) { METHOD_ADD(equality_bp_family, TYPECHECK_BPF_MTID, EqualityDetails::typecheck); - METHOD_ADD(equality_bp_family, ASSERT_BPF_MTID, EqualityDetails::assert); - METHOD_ADD(equality_bp_family, SCHEMA_BPF_MTID, EqualityDetails::schema); + METHOD_ADD(equality_bp_family, ASSERT_BPF_MTID, EqualityDetails::assert); + METHOD_ADD(equality_bp_family, SCHEMA_BPF_MTID, EqualityDetails::schema); + + METHOD_ADD(empty_bp_family, TYPECHECK_BPF_MTID, EqualityDetails::typecheck_empty); + METHOD_ADD(empty_bp_family, ASSERT_BPF_MTID, EqualityDetails::assert_empty); + METHOD_ADD(empty_bp_family, SCHEMA_BPF_MTID, EqualityDetails::schema_empty); }
§2. Typechecking. This is a very polymorphic relation, in that it can accept terms of almost @@ -102,7 +106,6 @@
§4. Assertion. In general values differ, and cannot be equated by fiat. But an exception is +
§4. The never-holding relation is simpler: anything can be hypothetically related to +anything else (except of course that it always is not). +
+ ++int EqualityDetails::typecheck_empty(bp_family *self, binary_predicate *bp, + kind **kinds_of_terms, kind **kinds_required, tc_problem_kit *tck) { + return ALWAYS_MATCH; +} ++
§5. Assertion. In general values differ, and cannot be equated by fiat. But an exception is setting a global variable.
-int EqualityDetails::assert(bp_family *self, binary_predicate *bp, +int EqualityDetails::assert(bp_family *self, binary_predicate *bp, inference_subject *infs0, parse_node *spec0, inference_subject *infs1, parse_node *spec1) { if (Lvalues::is_actual_NONLOCAL_VARIABLE(spec0)) { @@ -206,7 +219,17 @@-return FALSE; }
§5. Compilation. Since we are compiling to I6, which is itself a C-level programming +
§6. The never-holding relation cannot be asserted true: +
+ ++int EqualityDetails::assert_empty(bp_family *self, binary_predicate *bp, + inference_subject *infs0, parse_node *spec0, + inference_subject *infs1, parse_node *spec1) { + return FALSE; +} ++
§7. Compilation. Since we are compiling to I6, which is itself a C-level programming language, it looks at first as if we can compile is into == when testing equality and = when asserting it: thus
@@ -246,17 +269,17 @@-int EqualityDetails::schema(bp_family *self, int task, binary_predicate *bp, annotated_i6_schema *asch) { +int EqualityDetails::schema(bp_family *self, int task, binary_predicate *bp, annotated_i6_schema *asch) { kind *st[2]; st[0] = Cinders::kind_of_term(asch->pt0); st[1] = Cinders::kind_of_term(asch->pt1); if ((Kinds::Behaviour::is_object(st[0])) && (Properties::can_name_coincide_with_kind(st[1])) && (Properties::property_with_same_name_as(st[1]))) - Handle the case of setting a property of A separately5.1; + Handle the case of setting a property of A separately7.1; if ((Kinds::eq(st[0], K_response)) && (Kinds::eq(st[1], K_text))) - Handle the case of setting a response separately5.2; + Handle the case of setting a response separately7.2; switch (task) { case TEST_ATOM_TASK: @@ -278,15 +301,15 @@-if ((storage_class == UNKNOWN_NT) && (Kinds::get_construct(st[0]) == CON_property)) storage_class = PROPERTY_VALUE_NT; - Make a further check that kinds permit this assignment5.4; + Make a further check that kinds permit this assignment7.4; if (storage_class == UNKNOWN_NT) { - Issue problem message for being unable to set equal5.5 + Issue problem message for being unable to set equal7.5 asch->schema = NULL; } else { - Exceptional case of setting the "player" global variable5.3; + Exceptional case of setting the "player" global variable7.3; Calculus::Schemas::modify(asch->schema, "%s", CompileLvalues::interpret_store(storage_class, st[0], st[1], 0)); - Add kind-checking code for run-time checking5.6; + Add kind-checking code for run-time checking7.6; } return TRUE; } @@ -294,7 +317,7 @@
return FALSE; }
§5.1. So here is the exceptional case (a) mentioned above. Suppose we have: +
§7.1. So here is the exceptional case (a) mentioned above. Suppose we have:
@@ -307,7 +330,7 @@lantern is bright". -
Handle the case of setting a property of A separately5.1 = +
Handle the case of setting a property of A separately7.1 =
@@ -324,8 +347,8 @@-} return FALSE;
-
- This code is used in §5.
§5.2. Handle the case of setting a response separately5.2 = +
+
- This code is used in §7.
§7.2. Handle the case of setting a response separately7.2 =
@@ -344,11 +367,11 @@-} return FALSE;
-
- This code is used in §5.
§5.3. A little bit of support within Inform to help the template layer. +
+
- This code is used in §7.
§7.3. A little bit of support within Inform to help the template layer.
-Exceptional case of setting the "player" global variable5.3 = +
Exceptional case of setting the "player" global variable7.3 =
@@ -365,8 +388,8 @@-return TRUE; }
-
- This code is used in §5.
§5.4. Make a further check that kinds permit this assignment5.4 = +
+
- This code is used in §7.
§7.4. Make a further check that kinds permit this assignment7.4 =
@@ -388,12 +411,12 @@-} }
-
- This code is used in §5.
§5.5. Rather than just returning FALSE for a generic problem message, we issue +
+
- This code is used in §7.
§7.5. Rather than just returning FALSE for a generic problem message, we issue one that's more helpfully specific and return TRUE.
-Issue problem message for being unable to set equal5.5 = +
Issue problem message for being unable to set equal7.5 =
@@ -414,8 +437,8 @@-"just as the number '7' is fixed."); }
-
- This code is used in §5.
§5.6. Add kind-checking code for run-time checking5.6 = +
+
- This code is used in §7.
§7.6. Add kind-checking code for run-time checking7.6 =
@@ -431,7 +454,16 @@-DISCARD_TEXT(TEMP) }
+
- This code is used in §5.
+
- This code is used in §7.
§8. This never holds and there is nothing to compile: +
+ ++int EqualityDetails::schema_empty(bp_family *self, int task, binary_predicate *bp, + annotated_i6_schema *asch) { + return FALSE; +} +diff --git a/docs/basic_inform/S-pd.html b/docs/basic_inform/S-pd.html index e1a3515c38..d02d44c017 100644 --- a/docs/basic_inform/S-pd.html +++ b/docs/basic_inform/S-pd.html @@ -427,7 +427,7 @@hopes: that's partly up to the virtual machine, unfortunately. -
See test case BIP-SayOneOf, though since intest runs on plain text only, +
See test case BIP-SayFonts, though since intest runs on plain text only, you may need to run this in the Inform application to be convinced.
@@ -1061,7 +1061,7 @@(documented at ph_seed): (- VM_Seed_RNG({N}); -). -
§31. A novel feature of Inform is that there is a default value of any kind: fpr +
§31. A novel feature of Inform is that there is a default value of any kind: for example, it is 0 for a number, or the empty text for text. When Inform compiles a value of a given kind but isn't told what value to compile, it always chooses the default, which is why the following definition works. diff --git a/docs/basic_inform/S-prm.html b/docs/basic_inform/S-prm.html index ddc5221946..d2c3073b6c 100644 --- a/docs/basic_inform/S-prm.html +++ b/docs/basic_inform/S-prm.html @@ -54,7 +54,7 @@
§1. Title. Every Inform 7 extension begins with a standard titling line and a -rubric text, and this are no exception: +rubric text, and this is no exception:
diff --git a/docs/bytecode-module/1-bm.html b/docs/bytecode-module/1-bm.html index c211a43b0c..933bb82e2a 100644 --- a/docs/bytecode-module/1-bm.html +++ b/docs/bytecode-module/1-bm.html @@ -51,7 +51,7 @@
- Home
- Inter Modules
- bytecode
- Chapter 1: Setting Up
- Bytecode Module
Setting up the use of this module.
-§1. This section simoly sets up the module in ways expected by foundation, and +
§1. This section simply sets up the module in ways expected by foundation, and contains no code of interest. The following constant exists only in tools which use this module:
diff --git a/docs/calculus-module/1-cm.html b/docs/calculus-module/1-cm.html index 0f679e099a..20c54bf5f7 100644 --- a/docs/calculus-module/1-cm.html +++ b/docs/calculus-module/1-cm.html @@ -59,7 +59,7 @@
- Home
- Services
- calculus
- Chapter 1: Setting Up
- Calculus Module
Setting up the use of this module.
-§1. This section simoly sets up the module in ways expected by foundation, and +
§1. This section simply sets up the module in ways expected by foundation, and contains no code of interest. The following constant exists only in tools which use this module:
diff --git a/docs/calculus-module/3-bp.html b/docs/calculus-module/3-bp.html index 3efd7b3174..0986ed882c 100644 --- a/docs/calculus-module/3-bp.html +++ b/docs/calculus-module/3-bp.html @@ -195,6 +195,7 @@
kind *BinaryPredicates::kind(binary_predicate *bp) { if (bp == R_equality) return Kinds::binary_con(CON_relation, K_value, K_value); + if (bp == R_empty) return Kinds::binary_con(CON_relation, K_value, K_value); kind *K0 = BinaryPredicates::term_kind(bp, 0); kind *K1 = BinaryPredicates::term_kind(bp, 1); if (K0 == NULL) K0 = K_object; diff --git a/docs/calculus-module/3-ter.html b/docs/calculus-module/3-ter.html index 71ad793bd9..ba0660819c 100644 --- a/docs/calculus-module/3-ter.html +++ b/docs/calculus-module/3-ter.html @@ -68,9 +68,11 @@
bp_family *equality_bp_family = NULL; bp_family *spatial_bp_family = NULL; +bp_family *empty_bp_family = NULL; binary_predicate *R_equality = NULL; binary_predicate *a_has_b_predicate = NULL; +binary_predicate *R_empty = NULL;§2. Family. This is a minimal representation only, for when the calculus module is used in a non-Inform context: whereas Inform adds other methods to the equality @@ -92,6 +94,14 @@
METHOD_ADD(spatial_bp_family, STOCK_BPF_MTID, Calculus::Equality::stock_spatial); #endif + + empty_bp_family = BinaryPredicateFamilies::new(); + METHOD_ADD(empty_bp_family, STOCK_BPF_MTID, + Calculus::Equality::stock_empty); + METHOD_ADD(empty_bp_family, DESCRIBE_FOR_PROBLEMS_BPF_MTID, + Calculus::Equality::describe_empty_for_problems); + METHOD_ADD(empty_bp_family, DESCRIBE_FOR_INDEX_BPF_MTID, + Calculus::Equality::describe_empty_for_index); }
§3. Initial stock. Note the unique one-off way in which equality is made. @@ -117,18 +127,34 @@
PreformUtilities::wording(<relation-names>, POSSESSION_RELATION_NAME)); } } + +void Calculus::Equality::stock_empty(bp_family *self, int n) { + if (n == 1) { + R_empty = BinaryPredicates::make_equality(empty_bp_family, + PreformUtilities::wording(<relation-names>, EMPTY_RELATION_NAME)); + BinaryPredicates::set_index_details(R_equality, "value", "value"); + } +}
-int Calculus::Equality::describe_for_problems(bp_family *self, OUTPUT_STREAM, +int Calculus::Equality::describe_for_problems(bp_family *self, OUTPUT_STREAM, binary_predicate *bp) { return FALSE; } -void Calculus::Equality::describe_for_index(bp_family *self, OUTPUT_STREAM, +void Calculus::Equality::describe_for_index(bp_family *self, OUTPUT_STREAM, binary_predicate *bp) { WRITE("equality"); } +int Calculus::Equality::describe_empty_for_problems(bp_family *self, OUTPUT_STREAM, + binary_predicate *bp) { + return FALSE; +} +void Calculus::Equality::describe_empty_for_index(bp_family *self, OUTPUT_STREAM, + binary_predicate *bp) { + WRITE("never-holding"); +}@@ -163,7 +163,7 @@text_stream *test_err = NULL; void Declarations::load_from_file(text_stream *arg) { - filename *F = Filenames::from_text(arg); + filename *F = Filenames::from_text(arg); feed_t FD = Feeds::begin(); source_file *sf = TextFromFiles::feed_into_lexer(F, NULL_GENERAL_POINTER); wording W = Feeds::end(FD); @@ -171,7 +171,7 @@
syntax_tree = SyntaxTree::new(); Sentences::break(syntax_tree, W); BinaryPredicateFamilies::first_stock(); - test_err = Str::new(); + test_err = Str::new(); SyntaxTree::traverse(syntax_tree, Declarations::parse); } @@ -405,9 +405,9 @@
PRINT("'%<W': ", W); if (R[1]) PRINT("true"); else { PRINT("false"); - if (Str::len(test_err) > 0) PRINT(" - %S", test_err); + if (Str::len(test_err) > 0) PRINT(" - %S", test_err); } - Str::clear(test_err); + Str::clear(test_err); PRINT("\n");
@@ -465,7 +465,7 @@
- This code is used in §4.
BPTerms::new(TERM_DOMAIN_FROM_KIND_FUNCTION(k0)); bp_term_details t1 = BPTerms::new(TERM_DOMAIN_FROM_KIND_FUNCTION(k1)); - text_stream *S = Str::new(); + text_stream *S = Str::new(); WRITE_TO(S, "%W", W); binary_predicate *bp = BinaryPredicates::make_pair(test_bp_family, t0, t1, S, NULL, NULL, @@ -475,7 +475,7 @@
TEMPORARY_TEXT(f1n) WRITE_TO(f0n, "%W", f0); WRITE_TO(f1n, "%W", f1); - if (Str::ne(f0n, I"none")) { + if (Str::ne(f0n, I"none")) { named_function *nf = CREATE(named_function); nf->bp = bp; nf->name = f0; @@ -483,7 +483,7 @@
BPTerms::set_function(&(bp->term_details[0]), Calculus::Schemas::new("%S(*1)", f0n)); } - if (Str::ne(f1n, I"none")) { + if (Str::ne(f1n, I"none")) { named_function *nf = CREATE(named_function); nf->bp = bp; nf->name = f1; diff --git a/docs/calculus-test/1-pc.html b/docs/calculus-test/1-pc.html index d7aa5c6844..31fdd41fdc 100644 --- a/docs/calculus-test/1-pc.html +++ b/docs/calculus-test/1-pc.html @@ -49,8 +49,8 @@
Repository
Related Projects
@@ -69,7 +69,7 @@
int main(int argc, char **argv) { - Foundation::start(argc, argv); + Foundation::start(argc, argv); WordsModule::start(); SyntaxModule::start(); LexiconModule::start(); @@ -78,21 +78,21 @@@@ -111,16 +111,16 @@KindsModule::start(); CalculusModule::start(); - pathname *P = Pathnames::from_text(I"services"); - P = Pathnames::down(P, I"calculus-test"); - P = Pathnames::down(P, I"Tangled"); - filename *S = Filenames::in(P, I"Syntax.preform"); + pathname *P = Pathnames::from_text(I"services"); + P = Pathnames::down(P, I"calculus-test"); + P = Pathnames::down(P, I"Tangled"); + filename *S = Filenames::in(P, I"Syntax.preform"); LoadPreform::load(S, NULL); - CommandLine::declare_heading( + CommandLine::declare_heading( L"calculus-test: a tool for testing the calculus module\n"); - CommandLine::declare_switch(LOAD_CLSW, L"load", 2, + CommandLine::declare_switch(LOAD_CLSW, L"load", 2, L"load kind definitions from file X"); - CommandLine::declare_switch(INTERPRET_CLSW, L"interpret", 2, + CommandLine::declare_switch(INTERPRET_CLSW, L"interpret", 2, L"interpret REPL commands in file X"); - CommandLine::read(argc, argv, NULL, &Main::respond, &Main::ignore); + CommandLine::read(argc, argv, NULL, &Main::respond, &Main::ignore); WordsModule::end(); SyntaxModule::end(); @@ -101,7 +101,7 @@
LinguisticsModule::end(); KindsModule::end(); CalculusModule::end(); - Foundation::end(); + Foundation::end(); return 0; }
void Main::respond(int id, int val, text_stream *arg, void *state) { text_stream *save_DL = DL; DL = STDOUT; - Streams::enable_debugging(DL); + Streams::enable_debugging(DL); switch (id) { - case LOAD_CLSW: NeptuneFiles::load(Filenames::from_text(arg)); break; + case LOAD_CLSW: NeptuneFiles::load(Filenames::from_text(arg)); break; case INTERPRET_CLSW: Declarations::load_from_file(arg); break; } DL = save_DL; } void Main::ignore(int id, text_stream *arg, void *state) { - Errors::fatal("only switches may be used at the command line"); + Errors::fatal("only switches may be used at the command line"); }
@@ -168,12 +168,14 @@
define EQUALITY_RELATION_NAME 0 define UNIVERSAL_RELATION_NAME 1 define POSSESSION_RELATION_NAME 2 +define EMPTY_RELATION_NAME 3<relation-names> ::= equality | universal | - possession + possession | + never-holding
- This is Preform grammar, not regular C code.