Inform - Support - Patches

About Patches  

Compiler  
Library  

DM4 Errata  

Issue C63012     [previous patch]

Minor bug in abbreviations
Submitted by: Owen Muniz     Appeared in: Compiler 6.30 or before     Fixed in: -
Problem

The list of suggested abbreviations generated by the -u switch always includes ", " and ". " even if they won't save any space (for example, after adjusting the alphabet table).

Solution (by Cedric Knight)

Apply this patch:

--- inform630ref\text.c	Fri Feb 27 06:30:00 2004
+++ text.c	Fri Aug 13 20:59:12 2004
@@ -1071,7 +1071,9 @@
             t1=(int) (time(0));
             for (j=0; j<tlbtab[i].occurrences; j++)
             {   for (j2=0; j2<tlbtab[i].occurrences; j2++) grandflags[j2]=1;
-                nl=2; noflags=tlbtab[i].occurrences;
+                nl=2;
+                if (tlbtab[i].text[2] == 0) nl--;
+                noflags=tlbtab[i].occurrences;
                 while ((noflags>=2)&&(nl<=62))
                 {   nl++;
                     for (j2=0; j2<nl; j2++)
@@ -1164,31 +1166,37 @@
     bestyet=my_calloc(sizeof(optab), 256, "bestyet");
     bestyet2=my_calloc(sizeof(optab), 64, "bestyet2");

-    bestyet2[0].text[0]='.';
-    bestyet2[0].text[1]=' ';
-    bestyet2[0].text[2]=0;
-
-    bestyet2[1].text[0]=',';
-    bestyet2[1].text[1]=' ';
-    bestyet2[1].text[2]=0;
-
-    for (i=0; all_text+i<all_text_top; i++)
-    {
-        if ((all_text[i]=='.') && (all_text[i+1]==' ') && (all_text[i+2]==' '))
-        {   all_text[i]='\n'; all_text[i+1]='\n'; all_text[i+2]='\n';
-            bestyet2[0].popularity++;
-        }
+    selected=0;
+#if 0
+    if (alphabet_modified == FALSE) {
+        selected=2;
+        bestyet2[0].text[0]='.';
+        bestyet2[0].text[1]=' ';
+        bestyet2[0].text[2]=0;
+
+        bestyet2[1].text[0]=',';
+        bestyet2[1].text[1]=' ';
+        bestyet2[1].text[2]=0;

-        if ((all_text[i]=='.') && (all_text[i+1]==' '))
-        {   all_text[i]='\n'; all_text[i+1]='\n';
-            bestyet2[0].popularity++;
-        }
+        for (i=0; all_text+i<all_text_top; i++)
+        {
+            if ((all_text[i]=='.') && (all_text[i+1]==' ') && (all_text[i+2]==' '))
+            {   all_text[i]='\n'; all_text[i+1]='\n'; all_text[i+2]='\n';
+                bestyet2[0].popularity++;
+            }

-        if ((all_text[i]==',') && (all_text[i+1]==' '))
-        {   all_text[i]='\n'; all_text[i+1]='\n';
-            bestyet2[1].popularity++;
+            if ((all_text[i]=='.') && (all_text[i+1]==' '))
+            {   all_text[i]='\n'; all_text[i+1]='\n';
+                bestyet2[0].popularity++;
+            }
+
+            if ((all_text[i]==',') && (all_text[i+1]==' '))
+            {   all_text[i]='\n'; all_text[i+1]='\n';
+                bestyet2[1].popularity++;
+            }
         }
     }
+#endif

     MAX_GTABLE=subtract_pointers(all_text_top,all_text)+1;
     grandtable=my_calloc(4*sizeof(int32), MAX_GTABLE/4, "grandtable");
@@ -1197,6 +1205,9 @@
     {   test.text[0]=all_text[i];
         test.text[1]=all_text[i+1];
         test.text[2]=all_text[i+2];
+        if (selected==0 && test.text[0]!='~'
+              && (iso_to_alphabet_grid[test.text[0]]>=26))
+            test.text[2]=0;
         test.text[3]=0;
         if ((test.text[0]=='\n')||(test.text[1]=='\n')||(test.text[2]=='\n'))
             goto DontKeep;
@@ -1217,9 +1228,9 @@
                 }
             }
 #endif
-            if ((all_text[i]==all_text[j])
-                 && (all_text[i+1]==all_text[j+1])
-                 && (all_text[i+2]==all_text[j+2]))
+            if ((test.text[0]==all_text[j])
+                 && (test.text[1]==all_text[j+1])
+                 && (test.text[2]==0 || test.text[2]==all_text[j+2]))
                  {   grandtable[t+test.occurrences]=j;
                      test.occurrences++;
                      if (t+test.occurrences==MAX_GTABLE)
@@ -1255,7 +1266,7 @@
                 tlbtab[i].occurrences);
     */

-    for (i=0; i<64; i++) bestyet2[i].length=0; selected=2;
+    for (i=0; i<64; i++) bestyet2[i].length=0;
     available=256;
     while ((available>0)&&(selected<64))
     {   printf("Pass %d\n", ++pass_no);
@@ -1302,7 +1313,9 @@
                 test.text[3]=0;

                 for (i=0; i<no_occs; i++)
-                    if (strcmp(test.text,tlbtab[i].text)==0)
+                    if ((test.text[0]==tlbtab[i].text[0])
+                            && (test.text[1]==tlbtab[i].text[1])
+                            && (tlbtab[i].text[2]==0 || test.text[2]==tlbtab[i].text[2]))
                         break;

                 for (j=0; j<tlbtab[i].occurrences; j++)


Last updated 17 April 2013. This web site has not been fully supported since April 2008. Information may be out of date. This page was originally managed by Roger Firth.