From 8af471fab51e891180d18edd4b50ec52fe54970c Mon Sep 17 00:00:00 2001 From: Graham Nelson Date: Sun, 25 Jul 2021 15:11:01 +0100 Subject: [PATCH] More and more localisation --- README.md | 2 +- build.txt | 4 +- docs/bytecode-module/2-tll.html | 3 +- docs/index-module/2-ii.html | 8 +- docs/index-module/2-ir.html | 2 +- docs/index-module/2-iu.html | 12 +- docs/index-module/2-lcl.html | 83 ++- docs/index-module/3-ae.html | 8 +- docs/index-module/3-ae2.html | 9 +- docs/index-module/3-be.html | 5 +- docs/index-module/3-ce2.html | 12 +- docs/index-module/3-ce3.html | 31 +- docs/index-module/3-ce4.html | 6 +- docs/index-module/3-ee.html | 12 +- docs/index-module/3-ee2.html | 10 +- docs/index-module/3-fe.html | 473 +++++++++++------- docs/index-module/3-ge2.html | 181 ++++--- docs/index-module/3-ie.html | 121 +++-- docs/index-module/3-le.html | 8 +- docs/index-module/3-me.html | 3 +- inform7/Figures/memory-diagnostics.txt | 14 +- inform7/Figures/timings-diagnostics.txt | 28 +- inform7/Internal/Languages/English/Index.txt | 83 ++- .../Chapter 2/Tree Location Lists.w | 3 +- inter/index-module/Chapter 2/Localisation.w | 73 +++ .../Chapter 3/Alphabetic Element.w | 8 +- .../Chapter 3/Arithmetic Element.w | 9 +- .../Chapter 3/Behaviour Element.w | 5 +- inter/index-module/Chapter 3/Chart Element.w | 12 +- .../index-module/Chapter 3/Commands Element.w | 29 +- .../index-module/Chapter 3/Contents Element.w | 6 +- inter/index-module/Chapter 3/Events Element.w | 12 +- inter/index-module/Chapter 3/Extras Element.w | 9 +- .../index-module/Chapter 3/Figures Element.w | 433 +++++++++------- .../index-module/Chapter 3/Grouped Element.w | 145 +++--- .../index-module/Chapter 3/Innards Element.w | 111 ++-- .../index-module/Chapter 3/Lexicon Element.w | 8 +- inter/index-module/Chapter 3/Map Element.w | 3 +- 38 files changed, 1215 insertions(+), 769 deletions(-) diff --git a/README.md b/README.md index 7148d5f86..7d7e7c0c7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Inform 7 -v10.1.0-alpha.1+6S79 'Krypton' (24 July 2021) +v10.1.0-alpha.1+6S80 'Krypton' (25 July 2021) ## About Inform 7 diff --git a/build.txt b/build.txt index 179e8e79b..4d84d069e 100644 --- a/build.txt +++ b/build.txt @@ -1,3 +1,3 @@ Prerelease: alpha.1 -Build Date: 24 July 2021 -Build Number: 6S79 +Build Date: 25 July 2021 +Build Number: 6S80 diff --git a/docs/bytecode-module/2-tll.html b/docs/bytecode-module/2-tll.html index ad617f722..e5dc82def 100644 --- a/docs/bytecode-module/2-tll.html +++ b/docs/bytecode-module/2-tll.html @@ -132,7 +132,8 @@ sorted by index. void TreeLists::sort(inter_tree_location_list *NL, int (*cmp)(const void *, const void *)) { if (NL == NULL) internal_error("null inter_tree_location_list"); - qsort(NL->list, (size_t) NL->list_used, sizeof(itl_entry), cmp); + if (NL->list_used > 0) + qsort(NL->list, (size_t) NL->list_used, sizeof(itl_entry), cmp); }

§3. And this macro conveniently loops through packages in a node list of their diff --git a/docs/index-module/2-ii.html b/docs/index-module/2-ii.html index 46e2a957b..55ec5e449 100644 --- a/docs/index-module/2-ii.html +++ b/docs/index-module/2-ii.html @@ -234,7 +234,7 @@ will be Kinds.html DISCARD_TEXT(key) DISCARD_TEXT(leafname) } - GroupedElement::detail_pages(D); + GroupedElement::detail_pages(D);

§3. This is a one-off function for generating the content of an index element @@ -321,7 +321,7 @@ of the Inter tree currently being indexed. void InterpretIndex::set_tree(inter_tree *I) { indexing_tree = I; } -inter_tree *InterpretIndex::get_tree(void) { +inter_tree *InterpretIndex::get_tree(void) { if (indexing_tree == NULL) internal_error("no indexing tree"); return indexing_tree; } @@ -354,7 +354,7 @@ of the Inter tree currently being indexed.

 text_stream index_file_struct;  The current index file being written
-text_stream *InterpretIndex::open_file(index_page *page, text_stream *index_leaf,
+text_stream *InterpretIndex::open_file(index_page *page, text_stream *index_leaf,
     text_stream *title, int sub, localisation_dictionary *D) {
     filename *F = IndexLocations::filename(index_leaf, sub);
     if (STREAM_OPEN_TO_FILE(&index_file_struct, F, UTF8_ENC) == FALSE) {
@@ -376,7 +376,7 @@ of the Inter tree currently being indexed.
 

§10.

-void InterpretIndex::close_index_file(text_stream *ifl) {
+void InterpretIndex::close_index_file(text_stream *ifl) {
     HTML::footer(ifl);
     STREAM_CLOSE(ifl);
     InterpretIndex::set_page(NULL);
diff --git a/docs/index-module/2-ir.html b/docs/index-module/2-ir.html
index 8f187738e..f0733a954 100644
--- a/docs/index-module/2-ir.html
+++ b/docs/index-module/2-ir.html
@@ -325,7 +325,7 @@ switched off:
 

-int IndexRules::index_action_rules(OUTPUT_STREAM, tree_inventory *inv, inter_package *an,
+int IndexRules::index_action_rules(OUTPUT_STREAM, tree_inventory *inv, inter_package *an,
     inter_package *rb, text_stream *key, text_stream *desc, localisation_dictionary *LD) {
     int resp_count = 0;
     IndexRules::list_suppress_indexed_links();
diff --git a/docs/index-module/2-iu.html b/docs/index-module/2-iu.html
index 1f231efc6..7cee600dc 100644
--- a/docs/index-module/2-iu.html
+++ b/docs/index-module/2-iu.html
@@ -84,7 +84,7 @@ on typical browser views embedded in apps on Windows, MacOS and Linux.)
 

-void IndexUtilities::banner_line(OUTPUT_STREAM, index_page *page, int N, text_stream *sym,
+void IndexUtilities::banner_line(OUTPUT_STREAM, index_page *page, int N, text_stream *sym,
     text_stream *name, text_stream *exp, char *link, localisation_dictionary *D) {
     HTML_OPEN_WITH("table", "cellspacing=\"3\" border=\"0\" style=\"background:#eeeeee;\"");
     HTML_OPEN("tr");
@@ -146,11 +146,11 @@ the source text in the application.
 

-void IndexUtilities::link(OUTPUT_STREAM, int wn) {
+void IndexUtilities::link(OUTPUT_STREAM, int wn) {
     IndexUtilities::link_to_location(OUT, Lexer::word_location(wn), TRUE);
 }
 
-void IndexUtilities::link_package(OUTPUT_STREAM, inter_package *pack) {
+void IndexUtilities::link_package(OUTPUT_STREAM, inter_package *pack) {
     int at = (int) Metadata::read_optional_numeric(pack, I"^at");
     if (at > 0) IndexUtilities::link(OUT, at);
 }
@@ -185,7 +185,7 @@ system set up in Documentat
 

-void IndexUtilities::link_to_documentation(OUTPUT_STREAM, inter_package *pack) {
+void IndexUtilities::link_to_documentation(OUTPUT_STREAM, inter_package *pack) {
     text_stream *doc = Metadata::read_optional_textual(pack, I"^documentation");
     if (Str::len(doc) > 0) IndexUtilities::DocReferences::link(OUT, doc);
 }
@@ -196,7 +196,7 @@ page about the taking action.
 

-void IndexUtilities::detail_link(OUTPUT_STREAM, char *stub, int sub, int down) {
+void IndexUtilities::detail_link(OUTPUT_STREAM, char *stub, int sub, int down) {
     WRITE(" ");
     HTML_OPEN_WITH("a", "href=%s%d_%s.html", (down)?"Details/":"", sub, stub);
     HTML_TAG_WITH("img", "border=0 src=inform:/doc_images/Beneath.png");
@@ -242,7 +242,7 @@ code.
     WRITE(" ");
 }
 
-void IndexUtilities::extra_all_link_with(OUTPUT_STREAM, int nr, char *icon) {
+void IndexUtilities::extra_all_link_with(OUTPUT_STREAM, int nr, char *icon) {
     HTML_OPEN_WITH("a", "href=\"#\" onclick=\"showAllResp(%d); return false;\"", nr);
     HTML_TAG_WITH("img", "border=0 src=inform:/doc_images/%s.png", icon);
     HTML_CLOSE("a");
diff --git a/docs/index-module/2-lcl.html b/docs/index-module/2-lcl.html
index 93bb037e0..5c088e63d 100644
--- a/docs/index-module/2-lcl.html
+++ b/docs/index-module/2-lcl.html
@@ -292,13 +292,25 @@ with everything under the first line being italicised. For example:
 

-void Localisation::write_0(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key) {
+void Localisation::bold_0(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key) {
+    WRITE("<b>");
+    Localisation::write_0(OUT, D, key);
+    WRITE("</b>");
+}
+
+void Localisation::italic_0(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key) {
+    WRITE("<i>");
+    Localisation::write_0(OUT, D, key);
+    WRITE("</i>");
+}
+
+void Localisation::write_0(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key) {
     text_stream *vals[10];
     Vacate the vals5.1;
     Localisation::write_general(OUT, D, key, vals);
 }
 
-void Localisation::write_1(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
+void Localisation::write_1(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
     text_stream *val1) {
     text_stream *vals[10];
     Vacate the vals5.1;
@@ -306,13 +318,74 @@ with everything under the first line being italicised. For example:
     Localisation::write_general(OUT, D, key, vals);
 }
 
-void Localisation::write_2(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
+void Localisation::write_1n(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
+    int val1) {
+    text_stream *vals[10];
+    Vacate the vals5.1;
+    TEMPORARY_TEXT(f1)
+    WRITE_TO(f1, "%d", val1);
+    vals[1] = f1;
+    Localisation::write_general(OUT, D, key, vals);
+    DISCARD_TEXT(f1)
+}
+
+void Localisation::write_2(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
     text_stream *val1, text_stream *val2) {
     text_stream *vals[10];
     Vacate the vals5.1;
     vals[1] = val1; vals[2] = val2;
     Localisation::write_general(OUT, D, key, vals);
 }
+
+void Localisation::write_2n(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
+    int val1, int val2) {
+    text_stream *vals[10];
+    Vacate the vals5.1;
+    TEMPORARY_TEXT(f1)
+    TEMPORARY_TEXT(f2)
+    WRITE_TO(f1, "%d", val1);
+    WRITE_TO(f2, "%d", val2);
+    vals[1] = f1; vals[2] = f2;
+    Localisation::write_general(OUT, D, key, vals);
+    DISCARD_TEXT(f1)
+    DISCARD_TEXT(f2)
+}
+
+void Localisation::write_2sn(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
+    text_stream *val1, int val2) {
+    text_stream *vals[10];
+    Vacate the vals5.1;
+    TEMPORARY_TEXT(f2)
+    WRITE_TO(f2, "%d", val2);
+    vals[1] = val1; vals[2] = f2;
+    Localisation::write_general(OUT, D, key, vals);
+    DISCARD_TEXT(f2)
+}
+
+void Localisation::write_2ns(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
+    int val1, text_stream *val2) {
+    text_stream *vals[10];
+    Vacate the vals5.1;
+    TEMPORARY_TEXT(f1)
+    WRITE_TO(f1, "%d", val1);
+    vals[1] = f1; vals[2] = val2;
+    Localisation::write_general(OUT, D, key, vals);
+    DISCARD_TEXT(f1)
+}
+
+void Localisation::write_3nsn(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
+    int val1, text_stream *val2, int val3) {
+    text_stream *vals[10];
+    Vacate the vals5.1;
+    TEMPORARY_TEXT(f1)
+    TEMPORARY_TEXT(f3)
+    WRITE_TO(f1, "%d", val1);
+    WRITE_TO(f3, "%d", val3);
+    vals[1] = f1; vals[2] = val2; vals[3] = f3;
+    Localisation::write_general(OUT, D, key, vals);
+    DISCARD_TEXT(f1)
+    DISCARD_TEXT(f3)
+}
 

§5.1. Vacate the vals5.1 =

@@ -320,11 +393,11 @@ with everything under the first line being italicised. For example:
     for (int i=0; i<10; i++) vals[i] = NULL;
 
-
  • This code is used in §5 (three times).
+
  • This code is used in §5 (8 times).

§6.

-void Localisation::write_general(OUTPUT_STREAM, localisation_dictionary *D,
+void Localisation::write_general(OUTPUT_STREAM, localisation_dictionary *D,
     text_stream *key, text_stream **vals) {
     text_stream *prototype = Localisation::read(D, key);
     int italics_open = FALSE;
diff --git a/docs/index-module/3-ae.html b/docs/index-module/3-ae.html
index 66fca0723..6fe635d1e 100644
--- a/docs/index-module/3-ae.html
+++ b/docs/index-module/3-ae.html
@@ -158,9 +158,7 @@ function togglePopup(material_id) {
 void AlphabeticElement::column(OUTPUT_STREAM, text_stream *key, localisation_dictionary *LD) {
     TEMPORARY_TEXT(full)
     WRITE_TO(full, "Index.Elements.A2.%S", key);
-    WRITE("<b>");
-    Localisation::write_0(OUT, LD, full);
-    WRITE("</b> ");
+    Localisation::bold_0(OUT, LD, full);
     DISCARD_TEXT(full)
 }
 
@@ -170,9 +168,7 @@ function togglePopup(material_id) { void AlphabeticElement::note(OUTPUT_STREAM, text_stream *key, localisation_dictionary *LD) { TEMPORARY_TEXT(full) WRITE_TO(full, "Index.Elements.A2.%S", key); - WRITE("<i>"); - Localisation::write_0(OUT, LD, full); - WRITE("</i> "); + Localisation::italic_0(OUT, LD, full); DISCARD_TEXT(full) }
diff --git a/docs/index-module/3-ae2.html b/docs/index-module/3-ae2.html index a83b8f9b9..57ddcb6e9 100644 --- a/docs/index-module/3-ae2.html +++ b/docs/index-module/3-ae2.html @@ -146,9 +146,7 @@ so we do little more than tabulate that data here. if (Str::len(dims) > 0) { WRITE("%S", dims); } else { - WRITE("<i>"); - Localisation::write_0(OUT, LD, I"Index.Elements.Ar.Dimensionless"); - WRITE("</i>"); + Localisation::italic_0(OUT, LD, I"Index.Elements.Ar.Dimensionless"); }
  • This code is used in §1.2.
@@ -204,9 +202,8 @@ text, sorted into kind order of left and then right operand. void ArithmeticElement::column(OUTPUT_STREAM, text_stream *key, localisation_dictionary *LD) { TEMPORARY_TEXT(full) WRITE_TO(full, "Index.Elements.Ar.%S", key); - WRITE("<b>"); - Localisation::write_0(OUT, LD, full); - WRITE("</b> "); + Localisation::bold_0(OUT, LD, full); + WRITE(" "); DISCARD_TEXT(full) }
diff --git a/docs/index-module/3-be.html b/docs/index-module/3-be.html index d971ff081..d957e5ad5 100644 --- a/docs/index-module/3-be.html +++ b/docs/index-module/3-be.html @@ -94,9 +94,8 @@ function togglePopup(material_id) { HTML_OPEN("p"); WRITE("<b>%S</b>", name); IndexUtilities::link_package(OUT, pack); HTML_TAG("br"); - WRITE("&nbsp;&nbsp;<i>"); - Localisation::write_0(OUT, LD, I"Index.Elements.Bh.Defined"); - WRITE(":</i>\n"); + WRITE("&nbsp;&nbsp;"); + Localisation::italic_0(OUT, LD, I"Index.Elements.Bh.Defined"); inter_tree_node *D = Inter::Packages::definition(pack); LOOP_THROUGH_INTER_CHILDREN(C, D) { if (C->W.data[ID_IFLD] == PACKAGE_IST) { diff --git a/docs/index-module/3-ce2.html b/docs/index-module/3-ce2.html index cd9df5cbc..fe9e5163b 100644 --- a/docs/index-module/3-ce2.html +++ b/docs/index-module/3-ce2.html @@ -261,9 +261,9 @@ or as paragraph of text in pass 2: HTML::open_indented_p(OUT, 1, "halftight"); IndexUtilities::anchor_numbered(OUT, i); ...the anchor to which the grey icon in the table led WRITE("<b>"); IndexUtilities::kind_name(OUT, pack, FALSE, TRUE); WRITE("</b>"); - WRITE(" (<i>"); - Localisation::write_0(OUT, D, I"Index.Elements.Ch.Plural"); - WRITE("</i> "); + WRITE(" ("); + Localisation::italic_0(OUT, D, I"Index.Elements.Ch.Plural"); + WRITE(" "); IndexUtilities::kind_name(OUT, pack, TRUE, FALSE); WRITE(")"); IndexUtilities::link_to_documentation(OUT, pack); HTML_CLOSE("p"); @@ -498,9 +498,9 @@ whole row. IndexUtilities::kind_name(OUT, pack, FALSE, FALSE); if (pass == 2) WRITE("</b>"); if (pass == 2) { - WRITE(" (<i>"); - Localisation::write_0(OUT, D, I"Index.Elements.Ch.Plural"); - WRITE("</i> "); + WRITE(" ("); + Localisation::italic_0(OUT, D, I"Index.Elements.Ch.Plural"); + WRITE(" "); IndexUtilities::kind_name(OUT, pack, TRUE, FALSE); WRITE(")"); } diff --git a/docs/index-module/3-ce3.html b/docs/index-module/3-ce3.html index 75a651a47..b6c3dc1e6 100644 --- a/docs/index-module/3-ce3.html +++ b/docs/index-module/3-ce3.html @@ -218,24 +218,21 @@ as follows: break; case OUT_OF_WORLD_COMMAND: HTML::begin_colour(OUT, I"800000"); - WRITE("&quot;%S&quot;, <i>", cie->command_headword); - Localisation::write_0(OUT, LD, I"Index.Elements.Cm.Command"); - WRITE("</i>"); + WRITE("&quot;%S&quot;, ", cie->command_headword); + Localisation::italic_0(OUT, LD, I"Index.Elements.Cm.Command"); HTML::end_colour(OUT); HTML_TAG("br"); break; case TESTING_COMMAND: HTML::begin_colour(OUT, I"800000"); - WRITE("&quot;%S&quot;, <i>", cie->command_headword); - Localisation::write_0(OUT, LD, I"Index.Elements.Cm.TestingCommand"); - WRITE("</i>"); + WRITE("&quot;%S&quot;, ", cie->command_headword); + Localisation::italic_0(OUT, LD, I"Index.Elements.Cm.TestingCommand"); HTML::end_colour(OUT); HTML_TAG("br"); break; case BARE_DIRECTION_COMMAND: - WRITE("&quot;[direction]&quot; - <i>"); - Localisation::write_0(OUT, LD, I"Index.Elements.Cm.DirectionCommand"); - WRITE("</i>"); + WRITE("&quot;[direction]&quot; - "); + Localisation::italic_0(OUT, LD, I"Index.Elements.Cm.DirectionCommand"); HTML_TAG("br"); break; } @@ -253,14 +250,14 @@ as follows: void CommandsElement::index_alias(OUTPUT_STREAM, inter_tree *I, inter_package *cg_pack, text_stream *headword, localisation_dictionary *LD) { - WRITE("&quot;%S&quot;, <i>", headword); - Localisation::write_0(OUT, LD, I"Index.Elements.Cm.Alias"); - WRITE("</i> &quot;%S&quot;", Metadata::read_textual(cg_pack, I"^command")); + WRITE("&quot;%S&quot;, ", headword); + Localisation::italic_0(OUT, LD, I"Index.Elements.Cm.Alias"); + WRITE(" &quot;%S&quot;", Metadata::read_textual(cg_pack, I"^command")); IndexUtilities::link_package(OUT, cg_pack); HTML_TAG("br"); } -void CommandsElement::index_grammar_line(OUTPUT_STREAM, inter_package *cgl, +void CommandsElement::index_grammar_line(OUTPUT_STREAM, inter_package *cgl, text_stream *headword, localisation_dictionary *LD) { inter_symbol *an_s = Metadata::read_optional_symbol(cgl, I"^action"); if (an_s == NULL) return; @@ -274,15 +271,13 @@ as follows: WRITE("&quot;"); IndexUtilities::link_package(OUT, cgl); - WRITE(" - <i>%S", Metadata::read_textual(an, I"^name")); + WRITE(" - <i>%S</i>", Metadata::read_textual(an, I"^name")); IndexUtilities::detail_link(OUT, "A", (int) Metadata::read_numeric(an, I"action_id"), TRUE); if (Metadata::read_optional_numeric(cgl, I"^reversed")) { - WRITE(" <i>"); - Localisation::write_0(OUT, LD, I"Index.Elements.Cm.Reversed"); - WRITE("</i>"); + WRITE(" "); + Localisation::italic_0(OUT, LD, I"Index.Elements.Cm.Reversed"); } - WRITE("</i>"); if (oow) HTML::end_colour(OUT); HTML_TAG("br"); } diff --git a/docs/index-module/3-ce4.html b/docs/index-module/3-ce4.html index 417a1d892..309d2d1c9 100644 --- a/docs/index-module/3-ce4.html +++ b/docs/index-module/3-ce4.html @@ -267,10 +267,8 @@ function togglePopup(material_id) {
 void ContentsElement::word_count(OUTPUT_STREAM, inter_package *pack,
     localisation_dictionary *LD) {
-    TEMPORARY_TEXT(words)
-    WRITE_TO(words, "%d", Metadata::read_numeric(pack, I"^word_count"));
-    Localisation::write_1(OUT, LD, I"Index.Elements.C.Words", words);
-    DISCARD_TEXT(words)
+    Localisation::write_1n(OUT, LD, I"Index.Elements.C.Words",
+        (int) Metadata::read_numeric(pack, I"^word_count"));
 }
 
@@ -99,14 +101,16 @@ function togglePopup(material_id) { (Metadata::exists(pack, I"^timed_for") == FALSE)) { if (when_count == 0) { HTML_OPEN("p"); - WRITE("<i>Events with no specific time</i>"); + Localisation::italic_0(OUT, LD, I"Index.Elements.Ev.Timeless"); HTML_CLOSE("p"); } when_count++; HTML_OPEN_WITH("p", "class=\"tightin2\""); WRITE("%S", Metadata::read_textual(pack, I"^preamble")); IndexUtilities::link_package(OUT, pack); - WRITE(" (where triggered: "); + WRITE(" ("); + Localisation::write_0(OUT, LD, I"Index.Elements.Ev.WhereTriggered"); + WRITE(": "); inter_package *entry; LOOP_THROUGH_SUBPACKAGES(entry, pack, I"_timed_rule_trigger") { int at = (int) Metadata::read_optional_numeric(entry, I"^used_at"); @@ -127,7 +131,7 @@ function togglePopup(material_id) { (Metadata::exists(pack, I"^timed_for"))) { if (tt_count == 0) { HTML_OPEN("p"); - WRITE("<i>Timetable</i>"); + Localisation::italic_0(OUT, LD, I"Index.Elements.Ev.Timetable"); HTML_CLOSE("p"); } tt_count++; diff --git a/docs/index-module/3-ee2.html b/docs/index-module/3-ee2.html index 090533a2c..7405d930e 100644 --- a/docs/index-module/3-ee2.html +++ b/docs/index-module/3-ee2.html @@ -72,7 +72,9 @@ function togglePopup(material_id) {

To write the Extras element (Xt) in the index.

-

§1.

+

§1. This is to sweep up rulebooks and activities not covered by other elements, +really, and most of the code here is just to arrange them in some logical order. +

 void ExtrasElement::render(OUTPUT_STREAM, localisation_dictionary *LD) {
@@ -118,12 +120,14 @@ function togglePopup(material_id) {
 
 
     HTML_OPEN("p");
+    WRITE("<b>");
     if (Metadata::read_optional_numeric(E, I"^category") == 1) {
-        WRITE("<b>From the source text</b>");
+        Localisation::write_0(OUT, LD, I"Index.Elements.Xt.FromSourceText");
     } else {
-        WRITE("<b>From the extension %S</b>",
+        Localisation::write_1(OUT, LD, I"Index.Elements.Xt.FromExtension",
             Metadata::read_optional_textual(E, I"^credit"));
     }
+    WRITE("</b>");
     HTML_CLOSE("p");
 
  • This code is used in §1.1 (twice).
diff --git a/docs/index-module/3-fe.html b/docs/index-module/3-fe.html index bd5b42d30..c60cb8222 100644 --- a/docs/index-module/3-fe.html +++ b/docs/index-module/3-fe.html @@ -72,62 +72,53 @@ function togglePopup(material_id) {

To write the Figures element (Fi) in the index.

-
+
-

§1. This also includes sounds and external files, a little questionably. +

§1. Not only figures but also sounds and external files, a little questionably.

 void FiguresElement::render(OUTPUT_STREAM, localisation_dictionary *LD) {
     inter_tree *I = InterpretIndex::get_tree();
     tree_inventory *inv = Synoptic::inv(I);
-    if (TreeLists::len(inv->figure_nodes) > 0) {
-        TreeLists::sort(inv->figure_nodes, Synoptic::module_order);
-    }
-    if (TreeLists::len(inv->sound_nodes) > 0) {
-        TreeLists::sort(inv->sound_nodes, Synoptic::module_order);
-    }
-    if (TreeLists::len(inv->file_nodes) > 0) {
-        TreeLists::sort(inv->file_nodes, Synoptic::module_order);
-    }
-    if (TreeLists::len(inv->figure_nodes) < 2) {  cover art always creates 1
-        HTML_OPEN("p");
-        WRITE("There are no figures, or illustrations, in this project.");
-        HTML_CLOSE("p");
-    } else {
-        Index the figures1.1;
-    }
-    if (TreeLists::len(inv->sound_nodes) == 0) {
-        HTML_OPEN("p");
-        WRITE("There are no sound effects in this project.");
-        HTML_CLOSE("p");
-    } else {
-        Index the sounds1.2;
-    }
-    if (TreeLists::len(inv->file_nodes) == 0) {
-        HTML_OPEN("p");
-        WRITE("This project doesn't read or write external files.");
-        HTML_CLOSE("p");
-    } else {
-        Index the files1.3;
-    }
+    TreeLists::sort(inv->figure_nodes, Synoptic::module_order);
+    TreeLists::sort(inv->sound_nodes, Synoptic::module_order);
+    TreeLists::sort(inv->file_nodes, Synoptic::module_order);
+    Index the figures1.1;
+    Index the sounds1.2;
+    Index the files1.3;
 }
 
-

§1.1. The index is presented with thumbnails of a given pixel width, which +

§1.1. Figures. Index the figures1.1 = +

+ +
+    if (TreeLists::len(inv->figure_nodes) <= 1) {  cover art always creates 1
+        HTML_OPEN("p");
+        Localisation::write_0(OUT, LD, I"Index.Elements.Fi.NoFigures");
+        HTML_CLOSE("p");
+    } else {
+        HTML_OPEN("p");
+        Localisation::bold_0(OUT, LD, I"Index.Elements.Fi.ListOfFigures");
+        HTML_CLOSE("p");
+        Tabulate the figures1.1.1;
+    }
+
+
  • This code is used in §1.
+

§1.1.1. The table is presented with thumbnails of a given pixel width, which the HTML renderer automatically scales to fit. Height is adjusted so as to match this width, preserving the aspect ratio.

define THUMBNAIL_WIDTH 80
 
-

Index the figures1.1 = +

Tabulate the figures1.1.1 =

     inter_package *settings = Inter::Packages::by_url(I, I"/main/completion/basics");
     int MAX_INDEXED_FIGURES =
         (int) Metadata::read_optional_numeric(settings, I"^max_indexed_figures");
-    HTML_OPEN("p"); WRITE("<b>List of Figures</b>"); HTML_CLOSE("p");
     HTML::begin_html_table(OUT, "#ffffff", TRUE, 0, 0, 0, 0, 0);
     int count_of_displayed_figures = 0;
     inter_package *pack;
@@ -136,78 +127,110 @@ to match this width, preserving the aspect ratio.
         if (id > 1) {
             text_stream *filename_as_text = Metadata::read_textual(pack, I"^filename");
             filename *F = Filenames::from_text(filename_as_text);
-            TEMPORARY_TEXT(line2)
+            TEMPORARY_TEXT(description)
             unsigned int width = 0, height = 0;
-            int rv = 0;
-            FILE *FIGURE_FILE = Filenames::fopen(F, "rb");
-            if (FIGURE_FILE) {
-                char *real_format = "JPEG";
-                rv = ImageFiles::get_JPEG_dimensions(FIGURE_FILE, &width, &height);
-                fclose(FIGURE_FILE);
-                if (rv == 0) {
-                    FIGURE_FILE = Filenames::fopen(F, "rb");
-                    if (FIGURE_FILE) {
-                        real_format = "PNG";
-                        rv = ImageFiles::get_PNG_dimensions(FIGURE_FILE, &width, &height);
-                        fclose(FIGURE_FILE);
-                    }
-                }
-                if (rv == 0) {
-                    WRITE_TO(line2, "<i>Unknown image format</i>");
-                } else {
-                    WRITE_TO(line2, "%s format: %d (width) by %d (height) pixels",
-                        real_format, width, height);
-                }
-            } else {
-                WRITE_TO(line2, "<i>Missing from the Figures folder</i>");
-            }
-            HTML::first_html_column(OUT, THUMBNAIL_WIDTH+10);
-            if (rv == 0) {
-                HTML_TAG_WITH("img", "border=\"0\" src=\"inform:/doc_images/image_problem.png\"");
-                WRITE("&nbsp;");
-            } else if (count_of_displayed_figures++ < MAX_INDEXED_FIGURES) {
-                HTML_TAG_WITH("img", "border=\"1\" src=\"file:%f\" width=\"%d\" height=\"%d\"",
-                    F, THUMBNAIL_WIDTH, THUMBNAIL_WIDTH*height/width);
-                WRITE("&nbsp;");
-            } else {
-                HTML_OPEN_WITH("div", "style=\"width:%dpx; height:%dpx; border:1px solid; background-color:#6495ed;\"",
-                    THUMBNAIL_WIDTH, THUMBNAIL_WIDTH*height/width);
-                WRITE("&nbsp;");
-                HTML_CLOSE("div");
-            }
-
-            HTML::next_html_column(OUT, 0);
-            WRITE("%S", Metadata::read_textual(pack, I"^name"));
-            IndexUtilities::link_package(OUT, pack);
-
-            HTML_TAG("br");
-            if (Str::len(line2) > 0) {
-                WRITE("%S", line2);
-                HTML_TAG("br");
-            }
-            WRITE("Filename: \"%S\" - resource number %d", Filenames::get_leafname(F), id);
-            HTML::end_html_row(OUT);
-            DISCARD_TEXT(line2)
+            int format_found = 0;
+            Find image format and dimensions1.1.1.1;
+            Render a table row for the image1.1.1.2;
+            DISCARD_TEXT(description)
         }
     }
     HTML::end_html_table(OUT);
     if (count_of_displayed_figures > MAX_INDEXED_FIGURES) {
         HTML_OPEN("p");
-        WRITE("(Only the first %d thumbnails have been shown here, "
-            "to avoid Inform taking up too much memory. If you'd like to "
-            "see more, set 'Use index figure thumbnails of at least %d.', or "
-            "whatever number you want to wait for.)",
+        WRITE("(");
+        Localisation::write_2n(OUT, LD, I"Index.Elements.Fi.ThumbnailLimit",
             MAX_INDEXED_FIGURES, 10*MAX_INDEXED_FIGURES);
+        WRITE(")");
         HTML_CLOSE("p");
     }
 
-
  • This code is used in §1.
-

§1.2. Sounds Index. Index the sounds1.2 = +

  • This code is used in §1.1.
+

§1.1.1.1. Find image format and dimensions1.1.1.1 = +

+ +
+    FILE *FIGURE_FILE = Filenames::fopen(F, "rb");
+    if (FIGURE_FILE) {
+        text_stream *real_format = I"JPEG";
+        format_found = ImageFiles::get_JPEG_dimensions(FIGURE_FILE, &width, &height);
+        fclose(FIGURE_FILE);
+        if (format_found == 0) {
+            FIGURE_FILE = Filenames::fopen(F, "rb");
+            if (FIGURE_FILE) {
+                real_format = I"PNG";
+                format_found = ImageFiles::get_PNG_dimensions(FIGURE_FILE, &width, &height);
+                fclose(FIGURE_FILE);
+            }
+        }
+        if (format_found == 0) {
+            Localisation::italic_0(description, LD, I"Index.Elements.Fi.UnknownFormat");
+        } else {
+            Localisation::write_1(description, LD, I"Index.Elements.Fi.Format", real_format);
+            WRITE_TO(description, ": ");
+            Localisation::write_2n(description, LD, I"Index.Elements.Fi.Dimensions",
+                (int) width, (int) height);
+        }
+    } else {
+        Localisation::italic_0(description, LD, I"Index.Elements.Fi.Missing");
+    }
+
+ +

§1.1.1.2. Render a table row for the image1.1.1.2 = +

+ +
+    HTML::first_html_column(OUT, THUMBNAIL_WIDTH+10);
+    if (format_found == 0) {
+        HTML_TAG_WITH("img",
+            "border=\"0\" src=\"inform:/doc_images/image_problem.png\"");
+        WRITE("&nbsp;");
+    } else if (count_of_displayed_figures++ < MAX_INDEXED_FIGURES) {
+        HTML_TAG_WITH("img",
+            "border=\"1\" src=\"file:%f\" width=\"%d\" height=\"%d\"",
+            F, THUMBNAIL_WIDTH, THUMBNAIL_WIDTH*height/width);
+        WRITE("&nbsp;");
+    } else {
+        HTML_OPEN_WITH("div",
+            "style=\"width:%dpx; height:%dpx; border:1px solid; background-color:#6495ed;\"",
+            THUMBNAIL_WIDTH, THUMBNAIL_WIDTH*height/width);
+        WRITE("&nbsp;");
+        HTML_CLOSE("div");
+    }
+
+    HTML::next_html_column(OUT, 0);
+    WRITE("%S", Metadata::read_textual(pack, I"^name"));
+    IndexUtilities::link_package(OUT, pack);
+    HTML_TAG("br");
+    if (Str::len(description) > 0) {
+        WRITE("%S", description);
+        HTML_TAG("br");
+    }
+    Localisation::write_2sn(description, LD, I"Index.Elements.Fi.Resource",
+        Filenames::get_leafname(F), (int) id);
+    HTML::end_html_row(OUT);
+
+ +

§1.2. Sounds. Index the sounds1.2 = +

+ +
+    if (TreeLists::len(inv->sound_nodes) == 0) {
+        HTML_OPEN("p");
+        Localisation::bold_0(OUT, LD, I"Index.Elements.Fi.ListOfSounds");
+        HTML_CLOSE("p");
+        HTML_OPEN("p");
+        Localisation::write_0(OUT, LD, I"Index.Elements.Fi.NoSounds");
+        HTML_CLOSE("p");
+    } else {
+        Tabulate the sounds1.2.1;
+    }
+
+
  • This code is used in §1.
+

§1.2.1. Tabulate the sounds1.2.1 =

-    HTML_OPEN("p"); WRITE("<b>List of Sounds</b>"); HTML_CLOSE("p");
-    WRITE("\n");
     HTML::begin_html_table(OUT, "#ffffff", TRUE, 0, 0, 0, 0, 0);
     inter_package *pack;
     LOOP_OVER_INVENTORY_PACKAGES(pack, i, inv->sound_nodes) {
@@ -217,106 +240,167 @@ to match this width, preserving the aspect ratio.
         unsigned int duration, pBitsPerSecond, pChannels, pSampleRate, fsize,
             midi_version = 0, no_tracks = 0;
         int preview = TRUE, waveform_style = TRUE;
-        TEMPORARY_TEXT(line2)
-        int rv = 0;
-        FILE *SOUND_FILE = Filenames::fopen(F, "rb");
-        if (SOUND_FILE) {
-            char *real_format = "AIFF";
-            rv = SoundFiles::get_AIFF_duration(SOUND_FILE, &duration, &pBitsPerSecond,
-                &pChannels, &pSampleRate);
-            fseek(SOUND_FILE, 0, SEEK_END);
-            fsize = (unsigned int) (ftell(SOUND_FILE));
-            fclose(SOUND_FILE);
-            if (rv == 0) {
-                SOUND_FILE = Filenames::fopen(F, "rb");
-                if (SOUND_FILE) {
-                    real_format = "Ogg Vorbis";
-                    preview = FALSE;
-                    rv = SoundFiles::get_OggVorbis_duration(SOUND_FILE, &duration,
-                        &pBitsPerSecond, &pChannels, &pSampleRate);
-                    fclose(SOUND_FILE);
-                }
-            }
-            if (rv == 0) {
-                SOUND_FILE = Filenames::fopen(F, "rb");
-                if (SOUND_FILE) {
-                    waveform_style = FALSE;
-                    real_format = "MIDI";
-                    preview = TRUE;
-                    rv = SoundFiles::get_MIDI_information(SOUND_FILE,
-                        &midi_version, &no_tracks);
-                    fclose(SOUND_FILE);
-                }
-            }
-            if (rv == 0) {
-                WRITE_TO(line2, "<i>Unknown sound format</i>");
-            } else {
-                if (waveform_style == FALSE) {
-                    WRITE_TO(line2, "Type %d %s file with %d track%s",
-                        midi_version, real_format, no_tracks,
-                        (no_tracks == 1)?"":"s");
-                    HTML_TAG("br");
-                    WRITE("<i>Warning: not officially supported in glulx yet</i>");
-                } else {
-                    int min = (duration/6000), sec = (duration%6000)/100,
-                        centisec = (duration%100);
-                    WRITE_TO(line2, "%d.%01dKB %s file: duration ",
-                        fsize/1024, (fsize%1024)/102, real_format);
-                    if (min > 0)
-                        WRITE_TO(line2, "%d minutes ", min);
-                    if ((sec > 0) || (centisec > 0)) {
-                        if (centisec == 0)
-                            WRITE_TO(line2, "%d seconds", sec);
-                        else
-                            WRITE_TO(line2, "%d.%02d seconds", sec, centisec);
-                    } else WRITE_TO(line2, "exactly");
-                    WRITE_TO(line2, "Sampled as %d.%01dkHz %s (%d.%01d kilobits/sec)",
-                        pSampleRate/1000, (pSampleRate%1000)/100,
-                        (pChannels==1)?"Mono":"Stereo",
-                        pBitsPerSecond/1000, (pSampleRate%1000)/100);
-                }
-            }
-        } else {
-            WRITE_TO(line2, "<i>Missing from the Sounds folder</i>");
-        }
-        HTML::first_html_column(OUT, THUMBNAIL_WIDTH+10);
-        if (rv == 0) {
-            HTML_TAG_WITH("img", "border=\"0\" src=\"inform:/doc_images/image_problem.png\"");
-        } else if (preview) {
-            HTML_OPEN_WITH("embed",
-                "src=\"file:%f\" width=\"%d\" height=\"64\" "
-                "autostart=\"false\" volume=\"50%%\" mastersound",
-                F, THUMBNAIL_WIDTH);
-            HTML_CLOSE("embed");
-        } else {
-            HTML_TAG_WITH("img", "border=\"0\" src=\"inform:/doc_images/sound_okay.png\"");
-        }
-        WRITE("&nbsp;");
-        HTML::next_html_column(OUT, 0);
-        WRITE("%S", Metadata::read_textual(pack, I"^name"));
-        IndexUtilities::link_package(OUT, pack);
-        HTML_TAG("br");
-        if (Str::len(line2) > 0) {
-            WRITE("%S", line2);
-            HTML_TAG("br");
-        }
-        WRITE("Filename: \"%S\" - resource number %d", Filenames::get_leafname(F), id);
-        DISCARD_TEXT(line2)
-        HTML::end_html_row(OUT);
+        TEMPORARY_TEXT(description)
+        int format_found = 0;
+        Find sound format and duration1.2.1.1
+        Render a table row for the sound1.2.1.2;
+        DISCARD_TEXT(description)
     }
     HTML::end_html_table(OUT);
 
-
  • This code is used in §1.
-

§1.3. This is more or less perfunctory, but still of some use, if only as a list. +

  • This code is used in §1.2.
+

§1.2.1.1. Find sound format and duration1.2.1.1 = +

+ +
+    FILE *SOUND_FILE = Filenames::fopen(F, "rb");
+    if (SOUND_FILE) {
+        text_stream *real_format = I"AIFF";
+        format_found = SoundFiles::get_AIFF_duration(SOUND_FILE, &duration, &pBitsPerSecond,
+            &pChannels, &pSampleRate);
+        fseek(SOUND_FILE, 0, SEEK_END);
+        fsize = (unsigned int) (ftell(SOUND_FILE));
+        fclose(SOUND_FILE);
+        if (format_found == 0) {
+            SOUND_FILE = Filenames::fopen(F, "rb");
+            if (SOUND_FILE) {
+                real_format = I"Ogg Vorbis";
+                preview = FALSE;
+                format_found = SoundFiles::get_OggVorbis_duration(SOUND_FILE, &duration,
+                    &pBitsPerSecond, &pChannels, &pSampleRate);
+                fclose(SOUND_FILE);
+            }
+        }
+        if (format_found == 0) {
+            SOUND_FILE = Filenames::fopen(F, "rb");
+            if (SOUND_FILE) {
+                waveform_style = FALSE;
+                real_format = I"MIDI";
+                preview = TRUE;
+                format_found = SoundFiles::get_MIDI_information(SOUND_FILE,
+                    &midi_version, &no_tracks);
+                fclose(SOUND_FILE);
+            }
+        }
+        if (format_found == 0) {
+            Localisation::italic_0(description, LD, I"Index.Elements.Fi.UnknownSoundFormat");
+        } else {
+            if (waveform_style == FALSE) Describe sound in MIDI format1.2.1.1.1
+            else Describe sound in waveform format1.2.1.1.2;
+        }
+    } else {
+        Localisation::italic_0(description, LD, I"Index.Elements.Fi.MissingSound");
+    }
+
+ +

§1.2.1.1.1. Describe sound in MIDI format1.2.1.1.1 = +

+ +
+    if (no_tracks == 1) {
+        Localisation::write_2ns(description, LD, I"Index.Elements.Fi.SoundFormatOneTrack",
+            (int) midi_version, real_format);
+    } else {
+        Localisation::write_3nsn(description, LD, I"Index.Elements.Fi.SoundFormatMultiTrack",
+            (int) midi_version, real_format, (int) no_tracks);
+    }
+    WRITE_TO(description, " - ");
+    Localisation::italic_0(description, LD, I"Index.Elements.Fi.SoundUnsupported");
+
+ +

§1.2.1.1.2. Describe sound in waveform format1.2.1.1.2 = +

+ +
+    TEMPORARY_TEXT(size)
+    WRITE_TO(size, "%d.%01dKB", fsize/1024, (fsize%1024)/102);
+    Localisation::write_2(description, LD, I"Index.Elements.Fi.SoundFile", size, real_format);
+    DISCARD_TEXT(size)
+    int min = (duration/6000), sec = (duration%6000)/100, centisec = (duration%100);
+    WRITE_TO(description, ": ");
+    TEMPORARY_TEXT(seconds)
+    if (centisec == 0) WRITE_TO(seconds, "%d", sec);
+    else WRITE_TO(seconds, "%d.%02d", sec, centisec);
+    if (min > 0) {
+        if ((sec > 0) || (centisec > 0)) {
+            Localisation::write_2ns(description, LD, I"Index.Elements.Fi.DurationMS",
+                min, seconds);
+        } else {
+            Localisation::write_1n(description, LD, I"Index.Elements.Fi.DurationM", min);
+        }
+    } else {
+        Localisation::write_1(description, LD, I"Index.Elements.Fi.DurationS", seconds);
+    }
+    DISCARD_TEXT(seconds)
+    WRITE_TO(description, "<br>");
+    TEMPORARY_TEXT(sample)
+    WRITE_TO(sample, "%d.%01dkHz", pSampleRate/1000, (pSampleRate%1000)/100);
+    Localisation::write_1(OUT, LD, I"Index.Elements.Fi.Sampled", sample);
+    DISCARD_TEXT(sample)
+    WRITE_TO(description, " ");
+    if (pChannels == 1) Localisation::write_0(OUT, LD, I"Index.Elements.Fi.Mono");
+    else Localisation::write_0(OUT, LD, I"Index.Elements.Fi.Stereo");
+    WRITE_TO(description, " (");
+    TEMPORARY_TEXT(bitrate)
+    WRITE_TO(bitrate, "%d.%01d", pBitsPerSecond/1000, (pSampleRate%1000)/100);
+    Localisation::write_1(OUT, LD, I"Index.Elements.Fi.BitRate", bitrate);
+    DISCARD_TEXT(bitrate)
+    WRITE_TO(description, ")");
+
+ +

§1.2.1.2. Render a table row for the sound1.2.1.2 = +

+ +
+    HTML::first_html_column(OUT, THUMBNAIL_WIDTH+10);
+    if (format_found == 0) {
+        HTML_TAG_WITH("img", "border=\"0\" src=\"inform:/doc_images/image_problem.png\"");
+    } else if (preview) {
+        HTML_OPEN_WITH("embed",
+            "src=\"file:%f\" width=\"%d\" height=\"64\" "
+            "autostart=\"false\" volume=\"50%%\" mastersound",
+            F, THUMBNAIL_WIDTH);
+        HTML_CLOSE("embed");
+    } else {
+        HTML_TAG_WITH("img", "border=\"0\" src=\"inform:/doc_images/sound_okay.png\"");
+    }
+    WRITE("&nbsp;");
+    HTML::next_html_column(OUT, 0);
+    WRITE("%S", Metadata::read_textual(pack, I"^name"));
+    IndexUtilities::link_package(OUT, pack);
+    HTML_TAG("br");
+    if (Str::len(description) > 0) {
+        WRITE("%S", description);
+        HTML_TAG("br");
+    }
+    Localisation::write_2sn(description, LD, I"Index.Elements.Fi.Resource",
+        Filenames::get_leafname(F), (int) id);
+    HTML::end_html_row(OUT);
+
+ +

§1.3. Files. This is more or less perfunctory, but still of some use, if only as a list.

Index the files1.3 =

-    HTML_OPEN("p");
-    WRITE("<b>List of External Files</b>");
-    HTML_CLOSE("p");
+    if (TreeLists::len(inv->file_nodes) == 0) {
+        HTML_OPEN("p");
+        Localisation::write_0(OUT, LD, I"Index.Elements.Fi.NoFiles");
+        HTML_CLOSE("p");
+    } else {
+        HTML_OPEN("p");
+        Localisation::bold_0(OUT, LD, I"Index.Elements.Fi.ListOfFiles");
+        HTML_CLOSE("p");
+        Tabulate the files1.3.1;
+    }
+
+
  • This code is used in §1.
+

§1.3.1. Tabulate the files1.3.1 = +

+ +
     HTML::begin_html_table(OUT, "#ffffff", TRUE, 0, 0, 0, 0, 0);
     inter_package *pack;
     LOOP_OVER_INVENTORY_PACKAGES(pack, i, inv->file_nodes) {
@@ -332,23 +416,26 @@ to match this width, preserving the aspect ratio.
         WRITE("%S", Metadata::read_textual(pack, I"^name"));
         IndexUtilities::link_package(OUT, pack);
         HTML_TAG("br");
-        WRITE("Filename: %s %S- owned by ",
-            (is_binary)?"- binary ":"",
-            Metadata::read_textual(pack, I"^leafname"));
+        if (is_binary)
+            Localisation::write_1(OUT, LD, I"Index.Elements.Fi.BinaryFile",
+                Metadata::read_textual(pack, I"^leafname"));
+        else
+            Localisation::write_1(OUT, LD, I"Index.Elements.Fi.TextFile",
+                Metadata::read_textual(pack, I"^leafname"));
+        WRITE(" - ");
         if (Metadata::read_optional_numeric(pack, I"^file_owned")) {
-            WRITE("this project");
+            Localisation::write_0(OUT, LD, I"Index.Elements.Fi.FileOwnedByThis");
         } else if (Metadata::read_optional_numeric(pack, I"^file_owned_by_other")) {
-            WRITE("another project");
+            Localisation::write_0(OUT, LD, I"Index.Elements.Fi.FileOwnedByOther");
         } else {
-            WRITE("project with IFID number <b>%S</b>",
+            Localisation::write_1(OUT, LD, I"Index.Elements.Fi.FileOwnedBy",
                 Metadata::read_textual(pack, I"^file_owner"));
         }
         HTML::end_html_row(OUT);
     }
     HTML::end_html_table(OUT);
-    HTML_OPEN("p");
 
-
  • This code is used in §1.
+
  • This code is used in §1.3.
diff --git a/docs/index-module/3-ge2.html b/docs/index-module/3-ge2.html index ef6cd2587..6954f8068 100644 --- a/docs/index-module/3-ge2.html +++ b/docs/index-module/3-ge2.html @@ -72,7 +72,8 @@ function togglePopup(material_id) {

To write the Grouped actions element (A1) in the index, and also the detailed per-action pages linked from it.

-

§1.

+

§1. The element itself is easily made: +

 void GroupedElement::render(OUTPUT_STREAM, localisation_dictionary *LD) {
@@ -108,24 +109,22 @@ function togglePopup(material_id) {
         }
         if (f == FALSE) HTML_OPEN("p");
         if ((f) && (suppress_comma == FALSE)) WRITE(", ");
-        GroupedElement::index_p1(OUT, an_pack, FALSE, FALSE, i);
+        inter_ti oow = Metadata::read_optional_numeric(an_pack, I"^out_of_world");
+        if (oow) HTML::begin_colour(OUT, I"800000");
+        WRITE("%S", Metadata::read_optional_textual(an_pack, I"^name"));
+        if (oow) HTML::end_colour(OUT);
+        IndexUtilities::link_package(OUT, an_pack);
+        IndexUtilities::detail_link(OUT, "A", i, FALSE);
         f = TRUE;
     }
     if (f) HTML_CLOSE("p");
 }
+
+

§2. Everything else in this section is for the detail pages: there is one such +page for each action. +

-void GroupedElement::index_p1(OUTPUT_STREAM, inter_package *an_pack, int bold, - int on_details_page, int i) { - inter_ti oow = Metadata::read_optional_numeric(an_pack, I"^out_of_world"); - if (oow) HTML::begin_colour(OUT, I"800000"); - if (bold) WRITE("<b>"); - WRITE("%S", Metadata::read_optional_textual(an_pack, I"^name")); - if (bold) WRITE("</b>"); - if (oow) HTML::end_colour(OUT); - IndexUtilities::link_package(OUT, an_pack); - IndexUtilities::detail_link(OUT, "A", i, (on_details_page)?FALSE:TRUE); -} - +
 void GroupedElement::detail_pages(localisation_dictionary *LD) {
     inter_tree *I = InterpretIndex::get_tree();
     tree_inventory *inv = Synoptic::inv(I);
@@ -134,38 +133,52 @@ function togglePopup(material_id) {
     inter_package *an_pack;
     LOOP_OVER_INVENTORY_PACKAGES(an_pack, i, inv->action_nodes) {
         text_stream *OUT = InterpretIndex::open_file(NULL, I"A.html", I"<Actions", i, LD);
-        IndexUtilities::banner_line(OUT, NULL, 1, I"^", I"Details",
-            I"Index.Pages.ActionDetails.Heading", "../Actions.html", LD);
-        HTML_TAG("hr");
-        text_stream *this_area = Metadata::read_optional_textual(an_pack, I"^index_heading");
-        text_stream *this_subarea = Metadata::read_optional_textual(an_pack, I"^index_subheading");
-        HTML_OPEN("p");
-        WRITE("<b>%S - %S</b><br>", this_area, this_subarea);
-        int c = 0;
-        inter_package *an2_pack;
-        LOOP_OVER_INVENTORY_PACKAGES(an2_pack, j, inv->action_nodes) {
-            text_stream *this_area2 = Metadata::read_optional_textual(an2_pack, I"^index_heading");
-            text_stream *this_subarea2 = Metadata::read_optional_textual(an2_pack, I"^index_subheading");
-            if ((Str::eq(this_area, this_area2)) && (Str::eq(this_subarea, this_subarea2))) {
-                if (c++ > 0) WRITE(", ");
-                if (j == i) WRITE("<b>");
-                WRITE("%S", Metadata::read_optional_textual(an2_pack, I"^name"));
-                if (j == i) WRITE("</b>");
-                if (j != i) IndexUtilities::detail_link(OUT, "A", j, FALSE);
-            }
-        }
-        HTML_CLOSE("p");
-        HTML_TAG("hr");
-        Show the heading1.1
-        HTML_TAG("hr");
-        Show the commands1.2;
-        Show the action variables1.3;
-        Show the rules relevant to this action1.4;
+        Write details page for the action2.1;
         InterpretIndex::close_index_file(OUT);
     }
 }
 
-

§1.1. Show the heading1.1 = +

§2.1. Write details page for the action2.1 = +

+ +
+    IndexUtilities::banner_line(OUT, NULL, 1, I"^", I"Details",
+        I"Index.Pages.ActionDetails.Heading", "../Actions.html", LD);
+    HTML_TAG("hr");
+    Show the fancy navigate-similar-actions menu2.1.1;
+    HTML_TAG("hr");
+    Show the heading2.1.2
+    HTML_TAG("hr");
+    Show the commands2.1.3;
+    Show the action variables2.1.4;
+    Show the rules relevant to this action2.1.5;
+
+
  • This code is used in §2.
+

§2.1.1. Show the fancy navigate-similar-actions menu2.1.1 = +

+ +
+    text_stream *this_area = Metadata::read_optional_textual(an_pack, I"^index_heading");
+    text_stream *this_subarea = Metadata::read_optional_textual(an_pack, I"^index_subheading");
+    HTML_OPEN("p");
+    WRITE("<b>%S - %S</b><br>", this_area, this_subarea);
+    int c = 0;
+    inter_package *an2_pack;
+    LOOP_OVER_INVENTORY_PACKAGES(an2_pack, j, inv->action_nodes) {
+        text_stream *this_area2 = Metadata::read_optional_textual(an2_pack, I"^index_heading");
+        text_stream *this_subarea2 = Metadata::read_optional_textual(an2_pack, I"^index_subheading");
+        if ((Str::eq(this_area, this_area2)) && (Str::eq(this_subarea, this_subarea2))) {
+            if (c++ > 0) WRITE(", ");
+            if (j == i) WRITE("<b>");
+            WRITE("%S", Metadata::read_optional_textual(an2_pack, I"^name"));
+            if (j == i) WRITE("</b>");
+            if (j != i) IndexUtilities::detail_link(OUT, "A", j, FALSE);
+        }
+    }
+    HTML_CLOSE("p");
+
+
  • This code is used in §2.1.
+

§2.1.2. Show the heading2.1.2 =

@@ -178,57 +191,74 @@ function togglePopup(material_id) {
     if (oow) HTML::end_colour(OUT);
     WRITE("</b>");
     IndexUtilities::link_package(OUT, an_pack);
-    if (requires_light) WRITE(" (requires light)");
-    WRITE(" (<i>past tense</i> %S)", Metadata::read_optional_textual(an_pack, I"^past_name"));
+    if (requires_light) {
+        WRITE(" (");
+        Localisation::write_0(OUT, LD, I"Index.Elements.A1.RequiresLight");
+        WRITE(")");
+    }
+    WRITE(" (");
+    Localisation::italic_0(OUT, LD, I"Index.Elements.A1.PastTense");
+    WRITE(" %S)", Metadata::read_optional_textual(an_pack, I"^past_name"));
     text_stream *spec = Metadata::read_optional_textual(an_pack, I"^specification");
     if (Str::len(spec) > 0) WRITE(": %S", spec);
     HTML_CLOSE("p");
     text_stream *desc = Metadata::read_optional_textual(an_pack, I"^description");
     if (Str::len(desc) > 0) { HTML_OPEN("p"); WRITE("%S", desc); HTML_CLOSE("p"); }
 
-
  • This code is used in §1.
-

§1.2. Show the commands1.2 = +

  • This code is used in §2.1.
+

§2.1.3. Show the commands2.1.3 =

-    HTML_OPEN("p"); WRITE("<b>Typed commands leading to this action</b>\n"); HTML_CLOSE("p");
+    HTML_OPEN("p");
+    Localisation::bold_0(OUT, LD, I"Index.Elements.A1.CommandsHeading");
+    HTML_CLOSE("p");
     HTML_OPEN("p");
     int producers = 0;
     inter_package *line_pack;
     LOOP_THROUGH_SUBPACKAGES(line_pack, an_pack, I"_cg_line") {
         inter_symbol *xref = Metadata::read_symbol(line_pack, I"^line");
-        CommandsElement::index_grammar_line(OUT, Inter::Packages::container(xref->definition), NULL, LD);
+        CommandsElement::index_grammar_line(OUT,
+            Inter::Packages::container(xref->definition), NULL, LD);
         producers++;
     }
-    if (producers == 0) WRITE("<i>None</i>");
+    if (producers == 0) Localisation::bold_0(OUT, LD, I"Index.Elements.A1.NoCommands");
     HTML_CLOSE("p");
 
-
  • This code is used in §1.
-

§1.3. Show the action variables1.3 = +

  • This code is used in §2.1.
+

§2.1.4. Show the action variables2.1.4 =

-    if (GroupedElement::no_vars(an_pack, I) > 0) {
-        HTML_OPEN("p"); WRITE("<b>Named values belonging to this action</b>\n"); HTML_CLOSE("p");
-        GroupedElement::index_shv_set(OUT, I, an_pack);
+    if (GroupedElement::no_vars(an_pack, I) > 0) {
+        HTML_OPEN("p");
+        Localisation::bold_0(OUT, LD, I"Index.Elements.A1.ValuesHeading");
+        HTML_CLOSE("p");
+        GroupedElement::index_shv_set(OUT, I, an_pack);
     }
 
-
  • This code is used in §1.
-

§1.4. Show the rules relevant to this action1.4 = +

  • This code is used in §2.1.
+

§2.1.5. Show the rules relevant to this action2.1.5 =

-    HTML_OPEN("p"); WRITE("<b>Rules controlling this action</b>"); HTML_CLOSE("p");
     HTML_OPEN("p");
-    WRITE("\n");
+    Localisation::bold_0(OUT, LD, I"Index.Elements.A1.RulesHeading");
+    HTML_CLOSE("p");
+    HTML_OPEN("p");
     int resp_count = 0;
     inter_ti oow = Metadata::read_optional_numeric(an_pack, I"^out_of_world");
     if (oow == FALSE) {
-        resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, NULL, I"persuasion", I"persuasion", LD);
-        resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, NULL, I"unsuccessful_attempt_by", I"unsuccessful attempt", LD);
-        resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, NULL, I"setting_action_variables", I"set action variables for", LD);
-        resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, NULL, I"before", I"before", LD);
-        resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, NULL, I"instead", I"instead of", LD);
+        resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, NULL,
+            I"persuasion", I"persuasion", LD);
+        resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, NULL,
+            I"unsuccessful_attempt_by", I"unsuccessful attempt", LD);
+        resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, NULL,
+            I"setting_action_variables", I"set action variables for", LD);
+        resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, NULL,
+            I"before", I"before", LD);
+        resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, NULL,
+            I"instead", I"instead of", LD);
     }
     inter_symbol *check_s = Metadata::read_symbol(an_pack, I"^check_rulebook");
     inter_symbol *carry_out_s = Metadata::read_symbol(an_pack, I"^carry_out_rulebook");
@@ -237,29 +267,32 @@ function togglePopup(material_id) {
     inter_package *carry_out_pack = Inter::Packages::container(carry_out_s->definition);
     inter_package *report_pack = Inter::Packages::container(report_s->definition);
 
-    resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, check_pack, I"check", I"check", LD);
-    resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, carry_out_pack, I"carry_out", I"carry out", LD);
+    resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, check_pack,
+        I"check", I"check", LD);
+    resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, carry_out_pack,
+        I"carry_out", I"carry out", LD);
     if (oow == FALSE)
-        resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, NULL, I"after", I"after", LD);
-    resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, report_pack, I"report", I"report", LD);
+        resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, NULL,
+            I"after", I"after", LD);
+    resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, report_pack,
+        I"report", I"report", LD);
     if (resp_count > 1) {
-        WRITE("Click on the speech-bubble icons to see the responses, "
-            "or here to see all of them:");
-        WRITE("&nbsp;");
+        Localisation::write_0(OUT, LD, I"Index.Elements.A1.ResponseIcons");
+        WRITE(":&nbsp;");
         IndexUtilities::extra_all_link_with(OUT, TreeLists::len(inv->rule_nodes), "responses");
         WRITE("%d", resp_count);
     }
     HTML_CLOSE("p");
 
-
  • This code is used in §1.
-

§2.

+
  • This code is used in §2.1.
+

§3.

-int GroupedElement::no_vars(inter_package *set, inter_tree *I) {
+int GroupedElement::no_vars(inter_package *set, inter_tree *I) {
     return InterTree::no_subpackages(set, I"_shared_variable");
 }
 
-void GroupedElement::index_shv_set(OUTPUT_STREAM, inter_tree *I, inter_package *set) {
+void GroupedElement::index_shv_set(OUTPUT_STREAM, inter_tree *I, inter_package *set) {
     inter_package *var_pack;
     LOOP_THROUGH_SUBPACKAGES(var_pack, set, I"_shared_variable") {
         HTML::open_indented_p(OUT, 2, "tight");
diff --git a/docs/index-module/3-ie.html b/docs/index-module/3-ie.html
index 989d01159..662b3688a 100644
--- a/docs/index-module/3-ie.html
+++ b/docs/index-module/3-ie.html
@@ -72,7 +72,8 @@ function togglePopup(material_id) {
     
 

To write the Innards element (In) in the index.

-

§1. Describing the current VM. +

§1. This element is something of a miscellany, except that it's all about the +technical implementation rather than the content of a work.

@@ -86,7 +87,7 @@ function togglePopup(material_id) {
 
     HTML_OPEN("p");
     IndexUtilities::extra_link(OUT, 3);
-    WRITE("See some technicalities for Inform maintainers only");
+    Localisation::write_0(OUT, LD, I"Index.Elements.In.Technicalities");
     HTML_CLOSE("p");
     IndexUtilities::extra_div_open(OUT, 3, 2, "e0e0e0");
     HTML_OPEN("p");
@@ -101,7 +102,9 @@ function togglePopup(material_id) {
 
 
     IndexUtilities::anchor(OUT, I"STORYFILE");
-    HTML_OPEN("p"); WRITE("Story file format: ");
+    HTML_OPEN("p");
+    Localisation::write_0(OUT, LD, I"Index.Elements.In.Format");
+    WRITE(": ");
     inter_package *pack = Inter::Packages::by_url(I, I"/main/completion/basics");
     text_stream *VM = Metadata::read_optional_textual(pack, I"^virtual_machine");
     text_stream *VM_icon = Metadata::read_optional_textual(pack, I"^virtual_machine_icon");
@@ -117,14 +120,20 @@ function togglePopup(material_id) {
 

-    HTML_OPEN("p"); WRITE("The following use options are in force:"); HTML_CLOSE("p");
-    InnardsElement::index_options_in_force_from(OUT, inv, MAIN_TEXT_UO_ORIGIN, NULL);
-    InnardsElement::index_options_in_force_from(OUT, inv, OPTIONS_FILE_UO_ORIGIN, NULL);
+    HTML_OPEN("p");
+    Localisation::write_0(OUT, LD, I"Index.Elements.In.ActiveUseOptions");
+    WRITE(":");
+    HTML_CLOSE("p");
+    InnardsElement::index_options_in_force_from(OUT, inv, MAIN_TEXT_UO_ORIGIN, NULL, LD);
+    InnardsElement::index_options_in_force_from(OUT, inv, OPTIONS_FILE_UO_ORIGIN, NULL, LD);
     inter_package *E;
     LOOP_OVER_INVENTORY_PACKAGES(E, i, inv->module_nodes)
-        InnardsElement::index_options_in_force_from(OUT, inv, EXTENSION_UO_ORIGIN, E);
+        InnardsElement::index_options_in_force_from(OUT, inv, EXTENSION_UO_ORIGIN, E, LD);
     int c = 0;
-    HTML_OPEN("p"); WRITE("Whereas these are not in force:"); HTML_CLOSE("p");
+    HTML_OPEN("p");
+    Localisation::write_0(OUT, LD, I"Index.Elements.In.InactiveUseOptions");
+    WRITE(":");
+    HTML_CLOSE("p");
     HTML::open_indented_p(OUT, 2, "tight");
     inter_package *pack;
     LOOP_OVER_INVENTORY_PACKAGES(pack, i, inv->use_option_nodes) {
@@ -135,7 +144,7 @@ function togglePopup(material_id) {
             if (c++ > 0) WRITE(", ");
         }
     }
-    if (c == 0) WRITE("None.");  in practice, this will never happen
+    if (c == 0) Localisation::write_0(OUT, LD, I"Index.Elements.In.NoUseOptions");
     HTML_CLOSE("p");
 
  • This code is used in §1.
@@ -156,12 +165,19 @@ function togglePopup(material_id) {

-    WRITE("Inform language definition:\n");
+    HTML_OPEN("p");
+    Localisation::write_0(OUT, LD, I"Index.Elements.In.LanguageDefinition");
+    WRITE(":");
+    HTML_CLOSE("p");
+    HTML_OPEN("p");
     inter_package *pack = Inter::Packages::by_url(I, I"/main/completion/basics");
     text_stream *used = Metadata::read_optional_textual(pack, I"^language_elements_used");
     text_stream *not_used = Metadata::read_optional_textual(pack, I"^language_elements_not_used");
-    if (Str::len(used) > 0) WRITE("Included: %S", used);
-    if (Str::len(not_used) > 0) WRITE("<br>Excluded: %S", not_used);
+    if (Str::len(used) > 0)
+        Localisation::write_1(OUT, LD, I"Index.Elements.In.Included", used);
+    if ((Str::len(used) > 0) && (Str::len(not_used) > 0)) WRITE("<br>");
+    if (Str::len(not_used) > 0)
+        Localisation::write_1(OUT, LD, I"Index.Elements.In.Excluded", not_used);
     HTML_CLOSE("p");
 
  • This code is used in §1.
@@ -170,7 +186,8 @@ function togglePopup(material_id) {
     HTML_OPEN("p");
-    WRITE("Debugging log:");
+    Localisation::write_0(OUT, LD, I"Index.Elements.In.Log");
+    WRITE(":");
     HTML_CLOSE("p");
     HTML_OPEN("p");
     inter_package *pack = Inter::Packages::by_url(I, I"/main/completion/basics");
@@ -192,7 +209,9 @@ function togglePopup(material_id) {
     HTML_CLOSE("p");
 
  • This code is used in §1.
-

§2. Now for indexing, where there's nothing much to see. +

§2. Use options can be set in three general ways, and the following function +answers the question "was this option set in this way?". E is meaningless +except for EXTENSION_UO_ORIGIN, when we are testing whether it was set in E.

define MAIN_TEXT_UO_ORIGIN 1
@@ -200,30 +219,14 @@ function togglePopup(material_id) {
 define EXTENSION_UO_ORIGIN 3
 
-void InnardsElement::index_options_in_force_from(OUTPUT_STREAM, tree_inventory *inv, int category, inter_package *E) {
-    int N = 0;
-    inter_package *pack;
-    LOOP_OVER_INVENTORY_PACKAGES(pack, i, inv->use_option_nodes) {
-        inter_ti set = Metadata::read_numeric(pack, I"^active");
-        inter_ti sfs = Metadata::read_numeric(pack, I"^source_file_scoped");
-        if ((set) && (sfs == FALSE)) {
-            if (InnardsElement::uo_set_from(pack, category, E)) {
-                if (N++ == 0) Write in the use option subheading2.2;
-                Write in the index line for a use option taken2.3;
-            }
-        }
-    }
-}
-
-

§2.1. And this is what the rest of Inform calls to find out whether a particular -pragma is set: -

- -
-int InnardsElement::uo_set_from(inter_package *pack, int category, inter_package *E) {
-    switch (category) {
-        case MAIN_TEXT_UO_ORIGIN: if (Metadata::read_optional_numeric(pack, I"^used_in_source_text")) return TRUE; break;
-        case OPTIONS_FILE_UO_ORIGIN: if (Metadata::read_optional_numeric(pack, I"^used_in_options")) return TRUE; break;
+int InnardsElement::uo_set_from(inter_package *pack, int way, inter_package *E) {
+    switch (way) {
+        case MAIN_TEXT_UO_ORIGIN:
+            if (Metadata::read_optional_numeric(pack, I"^used_in_source_text")) return TRUE;
+            break;
+        case OPTIONS_FILE_UO_ORIGIN:
+            if (Metadata::read_optional_numeric(pack, I"^used_in_options")) return TRUE;
+            break;
         case EXTENSION_UO_ORIGIN: {
             inter_symbol *id = Metadata::read_optional_symbol(pack, I"^used_in_extension");
             if (id) {
@@ -236,29 +239,50 @@ pragma is set:
     return FALSE;
 }
 
-

§2.2. Write in the use option subheading2.2 = +

§3. Here we list the UOs set in a particular way, using the same calling conventions. +

+ +
+void InnardsElement::index_options_in_force_from(OUTPUT_STREAM, tree_inventory *inv,
+    int way, inter_package *E, localisation_dictionary *LD) {
+    int N = 0;
+    inter_package *pack;
+    LOOP_OVER_INVENTORY_PACKAGES(pack, i, inv->use_option_nodes) {
+        inter_ti set = Metadata::read_numeric(pack, I"^active");
+        inter_ti sfs = Metadata::read_numeric(pack, I"^source_file_scoped");
+        if ((set) && (sfs == FALSE)) {
+            if (InnardsElement::uo_set_from(pack, way, E)) {
+                if (N++ == 0) Write in the use option subheading3.1;
+                Write in the index line for a use option taken3.2;
+            }
+        }
+    }
+}
+
+

§3.1. Write in the use option subheading3.1 =

     HTML::open_indented_p(OUT, 2, "tight");
     HTML::begin_colour(OUT, I"808080");
-    WRITE("Set from ");
-    switch (category) {
+    switch (way) {
         case MAIN_TEXT_UO_ORIGIN:
-            WRITE("the source text"); break;
+            Localisation::write_0(OUT, LD, I"Index.Elements.In.SetFromSource");
+            break;
         case OPTIONS_FILE_UO_ORIGIN:
-            WRITE("the Options.txt configuration file, or automatically");
+            Localisation::write_0(OUT, LD, I"Index.Elements.In.SetAutomatically");
             IndexUtilities::DocReferences::link(OUT, I"OPTIONSFILE"); break;
         case EXTENSION_UO_ORIGIN:
-            WRITE("%S", Metadata::read_optional_textual(E, I"^credit"));
+            Localisation::write_1(OUT, LD, I"Index.Elements.In.SetFrom",
+                Metadata::read_optional_textual(E, I"^credit"));
             break;
     }
     WRITE(":");
     HTML::end_colour(OUT);
     HTML_CLOSE("p");
 
-
  • This code is used in §2.
-

§2.3. Write in the index line for a use option taken2.3 = +

  • This code is used in §3.
+

§3.2. Write in the index line for a use option taken3.2 =

@@ -275,11 +299,12 @@ pragma is set:
             Metadata::read_optional_textual(pack, I"^name"), 2*msv);
         PasteButtons::paste_text(OUT, TEMP);
         DISCARD_TEXT(TEMP)
-        WRITE("&nbsp;<i>Double this</i>");
+        WRITE("&nbsp;");
+        Localisation::italic_0(OUT, LD, I"Index.Elements.In.Double");
     }
     HTML_CLOSE("p");
 
-
  • This code is used in §2.
+
  • This code is used in §3.
diff --git a/docs/index-module/3-le.html b/docs/index-module/3-le.html index f45bab8e5..e2cd2465d 100644 --- a/docs/index-module/3-le.html +++ b/docs/index-module/3-le.html @@ -79,13 +79,7 @@ function togglePopup(material_id) { IndexUtilities::anchor(OUT, I"LEXICON"); HTML_OPEN("p"); HTML_OPEN_WITH("span", "class=\"smaller\""); - WRITE("For instance, the description 'an unlocked door' is made " - "up from the adjective 'unlocked' and the noun 'door', both of which " - "can be found below. Property adjectives, like 'open', can be used " - "when creating things - 'In the Ballroom is an open container' is " - "allowed because 'open' is a property - but those with complicated " - "definitions, like 'empty', can only be tested during play, e.g. " - "with rules like 'Instead of taking an empty container, ...'."); + Localisation::write_0(OUT, LD, I"Index.Elements.Lx.Explanation"); HTML_CLOSE("span"); HTML_CLOSE("p"); IndexLexicon::listing(OUT, InterpretIndex::get_lexicon(), FALSE, LD); diff --git a/docs/index-module/3-me.html b/docs/index-module/3-me.html index b7861f40e..7640a57b7 100644 --- a/docs/index-module/3-me.html +++ b/docs/index-module/3-me.html @@ -104,8 +104,7 @@ function togglePopup(material_id) {
     faux_instance *I;
     LOOP_OVER_FAUX_INSTANCES(faux_set, I)
-        if ((MapElement::no_detail_index(I))
-            || (FauxInstances::is_a_direction(I)))
+        if ((MapElement::no_detail_index(I)) || (FauxInstances::is_a_direction(I)))
             FauxInstances::increment_indexing_count(I);
 
  • This code is used in §1.
diff --git a/inform7/Figures/memory-diagnostics.txt b/inform7/Figures/memory-diagnostics.txt index 33b28e650..ab0681f09 100644 --- a/inform7/Figures/memory-diagnostics.txt +++ b/inform7/Figures/memory-diagnostics.txt @@ -1,10 +1,10 @@ -Total memory consumption was 391672K = 382 MB +Total memory consumption was 392495K = 383 MB -60.4% was used for 1994926 objects, in 371045 frames in 296 x 800K = 236800K = 231 MB: +60.5% was used for 1995026 objects, in 371046 frames in 297 x 800K = 237600K = 232 MB: 10.4% inter_tree_node_array 58 x 8192 = 475136 objects, 41813824 bytes - 7.1% text_stream_array 5124 x 100 = 512400 objects, 28858368 bytes - 4.3% linked_list 30840 objects, 17270400 bytes + 7.1% text_stream_array 5125 x 100 = 512500 objects, 28864000 bytes + 4.2% linked_list 30840 objects, 17270400 bytes 3.4% inter_symbol_array 139 x 1024 = 142336 objects, 13668704 bytes 2.5% parse_node 129399 objects, 10351920 bytes 1.8% verb_conjugation 160 objects, 7425280 bytes @@ -234,9 +234,9 @@ Total memory consumption was 391672K = 382 MB ---- kind_template_definition 1 object, 40 bytes ---- loop_over_scope 1 object, 40 bytes -39.5% was used for memory not allocated for objects: +39.4% was used for memory not allocated for objects: - 20.6% text stream storage 82746500 bytes in 530520 claims + 20.5% text stream storage 82770840 bytes in 530655 claims 4.5% dictionary storage 18153472 bytes in 33229 claims ---- sorting 744 bytes in 3 claims 1.7% source text 7200000 bytes in 3 claims @@ -254,5 +254,5 @@ Total memory consumption was 391672K = 382 MB ---- code generation workspace for objects 9648 bytes in 9 claims ---- emitter array storage 157552 bytes in 2061 claims -18.6% was overhead - 74974232 bytes = 73217K = 71 MB +18.8% was overhead - 75787800 bytes = 74011K = 72 MB diff --git a/inform7/Figures/timings-diagnostics.txt b/inform7/Figures/timings-diagnostics.txt index 168a992ad..aeaaf7e7f 100644 --- a/inform7/Figures/timings-diagnostics.txt +++ b/inform7/Figures/timings-diagnostics.txt @@ -1,11 +1,11 @@ 100.0% in inform7 run - 56.0% in compilation to Inter - 40.2% in //Sequence::undertake_queued_tasks// - 3.6% in //MajorNodes::pre_pass// - 2.5% in //MajorNodes::pass_1// + 56.1% in compilation to Inter + 40.1% in //Sequence::undertake_queued_tasks// + 3.5% in //MajorNodes::pre_pass// + 2.7% in //MajorNodes::pass_1// 2.1% in //RTPhrasebook::compile_entries// 1.4% in //ImperativeDefinitions::assess_all// - 1.2% in //RTKindConstructors::compile// + 1.1% in //RTKindConstructors::compile// 0.4% in //ImperativeDefinitions::compile_first_block// 0.4% in //MajorNodes::pass_2// 0.4% in //Sequence::undertake_queued_tasks// @@ -16,21 +16,21 @@ 0.1% in //RTKindConstructors::compile_permissions// 0.1% in //Task::make_built_in_kind_constructors// 0.1% in //World::stages_II_and_III// - 1.8% not specifically accounted for - 42.0% in running Inter pipeline + 1.9% not specifically accounted for + 41.8% in running Inter pipeline 10.9% in step preparation - 9.7% in inter step 7/14: consolidate-text - 8.3% in inter step 2/14: link - 6.9% in inter step 14/14: generate inform6 -> auto.inf + 9.9% in inter step 7/14: consolidate-text + 8.0% in inter step 2/14: link + 7.1% in inter step 14/14: generate inform6 -> auto.inf 1.5% in inter step 10/14: make-identifiers-unique 0.4% in inter step 11/14: reconcile-verbs 0.2% in inter step 13/14: eliminate-redundant-operations 0.2% in inter step 6/14: assimilate 0.2% in inter step 8/14: resolve-external-symbols - 0.2% in inter step 9/14: inspect-plugs 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 - 2.5% not specifically accounted for - 1.6% in supervisor - 0.2% not specifically accounted for + 0.1% in inter step 9/14: inspect-plugs + 2.3% not specifically accounted for + 1.7% in supervisor + 0.3% not specifically accounted for diff --git a/inform7/Internal/Languages/English/Index.txt b/inform7/Internal/Languages/English/Index.txt index 48487f143..8daae7f70 100644 --- a/inform7/Internal/Languages/English/Index.txt +++ b/inform7/Internal/Languages/English/Index.txt @@ -27,9 +27,62 @@ %Index.Elements.Fi.Title = Figures %Index.Elements.Fi.Heading = The figures, sound effects or external files used.|About figures; About sounds; About files +%Index.Elements.Fi.NoFigures = There are no figures, or illustrations, in this project. +%Index.Elements.Fi.NoSounds = There are no sound effects in this project. +%Index.Elements.Fi.NoFiles = This project doesn't read or write external files. +%Index.Elements.Fi.ListOfFigures = List of Figures +%Index.Elements.Fi.ListOfSounds = List of Sounds +%Index.Elements.Fi.ListOfFiles = List of External Files + +%Index.Elements.Fi.Format = Format *1 +%Index.Elements.Fi.UnknownFormat = Unknown image format +%Index.Elements.Fi.Dimensions = *1 (width) by *2 (height) pixels +%Index.Elements.Fi.Missing = Missing from the Figures folder +%Index.Elements.Fi.Resource = Filename: "*1" - resource number *2 + +%Index.Elements.Fi.UnknownSoundFormat = Unknown sound format +%Index.Elements.Fi.SoundUnsupported = Warning: not officially supported in Glulx yet +%Index.Elements.Fi.SoundFormatOneTrack = Type *1 *2 file with 1 track +%Index.Elements.Fi.SoundFormatMultiTrack = Type *1 *2 file with *3 tracks +%Index.Elements.Fi.SoundFile = *1 *2 file +%Index.Elements.Fi.MissingSound = Missing from the Sounds folder +%Index.Elements.Fi.DurationS = duration *1 seconds +%Index.Elements.Fi.DurationMS = duration *1 minutes *2 seconds +%Index.Elements.Fi.DurationM = duration *1 minutes exactly +%Index.Elements.Fi.Sampled = Sampled as *1 +%Index.Elements.Fi.Mono = Mono +%Index.Elements.Fi.Stereo = Stereo +%Index.Elements.Fi.BitRate = *1 kilobits/sec + +%Index.Elements.Fi.BinaryFile = Binary file "*1" +%Index.Elements.Fi.TextFile = File "*1" +%Index.Elements.Fi.FileOwnedByThis = owned by this project +%Index.Elements.Fi.FileOwnedByOther = owned by another project +%Index.Elements.Fi.FileOwnedBy = owned by project with IFID number *1 + +%Index.Elements.Fi.ThumbnailLimit = + Only the first *1 thumbnails have been shown here, to avoid Inform taking + up too much memory. If you'd like to see more, set 'Use index figure + thumbnails of at least *2.', or whatever number you want to wait for. + %Index.Elements.In.Title = Innards %Index.Elements.In.Heading = Technicalities about the story file being produced.|About the story file; About use options +%Index.Elements.In.Technicalities = See some technicalities for Inform maintainers only +%Index.Elements.In.Format = Story file format +%Index.Elements.In.ActiveUseOptions = The following use options are in force +%Index.Elements.In.InactiveUseOptions = Whereas these are not in force +%Index.Elements.In.NoUseOptions = None +%Index.Elements.In.LanguageDefinition = Inform language definition +%Index.Elements.In.Included = Included: *1 +%Index.Elements.In.Excluded = Excluded: *1 +%Index.Elements.In.Log = Debugging log + +%Index.Elements.In.SetFromSource = Set from the source text +%Index.Elements.In.SetAutomatically = Set from the Options.txt configuration file, or automatically +%Index.Elements.In.SetFrom = Set from *1 +%Index.Elements.In.Double = Double this + %Index.Pages.Actions.Title = Actions Index %Index.Pages.Actions.Caption = Things that people can try to do @@ -38,6 +91,15 @@ %Index.Elements.A1.Title = Grouped %Index.Elements.A1.Heading = With similar actions grouped together|About actions; New actions; Out of world actions (in red) +%Index.Elements.A1.RequiresLight = requires light +%Index.Elements.A1.PastTense = past tense +%Index.Elements.A1.CommandsHeading = Typed commands leading to this action +%Index.Elements.A1.NoCommands = None +%Index.Elements.A1.ValuesHeading = Named values belonging to this action +%Index.Elements.A1.RulesHeading = Rules controlling this action +%Index.Elements.A1.ResponseIcons = + Click on the speech-bubble icons to see the responses, or here to see all of them + %Index.Elements.A2.Title = Alphabetic %Index.Elements.A2.Heading = Listed in alphabetical order|About actions; New actions; Out of world actions (in red) @@ -53,7 +115,7 @@ %Index.Elements.Bh.Heading = Kinds of action, grouped under common names|About kinds of action %Index.Elements.Bh.None = No names for kinds of action have yet been defined. -%Index.Elements.Bh.Defined = defined as any of the following acts +%Index.Elements.Bh.Defined = defined as any of the following acts: %Index.Elements.Cm.Title = Commands %Index.Elements.Cm.Heading = Commands which the player can type|About commands @@ -151,7 +213,16 @@ %Index.Elements.Lx.ToBe = *1, to be %Index.Elements.Lx.KindOf = a kind of *1 -%Index.Elements.Lx/ValueOf = value of *1 +%Index.Elements.Lx.ValueOf = value of *1 + +%Index.Elements.Lx.Explanation = + For instance, the description 'an unlocked door' is made + up from the adjective 'unlocked' and the noun 'door', both of which + can be found below. Property adjectives, like 'open', can be used + when creating things - 'In the Ballroom is an open container' is + allowed because 'open' is a property - but those with complicated + definitions, like 'empty', can only be tested during play, e.g. + with rules like 'Instead of taking an empty container, ...'. %Index.Elements.Rl.Title = Relations %Index.Elements.Rl.Heading = Relations give meaning to verbs|About relations @@ -177,6 +248,9 @@ %Index.Elements.Xt.Title = Extras %Index.Elements.Xt.Heading = Further rulebooks, from the source or extensions|About rulebooks; About activities; Moving or abolishing rules +%Index.Elements.Xt.FromSourceText = From the source text +%Index.Elements.Xt.FromExtension = From the extension *1 + %Index.Pages.Scenes.Title = Scenes Index %Index.Pages.Scenes.Caption = Like scenes in a movie @@ -186,6 +260,11 @@ %Index.Elements.Ev.Title = Events %Index.Elements.Ev.Heading = Timed events, if any|About timed events +%Index.Elements.Ev.None = None +%Index.Elements.Ev.Timeless = Events with no specific time +%Index.Elements.Ev.WhereTriggered = where triggered +%Index.Elements.Ev.Timetable = Timetable + %Index.Elements.RS.Title = Rules %Index.Elements.RS.Heading = General rules about scenes diff --git a/inter/bytecode-module/Chapter 2/Tree Location Lists.w b/inter/bytecode-module/Chapter 2/Tree Location Lists.w index 45c5cc891..d234b4379 100644 --- a/inter/bytecode-module/Chapter 2/Tree Location Lists.w +++ b/inter/bytecode-module/Chapter 2/Tree Location Lists.w @@ -60,7 +60,8 @@ void TreeLists::add(inter_tree_location_list *NL, inter_tree_node *P) { void TreeLists::sort(inter_tree_location_list *NL, int (*cmp)(const void *, const void *)) { if (NL == NULL) internal_error("null inter_tree_location_list"); - qsort(NL->list, (size_t) NL->list_used, sizeof(itl_entry), cmp); + if (NL->list_used > 0) + qsort(NL->list, (size_t) NL->list_used, sizeof(itl_entry), cmp); } @ And this macro conveniently loops through packages in a node list of their diff --git a/inter/index-module/Chapter 2/Localisation.w b/inter/index-module/Chapter 2/Localisation.w index ff93891cf..83195cfb9 100644 --- a/inter/index-module/Chapter 2/Localisation.w +++ b/inter/index-module/Chapter 2/Localisation.w @@ -185,6 +185,18 @@ with everything under the first line being italicised. For example: Note that a valid documentation reference must begin with an upper-case letter. = +void Localisation::bold_0(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key) { + WRITE(""); + Localisation::write_0(OUT, D, key); + WRITE(""); +} + +void Localisation::italic_0(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key) { + WRITE(""); + Localisation::write_0(OUT, D, key); + WRITE(""); +} + void Localisation::write_0(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key) { text_stream *vals[10]; @; @@ -199,6 +211,17 @@ void Localisation::write_1(OUTPUT_STREAM, localisation_dictionary *D, text_strea Localisation::write_general(OUT, D, key, vals); } +void Localisation::write_1n(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key, + int val1) { + text_stream *vals[10]; + @; + TEMPORARY_TEXT(f1) + WRITE_TO(f1, "%d", val1); + vals[1] = f1; + Localisation::write_general(OUT, D, key, vals); + DISCARD_TEXT(f1) +} + void Localisation::write_2(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key, text_stream *val1, text_stream *val2) { text_stream *vals[10]; @@ -207,6 +230,56 @@ void Localisation::write_2(OUTPUT_STREAM, localisation_dictionary *D, text_strea Localisation::write_general(OUT, D, key, vals); } +void Localisation::write_2n(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key, + int val1, int val2) { + text_stream *vals[10]; + @; + TEMPORARY_TEXT(f1) + TEMPORARY_TEXT(f2) + WRITE_TO(f1, "%d", val1); + WRITE_TO(f2, "%d", val2); + vals[1] = f1; vals[2] = f2; + Localisation::write_general(OUT, D, key, vals); + DISCARD_TEXT(f1) + DISCARD_TEXT(f2) +} + +void Localisation::write_2sn(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key, + text_stream *val1, int val2) { + text_stream *vals[10]; + @; + TEMPORARY_TEXT(f2) + WRITE_TO(f2, "%d", val2); + vals[1] = val1; vals[2] = f2; + Localisation::write_general(OUT, D, key, vals); + DISCARD_TEXT(f2) +} + +void Localisation::write_2ns(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key, + int val1, text_stream *val2) { + text_stream *vals[10]; + @; + TEMPORARY_TEXT(f1) + WRITE_TO(f1, "%d", val1); + vals[1] = f1; vals[2] = val2; + Localisation::write_general(OUT, D, key, vals); + DISCARD_TEXT(f1) +} + +void Localisation::write_3nsn(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key, + int val1, text_stream *val2, int val3) { + text_stream *vals[10]; + @; + TEMPORARY_TEXT(f1) + TEMPORARY_TEXT(f3) + WRITE_TO(f1, "%d", val1); + WRITE_TO(f3, "%d", val3); + vals[1] = f1; vals[2] = val2; vals[3] = f3; + Localisation::write_general(OUT, D, key, vals); + DISCARD_TEXT(f1) + DISCARD_TEXT(f3) +} + @ = for (int i=0; i<10; i++) vals[i] = NULL; diff --git a/inter/index-module/Chapter 3/Alphabetic Element.w b/inter/index-module/Chapter 3/Alphabetic Element.w index 4620b6a97..9b8903857 100644 --- a/inter/index-module/Chapter 3/Alphabetic Element.w +++ b/inter/index-module/Chapter 3/Alphabetic Element.w @@ -73,9 +73,7 @@ void AlphabeticElement::render(OUTPUT_STREAM, localisation_dictionary *LD) { void AlphabeticElement::column(OUTPUT_STREAM, text_stream *key, localisation_dictionary *LD) { TEMPORARY_TEXT(full) WRITE_TO(full, "Index.Elements.A2.%S", key); - WRITE(""); - Localisation::write_0(OUT, LD, full); - WRITE(" "); + Localisation::bold_0(OUT, LD, full); DISCARD_TEXT(full) } @@ -83,9 +81,7 @@ void AlphabeticElement::column(OUTPUT_STREAM, text_stream *key, localisation_dic void AlphabeticElement::note(OUTPUT_STREAM, text_stream *key, localisation_dictionary *LD) { TEMPORARY_TEXT(full) WRITE_TO(full, "Index.Elements.A2.%S", key); - WRITE(""); - Localisation::write_0(OUT, LD, full); - WRITE(" "); + Localisation::italic_0(OUT, LD, full); DISCARD_TEXT(full) } diff --git a/inter/index-module/Chapter 3/Arithmetic Element.w b/inter/index-module/Chapter 3/Arithmetic Element.w index e4c9acd16..b758d45e1 100644 --- a/inter/index-module/Chapter 3/Arithmetic Element.w +++ b/inter/index-module/Chapter 3/Arithmetic Element.w @@ -64,9 +64,7 @@ void ArithmeticElement::render(OUTPUT_STREAM, localisation_dictionary *LD) { if (Str::len(dims) > 0) { WRITE("%S", dims); } else { - WRITE(""); - Localisation::write_0(OUT, LD, I"Index.Elements.Ar.Dimensionless"); - WRITE(""); + Localisation::italic_0(OUT, LD, I"Index.Elements.Ar.Dimensionless"); } @ This is simply a table of all the multiplications declared in the source @@ -114,8 +112,7 @@ text, sorted into kind order of left and then right operand. void ArithmeticElement::column(OUTPUT_STREAM, text_stream *key, localisation_dictionary *LD) { TEMPORARY_TEXT(full) WRITE_TO(full, "Index.Elements.Ar.%S", key); - WRITE(""); - Localisation::write_0(OUT, LD, full); - WRITE(" "); + Localisation::bold_0(OUT, LD, full); + WRITE(" "); DISCARD_TEXT(full) } diff --git a/inter/index-module/Chapter 3/Behaviour Element.w b/inter/index-module/Chapter 3/Behaviour Element.w index fe0bd4edb..800315871 100644 --- a/inter/index-module/Chapter 3/Behaviour Element.w +++ b/inter/index-module/Chapter 3/Behaviour Element.w @@ -23,9 +23,8 @@ void BehaviourElement::render(OUTPUT_STREAM, localisation_dictionary *LD) { HTML_OPEN("p"); WRITE("%S", name); IndexUtilities::link_package(OUT, pack); HTML_TAG("br"); - WRITE("  "); - Localisation::write_0(OUT, LD, I"Index.Elements.Bh.Defined"); - WRITE(":\n"); + WRITE("  "); + Localisation::italic_0(OUT, LD, I"Index.Elements.Bh.Defined"); inter_tree_node *D = Inter::Packages::definition(pack); LOOP_THROUGH_INTER_CHILDREN(C, D) { if (C->W.data[ID_IFLD] == PACKAGE_IST) { diff --git a/inter/index-module/Chapter 3/Chart Element.w b/inter/index-module/Chapter 3/Chart Element.w index dffd7c674..7cb0173a5 100644 --- a/inter/index-module/Chapter 3/Chart Element.w +++ b/inter/index-module/Chapter 3/Chart Element.w @@ -155,9 +155,9 @@ or as paragraph of text in pass 2: HTML::open_indented_p(OUT, 1, "halftight"); IndexUtilities::anchor_numbered(OUT, i); /* ...the anchor to which the grey icon in the table led */ WRITE(""); IndexUtilities::kind_name(OUT, pack, FALSE, TRUE); WRITE(""); - WRITE(" ("); - Localisation::write_0(OUT, D, I"Index.Elements.Ch.Plural"); - WRITE(" "); + WRITE(" ("); + Localisation::italic_0(OUT, D, I"Index.Elements.Ch.Plural"); + WRITE(" "); IndexUtilities::kind_name(OUT, pack, TRUE, FALSE); WRITE(")"); IndexUtilities::link_to_documentation(OUT, pack); HTML_CLOSE("p"); @@ -353,9 +353,9 @@ void ChartElement::index_object_kind(OUTPUT_STREAM, tree_inventory *inv, IndexUtilities::kind_name(OUT, pack, FALSE, FALSE); if (pass == 2) WRITE(""); if (pass == 2) { - WRITE(" ("); - Localisation::write_0(OUT, D, I"Index.Elements.Ch.Plural"); - WRITE(" "); + WRITE(" ("); + Localisation::italic_0(OUT, D, I"Index.Elements.Ch.Plural"); + WRITE(" "); IndexUtilities::kind_name(OUT, pack, TRUE, FALSE); WRITE(")"); } diff --git a/inter/index-module/Chapter 3/Commands Element.w b/inter/index-module/Chapter 3/Commands Element.w index 5348fdecc..32eb3abac 100644 --- a/inter/index-module/Chapter 3/Commands Element.w +++ b/inter/index-module/Chapter 3/Commands Element.w @@ -126,24 +126,21 @@ linked_list *CommandsElement::sort(linked_list *entries) { break; case OUT_OF_WORLD_COMMAND: HTML::begin_colour(OUT, I"800000"); - WRITE(""%S", ", cie->command_headword); - Localisation::write_0(OUT, LD, I"Index.Elements.Cm.Command"); - WRITE(""); + WRITE(""%S", ", cie->command_headword); + Localisation::italic_0(OUT, LD, I"Index.Elements.Cm.Command"); HTML::end_colour(OUT); HTML_TAG("br"); break; case TESTING_COMMAND: HTML::begin_colour(OUT, I"800000"); - WRITE(""%S", ", cie->command_headword); - Localisation::write_0(OUT, LD, I"Index.Elements.Cm.TestingCommand"); - WRITE(""); + WRITE(""%S", ", cie->command_headword); + Localisation::italic_0(OUT, LD, I"Index.Elements.Cm.TestingCommand"); HTML::end_colour(OUT); HTML_TAG("br"); break; case BARE_DIRECTION_COMMAND: - WRITE(""[direction]" - "); - Localisation::write_0(OUT, LD, I"Index.Elements.Cm.DirectionCommand"); - WRITE(""); + WRITE(""[direction]" - "); + Localisation::italic_0(OUT, LD, I"Index.Elements.Cm.DirectionCommand"); HTML_TAG("br"); break; } @@ -160,9 +157,9 @@ void CommandsElement::index_normal(OUTPUT_STREAM, inter_tree *I, inter_package * void CommandsElement::index_alias(OUTPUT_STREAM, inter_tree *I, inter_package *cg_pack, text_stream *headword, localisation_dictionary *LD) { - WRITE(""%S", ", headword); - Localisation::write_0(OUT, LD, I"Index.Elements.Cm.Alias"); - WRITE(" "%S"", Metadata::read_textual(cg_pack, I"^command")); + WRITE(""%S", ", headword); + Localisation::italic_0(OUT, LD, I"Index.Elements.Cm.Alias"); + WRITE(" "%S"", Metadata::read_textual(cg_pack, I"^command")); IndexUtilities::link_package(OUT, cg_pack); HTML_TAG("br"); } @@ -181,15 +178,13 @@ void CommandsElement::index_grammar_line(OUTPUT_STREAM, inter_package *cgl, WRITE("""); IndexUtilities::link_package(OUT, cgl); - WRITE(" - %S", Metadata::read_textual(an, I"^name")); + WRITE(" - %S", Metadata::read_textual(an, I"^name")); IndexUtilities::detail_link(OUT, "A", (int) Metadata::read_numeric(an, I"action_id"), TRUE); if (Metadata::read_optional_numeric(cgl, I"^reversed")) { - WRITE(" "); - Localisation::write_0(OUT, LD, I"Index.Elements.Cm.Reversed"); - WRITE(""); + WRITE(" "); + Localisation::italic_0(OUT, LD, I"Index.Elements.Cm.Reversed"); } - WRITE(""); if (oow) HTML::end_colour(OUT); HTML_TAG("br"); } diff --git a/inter/index-module/Chapter 3/Contents Element.w b/inter/index-module/Chapter 3/Contents Element.w index 5747c7bff..309b3e5fc 100644 --- a/inter/index-module/Chapter 3/Contents Element.w +++ b/inter/index-module/Chapter 3/Contents Element.w @@ -173,8 +173,6 @@ void ContentsElement::index_extensions_included_by(OUTPUT_STREAM, tree_inventory @ = void ContentsElement::word_count(OUTPUT_STREAM, inter_package *pack, localisation_dictionary *LD) { - TEMPORARY_TEXT(words) - WRITE_TO(words, "%d", Metadata::read_numeric(pack, I"^word_count")); - Localisation::write_1(OUT, LD, I"Index.Elements.C.Words", words); - DISCARD_TEXT(words) + Localisation::write_1n(OUT, LD, I"Index.Elements.C.Words", + (int) Metadata::read_numeric(pack, I"^word_count")); } diff --git a/inter/index-module/Chapter 3/Events Element.w b/inter/index-module/Chapter 3/Events Element.w index 31eb4896a..fa139740d 100644 --- a/inter/index-module/Chapter 3/Events Element.w +++ b/inter/index-module/Chapter 3/Events Element.w @@ -14,7 +14,9 @@ void EventsElement::render(OUTPUT_STREAM, localisation_dictionary *LD) { @; @; if ((when_count == 0) && (tt_count == 0)) { - HTML_OPEN("p"); WRITE("None."); HTML_CLOSE("p"); + HTML_OPEN("p"); + Localisation::italic_0(OUT, LD, I"Index.Elements.Ev.None"); + HTML_CLOSE("p"); } } @@ -25,14 +27,16 @@ void EventsElement::render(OUTPUT_STREAM, localisation_dictionary *LD) { (Metadata::exists(pack, I"^timed_for") == FALSE)) { if (when_count == 0) { HTML_OPEN("p"); - WRITE("Events with no specific time"); + Localisation::italic_0(OUT, LD, I"Index.Elements.Ev.Timeless"); HTML_CLOSE("p"); } when_count++; HTML_OPEN_WITH("p", "class=\"tightin2\""); WRITE("%S", Metadata::read_textual(pack, I"^preamble")); IndexUtilities::link_package(OUT, pack); - WRITE(" (where triggered: "); + WRITE(" ("); + Localisation::write_0(OUT, LD, I"Index.Elements.Ev.WhereTriggered"); + WRITE(": "); inter_package *entry; LOOP_THROUGH_SUBPACKAGES(entry, pack, I"_timed_rule_trigger") { int at = (int) Metadata::read_optional_numeric(entry, I"^used_at"); @@ -49,7 +53,7 @@ void EventsElement::render(OUTPUT_STREAM, localisation_dictionary *LD) { (Metadata::exists(pack, I"^timed_for"))) { if (tt_count == 0) { HTML_OPEN("p"); - WRITE("Timetable"); + Localisation::italic_0(OUT, LD, I"Index.Elements.Ev.Timetable"); HTML_CLOSE("p"); } tt_count++; diff --git a/inter/index-module/Chapter 3/Extras Element.w b/inter/index-module/Chapter 3/Extras Element.w index eb662c80b..777be57b4 100644 --- a/inter/index-module/Chapter 3/Extras Element.w +++ b/inter/index-module/Chapter 3/Extras Element.w @@ -2,7 +2,8 @@ To write the Extras element (Xt) in the index. -@ +@ This is to sweep up rulebooks and activities not covered by other elements, +really, and most of the code here is just to arrange them in some logical order. = void ExtrasElement::render(OUTPUT_STREAM, localisation_dictionary *LD) { @@ -41,10 +42,12 @@ void ExtrasElement::render(OUTPUT_STREAM, localisation_dictionary *LD) { @ = HTML_OPEN("p"); + WRITE(""); if (Metadata::read_optional_numeric(E, I"^category") == 1) { - WRITE("From the source text"); + Localisation::write_0(OUT, LD, I"Index.Elements.Xt.FromSourceText"); } else { - WRITE("From the extension %S", + Localisation::write_1(OUT, LD, I"Index.Elements.Xt.FromExtension", Metadata::read_optional_textual(E, I"^credit")); } + WRITE(""); HTML_CLOSE("p"); diff --git a/inter/index-module/Chapter 3/Figures Element.w b/inter/index-module/Chapter 3/Figures Element.w index ff8c17525..6e62827fe 100644 --- a/inter/index-module/Chapter 3/Figures Element.w +++ b/inter/index-module/Chapter 3/Figures Element.w @@ -2,56 +2,45 @@ To write the Figures element (Fi) in the index. -@ This also includes sounds and external files, a little questionably. +@ Not only figures but also sounds and external files, a little questionably. = void FiguresElement::render(OUTPUT_STREAM, localisation_dictionary *LD) { inter_tree *I = InterpretIndex::get_tree(); tree_inventory *inv = Synoptic::inv(I); - if (TreeLists::len(inv->figure_nodes) > 0) { - TreeLists::sort(inv->figure_nodes, Synoptic::module_order); - } - if (TreeLists::len(inv->sound_nodes) > 0) { - TreeLists::sort(inv->sound_nodes, Synoptic::module_order); - } - if (TreeLists::len(inv->file_nodes) > 0) { - TreeLists::sort(inv->file_nodes, Synoptic::module_order); - } - if (TreeLists::len(inv->figure_nodes) < 2) { /* cover art always creates 1 */ - HTML_OPEN("p"); - WRITE("There are no figures, or illustrations, in this project."); - HTML_CLOSE("p"); - } else { - @; - } - if (TreeLists::len(inv->sound_nodes) == 0) { - HTML_OPEN("p"); - WRITE("There are no sound effects in this project."); - HTML_CLOSE("p"); - } else { - @; - } - if (TreeLists::len(inv->file_nodes) == 0) { - HTML_OPEN("p"); - WRITE("This project doesn't read or write external files."); - HTML_CLOSE("p"); - } else { - @; - } + TreeLists::sort(inv->figure_nodes, Synoptic::module_order); + TreeLists::sort(inv->sound_nodes, Synoptic::module_order); + TreeLists::sort(inv->file_nodes, Synoptic::module_order); + @; + @; + @; } -@ The index is presented with thumbnails of a given pixel width, which +@h Figures. + +@ = + if (TreeLists::len(inv->figure_nodes) <= 1) { /* cover art always creates 1 */ + HTML_OPEN("p"); + Localisation::write_0(OUT, LD, I"Index.Elements.Fi.NoFigures"); + HTML_CLOSE("p"); + } else { + HTML_OPEN("p"); + Localisation::bold_0(OUT, LD, I"Index.Elements.Fi.ListOfFigures"); + HTML_CLOSE("p"); + @; + } + +@ The table is presented with thumbnails of a given pixel width, which the HTML renderer automatically scales to fit. Height is adjusted so as to match this width, preserving the aspect ratio. @d THUMBNAIL_WIDTH 80 = -@ = +@ = inter_package *settings = Inter::Packages::by_url(I, I"/main/completion/basics"); int MAX_INDEXED_FIGURES = (int) Metadata::read_optional_numeric(settings, I"^max_indexed_figures"); - HTML_OPEN("p"); WRITE("List of Figures"); HTML_CLOSE("p"); HTML::begin_html_table(OUT, "#ffffff", TRUE, 0, 0, 0, 0, 0); int count_of_displayed_figures = 0; inter_package *pack; @@ -60,76 +49,96 @@ to match this width, preserving the aspect ratio. if (id > 1) { text_stream *filename_as_text = Metadata::read_textual(pack, I"^filename"); filename *F = Filenames::from_text(filename_as_text); - TEMPORARY_TEXT(line2) + TEMPORARY_TEXT(description) unsigned int width = 0, height = 0; - int rv = 0; - FILE *FIGURE_FILE = Filenames::fopen(F, "rb"); - if (FIGURE_FILE) { - char *real_format = "JPEG"; - rv = ImageFiles::get_JPEG_dimensions(FIGURE_FILE, &width, &height); - fclose(FIGURE_FILE); - if (rv == 0) { - FIGURE_FILE = Filenames::fopen(F, "rb"); - if (FIGURE_FILE) { - real_format = "PNG"; - rv = ImageFiles::get_PNG_dimensions(FIGURE_FILE, &width, &height); - fclose(FIGURE_FILE); - } - } - if (rv == 0) { - WRITE_TO(line2, "Unknown image format"); - } else { - WRITE_TO(line2, "%s format: %d (width) by %d (height) pixels", - real_format, width, height); - } - } else { - WRITE_TO(line2, "Missing from the Figures folder"); - } - HTML::first_html_column(OUT, THUMBNAIL_WIDTH+10); - if (rv == 0) { - HTML_TAG_WITH("img", "border=\"0\" src=\"inform:/doc_images/image_problem.png\""); - WRITE(" "); - } else if (count_of_displayed_figures++ < MAX_INDEXED_FIGURES) { - HTML_TAG_WITH("img", "border=\"1\" src=\"file://%f\" width=\"%d\" height=\"%d\"", - F, THUMBNAIL_WIDTH, THUMBNAIL_WIDTH*height/width); - WRITE(" "); - } else { - HTML_OPEN_WITH("div", "style=\"width:%dpx; height:%dpx; border:1px solid; background-color:#6495ed;\"", - THUMBNAIL_WIDTH, THUMBNAIL_WIDTH*height/width); - WRITE(" "); - HTML_CLOSE("div"); - } - - HTML::next_html_column(OUT, 0); - WRITE("%S", Metadata::read_textual(pack, I"^name")); - IndexUtilities::link_package(OUT, pack); - - HTML_TAG("br"); - if (Str::len(line2) > 0) { - WRITE("%S", line2); - HTML_TAG("br"); - } - WRITE("Filename: \"%S\" - resource number %d", Filenames::get_leafname(F), id); - HTML::end_html_row(OUT); - DISCARD_TEXT(line2) + int format_found = 0; + @; + @; + DISCARD_TEXT(description) } } HTML::end_html_table(OUT); if (count_of_displayed_figures > MAX_INDEXED_FIGURES) { HTML_OPEN("p"); - WRITE("(Only the first %d thumbnails have been shown here, " - "to avoid Inform taking up too much memory. If you'd like to " - "see more, set 'Use index figure thumbnails of at least %d.', or " - "whatever number you want to wait for.)", + WRITE("("); + Localisation::write_2n(OUT, LD, I"Index.Elements.Fi.ThumbnailLimit", MAX_INDEXED_FIGURES, 10*MAX_INDEXED_FIGURES); + WRITE(")"); HTML_CLOSE("p"); } -@h Sounds Index. +@ = + FILE *FIGURE_FILE = Filenames::fopen(F, "rb"); + if (FIGURE_FILE) { + text_stream *real_format = I"JPEG"; + format_found = ImageFiles::get_JPEG_dimensions(FIGURE_FILE, &width, &height); + fclose(FIGURE_FILE); + if (format_found == 0) { + FIGURE_FILE = Filenames::fopen(F, "rb"); + if (FIGURE_FILE) { + real_format = I"PNG"; + format_found = ImageFiles::get_PNG_dimensions(FIGURE_FILE, &width, &height); + fclose(FIGURE_FILE); + } + } + if (format_found == 0) { + Localisation::italic_0(description, LD, I"Index.Elements.Fi.UnknownFormat"); + } else { + Localisation::write_1(description, LD, I"Index.Elements.Fi.Format", real_format); + WRITE_TO(description, ": "); + Localisation::write_2n(description, LD, I"Index.Elements.Fi.Dimensions", + (int) width, (int) height); + } + } else { + Localisation::italic_0(description, LD, I"Index.Elements.Fi.Missing"); + } + +@ = + HTML::first_html_column(OUT, THUMBNAIL_WIDTH+10); + if (format_found == 0) { + HTML_TAG_WITH("img", + "border=\"0\" src=\"inform:/doc_images/image_problem.png\""); + WRITE(" "); + } else if (count_of_displayed_figures++ < MAX_INDEXED_FIGURES) { + HTML_TAG_WITH("img", + "border=\"1\" src=\"file://%f\" width=\"%d\" height=\"%d\"", + F, THUMBNAIL_WIDTH, THUMBNAIL_WIDTH*height/width); + WRITE(" "); + } else { + HTML_OPEN_WITH("div", + "style=\"width:%dpx; height:%dpx; border:1px solid; background-color:#6495ed;\"", + THUMBNAIL_WIDTH, THUMBNAIL_WIDTH*height/width); + WRITE(" "); + HTML_CLOSE("div"); + } + + HTML::next_html_column(OUT, 0); + WRITE("%S", Metadata::read_textual(pack, I"^name")); + IndexUtilities::link_package(OUT, pack); + HTML_TAG("br"); + if (Str::len(description) > 0) { + WRITE("%S", description); + HTML_TAG("br"); + } + Localisation::write_2sn(description, LD, I"Index.Elements.Fi.Resource", + Filenames::get_leafname(F), (int) id); + HTML::end_html_row(OUT); + +@h Sounds. @ = - HTML_OPEN("p"); WRITE("List of Sounds"); HTML_CLOSE("p"); - WRITE("\n"); + if (TreeLists::len(inv->sound_nodes) == 0) { + HTML_OPEN("p"); + Localisation::bold_0(OUT, LD, I"Index.Elements.Fi.ListOfSounds"); + HTML_CLOSE("p"); + HTML_OPEN("p"); + Localisation::write_0(OUT, LD, I"Index.Elements.Fi.NoSounds"); + HTML_CLOSE("p"); + } else { + @; + } + +@ = HTML::begin_html_table(OUT, "#ffffff", TRUE, 0, 0, 0, 0, 0); inter_package *pack; LOOP_OVER_INVENTORY_PACKAGES(pack, i, inv->sound_nodes) { @@ -139,102 +148,143 @@ to match this width, preserving the aspect ratio. unsigned int duration, pBitsPerSecond, pChannels, pSampleRate, fsize, midi_version = 0, no_tracks = 0; int preview = TRUE, waveform_style = TRUE; - TEMPORARY_TEXT(line2) - int rv = 0; - FILE *SOUND_FILE = Filenames::fopen(F, "rb"); - if (SOUND_FILE) { - char *real_format = "AIFF"; - rv = SoundFiles::get_AIFF_duration(SOUND_FILE, &duration, &pBitsPerSecond, - &pChannels, &pSampleRate); - fseek(SOUND_FILE, 0, SEEK_END); - fsize = (unsigned int) (ftell(SOUND_FILE)); - fclose(SOUND_FILE); - if (rv == 0) { - SOUND_FILE = Filenames::fopen(F, "rb"); - if (SOUND_FILE) { - real_format = "Ogg Vorbis"; - preview = FALSE; - rv = SoundFiles::get_OggVorbis_duration(SOUND_FILE, &duration, - &pBitsPerSecond, &pChannels, &pSampleRate); - fclose(SOUND_FILE); - } - } - if (rv == 0) { - SOUND_FILE = Filenames::fopen(F, "rb"); - if (SOUND_FILE) { - waveform_style = FALSE; - real_format = "MIDI"; - preview = TRUE; - rv = SoundFiles::get_MIDI_information(SOUND_FILE, - &midi_version, &no_tracks); - fclose(SOUND_FILE); - } - } - if (rv == 0) { - WRITE_TO(line2, "Unknown sound format"); - } else { - if (waveform_style == FALSE) { - WRITE_TO(line2, "Type %d %s file with %d track%s", - midi_version, real_format, no_tracks, - (no_tracks == 1)?"":"s"); - HTML_TAG("br"); - WRITE("Warning: not officially supported in glulx yet"); - } else { - int min = (duration/6000), sec = (duration%6000)/100, - centisec = (duration%100); - WRITE_TO(line2, "%d.%01dKB %s file: duration ", - fsize/1024, (fsize%1024)/102, real_format); - if (min > 0) - WRITE_TO(line2, "%d minutes ", min); - if ((sec > 0) || (centisec > 0)) { - if (centisec == 0) - WRITE_TO(line2, "%d seconds", sec); - else - WRITE_TO(line2, "%d.%02d seconds", sec, centisec); - } else WRITE_TO(line2, "exactly"); - WRITE_TO(line2, "Sampled as %d.%01dkHz %s (%d.%01d kilobits/sec)", - pSampleRate/1000, (pSampleRate%1000)/100, - (pChannels==1)?"Mono":"Stereo", - pBitsPerSecond/1000, (pSampleRate%1000)/100); - } - } - } else { - WRITE_TO(line2, "Missing from the Sounds folder"); - } - HTML::first_html_column(OUT, THUMBNAIL_WIDTH+10); - if (rv == 0) { - HTML_TAG_WITH("img", "border=\"0\" src=\"inform:/doc_images/image_problem.png\""); - } else if (preview) { - HTML_OPEN_WITH("embed", - "src=\"file://%f\" width=\"%d\" height=\"64\" " - "autostart=\"false\" volume=\"50%%\" mastersound", - F, THUMBNAIL_WIDTH); - HTML_CLOSE("embed"); - } else { - HTML_TAG_WITH("img", "border=\"0\" src=\"inform:/doc_images/sound_okay.png\""); - } - WRITE(" "); - HTML::next_html_column(OUT, 0); - WRITE("%S", Metadata::read_textual(pack, I"^name")); - IndexUtilities::link_package(OUT, pack); - HTML_TAG("br"); - if (Str::len(line2) > 0) { - WRITE("%S", line2); - HTML_TAG("br"); - } - WRITE("Filename: \"%S\" - resource number %d", Filenames::get_leafname(F), id); - DISCARD_TEXT(line2) - HTML::end_html_row(OUT); + TEMPORARY_TEXT(description) + int format_found = 0; + @ + @; + DISCARD_TEXT(description) } HTML::end_html_table(OUT); -@ This is more or less perfunctory, but still of some use, if only as a list. +@ = + FILE *SOUND_FILE = Filenames::fopen(F, "rb"); + if (SOUND_FILE) { + text_stream *real_format = I"AIFF"; + format_found = SoundFiles::get_AIFF_duration(SOUND_FILE, &duration, &pBitsPerSecond, + &pChannels, &pSampleRate); + fseek(SOUND_FILE, 0, SEEK_END); + fsize = (unsigned int) (ftell(SOUND_FILE)); + fclose(SOUND_FILE); + if (format_found == 0) { + SOUND_FILE = Filenames::fopen(F, "rb"); + if (SOUND_FILE) { + real_format = I"Ogg Vorbis"; + preview = FALSE; + format_found = SoundFiles::get_OggVorbis_duration(SOUND_FILE, &duration, + &pBitsPerSecond, &pChannels, &pSampleRate); + fclose(SOUND_FILE); + } + } + if (format_found == 0) { + SOUND_FILE = Filenames::fopen(F, "rb"); + if (SOUND_FILE) { + waveform_style = FALSE; + real_format = I"MIDI"; + preview = TRUE; + format_found = SoundFiles::get_MIDI_information(SOUND_FILE, + &midi_version, &no_tracks); + fclose(SOUND_FILE); + } + } + if (format_found == 0) { + Localisation::italic_0(description, LD, I"Index.Elements.Fi.UnknownSoundFormat"); + } else { + if (waveform_style == FALSE) @ + else @; + } + } else { + Localisation::italic_0(description, LD, I"Index.Elements.Fi.MissingSound"); + } + +@ = + if (no_tracks == 1) { + Localisation::write_2ns(description, LD, I"Index.Elements.Fi.SoundFormatOneTrack", + (int) midi_version, real_format); + } else { + Localisation::write_3nsn(description, LD, I"Index.Elements.Fi.SoundFormatMultiTrack", + (int) midi_version, real_format, (int) no_tracks); + } + WRITE_TO(description, " - "); + Localisation::italic_0(description, LD, I"Index.Elements.Fi.SoundUnsupported"); + +@ = + TEMPORARY_TEXT(size) + WRITE_TO(size, "%d.%01dKB", fsize/1024, (fsize%1024)/102); + Localisation::write_2(description, LD, I"Index.Elements.Fi.SoundFile", size, real_format); + DISCARD_TEXT(size) + int min = (duration/6000), sec = (duration%6000)/100, centisec = (duration%100); + WRITE_TO(description, ": "); + TEMPORARY_TEXT(seconds) + if (centisec == 0) WRITE_TO(seconds, "%d", sec); + else WRITE_TO(seconds, "%d.%02d", sec, centisec); + if (min > 0) { + if ((sec > 0) || (centisec > 0)) { + Localisation::write_2ns(description, LD, I"Index.Elements.Fi.DurationMS", + min, seconds); + } else { + Localisation::write_1n(description, LD, I"Index.Elements.Fi.DurationM", min); + } + } else { + Localisation::write_1(description, LD, I"Index.Elements.Fi.DurationS", seconds); + } + DISCARD_TEXT(seconds) + WRITE_TO(description, "
"); + TEMPORARY_TEXT(sample) + WRITE_TO(sample, "%d.%01dkHz", pSampleRate/1000, (pSampleRate%1000)/100); + Localisation::write_1(OUT, LD, I"Index.Elements.Fi.Sampled", sample); + DISCARD_TEXT(sample) + WRITE_TO(description, " "); + if (pChannels == 1) Localisation::write_0(OUT, LD, I"Index.Elements.Fi.Mono"); + else Localisation::write_0(OUT, LD, I"Index.Elements.Fi.Stereo"); + WRITE_TO(description, " ("); + TEMPORARY_TEXT(bitrate) + WRITE_TO(bitrate, "%d.%01d", pBitsPerSecond/1000, (pSampleRate%1000)/100); + Localisation::write_1(OUT, LD, I"Index.Elements.Fi.BitRate", bitrate); + DISCARD_TEXT(bitrate) + WRITE_TO(description, ")"); + +@ = + HTML::first_html_column(OUT, THUMBNAIL_WIDTH+10); + if (format_found == 0) { + HTML_TAG_WITH("img", "border=\"0\" src=\"inform:/doc_images/image_problem.png\""); + } else if (preview) { + HTML_OPEN_WITH("embed", + "src=\"file://%f\" width=\"%d\" height=\"64\" " + "autostart=\"false\" volume=\"50%%\" mastersound", + F, THUMBNAIL_WIDTH); + HTML_CLOSE("embed"); + } else { + HTML_TAG_WITH("img", "border=\"0\" src=\"inform:/doc_images/sound_okay.png\""); + } + WRITE(" "); + HTML::next_html_column(OUT, 0); + WRITE("%S", Metadata::read_textual(pack, I"^name")); + IndexUtilities::link_package(OUT, pack); + HTML_TAG("br"); + if (Str::len(description) > 0) { + WRITE("%S", description); + HTML_TAG("br"); + } + Localisation::write_2sn(description, LD, I"Index.Elements.Fi.Resource", + Filenames::get_leafname(F), (int) id); + HTML::end_html_row(OUT); + +@h Files. +This is more or less perfunctory, but still of some use, if only as a list. -= @ = - HTML_OPEN("p"); - WRITE("List of External Files"); - HTML_CLOSE("p"); + if (TreeLists::len(inv->file_nodes) == 0) { + HTML_OPEN("p"); + Localisation::write_0(OUT, LD, I"Index.Elements.Fi.NoFiles"); + HTML_CLOSE("p"); + } else { + HTML_OPEN("p"); + Localisation::bold_0(OUT, LD, I"Index.Elements.Fi.ListOfFiles"); + HTML_CLOSE("p"); + @; + } + +@ = HTML::begin_html_table(OUT, "#ffffff", TRUE, 0, 0, 0, 0, 0); inter_package *pack; LOOP_OVER_INVENTORY_PACKAGES(pack, i, inv->file_nodes) { @@ -250,18 +300,21 @@ to match this width, preserving the aspect ratio. WRITE("%S", Metadata::read_textual(pack, I"^name")); IndexUtilities::link_package(OUT, pack); HTML_TAG("br"); - WRITE("Filename: %s %S- owned by ", - (is_binary)?"- binary ":"", - Metadata::read_textual(pack, I"^leafname")); + if (is_binary) + Localisation::write_1(OUT, LD, I"Index.Elements.Fi.BinaryFile", + Metadata::read_textual(pack, I"^leafname")); + else + Localisation::write_1(OUT, LD, I"Index.Elements.Fi.TextFile", + Metadata::read_textual(pack, I"^leafname")); + WRITE(" - "); if (Metadata::read_optional_numeric(pack, I"^file_owned")) { - WRITE("this project"); + Localisation::write_0(OUT, LD, I"Index.Elements.Fi.FileOwnedByThis"); } else if (Metadata::read_optional_numeric(pack, I"^file_owned_by_other")) { - WRITE("another project"); + Localisation::write_0(OUT, LD, I"Index.Elements.Fi.FileOwnedByOther"); } else { - WRITE("project with IFID number %S", + Localisation::write_1(OUT, LD, I"Index.Elements.Fi.FileOwnedBy", Metadata::read_textual(pack, I"^file_owner")); } HTML::end_html_row(OUT); } HTML::end_html_table(OUT); - HTML_OPEN("p"); diff --git a/inter/index-module/Chapter 3/Grouped Element.w b/inter/index-module/Chapter 3/Grouped Element.w index fb47ba0f7..5eaaa221b 100644 --- a/inter/index-module/Chapter 3/Grouped Element.w +++ b/inter/index-module/Chapter 3/Grouped Element.w @@ -3,7 +3,9 @@ To write the Grouped actions element (A1) in the index, and also the detailed per-action pages linked from it. -@ = +@ The element itself is easily made: + += void GroupedElement::render(OUTPUT_STREAM, localisation_dictionary *LD) { inter_tree *I = InterpretIndex::get_tree(); tree_inventory *inv = Synoptic::inv(I); @@ -37,24 +39,21 @@ void GroupedElement::render(OUTPUT_STREAM, localisation_dictionary *LD) { } if (f == FALSE) HTML_OPEN("p"); if ((f) && (suppress_comma == FALSE)) WRITE(", "); - GroupedElement::index_p1(OUT, an_pack, FALSE, FALSE, i); + inter_ti oow = Metadata::read_optional_numeric(an_pack, I"^out_of_world"); + if (oow) HTML::begin_colour(OUT, I"800000"); + WRITE("%S", Metadata::read_optional_textual(an_pack, I"^name")); + if (oow) HTML::end_colour(OUT); + IndexUtilities::link_package(OUT, an_pack); + IndexUtilities::detail_link(OUT, "A", i, FALSE); f = TRUE; } if (f) HTML_CLOSE("p"); } -void GroupedElement::index_p1(OUTPUT_STREAM, inter_package *an_pack, int bold, - int on_details_page, int i) { - inter_ti oow = Metadata::read_optional_numeric(an_pack, I"^out_of_world"); - if (oow) HTML::begin_colour(OUT, I"800000"); - if (bold) WRITE(""); - WRITE("%S", Metadata::read_optional_textual(an_pack, I"^name")); - if (bold) WRITE(""); - if (oow) HTML::end_colour(OUT); - IndexUtilities::link_package(OUT, an_pack); - IndexUtilities::detail_link(OUT, "A", i, (on_details_page)?FALSE:TRUE); -} +@ Everything else in this section is for the detail pages: there is one such +page for each action. += void GroupedElement::detail_pages(localisation_dictionary *LD) { inter_tree *I = InterpretIndex::get_tree(); tree_inventory *inv = Synoptic::inv(I); @@ -63,37 +62,43 @@ void GroupedElement::detail_pages(localisation_dictionary *LD) { inter_package *an_pack; LOOP_OVER_INVENTORY_PACKAGES(an_pack, i, inv->action_nodes) { text_stream *OUT = InterpretIndex::open_file(NULL, I"A.html", I"%S - %S
", this_area, this_subarea); - int c = 0; - inter_package *an2_pack; - LOOP_OVER_INVENTORY_PACKAGES(an2_pack, j, inv->action_nodes) { - text_stream *this_area2 = Metadata::read_optional_textual(an2_pack, I"^index_heading"); - text_stream *this_subarea2 = Metadata::read_optional_textual(an2_pack, I"^index_subheading"); - if ((Str::eq(this_area, this_area2)) && (Str::eq(this_subarea, this_subarea2))) { - if (c++ > 0) WRITE(", "); - if (j == i) WRITE(""); - WRITE("%S", Metadata::read_optional_textual(an2_pack, I"^name")); - if (j == i) WRITE(""); - if (j != i) IndexUtilities::detail_link(OUT, "A", j, FALSE); - } - } - HTML_CLOSE("p"); - HTML_TAG("hr"); - @ - HTML_TAG("hr"); - @; - @; - @; + @; InterpretIndex::close_index_file(OUT); } } +@ = + IndexUtilities::banner_line(OUT, NULL, 1, I"^", I"Details", + I"Index.Pages.ActionDetails.Heading", "../Actions.html", LD); + HTML_TAG("hr"); + @; + HTML_TAG("hr"); + @ + HTML_TAG("hr"); + @; + @; + @; + +@ = + text_stream *this_area = Metadata::read_optional_textual(an_pack, I"^index_heading"); + text_stream *this_subarea = Metadata::read_optional_textual(an_pack, I"^index_subheading"); + HTML_OPEN("p"); + WRITE("%S - %S
", this_area, this_subarea); + int c = 0; + inter_package *an2_pack; + LOOP_OVER_INVENTORY_PACKAGES(an2_pack, j, inv->action_nodes) { + text_stream *this_area2 = Metadata::read_optional_textual(an2_pack, I"^index_heading"); + text_stream *this_subarea2 = Metadata::read_optional_textual(an2_pack, I"^index_subheading"); + if ((Str::eq(this_area, this_area2)) && (Str::eq(this_subarea, this_subarea2))) { + if (c++ > 0) WRITE(", "); + if (j == i) WRITE(""); + WRITE("%S", Metadata::read_optional_textual(an2_pack, I"^name")); + if (j == i) WRITE(""); + if (j != i) IndexUtilities::detail_link(OUT, "A", j, FALSE); + } + } + HTML_CLOSE("p"); + @ = inter_ti oow = Metadata::read_optional_numeric(an_pack, I"^out_of_world"); inter_ti requires_light = Metadata::read_numeric(an_pack, I"^requires_light"); @@ -104,8 +109,14 @@ void GroupedElement::detail_pages(localisation_dictionary *LD) { if (oow) HTML::end_colour(OUT); WRITE(""); IndexUtilities::link_package(OUT, an_pack); - if (requires_light) WRITE(" (requires light)"); - WRITE(" (past tense %S)", Metadata::read_optional_textual(an_pack, I"^past_name")); + if (requires_light) { + WRITE(" ("); + Localisation::write_0(OUT, LD, I"Index.Elements.A1.RequiresLight"); + WRITE(")"); + } + WRITE(" ("); + Localisation::italic_0(OUT, LD, I"Index.Elements.A1.PastTense"); + WRITE(" %S)", Metadata::read_optional_textual(an_pack, I"^past_name")); text_stream *spec = Metadata::read_optional_textual(an_pack, I"^specification"); if (Str::len(spec) > 0) WRITE(": %S", spec); HTML_CLOSE("p"); @@ -113,36 +124,47 @@ void GroupedElement::detail_pages(localisation_dictionary *LD) { if (Str::len(desc) > 0) { HTML_OPEN("p"); WRITE("%S", desc); HTML_CLOSE("p"); } @ = - HTML_OPEN("p"); WRITE("Typed commands leading to this action\n"); HTML_CLOSE("p"); + HTML_OPEN("p"); + Localisation::bold_0(OUT, LD, I"Index.Elements.A1.CommandsHeading"); + HTML_CLOSE("p"); HTML_OPEN("p"); int producers = 0; inter_package *line_pack; LOOP_THROUGH_SUBPACKAGES(line_pack, an_pack, I"_cg_line") { inter_symbol *xref = Metadata::read_symbol(line_pack, I"^line"); - CommandsElement::index_grammar_line(OUT, Inter::Packages::container(xref->definition), NULL, LD); + CommandsElement::index_grammar_line(OUT, + Inter::Packages::container(xref->definition), NULL, LD); producers++; } - if (producers == 0) WRITE("None"); + if (producers == 0) Localisation::bold_0(OUT, LD, I"Index.Elements.A1.NoCommands"); HTML_CLOSE("p"); @ = if (GroupedElement::no_vars(an_pack, I) > 0) { - HTML_OPEN("p"); WRITE("Named values belonging to this action\n"); HTML_CLOSE("p"); + HTML_OPEN("p"); + Localisation::bold_0(OUT, LD, I"Index.Elements.A1.ValuesHeading"); + HTML_CLOSE("p"); GroupedElement::index_shv_set(OUT, I, an_pack); } @ = - HTML_OPEN("p"); WRITE("Rules controlling this action"); HTML_CLOSE("p"); HTML_OPEN("p"); - WRITE("\n"); + Localisation::bold_0(OUT, LD, I"Index.Elements.A1.RulesHeading"); + HTML_CLOSE("p"); + HTML_OPEN("p"); int resp_count = 0; inter_ti oow = Metadata::read_optional_numeric(an_pack, I"^out_of_world"); if (oow == FALSE) { - resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, NULL, I"persuasion", I"persuasion", LD); - resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, NULL, I"unsuccessful_attempt_by", I"unsuccessful attempt", LD); - resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, NULL, I"setting_action_variables", I"set action variables for", LD); - resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, NULL, I"before", I"before", LD); - resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, NULL, I"instead", I"instead of", LD); + resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, NULL, + I"persuasion", I"persuasion", LD); + resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, NULL, + I"unsuccessful_attempt_by", I"unsuccessful attempt", LD); + resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, NULL, + I"setting_action_variables", I"set action variables for", LD); + resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, NULL, + I"before", I"before", LD); + resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, NULL, + I"instead", I"instead of", LD); } inter_symbol *check_s = Metadata::read_symbol(an_pack, I"^check_rulebook"); inter_symbol *carry_out_s = Metadata::read_symbol(an_pack, I"^carry_out_rulebook"); @@ -151,15 +173,18 @@ void GroupedElement::detail_pages(localisation_dictionary *LD) { inter_package *carry_out_pack = Inter::Packages::container(carry_out_s->definition); inter_package *report_pack = Inter::Packages::container(report_s->definition); - resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, check_pack, I"check", I"check", LD); - resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, carry_out_pack, I"carry_out", I"carry out", LD); + resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, check_pack, + I"check", I"check", LD); + resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, carry_out_pack, + I"carry_out", I"carry out", LD); if (oow == FALSE) - resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, NULL, I"after", I"after", LD); - resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, report_pack, I"report", I"report", LD); + resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, NULL, + I"after", I"after", LD); + resp_count += IndexRules::index_action_rules(OUT, inv, an_pack, report_pack, + I"report", I"report", LD); if (resp_count > 1) { - WRITE("Click on the speech-bubble icons to see the responses, " - "or here to see all of them:"); - WRITE(" "); + Localisation::write_0(OUT, LD, I"Index.Elements.A1.ResponseIcons"); + WRITE(": "); IndexUtilities::extra_all_link_with(OUT, TreeLists::len(inv->rule_nodes), "responses"); WRITE("%d", resp_count); } diff --git a/inter/index-module/Chapter 3/Innards Element.w b/inter/index-module/Chapter 3/Innards Element.w index 0632264ca..fe9144915 100644 --- a/inter/index-module/Chapter 3/Innards Element.w +++ b/inter/index-module/Chapter 3/Innards Element.w @@ -2,7 +2,8 @@ To write the Innards element (In) in the index. -@ Describing the current VM. +@ This element is something of a miscellany, except that it's all about the +technical implementation rather than the content of a work. = void InnardsElement::render(OUTPUT_STREAM, localisation_dictionary *LD) { @@ -15,7 +16,7 @@ void InnardsElement::render(OUTPUT_STREAM, localisation_dictionary *LD) { HTML_OPEN("p"); IndexUtilities::extra_link(OUT, 3); - WRITE("See some technicalities for Inform maintainers only"); + Localisation::write_0(OUT, LD, I"Index.Elements.In.Technicalities"); HTML_CLOSE("p"); IndexUtilities::extra_div_open(OUT, 3, 2, "e0e0e0"); HTML_OPEN("p"); @@ -27,7 +28,9 @@ void InnardsElement::render(OUTPUT_STREAM, localisation_dictionary *LD) { @ = IndexUtilities::anchor(OUT, I"STORYFILE"); - HTML_OPEN("p"); WRITE("Story file format: "); + HTML_OPEN("p"); + Localisation::write_0(OUT, LD, I"Index.Elements.In.Format"); + WRITE(": "); inter_package *pack = Inter::Packages::by_url(I, I"/main/completion/basics"); text_stream *VM = Metadata::read_optional_textual(pack, I"^virtual_machine"); text_stream *VM_icon = Metadata::read_optional_textual(pack, I"^virtual_machine_icon"); @@ -39,14 +42,20 @@ void InnardsElement::render(OUTPUT_STREAM, localisation_dictionary *LD) { HTML_CLOSE("p"); @ = - HTML_OPEN("p"); WRITE("The following use options are in force:"); HTML_CLOSE("p"); - InnardsElement::index_options_in_force_from(OUT, inv, MAIN_TEXT_UO_ORIGIN, NULL); - InnardsElement::index_options_in_force_from(OUT, inv, OPTIONS_FILE_UO_ORIGIN, NULL); + HTML_OPEN("p"); + Localisation::write_0(OUT, LD, I"Index.Elements.In.ActiveUseOptions"); + WRITE(":"); + HTML_CLOSE("p"); + InnardsElement::index_options_in_force_from(OUT, inv, MAIN_TEXT_UO_ORIGIN, NULL, LD); + InnardsElement::index_options_in_force_from(OUT, inv, OPTIONS_FILE_UO_ORIGIN, NULL, LD); inter_package *E; LOOP_OVER_INVENTORY_PACKAGES(E, i, inv->module_nodes) - InnardsElement::index_options_in_force_from(OUT, inv, EXTENSION_UO_ORIGIN, E); + InnardsElement::index_options_in_force_from(OUT, inv, EXTENSION_UO_ORIGIN, E, LD); int c = 0; - HTML_OPEN("p"); WRITE("Whereas these are not in force:"); HTML_CLOSE("p"); + HTML_OPEN("p"); + Localisation::write_0(OUT, LD, I"Index.Elements.In.InactiveUseOptions"); + WRITE(":"); + HTML_CLOSE("p"); HTML::open_indented_p(OUT, 2, "tight"); inter_package *pack; LOOP_OVER_INVENTORY_PACKAGES(pack, i, inv->use_option_nodes) { @@ -57,7 +66,7 @@ void InnardsElement::render(OUTPUT_STREAM, localisation_dictionary *LD) { if (c++ > 0) WRITE(", "); } } - if (c == 0) WRITE("None."); /* in practice, this will never happen */ + if (c == 0) Localisation::write_0(OUT, LD, I"Index.Elements.In.NoUseOptions"); HTML_CLOSE("p"); @ = @@ -70,17 +79,25 @@ void InnardsElement::render(OUTPUT_STREAM, localisation_dictionary *LD) { HTML_CLOSE("span"); @ = - WRITE("Inform language definition:\n"); + HTML_OPEN("p"); + Localisation::write_0(OUT, LD, I"Index.Elements.In.LanguageDefinition"); + WRITE(":"); + HTML_CLOSE("p"); + HTML_OPEN("p"); inter_package *pack = Inter::Packages::by_url(I, I"/main/completion/basics"); text_stream *used = Metadata::read_optional_textual(pack, I"^language_elements_used"); text_stream *not_used = Metadata::read_optional_textual(pack, I"^language_elements_not_used"); - if (Str::len(used) > 0) WRITE("Included: %S", used); - if (Str::len(not_used) > 0) WRITE("
Excluded: %S", not_used); + if (Str::len(used) > 0) + Localisation::write_1(OUT, LD, I"Index.Elements.In.Included", used); + if ((Str::len(used) > 0) && (Str::len(not_used) > 0)) WRITE("
"); + if (Str::len(not_used) > 0) + Localisation::write_1(OUT, LD, I"Index.Elements.In.Excluded", not_used); HTML_CLOSE("p"); @ = HTML_OPEN("p"); - WRITE("Debugging log:"); + Localisation::write_0(OUT, LD, I"Index.Elements.In.Log"); + WRITE(":"); HTML_CLOSE("p"); HTML_OPEN("p"); inter_package *pack = Inter::Packages::by_url(I, I"/main/completion/basics"); @@ -101,36 +118,23 @@ void InnardsElement::render(OUTPUT_STREAM, localisation_dictionary *LD) { } HTML_CLOSE("p"); -@ Now for indexing, where there's nothing much to see. +@ Use options can be set in three general ways, and the following function +answers the question "was this option set in this way?". |E| is meaningless +except for |EXTENSION_UO_ORIGIN|, when we are testing whether it was set in |E|. @d MAIN_TEXT_UO_ORIGIN 1 @d OPTIONS_FILE_UO_ORIGIN 2 @d EXTENSION_UO_ORIGIN 3 = -void InnardsElement::index_options_in_force_from(OUTPUT_STREAM, tree_inventory *inv, int category, inter_package *E) { - int N = 0; - inter_package *pack; - LOOP_OVER_INVENTORY_PACKAGES(pack, i, inv->use_option_nodes) { - inter_ti set = Metadata::read_numeric(pack, I"^active"); - inter_ti sfs = Metadata::read_numeric(pack, I"^source_file_scoped"); - if ((set) && (sfs == FALSE)) { - if (InnardsElement::uo_set_from(pack, category, E)) { - if (N++ == 0) @; - @; - } - } - } -} - -@ And this is what the rest of Inform calls to find out whether a particular -pragma is set: - -= -int InnardsElement::uo_set_from(inter_package *pack, int category, inter_package *E) { - switch (category) { - case MAIN_TEXT_UO_ORIGIN: if (Metadata::read_optional_numeric(pack, I"^used_in_source_text")) return TRUE; break; - case OPTIONS_FILE_UO_ORIGIN: if (Metadata::read_optional_numeric(pack, I"^used_in_options")) return TRUE; break; +int InnardsElement::uo_set_from(inter_package *pack, int way, inter_package *E) { + switch (way) { + case MAIN_TEXT_UO_ORIGIN: + if (Metadata::read_optional_numeric(pack, I"^used_in_source_text")) return TRUE; + break; + case OPTIONS_FILE_UO_ORIGIN: + if (Metadata::read_optional_numeric(pack, I"^used_in_options")) return TRUE; + break; case EXTENSION_UO_ORIGIN: { inter_symbol *id = Metadata::read_optional_symbol(pack, I"^used_in_extension"); if (id) { @@ -143,18 +147,38 @@ int InnardsElement::uo_set_from(inter_package *pack, int category, inter_package return FALSE; } +@ Here we list the UOs set in a particular way, using the same calling conventions. + += +void InnardsElement::index_options_in_force_from(OUTPUT_STREAM, tree_inventory *inv, + int way, inter_package *E, localisation_dictionary *LD) { + int N = 0; + inter_package *pack; + LOOP_OVER_INVENTORY_PACKAGES(pack, i, inv->use_option_nodes) { + inter_ti set = Metadata::read_numeric(pack, I"^active"); + inter_ti sfs = Metadata::read_numeric(pack, I"^source_file_scoped"); + if ((set) && (sfs == FALSE)) { + if (InnardsElement::uo_set_from(pack, way, E)) { + if (N++ == 0) @; + @; + } + } + } +} + @ = HTML::open_indented_p(OUT, 2, "tight"); HTML::begin_colour(OUT, I"808080"); - WRITE("Set from "); - switch (category) { + switch (way) { case MAIN_TEXT_UO_ORIGIN: - WRITE("the source text"); break; + Localisation::write_0(OUT, LD, I"Index.Elements.In.SetFromSource"); + break; case OPTIONS_FILE_UO_ORIGIN: - WRITE("the Options.txt configuration file, or automatically"); + Localisation::write_0(OUT, LD, I"Index.Elements.In.SetAutomatically"); IndexUtilities::DocReferences::link(OUT, I"OPTIONSFILE"); break; case EXTENSION_UO_ORIGIN: - WRITE("%S", Metadata::read_optional_textual(E, I"^credit")); + Localisation::write_1(OUT, LD, I"Index.Elements.In.SetFrom", + Metadata::read_optional_textual(E, I"^credit")); break; } WRITE(":"); @@ -175,6 +199,7 @@ int InnardsElement::uo_set_from(inter_package *pack, int category, inter_package Metadata::read_optional_textual(pack, I"^name"), 2*msv); PasteButtons::paste_text(OUT, TEMP); DISCARD_TEXT(TEMP) - WRITE(" Double this"); + WRITE(" "); + Localisation::italic_0(OUT, LD, I"Index.Elements.In.Double"); } HTML_CLOSE("p"); diff --git a/inter/index-module/Chapter 3/Lexicon Element.w b/inter/index-module/Chapter 3/Lexicon Element.w index c972cdc21..f76dfea87 100644 --- a/inter/index-module/Chapter 3/Lexicon Element.w +++ b/inter/index-module/Chapter 3/Lexicon Element.w @@ -7,13 +7,7 @@ void LexiconElement::render(OUTPUT_STREAM, localisation_dictionary *LD) { IndexUtilities::anchor(OUT, I"LEXICON"); HTML_OPEN("p"); HTML_OPEN_WITH("span", "class=\"smaller\""); - WRITE("For instance, the description 'an unlocked door' is made " - "up from the adjective 'unlocked' and the noun 'door', both of which " - "can be found below. Property adjectives, like 'open', can be used " - "when creating things - 'In the Ballroom is an open container' is " - "allowed because 'open' is a property - but those with complicated " - "definitions, like 'empty', can only be tested during play, e.g. " - "with rules like 'Instead of taking an empty container, ...'."); + Localisation::write_0(OUT, LD, I"Index.Elements.Lx.Explanation"); HTML_CLOSE("span"); HTML_CLOSE("p"); IndexLexicon::listing(OUT, InterpretIndex::get_lexicon(), FALSE, LD); diff --git a/inter/index-module/Chapter 3/Map Element.w b/inter/index-module/Chapter 3/Map Element.w index e7ade2ed6..77f37d244 100644 --- a/inter/index-module/Chapter 3/Map Element.w +++ b/inter/index-module/Chapter 3/Map Element.w @@ -29,8 +29,7 @@ void MapElement::render(OUTPUT_STREAM, localisation_dictionary *D, int test_only @ = faux_instance *I; LOOP_OVER_FAUX_INSTANCES(faux_set, I) - if ((MapElement::no_detail_index(I)) - || (FauxInstances::is_a_direction(I))) + if ((MapElement::no_detail_index(I)) || (FauxInstances::is_a_direction(I))) FauxInstances::increment_indexing_count(I); @ =