From 2c84a758d129dd1b6ab4ae6bc79fa0a2393a923a Mon Sep 17 00:00:00 2001 From: Graham Nelson Date: Sun, 23 Jul 2023 15:28:37 +0100 Subject: [PATCH] Fixed various bugs with installing directory extensions --- docs/BasicInformKit/S-lst.html | 45 +- docs/BasicInformKit/S-rgx.html | 244 ++++---- docs/BasicInformKit/S-srt.html | 3 + docs/BasicInformKit/S-tbl.html | 44 +- docs/basic_inform/S-pd.html | 20 +- docs/basic_inform/S-prm.html | 2 +- docs/lexicon-module/P-wtmd.html | 18 +- docs/multimedia-module/2-rf.html | 2 +- docs/supervisor-module/1-ic.html | 40 +- docs/supervisor-module/2-cps.html | 6 +- docs/supervisor-module/2-gnr.html | 2 +- docs/supervisor-module/2-jm.html | 3 +- docs/supervisor-module/4-ebm.html | 21 +- docs/supervisor-module/4-em.html | 2 +- docs/supervisor-module/5-es.html | 42 +- docs/supervisor-module/5-ps2.html | 2 +- docs/supervisor-module/6-inc.html | 5 +- docs/supervisor-module/7-dc.html | 67 +-- docs/supervisor-module/7-dr.html | 40 +- docs/supervisor-module/7-dt.html | 2 - docs/supervisor-module/7-ti.html | 2 +- docs/supervisor-module/7-tm.html | 4 +- .../Chapter 1/Inbuild Control.w | 20 - inbuild/supervisor-module/Chapter 2/Copies.w | 6 +- .../Chapter 2/JSON Metadata.w | 3 +- .../Chapter 4/Extension Bundle Manager.w | 11 +- .../Chapter 5/Extension Services.w | 33 +- .../Chapter 5/Project Services.w | 2 +- .../supervisor-module/Chapter 6/Inclusions.w | 5 +- .../Chapter 7/Documentation Compiler.w | 67 +-- .../Chapter 7/Documentation Renderer.w | 40 +- .../Chapter 7/Documentation Tree.w | 4 +- .../Chapter 7/The Installer.w | 2 +- inform7/Downloads/excerpts-diagnostics.txt | 18 +- inform7/Downloads/preform-diagnostics.txt | 552 +++++++++--------- inform7/Figures/documentation-diagnostics.txt | 2 + inform7/Figures/memory-diagnostics.txt | 50 +- inform7/Figures/preform-summary.txt | 12 +- inform7/Figures/syntax-summary.txt | 210 +++---- inform7/Figures/timings-diagnostics.txt | 33 +- .../Chapter 2/Resource Finder.w | 2 +- .../Figures/excerpts-diagnostics.txt | 18 +- 42 files changed, 867 insertions(+), 839 deletions(-) diff --git a/docs/BasicInformKit/S-lst.html b/docs/BasicInformKit/S-lst.html index 6c352077b..70333d666 100644 --- a/docs/BasicInformKit/S-lst.html +++ b/docs/BasicInformKit/S-lst.html @@ -189,12 +189,6 @@ stopping as soon as a pair of corresponding items differs: thus we sort lists of equal size in lexicographic order.

-

Since the comparison function depends only on the KOV, it may seem wasteful -of a word of memory to store it in the list, given that we are already storing -the KOV in any case. But we do this because comparisons have to be fast: we -don't want to incur the overhead of translating KOV to comparison function. -

-
 [ LIST_OF_TY_Compare listleft listright delta no_items i cf;
     delta = BlkValueRead(listleft, LIST_LENGTH_F) - BlkValueRead(listright, LIST_LENGTH_F);
@@ -762,13 +756,20 @@ we sort based not on the item values but on their values for the property
 prop. (This only makes sense if the list contains objects.)
 

+

LIST_OF_TY_Sort(list, dir, 0, 0, cf) sorts the given list with the custom +comparison function cf, which must behave as any standard comparison function +would. +

+
+Constant SORT_LIST_RANDOM = 2;
+
 Global LIST_OF_TY_Sort_cf;
 
-[ LIST_OF_TY_Sort list dir prop cf  i j no_items v;
+[ LIST_OF_TY_Sort list dir prop prop_is_bv cf  i j no_items v;
     BlkMakeMutable(list);
     no_items = BlkValueRead(list, LIST_LENGTH_F);
-    if (dir == 2) {
+    if (dir == SORT_LIST_RANDOM) {
         if (no_items < 2) return;
         for (i=1:i<no_items:i++) {
             j = random(i+1) - 1;
@@ -779,8 +780,20 @@ we sort based not on the item values but on their values for the property
         return;
     }
     SetSortDomain(ListSwapEntries, ListCompareEntries);
-    if (cf) LIST_OF_TY_Sort_cf = BlkValueCompare;
-    else LIST_OF_TY_Sort_cf = 0;
+    if (cf) {
+        LIST_OF_TY_Sort_cf = cf;
+    }
+    else if (prop) {
+        if (prop_is_bv) {
+            LIST_OF_TY_Sort_cf = BlkValueCompare;
+        }
+        else {
+            LIST_OF_TY_Sort_cf = 0;
+        }
+    }
+    else {
+        LIST_OF_TY_Sort_cf = LIST_OF_TY_ComparisonFn(list);
+    }
     SortArray(list, prop, dir, no_items, 0);
 ];
 
@@ -791,23 +804,21 @@ we sort based not on the item values but on their values for the property
     BlkValueWrite(list, LIST_ITEM_BASE+j-1, v);
 ];
 
-[ ListCompareEntries list col i j d cf;
+[ ListCompareEntries list col i j d;
     if (i==j) return 0;
     i = BlkValueRead(list, LIST_ITEM_BASE+i-1);
     j = BlkValueRead(list, LIST_ITEM_BASE+j-1);
     if (I7S_Col) {
         if (i provides I7S_Col) i=i.I7S_Col; else i=0;
         if (j provides I7S_Col) j=j.I7S_Col; else j=0;
-        cf = LIST_OF_TY_Sort_cf;
-    } else {
-        cf = LIST_OF_TY_ComparisonFn(list);
     }
-    if (cf == 0) {
+    if (LIST_OF_TY_Sort_cf == 0) {
         if (i > j) return 1;
         if (i < j) return -1;
         return 0;
-    } else
-        return cf(i, j);
+    } else {
+        return LIST_OF_TY_Sort_cf(i, j);
+    }
 ];
 

§18. Search And Replace. And finally, last but not least: the routine which searches an indexed text txt trying to match it against ftxt. If ftxtype is set to diff --git a/docs/BasicInformKit/S-srt.html b/docs/BasicInformKit/S-srt.html index 6f5966331..e1c1cf5c9 100644 --- a/docs/BasicInformKit/S-srt.html +++ b/docs/BasicInformKit/S-srt.html @@ -79,6 +79,9 @@ auxiliary storage.

+Constant SORT_ASCENDING = 1;
+Constant SORT_DESCENDING = -1;
+
 Global I7S_Tab; The array to be sorted, which can have almost any format
 Global I7S_Col; The "column number" in the array, if any
 Global I7S_Dir; The direction of sorting: ascending (1) or descending (-1)
diff --git a/docs/BasicInformKit/S-tbl.html b/docs/BasicInformKit/S-tbl.html
index 72dc45170..a4d1c0abd 100644
--- a/docs/BasicInformKit/S-tbl.html
+++ b/docs/BasicInformKit/S-tbl.html
@@ -65,7 +65,7 @@ MathJax = {
     
 

To read, write, search and allocate rows in the Table data structure.

-
+

§1. Format. The I7 Table structure is not to be confused with the I6 table form of array: it is essentially a two-dimensional array which has some metadata @@ -708,7 +708,19 @@ where other entries are not. } ];

-

§18. Move Row Down.

+

§18. TableCompareRowsCustomCF(T, C, R1, R2, D) is similar, but calls a custom +comparison function, and so ignores the C parameter. The D parameter is +also ignored at present. +

+ +
+Global Table_Sort_cf;
+
+[ TableCompareRowsCustomCF tab col row1 row2 dir;
+    return Table_Sort_cf(tab, row1, row2);
+];
+
+

§19. Move Row Down.

 [ TableMoveRowDown tab r1 r2 rx k l m v f;
@@ -728,7 +740,7 @@ where other entries are not.
     }
 ];
 
-

§19. Shuffle. TableShuffle(T) sorts T into random row order. +

§20. Shuffle. TableShuffle(T) sorts T into random row order.

@@ -738,7 +750,7 @@ where other entries are not.
     for (i=2:i<=to:i++) TableSwapRows(tab, i, random(i));
 ];
 
-

§20. Next Row. TableNextRow(T, C, R, D) is used when scanning through a table in order +

§21. Next Row. TableNextRow(T, C, R, D) is used when scanning through a table in order of the values in column C: ascending order if D = 1, descending if D = -1. The current position is row R of column C, or R = 0 if we have not yet found the first row. The return value is the row number for the @@ -828,7 +840,7 @@ Rows with blank entries in C< return min_at; ]; -

§21. Move Blanks to Back.

+

§22. Move Blanks to Back.

 [ TableMoveBlanksToBack tab fromrow torow i fbl lnbl blc;
@@ -848,25 +860,33 @@ Rows with blank entries in C<
     return torow-blc; Final non-blank row
 ];
 
-

§22. Sort. This is really only a front-end: it calls the sorting code at "Sort.i6t". +

§23. Sort. This is really only a front-end: it calls the sorting code at "Sort.i6t".

-[ TableSort tab col dir algorithm i j k f;
+[ TableSort tab col dir algorithm cf  i j k;
     for (i=1:i<=tab-->0:i++) {
         j = tab-->i; Address of column table
         if ((j-->1) & TB_COLUMN_DONTSORTME)
             return RunTimeProblem(RTP_TABLE_CANTSORT, tab);
     }
-    if (col >= 100) col=TableFindCol(tab, col, false);
+
+    if (cf) {
+        Table_Sort_cf = cf;
+        SetSortDomain(TableSwapRows, TableCompareRowsCustomCF);
+    }
+    else {
+        if (col >= 100) col=TableFindCol(tab, col, false);
+        SetSortDomain(TableSwapRows, TableCompareRows);
+    }
+
     k = TableRows(tab);
     k = TableMoveBlanksToBack(tab, 1, k);
 
-    SetSortDomain(TableSwapRows, TableCompareRows);
     SortArray(tab, col, dir, k, algorithm);
 ];
 
-

§23. Print Table to File. This is how we serialise a table to an external file, though the writing +

§24. Print Table to File. This is how we serialise a table to an external file, though the writing is done by printing characters in the standard way; it's just that the output stream will be an external file rather than the screen when this routine is called. @@ -900,7 +920,7 @@ is called. rfalse; ]; -

§24. Read Table from File. And this is how we unserialise again. It makes sense only on Glulx. +

§25. Read Table from File. And this is how we unserialise again. It makes sense only on Glulx.

@@ -981,7 +1001,7 @@ is called.
     return RunTimeProblem(RTP_TABLE_BADFILE, tab);
 ];
 
-

§25. Debugging. Routines to print the state of a table, for debugging purposes only. +

§26. Debugging. Routines to print the state of a table, for debugging purposes only.

diff --git a/docs/basic_inform/S-pd.html b/docs/basic_inform/S-pd.html
index a05e90471..641457ed0 100644
--- a/docs/basic_inform/S-pd.html
+++ b/docs/basic_inform/S-pd.html
@@ -1480,10 +1480,13 @@ text variable.
     (- TableShuffle({T}); -).
 To sort (T - table name) in/into (TC - table column) order
     (documented at ph_sortcolumn):
-    (- TableSort({T}, {TC}, 1); -).
+    (- TableSort({T}, {TC}, SORT_ASCENDING); -).
 To sort (T - table name) in/into reverse (TC - table column) order
     (documented at ph_sortcolumnreverse):
-    (- TableSort({T}, {TC}, -1); -).
+    (- TableSort({T}, {TC}, SORT_DESCENDING); -).
+To sort (T - table name) with (cf - phrase (table name, number, number) -> number)
+    (documented at ph_sorttablephrase):
+    (- TableSort({T}, 0, SORT_ASCENDING, 0, {cf}-->1); -).
 

§43. Lists. The following are all for adding and removing values to dynamic lists.

@@ -1599,19 +1602,22 @@ mechanism, in "Sort.i6t", which handles both lists and tables. (- LIST_OF_TY_Rotate({-lvalue-by-reference:L}, 1); -). To sort (L - a list of values) (documented at ph_sortlist): - (- LIST_OF_TY_Sort({-lvalue-by-reference:L}, 1); -). + (- LIST_OF_TY_Sort({-lvalue-by-reference:L}, SORT_ASCENDING); -). To sort (L - a list of values) in/into reverse order (documented at ph_sortlistreverse): - (- LIST_OF_TY_Sort({-lvalue-by-reference:L}, -1); -). + (- LIST_OF_TY_Sort({-lvalue-by-reference:L}, SORT_DESCENDING); -). +To sort (L - a list of values of kind K) with (cf - phrase (K, K) -> number) + (documented at ph_sortlistphrase): + (- LIST_OF_TY_Sort({-lvalue-by-reference:L}, SORT_ASCENDING, 0, 0, {cf}-->1); -). To sort (L - a list of values) in/into random order (documented at ph_sortlistrandom): - (- LIST_OF_TY_Sort({-lvalue-by-reference:L}, 2); -). + (- LIST_OF_TY_Sort({-lvalue-by-reference:L}, SORT_LIST_RANDOM); -). To sort (L - a list of objects) in/into (P - property) order (documented at ph_sortlistproperty): - (- LIST_OF_TY_Sort({-lvalue-by-reference:L}, 1, {P}, {-property-holds-block-value:P}); -). + (- LIST_OF_TY_Sort({-lvalue-by-reference:L}, SORT_ASCENDING, {P}, {-property-holds-block-value:P}); -). To sort (L - a list of objects) in/into reverse (P - property) order (documented at ph_sortlistpropertyreverse): - (- LIST_OF_TY_Sort({-lvalue-by-reference:L}, -1, {P}, {-property-holds-block-value:P}); -). + (- LIST_OF_TY_Sort({-lvalue-by-reference:L}, SORT_DESCENDING, {P}, {-property-holds-block-value:P}); -).

§48. Relations are the final data structure given here. In some ways they are the most fundamental of all, but they're not either set or tested by diff --git a/docs/basic_inform/S-prm.html b/docs/basic_inform/S-prm.html index 1b83babf9..757263532 100644 --- a/docs/basic_inform/S-prm.html +++ b/docs/basic_inform/S-prm.html @@ -58,7 +58,7 @@ rubric text, and this is no exception:

-Version [[Version Number]] of Basic Inform by Graham Nelson begins here.
+Version [[Version Number]] of Basic Inform by Graham Nelson begins here.
 
 "Basic Inform, included in every project, defines the basic framework
 of Inform as a programming language."
diff --git a/docs/lexicon-module/P-wtmd.html b/docs/lexicon-module/P-wtmd.html
index 5f401da91..24b434d33 100644
--- a/docs/lexicon-module/P-wtmd.html
+++ b/docs/lexicon-module/P-wtmd.html
@@ -181,21 +181,21 @@ than the number with correct ones
 number of successes.
 
 
-Size of lexicon: 3162 excerpt meanings
-  Stored among 855 words out of total vocabulary of 10626
+Size of lexicon: 3164 excerpt meanings
+  Stored among 855 words out of total vocabulary of 10631
   719 words have a start list: longest belongs to report (with 293 meanings)
   21 words have an end list: longest belongs to digits (with 7 meanings)
   29 words have a middle list: longest belongs to to (with 4 meanings)
   108 words have a subset list: longest belongs to street (with 4 meanings)
 
-Number of attempts to retrieve: 110520
-  of which unsuccessful: 92374
-  of which successful: 18146
+Number of attempts to retrieve: 110594
+  of which unsuccessful: 92446
+  of which successful: 18148
 
-Total attempts to match against excerpt meanings: 279412
-  of which, total with incorrect hash codes: 256664
-  of which, total with correct hash codes: 22748
-  of which, total which matched: 19917
+Total attempts to match against excerpt meanings: 279464
+  of which, total with incorrect hash codes: 256710
+  of which, total with correct hash codes: 22754
+  of which, total which matched: 19919