+

Utility functions for standing text which may vary by language.


@@ -91,7 +91,7 @@ is available.

It would be elegant to handle this using inform_language objects, but those exist only in the supervisor module, which is a part of inform7 -but not of inter: and this indexing module has to work in both. +but not of inter: and this code has to work in both.

For now, a localisation_dictionary object is just a wrapper for a simple @@ -120,7 +120,7 @@ dictionaries, we might revisit this.

-text_stream *Localisation::read(localisation_dictionary *D, text_stream *key) {
+text_stream *Localisation::read(localisation_dictionary *D, text_stream *key) {
     return Dictionaries::get_text(D->texts, key);
 }
 
@@ -267,7 +267,7 @@ of the keys, substituting textual values in for placeholders. For example, given
 
 %Index.Elements.RS.Unlist = The *1 is not listed in the *2.
 
-

Calling Localisation::write_2 on the key "Index.Elements.RS.Unlist" with +

Calling Localisation::roman_tt on the key "Index.Elements.RS.Unlist" with the values "imports rule" and "customs rulebook" would then produce:

@@ -292,83 +292,79 @@ with everything under the first line being italicised. For example:

-void Localisation::bold_0(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key) {
-    WRITE("<b>");
-    Localisation::write_0(OUT, D, key);
-    WRITE("</b>");
+void Localisation::bold(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key) {
+    WRITE("<b>"); Localisation::roman(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::italic(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key) {
+    WRITE("<i>"); Localisation::roman(OUT, D, key); WRITE("</i>");
 }
 
-void Localisation::write_0(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key) {
+void Localisation::roman(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key) {
     text_stream *vals[10];
-    Vacate the vals5.1;
+    Vacate the vals5.9;
     Localisation::write_general(OUT, D, key, vals);
 }
+
+

§5.1.

-void Localisation::bold_1(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key, +
+void Localisation::bold_t(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
     text_stream *val1) {
-    WRITE("<b>");
-    Localisation::write_1(OUT, D, key, val1);
-    WRITE("</b>");
+    WRITE("<b>"); Localisation::roman_t(OUT, D, key, val1); WRITE("</b>");
 }
-
-void Localisation::italic_1(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
+void Localisation::italic_t(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
     text_stream *val1) {
-    WRITE("<i>");
-    Localisation::write_1(OUT, D, key, val1);
-    WRITE("</i>");
+    WRITE("<i>"); Localisation::roman_t(OUT, D, key, val1); WRITE("</i>");
 }
-
-void Localisation::write_1(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
+void Localisation::roman_t(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
     text_stream *val1) {
     text_stream *vals[10];
-    Vacate the vals5.1;
+    Vacate the vals5.9;
     vals[1] = val1;
     Localisation::write_general(OUT, D, key, vals);
 }
+
+

§5.2.

-void Localisation::write_1n(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key, +
+void Localisation::roman_i(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
     int val1) {
     text_stream *vals[10];
-    Vacate the vals5.1;
+    Vacate the vals5.9;
     TEMPORARY_TEXT(f1)
     WRITE_TO(f1, "%d", val1);
     vals[1] = f1;
     Localisation::write_general(OUT, D, key, vals);
     DISCARD_TEXT(f1)
 }
+
+

§5.3.

-void Localisation::bold_2(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key, +
+void Localisation::bold_tt(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
     text_stream *val1, text_stream *val2) {
-    WRITE("<b>");
-    Localisation::write_2(OUT, D, key, val1, val2);
-    WRITE("</b>");
+    WRITE("<b>"); Localisation::roman_tt(OUT, D, key, val1, val2); WRITE("</b>");
 }
-
-void Localisation::italic_2(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
+void Localisation::italic_tt(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
     text_stream *val1, text_stream *val2) {
-    WRITE("<i>");
-    Localisation::write_2(OUT, D, key, val1, val2);
-    WRITE("</i>");
+    WRITE("<i>"); Localisation::roman_tt(OUT, D, key, val1, val2); WRITE("</i>");
 }
-
-void Localisation::write_2(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
+void Localisation::roman_tt(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
     text_stream *val1, text_stream *val2) {
     text_stream *vals[10];
-    Vacate the vals5.1;
+    Vacate the vals5.9;
     vals[1] = val1; vals[2] = val2;
     Localisation::write_general(OUT, D, key, vals);
 }
+
+

§5.4.

-void Localisation::write_2n(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key, +
+void Localisation::roman_ii(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
     int val1, int val2) {
     text_stream *vals[10];
-    Vacate the vals5.1;
+    Vacate the vals5.9;
     TEMPORARY_TEXT(f1)
     TEMPORARY_TEXT(f2)
     WRITE_TO(f1, "%d", val1);
@@ -378,41 +374,53 @@ with everything under the first line being italicised. For example:
     DISCARD_TEXT(f1)
     DISCARD_TEXT(f2)
 }
+
+

§5.5.

-void Localisation::write_2sn(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key, +
+void Localisation::roman_ti(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
     text_stream *val1, int val2) {
     text_stream *vals[10];
-    Vacate the vals5.1;
+    Vacate the vals5.9;
     TEMPORARY_TEXT(f2)
     WRITE_TO(f2, "%d", val2);
     vals[1] = val1; vals[2] = f2;
     Localisation::write_general(OUT, D, key, vals);
     DISCARD_TEXT(f2)
 }
+
+

§5.6.

-void Localisation::write_2ns(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key, +
+void Localisation::roman_it(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
     int val1, text_stream *val2) {
     text_stream *vals[10];
-    Vacate the vals5.1;
+    Vacate the vals5.9;
     TEMPORARY_TEXT(f1)
     WRITE_TO(f1, "%d", val1);
     vals[1] = f1; vals[2] = val2;
     Localisation::write_general(OUT, D, key, vals);
     DISCARD_TEXT(f1)
 }
+
+

§5.7.

-void Localisation::write_3(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key, +
+void Localisation::write_ttt(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
     text_stream *val1, text_stream *val2, text_stream *val3) {
     text_stream *vals[10];
-    Vacate the vals5.1;
+    Vacate the vals5.9;
     vals[1] = val1; vals[2] = val2; vals[3] = val3;
     Localisation::write_general(OUT, D, key, vals);
 }
+
+

§5.8.

-void Localisation::write_3nsn(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key, +
+void Localisation::write_iti(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
     int val1, text_stream *val2, int val3) {
     text_stream *vals[10];
-    Vacate the vals5.1;
+    Vacate the vals5.9;
     TEMPORARY_TEXT(f1)
     TEMPORARY_TEXT(f3)
     WRITE_TO(f1, "%d", val1);
@@ -423,17 +431,17 @@ with everything under the first line being italicised. For example:
     DISCARD_TEXT(f3)
 }
 
-

§5.1. Vacate the vals5.1 = +

§5.9. Vacate the vals5.9 =

     for (int i=0; i<10; i++) vals[i] = NULL;
 
-
  • This code is used in §5 (9 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;
@@ -459,7 +467,7 @@ with everything under the first line being italicised. For example:
                 while ((i<Str::len(prototype)) && (Str::get_at(prototype, i) != '>'))
                     PUT_TO(link, Str::get_at(prototype, i++));
                 if (Characters::isupper(Str::get_at(link, 0)))
-                    IndexUtilities::DocReferences::link(OUT, link);
+                    DocReferences::link(OUT, link);
                 else WRITE("<%S>", link);
                 DISCARD_TEXT(link)
                 break;
@@ -473,7 +481,7 @@ with everything under the first line being italicised. For example:
 }