diff --git a/README.md b/README.md index 030b371e4..6743bb4d4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Inform 7 -v10.1.0-alpha.1+6S28 'Krypton' (1 June 2021) +v10.1.0-alpha.1+6S29 'Krypton' (2 June 2021) ## About Inform 7 diff --git a/build.txt b/build.txt index 721254e4c..623cc558e 100644 --- a/build.txt +++ b/build.txt @@ -1,3 +1,3 @@ Prerelease: alpha.1 -Build Date: 1 June 2021 -Build Number: 6S28 +Build Date: 2 June 2021 +Build Number: 6S29 diff --git a/docs/assertions-module/3-dbtr.html b/docs/assertions-module/3-dbtr.html index c15c06379..efb929e64 100644 --- a/docs/assertions-module/3-dbtr.html +++ b/docs/assertions-module/3-dbtr.html @@ -265,7 +265,7 @@ whatever was named in column 1: see below. Actually issue PM_TableDefiningTheImpossible problem6.1.1; return; } - if (t) Tables::use_to_define(t, defining_objects, V->next); + if (t) Tables::use_to_define(t, defining_objects, V->next);

§4.1.1.1. Issue PM_TableDefiningObject problem4.1.1.1 = diff --git a/docs/assertions-module/7-tbl.html b/docs/assertions-module/7-tbl.html index 13b9b2584..95e60921a 100644 --- a/docs/assertions-module/7-tbl.html +++ b/docs/assertions-module/7-tbl.html @@ -73,7 +73,7 @@ function togglePopup(material_id) {

To manage and compile tables, which are two-dimensional arrays with associative look-up facilities provided at run-time.

-
+

§1. This is how a table is stored. Note that the limit on columns per table must not rise to 100 or beyond because that would break the system of table @@ -237,7 +237,7 @@ some of these fields have been properly filled in. return t->no_columns; } -int Tables::get_no_rows(table *t) { +int Tables::get_no_rows(table *t) { parse_node *PN; int c=0; for (PN=t->columns[0].entries->down; PN; PN=PN->next) c++; c += t->blank_rows; @@ -372,7 +372,7 @@ table and then destroy the temporary one made here.

-void Tables::create_table(parse_node *PN) {
+void Tables::create_table(parse_node *PN) {
     wording W = Node::get_text(PN);
     int connection = TABLE_IS_NEW;  i.e., no connection with existing tables
 
@@ -983,7 +983,7 @@ columns and in the same order.
 

§18.

-parse_node *Tables::empty_cell_node(void) {
+parse_node *Tables::empty_cell_node(void) {
     return Diagrams::new_PROPER_NOUN(EMPTY_WORDING);
 }
 
@@ -996,7 +996,7 @@ things to be defined. So we exempt it from the checking below.

-void Tables::stock_table(table *t, int phase) {
+void Tables::stock_table(table *t, int phase) {
     LOGIF(TABLES, "Stocking $B (%d cols): phase %d\n", t, t->no_columns, phase);
     table_being_examined = t;
     int i = 0;
@@ -1192,7 +1192,7 @@ people — it needs to be "yourself" instead, since "player" is a variable.
 

§22.

-void Tables::stock_table_cell(table *t, parse_node *cell, int row_count, int col_count) {
+void Tables::stock_table_cell(table *t, parse_node *cell, int row_count, int col_count) {
     current_sentence = cell;
     int topic_exception = FALSE;
     table_cell_node = cell;
@@ -1363,7 +1363,7 @@ at a time:
 

-void Tables::amend_table(table *main_table, table *amendments) {
+void Tables::amend_table(table *main_table, table *amendments) {
     LOGIF(TABLES, "Amending table $B according to $B\n", main_table, amendments);
     parse_node *leftmost_amend_cell = NULL;
     int amend_row = 1, amendment_problem_opened = FALSE;
@@ -1580,7 +1580,7 @@ original:
 

-void Tables::splice_table_row(table *table_to, table *table_from, int row_to, int row_from) {
+void Tables::splice_table_row(table *table_to, table *table_from, int row_to, int row_from) {
     int i;
     for (i=0; i<table_to->no_columns; i++) {
         parse_node *cell_to, *cell_from;
@@ -1597,148 +1597,11 @@ original:
     }
 }
 
-

§26. Indexing. Tables inside extensions are often used just for the storage needed to manage -back-of-house algorithms, so to speak, and they aren't intended for the end -user to poke around with; that's certainly true of the tables in the Standard -Rules, which of course are always present. So these are hidden by default. +

§26. This is called when a table is being asked to define objects (or kinds).

-void Tables::index(OUTPUT_STREAM) {
-    HTML_OPEN("p");
-    int m = Tables::index_tables_in(OUT, NULL, 0);
-    HTML_CLOSE("p");
-    HTML_OPEN("p");
-    Index::extra_link(OUT, 2);
-    if (m > 0) WRITE("Show tables inside extensions too");
-    else WRITE("Show tables inside extensions (there are none in the main text)");
-    HTML_CLOSE("p");
-    Index::extra_div_open(OUT, 2, 1, "e0e0e0");
-    inform_extension *E; int efc = 0;
-    LOOP_OVER(E, inform_extension) Tables::index_tables_in(OUT, E, efc++);
-    Index::extra_div_close(OUT, "e0e0e0");
-}
-
-

§27. This tabulates tables within a given extension, returning the number listed, -and does nothing at all if that number is 0. -

- -
-int Tables::index_tables_in(OUTPUT_STREAM, inform_extension *E, int efc) {
-    int tc = 0; table *t;
-    LOOP_OVER(t, table) if (Tables::table_within(t, E)) tc++;
-    if (tc > 0) {
-        if (E) {
-            HTML_OPEN("p");
-            WRITE("<i>%S</i>", E->as_copy->edition->work->title);
-            HTML_CLOSE("p");
-        }
-        HTML::begin_plain_html_table(OUT);
-        LOOP_OVER(t, table)
-            if (Tables::table_within(t, E))
-                Index this table27.1;
-        HTML::end_html_table(OUT);
-    }
-    return tc;
-}
-
-

§27.1. The following probably ought to use a multiplication sign rather than a -Helvetica-style lower case "x", but life is full of compromises. -

- -

Index this table27.1 = -

- -
-    HTML::first_html_column_spaced(OUT, 0);
-    WRITE("<b>%+W</b>", Node::get_text(t->headline_fragment));
-    table_contribution *tc; int ntc = 0;
-    for (tc = t->table_created_at; tc; tc = tc->next) {
-        if (ntc++ > 0) WRITE(" +");
-        Index::link(OUT, Wordings::first_wn(Node::get_text(tc->source_table)));
-    }
-    HTML::next_html_column_spaced(OUT, 0);
-    int rc = Tables::get_no_rows(t);
-    WRITE("<i>");
-    HTML_OPEN_WITH("span", "class=\"smaller\"");
-    if (t->first_column_by_definition) {
-        WRITE("%d definition%s", rc,
-            (rc == 1)?"":"s");
-    } else {
-        WRITE("%d column%s x %d row%s",
-            t->no_columns, (t->no_columns == 1)?"":"s",
-            rc, (rc == 1)?"":"s");
-    }
-    if (t->blank_rows > 0) {
-        WRITE(" (%d blank", t->blank_rows);
-        if (Wordings::nonempty(t->blank_rows_for_each_text))
-            WRITE(", one for each %+W", t->blank_rows_for_each_text);
-        WRITE(")");
-    }
-    HTML_CLOSE("span");
-    WRITE("</i>");
-    HTML::end_html_row(OUT);
-    int col;
-    for (col = 0; col < t->no_columns; col++) {
-        HTML::first_html_column(OUT, 0);
-        WRITE("&nbsp;&nbsp;col %d:&nbsp;&nbsp;", col+1);
-        wording CW = Nouns::nominative_singular(t->columns[col].column_identity->name);
-        if ((t->first_column_by_definition) && (col == 0)) {
-            parse_node *PN = t->where_used_to_define;
-            WRITE("%+W", Node::get_text(PN));
-            Index::link(OUT, Wordings::first_wn(Node::get_text(PN)));
-        } else {
-            if (t->first_column_by_definition) WRITE("<i>sets</i> ");
-            WRITE("%+W&nbsp;", CW);
-            TEMPORARY_TEXT(TEMP)
-            WRITE_TO(TEMP, "%+W", CW);
-            if (t->first_column_by_definition == FALSE) WRITE_TO(TEMP, " entry");
-            PasteButtons::paste_text(OUT, TEMP);
-            DISCARD_TEXT(TEMP)
-        }
-        HTML::next_html_column(OUT, 0);
-        if ((t->first_column_by_definition) && (col == 0)) {
-            parse_node *cell;
-            int row;
-            for (row = 1, cell = t->columns[0].entries->down; cell; cell = cell->next, row++) {
-                if (row > 1) WRITE(", ");
-                WRITE("%+W", Node::get_text(cell));
-                Index::link(OUT, Wordings::first_wn(Node::get_text(cell)));
-            }
-        } else if (t->first_column_by_definition) {
-            Kinds::Textual::write(OUT,
-                Tables::Columns::get_kind(
-                    t->columns[col].column_identity));
-            WRITE(" property");
-        } else {
-            WRITE("of ");
-            Kinds::Textual::write_plural(OUT,
-                Tables::Columns::get_kind(
-                    t->columns[col].column_identity));
-        }
-        HTML::end_html_row(OUT);
-    }
-
-
  • This code is used in §27.
-

§28. The following laboriously tests whether a table is defined within a -given extension: -

- -
-int Tables::table_within(table *t, inform_extension *E) {
-    if (t->amendment_of) return FALSE;
-    heading *at_heading =
-        Headings::of_wording(Node::get_text(t->table_created_at->source_table));
-    inform_extension *at_E = Headings::get_extension_containing(at_heading);
-    if (E == at_E) return TRUE;
-    return FALSE;
-}
-
-

§29. This is called when a table is being asked to define objects (or kinds). -

- -
-void Tables::use_to_define(table *t, int defining_objects, parse_node *where) {
+void Tables::use_to_define(table *t, int defining_objects, parse_node *where) {
     if (t == NULL) internal_error("no table");
     if (defining_objects == FALSE) {
         t->contains_property_values_at_run_time = TRUE;
diff --git a/docs/assertions-module/7-tc.html b/docs/assertions-module/7-tc.html
index 9caaabb12..e238b1be7 100644
--- a/docs/assertions-module/7-tc.html
+++ b/docs/assertions-module/7-tc.html
@@ -178,7 +178,7 @@ of entry in the column \(C\).
 

-kind *Tables::Columns::get_kind(table_column *tc) {
+kind *Tables::Columns::get_kind(table_column *tc) {
     return tc->kind_stored_in_column;
 }
 
diff --git a/docs/codegen-module/6-ce.html b/docs/codegen-module/6-ce.html
index f64771256..e8ba98296 100644
--- a/docs/codegen-module/6-ce.html
+++ b/docs/codegen-module/6-ce.html
@@ -78,7 +78,7 @@ simplified form of the iFiction record, without the XML overhead.
 

-void CardElement::Library_Card(OUTPUT_STREAM) {
+void CardElement::render(OUTPUT_STREAM) {
     inter_tree *I = Index::get_tree();
     inter_package *pack = Inter::Packages::by_url(I, I"/main/completion/bibliographic");
 
diff --git a/docs/codegen-module/6-ifs.html b/docs/codegen-module/6-ifs.html
index c40caa759..9d28706b1 100644
--- a/docs/codegen-module/6-ifs.html
+++ b/docs/codegen-module/6-ifs.html
@@ -824,10 +824,44 @@ to show, hide and colour things:
 
 void Index::index_actual_element(OUTPUT_STREAM, text_stream *elt) {
     if (Str::eq_wide_string(elt, L"Cd")) {
-        CardElement::Library_Card(OUT);
+        CardElement::render(OUT);
         return;
     }
     #ifdef CORE_MODULE
+    if (Str::eq_wide_string(elt, L"Tb")) {
+        IXTables::render(OUT);
+        return;
+    }
+    if (Str::eq_wide_string(elt, L"In")) {
+        IXInnards::render(OUT, Supervisor::current_vm());
+        return;
+    }
+    if (Str::eq_wide_string(elt, L"Rl")) {
+        IXRelations::render(OUT);
+        return;
+    }
+    if (Str::eq_wide_string(elt, L"Ev")) {
+        IXEvents::render(OUT);
+        return;
+    }
+    if (Str::eq_wide_string(elt, L"RS")) {
+        IXRulesForScenes::render(OUT);
+        return;
+    }
+    if (Str::eq_wide_string(elt, L"Pl")) {
+        IXScenes::render(OUT);
+        return;
+    }
+    if (Str::eq_wide_string(elt, L"Bh")) {
+        IXBehaviour::render(OUT);
+        return;
+    }
+    if (Str::eq_wide_string(elt, L"Fi")) {
+        IXFigures::render(OUT);
+        return;
+    }
+
+
     if (Str::eq_wide_string(elt, L"C")) {
         IndexHeadings::index(OUT);
         IndexExtensions::index(OUT);
@@ -840,20 +874,6 @@ to show, hide and colour things:
         Equations::index(OUT);
         return;
     }
-    if (Str::eq_wide_string(elt, L"Fi")) {
-        IXFigures::index_all(OUT);
-        IXSounds::index_all(OUT);
-        IXExternalFiles::index_all(OUT);
-        return;
-    }
-    if (Str::eq_wide_string(elt, L"Tb")) {
-        Tables::index(OUT);
-        return;
-    }
-    if (Str::eq_wide_string(elt, L"In")) {
-        IXActivities::innards(OUT, Supervisor::current_vm());
-        return;
-    }
 
     if (Str::eq_wide_string(elt, L"Ph")) {
         Phrases::Index::index_page_Phrasebook(OUT);
@@ -863,10 +883,6 @@ to show, hide and colour things:
         IndexLexicon::index(OUT);
         return;
     }
-    if (Str::eq_wide_string(elt, L"Rl")) {
-        IXRelations::index_table(OUT);
-        return;
-    }
     if (Str::eq_wide_string(elt, L"Vb")) {
         IndexLexicon::index_verbs(OUT);
         return;
@@ -891,22 +907,6 @@ to show, hide and colour things:
         return;
     }
 
-    if (Str::eq_wide_string(elt, L"Pl")) {
-        #ifdef IF_MODULE
-        IXScenes::index(OUT);
-        #endif
-        return;
-    }
-    if (Str::eq_wide_string(elt, L"Ev")) {
-        IXRules::index_timed_rules(OUT);  rules which happen at set times of day
-        return;
-    }
-    if (Str::eq_wide_string(elt, L"RS")) {
-        #ifdef IF_MODULE
-        IXScenes::index_rules(OUT);
-        #endif
-        return;
-    }
 
     if (Str::eq_wide_string(elt, L"St")) {
         IXRules::Rules_page(OUT, 1);
@@ -918,33 +918,19 @@ to show, hide and colour things:
     }
 
     if (Str::eq_wide_string(elt, L"A1")) {
-        #ifdef IF_MODULE
         CommandsIndex::page(OUT);
-        #endif
-        return;
-    }
-    if (Str::eq_wide_string(elt, L"Bh")) {
-        #ifdef IF_MODULE
-        IXActions::index_named_patterns(OUT);
-        #endif
         return;
     }
     if (Str::eq_wide_string(elt, L"Cm")) {
-        #ifdef IF_MODULE
         CommandsIndex::commands(OUT);
-        #endif
         return;
     }
     if (Str::eq_wide_string(elt, L"To")) {
-        #ifdef IF_MODULE
         CommandsIndex::tokens(OUT);
-        #endif
         return;
     }
     if (Str::eq_wide_string(elt, L"A2")) {
-        #ifdef IF_MODULE
         CommandsIndex::alphabetical(OUT);
-        #endif
         return;
     }
     #endif
diff --git a/docs/index-module/1-im.html b/docs/index-module/1-im.html
index b48fd8529..cc6c59f2d 100644
--- a/docs/index-module/1-im.html
+++ b/docs/index-module/1-im.html
@@ -95,7 +95,7 @@ which use this module:
 }
 
diff --git a/docs/index-module/2-act.html b/docs/index-module/2-act.html index 1166b99df..e1081b7a0 100644 --- a/docs/index-module/2-act.html +++ b/docs/index-module/2-act.html @@ -72,8 +72,6 @@ function togglePopup(material_id) {

To index activities.

-
-

§1.

@@ -88,7 +86,7 @@ function togglePopup(material_id) {
     struct activity_crossref *next;
 } activity_crossref;
 
-
  • The structure activity_indexing_data is private to this section.
  • The structure activity_crossref is accessed in 2/ins, 2/rls, 3/scn, 4/em and here.
+
  • The structure activity_indexing_data is private to this section.
  • The structure activity_crossref is accessed in 2/ins, 2/rls, 2/te, 3/pe, 4/em and here.

§2.

@@ -133,11 +131,11 @@ function togglePopup(material_id) {
 void IXActivities::index_details(OUTPUT_STREAM, activity *av) {
     int ignore_me = 0;
     IXRules::index_rulebook(OUT, av->before_rules, "before",
-        IXRules::no_rule_context(), &ignore_me);
+        IXRules::no_rule_context(), &ignore_me);
     IXRules::index_rulebook(OUT, av->for_rules, "for",
-        IXRules::no_rule_context(), &ignore_me);
+        IXRules::no_rule_context(), &ignore_me);
     IXRules::index_rulebook(OUT, av->after_rules, "after",
-        IXRules::no_rule_context(), &ignore_me);
+        IXRules::no_rule_context(), &ignore_me);
     IXActivities::index_cross_references(OUT, av);
 }
 
@@ -165,73 +163,8 @@ function togglePopup(material_id) {
     }
 }
 
-

§3. Describing the current VM.

- -
-void IXActivities::innards(OUTPUT_STREAM, target_vm *VM) {
-    IXActivities::index_VM(OUT, VM);
-    NewUseOptions::index(OUT);
-    HTML_OPEN("p");
-    Index::extra_link(OUT, 3);
-    WRITE("See some technicalities for Inform maintainers only");
-    HTML_CLOSE("p");
-    Index::extra_div_open(OUT, 3, 2, "e0e0e0");
-    IXActivities::show_configuration(OUT);
-    Add some paste buttons for the debugging log3.1;
-    Index::extra_div_close(OUT, "e0e0e0");
-}
-
-

§3.1. The index provides some hidden paste icons for these: -

- -

Add some paste buttons for the debugging log3.1 = -

- -
-    HTML_OPEN("p");
-    WRITE("Debugging log:");
-    HTML_CLOSE("p");
-    HTML_OPEN("p");
-    for (int i=0; i<NO_DEFINED_DA_VALUES; i++) {
-        debugging_aspect *da = &(the_debugging_aspects[i]);
-        if (Str::len(da->unhyphenated_name) > 0) {
-            TEMPORARY_TEXT(is)
-            WRITE_TO(is, "Include %S in the debugging log.", da->unhyphenated_name);
-            PasteButtons::paste_text(OUT, is);
-            WRITE("&nbsp;%S", is);
-            DISCARD_TEXT(is)
-            HTML_TAG("br");
-        }
-    }
-    HTML_CLOSE("p");
-
-
  • This code is used in §3.
-

§4.

- -
-void IXActivities::index_VM(OUTPUT_STREAM, target_vm *VM) {
-    if (VM == NULL) internal_error("target VM not set yet");
-    Index::anchor(OUT, I"STORYFILE");
-    HTML_OPEN("p"); WRITE("Story file format: ");
-    ExtensionIndex::plot_icon(OUT, VM);
-    TargetVMs::write(OUT, VM);
-    HTML_CLOSE("p");
-}
-
-

§5.

- -
-void IXActivities::show_configuration(OUTPUT_STREAM) {
-    HTML_OPEN("p");
-    Index::anchor(OUT, I"CONFIG");
-    WRITE("Inform language definition:\n");
-    PluginManager::list_plugins(OUT, "Included", TRUE);
-    PluginManager::list_plugins(OUT, "Excluded", FALSE);
-    HTML_CLOSE("p");
-}
-
diff --git a/docs/index-module/2-adj.html b/docs/index-module/2-adj.html index 1bb1749a4..82b06294c 100644 --- a/docs/index-module/2-adj.html +++ b/docs/index-module/2-adj.html @@ -104,7 +104,7 @@ prefaced "(of a rulebook)", "(of an activity)", and so on.
  • This code is used in §1.
diff --git a/docs/index-module/2-be.html b/docs/index-module/2-be.html new file mode 100644 index 000000000..629863e33 --- /dev/null +++ b/docs/index-module/2-be.html @@ -0,0 +1,104 @@ + + + + Behaviour Element + + + + + + + + + + + + + + + +
+ + +

To index relations.

+ +

§1. A brief table of relations appears on the Phrasebook Index page. +

+ +
+void IXBehaviour::render(OUTPUT_STREAM) {
+    named_action_pattern *nap;
+    int num_naps = NUMBER_CREATED(named_action_pattern);
+
+    if (num_naps == 0) {
+        HTML_OPEN("p");
+        WRITE("No names for kinds of action have yet been defined.");
+        HTML_CLOSE("p");
+    }
+
+    LOOP_OVER(nap, named_action_pattern) {
+        HTML_OPEN("p"); WRITE("<b>%+W</b>", Nouns::nominative_singular(nap->as_noun));
+        Index::link(OUT, Wordings::first_wn(nap->text_of_declaration));
+        HTML_TAG("br");
+        WRITE("&nbsp;&nbsp;<i>defined as any of the following acts:</i>\n");
+        named_action_pattern_entry *nape;
+        LOOP_OVER_LINKED_LIST(nape, named_action_pattern_entry, nap->patterns) {
+            action_pattern *ap = nape->behaviour;
+            HTML_TAG("br");
+            WRITE("&nbsp;&nbsp;&nbsp;&nbsp;%+W", ap->text_of_pattern);
+            Index::link(OUT, Wordings::first_wn(ap->text_of_pattern));
+        }
+        HTML_CLOSE("p");
+    }
+}
+
+ + +
+ + + diff --git a/docs/index-module/2-ee.html b/docs/index-module/2-ee.html new file mode 100644 index 000000000..f99bc25dd --- /dev/null +++ b/docs/index-module/2-ee.html @@ -0,0 +1,140 @@ + + + + Events Element + + + + + + + + + + + + + + + +
+ + +

To index relations.

+ +

§1.

+ +
+void IXEvents::render(OUTPUT_STREAM) {
+    int when_count = 0, tt_count = 0;
+    Index events with no specific time1.1;
+    Index timetabled events1.2;
+    if ((when_count == 0) && (tt_count == 0)) {
+        HTML_OPEN("p"); WRITE("<i>None.</i>"); HTML_CLOSE("p");
+    }
+}
+
+

§1.1. Index events with no specific time1.1 = +

+ +
+    id_body *idb;
+    LOOP_OVER(idb, id_body) {
+        int t = TimedRules::get_timing_of_event(idb->head_of_defn);
+        if (t == NO_FIXED_TIME) {
+            if (when_count == 0) {
+                HTML_OPEN("p");
+                WRITE("<i>Events with no specific time</i>");
+                HTML_CLOSE("p");
+            }
+            when_count++;
+            HTML_OPEN_WITH("p", "class=\"tightin2\"");
+            ImperativeDefinitions::index_preamble(OUT, idb->head_of_defn);
+            if ((ImperativeDefinitions::body_at(idb)) &&
+                (Wordings::nonempty(Node::get_text(ImperativeDefinitions::body_at(idb)))))
+                Index::link(OUT, Wordings::first_wn(Node::get_text(ImperativeDefinitions::body_at(idb))));
+            WRITE(" (where triggered: ");
+            linked_list *L = TimedRules::get_uses_as_event(idb->head_of_defn);
+            parse_node *p;
+            LOOP_OVER_LINKED_LIST(p, parse_node, L)
+                Index::link(OUT, Wordings::first_wn(Node::get_text(p)));
+            WRITE(")");
+            HTML_CLOSE("p");
+        }
+    }
+
+
  • This code is used in §1.
+

§1.2. Index timetabled events1.2 = +

+ +
+    id_body *idb;
+    LOOP_OVER(idb, id_body) {
+        int t = TimedRules::get_timing_of_event(idb->head_of_defn);
+        if (t >= 0) {  i.e., an actual time of day in minutes since midnight
+            if (tt_count == 0) {
+                HTML_OPEN("p");
+                WRITE("<i>Timetable</i>");
+                HTML_CLOSE("p");
+            }
+            tt_count++;
+            HTML_OPEN_WITH("p", "class=\"in2\"");
+            ImperativeDefinitions::index_preamble(OUT, idb->head_of_defn);
+            if ((ImperativeDefinitions::body_at(idb)) &&
+                (Wordings::nonempty(Node::get_text(ImperativeDefinitions::body_at(idb)))))
+                Index::link(OUT, Wordings::first_wn(Node::get_text(ImperativeDefinitions::body_at(idb))));
+            HTML_CLOSE("p");
+        }
+    }
+
+
  • This code is used in §1.
+ + +
+ + + diff --git a/docs/index-module/2-ie.html b/docs/index-module/2-ie.html index 22ac7a8e6..702750bc5 100644 --- a/docs/index-module/2-ie.html +++ b/docs/index-module/2-ie.html @@ -379,7 +379,7 @@ dictionary. }
diff --git a/docs/index-module/2-ie2.html b/docs/index-module/2-ie2.html new file mode 100644 index 000000000..1572c37d6 --- /dev/null +++ b/docs/index-module/2-ie2.html @@ -0,0 +1,149 @@ + + + + Innards Element + + + + + + + + + + + + + + + + + + +
+ + +

To index tables.

+ +
+ +

§1. Describing the current VM.

+ +
+void IXInnards::render(OUTPUT_STREAM, target_vm *VM) {
+    IXInnards::index_VM(OUT, VM);
+    NewUseOptions::index(OUT);
+    HTML_OPEN("p");
+    Index::extra_link(OUT, 3);
+    WRITE("See some technicalities for Inform maintainers only");
+    HTML_CLOSE("p");
+    Index::extra_div_open(OUT, 3, 2, "e0e0e0");
+    IXInnards::show_configuration(OUT);
+    Add some paste buttons for the debugging log1.1;
+    Index::extra_div_close(OUT, "e0e0e0");
+}
+
+

§1.1. The index provides some hidden paste icons for these: +

+ +

Add some paste buttons for the debugging log1.1 = +

+ +
+    HTML_OPEN("p");
+    WRITE("Debugging log:");
+    HTML_CLOSE("p");
+    HTML_OPEN("p");
+    for (int i=0; i<NO_DEFINED_DA_VALUES; i++) {
+        debugging_aspect *da = &(the_debugging_aspects[i]);
+        if (Str::len(da->unhyphenated_name) > 0) {
+            TEMPORARY_TEXT(is)
+            WRITE_TO(is, "Include %S in the debugging log.", da->unhyphenated_name);
+            PasteButtons::paste_text(OUT, is);
+            WRITE("&nbsp;%S", is);
+            DISCARD_TEXT(is)
+            HTML_TAG("br");
+        }
+    }
+    HTML_CLOSE("p");
+
+
  • This code is used in §1.
+

§2.

+ +
+void IXInnards::index_VM(OUTPUT_STREAM, target_vm *VM) {
+    if (VM == NULL) internal_error("target VM not set yet");
+    Index::anchor(OUT, I"STORYFILE");
+    HTML_OPEN("p"); WRITE("Story file format: ");
+    ExtensionIndex::plot_icon(OUT, VM);
+    TargetVMs::write(OUT, VM);
+    HTML_CLOSE("p");
+}
+
+

§3.

+ +
+void IXInnards::show_configuration(OUTPUT_STREAM) {
+    HTML_OPEN("p");
+    Index::anchor(OUT, I"CONFIG");
+    WRITE("Inform language definition:\n");
+    PluginManager::list_plugins(OUT, "Included", TRUE);
+    PluginManager::list_plugins(OUT, "Excluded", FALSE);
+    HTML_CLOSE("p");
+}
+
+ + +
+ + + diff --git a/docs/index-module/2-ih.html b/docs/index-module/2-ih.html index 6c61f65b5..953208bde 100644 --- a/docs/index-module/2-ih.html +++ b/docs/index-module/2-ih.html @@ -179,7 +179,7 @@ surreptitiously check that it is correctly formed at the same time. } }
-
  • The structure contents_entry is accessed in 2/ins, 2/rls, 2/act, 3/scn, 4/em and here.
+
  • The structure contents_entry is accessed in 2/ins, 2/rls, 2/act, 2/te, 3/pe, 4/em and here.

§3.1. Index this entry in the contents3.1 =

@@ -360,7 +360,7 @@ but should this arise then the best recourse is to ignore the heading.
diff --git a/docs/index-module/2-inf.html b/docs/index-module/2-inf.html index 3c9ff49f9..b1e133351 100644 --- a/docs/index-module/2-inf.html +++ b/docs/index-module/2-inf.html @@ -194,7 +194,7 @@ state of being boolean, and the given certainty levels: }
diff --git a/docs/index-module/2-ins.html b/docs/index-module/2-ins.html index b0e3c618d..a78f6458c 100644 --- a/docs/index-module/2-ins.html +++ b/docs/index-module/2-ins.html @@ -89,7 +89,7 @@ function togglePopup(material_id) { struct instance_usage *next; } instance_usage;
- +

§2.

@@ -203,7 +203,7 @@ constant value.
 }
 
diff --git a/docs/index-module/2-ipw.html b/docs/index-module/2-ipw.html index e2aae6468..0066ba33a 100644 --- a/docs/index-module/2-ipw.html +++ b/docs/index-module/2-ipw.html @@ -509,7 +509,7 @@ table of Kinds. } diff --git a/docs/index-module/2-ki.html b/docs/index-module/2-ki.html index 42f54bd14..33f807465 100644 --- a/docs/index-module/2-ki.html +++ b/docs/index-module/2-ki.html @@ -571,7 +571,7 @@ as "0 kg", "0 hectares", or whatever is appropriate. diff --git a/docs/index-module/2-li.html b/docs/index-module/2-li.html index 0061a4c09..ada2f74ce 100644 --- a/docs/index-module/2-li.html +++ b/docs/index-module/2-li.html @@ -684,7 +684,7 @@ be able to print out a table of just those verbs created in that extension. if (vu->where_vu_created) Index::link(OUT, Wordings::first_wn(Node::get_text(vu->where_vu_created))); binary_predicate *bp = VerbMeanings::get_regular_meaning_of_form(Verbs::base_form(VerbUsages::get_verb(vu))); - if (bp) IXRelations::index_for_verbs(OUT, bp); + if (bp) IndexLexicon::show_relation(OUT, bp); return; } preposition *prep; @@ -693,13 +693,26 @@ be able to print out a table of just those verbs created in that extension. if (prep->where_prep_created) Index::link(OUT, Wordings::first_wn(Node::get_text(prep->where_prep_created))); binary_predicate *bp = VerbMeanings::get_regular_meaning_of_form(Verbs::find_form(copular_verb, prep, NULL)); - if (bp) IXRelations::index_for_verbs(OUT, bp); + if (bp) IndexLexicon::show_relation(OUT, bp); return; } } + +void IndexLexicon::show_relation(OUTPUT_STREAM, binary_predicate *bp) { + WRITE(" ... <i>"); + if (bp == NULL) WRITE("(a meaning internal to Inform)"); + else { + if (bp->right_way_round == FALSE) { + bp = bp->reversal; + WRITE("reversed "); + } + WordAssemblages::index(OUT, &(bp->relation_name)); + } + WRITE("</i>"); +} diff --git a/docs/index-module/2-pi.html b/docs/index-module/2-pi.html index 826a1bb44..4de1897f0 100644 --- a/docs/index-module/2-pi.html +++ b/docs/index-module/2-pi.html @@ -501,7 +501,7 @@ so we won't list them here. } diff --git a/docs/index-module/2-prp.html b/docs/index-module/2-prp.html index ad60125e1..ed0887245 100644 --- a/docs/index-module/2-prp.html +++ b/docs/index-module/2-prp.html @@ -143,7 +143,7 @@ function togglePopup(material_id) { } diff --git a/docs/index-module/2-rlt.html b/docs/index-module/2-re.html similarity index 75% rename from docs/index-module/2-rlt.html rename to docs/index-module/2-re.html index b56504f2b..7f99e0e92 100644 --- a/docs/index-module/2-rlt.html +++ b/docs/index-module/2-re.html @@ -1,7 +1,7 @@ - Relations + Relations Element @@ -12,14 +12,6 @@ - - - @@ -67,16 +59,16 @@ function togglePopup(material_id) {
- + +

To index relations.

§1. A brief table of relations appears on the Phrasebook Index page.

-void IXRelations::index_table(OUTPUT_STREAM) {
+void IXRelations::render(OUTPUT_STREAM) {
     binary_predicate *bp;
     HTML_OPEN("p");
     HTML::begin_plain_html_table(OUT);
@@ -105,25 +97,8 @@ function togglePopup(material_id) {
     HTML_CLOSE("p");
 }
 
-

§2. And a briefer note still for the table of verbs. -

- -
-void IXRelations::index_for_verbs(OUTPUT_STREAM, binary_predicate *bp) {
-    WRITE(" ... <i>");
-    if (bp == NULL) WRITE("(a meaning internal to Inform)");
-    else {
-        if (bp->right_way_round == FALSE) {
-            bp = bp->reversal;
-            WRITE("reversed ");
-        }
-        WordAssemblages::index(OUT, &(bp->relation_name));
-    }
-    WRITE("</i>");
-}
-
diff --git a/docs/index-module/2-rfse.html b/docs/index-module/2-rfse.html new file mode 100644 index 000000000..736f3f22e --- /dev/null +++ b/docs/index-module/2-rfse.html @@ -0,0 +1,91 @@ + + + + Rules for Scenes Element + + + + + + + + + + + + + + + +
+ + +

The RS element.

+ +

§1.

+ +
+void IXRulesForScenes::render(OUTPUT_STREAM) {
+    HTML_OPEN("p"); WRITE("<b>The scene-changing machinery</b>"); HTML_CLOSE("p");
+    IXRules::index_rules_box(OUT, "Scene changing", EMPTY_WORDING, NULL,
+        Rulebooks::std(SCENE_CHANGING_RB), NULL, NULL, 1, FALSE);
+    HTML_OPEN("p");
+    Index::anchor(OUT, I"SRULES");
+    WRITE("<b>General rules applying to scene changes</b>");
+    HTML_CLOSE("p");
+    IXRules::index_rules_box(OUT, "When a scene begins", EMPTY_WORDING, NULL,
+        Rulebooks::std(WHEN_SCENE_BEGINS_RB), NULL, NULL, 1, FALSE);
+    IXRules::index_rules_box(OUT, "When a scene ends", EMPTY_WORDING, NULL,
+        Rulebooks::std(WHEN_SCENE_ENDS_RB), NULL, NULL, 1, FALSE);
+}
+
+ + +
+ + + diff --git a/docs/index-module/2-rls.html b/docs/index-module/2-rls.html index d592cf5dd..21ea333a7 100644 --- a/docs/index-module/2-rls.html +++ b/docs/index-module/2-rls.html @@ -72,7 +72,7 @@ function togglePopup(material_id) {

To index rules and rulebooks.

-
+

§1. Indexing. Some rules are provided with index text:

@@ -172,7 +172,7 @@ function togglePopup(material_id) { if (R->responses[l].message) { if (c == 0) Index::extra_div_open_nested(OUT, 1000000+R->allocation_id, 2); else HTML_TAG("br"); - IXRules::index_response(OUT, R, l, R->responses[l].message); + IXRules::index_response(OUT, R, l, R->responses[l].message); c++; } if (c > 0) Index::extra_div_close_nested(OUT); @@ -564,14 +564,8 @@ popular rulebooks, showing their contents in logical order. return nb; } -void IXRules::index_scene(OUTPUT_STREAM) { - HTML_OPEN("p"); WRITE("<b>The scene-changing machinery</b>"); HTML_CLOSE("p"); - IXRules::index_rules_box(OUT, "Scene changing", EMPTY_WORDING, NULL, - Rulebooks::std(SCENE_CHANGING_RB), NULL, NULL, 1, FALSE); -} - int unique_xtra_no = 0; -void IXRules::index_rules_box(OUTPUT_STREAM, char *name, wording W, text_stream *doc_link, +void IXRules::index_rules_box(OUTPUT_STREAM, char *name, wording W, text_stream *doc_link, rulebook *rb, activity *av, char *text, int indent, int hide_behind_plus) { int xtra_no = 0; if (rb) xtra_no = rb->allocation_id; @@ -653,7 +647,7 @@ popular rulebooks, showing their contents in logical order. if (rb) { int ignore_me = 0; IXRules::index_rulebook(OUT, rb, "", - IXRules::no_rule_context(), &ignore_me); + IXRules::no_rule_context(), &ignore_me); } if (av) IXActivities::index_details(OUT, av); } @@ -689,7 +683,7 @@ popular rulebooks, showing their contents in logical order.

§8.

-int IXRules::index_rulebook(OUTPUT_STREAM, rulebook *rb, char *billing, rule_context rc, int *resp_count) {
+int IXRules::index_rulebook(OUTPUT_STREAM, rulebook *rb, char *billing, rule_context rc, int *resp_count) {
     int suppress_outcome = FALSE, t;
     if (rb == NULL) return 0;
     if (billing == NULL) internal_error("No billing for rb index");
@@ -706,14 +700,14 @@ popular rulebooks, showing their contents in logical order.
 }
 
 #ifdef IF_MODULE
-void IXRules::index_action_rules(OUTPUT_STREAM, action_name *an, rulebook *rb,
+void IXRules::index_action_rules(OUTPUT_STREAM, action_name *an, rulebook *rb,
     int code, char *desc, int *resp_count) {
     int t = 0;
     IXRules::list_suppress_indexed_links();
     if (code >= 0) t += IXRules::index_rulebook(OUT, Rulebooks::std(code), desc,
-        IXRules::action_context(an), resp_count);
+        IXRules::action_context(an), resp_count);
     if (rb) t += IXRules::index_rulebook(OUT, rb, desc,
-        IXRules::no_rule_context(), resp_count);
+        IXRules::no_rule_context(), resp_count);
     IXRules::list_resume_indexed_links();
     if (t > 0) HTML_TAG("br");
 }
@@ -756,7 +750,7 @@ have affected it in this way:
     return t;
 }
 
-void IXRules::rb_index_placements(OUTPUT_STREAM, rulebook *rb) {
+void IXRules::rb_index_placements(OUTPUT_STREAM, rulebook *rb) {
     placement_affecting *npl = rb->indexing_data.placement_list;
     while (npl) {
         WRITE("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
@@ -769,7 +763,7 @@ have affected it in this way:
     }
 }
 
-void IXRules::index_outcomes(OUTPUT_STREAM, outcomes *outs, int suppress_outcome) {
+void IXRules::index_outcomes(OUTPUT_STREAM, outcomes *outs, int suppress_outcome) {
     if (suppress_outcome == FALSE) {
         rulebook_outcome *ro;
         LOOP_OVER_LINKED_LIST(ro, rulebook_outcome, outs->named_outcomes) {
@@ -802,74 +796,8 @@ have affected it in this way:
     }
 }
 
- -

§10.

- -
-void IXRules::index_timed_rules(OUTPUT_STREAM) {
-    int when_count = 0, tt_count = 0;
-    Index events with no specific time10.1;
-    Index timetabled events10.2;
-    if ((when_count == 0) && (tt_count == 0)) {
-        HTML_OPEN("p"); WRITE("<i>None.</i>"); HTML_CLOSE("p");
-    }
-}
-
-

§10.1. Index events with no specific time10.1 = -

- -
-    id_body *idb;
-    LOOP_OVER(idb, id_body) {
-        int t = TimedRules::get_timing_of_event(idb->head_of_defn);
-        if (t == NO_FIXED_TIME) {
-            if (when_count == 0) {
-                HTML_OPEN("p");
-                WRITE("<i>Events with no specific time</i>");
-                HTML_CLOSE("p");
-            }
-            when_count++;
-            HTML_OPEN_WITH("p", "class=\"tightin2\"");
-            ImperativeDefinitions::index_preamble(OUT, idb->head_of_defn);
-            if ((ImperativeDefinitions::body_at(idb)) &&
-                (Wordings::nonempty(Node::get_text(ImperativeDefinitions::body_at(idb)))))
-                Index::link(OUT, Wordings::first_wn(Node::get_text(ImperativeDefinitions::body_at(idb))));
-            WRITE(" (where triggered: ");
-            linked_list *L = TimedRules::get_uses_as_event(idb->head_of_defn);
-            parse_node *p;
-            LOOP_OVER_LINKED_LIST(p, parse_node, L)
-                Index::link(OUT, Wordings::first_wn(Node::get_text(p)));
-            WRITE(")");
-            HTML_CLOSE("p");
-        }
-    }
-
- -

§10.2. Index timetabled events10.2 = -

- -
-    id_body *idb;
-    LOOP_OVER(idb, id_body) {
-        int t = TimedRules::get_timing_of_event(idb->head_of_defn);
-        if (t >= 0) {  i.e., an actual time of day in minutes since midnight
-            if (tt_count == 0) {
-                HTML_OPEN("p");
-                WRITE("<i>Timetable</i>");
-                HTML_CLOSE("p");
-            }
-            tt_count++;
-            HTML_OPEN_WITH("p", "class=\"in2\"");
-            ImperativeDefinitions::index_preamble(OUT, idb->head_of_defn);
-            if ((ImperativeDefinitions::body_at(idb)) &&
-                (Wordings::nonempty(Node::get_text(ImperativeDefinitions::body_at(idb)))))
-                Index::link(OUT, Wordings::first_wn(Node::get_text(ImperativeDefinitions::body_at(idb))));
-            HTML_CLOSE("p");
-        }
-    }
-
- -

§11. Rule contexts. These are mainly (only?) used in indexing, as a way to represent the idea of +

+

§10. Rule contexts. These are mainly (only?) used in indexing, as a way to represent the idea of being the relevant scene or action for a rule.

@@ -879,20 +807,20 @@ being the relevant scene or action for a rule. struct scene *scene_context; } rule_context; -rule_context IXRules::action_context(action_name *an) { +rule_context IXRules::action_context(action_name *an) { rule_context rc; rc.action_context = an; rc.scene_context = NULL; return rc; } -rule_context IXRules::scene_context(scene *s) { +rule_context IXRules::scene_context(scene *s) { rule_context rc; rc.action_context = NULL; rc.scene_context = s; return rc; } -rule_context IXRules::no_rule_context(void) { +rule_context IXRules::no_rule_context(void) { rule_context rc; rc.action_context = NULL; rc.scene_context = NULL; @@ -907,12 +835,12 @@ being the relevant scene or action for a rule. } -

§12. When we index a response, we also provide a paste button for the source +

§11. When we index a response, we also provide a paste button for the source text to assert a change:

-void IXRules::index_response(OUTPUT_STREAM, rule *R, int marker, response_message *resp) {
+void IXRules::index_response(OUTPUT_STREAM, rule *R, int marker, response_message *resp) {
     WRITE("&nbsp;&nbsp;&nbsp;&nbsp;");
     HTML_OPEN_WITH("span",
         "style=\"color: #ffffff; "
@@ -936,7 +864,7 @@ text to assert a change:
 }
 
diff --git a/docs/index-module/2-te.html b/docs/index-module/2-te.html new file mode 100644 index 000000000..3cb5e198c --- /dev/null +++ b/docs/index-module/2-te.html @@ -0,0 +1,221 @@ + + + + Tables Element + + + + + + + + + + + + + + + + + + +
+ + +

To index tables.

+ +
+ +

§1. Indexing. Tables inside extensions are often used just for the storage needed to manage +back-of-house algorithms, so to speak, and they aren't intended for the end +user to poke around with; that's certainly true of the tables in the Standard +Rules, which of course are always present. So these are hidden by default. +

+ +
+void IXTables::render(OUTPUT_STREAM) {
+    HTML_OPEN("p");
+    int m = IXTables::index_tables_in(OUT, NULL, 0);
+    HTML_CLOSE("p");
+    HTML_OPEN("p");
+    Index::extra_link(OUT, 2);
+    if (m > 0) WRITE("Show tables inside extensions too");
+    else WRITE("Show tables inside extensions (there are none in the main text)");
+    HTML_CLOSE("p");
+    Index::extra_div_open(OUT, 2, 1, "e0e0e0");
+    inform_extension *E; int efc = 0;
+    LOOP_OVER(E, inform_extension) IXTables::index_tables_in(OUT, E, efc++);
+    Index::extra_div_close(OUT, "e0e0e0");
+}
+
+

§2. This tabulates tables within a given extension, returning the number listed, +and does nothing at all if that number is 0. +

+ +
+int IXTables::index_tables_in(OUTPUT_STREAM, inform_extension *E, int efc) {
+    int tc = 0; table *t;
+    LOOP_OVER(t, table) if (IXTables::table_within(t, E)) tc++;
+    if (tc > 0) {
+        if (E) {
+            HTML_OPEN("p");
+            WRITE("<i>%S</i>", E->as_copy->edition->work->title);
+            HTML_CLOSE("p");
+        }
+        HTML::begin_plain_html_table(OUT);
+        LOOP_OVER(t, table)
+            if (IXTables::table_within(t, E))
+                Index this table2.1;
+        HTML::end_html_table(OUT);
+    }
+    return tc;
+}
+
+

§2.1. The following probably ought to use a multiplication sign rather than a +Helvetica-style lower case "x", but life is full of compromises. +

+ +

Index this table2.1 = +

+ +
+    HTML::first_html_column_spaced(OUT, 0);
+    WRITE("<b>%+W</b>", Node::get_text(t->headline_fragment));
+    table_contribution *tc; int ntc = 0;
+    for (tc = t->table_created_at; tc; tc = tc->next) {
+        if (ntc++ > 0) WRITE(" +");
+        Index::link(OUT, Wordings::first_wn(Node::get_text(tc->source_table)));
+    }
+    HTML::next_html_column_spaced(OUT, 0);
+    int rc = Tables::get_no_rows(t);
+    WRITE("<i>");
+    HTML_OPEN_WITH("span", "class=\"smaller\"");
+    if (t->first_column_by_definition) {
+        WRITE("%d definition%s", rc,
+            (rc == 1)?"":"s");
+    } else {
+        WRITE("%d column%s x %d row%s",
+            t->no_columns, (t->no_columns == 1)?"":"s",
+            rc, (rc == 1)?"":"s");
+    }
+    if (t->blank_rows > 0) {
+        WRITE(" (%d blank", t->blank_rows);
+        if (Wordings::nonempty(t->blank_rows_for_each_text))
+            WRITE(", one for each %+W", t->blank_rows_for_each_text);
+        WRITE(")");
+    }
+    HTML_CLOSE("span");
+    WRITE("</i>");
+    HTML::end_html_row(OUT);
+    int col;
+    for (col = 0; col < t->no_columns; col++) {
+        HTML::first_html_column(OUT, 0);
+        WRITE("&nbsp;&nbsp;col %d:&nbsp;&nbsp;", col+1);
+        wording CW = Nouns::nominative_singular(t->columns[col].column_identity->name);
+        if ((t->first_column_by_definition) && (col == 0)) {
+            parse_node *PN = t->where_used_to_define;
+            WRITE("%+W", Node::get_text(PN));
+            Index::link(OUT, Wordings::first_wn(Node::get_text(PN)));
+        } else {
+            if (t->first_column_by_definition) WRITE("<i>sets</i> ");
+            WRITE("%+W&nbsp;", CW);
+            TEMPORARY_TEXT(TEMP)
+            WRITE_TO(TEMP, "%+W", CW);
+            if (t->first_column_by_definition == FALSE) WRITE_TO(TEMP, " entry");
+            PasteButtons::paste_text(OUT, TEMP);
+            DISCARD_TEXT(TEMP)
+        }
+        HTML::next_html_column(OUT, 0);
+        if ((t->first_column_by_definition) && (col == 0)) {
+            parse_node *cell;
+            int row;
+            for (row = 1, cell = t->columns[0].entries->down; cell; cell = cell->next, row++) {
+                if (row > 1) WRITE(", ");
+                WRITE("%+W", Node::get_text(cell));
+                Index::link(OUT, Wordings::first_wn(Node::get_text(cell)));
+            }
+        } else if (t->first_column_by_definition) {
+            Kinds::Textual::write(OUT,
+                Tables::Columns::get_kind(
+                    t->columns[col].column_identity));
+            WRITE(" property");
+        } else {
+            WRITE("of ");
+            Kinds::Textual::write_plural(OUT,
+                Tables::Columns::get_kind(
+                    t->columns[col].column_identity));
+        }
+        HTML::end_html_row(OUT);
+    }
+
+ +

§3. The following laboriously tests whether a table is defined within a +given extension: +

+ +
+int IXTables::table_within(table *t, inform_extension *E) {
+    if (t->amendment_of) return FALSE;
+    heading *at_heading =
+        Headings::of_wording(Node::get_text(t->table_created_at->source_table));
+    inform_extension *at_E = Headings::get_extension_containing(at_heading);
+    if (E == at_E) return TRUE;
+    return FALSE;
+}
+
+ + +
+ + + diff --git a/docs/index-module/2-vrb.html b/docs/index-module/2-vrb.html index edaa217ce..014010396 100644 --- a/docs/index-module/2-vrb.html +++ b/docs/index-module/2-vrb.html @@ -162,7 +162,7 @@ the following: } diff --git a/docs/index-module/3-act.html b/docs/index-module/3-act.html index 09f1422a8..cbc15d6ec 100644 --- a/docs/index-module/3-act.html +++ b/docs/index-module/3-act.html @@ -240,32 +240,6 @@ function togglePopup(material_id) { WRITE(" "); } -void IXActions::index_named_patterns(OUTPUT_STREAM) { - named_action_pattern *nap; - int num_naps = NUMBER_CREATED(named_action_pattern); - - if (num_naps == 0) { - HTML_OPEN("p"); - WRITE("No names for kinds of action have yet been defined."); - HTML_CLOSE("p"); - } - - LOOP_OVER(nap, named_action_pattern) { - HTML_OPEN("p"); WRITE("<b>%+W</b>", Nouns::nominative_singular(nap->as_noun)); - Index::link(OUT, Wordings::first_wn(nap->text_of_declaration)); - HTML_TAG("br"); - WRITE("&nbsp;&nbsp;<i>defined as any of the following acts:</i>\n"); - named_action_pattern_entry *nape; - LOOP_OVER_LINKED_LIST(nape, named_action_pattern_entry, nap->patterns) { - action_pattern *ap = nape->behaviour; - HTML_TAG("br"); - WRITE("&nbsp;&nbsp;&nbsp;&nbsp;%+W", ap->text_of_pattern); - Index::link(OUT, Wordings::first_wn(ap->text_of_pattern)); - } - HTML_CLOSE("p"); - } -} - void IXActions::index_named_patterns_for_extension(OUTPUT_STREAM, source_file *sf, inform_extension *E) { named_action_pattern *nap; int kc = 0; @@ -278,7 +252,7 @@ function togglePopup(material_id) { diff --git a/docs/index-module/3-bck.html b/docs/index-module/3-bck.html index 918bc0979..afac4ad12 100644 --- a/docs/index-module/3-bck.html +++ b/docs/index-module/3-bck.html @@ -119,7 +119,7 @@ adds backdrop contents to a room called
  • This code is used in §1.
  • diff --git a/docs/index-module/3-ci.html b/docs/index-module/3-ci.html index d701f4dc2..62fc783c7 100644 --- a/docs/index-module/3-ci.html +++ b/docs/index-module/3-ci.html @@ -577,7 +577,7 @@ the HTML index. } diff --git a/docs/index-module/3-ef.html b/docs/index-module/3-ef.html deleted file mode 100644 index 6b8198a20..000000000 --- a/docs/index-module/3-ef.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - External Files - - - - - - - - - - - - - - - -
    - - -

    To produce the index of external files.

    - -

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

    - -
    -void IXExternalFiles::index_all(OUTPUT_STREAM) {
    -    if (PluginManager::active(files_plugin) == FALSE) return;
    -    files_data *exf;
    -    if (NUMBER_CREATED(files_data) == 0) {
    -        HTML_OPEN("p");
    -        WRITE("This project doesn't read or write external files.");
    -        HTML_CLOSE("p");
    -        return;
    -    }
    -    HTML_OPEN("p");
    -    WRITE("<b>List of External Files</b>");
    -    HTML_CLOSE("p");
    -    HTML::begin_html_table(OUT, "#ffffff", TRUE, 0, 0, 0, 0, 0);
    -    LOOP_OVER(exf, files_data) {
    -        HTML::first_html_column(OUT, THUMBNAIL_WIDTH+10);
    -        if (exf->file_is_binary) {
    -            HTML_TAG_WITH("img", "border=\"0\" src=\"inform:/doc_images/exf_binary.png\"");
    -        } else {
    -            HTML_TAG_WITH("img", "border=\"0\" src=\"inform:/doc_images/exf_text.png\"");
    -        }
    -        WRITE("&nbsp;");
    -        HTML::next_html_column(OUT, 0);
    -        WRITE("%+W", exf->name);
    -        Index::link(OUT, Wordings::first_wn(exf->name));
    -        HTML_TAG("br");
    -        WRITE("Filename: %s %N- owned by ",
    -            (exf->file_is_binary)?"- binary ":"",
    -            exf->unextended_filename);
    -        switch (exf->file_ownership) {
    -            case OWNED_BY_THIS_PROJECT: WRITE("this project"); break;
    -            case OWNED_BY_ANOTHER_PROJECT: WRITE("another project"); break;
    -            case OWNED_BY_SPECIFIC_PROJECT:
    -                WRITE("project with IFID number <b>%S</b>",
    -                    exf->IFID_of_owner);
    -                break;
    -        }
    -        HTML::end_html_row(OUT);
    -    }
    -    HTML::end_html_table(OUT);
    -    HTML_OPEN("p");
    -}
    -
    - - -
    - - - diff --git a/docs/index-module/3-fe.html b/docs/index-module/3-fe.html new file mode 100644 index 000000000..2d2073aa9 --- /dev/null +++ b/docs/index-module/3-fe.html @@ -0,0 +1,347 @@ + + + + Figures Element + + + + + + + + + + + + + + + + + + +
    + + +

    To produce the index of figures.

    + +
    + +

    §1.

    + +
    +void IXFigures::render(OUTPUT_STREAM) {
    +    IXFigures::index_all(OUT);
    +    IXFigures::index_sounds(OUT);
    +    IXFigures::index_files(OUT);
    +}
    +
    +

    §2. The index 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
    +
    +
    +void IXFigures::index_all(OUTPUT_STREAM) {
    +    if (PluginManager::active(figures_plugin) == FALSE) return;
    +    figures_data *bf; FILE *FIGURE_FILE;
    +    int MAX_INDEXED_FIGURES = global_compilation_settings.index_figure_thumbnails;
    +    int rv;
    +    if (NUMBER_CREATED(figures_data) < 2) {  cover art always creates 1
    +        HTML_OPEN("p"); WRITE("There are no figures, or illustrations, in this project.");
    +        HTML_CLOSE("p"); return;
    +    }
    +    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;
    +    LOOP_OVER(bf, figures_data) {
    +        if (bf->figure_number > 1) {
    +            TEMPORARY_TEXT(line2)
    +            unsigned int width = 0, height = 0;
    +            rv = 0;
    +            FIGURE_FILE = Filenames::fopen(bf->filename_of_image_file, "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(bf->filename_of_image_file, "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>");
    +                    HTML_TAG("br");
    +                } else {
    +                    WRITE_TO(line2, "%s format: %d (width) by %d (height) pixels",
    +                        real_format, width, height);
    +                    HTML_TAG("br");
    +                }
    +            } else {
    +                WRITE_TO(line2, "<i>Missing from the Figures folder</i>");
    +                HTML_TAG("br");
    +            }
    +            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\"",
    +                    bf->filename_of_image_file, 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("%+W", bf->name);
    +            Index::link(OUT, Wordings::first_wn(bf->name));
    +
    +            TEMPORARY_TEXT(rel)
    +            Filenames::to_text_relative(rel, bf->filename_of_image_file,
    +                Projects::materials_path(Task::project()));
    +            HTML_TAG("br");
    +            WRITE("%SFilename: \"%S\" - resource number %d", line2, rel, bf->figure_number);
    +            DISCARD_TEXT(rel)
    +            HTML::end_html_row(OUT);
    +            DISCARD_TEXT(line2)
    +        }
    +    }
    +    HTML::end_html_table(OUT);
    +    HTML_OPEN("p");
    +    if (count_of_displayed_figures > MAX_INDEXED_FIGURES) {
    +        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.)",
    +            MAX_INDEXED_FIGURES, 10*MAX_INDEXED_FIGURES);
    +        HTML_CLOSE("p");
    +    }
    +}
    +
    +

    §3. Sounds Index.

    + +
    +void IXFigures::index_sounds(OUTPUT_STREAM) {
    +    if (PluginManager::active(sounds_plugin) == FALSE) return;
    +    sounds_data *bs; FILE *SOUND_FILE;
    +    TEMPORARY_TEXT(line2)
    +    int rv;
    +    if (NUMBER_CREATED(sounds_data) == 0) {
    +        HTML_OPEN("p");
    +        WRITE("There are no sound effects in this project.");
    +        HTML_CLOSE("p");
    +        return;
    +    }
    +    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);
    +    LOOP_OVER(bs, sounds_data) {
    +        unsigned int duration, pBitsPerSecond, pChannels, pSampleRate, fsize,
    +            midi_version = 0, no_tracks = 0;
    +        int preview = TRUE, waveform_style = TRUE;
    +        rv = 0;
    +        SOUND_FILE = Filenames::fopen(bs->filename_of_sound_file, "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(bs->filename_of_sound_file, "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(bs->filename_of_sound_file, "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>");
    +                HTML_TAG("br");
    +            } 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>");
    +                    HTML_TAG("br");
    +                } 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");
    +                    HTML_TAG("br");
    +                    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);
    +                    HTML_TAG("br");
    +                }
    +            }
    +        } else {
    +            WRITE_TO(line2, "<i>Missing from the Sounds folder</i>");
    +            HTML_TAG("br");
    +        }
    +        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",
    +                bs->filename_of_sound_file, 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("%+W", bs->name);
    +        Index::link(OUT, Wordings::first_wn(bs->name));
    +        TEMPORARY_TEXT(rel)
    +        Filenames::to_text_relative(rel, bs->filename_of_sound_file,
    +            Projects::materials_path(Task::project()));
    +        HTML_TAG("br");
    +        WRITE("%SFilename: \"%S\" - resource number %d", line2, rel, bs->sound_number);
    +        DISCARD_TEXT(rel)
    +        HTML::end_html_row(OUT);
    +    }
    +    HTML::end_html_table(OUT);
    +    HTML_OPEN("p");
    +    DISCARD_TEXT(line2)
    +}
    +
    +

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

    + +
    +void IXFigures::index_files(OUTPUT_STREAM) {
    +    if (PluginManager::active(files_plugin) == FALSE) return;
    +    files_data *exf;
    +    if (NUMBER_CREATED(files_data) == 0) {
    +        HTML_OPEN("p");
    +        WRITE("This project doesn't read or write external files.");
    +        HTML_CLOSE("p");
    +        return;
    +    }
    +    HTML_OPEN("p");
    +    WRITE("<b>List of External Files</b>");
    +    HTML_CLOSE("p");
    +    HTML::begin_html_table(OUT, "#ffffff", TRUE, 0, 0, 0, 0, 0);
    +    LOOP_OVER(exf, files_data) {
    +        HTML::first_html_column(OUT, THUMBNAIL_WIDTH+10);
    +        if (exf->file_is_binary) {
    +            HTML_TAG_WITH("img", "border=\"0\" src=\"inform:/doc_images/exf_binary.png\"");
    +        } else {
    +            HTML_TAG_WITH("img", "border=\"0\" src=\"inform:/doc_images/exf_text.png\"");
    +        }
    +        WRITE("&nbsp;");
    +        HTML::next_html_column(OUT, 0);
    +        WRITE("%+W", exf->name);
    +        Index::link(OUT, Wordings::first_wn(exf->name));
    +        HTML_TAG("br");
    +        WRITE("Filename: %s %N- owned by ",
    +            (exf->file_is_binary)?"- binary ":"",
    +            exf->unextended_filename);
    +        switch (exf->file_ownership) {
    +            case OWNED_BY_THIS_PROJECT: WRITE("this project"); break;
    +            case OWNED_BY_ANOTHER_PROJECT: WRITE("another project"); break;
    +            case OWNED_BY_SPECIFIC_PROJECT:
    +                WRITE("project with IFID number <b>%S</b>",
    +                    exf->IFID_of_owner);
    +                break;
    +        }
    +        HTML::end_html_row(OUT);
    +    }
    +    HTML::end_html_table(OUT);
    +    HTML_OPEN("p");
    +}
    +
    + + +
    + + + diff --git a/docs/index-module/3-fgr.html b/docs/index-module/3-fgr.html deleted file mode 100644 index e03139106..000000000 --- a/docs/index-module/3-fgr.html +++ /dev/null @@ -1,166 +0,0 @@ - - - - Figures - - - - - - - - - - - - - - - -
    - - -

    To produce the index of figures.

    - -

    §1. The index 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
    -
    -
    -void IXFigures::index_all(OUTPUT_STREAM) {
    -    if (PluginManager::active(figures_plugin) == FALSE) return;
    -    figures_data *bf; FILE *FIGURE_FILE;
    -    int MAX_INDEXED_FIGURES = global_compilation_settings.index_figure_thumbnails;
    -    int rv;
    -    if (NUMBER_CREATED(figures_data) < 2) {  cover art always creates 1
    -        HTML_OPEN("p"); WRITE("There are no figures, or illustrations, in this project.");
    -        HTML_CLOSE("p"); return;
    -    }
    -    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;
    -    LOOP_OVER(bf, figures_data) {
    -        if (bf->figure_number > 1) {
    -            TEMPORARY_TEXT(line2)
    -            unsigned int width = 0, height = 0;
    -            rv = 0;
    -            FIGURE_FILE = Filenames::fopen(bf->filename_of_image_file, "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(bf->filename_of_image_file, "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>");
    -                    HTML_TAG("br");
    -                } else {
    -                    WRITE_TO(line2, "%s format: %d (width) by %d (height) pixels",
    -                        real_format, width, height);
    -                    HTML_TAG("br");
    -                }
    -            } else {
    -                WRITE_TO(line2, "<i>Missing from the Figures folder</i>");
    -                HTML_TAG("br");
    -            }
    -            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\"",
    -                    bf->filename_of_image_file, 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("%+W", bf->name);
    -            Index::link(OUT, Wordings::first_wn(bf->name));
    -
    -            TEMPORARY_TEXT(rel)
    -            Filenames::to_text_relative(rel, bf->filename_of_image_file,
    -                Projects::materials_path(Task::project()));
    -            HTML_TAG("br");
    -            WRITE("%SFilename: \"%S\" - resource number %d", line2, rel, bf->figure_number);
    -            DISCARD_TEXT(rel)
    -            HTML::end_html_row(OUT);
    -            DISCARD_TEXT(line2)
    -        }
    -    }
    -    HTML::end_html_table(OUT);
    -    HTML_OPEN("p");
    -    if (count_of_displayed_figures > MAX_INDEXED_FIGURES) {
    -        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.)",
    -            MAX_INDEXED_FIGURES, 10*MAX_INDEXED_FIGURES);
    -        HTML_CLOSE("p");
    -    }
    -}
    -
    - - -
    - - - diff --git a/docs/index-module/3-scn.html b/docs/index-module/3-pe.html similarity index 72% rename from docs/index-module/3-scn.html rename to docs/index-module/3-pe.html index 7a79e41be..724b66ba0 100644 --- a/docs/index-module/3-scn.html +++ b/docs/index-module/3-pe.html @@ -1,7 +1,7 @@ - Scenes + Plot Element @@ -67,12 +67,12 @@ function togglePopup(material_id) {
    - + +

    Parallel to the World index of space is the Scenes index of time, and in this section we render it as HTML.

    -
    +

    §1. The mapping of time is on the one hand simpler than the mapping of space since there is only one dimension, but on the other hand more complex since @@ -83,22 +83,17 @@ seems natural enough to learn in practice.

    -void IXScenes::index(OUTPUT_STREAM) {
    +void IXScenes::render(OUTPUT_STREAM) {
         int nr = NUMBER_CREATED(scene);
         scene **sorted = Memory::calloc(nr, sizeof(scene *), INDEX_SORTING_MREASON);
    -    Sort the scenes1.1;
    +    Sort the scenes1.1;
     
    -    Tabulate the scenes1.2;
    -    Show the legend for the scene table icons1.3;
    -    Give details of each scene in turn1.5;
    +    Tabulate the scenes1.2;
    +    Show the legend for the scene table icons1.3;
    +    Give details of each scene in turn1.4;
     
         Memory::I7_array_free(sorted, INDEX_SORTING_MREASON, nr, sizeof(scene *));
     }
    -
    -void IXScenes::index_rules(OUTPUT_STREAM) {
    -    IXRules::index_scene(OUT);  rules in generic scene-ending rulebooks
    -    Show the generic scene-change rules1.4;
    -}
     

    §1.1. As usual, we sort with the C library's qsort.

    @@ -110,9 +105,9 @@ seems natural enough to learn in practice. int i = 0; scene *sc; LOOP_OVER(sc, scene) sorted[i++] = sc; - qsort(sorted, (size_t) nr, sizeof(scene *), IXScenes::compare_scenes); + qsort(sorted, (size_t) nr, sizeof(scene *), IXScenes::compare_scenes); -
    • This code is used in §1.
    +
    • This code is used in §1.

    §1.2. The sorted ordering is used as-is later on, when we get to the details, but for the tabulation it's refined further. First we have the start-of-play scenes, in sorted order; then scenes with a condition for their beginning @@ -129,58 +124,44 @@ about and created but never made use of.) for (int i=0; i<nr; i++) { scene *sc = sorted[i]; if ((sc->start_of_play) || (sc == SC_entire_game)) - IXScenes::index_from_scene(OUT, sc, 0, START_OF_PLAY_END, NULL, sorted, nr); + IXScenes::index_from_scene(OUT, sc, 0, START_OF_PLAY_END, NULL, sorted, nr); } for (int i=0; i<nr; i++) { scene *sc = sorted[i]; if ((sc->ends[0].anchor_condition) && (sc != SC_entire_game)) - IXScenes::index_from_scene(OUT, sc, 0, START_OF_PLAY_END, NULL, sorted, nr); + IXScenes::index_from_scene(OUT, sc, 0, START_OF_PLAY_END, NULL, sorted, nr); } for (int i=0; i<nr; i++) { scene *sc = sorted[i]; if (sc->indexed == FALSE) - IXScenes::index_from_scene(OUT, sc, 0, NEVER_HAPPENS_END, NULL, sorted, nr); + IXScenes::index_from_scene(OUT, sc, 0, NEVER_HAPPENS_END, NULL, sorted, nr); } -

    • This code is used in §1.
    +
    • This code is used in §1.

    §1.3. Show the legend for the scene table icons1.3 =

         HTML_OPEN("p"); WRITE("Legend: ");
    -    IXScenes::scene_icon_legend(OUT, "WPB", "Begins when play begins");
    +    IXScenes::scene_icon_legend(OUT, "WPB", "Begins when play begins");
         WRITE("; ");
    -    IXScenes::scene_icon_legend(OUT, "WhenC", "can begin whenever some condition holds");
    +    IXScenes::scene_icon_legend(OUT, "WhenC", "can begin whenever some condition holds");
         WRITE("; ");
    -    IXScenes::scene_icon_legend(OUT, "Segue", "follows when a previous scene ends");
    +    IXScenes::scene_icon_legend(OUT, "Segue", "follows when a previous scene ends");
         WRITE("; ");
    -    IXScenes::scene_icon_legend(OUT, "Simul", "begins simultaneously");
    +    IXScenes::scene_icon_legend(OUT, "Simul", "begins simultaneously");
         WRITE("; ");
    -    IXScenes::scene_icon_legend(OUT, "WNever", "never begins");
    +    IXScenes::scene_icon_legend(OUT, "WNever", "never begins");
         WRITE("; ");
    -    IXScenes::scene_icon_legend(OUT, "ENever", "never ends");
    +    IXScenes::scene_icon_legend(OUT, "ENever", "never ends");
         WRITE("; ");
    -    IXScenes::scene_icon_legend(OUT, "Recurring", "recurring (can happen more than once)");
    +    IXScenes::scene_icon_legend(OUT, "Recurring", "recurring (can happen more than once)");
         WRITE(". <i>Scene names are italicised when and if they appear for a second "
             "or subsequent time because the scene can begin in more than one way</i>.");
         HTML_CLOSE("p");
     
    -
    • This code is used in §1.
    -

    §1.4. Show the generic scene-change rules1.4 = -

    - -
    -    HTML_OPEN("p");
    -    Index::anchor(OUT, I"SRULES");
    -    WRITE("<b>General rules applying to scene changes</b>");
    -    HTML_CLOSE("p");
    -    IXRules::index_rules_box(OUT, "When a scene begins", EMPTY_WORDING, NULL,
    -        Rulebooks::std(WHEN_SCENE_BEGINS_RB), NULL, NULL, 1, FALSE);
    -    IXRules::index_rules_box(OUT, "When a scene ends", EMPTY_WORDING, NULL,
    -        Rulebooks::std(WHEN_SCENE_ENDS_RB), NULL, NULL, 1, FALSE);
    -
    -
    • This code is used in §1.
    -

    §1.5. Give details of each scene in turn1.5 = +

    • This code is used in §1.
    +

    §1.4. Give details of each scene in turn1.4 =

    @@ -188,33 +169,33 @@ about and created but never made use of.)
         for (int i=0; i<nr; i++) {
             HTML_TAG("hr");
             scene *sc = sorted[i];
    -        Give details of a specific scene1.5.1;
    +        Give details of a specific scene1.4.1;
         }
     
    -
    • This code is used in §1.
    -

    §1.5.1. The curious condition about end 1 here is to avoid printing "Ends: Never" +

    • This code is used in §1.
    +

    §1.4.1. The curious condition about end 1 here is to avoid printing "Ends: Never" in cases where fancier ends for the scene exist, so that the scene can, in fact, end.

    -

    Give details of a specific scene1.5.1 = +

    Give details of a specific scene1.4.1 =

    -    Index the name and recurrence status of the scene1.5.1.1;
    -    if (sc == SC_entire_game) Explain the Entire Game scene1.5.1.2;
    +    Index the name and recurrence status of the scene1.4.1.1;
    +    if (sc == SC_entire_game) Explain the Entire Game scene1.4.1.2;
     
         for (int end=0; end<sc->no_ends; end++) {
             if ((end == 1) && (sc->no_ends > 2) &&
                 (sc->ends[1].anchor_condition==NULL) && (sc->ends[1].anchor_connectors==NULL))
                 continue;
    -        Index the conditions for this scene end to occur1.5.1.4;
    -        Index the rules which apply when this scene end occurs1.5.1.5;
    -        if (end == 0) Index the rules which apply during this scene1.5.1.3;
    +        Index the conditions for this scene end to occur1.4.1.4;
    +        Index the rules which apply when this scene end occurs1.4.1.5;
    +        if (end == 0) Index the rules which apply during this scene1.4.1.3;
         }
     
    -
    • This code is used in §1.5.
    -

    §1.5.1.1. Index the name and recurrence status of the scene1.5.1.1 = +

    • This code is used in §1.4.
    +

    §1.4.1.1. Index the name and recurrence status of the scene1.4.1.1 =

    @@ -227,8 +208,8 @@ fact, end.
             WRITE("&nbsp;&nbsp;<i>recurring</i>");
         HTML_CLOSE("p");
     
    - -

    §1.5.1.2. Explain the Entire Game scene1.5.1.2 = +

    +

    §1.4.1.2. Explain the Entire Game scene1.4.1.2 =

    @@ -238,15 +219,15 @@ fact, end.
             "it too will end but then begin again.)");
         HTML_CLOSE("p");
     
    - -

    §1.5.1.3. Index the rules which apply during this scene1.5.1.3 = +

    +

    §1.4.1.3. Index the rules which apply during this scene1.4.1.3 =

         int rbc = 0;
         rulebook *rb;
         LOOP_OVER(rb, rulebook) {
    -        if (Rulebooks::is_contextually_empty(rb, IXRules::scene_context(sc)) == FALSE) {
    +        if (Rulebooks::is_contextually_empty(rb, IXRules::scene_context(sc)) == FALSE) {
                 if (rbc++ == 0) {
                     HTML::open_indented_p(OUT, 1, "hanging");
                     WRITE("<i>During this scene:</i>");
    @@ -255,12 +236,12 @@ fact, end.
                 HTML::open_indented_p(OUT, 2, "hanging");
                 WRITE("<i>%+W</i>", rb->primary_name); HTML_CLOSE("p");
                 int ignore_me = 0;
    -            IXRules::index_rulebook(OUT, rb, "", IXRules::scene_context(sc), &ignore_me);
    +            IXRules::index_rulebook(OUT, rb, "", IXRules::scene_context(sc), &ignore_me);
             }
         }
     
    - -

    §1.5.1.4. Index the conditions for this scene end to occur1.5.1.4 = +

    +

    §1.4.1.4. Index the conditions for this scene end to occur1.4.1.4 =

    @@ -269,14 +250,14 @@ fact, end.
         if (end >= 2) WRITE("%+W ", sc->ends[end].end_names);
         WRITE("when:</i> ");
         int count = 0;
    -    Index the play-begins condition1.5.1.4.1;
    -    Index the I7 condition for a scene to end1.5.1.4.2;
    -    Index connections to other scene ends1.5.1.4.3;
    +    Index the play-begins condition1.4.1.4.1;
    +    Index the I7 condition for a scene to end1.4.1.4.2;
    +    Index connections to other scene ends1.4.1.4.3;
         if (count == 0) WRITE("<b>never</b>");
         HTML_CLOSE("p");
     
    - -

    §1.5.1.4.1. Index the play-begins condition1.5.1.4.1 = +

    +

    §1.4.1.4.1. Index the play-begins condition1.4.1.4.1 =

    @@ -289,8 +270,8 @@ fact, end.
             count++;
         }
     
    - -

    §1.5.1.4.2. Index the I7 condition for a scene to end1.5.1.4.2 = +

    +

    §1.4.1.4.2. Index the I7 condition for a scene to end1.4.1.4.2 =

    @@ -304,8 +285,8 @@ fact, end.
             count++;
         }
     
    - -

    §1.5.1.4.3. Index connections to other scene ends1.5.1.4.3 = +

    +

    §1.4.1.4.3. Index connections to other scene ends1.4.1.4.3 =

    @@ -321,8 +302,8 @@ fact, end.
             count++;
         }
     
    - -

    §1.5.1.5. Index the rules which apply when this scene end occurs1.5.1.5 = +

    +

    §1.4.1.5. Index the rules which apply when this scene end occurs1.4.1.5 =

    @@ -331,10 +312,10 @@ fact, end.
             WRITE("<i>What happens:</i>"); HTML_CLOSE("p");
             int ignore_me = 0;
             IXRules::index_rulebook(OUT, sc->ends[end].end_rulebook, "",
    -            IXRules::no_rule_context(), &ignore_me);
    +            IXRules::no_rule_context(), &ignore_me);
         }
     
    - +

    §2. Table of Scenes. We finally return to the table of scenes. The following is recursive, and is called at the top level for each scene in turn which starts at the start of play (see above). @@ -352,19 +333,19 @@ on the initial call when dept define NEVER_HAPPENS_END -2

    -void IXScenes::index_from_scene(OUTPUT_STREAM, scene *sc, int depth,
    +void IXScenes::index_from_scene(OUTPUT_STREAM, scene *sc, int depth,
         int end, scene *sc_from, scene **sorted, int nr) {
         HTML::open_indented_p(OUT, depth+1, "tight");
    -    Indicate the route by which this scene was reached2.1;
    -    Name the scene in the table, italicised if we've seen it already2.2;
    +    Indicate the route by which this scene was reached2.1;
    +    Name the scene in the table, italicised if we've seen it already2.2;
         if (sc->indexed == FALSE) {
    -        Show the never-ends icon if appropriate2.3;
    -        Show the recurring icon if appropriate2.4;
    +        Show the never-ends icon if appropriate2.3;
    +        Show the recurring icon if appropriate2.4;
         }
         HTML_CLOSE("p");
         if (sc->indexed) return;
         sc->indexed = TRUE;
    -    Indent to tabulate other scenes connected to the ends of this one2.5;
    +    Indent to tabulate other scenes connected to the ends of this one2.5;
     }
     

    §2.1. Indicate the route by which this scene was reached2.1 = @@ -372,21 +353,21 @@ on the initial call when dept

         switch(end) {
    -        case 0: IXScenes::scene_icon(OUT, "Simul"); break;
    -        case 1: IXScenes::scene_icon(OUT, "Segue"); break;
    +        case 0: IXScenes::scene_icon(OUT, "Simul"); break;
    +        case 1: IXScenes::scene_icon(OUT, "Segue"); break;
             case START_OF_PLAY_END: break;
    -        case NEVER_HAPPENS_END: IXScenes::scene_icon(OUT, "WNever"); break;
    +        case NEVER_HAPPENS_END: IXScenes::scene_icon(OUT, "WNever"); break;
             default:
    -            IXScenes::scene_icon(OUT, "Segue");
    +            IXScenes::scene_icon(OUT, "Segue");
                 WRITE("[ends %+W]&nbsp;", sc_from->ends[end].end_names); break;
         }
         if ((sc->indexed == FALSE) || (depth == 0)) {
    -        if (sc == SC_entire_game) IXScenes::scene_icon(OUT, "WPB");
    -        else if (sc->ends[0].anchor_condition) IXScenes::scene_icon(OUT, "WhenC");
    -        if (sc->start_of_play) IXScenes::scene_icon(OUT, "WPB");
    +        if (sc == SC_entire_game) IXScenes::scene_icon(OUT, "WPB");
    +        else if (sc->ends[0].anchor_condition) IXScenes::scene_icon(OUT, "WhenC");
    +        if (sc->start_of_play) IXScenes::scene_icon(OUT, "WPB");
         }
     
    -
    • This code is used in §2.
    +
    • This code is used in §2.

    §2.2. Name the scene in the table, italicised if we've seen it already2.2 =

    @@ -396,7 +377,7 @@ on the initial call when dept if (sc->indexed) WRITE("</i>"); else Index::below_link_numbered(OUT, sc->allocation_id); -
    • This code is used in §2.
    +
    • This code is used in §2.

    §2.3. Show the never-ends icon if appropriate2.3 =

    @@ -406,18 +387,18 @@ on the initial call when dept if (sc->ends[e].anchor_connectors) ways_to_end++; if (sc->ends[e].anchor_condition) ways_to_end++; } - if (ways_to_end == 0) IXScenes::scene_icon_append(OUT, "ENever"); + if (ways_to_end == 0) IXScenes::scene_icon_append(OUT, "ENever"); -
    • This code is used in §2.
    +
    • This code is used in §2.

    §2.4. Show the recurring icon if appropriate2.4 =

         inference_subject *subj = Instances::as_subject(sc->as_instance);
         if (PropertyInferences::either_or_state(subj, P_recurring) > UNKNOWN_CE)
    -        IXScenes::scene_icon_append(OUT, "Recurring");
    +        IXScenes::scene_icon_append(OUT, "Recurring");
     
    -
    • This code is used in §2.
    +
    • This code is used in §2.

    §2.5. And this is where the routine recurses, so that consequent scenes are tabulated underneath the present one, indented one step further in (since indentation is coupled to depth). First we recurse to scenes which end when @@ -433,31 +414,31 @@ this one does; then to scenes which begin when this one ends. scene_connector *scon; for (scon = sc2->ends[0].anchor_connectors; scon; scon=scon->next) if ((scon->connect_to == sc) && (scon->end >= 1)) - IXScenes::index_from_scene(OUT, sc2, depth + 1, scon->end, sc, sorted, nr); + IXScenes::index_from_scene(OUT, sc2, depth + 1, scon->end, sc, sorted, nr); } for (int i=0; i<nr; i++) { scene *sc2 = sorted[i]; scene_connector *scon; for (scon = sc2->ends[0].anchor_connectors; scon; scon=scon->next) if ((scon->connect_to == sc) && (scon->end == 0)) - IXScenes::index_from_scene(OUT, sc2, depth, scon->end, sc, sorted, nr); + IXScenes::index_from_scene(OUT, sc2, depth, scon->end, sc, sorted, nr); } -

    • This code is used in §2.
    +
    • This code is used in §2.

    §3. We have been using:

    -void IXScenes::scene_icon(OUTPUT_STREAM, char *si) {
    -    IXScenes::scene_icon_unspaced(OUT, si); WRITE("&nbsp;&nbsp;");
    +void IXScenes::scene_icon(OUTPUT_STREAM, char *si) {
    +    IXScenes::scene_icon_unspaced(OUT, si); WRITE("&nbsp;&nbsp;");
     }
     
    -void IXScenes::scene_icon_append(OUTPUT_STREAM, char *si) {
    -    WRITE("&nbsp;&nbsp;"); IXScenes::scene_icon_unspaced(OUT, si);
    +void IXScenes::scene_icon_append(OUTPUT_STREAM, char *si) {
    +    WRITE("&nbsp;&nbsp;"); IXScenes::scene_icon_unspaced(OUT, si);
     }
     
    -void IXScenes::scene_icon_legend(OUTPUT_STREAM, char *si, char *gloss) {
    -    IXScenes::scene_icon_unspaced(OUT, si); WRITE("&nbsp;<i>%s</i>", gloss);
    +void IXScenes::scene_icon_legend(OUTPUT_STREAM, char *si, char *gloss) {
    +    IXScenes::scene_icon_unspaced(OUT, si); WRITE("&nbsp;<i>%s</i>", gloss);
     }
     
     void IXScenes::scene_icon_unspaced(OUTPUT_STREAM, char *si) {
    @@ -470,7 +451,7 @@ rest in ascending alphabetical order.
     

    -int IXScenes::compare_scenes(const void *ent1, const void *ent2) {
    +int IXScenes::compare_scenes(const void *ent1, const void *ent2) {
         const scene *sc1 = *((const scene **) ent1);
         const scene *sc2 = *((const scene **) ent2);
         if ((sc1 == SC_entire_game) && (sc2 != SC_entire_game)) return -1;
    @@ -481,7 +462,7 @@ rest in ascending alphabetical order.
     }
     
    diff --git a/docs/index-module/3-rgn.html b/docs/index-module/3-rgn.html index 9f63104e5..c0954e6dd 100644 --- a/docs/index-module/3-rgn.html +++ b/docs/index-module/3-rgn.html @@ -76,7 +76,7 @@ } diff --git a/docs/index-module/3-se.html b/docs/index-module/3-se.html deleted file mode 100644 index e385e9dea..000000000 --- a/docs/index-module/3-se.html +++ /dev/null @@ -1,192 +0,0 @@ - - - - Sound Effects - - - - - - - - - - - - - - - -
    - - -

    To produce the index of sound effects.

    - -
    - -

    §1. Sounds Index.

    - -
    -void IXSounds::index_all(OUTPUT_STREAM) {
    -    if (PluginManager::active(sounds_plugin) == FALSE) return;
    -    sounds_data *bs; FILE *SOUND_FILE;
    -    TEMPORARY_TEXT(line2)
    -    int rv;
    -    if (NUMBER_CREATED(sounds_data) == 0) {
    -        HTML_OPEN("p");
    -        WRITE("There are no sound effects in this project.");
    -        HTML_CLOSE("p");
    -        return;
    -    }
    -    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);
    -    LOOP_OVER(bs, sounds_data) {
    -        unsigned int duration, pBitsPerSecond, pChannels, pSampleRate, fsize,
    -            midi_version = 0, no_tracks = 0;
    -        int preview = TRUE, waveform_style = TRUE;
    -        rv = 0;
    -        SOUND_FILE = Filenames::fopen(bs->filename_of_sound_file, "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(bs->filename_of_sound_file, "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(bs->filename_of_sound_file, "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>");
    -                HTML_TAG("br");
    -            } 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>");
    -                    HTML_TAG("br");
    -                } 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");
    -                    HTML_TAG("br");
    -                    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);
    -                    HTML_TAG("br");
    -                }
    -            }
    -        } else {
    -            WRITE_TO(line2, "<i>Missing from the Sounds folder</i>");
    -            HTML_TAG("br");
    -        }
    -        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",
    -                bs->filename_of_sound_file, 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("%+W", bs->name);
    -        Index::link(OUT, Wordings::first_wn(bs->name));
    -        TEMPORARY_TEXT(rel)
    -        Filenames::to_text_relative(rel, bs->filename_of_sound_file,
    -            Projects::materials_path(Task::project()));
    -        HTML_TAG("br");
    -        WRITE("%SFilename: \"%S\" - resource number %d", line2, rel, bs->sound_number);
    -        DISCARD_TEXT(rel)
    -        HTML::end_html_row(OUT);
    -    }
    -    HTML::end_html_table(OUT);
    -    HTML_OPEN("p");
    -    DISCARD_TEXT(line2)
    -}
    -
    - - -
    - - - diff --git a/docs/index-module/3-spt.html b/docs/index-module/3-spt.html index fbfe8190c..9327f5847 100644 --- a/docs/index-module/3-spt.html +++ b/docs/index-module/3-spt.html @@ -165,7 +165,7 @@ it already turns up under its owner. } diff --git a/docs/index-module/3-tm.html b/docs/index-module/3-tm.html index a944bdcad..7b699c9ad 100644 --- a/docs/index-module/3-tm.html +++ b/docs/index-module/3-tm.html @@ -96,7 +96,7 @@ } diff --git a/docs/index-module/3-tp.html b/docs/index-module/3-tp.html index ca5e708f8..46e9eff49 100644 --- a/docs/index-module/3-tp.html +++ b/docs/index-module/3-tp.html @@ -93,7 +93,7 @@ usually appear anywhere. } diff --git a/docs/index-module/4-em.html b/docs/index-module/4-em.html index d3d1957fb..a9afad8b7 100644 --- a/docs/index-module/4-em.html +++ b/docs/index-module/4-em.html @@ -127,7 +127,7 @@ values inherited by sub-objects. int numeric_value; or numeric value, if appropriate to this type } plotting_parameter; - +

    §3. A set of variables associated with any map object is called a "scope". As implied above, the global scope is special: it contains the default settings passed down to all lower scopes. @@ -1633,7 +1633,7 @@ are written as triples of floating point numbers \(0 \leq b \leq 1\). }

    diff --git a/docs/index-module/4-hm.html b/docs/index-module/4-hm.html index 149d5b0d0..dbcf8cb6f 100644 --- a/docs/index-module/4-hm.html +++ b/docs/index-module/4-hm.html @@ -1360,7 +1360,7 @@ that nothing is shown if all of the rooms are outside of regions. diff --git a/docs/index-module/4-sg.html b/docs/index-module/4-sg.html index 9bd92144a..989247aae 100644 --- a/docs/index-module/4-sg.html +++ b/docs/index-module/4-sg.html @@ -320,7 +320,7 @@ sacrifice that.) } diff --git a/docs/index-module/4-sm.html b/docs/index-module/4-sm.html index 51d54e4af..f0942bf51 100644 --- a/docs/index-module/4-sm.html +++ b/docs/index-module/4-sm.html @@ -3353,7 +3353,7 @@ rooms: } diff --git a/docs/index-module/index.html b/docs/index-module/index.html index acbe07ae5..d69340231 100644 --- a/docs/index-module/index.html +++ b/docs/index-module/index.html @@ -124,8 +124,8 @@ To index properties.

  • -

    - Relations - +

    + Relations Element - To index relations.

  • @@ -148,6 +148,31 @@ Phrasebook Index - To compile most of the HTML page for the Phrasebook index.

  • +
  • +

    + Tables Element - + To index tables.

    +
  • +
  • +

    + Innards Element - + To index tables.

    +
  • +
  • +

    + Events Element - + To index relations.

    +
  • +
  • +

    + Rules for Scenes Element - + The RS element.

    +
  • +
  • +

    + Behaviour Element - + To index relations.

    +
  • @@ -155,20 +180,10 @@ Chapter 3: Indexing for Plugins

    • -

      - Figures - +

      + Figures Element - To produce the index of figures.

    • -
    • -

      - Sound Effects - - To produce the index of sound effects.

      -
    • -
    • -

      - External Files - - To produce the index of external files.

      -
    • Spatial - @@ -195,8 +210,8 @@ Indexing the player's initial position.

    • -

      - Scenes - +

      + Plot Element - Parallel to the World index of space is the Scenes index of time, and in this section we render it as HTML.

    • diff --git a/inform7/Figures/timings-diagnostics.txt b/inform7/Figures/timings-diagnostics.txt index 3508424f4..b78de7ff0 100644 --- a/inform7/Figures/timings-diagnostics.txt +++ b/inform7/Figures/timings-diagnostics.txt @@ -1,24 +1,25 @@ 100.0% in inform7 run - 53.7% in compilation to Inter - 39.3% in //Sequence::undertake_queued_tasks// - 4.4% in //MajorNodes::pre_pass// - 3.2% in //MajorNodes::pass_1// - 1.6% in //ImperativeDefinitions::assess_all// + 53.6% in compilation to Inter + 39.5% in //Sequence::undertake_queued_tasks// + 4.1% in //MajorNodes::pre_pass// + 3.1% in //MajorNodes::pass_1// + 1.7% in //ImperativeDefinitions::assess_all// 0.5% in //ImperativeDefinitions::compile_first_block// 0.5% in //MajorNodes::pass_2// 0.5% in //RTKindConstructors::compile// 0.5% in //World::stage_V// 0.3% in //Sequence::undertake_queued_tasks// + 0.1% in //InferenceSubjects::emit_all// 0.1% in //RTKindConstructors::compile_permissions// 0.1% in //Task::make_built_in_kind_constructors// 0.1% in //World::stages_II_and_III// - 2.1% not specifically accounted for + 1.9% not specifically accounted for 43.9% in running Inter pipeline - 11.2% in step preparation - 11.0% in inter step 7/14: consolidate-text - 9.6% in inter step 2/14: link - 7.8% in inter step 14/14: generate inform6 -> auto.inf - 0.7% in inter step 10/14: make-identifiers-unique + 11.1% in inter step 7/14: consolidate-text + 10.9% in step preparation + 9.5% in inter step 2/14: link + 7.4% in inter step 14/14: generate inform6 -> auto.inf + 0.8% in inter step 10/14: make-identifiers-unique 0.3% in inter step 11/14: reconcile-verbs 0.3% in inter step 13/14: eliminate-redundant-operations 0.1% in inter step 12/14: eliminate-redundant-labels @@ -27,6 +28,6 @@ 0.1% in inter step 6/14: assimilate 0.1% in inter step 8/14: resolve-external-symbols 0.1% in inter step 9/14: inspect-plugs - 1.8% not specifically accounted for - 1.9% in supervisor + 2.1% not specifically accounted for + 2.0% in supervisor 0.4% not specifically accounted for diff --git a/inform7/assertions-module/Chapter 7/Tables.w b/inform7/assertions-module/Chapter 7/Tables.w index 8a31e3f25..71377784f 100644 --- a/inform7/assertions-module/Chapter 7/Tables.w +++ b/inform7/assertions-module/Chapter 7/Tables.w @@ -1288,136 +1288,6 @@ void Tables::splice_table_row(table *table_to, table *table_from, int row_to, in } } -@h Indexing. -Tables inside extensions are often used just for the storage needed to manage -back-of-house algorithms, so to speak, and they aren't intended for the end -user to poke around with; that's certainly true of the tables in the Standard -Rules, which of course are always present. So these are hidden by default. - -= -void Tables::index(OUTPUT_STREAM) { - HTML_OPEN("p"); - int m = Tables::index_tables_in(OUT, NULL, 0); - HTML_CLOSE("p"); - HTML_OPEN("p"); - Index::extra_link(OUT, 2); - if (m > 0) WRITE("Show tables inside extensions too"); - else WRITE("Show tables inside extensions (there are none in the main text)"); - HTML_CLOSE("p"); - Index::extra_div_open(OUT, 2, 1, "e0e0e0"); - inform_extension *E; int efc = 0; - LOOP_OVER(E, inform_extension) Tables::index_tables_in(OUT, E, efc++); - Index::extra_div_close(OUT, "e0e0e0"); -} - -@ This tabulates tables within a given extension, returning the number listed, -and does nothing at all if that number is 0. - -= -int Tables::index_tables_in(OUTPUT_STREAM, inform_extension *E, int efc) { - int tc = 0; table *t; - LOOP_OVER(t, table) if (Tables::table_within(t, E)) tc++; - if (tc > 0) { - if (E) { - HTML_OPEN("p"); - WRITE("%S", E->as_copy->edition->work->title); - HTML_CLOSE("p"); - } - HTML::begin_plain_html_table(OUT); - LOOP_OVER(t, table) - if (Tables::table_within(t, E)) - @; - HTML::end_html_table(OUT); - } - return tc; -} - -@ The following probably ought to use a multiplication sign rather than a -Helvetica-style lower case "x", but life is full of compromises. - -@ = - HTML::first_html_column_spaced(OUT, 0); - WRITE("%+W", Node::get_text(t->headline_fragment)); - table_contribution *tc; int ntc = 0; - for (tc = t->table_created_at; tc; tc = tc->next) { - if (ntc++ > 0) WRITE(" +"); - Index::link(OUT, Wordings::first_wn(Node::get_text(tc->source_table))); - } - HTML::next_html_column_spaced(OUT, 0); - int rc = Tables::get_no_rows(t); - WRITE(""); - HTML_OPEN_WITH("span", "class=\"smaller\""); - if (t->first_column_by_definition) { - WRITE("%d definition%s", rc, - (rc == 1)?"":"s"); - } else { - WRITE("%d column%s x %d row%s", - t->no_columns, (t->no_columns == 1)?"":"s", - rc, (rc == 1)?"":"s"); - } - if (t->blank_rows > 0) { - WRITE(" (%d blank", t->blank_rows); - if (Wordings::nonempty(t->blank_rows_for_each_text)) - WRITE(", one for each %+W", t->blank_rows_for_each_text); - WRITE(")"); - } - HTML_CLOSE("span"); - WRITE(""); - HTML::end_html_row(OUT); - int col; - for (col = 0; col < t->no_columns; col++) { - HTML::first_html_column(OUT, 0); - WRITE("  col %d:  ", col+1); - wording CW = Nouns::nominative_singular(t->columns[col].column_identity->name); - if ((t->first_column_by_definition) && (col == 0)) { - parse_node *PN = t->where_used_to_define; - WRITE("%+W", Node::get_text(PN)); - Index::link(OUT, Wordings::first_wn(Node::get_text(PN))); - } else { - if (t->first_column_by_definition) WRITE("sets "); - WRITE("%+W ", CW); - TEMPORARY_TEXT(TEMP) - WRITE_TO(TEMP, "%+W", CW); - if (t->first_column_by_definition == FALSE) WRITE_TO(TEMP, " entry"); - PasteButtons::paste_text(OUT, TEMP); - DISCARD_TEXT(TEMP) - } - HTML::next_html_column(OUT, 0); - if ((t->first_column_by_definition) && (col == 0)) { - parse_node *cell; - int row; - for (row = 1, cell = t->columns[0].entries->down; cell; cell = cell->next, row++) { - if (row > 1) WRITE(", "); - WRITE("%+W", Node::get_text(cell)); - Index::link(OUT, Wordings::first_wn(Node::get_text(cell))); - } - } else if (t->first_column_by_definition) { - Kinds::Textual::write(OUT, - Tables::Columns::get_kind( - t->columns[col].column_identity)); - WRITE(" property"); - } else { - WRITE("of "); - Kinds::Textual::write_plural(OUT, - Tables::Columns::get_kind( - t->columns[col].column_identity)); - } - HTML::end_html_row(OUT); - } - -@ The following laboriously tests whether a table is defined within a -given extension: - -= -int Tables::table_within(table *t, inform_extension *E) { - if (t->amendment_of) return FALSE; - heading *at_heading = - Headings::of_wording(Node::get_text(t->table_created_at->source_table)); - inform_extension *at_E = Headings::get_extension_containing(at_heading); - if (E == at_E) return TRUE; - return FALSE; -} - @ This is called when a table is being asked to define objects (or kinds). = diff --git a/inform7/index-module/Chapter 2/Activities.w b/inform7/index-module/Chapter 2/Activities.w index 723492ac4..5f2ac3f8f 100644 --- a/inform7/index-module/Chapter 2/Activities.w +++ b/inform7/index-module/Chapter 2/Activities.w @@ -90,58 +90,3 @@ void IXActivities::index_cross_references(OUTPUT_STREAM, activity *av) { } } -@h Describing the current VM. - -= -void IXActivities::innards(OUTPUT_STREAM, target_vm *VM) { - IXActivities::index_VM(OUT, VM); - NewUseOptions::index(OUT); - HTML_OPEN("p"); - Index::extra_link(OUT, 3); - WRITE("See some technicalities for Inform maintainers only"); - HTML_CLOSE("p"); - Index::extra_div_open(OUT, 3, 2, "e0e0e0"); - IXActivities::show_configuration(OUT); - @; - Index::extra_div_close(OUT, "e0e0e0"); -} - -@ The index provides some hidden paste icons for these: - -@ = - HTML_OPEN("p"); - WRITE("Debugging log:"); - HTML_CLOSE("p"); - HTML_OPEN("p"); - for (int i=0; iunhyphenated_name) > 0) { - TEMPORARY_TEXT(is) - WRITE_TO(is, "Include %S in the debugging log.", da->unhyphenated_name); - PasteButtons::paste_text(OUT, is); - WRITE(" %S", is); - DISCARD_TEXT(is) - HTML_TAG("br"); - } - } - HTML_CLOSE("p"); - -@ = -void IXActivities::index_VM(OUTPUT_STREAM, target_vm *VM) { - if (VM == NULL) internal_error("target VM not set yet"); - Index::anchor(OUT, I"STORYFILE"); - HTML_OPEN("p"); WRITE("Story file format: "); - ExtensionIndex::plot_icon(OUT, VM); - TargetVMs::write(OUT, VM); - HTML_CLOSE("p"); -} - -@ = -void IXActivities::show_configuration(OUTPUT_STREAM) { - HTML_OPEN("p"); - Index::anchor(OUT, I"CONFIG"); - WRITE("Inform language definition:\n"); - PluginManager::list_plugins(OUT, "Included", TRUE); - PluginManager::list_plugins(OUT, "Excluded", FALSE); - HTML_CLOSE("p"); -} diff --git a/inform7/index-module/Chapter 2/Behaviour Element.w b/inform7/index-module/Chapter 2/Behaviour Element.w new file mode 100644 index 000000000..35b0c68c2 --- /dev/null +++ b/inform7/index-module/Chapter 2/Behaviour Element.w @@ -0,0 +1,33 @@ +[IXBehaviour::] Behaviour Element. + +To index relations. + +@ A brief table of relations appears on the Phrasebook Index page. + += +void IXBehaviour::render(OUTPUT_STREAM) { + named_action_pattern *nap; + int num_naps = NUMBER_CREATED(named_action_pattern); + + if (num_naps == 0) { + HTML_OPEN("p"); + WRITE("No names for kinds of action have yet been defined."); + HTML_CLOSE("p"); + } + + LOOP_OVER(nap, named_action_pattern) { + HTML_OPEN("p"); WRITE("%+W", Nouns::nominative_singular(nap->as_noun)); + Index::link(OUT, Wordings::first_wn(nap->text_of_declaration)); + HTML_TAG("br"); + WRITE("  defined as any of the following acts:\n"); + named_action_pattern_entry *nape; + LOOP_OVER_LINKED_LIST(nape, named_action_pattern_entry, nap->patterns) { + action_pattern *ap = nape->behaviour; + HTML_TAG("br"); + WRITE("    %+W", ap->text_of_pattern); + Index::link(OUT, Wordings::first_wn(ap->text_of_pattern)); + } + HTML_CLOSE("p"); + } +} + diff --git a/inform7/index-module/Chapter 2/Events Element.w b/inform7/index-module/Chapter 2/Events Element.w new file mode 100644 index 000000000..e6191e49b --- /dev/null +++ b/inform7/index-module/Chapter 2/Events Element.w @@ -0,0 +1,62 @@ +[IXEvents::] Events Element. + +To index relations. + +@ + += +void IXEvents::render(OUTPUT_STREAM) { + int when_count = 0, tt_count = 0; + @; + @; + if ((when_count == 0) && (tt_count == 0)) { + HTML_OPEN("p"); WRITE("None."); HTML_CLOSE("p"); + } +} + +@ = + id_body *idb; + LOOP_OVER(idb, id_body) { + int t = TimedRules::get_timing_of_event(idb->head_of_defn); + if (t == NO_FIXED_TIME) { + if (when_count == 0) { + HTML_OPEN("p"); + WRITE("Events with no specific time"); + HTML_CLOSE("p"); + } + when_count++; + HTML_OPEN_WITH("p", "class=\"tightin2\""); + ImperativeDefinitions::index_preamble(OUT, idb->head_of_defn); + if ((ImperativeDefinitions::body_at(idb)) && + (Wordings::nonempty(Node::get_text(ImperativeDefinitions::body_at(idb))))) + Index::link(OUT, Wordings::first_wn(Node::get_text(ImperativeDefinitions::body_at(idb)))); + WRITE(" (where triggered: "); + linked_list *L = TimedRules::get_uses_as_event(idb->head_of_defn); + parse_node *p; + LOOP_OVER_LINKED_LIST(p, parse_node, L) + Index::link(OUT, Wordings::first_wn(Node::get_text(p))); + WRITE(")"); + HTML_CLOSE("p"); + } + } + +@ = + id_body *idb; + LOOP_OVER(idb, id_body) { + int t = TimedRules::get_timing_of_event(idb->head_of_defn); + if (t >= 0) { /* i.e., an actual time of day in minutes since midnight */ + if (tt_count == 0) { + HTML_OPEN("p"); + WRITE("Timetable"); + HTML_CLOSE("p"); + } + tt_count++; + HTML_OPEN_WITH("p", "class=\"in2\""); + ImperativeDefinitions::index_preamble(OUT, idb->head_of_defn); + if ((ImperativeDefinitions::body_at(idb)) && + (Wordings::nonempty(Node::get_text(ImperativeDefinitions::body_at(idb))))) + Index::link(OUT, Wordings::first_wn(Node::get_text(ImperativeDefinitions::body_at(idb)))); + HTML_CLOSE("p"); + } + } + diff --git a/inform7/index-module/Chapter 2/Innards Element.w b/inform7/index-module/Chapter 2/Innards Element.w new file mode 100644 index 000000000..a8226e141 --- /dev/null +++ b/inform7/index-module/Chapter 2/Innards Element.w @@ -0,0 +1,59 @@ +[IXInnards::] Innards Element. + +To index tables. + +@h Describing the current VM. + += +void IXInnards::render(OUTPUT_STREAM, target_vm *VM) { + IXInnards::index_VM(OUT, VM); + NewUseOptions::index(OUT); + HTML_OPEN("p"); + Index::extra_link(OUT, 3); + WRITE("See some technicalities for Inform maintainers only"); + HTML_CLOSE("p"); + Index::extra_div_open(OUT, 3, 2, "e0e0e0"); + IXInnards::show_configuration(OUT); + @; + Index::extra_div_close(OUT, "e0e0e0"); +} + +@ The index provides some hidden paste icons for these: + +@ = + HTML_OPEN("p"); + WRITE("Debugging log:"); + HTML_CLOSE("p"); + HTML_OPEN("p"); + for (int i=0; iunhyphenated_name) > 0) { + TEMPORARY_TEXT(is) + WRITE_TO(is, "Include %S in the debugging log.", da->unhyphenated_name); + PasteButtons::paste_text(OUT, is); + WRITE(" %S", is); + DISCARD_TEXT(is) + HTML_TAG("br"); + } + } + HTML_CLOSE("p"); + +@ = +void IXInnards::index_VM(OUTPUT_STREAM, target_vm *VM) { + if (VM == NULL) internal_error("target VM not set yet"); + Index::anchor(OUT, I"STORYFILE"); + HTML_OPEN("p"); WRITE("Story file format: "); + ExtensionIndex::plot_icon(OUT, VM); + TargetVMs::write(OUT, VM); + HTML_CLOSE("p"); +} + +@ = +void IXInnards::show_configuration(OUTPUT_STREAM) { + HTML_OPEN("p"); + Index::anchor(OUT, I"CONFIG"); + WRITE("Inform language definition:\n"); + PluginManager::list_plugins(OUT, "Included", TRUE); + PluginManager::list_plugins(OUT, "Excluded", FALSE); + HTML_CLOSE("p"); +} diff --git a/inform7/index-module/Chapter 2/Lexicon Index.w b/inform7/index-module/Chapter 2/Lexicon Index.w index 728394b54..c07528aa4 100644 --- a/inform7/index-module/Chapter 2/Lexicon Index.w +++ b/inform7/index-module/Chapter 2/Lexicon Index.w @@ -523,7 +523,7 @@ void IndexLexicon::tabulate_meanings(OUTPUT_STREAM, index_lexicon_entry *lex) { if (vu->where_vu_created) Index::link(OUT, Wordings::first_wn(Node::get_text(vu->where_vu_created))); binary_predicate *bp = VerbMeanings::get_regular_meaning_of_form(Verbs::base_form(VerbUsages::get_verb(vu))); - if (bp) IXRelations::index_for_verbs(OUT, bp); + if (bp) IndexLexicon::show_relation(OUT, bp); return; } preposition *prep; @@ -532,7 +532,20 @@ void IndexLexicon::tabulate_meanings(OUTPUT_STREAM, index_lexicon_entry *lex) { if (prep->where_prep_created) Index::link(OUT, Wordings::first_wn(Node::get_text(prep->where_prep_created))); binary_predicate *bp = VerbMeanings::get_regular_meaning_of_form(Verbs::find_form(copular_verb, prep, NULL)); - if (bp) IXRelations::index_for_verbs(OUT, bp); + if (bp) IndexLexicon::show_relation(OUT, bp); return; } } + +void IndexLexicon::show_relation(OUTPUT_STREAM, binary_predicate *bp) { + WRITE(" ... "); + if (bp == NULL) WRITE("(a meaning internal to Inform)"); + else { + if (bp->right_way_round == FALSE) { + bp = bp->reversal; + WRITE("reversed "); + } + WordAssemblages::index(OUT, &(bp->relation_name)); + } + WRITE(""); +} diff --git a/inform7/index-module/Chapter 2/Relations.w b/inform7/index-module/Chapter 2/Relations Element.w similarity index 72% rename from inform7/index-module/Chapter 2/Relations.w rename to inform7/index-module/Chapter 2/Relations Element.w index 14afec47d..6aceb529c 100644 --- a/inform7/index-module/Chapter 2/Relations.w +++ b/inform7/index-module/Chapter 2/Relations Element.w @@ -1,11 +1,11 @@ -[IXRelations::] Relations. +[IXRelations::] Relations Element. To index relations. @ A brief table of relations appears on the Phrasebook Index page. = -void IXRelations::index_table(OUTPUT_STREAM) { +void IXRelations::render(OUTPUT_STREAM) { binary_predicate *bp; HTML_OPEN("p"); HTML::begin_plain_html_table(OUT); @@ -33,19 +33,3 @@ void IXRelations::index_table(OUTPUT_STREAM) { HTML::end_html_table(OUT); HTML_CLOSE("p"); } - -@ And a briefer note still for the table of verbs. - -= -void IXRelations::index_for_verbs(OUTPUT_STREAM, binary_predicate *bp) { - WRITE(" ... "); - if (bp == NULL) WRITE("(a meaning internal to Inform)"); - else { - if (bp->right_way_round == FALSE) { - bp = bp->reversal; - WRITE("reversed "); - } - WordAssemblages::index(OUT, &(bp->relation_name)); - } - WRITE(""); -} diff --git a/inform7/index-module/Chapter 2/Rules for Scenes Element.w b/inform7/index-module/Chapter 2/Rules for Scenes Element.w new file mode 100644 index 000000000..75dcefb4a --- /dev/null +++ b/inform7/index-module/Chapter 2/Rules for Scenes Element.w @@ -0,0 +1,20 @@ +[IXRulesForScenes::] Rules for Scenes Element. + +The RS element. + +@ + += +void IXRulesForScenes::render(OUTPUT_STREAM) { + HTML_OPEN("p"); WRITE("The scene-changing machinery"); HTML_CLOSE("p"); + IXRules::index_rules_box(OUT, "Scene changing", EMPTY_WORDING, NULL, + Rulebooks::std(SCENE_CHANGING_RB), NULL, NULL, 1, FALSE); + HTML_OPEN("p"); + Index::anchor(OUT, I"SRULES"); + WRITE("General rules applying to scene changes"); + HTML_CLOSE("p"); + IXRules::index_rules_box(OUT, "When a scene begins", EMPTY_WORDING, NULL, + Rulebooks::std(WHEN_SCENE_BEGINS_RB), NULL, NULL, 1, FALSE); + IXRules::index_rules_box(OUT, "When a scene ends", EMPTY_WORDING, NULL, + Rulebooks::std(WHEN_SCENE_ENDS_RB), NULL, NULL, 1, FALSE); +} diff --git a/inform7/index-module/Chapter 2/Rules.w b/inform7/index-module/Chapter 2/Rules.w index 140a9066c..a767f048e 100644 --- a/inform7/index-module/Chapter 2/Rules.w +++ b/inform7/index-module/Chapter 2/Rules.w @@ -411,12 +411,6 @@ int IXRules::noteworthy_rulebooks(inform_extension *E) { return nb; } -void IXRules::index_scene(OUTPUT_STREAM) { - HTML_OPEN("p"); WRITE("The scene-changing machinery"); HTML_CLOSE("p"); - IXRules::index_rules_box(OUT, "Scene changing", EMPTY_WORDING, NULL, - Rulebooks::std(SCENE_CHANGING_RB), NULL, NULL, 1, FALSE); -} - int unique_xtra_no = 0; void IXRules::index_rules_box(OUTPUT_STREAM, char *name, wording W, text_stream *doc_link, rulebook *rb, activity *av, char *text, int indent, int hide_behind_plus) { @@ -643,64 +637,6 @@ void IXRules::index_outcomes(OUTPUT_STREAM, outcomes *outs, int suppress_outcome } } -@ - -= -void IXRules::index_timed_rules(OUTPUT_STREAM) { - int when_count = 0, tt_count = 0; - @; - @; - if ((when_count == 0) && (tt_count == 0)) { - HTML_OPEN("p"); WRITE("None."); HTML_CLOSE("p"); - } -} - -@ = - id_body *idb; - LOOP_OVER(idb, id_body) { - int t = TimedRules::get_timing_of_event(idb->head_of_defn); - if (t == NO_FIXED_TIME) { - if (when_count == 0) { - HTML_OPEN("p"); - WRITE("Events with no specific time"); - HTML_CLOSE("p"); - } - when_count++; - HTML_OPEN_WITH("p", "class=\"tightin2\""); - ImperativeDefinitions::index_preamble(OUT, idb->head_of_defn); - if ((ImperativeDefinitions::body_at(idb)) && - (Wordings::nonempty(Node::get_text(ImperativeDefinitions::body_at(idb))))) - Index::link(OUT, Wordings::first_wn(Node::get_text(ImperativeDefinitions::body_at(idb)))); - WRITE(" (where triggered: "); - linked_list *L = TimedRules::get_uses_as_event(idb->head_of_defn); - parse_node *p; - LOOP_OVER_LINKED_LIST(p, parse_node, L) - Index::link(OUT, Wordings::first_wn(Node::get_text(p))); - WRITE(")"); - HTML_CLOSE("p"); - } - } - -@ = - id_body *idb; - LOOP_OVER(idb, id_body) { - int t = TimedRules::get_timing_of_event(idb->head_of_defn); - if (t >= 0) { /* i.e., an actual time of day in minutes since midnight */ - if (tt_count == 0) { - HTML_OPEN("p"); - WRITE("Timetable"); - HTML_CLOSE("p"); - } - tt_count++; - HTML_OPEN_WITH("p", "class=\"in2\""); - ImperativeDefinitions::index_preamble(OUT, idb->head_of_defn); - if ((ImperativeDefinitions::body_at(idb)) && - (Wordings::nonempty(Node::get_text(ImperativeDefinitions::body_at(idb))))) - Index::link(OUT, Wordings::first_wn(Node::get_text(ImperativeDefinitions::body_at(idb)))); - HTML_CLOSE("p"); - } - } - @h Rule contexts. These are mainly (only?) used in indexing, as a way to represent the idea of being the relevant scene or action for a rule. diff --git a/inform7/index-module/Chapter 2/Tables Element.w b/inform7/index-module/Chapter 2/Tables Element.w new file mode 100644 index 000000000..9908d8983 --- /dev/null +++ b/inform7/index-module/Chapter 2/Tables Element.w @@ -0,0 +1,133 @@ +[IXTables::] Tables Element. + +To index tables. + +@h Indexing. +Tables inside extensions are often used just for the storage needed to manage +back-of-house algorithms, so to speak, and they aren't intended for the end +user to poke around with; that's certainly true of the tables in the Standard +Rules, which of course are always present. So these are hidden by default. + += +void IXTables::render(OUTPUT_STREAM) { + HTML_OPEN("p"); + int m = IXTables::index_tables_in(OUT, NULL, 0); + HTML_CLOSE("p"); + HTML_OPEN("p"); + Index::extra_link(OUT, 2); + if (m > 0) WRITE("Show tables inside extensions too"); + else WRITE("Show tables inside extensions (there are none in the main text)"); + HTML_CLOSE("p"); + Index::extra_div_open(OUT, 2, 1, "e0e0e0"); + inform_extension *E; int efc = 0; + LOOP_OVER(E, inform_extension) IXTables::index_tables_in(OUT, E, efc++); + Index::extra_div_close(OUT, "e0e0e0"); +} + +@ This tabulates tables within a given extension, returning the number listed, +and does nothing at all if that number is 0. + += +int IXTables::index_tables_in(OUTPUT_STREAM, inform_extension *E, int efc) { + int tc = 0; table *t; + LOOP_OVER(t, table) if (IXTables::table_within(t, E)) tc++; + if (tc > 0) { + if (E) { + HTML_OPEN("p"); + WRITE("%S", E->as_copy->edition->work->title); + HTML_CLOSE("p"); + } + HTML::begin_plain_html_table(OUT); + LOOP_OVER(t, table) + if (IXTables::table_within(t, E)) + @; + HTML::end_html_table(OUT); + } + return tc; +} + +@ The following probably ought to use a multiplication sign rather than a +Helvetica-style lower case "x", but life is full of compromises. + +@ = + HTML::first_html_column_spaced(OUT, 0); + WRITE("%+W", Node::get_text(t->headline_fragment)); + table_contribution *tc; int ntc = 0; + for (tc = t->table_created_at; tc; tc = tc->next) { + if (ntc++ > 0) WRITE(" +"); + Index::link(OUT, Wordings::first_wn(Node::get_text(tc->source_table))); + } + HTML::next_html_column_spaced(OUT, 0); + int rc = Tables::get_no_rows(t); + WRITE(""); + HTML_OPEN_WITH("span", "class=\"smaller\""); + if (t->first_column_by_definition) { + WRITE("%d definition%s", rc, + (rc == 1)?"":"s"); + } else { + WRITE("%d column%s x %d row%s", + t->no_columns, (t->no_columns == 1)?"":"s", + rc, (rc == 1)?"":"s"); + } + if (t->blank_rows > 0) { + WRITE(" (%d blank", t->blank_rows); + if (Wordings::nonempty(t->blank_rows_for_each_text)) + WRITE(", one for each %+W", t->blank_rows_for_each_text); + WRITE(")"); + } + HTML_CLOSE("span"); + WRITE(""); + HTML::end_html_row(OUT); + int col; + for (col = 0; col < t->no_columns; col++) { + HTML::first_html_column(OUT, 0); + WRITE("  col %d:  ", col+1); + wording CW = Nouns::nominative_singular(t->columns[col].column_identity->name); + if ((t->first_column_by_definition) && (col == 0)) { + parse_node *PN = t->where_used_to_define; + WRITE("%+W", Node::get_text(PN)); + Index::link(OUT, Wordings::first_wn(Node::get_text(PN))); + } else { + if (t->first_column_by_definition) WRITE("sets "); + WRITE("%+W ", CW); + TEMPORARY_TEXT(TEMP) + WRITE_TO(TEMP, "%+W", CW); + if (t->first_column_by_definition == FALSE) WRITE_TO(TEMP, " entry"); + PasteButtons::paste_text(OUT, TEMP); + DISCARD_TEXT(TEMP) + } + HTML::next_html_column(OUT, 0); + if ((t->first_column_by_definition) && (col == 0)) { + parse_node *cell; + int row; + for (row = 1, cell = t->columns[0].entries->down; cell; cell = cell->next, row++) { + if (row > 1) WRITE(", "); + WRITE("%+W", Node::get_text(cell)); + Index::link(OUT, Wordings::first_wn(Node::get_text(cell))); + } + } else if (t->first_column_by_definition) { + Kinds::Textual::write(OUT, + Tables::Columns::get_kind( + t->columns[col].column_identity)); + WRITE(" property"); + } else { + WRITE("of "); + Kinds::Textual::write_plural(OUT, + Tables::Columns::get_kind( + t->columns[col].column_identity)); + } + HTML::end_html_row(OUT); + } + +@ The following laboriously tests whether a table is defined within a +given extension: + += +int IXTables::table_within(table *t, inform_extension *E) { + if (t->amendment_of) return FALSE; + heading *at_heading = + Headings::of_wording(Node::get_text(t->table_created_at->source_table)); + inform_extension *at_E = Headings::get_extension_containing(at_heading); + if (E == at_E) return TRUE; + return FALSE; +} diff --git a/inform7/index-module/Chapter 3/Actions.w b/inform7/index-module/Chapter 3/Actions.w index d4d1a38aa..1b5af8bb7 100644 --- a/inform7/index-module/Chapter 3/Actions.w +++ b/inform7/index-module/Chapter 3/Actions.w @@ -170,32 +170,6 @@ void IXActions::act_index_something(OUTPUT_STREAM, action_name *an, int argc) { WRITE(" "); } -void IXActions::index_named_patterns(OUTPUT_STREAM) { - named_action_pattern *nap; - int num_naps = NUMBER_CREATED(named_action_pattern); - - if (num_naps == 0) { - HTML_OPEN("p"); - WRITE("No names for kinds of action have yet been defined."); - HTML_CLOSE("p"); - } - - LOOP_OVER(nap, named_action_pattern) { - HTML_OPEN("p"); WRITE("%+W", Nouns::nominative_singular(nap->as_noun)); - Index::link(OUT, Wordings::first_wn(nap->text_of_declaration)); - HTML_TAG("br"); - WRITE("  defined as any of the following acts:\n"); - named_action_pattern_entry *nape; - LOOP_OVER_LINKED_LIST(nape, named_action_pattern_entry, nap->patterns) { - action_pattern *ap = nape->behaviour; - HTML_TAG("br"); - WRITE("    %+W", ap->text_of_pattern); - Index::link(OUT, Wordings::first_wn(ap->text_of_pattern)); - } - HTML_CLOSE("p"); - } -} - void IXActions::index_named_patterns_for_extension(OUTPUT_STREAM, source_file *sf, inform_extension *E) { named_action_pattern *nap; int kc = 0; diff --git a/inform7/index-module/Chapter 3/External Files.w b/inform7/index-module/Chapter 3/External Files.w deleted file mode 100644 index 7f51d9438..000000000 --- a/inform7/index-module/Chapter 3/External Files.w +++ /dev/null @@ -1,48 +0,0 @@ -[IXExternalFiles::] External Files. - -To produce the index of external files. - -@ This is more or less perfunctory, but still of some use, if only as a list. - -= -void IXExternalFiles::index_all(OUTPUT_STREAM) { - if (PluginManager::active(files_plugin) == FALSE) return; - files_data *exf; - if (NUMBER_CREATED(files_data) == 0) { - HTML_OPEN("p"); - WRITE("This project doesn't read or write external files."); - HTML_CLOSE("p"); - return; - } - HTML_OPEN("p"); - WRITE("List of External Files"); - HTML_CLOSE("p"); - HTML::begin_html_table(OUT, "#ffffff", TRUE, 0, 0, 0, 0, 0); - LOOP_OVER(exf, files_data) { - HTML::first_html_column(OUT, THUMBNAIL_WIDTH+10); - if (exf->file_is_binary) { - HTML_TAG_WITH("img", "border=\"0\" src=\"inform:/doc_images/exf_binary.png\""); - } else { - HTML_TAG_WITH("img", "border=\"0\" src=\"inform:/doc_images/exf_text.png\""); - } - WRITE(" "); - HTML::next_html_column(OUT, 0); - WRITE("%+W", exf->name); - Index::link(OUT, Wordings::first_wn(exf->name)); - HTML_TAG("br"); - WRITE("Filename: %s %N- owned by ", - (exf->file_is_binary)?"- binary ":"", - exf->unextended_filename); - switch (exf->file_ownership) { - case OWNED_BY_THIS_PROJECT: WRITE("this project"); break; - case OWNED_BY_ANOTHER_PROJECT: WRITE("another project"); break; - case OWNED_BY_SPECIFIC_PROJECT: - WRITE("project with IFID number %S", - exf->IFID_of_owner); - break; - } - HTML::end_html_row(OUT); - } - HTML::end_html_table(OUT); - HTML_OPEN("p"); -} diff --git a/inform7/index-module/Chapter 3/Figures Element.w b/inform7/index-module/Chapter 3/Figures Element.w new file mode 100644 index 000000000..018e51edf --- /dev/null +++ b/inform7/index-module/Chapter 3/Figures Element.w @@ -0,0 +1,264 @@ +[IXFigures::] Figures Element. + +To produce the index of figures. + +@ + += +void IXFigures::render(OUTPUT_STREAM) { + IXFigures::index_all(OUT); + IXFigures::index_sounds(OUT); + IXFigures::index_files(OUT); +} + +@ The index 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 + += +void IXFigures::index_all(OUTPUT_STREAM) { + if (PluginManager::active(figures_plugin) == FALSE) return; + figures_data *bf; FILE *FIGURE_FILE; + int MAX_INDEXED_FIGURES = global_compilation_settings.index_figure_thumbnails; + int rv; + if (NUMBER_CREATED(figures_data) < 2) { /* cover art always creates 1 */ + HTML_OPEN("p"); WRITE("There are no figures, or illustrations, in this project."); + HTML_CLOSE("p"); return; + } + 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; + LOOP_OVER(bf, figures_data) { + if (bf->figure_number > 1) { + TEMPORARY_TEXT(line2) + unsigned int width = 0, height = 0; + rv = 0; + FIGURE_FILE = Filenames::fopen(bf->filename_of_image_file, "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(bf->filename_of_image_file, "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"); + HTML_TAG("br"); + } else { + WRITE_TO(line2, "%s format: %d (width) by %d (height) pixels", + real_format, width, height); + HTML_TAG("br"); + } + } else { + WRITE_TO(line2, "Missing from the Figures folder"); + HTML_TAG("br"); + } + 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\"", + bf->filename_of_image_file, 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("%+W", bf->name); + Index::link(OUT, Wordings::first_wn(bf->name)); + + TEMPORARY_TEXT(rel) + Filenames::to_text_relative(rel, bf->filename_of_image_file, + Projects::materials_path(Task::project())); + HTML_TAG("br"); + WRITE("%SFilename: \"%S\" - resource number %d", line2, rel, bf->figure_number); + DISCARD_TEXT(rel) + HTML::end_html_row(OUT); + DISCARD_TEXT(line2) + } + } + HTML::end_html_table(OUT); + HTML_OPEN("p"); + if (count_of_displayed_figures > MAX_INDEXED_FIGURES) { + 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.)", + MAX_INDEXED_FIGURES, 10*MAX_INDEXED_FIGURES); + HTML_CLOSE("p"); + } +} + +@h Sounds Index. + += +void IXFigures::index_sounds(OUTPUT_STREAM) { + if (PluginManager::active(sounds_plugin) == FALSE) return; + sounds_data *bs; FILE *SOUND_FILE; + TEMPORARY_TEXT(line2) + int rv; + if (NUMBER_CREATED(sounds_data) == 0) { + HTML_OPEN("p"); + WRITE("There are no sound effects in this project."); + HTML_CLOSE("p"); + return; + } + HTML_OPEN("p"); WRITE("List of Sounds"); HTML_CLOSE("p"); + WRITE("\n"); + HTML::begin_html_table(OUT, "#ffffff", TRUE, 0, 0, 0, 0, 0); + LOOP_OVER(bs, sounds_data) { + unsigned int duration, pBitsPerSecond, pChannels, pSampleRate, fsize, + midi_version = 0, no_tracks = 0; + int preview = TRUE, waveform_style = TRUE; + rv = 0; + SOUND_FILE = Filenames::fopen(bs->filename_of_sound_file, "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(bs->filename_of_sound_file, "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(bs->filename_of_sound_file, "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"); + HTML_TAG("br"); + } 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"); + HTML_TAG("br"); + } 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"); + HTML_TAG("br"); + 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); + HTML_TAG("br"); + } + } + } else { + WRITE_TO(line2, "Missing from the Sounds folder"); + HTML_TAG("br"); + } + 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", + bs->filename_of_sound_file, 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("%+W", bs->name); + Index::link(OUT, Wordings::first_wn(bs->name)); + TEMPORARY_TEXT(rel) + Filenames::to_text_relative(rel, bs->filename_of_sound_file, + Projects::materials_path(Task::project())); + HTML_TAG("br"); + WRITE("%SFilename: \"%S\" - resource number %d", line2, rel, bs->sound_number); + DISCARD_TEXT(rel) + HTML::end_html_row(OUT); + } + HTML::end_html_table(OUT); + HTML_OPEN("p"); + DISCARD_TEXT(line2) +} + +@ This is more or less perfunctory, but still of some use, if only as a list. + += +void IXFigures::index_files(OUTPUT_STREAM) { + if (PluginManager::active(files_plugin) == FALSE) return; + files_data *exf; + if (NUMBER_CREATED(files_data) == 0) { + HTML_OPEN("p"); + WRITE("This project doesn't read or write external files."); + HTML_CLOSE("p"); + return; + } + HTML_OPEN("p"); + WRITE("List of External Files"); + HTML_CLOSE("p"); + HTML::begin_html_table(OUT, "#ffffff", TRUE, 0, 0, 0, 0, 0); + LOOP_OVER(exf, files_data) { + HTML::first_html_column(OUT, THUMBNAIL_WIDTH+10); + if (exf->file_is_binary) { + HTML_TAG_WITH("img", "border=\"0\" src=\"inform:/doc_images/exf_binary.png\""); + } else { + HTML_TAG_WITH("img", "border=\"0\" src=\"inform:/doc_images/exf_text.png\""); + } + WRITE(" "); + HTML::next_html_column(OUT, 0); + WRITE("%+W", exf->name); + Index::link(OUT, Wordings::first_wn(exf->name)); + HTML_TAG("br"); + WRITE("Filename: %s %N- owned by ", + (exf->file_is_binary)?"- binary ":"", + exf->unextended_filename); + switch (exf->file_ownership) { + case OWNED_BY_THIS_PROJECT: WRITE("this project"); break; + case OWNED_BY_ANOTHER_PROJECT: WRITE("another project"); break; + case OWNED_BY_SPECIFIC_PROJECT: + WRITE("project with IFID number %S", + exf->IFID_of_owner); + break; + } + HTML::end_html_row(OUT); + } + HTML::end_html_table(OUT); + HTML_OPEN("p"); +} diff --git a/inform7/index-module/Chapter 3/Figures.w b/inform7/index-module/Chapter 3/Figures.w deleted file mode 100644 index 13c385232..000000000 --- a/inform7/index-module/Chapter 3/Figures.w +++ /dev/null @@ -1,94 +0,0 @@ -[IXFigures::] Figures. - -To produce the index of figures. - -@ The index 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 - -= -void IXFigures::index_all(OUTPUT_STREAM) { - if (PluginManager::active(figures_plugin) == FALSE) return; - figures_data *bf; FILE *FIGURE_FILE; - int MAX_INDEXED_FIGURES = global_compilation_settings.index_figure_thumbnails; - int rv; - if (NUMBER_CREATED(figures_data) < 2) { /* cover art always creates 1 */ - HTML_OPEN("p"); WRITE("There are no figures, or illustrations, in this project."); - HTML_CLOSE("p"); return; - } - 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; - LOOP_OVER(bf, figures_data) { - if (bf->figure_number > 1) { - TEMPORARY_TEXT(line2) - unsigned int width = 0, height = 0; - rv = 0; - FIGURE_FILE = Filenames::fopen(bf->filename_of_image_file, "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(bf->filename_of_image_file, "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"); - HTML_TAG("br"); - } else { - WRITE_TO(line2, "%s format: %d (width) by %d (height) pixels", - real_format, width, height); - HTML_TAG("br"); - } - } else { - WRITE_TO(line2, "Missing from the Figures folder"); - HTML_TAG("br"); - } - 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\"", - bf->filename_of_image_file, 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("%+W", bf->name); - Index::link(OUT, Wordings::first_wn(bf->name)); - - TEMPORARY_TEXT(rel) - Filenames::to_text_relative(rel, bf->filename_of_image_file, - Projects::materials_path(Task::project())); - HTML_TAG("br"); - WRITE("%SFilename: \"%S\" - resource number %d", line2, rel, bf->figure_number); - DISCARD_TEXT(rel) - HTML::end_html_row(OUT); - DISCARD_TEXT(line2) - } - } - HTML::end_html_table(OUT); - HTML_OPEN("p"); - if (count_of_displayed_figures > MAX_INDEXED_FIGURES) { - 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.)", - MAX_INDEXED_FIGURES, 10*MAX_INDEXED_FIGURES); - HTML_CLOSE("p"); - } -} diff --git a/inform7/index-module/Chapter 3/Scenes.w b/inform7/index-module/Chapter 3/Plot Element.w similarity index 94% rename from inform7/index-module/Chapter 3/Scenes.w rename to inform7/index-module/Chapter 3/Plot Element.w index 614a76fe0..331de229c 100644 --- a/inform7/index-module/Chapter 3/Scenes.w +++ b/inform7/index-module/Chapter 3/Plot Element.w @@ -1,4 +1,4 @@ -[IXScenes::] Scenes. +[IXScenes::] Plot Element. Parallel to the World index of space is the Scenes index of time, and in this section we render it as HTML. @@ -11,7 +11,7 @@ with a notation which takes a little bit of on-screen explanation, but seems natural enough to learn in practice. = -void IXScenes::index(OUTPUT_STREAM) { +void IXScenes::render(OUTPUT_STREAM) { int nr = NUMBER_CREATED(scene); scene **sorted = Memory::calloc(nr, sizeof(scene *), INDEX_SORTING_MREASON); @; @@ -23,11 +23,6 @@ void IXScenes::index(OUTPUT_STREAM) { Memory::I7_array_free(sorted, INDEX_SORTING_MREASON, nr, sizeof(scene *)); } -void IXScenes::index_rules(OUTPUT_STREAM) { - IXRules::index_scene(OUT); /* rules in generic scene-ending rulebooks */ - @; -} - @ As usual, we sort with the C library's |qsort|. @ = @@ -81,15 +76,6 @@ about and created but never made use of.) "or subsequent time because the scene can begin in more than one way."); HTML_CLOSE("p"); -@ = - HTML_OPEN("p"); - Index::anchor(OUT, I"SRULES"); - WRITE("General rules applying to scene changes"); - HTML_CLOSE("p"); - IXRules::index_rules_box(OUT, "When a scene begins", EMPTY_WORDING, NULL, - Rulebooks::std(WHEN_SCENE_BEGINS_RB), NULL, NULL, 1, FALSE); - IXRules::index_rules_box(OUT, "When a scene ends", EMPTY_WORDING, NULL, - Rulebooks::std(WHEN_SCENE_ENDS_RB), NULL, NULL, 1, FALSE); @ = Index::anchor(OUT, I"SDETAILS"); diff --git a/inform7/index-module/Chapter 3/Sound Effects.w b/inform7/index-module/Chapter 3/Sound Effects.w deleted file mode 100644 index bf9c5250a..000000000 --- a/inform7/index-module/Chapter 3/Sound Effects.w +++ /dev/null @@ -1,119 +0,0 @@ -[IXSounds::] Sound Effects. - -To produce the index of sound effects. - -@h Sounds Index. - -= -void IXSounds::index_all(OUTPUT_STREAM) { - if (PluginManager::active(sounds_plugin) == FALSE) return; - sounds_data *bs; FILE *SOUND_FILE; - TEMPORARY_TEXT(line2) - int rv; - if (NUMBER_CREATED(sounds_data) == 0) { - HTML_OPEN("p"); - WRITE("There are no sound effects in this project."); - HTML_CLOSE("p"); - return; - } - HTML_OPEN("p"); WRITE("List of Sounds"); HTML_CLOSE("p"); - WRITE("\n"); - HTML::begin_html_table(OUT, "#ffffff", TRUE, 0, 0, 0, 0, 0); - LOOP_OVER(bs, sounds_data) { - unsigned int duration, pBitsPerSecond, pChannels, pSampleRate, fsize, - midi_version = 0, no_tracks = 0; - int preview = TRUE, waveform_style = TRUE; - rv = 0; - SOUND_FILE = Filenames::fopen(bs->filename_of_sound_file, "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(bs->filename_of_sound_file, "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(bs->filename_of_sound_file, "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"); - HTML_TAG("br"); - } 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"); - HTML_TAG("br"); - } 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"); - HTML_TAG("br"); - 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); - HTML_TAG("br"); - } - } - } else { - WRITE_TO(line2, "Missing from the Sounds folder"); - HTML_TAG("br"); - } - 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", - bs->filename_of_sound_file, 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("%+W", bs->name); - Index::link(OUT, Wordings::first_wn(bs->name)); - TEMPORARY_TEXT(rel) - Filenames::to_text_relative(rel, bs->filename_of_sound_file, - Projects::materials_path(Task::project())); - HTML_TAG("br"); - WRITE("%SFilename: \"%S\" - resource number %d", line2, rel, bs->sound_number); - DISCARD_TEXT(rel) - HTML::end_html_row(OUT); - } - HTML::end_html_table(OUT); - HTML_OPEN("p"); - DISCARD_TEXT(line2) -} diff --git a/inform7/index-module/Contents.w b/inform7/index-module/Contents.w index 6d3be115a..1a0fbd8a2 100644 --- a/inform7/index-module/Contents.w +++ b/inform7/index-module/Contents.w @@ -18,22 +18,25 @@ Chapter 2: Indexing Adjectives Variables Properties - Relations + Relations Element Inferences Rules Activities Phrasebook Index + Tables Element + Innards Element + Events Element + Rules for Scenes Element + Behaviour Element Chapter 3: Indexing for Plugins - Figures - Sound Effects - External Files + Figures Element Spatial The Player Backdrops Regions The Map - Scenes + Plot Element Actions Commands Index diff --git a/inter/codegen-module/Chapter 6/Card Element.w b/inter/codegen-module/Chapter 6/Card Element.w index 0ba51d805..4817a2029 100644 --- a/inter/codegen-module/Chapter 6/Card Element.w +++ b/inter/codegen-module/Chapter 6/Card Element.w @@ -7,7 +7,7 @@ natural way to present bibliographic data to the user. In effect, it's a simplified form of the iFiction record, without the XML overhead. = -void CardElement::Library_Card(OUTPUT_STREAM) { +void CardElement::render(OUTPUT_STREAM) { inter_tree *I = Index::get_tree(); inter_package *pack = Inter::Packages::by_url(I, I"/main/completion/bibliographic"); diff --git a/inter/codegen-module/Chapter 6/Index File Services.w b/inter/codegen-module/Chapter 6/Index File Services.w index 66322c424..a0f49f3f1 100644 --- a/inter/codegen-module/Chapter 6/Index File Services.w +++ b/inter/codegen-module/Chapter 6/Index File Services.w @@ -651,10 +651,44 @@ void Index::test_card(OUTPUT_STREAM, wording W) { void Index::index_actual_element(OUTPUT_STREAM, text_stream *elt) { if (Str::eq_wide_string(elt, L"Cd")) { - CardElement::Library_Card(OUT); + CardElement::render(OUT); return; } #ifdef CORE_MODULE + if (Str::eq_wide_string(elt, L"Tb")) { + IXTables::render(OUT); + return; + } + if (Str::eq_wide_string(elt, L"In")) { + IXInnards::render(OUT, Supervisor::current_vm()); + return; + } + if (Str::eq_wide_string(elt, L"Rl")) { + IXRelations::render(OUT); + return; + } + if (Str::eq_wide_string(elt, L"Ev")) { + IXEvents::render(OUT); + return; + } + if (Str::eq_wide_string(elt, L"RS")) { + IXRulesForScenes::render(OUT); + return; + } + if (Str::eq_wide_string(elt, L"Pl")) { + IXScenes::render(OUT); + return; + } + if (Str::eq_wide_string(elt, L"Bh")) { + IXBehaviour::render(OUT); + return; + } + if (Str::eq_wide_string(elt, L"Fi")) { + IXFigures::render(OUT); + return; + } + + if (Str::eq_wide_string(elt, L"C")) { IndexHeadings::index(OUT); IndexExtensions::index(OUT); @@ -667,20 +701,6 @@ void Index::index_actual_element(OUTPUT_STREAM, text_stream *elt) { Equations::index(OUT); return; } - if (Str::eq_wide_string(elt, L"Fi")) { - IXFigures::index_all(OUT); - IXSounds::index_all(OUT); - IXExternalFiles::index_all(OUT); - return; - } - if (Str::eq_wide_string(elt, L"Tb")) { - Tables::index(OUT); - return; - } - if (Str::eq_wide_string(elt, L"In")) { - IXActivities::innards(OUT, Supervisor::current_vm()); - return; - } if (Str::eq_wide_string(elt, L"Ph")) { Phrases::Index::index_page_Phrasebook(OUT); @@ -690,10 +710,6 @@ void Index::index_actual_element(OUTPUT_STREAM, text_stream *elt) { IndexLexicon::index(OUT); return; } - if (Str::eq_wide_string(elt, L"Rl")) { - IXRelations::index_table(OUT); - return; - } if (Str::eq_wide_string(elt, L"Vb")) { IndexLexicon::index_verbs(OUT); return; @@ -718,22 +734,6 @@ void Index::index_actual_element(OUTPUT_STREAM, text_stream *elt) { return; } - if (Str::eq_wide_string(elt, L"Pl")) { - #ifdef IF_MODULE - IXScenes::index(OUT); - #endif - return; - } - if (Str::eq_wide_string(elt, L"Ev")) { - IXRules::index_timed_rules(OUT); /* rules which happen at set times of day */ - return; - } - if (Str::eq_wide_string(elt, L"RS")) { - #ifdef IF_MODULE - IXScenes::index_rules(OUT); - #endif - return; - } if (Str::eq_wide_string(elt, L"St")) { IXRules::Rules_page(OUT, 1); @@ -745,33 +745,19 @@ void Index::index_actual_element(OUTPUT_STREAM, text_stream *elt) { } if (Str::eq_wide_string(elt, L"A1")) { - #ifdef IF_MODULE CommandsIndex::page(OUT); - #endif - return; - } - if (Str::eq_wide_string(elt, L"Bh")) { - #ifdef IF_MODULE - IXActions::index_named_patterns(OUT); - #endif return; } if (Str::eq_wide_string(elt, L"Cm")) { - #ifdef IF_MODULE CommandsIndex::commands(OUT); - #endif return; } if (Str::eq_wide_string(elt, L"To")) { - #ifdef IF_MODULE CommandsIndex::tokens(OUT); - #endif return; } if (Str::eq_wide_string(elt, L"A2")) { - #ifdef IF_MODULE CommandsIndex::alphabetical(OUT); - #endif return; } #endif