mirror of
https://github.com/ganelson/inform.git
synced 2024-07-03 07:24:58 +03:00
Migrated Ar element
This commit is contained in:
parent
8b89583fe0
commit
38cd2bff3c
|
@ -1,134 +0,0 @@
|
||||||
[IXArithmetic::] Arithmetic Element.
|
|
||||||
|
|
||||||
To index dimensional rules.
|
|
||||||
|
|
||||||
@
|
|
||||||
|
|
||||||
=
|
|
||||||
void IXArithmetic::render(OUTPUT_STREAM) {
|
|
||||||
HTML_TAG("hr");
|
|
||||||
@<Index the rubric about quasinumerical kinds@>;
|
|
||||||
@<Index the table of quasinumerical kinds@>;
|
|
||||||
@<Index the table of multiplication rules@>;
|
|
||||||
}
|
|
||||||
|
|
||||||
@<Index the rubric about quasinumerical kinds@> =
|
|
||||||
HTML_OPEN("p");
|
|
||||||
HTML_TAG_WITH("a", "calculator");
|
|
||||||
HTML::begin_plain_html_table(OUT);
|
|
||||||
HTML::first_html_column(OUT, 0);
|
|
||||||
HTML_TAG_WITH("img", "border=0 src=inform:/doc_images/calc2.png");
|
|
||||||
WRITE(" ");
|
|
||||||
WRITE("Kinds of value marked with the <b>calculator symbol</b> are numerical - "
|
|
||||||
"these are values we can add, multiply and so on. The range of these "
|
|
||||||
"numbers depends on the Format setting for the project (Glulx format "
|
|
||||||
"supports much higher numbers than Z-code).");
|
|
||||||
HTML::end_html_row(OUT);
|
|
||||||
HTML::end_html_table(OUT);
|
|
||||||
HTML_CLOSE("p");
|
|
||||||
|
|
||||||
@<Index the table of quasinumerical kinds@> =
|
|
||||||
HTML_OPEN("p");
|
|
||||||
HTML::begin_plain_html_table(OUT);
|
|
||||||
|
|
||||||
HTML::first_html_column(OUT, 0);
|
|
||||||
WRITE("<b>kind of value</b>");
|
|
||||||
HTML::next_html_column(OUT, 0);
|
|
||||||
WRITE("<b>minimum</b>");
|
|
||||||
HTML::next_html_column(OUT, 0);
|
|
||||||
WRITE("<b>maximum</b>");
|
|
||||||
HTML::next_html_column(OUT, 0);
|
|
||||||
WRITE("<b>dimensions</b>");
|
|
||||||
HTML::end_html_row(OUT);
|
|
||||||
|
|
||||||
kind *R;
|
|
||||||
LOOP_OVER_BASE_KINDS(R)
|
|
||||||
if (Kinds::Behaviour::is_quasinumerical(R)) {
|
|
||||||
if (Kinds::is_intermediate(R)) continue;
|
|
||||||
HTML::first_html_column(OUT, 0);
|
|
||||||
Kinds::Index::index_kind(OUT, R, FALSE, FALSE);
|
|
||||||
HTML::next_html_column(OUT, 0);
|
|
||||||
@<Index the minimum positive value for a quasinumerical kind@>;
|
|
||||||
HTML::next_html_column(OUT, 0);
|
|
||||||
@<Index the maximum positive value for a quasinumerical kind@>;
|
|
||||||
HTML::next_html_column(OUT, 0);
|
|
||||||
if (Kinds::Dimensions::dimensionless(R)) WRITE("<i>dimensionless</i>");
|
|
||||||
else {
|
|
||||||
unit_sequence *deriv = Kinds::Behaviour::get_dimensional_form(R);
|
|
||||||
Kinds::Dimensions::index_unit_sequence(OUT, deriv, TRUE);
|
|
||||||
}
|
|
||||||
HTML::end_html_row(OUT);
|
|
||||||
}
|
|
||||||
HTML::end_html_table(OUT);
|
|
||||||
HTML_CLOSE("p");
|
|
||||||
|
|
||||||
@ At run-time, the minimum positive value is of course |1|, but because of
|
|
||||||
scaling this can appear to be much lower.
|
|
||||||
|
|
||||||
@<Index the minimum positive value for a quasinumerical kind@> =
|
|
||||||
if (Kinds::eq(R, K_number)) WRITE("1");
|
|
||||||
else {
|
|
||||||
text_stream *p = Kinds::Behaviour::get_index_minimum_value(R);
|
|
||||||
if (Str::len(p) > 0) WRITE("%S", p);
|
|
||||||
else LiteralPatterns::index_value(OUT,
|
|
||||||
LiteralPatterns::list_of_literal_forms(R), 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@<Index the maximum positive value for a quasinumerical kind@> =
|
|
||||||
if (Kinds::eq(R, K_number)) {
|
|
||||||
if (TargetVMs::is_16_bit(Task::vm())) WRITE("32767");
|
|
||||||
else WRITE("2147483647");
|
|
||||||
} else {
|
|
||||||
text_stream *p = Kinds::Behaviour::get_index_maximum_value(R);
|
|
||||||
if (Str::len(p) > 0) WRITE("%S", p);
|
|
||||||
else {
|
|
||||||
if (TargetVMs::is_16_bit(Task::vm()))
|
|
||||||
LiteralPatterns::index_value(OUT,
|
|
||||||
LiteralPatterns::list_of_literal_forms(R), 32767);
|
|
||||||
else
|
|
||||||
LiteralPatterns::index_value(OUT,
|
|
||||||
LiteralPatterns::list_of_literal_forms(R), 2147483647);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ This is simply a table of all the multiplications declared in the source
|
|
||||||
text, sorted into kind order of left and then right operand.
|
|
||||||
|
|
||||||
@<Index the table of multiplication rules@> =
|
|
||||||
kind *L, *R, *O;
|
|
||||||
int NP = 0, wn;
|
|
||||||
LOOP_OVER_MULTIPLICATIONS(L, R, O, wn) {
|
|
||||||
if (NP++ == 0) {
|
|
||||||
HTML_OPEN("p");
|
|
||||||
WRITE("This is how multiplication changes kinds:");
|
|
||||||
HTML_CLOSE("p");
|
|
||||||
HTML_OPEN("p");
|
|
||||||
HTML::begin_plain_html_table(OUT);
|
|
||||||
}
|
|
||||||
HTML::first_html_column(OUT, 0);
|
|
||||||
if (wn >= 0) Index::link(OUT, wn);
|
|
||||||
HTML::next_html_column(OUT, 0);
|
|
||||||
Kinds::Index::index_kind(OUT, L, FALSE, FALSE);
|
|
||||||
HTML::begin_colour(OUT, I"808080");
|
|
||||||
WRITE(" x ");
|
|
||||||
HTML::end_colour(OUT);
|
|
||||||
Kinds::Index::index_kind(OUT, R, FALSE, FALSE);
|
|
||||||
HTML::begin_colour(OUT, I"808080");
|
|
||||||
WRITE(" = ");
|
|
||||||
HTML::end_colour(OUT);
|
|
||||||
Kinds::Index::index_kind(OUT, O, FALSE, FALSE);
|
|
||||||
WRITE(" ");
|
|
||||||
HTML::next_html_column(OUT, 0);
|
|
||||||
LiteralPatterns::index_benchmark_value(OUT, L);
|
|
||||||
HTML::begin_colour(OUT, I"808080");
|
|
||||||
WRITE(" x ");
|
|
||||||
HTML::end_colour(OUT);
|
|
||||||
LiteralPatterns::index_benchmark_value(OUT, R);
|
|
||||||
HTML::begin_colour(OUT, I"808080");
|
|
||||||
WRITE(" = ");
|
|
||||||
HTML::end_colour(OUT);
|
|
||||||
LiteralPatterns::index_benchmark_value(OUT, O);
|
|
||||||
HTML::end_html_row(OUT);
|
|
||||||
}
|
|
||||||
if (NP > 0) { HTML::end_html_table(OUT); HTML_CLOSE("p"); }
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ Chapter 2: Indexing
|
||||||
Rules
|
Rules
|
||||||
Activities
|
Activities
|
||||||
Phrasebook Index
|
Phrasebook Index
|
||||||
Arithmetic Element
|
|
||||||
|
|
||||||
Chapter 3: Indexing for Plugins
|
Chapter 3: Indexing for Plugins
|
||||||
Spatial
|
Spatial
|
||||||
|
|
|
@ -951,6 +951,9 @@ void Hierarchy::establish(void) {
|
||||||
@e KIND_DSIZE_MD_HL
|
@e KIND_DSIZE_MD_HL
|
||||||
@e KIND_DOCUMENTATION_MD_HL
|
@e KIND_DOCUMENTATION_MD_HL
|
||||||
@e RUCKSACK_CLASS_MD_HL
|
@e RUCKSACK_CLASS_MD_HL
|
||||||
|
@e MIN_VAL_INDEX_MD_HL
|
||||||
|
@e MAX_VAL_INDEX_MD_HL
|
||||||
|
@e DIMENSIONS_INDEX_MD_HL
|
||||||
@e WEAK_ID_HL
|
@e WEAK_ID_HL
|
||||||
@e ICOUNT_HL
|
@e ICOUNT_HL
|
||||||
@e ILIST_HL
|
@e ILIST_HL
|
||||||
|
@ -991,6 +994,15 @@ void Hierarchy::establish(void) {
|
||||||
@e KIND_USAGE_HAP
|
@e KIND_USAGE_HAP
|
||||||
@e KIND_CLASS_HL
|
@e KIND_CLASS_HL
|
||||||
|
|
||||||
|
@e MULTIPLICATION_RULE_HAP
|
||||||
|
@e SET_AT_MD_HL
|
||||||
|
@e LEFT_OPERAND_MD_HL
|
||||||
|
@e RIGHT_OPERAND_MD_HL
|
||||||
|
@e RESULT_MD_HL
|
||||||
|
@e LEFT_OPERAND_BM_MD_HL
|
||||||
|
@e RIGHT_OPERAND_BM_MD_HL
|
||||||
|
@e RESULT_BM_MD_HL
|
||||||
|
|
||||||
@<Establish kinds@> =
|
@<Establish kinds@> =
|
||||||
submodule_identity *kinds = Packaging::register_submodule(I"kinds");
|
submodule_identity *kinds = Packaging::register_submodule(I"kinds");
|
||||||
|
|
||||||
|
@ -1021,6 +1033,9 @@ void Hierarchy::establish(void) {
|
||||||
H_C_U(KIND_MKDEF_FN_MD_HL, I"^mkdef_fn")
|
H_C_U(KIND_MKDEF_FN_MD_HL, I"^mkdef_fn")
|
||||||
H_C_U(KIND_DSIZE_MD_HL, I"^domain_size")
|
H_C_U(KIND_DSIZE_MD_HL, I"^domain_size")
|
||||||
H_C_U(RUCKSACK_CLASS_MD_HL, I"^rucksack_class")
|
H_C_U(RUCKSACK_CLASS_MD_HL, I"^rucksack_class")
|
||||||
|
H_C_U(MIN_VAL_INDEX_MD_HL, I"^min_value")
|
||||||
|
H_C_U(MAX_VAL_INDEX_MD_HL, I"^max_value")
|
||||||
|
H_C_U(DIMENSIONS_INDEX_MD_HL, I"^dimensions")
|
||||||
H_C_U(KIND_DOCUMENTATION_MD_HL, I"^documentation")
|
H_C_U(KIND_DOCUMENTATION_MD_HL, I"^documentation")
|
||||||
H_C_I(WEAK_ID_HL)
|
H_C_I(WEAK_ID_HL)
|
||||||
H_C_I(ICOUNT_HL)
|
H_C_I(ICOUNT_HL)
|
||||||
|
@ -1055,7 +1070,7 @@ void Hierarchy::establish(void) {
|
||||||
H_END
|
H_END
|
||||||
H_END
|
H_END
|
||||||
H_BEGIN_AP(DERIVED_KIND_HAP, I"derived_kind", I"_derived_kind")
|
H_BEGIN_AP(DERIVED_KIND_HAP, I"derived_kind", I"_derived_kind")
|
||||||
H_C_U(DK_NEEDED_MD_HL, I"^default_value_needed")
|
H_C_U(DK_NEEDED_MD_HL, I"^default_value_needed")
|
||||||
H_C_U(DK_STRONG_ID_HL, I"strong_id")
|
H_C_U(DK_STRONG_ID_HL, I"strong_id")
|
||||||
H_C_G(DK_KIND_HL, I"DK")
|
H_C_G(DK_KIND_HL, I"DK")
|
||||||
H_C_U(DK_DEFAULT_VALUE_HL, I"default_value")
|
H_C_U(DK_DEFAULT_VALUE_HL, I"default_value")
|
||||||
|
@ -1067,6 +1082,15 @@ void Hierarchy::establish(void) {
|
||||||
H_BEGIN(HierarchyLocations::completion_submodule(I, kinds))
|
H_BEGIN(HierarchyLocations::completion_submodule(I, kinds))
|
||||||
H_BEGIN_AP(KIND_USAGE_HAP, I"kind_usage", I"_kind_usage")
|
H_BEGIN_AP(KIND_USAGE_HAP, I"kind_usage", I"_kind_usage")
|
||||||
H_END
|
H_END
|
||||||
|
H_BEGIN_AP(MULTIPLICATION_RULE_HAP, I"multiplication_rule", I"_multiplication_rule")
|
||||||
|
H_C_U(SET_AT_MD_HL, I"^at")
|
||||||
|
H_C_U(LEFT_OPERAND_MD_HL, I"^left_operand")
|
||||||
|
H_C_U(RIGHT_OPERAND_MD_HL, I"^right_operand")
|
||||||
|
H_C_U(RESULT_MD_HL, I"^result")
|
||||||
|
H_C_U(LEFT_OPERAND_BM_MD_HL, I"^left_operand_benchmark")
|
||||||
|
H_C_U(RIGHT_OPERAND_BM_MD_HL, I"^right_operand_benchmark")
|
||||||
|
H_C_U(RESULT_BM_MD_HL, I"^result_benchmark")
|
||||||
|
H_END
|
||||||
H_END
|
H_END
|
||||||
|
|
||||||
@h Literal patterns.
|
@h Literal patterns.
|
||||||
|
|
|
@ -596,9 +596,83 @@ void RTKindConstructors::compile(void) {
|
||||||
if (kc->compilation_data.declaration_sequence_number >= 0)
|
if (kc->compilation_data.declaration_sequence_number >= 0)
|
||||||
Produce::annotate_i(RTKindDeclarations::iname(K), DECLARATION_ORDER_IANN,
|
Produce::annotate_i(RTKindDeclarations::iname(K), DECLARATION_ORDER_IANN,
|
||||||
(inter_ti) kc->compilation_data.declaration_sequence_number);
|
(inter_ti) kc->compilation_data.declaration_sequence_number);
|
||||||
|
|
||||||
|
if ((Kinds::Behaviour::is_quasinumerical(K)) && (Kinds::is_intermediate(K) == FALSE)) {
|
||||||
|
TEMPORARY_TEXT(OUT)
|
||||||
|
@<Index the minimum positive value for a quasinumerical kind@>;
|
||||||
|
Hierarchy::apply_metadata(pack, MIN_VAL_INDEX_MD_HL, OUT);
|
||||||
|
Str::clear(OUT);
|
||||||
|
@<Index the maximum positive value for a quasinumerical kind@>;
|
||||||
|
Hierarchy::apply_metadata(pack, MAX_VAL_INDEX_MD_HL, OUT);
|
||||||
|
Str::clear(OUT);
|
||||||
|
@<Index the dimensions for a quasinumerical kind@>;
|
||||||
|
Hierarchy::apply_metadata(pack, DIMENSIONS_INDEX_MD_HL, OUT);
|
||||||
|
DISCARD_TEXT(OUT)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@<Compile multiplication rules for the index@>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@<Index the minimum positive value for a quasinumerical kind@> =
|
||||||
|
if (Kinds::eq(K, K_number)) WRITE("1");
|
||||||
|
else {
|
||||||
|
text_stream *p = Kinds::Behaviour::get_index_minimum_value(K);
|
||||||
|
if (Str::len(p) > 0) WRITE("%S", p);
|
||||||
|
else LiteralPatterns::index_value(OUT,
|
||||||
|
LiteralPatterns::list_of_literal_forms(K), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@<Index the maximum positive value for a quasinumerical kind@> =
|
||||||
|
if (Kinds::eq(K, K_number)) {
|
||||||
|
if (TargetVMs::is_16_bit(Task::vm())) WRITE("32767");
|
||||||
|
else WRITE("2147483647");
|
||||||
|
} else {
|
||||||
|
text_stream *p = Kinds::Behaviour::get_index_maximum_value(K);
|
||||||
|
if (Str::len(p) > 0) WRITE("%S", p);
|
||||||
|
else {
|
||||||
|
if (TargetVMs::is_16_bit(Task::vm()))
|
||||||
|
LiteralPatterns::index_value(OUT,
|
||||||
|
LiteralPatterns::list_of_literal_forms(K), 32767);
|
||||||
|
else
|
||||||
|
LiteralPatterns::index_value(OUT,
|
||||||
|
LiteralPatterns::list_of_literal_forms(K), 2147483647);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@<Index the dimensions for a quasinumerical kind@> =
|
||||||
|
if (Kinds::Dimensions::dimensionless(K) == FALSE) {
|
||||||
|
unit_sequence *deriv = Kinds::Behaviour::get_dimensional_form(K);
|
||||||
|
Kinds::Dimensions::index_unit_sequence(OUT, deriv, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@<Compile multiplication rules for the index@> =
|
||||||
|
kind *L, *R, *O;
|
||||||
|
int wn;
|
||||||
|
LOOP_OVER_MULTIPLICATIONS(L, R, O, wn) {
|
||||||
|
package_request *pack = Hierarchy::completion_package(MULTIPLICATION_RULE_HAP);
|
||||||
|
if (wn >= 0) Hierarchy::apply_metadata_from_number(pack, SET_AT_MD_HL, (inter_ti) wn);
|
||||||
|
TEMPORARY_TEXT(OUT)
|
||||||
|
WRITE_TO(OUT, "%u", L);
|
||||||
|
Hierarchy::apply_metadata(pack, LEFT_OPERAND_MD_HL, OUT);
|
||||||
|
Str::clear(OUT);
|
||||||
|
WRITE_TO(OUT, "%u", R);
|
||||||
|
Hierarchy::apply_metadata(pack, RIGHT_OPERAND_MD_HL, OUT);
|
||||||
|
Str::clear(OUT);
|
||||||
|
WRITE_TO(OUT, "%u", O);
|
||||||
|
Hierarchy::apply_metadata(pack, RESULT_MD_HL, OUT);
|
||||||
|
Str::clear(OUT);
|
||||||
|
LiteralPatterns::index_benchmark_value(OUT, L);
|
||||||
|
Hierarchy::apply_metadata(pack, LEFT_OPERAND_BM_MD_HL, OUT);
|
||||||
|
Str::clear(OUT);
|
||||||
|
LiteralPatterns::index_benchmark_value(OUT, R);
|
||||||
|
Hierarchy::apply_metadata(pack, RIGHT_OPERAND_BM_MD_HL, OUT);
|
||||||
|
Str::clear(OUT);
|
||||||
|
LiteralPatterns::index_benchmark_value(OUT, O);
|
||||||
|
Hierarchy::apply_metadata(pack, RESULT_BM_MD_HL, OUT);
|
||||||
|
DISCARD_TEXT(OUT)
|
||||||
|
}
|
||||||
|
|
||||||
@
|
@
|
||||||
|
|
||||||
=
|
=
|
||||||
|
|
|
@ -48,6 +48,7 @@ typedef struct tree_inventory {
|
||||||
inter_tree_location_list *variable_nodes;
|
inter_tree_location_list *variable_nodes;
|
||||||
inter_tree_location_list *equation_nodes;
|
inter_tree_location_list *equation_nodes;
|
||||||
inter_tree_location_list *heading_nodes;
|
inter_tree_location_list *heading_nodes;
|
||||||
|
inter_tree_location_list *multiplication_rule_nodes;
|
||||||
CLASS_DEFINITION
|
CLASS_DEFINITION
|
||||||
} tree_inventory;
|
} tree_inventory;
|
||||||
|
|
||||||
|
@ -84,6 +85,7 @@ tree_inventory *Synoptic::new_inventory(inter_tree *I) {
|
||||||
inv->variable_nodes = Synoptic::add_inventory_need(inv, I"_variable");
|
inv->variable_nodes = Synoptic::add_inventory_need(inv, I"_variable");
|
||||||
inv->equation_nodes = Synoptic::add_inventory_need(inv, I"_equation");
|
inv->equation_nodes = Synoptic::add_inventory_need(inv, I"_equation");
|
||||||
inv->heading_nodes = Synoptic::add_inventory_need(inv, I"_heading");
|
inv->heading_nodes = Synoptic::add_inventory_need(inv, I"_heading");
|
||||||
|
inv->multiplication_rule_nodes = Synoptic::add_inventory_need(inv, I"_multiplication_rule");
|
||||||
|
|
||||||
inv->extension_nodes = TreeLists::new();
|
inv->extension_nodes = TreeLists::new();
|
||||||
inv->scene_nodes = TreeLists::new();
|
inv->scene_nodes = TreeLists::new();
|
||||||
|
|
107
inter/codegen-module/Chapter 6/Arithmetic Element.w
Normal file
107
inter/codegen-module/Chapter 6/Arithmetic Element.w
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
[ArithmeticElement::] Arithmetic Element.
|
||||||
|
|
||||||
|
To index dimensional rules.
|
||||||
|
|
||||||
|
@ These were really indexed for us in metadata generated by the main compiler;
|
||||||
|
so we do little more than tabulate that data here.
|
||||||
|
|
||||||
|
=
|
||||||
|
void ArithmeticElement::render(OUTPUT_STREAM) {
|
||||||
|
inter_tree *I = Index::get_tree();
|
||||||
|
tree_inventory *inv = Synoptic::inv(I);
|
||||||
|
TreeLists::sort(inv->kind_nodes, Synoptic::module_order);
|
||||||
|
TreeLists::sort(inv->multiplication_rule_nodes, Synoptic::module_order);
|
||||||
|
HTML_TAG("hr");
|
||||||
|
@<Index the rubric about quasinumerical kinds@>;
|
||||||
|
@<Index the table of quasinumerical kinds@>;
|
||||||
|
@<Index the table of multiplication rules@>;
|
||||||
|
}
|
||||||
|
|
||||||
|
@<Index the rubric about quasinumerical kinds@> =
|
||||||
|
HTML_OPEN("p");
|
||||||
|
HTML_TAG_WITH("a", "calculator");
|
||||||
|
HTML::begin_plain_html_table(OUT);
|
||||||
|
HTML::first_html_column(OUT, 0);
|
||||||
|
HTML_TAG_WITH("img", "border=0 src=inform:/doc_images/calc2.png");
|
||||||
|
WRITE(" ");
|
||||||
|
WRITE("Kinds of value marked with the calculator symbol are numerical - "
|
||||||
|
"these are values we can add, multiply and so on. The range of these "
|
||||||
|
"numbers depends on the Format setting for the project (Glulx format "
|
||||||
|
"supports much higher numbers than Z-code).");
|
||||||
|
HTML::end_html_row(OUT);
|
||||||
|
HTML::end_html_table(OUT);
|
||||||
|
HTML_CLOSE("p");
|
||||||
|
|
||||||
|
@<Index the table of quasinumerical kinds@> =
|
||||||
|
HTML_OPEN("p");
|
||||||
|
HTML::begin_plain_html_table(OUT);
|
||||||
|
|
||||||
|
HTML::first_html_column(OUT, 0);
|
||||||
|
WRITE("<b>kind of value</b>");
|
||||||
|
HTML::next_html_column(OUT, 0);
|
||||||
|
WRITE("<b>minimum</b>");
|
||||||
|
HTML::next_html_column(OUT, 0);
|
||||||
|
WRITE("<b>maximum</b>");
|
||||||
|
HTML::next_html_column(OUT, 0);
|
||||||
|
WRITE("<b>dimensions</b>");
|
||||||
|
HTML::end_html_row(OUT);
|
||||||
|
|
||||||
|
for (int i=0; i<TreeLists::len(inv->kind_nodes); i++) {
|
||||||
|
inter_package *pack = Inter::Package::defined_by_frame(inv->kind_nodes->list[i].node);
|
||||||
|
if (Str::len(Metadata::read_optional_textual(pack, I"^min_value")) > 0) {
|
||||||
|
HTML::first_html_column(OUT, 0);
|
||||||
|
WRITE("%S", Metadata::read_optional_textual(pack, I"^printed_name"));
|
||||||
|
HTML::next_html_column(OUT, 0);
|
||||||
|
WRITE("%S", Metadata::read_optional_textual(pack, I"^min_value"));
|
||||||
|
HTML::next_html_column(OUT, 0);
|
||||||
|
WRITE("%S", Metadata::read_optional_textual(pack, I"^max_value"));
|
||||||
|
HTML::next_html_column(OUT, 0);
|
||||||
|
text_stream *dims = Metadata::read_optional_textual(pack, I"^dimensions");
|
||||||
|
if (Str::len(dims) > 0) WRITE("%S", dims); else WRITE("<i>dimensionless</i>");
|
||||||
|
HTML::end_html_row(OUT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HTML::end_html_table(OUT);
|
||||||
|
HTML_CLOSE("p");
|
||||||
|
|
||||||
|
@ This is simply a table of all the multiplications declared in the source
|
||||||
|
text, sorted into kind order of left and then right operand.
|
||||||
|
|
||||||
|
@<Index the table of multiplication rules@> =
|
||||||
|
if (TreeLists::len(inv->multiplication_rule_nodes) > 0) {
|
||||||
|
HTML_OPEN("p");
|
||||||
|
WRITE("This is how multiplication changes kinds:");
|
||||||
|
HTML_CLOSE("p");
|
||||||
|
HTML_OPEN("p");
|
||||||
|
HTML::begin_plain_html_table(OUT);
|
||||||
|
for (int i=0; i<TreeLists::len(inv->multiplication_rule_nodes); i++) {
|
||||||
|
inter_package *pack = Inter::Package::defined_by_frame(inv->multiplication_rule_nodes->list[i].node);
|
||||||
|
HTML::first_html_column(OUT, 0);
|
||||||
|
int at = (int) Metadata::read_optional_numeric(pack, I"^at");
|
||||||
|
if (at > 0) Index::link(OUT, at);
|
||||||
|
HTML::next_html_column(OUT, 0);
|
||||||
|
WRITE("%S", Metadata::read_optional_textual(pack, I"^left_operand"));
|
||||||
|
HTML::begin_colour(OUT, I"808080");
|
||||||
|
WRITE(" x ");
|
||||||
|
HTML::end_colour(OUT);
|
||||||
|
WRITE("%S", Metadata::read_optional_textual(pack, I"^right_operand"));
|
||||||
|
HTML::begin_colour(OUT, I"808080");
|
||||||
|
WRITE(" = ");
|
||||||
|
HTML::end_colour(OUT);
|
||||||
|
WRITE("%S", Metadata::read_optional_textual(pack, I"^result"));
|
||||||
|
WRITE(" ");
|
||||||
|
HTML::next_html_column(OUT, 0);
|
||||||
|
WRITE("%S", Metadata::read_optional_textual(pack, I"^left_operand_benchmark"));
|
||||||
|
HTML::begin_colour(OUT, I"808080");
|
||||||
|
WRITE(" x ");
|
||||||
|
HTML::end_colour(OUT);
|
||||||
|
WRITE("%S", Metadata::read_optional_textual(pack, I"^right_operand_benchmark"));
|
||||||
|
HTML::begin_colour(OUT, I"808080");
|
||||||
|
WRITE(" = ");
|
||||||
|
HTML::end_colour(OUT);
|
||||||
|
WRITE("%S", Metadata::read_optional_textual(pack, I"^result_benchmark"));
|
||||||
|
HTML::end_html_row(OUT);
|
||||||
|
}
|
||||||
|
HTML::end_html_table(OUT);
|
||||||
|
HTML_CLOSE("p");
|
||||||
|
}
|
|
@ -644,76 +644,28 @@ void Index::test_card(OUTPUT_STREAM, wording W) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Index::index_actual_element(OUTPUT_STREAM, text_stream *elt) {
|
void Index::index_actual_element(OUTPUT_STREAM, text_stream *elt) {
|
||||||
if (Str::eq_wide_string(elt, L"Bh")) {
|
if (Str::eq_wide_string(elt, L"Ar")) { ArithmeticElement::render(OUT); return; }
|
||||||
BehaviourElement::render(OUT);
|
if (Str::eq_wide_string(elt, L"Bh")) { BehaviourElement::render(OUT); return; }
|
||||||
return;
|
if (Str::eq_wide_string(elt, L"C")) { ContentsElement::render(OUT); return; }
|
||||||
}
|
if (Str::eq_wide_string(elt, L"Cd")) { CardElement::render(OUT); return; }
|
||||||
if (Str::eq_wide_string(elt, L"Cd")) {
|
if (Str::eq_wide_string(elt, L"Ev")) { EventsElement::render(OUT); return; }
|
||||||
CardElement::render(OUT);
|
if (Str::eq_wide_string(elt, L"Fi")) { FiguresElement::render(OUT); return; }
|
||||||
return;
|
if (Str::eq_wide_string(elt, L"Gz")) { GazetteerElement::render(OUT); return; }
|
||||||
}
|
if (Str::eq_wide_string(elt, L"In")) { InnardsElement::render(OUT); return; }
|
||||||
if (Str::eq_wide_string(elt, L"Rl")) {
|
if (Str::eq_wide_string(elt, L"Lx")) { LexiconElement::render(OUT); return; }
|
||||||
RelationsElement::render(OUT);
|
if (Str::eq_wide_string(elt, L"Rl")) { RelationsElement::render(OUT); return; }
|
||||||
return;
|
if (Str::eq_wide_string(elt, L"RS")) { RulesForScenesElement::render(OUT); return; }
|
||||||
}
|
if (Str::eq_wide_string(elt, L"St")) { StandardsElement::render(OUT); return; }
|
||||||
if (Str::eq_wide_string(elt, L"Ev")) {
|
if (Str::eq_wide_string(elt, L"Tb")) { TablesElement::render(OUT); return; }
|
||||||
EventsElement::render(OUT);
|
if (Str::eq_wide_string(elt, L"Vb")) { VerbsElement::render(OUT); return; }
|
||||||
return;
|
if (Str::eq_wide_string(elt, L"Vl")) { ValuesElement::render(OUT); return; }
|
||||||
}
|
if (Str::eq_wide_string(elt, L"Xt")) { ExtrasElement::render(OUT); return; }
|
||||||
if (Str::eq_wide_string(elt, L"Fi")) {
|
|
||||||
FiguresElement::render(OUT);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Str::eq_wide_string(elt, L"Tb")) {
|
|
||||||
TablesElement::render(OUT);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Str::eq_wide_string(elt, L"Vl")) {
|
|
||||||
ValuesElement::render(OUT);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Str::eq_wide_string(elt, L"RS")) {
|
|
||||||
RulesForScenesElement::render(OUT);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Str::eq_wide_string(elt, L"Xt")) {
|
|
||||||
ExtrasElement::render(OUT);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Str::eq_wide_string(elt, L"St")) {
|
|
||||||
StandardsElement::render(OUT);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Str::eq_wide_string(elt, L"C")) {
|
|
||||||
ContentsElement::render(OUT);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Str::eq_wide_string(elt, L"In")) {
|
|
||||||
InnardsElement::render(OUT);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Str::eq_wide_string(elt, L"Vb")) {
|
|
||||||
VerbsElement::render(OUT);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Str::eq_wide_string(elt, L"Gz")) {
|
|
||||||
GazetteerElement::render(OUT);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Str::eq_wide_string(elt, L"Lx")) {
|
|
||||||
LexiconElement::render(OUT);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CORE_MODULE
|
#ifdef CORE_MODULE
|
||||||
if (Str::eq_wide_string(elt, L"Pl")) {
|
if (Str::eq_wide_string(elt, L"Pl")) {
|
||||||
IXScenes::render(OUT);
|
IXScenes::render(OUT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Str::eq_wide_string(elt, L"Ar")) {
|
|
||||||
IXArithmetic::render(OUT);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Str::eq_wide_string(elt, L"Mp")) {
|
if (Str::eq_wide_string(elt, L"Mp")) {
|
||||||
IXPhysicalWorld::render(OUT);
|
IXPhysicalWorld::render(OUT);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -80,3 +80,4 @@ Chapter 6: Index
|
||||||
Verbs Element
|
Verbs Element
|
||||||
Gazetteer Element
|
Gazetteer Element
|
||||||
Lexicon Element
|
Lexicon Element
|
||||||
|
Arithmetic Element
|
||||||
|
|
Loading…
Reference in a new issue