1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-07-09 02:24:21 +03:00
inform7/inter/index-module/Chapter 3/Arithmetic Element.w

119 lines
4.1 KiB
OpenEdge ABL
Raw Normal View History

2021-06-12 18:30:21 +03:00
[ArithmeticElement::] Arithmetic Element.
2021-06-27 18:10:51 +03:00
To write the Arithmetic element (Ar) in the index.
2021-06-12 18:30:21 +03:00
@ These were really indexed for us in metadata generated by the main compiler;
so we do little more than tabulate that data here.
=
2021-07-26 15:48:49 +03:00
void ArithmeticElement::render(OUTPUT_STREAM, index_session *session) {
localisation_dictionary *LD = Indexing::get_localisation(session);
tree_inventory *inv = Indexing::get_inventory(session);
2022-02-03 01:35:38 +02:00
InterNodeList::array_sort(inv->kind_nodes, MakeSynopticModuleStage::module_order);
InterNodeList::array_sort(inv->multiplication_rule_nodes, MakeSynopticModuleStage::module_order);
2021-06-12 18:30:21 +03:00
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("&nbsp;");
2021-07-26 02:34:51 +03:00
Localisation::roman(OUT, LD, I"Index.Elements.Ar.Calculator");
2021-06-12 18:30:21 +03:00
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);
2021-07-24 01:32:44 +03:00
ArithmeticElement::column(OUT, I"KindColumn", LD);
2021-06-12 18:30:21 +03:00
HTML::next_html_column(OUT, 0);
2021-07-24 01:32:44 +03:00
ArithmeticElement::column(OUT, I"MinimumColumn", LD);
2021-06-12 18:30:21 +03:00
HTML::next_html_column(OUT, 0);
2021-07-24 01:32:44 +03:00
ArithmeticElement::column(OUT, I"MaximumColumn", LD);
2021-06-12 18:30:21 +03:00
HTML::next_html_column(OUT, 0);
2021-07-24 01:32:44 +03:00
ArithmeticElement::column(OUT, I"DimensionsdColumn", LD);
2021-06-12 18:30:21 +03:00
HTML::end_html_row(OUT);
2021-07-25 00:04:35 +03:00
inter_package *pack;
LOOP_OVER_INVENTORY_PACKAGES(pack, i, inv->kind_nodes)
if (Str::len(Metadata::optional_textual(pack, I"^min_value")) > 0) {
2021-06-12 18:30:21 +03:00
HTML::first_html_column(OUT, 0);
WRITE("%S", Metadata::optional_textual(pack, I"^printed_name"));
2021-06-12 18:30:21 +03:00
HTML::next_html_column(OUT, 0);
WRITE("%S", Metadata::optional_textual(pack, I"^min_value"));
2021-06-12 18:30:21 +03:00
HTML::next_html_column(OUT, 0);
WRITE("%S", Metadata::optional_textual(pack, I"^max_value"));
2021-06-12 18:30:21 +03:00
HTML::next_html_column(OUT, 0);
2021-07-22 01:21:56 +03:00
@<Dimensions column@>;
2021-06-12 18:30:21 +03:00
HTML::end_html_row(OUT);
}
HTML::end_html_table(OUT);
HTML_CLOSE("p");
2021-07-22 01:21:56 +03:00
@<Dimensions column@> =
text_stream *dims = Metadata::optional_textual(pack, I"^dimensions");
2021-07-22 01:21:56 +03:00
if (Str::len(dims) > 0) {
WRITE("%S", dims);
} else {
2021-07-26 02:34:51 +03:00
Localisation::italic(OUT, LD, I"Index.Elements.Ar.Dimensionless");
2021-07-22 01:21:56 +03:00
}
2021-06-12 18:30:21 +03:00
@ 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@> =
2022-02-03 01:35:38 +02:00
if (InterNodeList::array_len(inv->multiplication_rule_nodes) > 0) {
2021-06-12 18:30:21 +03:00
HTML_OPEN("p");
WRITE("This is how multiplication changes kinds:");
HTML_CLOSE("p");
HTML_OPEN("p");
HTML::begin_plain_html_table(OUT);
2021-07-25 00:04:35 +03:00
inter_package *pack;
LOOP_OVER_INVENTORY_PACKAGES(pack, i, inv->multiplication_rule_nodes) {
2021-06-12 18:30:21 +03:00
HTML::first_html_column(OUT, 0);
2021-07-24 20:16:56 +03:00
IndexUtilities::link_package(OUT, pack);
2021-06-12 18:30:21 +03:00
HTML::next_html_column(OUT, 0);
WRITE("%S", Metadata::optional_textual(pack, I"^left_operand"));
2021-06-12 18:30:21 +03:00
HTML::begin_colour(OUT, I"808080");
WRITE(" x ");
HTML::end_colour(OUT);
WRITE("%S", Metadata::optional_textual(pack, I"^right_operand"));
2021-06-12 18:30:21 +03:00
HTML::begin_colour(OUT, I"808080");
WRITE(" = ");
HTML::end_colour(OUT);
WRITE("%S", Metadata::optional_textual(pack, I"^result"));
2021-06-12 18:30:21 +03:00
WRITE("&nbsp;&nbsp;&nbsp;&nbsp;");
HTML::next_html_column(OUT, 0);
WRITE("%S", Metadata::optional_textual(pack, I"^left_operand_benchmark"));
2021-06-12 18:30:21 +03:00
HTML::begin_colour(OUT, I"808080");
WRITE(" x ");
HTML::end_colour(OUT);
WRITE("%S", Metadata::optional_textual(pack, I"^right_operand_benchmark"));
2021-06-12 18:30:21 +03:00
HTML::begin_colour(OUT, I"808080");
WRITE(" = ");
HTML::end_colour(OUT);
WRITE("%S", Metadata::optional_textual(pack, I"^result_benchmark"));
2021-06-12 18:30:21 +03:00
HTML::end_html_row(OUT);
}
HTML::end_html_table(OUT);
HTML_CLOSE("p");
}
2021-07-24 01:32:44 +03:00
@ =
void ArithmeticElement::column(OUTPUT_STREAM, text_stream *key, localisation_dictionary *LD) {
TEMPORARY_TEXT(full)
WRITE_TO(full, "Index.Elements.Ar.%S", key);
2021-07-26 02:34:51 +03:00
Localisation::bold(OUT, LD, full);
2021-07-25 17:11:01 +03:00
WRITE(" ");
2021-07-24 01:32:44 +03:00
DISCARD_TEXT(full)
}