diff --git a/README.md b/README.md index a68062e6b..ab93bcd90 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Inform 7 -[Version](notes/versioning.md): 10.2.0-beta+6V93 'Krypton' (3 November 2022) +[Version](notes/versioning.md): 10.2.0-beta+6V94 'Krypton' (5 November 2022) ## About Inform diff --git a/build.txt b/build.txt index d16d2c8c0..f2e763039 100644 --- a/build.txt +++ b/build.txt @@ -1,3 +1,3 @@ Prerelease: beta -Build Date: 3 November 2022 -Build Number: 6V93 +Build Date: 5 November 2022 +Build Number: 6V94 diff --git a/docs/index-module/2-iu.html b/docs/index-module/2-iu.html index 978242d71..b4195806c 100644 --- a/docs/index-module/2-iu.html +++ b/docs/index-module/2-iu.html @@ -141,7 +141,7 @@ the source text in the application. IndexUtilities::link_to_location(OUT, Lexer::word_location(wn), TRUE); } -void IndexUtilities::link_package(OUTPUT_STREAM, inter_package *pack) { +void IndexUtilities::link_package(OUTPUT_STREAM, inter_package *pack) { int at = (int) Metadata::read_optional_numeric(pack, I"^at"); if (at > 0) IndexUtilities::link(OUT, at); } diff --git a/docs/index-module/3-fe.html b/docs/index-module/3-fe.html index 2a3354c20..2def67f57 100644 --- a/docs/index-module/3-fe.html +++ b/docs/index-module/3-fe.html @@ -59,7 +59,7 @@ function togglePopup(material_id) {

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

-
+

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

@@ -74,7 +74,8 @@ function togglePopup(material_id) { InterNodeList::array_sort(inv->file_nodes, MakeSynopticModuleStage::module_order); Index the figures1.1; Index the sounds1.2; - Index the files1.3; + Index the internal files1.3; + Index the files1.4; }

§1.1. Figures. Index the figures1.1 = @@ -203,11 +204,11 @@ to match this width, preserving the aspect ratio.

+    HTML_OPEN("p");
+    Localisation::bold(OUT, LD, I"Index.Elements.Fi.ListOfSounds");
+    HTML_CLOSE("p");
     if (InterNodeList::array_len(inv->sound_nodes) == 0) {
         HTML_OPEN("p");
-        Localisation::bold(OUT, LD, I"Index.Elements.Fi.ListOfSounds");
-        HTML_CLOSE("p");
-        HTML_OPEN("p");
         Localisation::roman(OUT, LD, I"Index.Elements.Fi.NoSounds");
         HTML_CLOSE("p");
     } else {
@@ -366,26 +367,180 @@ to match this width, preserving the aspect ratio.
     HTML::end_html_row(OUT);
 
-

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

+

§1.3. Internal files.

-

Index the files1.3 = +

define EXTERNAL_TEXT_FILE_NFSMF 0
+define EXTERNAL_BINARY_FILE_NFSMF 1
+define INTERNAL_TEXT_FILE_NFSMF 2
+define INTERNAL_BINARY_FILE_NFSMF 3
+define INTERNAL_FORM_FILE_NFSMF 4
+
+

Index the internal files1.3 =

+    HTML_OPEN("p");
+    Localisation::bold(OUT, LD, I"Index.Elements.Fi.ListOfInternalFiles");
+    HTML_CLOSE("p");
+    if (InterNodeList::array_len(inv->internal_file_nodes) == 0) {
+        HTML_OPEN("p");
+        Localisation::roman(OUT, LD, I"Index.Elements.Fi.NoInternalFiles");
+        HTML_CLOSE("p");
+    } else {
+        Tabulate the internal files1.3.1;
+    }
+
+ +

§1.3.1. Tabulate the internal files1.3.1 = +

+ +
+    HTML::begin_html_table(OUT, NULL, TRUE, 0, 0, 0, 0, 0);
+    inter_package *pack;
+    LOOP_OVER_INVENTORY_PACKAGES(pack, i, inv->internal_file_nodes) {
+        inter_ti id = Metadata::read_numeric(pack, I"^resource_id");
+        text_stream *filename_as_text = Metadata::required_textual(pack, I"^filename");
+        filename *F = Filenames::from_text(filename_as_text);
+        inter_ti format = Metadata::read_numeric(pack, I"^internal_file_format");
+        TEMPORARY_TEXT(description)
+        TEMPORARY_TEXT(preview)
+        Find internal file preview1.3.1.1;
+        Render a table row for the internal file1.3.1.2;
+        DISCARD_TEXT(description)
+        DISCARD_TEXT(preview)
+    }
+    HTML::end_html_table(OUT);
+
+ +

§1.3.1.1. Find internal file preview1.3.1.1 = +

+ +
+    FILE *INTERNAL_FILE = Filenames::fopen(F, "rb");
+    if (INTERNAL_FILE) {
+        switch (format) {
+            case INTERNAL_TEXT_FILE_NFSMF:
+                WRITE_TO(description, "%S", filename_as_text);
+                Offer a textual preview1.3.1.1.1;
+                break;
+            case INTERNAL_BINARY_FILE_NFSMF:
+                WRITE_TO(description, "%S", filename_as_text);
+                Offer a binary preview1.3.1.1.2;
+                break;
+            case INTERNAL_FORM_FILE_NFSMF:
+                WRITE_TO(description, "%S", filename_as_text);
+                Offer a binary preview1.3.1.1.2;
+                break;
+        }
+    } else {
+        Localisation::italic(description, LD, I"Index.Elements.Fi.MissingInternalFile");
+    }
+
+ +

§1.3.1.1.1. Offer a textual preview1.3.1.1.1 = +

+ +
+    for (int row = 0; row < 6; ) {
+        int col = 0;
+        unsigned int B, line_ended = FALSE;
+        while (BinaryFiles::read_int8(INTERNAL_FILE, &B)) {
+            if ((B == 10) || (B == 13)) { line_ended = TRUE; break; }
+            if (col++ >= 80) { WRITE_TO(preview, "[...]"); line_ended = TRUE; break; }
+            if ((B >= 0x20) && (B <= 0x7E)) WRITE_TO(preview, "%c", B);
+            else WRITE_TO(preview, "?");
+        }
+        if (line_ended == FALSE) break;
+        if (col > 0) row++;
+        WRITE_TO(preview, "\n");
+    }
+
+ +

§1.3.1.1.2. Offer a binary preview1.3.1.1.2 = +

+ +
+    for (int row = 0; row < 6; row++) {
+        unsigned int bytes[16];
+        for (int col = 0; col < 16; col++) {
+            if (!BinaryFiles::read_int8(INTERNAL_FILE, &(bytes[col]))) {
+                for (; col < 16; col++) bytes[col] = 256;
+                row = 6; break;
+            }
+        }
+        for (int col = 0; col < 16; col++) {
+            if (bytes[col] < 256) WRITE_TO(preview, "%02x ", bytes[col]);
+            else WRITE_TO(preview, ".. ");
+        }
+        for (int col = 0; col < 16; col++) {
+            if ((bytes[col] >= 0x20) && (bytes[col] <= 0x7E)) WRITE_TO(preview, "%c", bytes[col]);
+            else WRITE_TO(preview, ".");
+        }
+        WRITE_TO(preview, "\n");
+    }
+
+ +

§1.3.1.2. Render a table row for the internal file1.3.1.2 = +

+ +
+    HTML::first_html_column(OUT, THUMBNAIL_WIDTH+10);
+    if (Str::len(description) == 0) {
+        HTML_TAG_WITH("img", "border=\"0\" src=\"inform:/doc_images/image_problem.png\"");
+    } else {
+        HTML_TAG_WITH("img", "border=\"0\" src=\"inform:/doc_images/data.png\"");
+    }
+    WRITE("&nbsp;");
+    HTML::next_html_column(OUT, 0);
+    HTML_OPEN_WITH("p", "class=\"hang\"");
+    switch (format) {
+        case INTERNAL_TEXT_FILE_NFSMF:   WRITE("(text) "); break;
+        case INTERNAL_BINARY_FILE_NFSMF: WRITE("(binary) "); break;
+        case INTERNAL_FORM_FILE_NFSMF:   WRITE("(form) "); break;
+    }
+    WRITE("%S", Metadata::required_textual(pack, I"^name"));
+    IndexUtilities::link_package(OUT, pack);
+    if (Str::len(description) > 0) {
+        HTML_TAG("br");
+        WRITE("%S", description);
+    }
+    HTML_CLOSE("p");
+    if (Str::len(preview) > 0) {
+        HTML_OPEN("pre");
+        int N = Streams::get_indentation(OUT);
+        Streams::set_indentation(OUT, 0);
+        WRITE("\n%S", preview);
+        Streams::set_indentation(OUT, N);
+        HTML_CLOSE("pre");
+        WRITE("\n");
+    }
+    HTML_OPEN("p");
+    Localisation::roman_ti(description, LD, I"Index.Elements.Fi.Resource",
+        Filenames::get_leafname(F), (int) id);
+    HTML_CLOSE("p");
+    HTML::end_html_row(OUT);
+
+ +

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

+ +

Index the files1.4 = +

+ +
+    HTML_OPEN("p");
+    Localisation::bold(OUT, LD, I"Index.Elements.Fi.ListOfFiles");
+    HTML_CLOSE("p");
     if (InterNodeList::array_len(inv->file_nodes) == 0) {
         HTML_OPEN("p");
         Localisation::roman(OUT, LD, I"Index.Elements.Fi.NoFiles");
         HTML_CLOSE("p");
     } else {
-        HTML_OPEN("p");
-        Localisation::bold(OUT, LD, I"Index.Elements.Fi.ListOfFiles");
-        HTML_CLOSE("p");
-        Tabulate the files1.3.1;
+        Tabulate the files1.4.1;
     }
 
-

§1.3.1. Tabulate the files1.3.1 = +

§1.4.1. Tabulate the files1.4.1 =

@@ -423,7 +578,7 @@ to match this width, preserving the aspect ratio.
     }
     HTML::end_html_table(OUT);
 
- + diff --git a/docs/multimedia-module/2-ef.html b/docs/multimedia-module/2-ef.html index e1332fdf6..26c1f46d9 100644 --- a/docs/multimedia-module/2-ef.html +++ b/docs/multimedia-module/2-ef.html @@ -120,12 +120,6 @@ function togglePopup(material_id) {

§3. And this is the Preform grammar needed for the subject phrase:

-
define EXTERNAL_TEXT_FILE_NFSMF 0
-define EXTERNAL_BINARY_FILE_NFSMF 1
-define INTERNAL_TEXT_FILE_NFSMF 2
-define INTERNAL_BINARY_FILE_NFSMF 3
-define INTERNAL_FORM_FILE_NFSMF 4
-
 <external-file-sentence-subject> ::=
     <definite-article> <external-file-sentence-subject> |  ==> { pass 2 }
@@ -214,7 +208,7 @@ has been found to create a file:
     switch (format) {
         case EXTERNAL_TEXT_FILE_NFSMF:
         case EXTERNAL_BINARY_FILE_NFSMF: {
-            if (format == EXTERNAL_BINARY_FILE_NFSMF) binary = TRUE;
+            if (format == EXTERNAL_BINARY_FILE_NFSMF) binary = TRUE;
             TEMPORARY_TEXT(ifid_of_file)
             Determine the ownership5.2;
             ExternalFiles::files_create(W, binary, ownership, ifid_of_file, FN);
@@ -247,9 +241,9 @@ has been found to create a file:
         }
         if (i>24) bad_filename = TRUE;
         if ((isalpha(p[i])) || (Characters::isdigit(p[i]))) continue;
-        if ((format == INTERNAL_TEXT_FILE_NFSMF) ||
-            (format == INTERNAL_BINARY_FILE_NFSMF) ||
-            (format == INTERNAL_FORM_FILE_NFSMF))
+        if ((format == INTERNAL_TEXT_FILE_NFSMF) ||
+            (format == INTERNAL_BINARY_FILE_NFSMF) ||
+            (format == INTERNAL_FORM_FILE_NFSMF))
             if ((p[i] == '.') || (p[i] == '_') || (p[i] == ' ')) continue;
         LOG("Objected to character %c\n", p[i]);
         bad_filename = TRUE;
diff --git a/docs/runtime-module/2-hrr.html b/docs/runtime-module/2-hrr.html
index 4b10deaba..7f245577f 100644
--- a/docs/runtime-module/2-hrr.html
+++ b/docs/runtime-module/2-hrr.html
@@ -1021,6 +1021,7 @@ and The Standard Kits (
 enum INSTANCE_IS_INF_MD_HL
 enum INSTANCE_FILE_VALUE_MD_HL
 enum INSTANCE_INTERNAL_FILE_FORMAT_MD_HL
+enum INSTANCE_INTERNAL_FILE_ID_MD_HL
 enum INSTANCE_FILE_IS_BINARY_MD_HL
 enum INSTANCE_FILE_OWNED_MD_HL
 enum INSTANCE_FILE_OWNED_BY_OTHER_MD_HL
@@ -1164,8 +1165,9 @@ and The Standard Kits (
             H_C_U(INSTANCE_FILE_OWNED_BY_OTHER_MD_HL,       I"^file_owned_by_other")
             H_C_U(INSTANCE_FILE_OWNER_MD_HL,                I"^file_owner")
             H_C_U(INSTANCE_INTERNAL_FILE_FORMAT_MD_HL,      I"^internal_file_format")
+            H_C_U(INSTANCE_INTERNAL_FILE_ID_MD_HL,          I"^resource_id")
             H_C_U(INSTANCE_FILE_IS_BINARY_MD_HL,            I"^is_binary")
-            H_C_U(INSTANCE_LEAFNAME_MD_HL,                  I"^leafname")
+            H_C_U(INSTANCE_LEAFNAME_MD_HL,                  I"^filename")
             H_C_U(INSTANCE_IS_FIGURE_MD_HL,                 I"^is_figure")
             H_C_U(INSTANCE_FIGURE_FILENAME_MD_HL,           I"^filename")
             H_C_U(INSTANCE_FIGURE_ID_MD_HL,                 I"^resource_id")
@@ -2559,14 +2561,14 @@ point system, and for those:
     DISCARD_TEXT(ANT)
 }
 
-void Hierarchy::apply_metadata_from_raw_wording(package_request *P, int id, wording W) {
+void Hierarchy::apply_metadata_from_raw_wording(package_request *P, int id, wording W) {
     TEMPORARY_TEXT(ANT)
     WRITE_TO(ANT, "%+W", W);
     Hierarchy::apply_metadata(P, id, ANT);
     DISCARD_TEXT(ANT)
 }
 
-void Hierarchy::apply_metadata_from_filename(package_request *P, int id, filename *F) {
+void Hierarchy::apply_metadata_from_filename(package_request *P, int id, filename *F) {
     TEMPORARY_TEXT(as_text)
     WRITE_TO(as_text, "%f", F);
     Hierarchy::apply_metadata(P, id, as_text);
diff --git a/docs/runtime-module/5-mlt.html b/docs/runtime-module/5-mlt.html
index 1591e0437..5c2239cdc 100644
--- a/docs/runtime-module/5-mlt.html
+++ b/docs/runtime-module/5-mlt.html
@@ -204,10 +204,12 @@ function togglePopup(material_id) {
 
     package_request *pack = RTInstances::package(inf->as_instance);
     Hierarchy::apply_metadata_from_iname(pack, INSTANCE_FILE_VALUE_MD_HL, inf_iname);
-    Hierarchy::apply_metadata_from_raw_wording(pack, INSTANCE_LEAFNAME_MD_HL,
-        Wordings::one_word(inf->unextended_filename));
+    Hierarchy::apply_metadata_from_filename(pack, INSTANCE_LEAFNAME_MD_HL,
+        inf->local_filename);
     Hierarchy::apply_metadata_from_number(pack, INSTANCE_INTERNAL_FILE_FORMAT_MD_HL,
         (inter_ti) inf->file_format);
+    Hierarchy::apply_metadata_from_number(pack, INSTANCE_INTERNAL_FILE_ID_MD_HL,
+        (inter_ti) inf->resource_id);
 

§3.2. Make the internal file metadata array3.2 = diff --git a/inform7/Figures/memory-diagnostics.txt b/inform7/Figures/memory-diagnostics.txt index a45c6cb06..b6ab410c8 100644 --- a/inform7/Figures/memory-diagnostics.txt +++ b/inform7/Figures/memory-diagnostics.txt @@ -1,9 +1,9 @@ -Total memory consumption was 123398K = 121 MB +Total memory consumption was 123401K = 121 MB - ---- was used for 2055375 objects, in 366318 frames in 0 x 800K = 0K = 0 MB: + ---- was used for 2055476 objects, in 366320 frames in 0 x 800K = 0K = 0 MB: 33.0% inter_tree_node_array 58 x 8192 = 475136 objects, 41813824 bytes - 20.6% text_stream_array 4637 x 100 = 463700 objects, 26115584 bytes + 20.6% text_stream_array 4638 x 100 = 463800 objects, 26121216 bytes 19.5% linked_list 44083 objects, 24686480 bytes 11.2% inter_symbol_array 133 x 1024 = 136192 objects, 14168224 bytes 10.4% inter_error_stash_array 101 x 1024 = 103424 objects, 13241504 bytes @@ -44,7 +44,7 @@ Total memory consumption was 123398K = 121 MB 0.2% inter_annotation_array 2 x 8192 = 16384 objects, 262208 bytes 0.1% vanilla_function 3703 objects, 236992 bytes 0.1% binary_predicate 326 objects, 172128 bytes - 0.1% hierarchy_location 1171 objects, 168624 bytes + 0.1% hierarchy_location 1172 objects, 168768 bytes 0.1% linguistic_stock_item 3329 objects, 159792 bytes 0.1% rule_family_data 401 objects, 147568 bytes 0.1% nonterminal 773 objects, 142232 bytes @@ -56,7 +56,7 @@ Total memory consumption was 123398K = 121 MB ---- anl_entry_array 2 x 1000 = 2000 objects, 96064 bytes ---- preposition 274 objects, 87680 bytes ---- inter_schema 1524 objects, 85344 bytes - ---- inter_tree 6 objects, 81696 bytes + ---- inter_tree 6 objects, 81744 bytes ---- lexical_cluster 2526 objects, 80832 bytes ---- pcalc_term_array 2 x 1000 = 2000 objects, 80064 bytes ---- kind_variable_declaration 1655 objects, 79440 bytes @@ -247,7 +247,7 @@ Total memory consumption was 123398K = 121 MB 100.0% was used for memory not allocated for objects: - 57.6% text stream storage 72805768 bytes in 481244 claims + 57.6% text stream storage 72808420 bytes in 481254 claims 4.2% dictionary storage 5311488 bytes in 7618 claims ---- sorting 1568 bytes in 159 claims 5.6% source text 7200000 bytes in 3 claims @@ -265,5 +265,5 @@ Total memory consumption was 123398K = 121 MB ---- code generation workspace for objects 3480 bytes in 19 claims 0.2% emitter array storage 280544 bytes in 2001 claims --147.-7% was overhead - -186754840 bytes = -182377K = -178 MB +-147.-7% was overhead - -186760664 bytes = -182383K = -178 MB diff --git a/inform7/Figures/timings-diagnostics.txt b/inform7/Figures/timings-diagnostics.txt index 8ed7f8c6e..03010d281 100644 --- a/inform7/Figures/timings-diagnostics.txt +++ b/inform7/Figures/timings-diagnostics.txt @@ -1,33 +1,33 @@ 100.0% in inform7 run - 70.9% in compilation to Inter - 49.6% in //Sequence::undertake_queued_tasks// - 4.8% in //MajorNodes::pre_pass// + 71.3% in compilation to Inter + 50.7% in //Sequence::undertake_queued_tasks// + 5.0% in //MajorNodes::pre_pass// 3.4% in //MajorNodes::pass_1// - 2.0% in //RTPhrasebook::compile_entries// - 1.8% in //ImperativeDefinitions::assess_all// - 1.4% in //RTKindConstructors::compile// - 1.2% in //Sequence::lint_inter// - 0.6% in //MajorNodes::pass_2// - 0.6% in //Sequence::undertake_queued_tasks// - 0.6% in //World::stage_V// - 0.4% in //ImperativeDefinitions::compile_first_block// - 0.4% in //Sequence::undertake_queued_tasks// - 0.2% in //CompletionModule::compile// - 0.2% in //InferenceSubjects::emit_all// - 0.2% in //RTKindConstructors::compile_permissions// - 0.2% in //Task::make_built_in_kind_constructors// - 0.2% in //World::stages_II_and_III// - 2.8% not specifically accounted for - 25.9% in running Inter pipeline - 9.9% in step 14/15: generate inform6 -> auto.inf - 5.6% in step 5/15: load-binary-kits - 5.4% in step 6/15: make-synoptic-module - 1.8% in step 9/15: make-identifiers-unique - 0.4% in step 12/15: eliminate-redundant-operations - 0.4% in step 4/15: compile-splats - 0.4% in step 7/15: shorten-wiring - 0.2% in step 11/15: eliminate-redundant-labels - 0.2% in step 8/15: detect-indirect-calls - 1.4% not specifically accounted for - 2.6% in supervisor - 0.5% not specifically accounted for + 1.9% in //RTPhrasebook::compile_entries// + 1.7% in //ImperativeDefinitions::assess_all// + 1.5% in //RTKindConstructors::compile// + 0.9% in //Sequence::lint_inter// + 0.5% in //MajorNodes::pass_2// + 0.5% in //Sequence::undertake_queued_tasks// + 0.5% in //Sequence::undertake_queued_tasks// + 0.5% in //World::stage_V// + 0.3% in //ImperativeDefinitions::compile_first_block// + 0.1% in //CompletionModule::compile// + 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.3% not specifically accounted for + 25.5% in running Inter pipeline + 10.1% in step 14/15: generate inform6 -> auto.inf + 5.5% in step 5/15: load-binary-kits + 5.1% in step 6/15: make-synoptic-module + 1.7% in step 9/15: make-identifiers-unique + 0.3% in step 12/15: eliminate-redundant-operations + 0.3% in step 4/15: compile-splats + 0.3% in step 7/15: shorten-wiring + 0.3% in step 8/15: detect-indirect-calls + 0.1% in step 11/15: eliminate-redundant-labels + 1.1% not specifically accounted for + 2.5% in supervisor + 0.6% not specifically accounted for diff --git a/inform7/Internal/Inter/BasicInformExtrasKit/kit_metadata.json b/inform7/Internal/Inter/BasicInformExtrasKit/kit_metadata.json index badb00ecd..a5a448489 100644 --- a/inform7/Internal/Inter/BasicInformExtrasKit/kit_metadata.json +++ b/inform7/Internal/Inter/BasicInformExtrasKit/kit_metadata.json @@ -2,7 +2,7 @@ "is": { "type": "kit", "title": "BasicInformExtrasKit", - "version": "10.2.0-beta+6V93" + "version": "10.2.0-beta+6V94" }, "kit-details": { "has-priority": 1 diff --git a/inform7/Internal/Inter/BasicInformKit/kit_metadata.json b/inform7/Internal/Inter/BasicInformKit/kit_metadata.json index 6d20b9768..d76dc9972 100644 --- a/inform7/Internal/Inter/BasicInformKit/kit_metadata.json +++ b/inform7/Internal/Inter/BasicInformKit/kit_metadata.json @@ -2,7 +2,7 @@ "is": { "type": "kit", "title": "BasicInformKit", - "version": "10.2.0-beta+6V93" + "version": "10.2.0-beta+6V94" }, "needs": [ { "unless": { diff --git a/inform7/Internal/Inter/CommandParserKit/kit_metadata.json b/inform7/Internal/Inter/CommandParserKit/kit_metadata.json index c4e481152..6a7a22372 100644 --- a/inform7/Internal/Inter/CommandParserKit/kit_metadata.json +++ b/inform7/Internal/Inter/CommandParserKit/kit_metadata.json @@ -2,7 +2,7 @@ "is": { "type": "kit", "title": "CommandParserKit", - "version": "10.2.0-beta+6V93" + "version": "10.2.0-beta+6V94" }, "needs": [ { "need": { diff --git a/inform7/Internal/Inter/EnglishLanguageKit/kit_metadata.json b/inform7/Internal/Inter/EnglishLanguageKit/kit_metadata.json index abf32de91..feff86afb 100644 --- a/inform7/Internal/Inter/EnglishLanguageKit/kit_metadata.json +++ b/inform7/Internal/Inter/EnglishLanguageKit/kit_metadata.json @@ -2,7 +2,7 @@ "is": { "type": "kit", "title": "EnglishLanguageKit", - "version": "10.2.0-beta+6V93" + "version": "10.2.0-beta+6V94" }, "needs": [ { "need": { diff --git a/inform7/Internal/Inter/WorldModelKit/kit_metadata.json b/inform7/Internal/Inter/WorldModelKit/kit_metadata.json index 45cf5ab29..39d0a4f77 100644 --- a/inform7/Internal/Inter/WorldModelKit/kit_metadata.json +++ b/inform7/Internal/Inter/WorldModelKit/kit_metadata.json @@ -2,7 +2,7 @@ "is": { "type": "kit", "title": "WorldModelKit", - "version": "10.2.0-beta+6V93" + "version": "10.2.0-beta+6V94" }, "needs": [ { "need": { diff --git a/inform7/Internal/Languages/English/Index.txt b/inform7/Internal/Languages/English/Index.txt index 6c5327ae3..666d57598 100644 --- a/inform7/Internal/Languages/English/Index.txt +++ b/inform7/Internal/Languages/English/Index.txt @@ -47,8 +47,10 @@ %Index.Elements.Fi.NoFigures = There are no figures, or illustrations, in this project. %Index.Elements.Fi.NoSounds = There are no sound effects in this project. %Index.Elements.Fi.NoFiles = This project doesn't read or write external files. +%Index.Elements.Fi.NoInternalFiles = This project doesn't read internal files. %Index.Elements.Fi.ListOfFigures = List of Figures %Index.Elements.Fi.ListOfSounds = List of Sounds +%Index.Elements.Fi.ListOfInternalFiles = List of Internal Files %Index.Elements.Fi.ListOfFiles = List of External Files %Index.Elements.Fi.Format = Format *1 @@ -71,6 +73,8 @@ %Index.Elements.Fi.Stereo = Stereo %Index.Elements.Fi.BitRate = *1 kilobits/sec +%Index.Elements.Fi.MissingInternalFile = Missing from the Data folder + %Index.Elements.Fi.BinaryFile = Binary file "*1" %Index.Elements.Fi.TextFile = File "*1" %Index.Elements.Fi.FileOwnedByThis = owned by this project diff --git a/inform7/multimedia-module/Chapter 2/External Files.w b/inform7/multimedia-module/Chapter 2/External Files.w index cc2709511..3b1b67840 100644 --- a/inform7/multimedia-module/Chapter 2/External Files.w +++ b/inform7/multimedia-module/Chapter 2/External Files.w @@ -56,12 +56,6 @@ int ExternalFiles::new_file_SMF(int task, parse_node *V, wording *NPs) { @ And this is the Preform grammar needed for the subject phrase: -@d EXTERNAL_TEXT_FILE_NFSMF 0 -@d EXTERNAL_BINARY_FILE_NFSMF 1 -@d INTERNAL_TEXT_FILE_NFSMF 2 -@d INTERNAL_BINARY_FILE_NFSMF 3 -@d INTERNAL_FORM_FILE_NFSMF 4 - = ::= | ==> { pass 2 } diff --git a/inform7/runtime-module/Chapter 2/Hierarchy.w b/inform7/runtime-module/Chapter 2/Hierarchy.w index fce43211a..b5b54abee 100644 --- a/inform7/runtime-module/Chapter 2/Hierarchy.w +++ b/inform7/runtime-module/Chapter 2/Hierarchy.w @@ -900,6 +900,7 @@ void Hierarchy::establish(void) { @e INSTANCE_IS_INF_MD_HL @e INSTANCE_FILE_VALUE_MD_HL @e INSTANCE_INTERNAL_FILE_FORMAT_MD_HL +@e INSTANCE_INTERNAL_FILE_ID_MD_HL @e INSTANCE_FILE_IS_BINARY_MD_HL @e INSTANCE_FILE_OWNED_MD_HL @e INSTANCE_FILE_OWNED_BY_OTHER_MD_HL @@ -1040,8 +1041,9 @@ void Hierarchy::establish(void) { H_C_U(INSTANCE_FILE_OWNED_BY_OTHER_MD_HL, I"^file_owned_by_other") H_C_U(INSTANCE_FILE_OWNER_MD_HL, I"^file_owner") H_C_U(INSTANCE_INTERNAL_FILE_FORMAT_MD_HL, I"^internal_file_format") + H_C_U(INSTANCE_INTERNAL_FILE_ID_MD_HL, I"^resource_id") H_C_U(INSTANCE_FILE_IS_BINARY_MD_HL, I"^is_binary") - H_C_U(INSTANCE_LEAFNAME_MD_HL, I"^leafname") + H_C_U(INSTANCE_LEAFNAME_MD_HL, I"^filename") H_C_U(INSTANCE_IS_FIGURE_MD_HL, I"^is_figure") H_C_U(INSTANCE_FIGURE_FILENAME_MD_HL, I"^filename") H_C_U(INSTANCE_FIGURE_ID_MD_HL, I"^resource_id") diff --git a/inform7/runtime-module/Chapter 5/Multimedia.w b/inform7/runtime-module/Chapter 5/Multimedia.w index 77936db34..b8fb5909a 100644 --- a/inform7/runtime-module/Chapter 5/Multimedia.w +++ b/inform7/runtime-module/Chapter 5/Multimedia.w @@ -130,10 +130,12 @@ void RTMultimedia::internal_compilation_agent(compilation_subtask *t) { @ = package_request *pack = RTInstances::package(inf->as_instance); Hierarchy::apply_metadata_from_iname(pack, INSTANCE_FILE_VALUE_MD_HL, inf_iname); - Hierarchy::apply_metadata_from_raw_wording(pack, INSTANCE_LEAFNAME_MD_HL, - Wordings::one_word(inf->unextended_filename)); + Hierarchy::apply_metadata_from_filename(pack, INSTANCE_LEAFNAME_MD_HL, + inf->local_filename); Hierarchy::apply_metadata_from_number(pack, INSTANCE_INTERNAL_FILE_FORMAT_MD_HL, (inter_ti) inf->file_format); + Hierarchy::apply_metadata_from_number(pack, INSTANCE_INTERNAL_FILE_ID_MD_HL, + (inter_ti) inf->resource_id); @ = packaging_state save = EmitArrays::begin_word(inf_iname, K_value); diff --git a/inter/index-module/Chapter 3/Figures Element.w b/inter/index-module/Chapter 3/Figures Element.w index c22fc9992..bdafcbdbb 100644 --- a/inter/index-module/Chapter 3/Figures Element.w +++ b/inter/index-module/Chapter 3/Figures Element.w @@ -14,6 +14,7 @@ void FiguresElement::render(OUTPUT_STREAM, index_session *session) { InterNodeList::array_sort(inv->file_nodes, MakeSynopticModuleStage::module_order); @; @; + @; @; } @@ -128,10 +129,10 @@ to match this width, preserving the aspect ratio. @h Sounds. @ = + HTML_OPEN("p"); + Localisation::bold(OUT, LD, I"Index.Elements.Fi.ListOfSounds"); + HTML_CLOSE("p"); if (InterNodeList::array_len(inv->sound_nodes) == 0) { - HTML_OPEN("p"); - Localisation::bold(OUT, LD, I"Index.Elements.Fi.ListOfSounds"); - HTML_CLOSE("p"); HTML_OPEN("p"); Localisation::roman(OUT, LD, I"Index.Elements.Fi.NoSounds"); HTML_CLOSE("p"); @@ -270,18 +271,148 @@ to match this width, preserving the aspect ratio. Filenames::get_leafname(F), (int) id); HTML::end_html_row(OUT); +@h Internal files. + +@d EXTERNAL_TEXT_FILE_NFSMF 0 +@d EXTERNAL_BINARY_FILE_NFSMF 1 +@d INTERNAL_TEXT_FILE_NFSMF 2 +@d INTERNAL_BINARY_FILE_NFSMF 3 +@d INTERNAL_FORM_FILE_NFSMF 4 + +@ = + HTML_OPEN("p"); + Localisation::bold(OUT, LD, I"Index.Elements.Fi.ListOfInternalFiles"); + HTML_CLOSE("p"); + if (InterNodeList::array_len(inv->internal_file_nodes) == 0) { + HTML_OPEN("p"); + Localisation::roman(OUT, LD, I"Index.Elements.Fi.NoInternalFiles"); + HTML_CLOSE("p"); + } else { + @; + } + +@ = + HTML::begin_html_table(OUT, NULL, TRUE, 0, 0, 0, 0, 0); + inter_package *pack; + LOOP_OVER_INVENTORY_PACKAGES(pack, i, inv->internal_file_nodes) { + inter_ti id = Metadata::read_numeric(pack, I"^resource_id"); + text_stream *filename_as_text = Metadata::required_textual(pack, I"^filename"); + filename *F = Filenames::from_text(filename_as_text); + inter_ti format = Metadata::read_numeric(pack, I"^internal_file_format"); + TEMPORARY_TEXT(description) + TEMPORARY_TEXT(preview) + @; + @; + DISCARD_TEXT(description) + DISCARD_TEXT(preview) + } + HTML::end_html_table(OUT); + +@ = + FILE *INTERNAL_FILE = Filenames::fopen(F, "rb"); + if (INTERNAL_FILE) { + switch (format) { + case INTERNAL_TEXT_FILE_NFSMF: + WRITE_TO(description, "%S", filename_as_text); + @; + break; + case INTERNAL_BINARY_FILE_NFSMF: + WRITE_TO(description, "%S", filename_as_text); + @; + break; + case INTERNAL_FORM_FILE_NFSMF: + WRITE_TO(description, "%S", filename_as_text); + @; + break; + } + } else { + Localisation::italic(description, LD, I"Index.Elements.Fi.MissingInternalFile"); + } + +@ = + for (int row = 0; row < 6; ) { + int col = 0; + unsigned int B, line_ended = FALSE; + while (BinaryFiles::read_int8(INTERNAL_FILE, &B)) { + if ((B == 10) || (B == 13)) { line_ended = TRUE; break; } + if (col++ >= 80) { WRITE_TO(preview, "[...]"); line_ended = TRUE; break; } + if ((B >= 0x20) && (B <= 0x7E)) WRITE_TO(preview, "%c", B); + else WRITE_TO(preview, "?"); + } + if (line_ended == FALSE) break; + if (col > 0) row++; + WRITE_TO(preview, "\n"); + } + +@ = + for (int row = 0; row < 6; row++) { + unsigned int bytes[16]; + for (int col = 0; col < 16; col++) { + if (!BinaryFiles::read_int8(INTERNAL_FILE, &(bytes[col]))) { + for (; col < 16; col++) bytes[col] = 256; + row = 6; break; + } + } + for (int col = 0; col < 16; col++) { + if (bytes[col] < 256) WRITE_TO(preview, "%02x ", bytes[col]); + else WRITE_TO(preview, ".. "); + } + for (int col = 0; col < 16; col++) { + if ((bytes[col] >= 0x20) && (bytes[col] <= 0x7E)) WRITE_TO(preview, "%c", bytes[col]); + else WRITE_TO(preview, "."); + } + WRITE_TO(preview, "\n"); + } + +@ = + HTML::first_html_column(OUT, THUMBNAIL_WIDTH+10); + if (Str::len(description) == 0) { + HTML_TAG_WITH("img", "border=\"0\" src=\"inform:/doc_images/image_problem.png\""); + } else { + HTML_TAG_WITH("img", "border=\"0\" src=\"inform:/doc_images/data.png\""); + } + WRITE(" "); + HTML::next_html_column(OUT, 0); + HTML_OPEN_WITH("p", "class=\"hang\""); + switch (format) { + case INTERNAL_TEXT_FILE_NFSMF: WRITE("(text) "); break; + case INTERNAL_BINARY_FILE_NFSMF: WRITE("(binary) "); break; + case INTERNAL_FORM_FILE_NFSMF: WRITE("(form) "); break; + } + WRITE("%S", Metadata::required_textual(pack, I"^name")); + IndexUtilities::link_package(OUT, pack); + if (Str::len(description) > 0) { + HTML_TAG("br"); + WRITE("%S", description); + } + HTML_CLOSE("p"); + if (Str::len(preview) > 0) { + HTML_OPEN("pre"); + int N = Streams::get_indentation(OUT); + Streams::set_indentation(OUT, 0); + WRITE("\n%S", preview); + Streams::set_indentation(OUT, N); + HTML_CLOSE("pre"); + WRITE("\n"); + } + HTML_OPEN("p"); + Localisation::roman_ti(description, LD, I"Index.Elements.Fi.Resource", + Filenames::get_leafname(F), (int) id); + HTML_CLOSE("p"); + HTML::end_html_row(OUT); + @h Files. This is more or less perfunctory, but still of some use, if only as a list. @ = + HTML_OPEN("p"); + Localisation::bold(OUT, LD, I"Index.Elements.Fi.ListOfFiles"); + HTML_CLOSE("p"); if (InterNodeList::array_len(inv->file_nodes) == 0) { HTML_OPEN("p"); Localisation::roman(OUT, LD, I"Index.Elements.Fi.NoFiles"); HTML_CLOSE("p"); } else { - HTML_OPEN("p"); - Localisation::bold(OUT, LD, I"Index.Elements.Fi.ListOfFiles"); - HTML_CLOSE("p"); @; } diff --git a/resources/Imagery/doc_images/data.png b/resources/Imagery/doc_images/data.png new file mode 100644 index 000000000..9bec38899 Binary files /dev/null and b/resources/Imagery/doc_images/data.png differ