texlive[68357] Build/source/texk/web2c/cwebdir: [CWEB] Disentangle

commits+ascherer at tug.org commits+ascherer at tug.org
Sun Sep 24 17:20:35 CEST 2023


Revision: 68357
          https://tug.org/svn/texlive?view=revision&revision=68357
Author:   ascherer
Date:     2023-09-24 17:20:35 +0200 (Sun, 24 Sep 2023)
Log Message:
-----------
[CWEB] Disentangle 'reduce' and 'translate'.

They both defined 'scrap_pointer i' and the uses got mixed in the
sections in between. Split into variables 'i' and 'j' respectively.

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/cwebdir/ChangeLog
    trunk/Build/source/texk/web2c/cwebdir/ctwill-hint.ch
    trunk/Build/source/texk/web2c/cwebdir/ctwill-mini.ch
    trunk/Build/source/texk/web2c/cwebdir/cweave.w

Modified: trunk/Build/source/texk/web2c/cwebdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/ChangeLog	2023-09-24 13:13:07 UTC (rev 68356)
+++ trunk/Build/source/texk/web2c/cwebdir/ChangeLog	2023-09-24 15:20:35 UTC (rev 68357)
@@ -1,6 +1,7 @@
 2023-09-24  Andreas Scherer  <https://ascherer.github.io>
 
-	* cweave.w: Purge two scrap pointers.
+	* ctwill-{hint,mini}.ch,
+	* cweave.w: Disentangle 'reduce' and 'translate'.
 
 2023-09-23  Andreas Scherer  <https://ascherer.github.io>
 

Modified: trunk/Build/source/texk/web2c/cwebdir/ctwill-hint.ch
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/ctwill-hint.ch	2023-09-24 13:13:07 UTC (rev 68356)
+++ trunk/Build/source/texk/web2c/cwebdir/ctwill-hint.ch	2023-09-24 15:20:35 UTC (rev 68357)
@@ -539,7 +539,7 @@
 @$force_lines {CTWILL}155 =\\{flags}[\.{'f'}]@>
 @z
 
-Section 187.
+Section 185.
 
 @x
 @ @<Print a snapsh...@>=
@@ -548,9 +548,19 @@
 @-n@>
 @%
 @$n {CTWILL}182 \&{short}@>
-@$n {CTWILL}183 \&{short}@>
 @z
 
+Section 187.
+
+ at x
+@ If we get to the end of the scrap list, category codes equal to zero are
+ at y
+@ If we get to the end of the scrap list, category codes equal to zero are
+ at -j@>
+@%
+@$j {CTWILL}188 \&{scrap\_pointer}@>
+ at z
+
 Section 189.
 
 @x

Modified: trunk/Build/source/texk/web2c/cwebdir/ctwill-mini.ch
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/ctwill-mini.ch	2023-09-24 13:13:07 UTC (rev 68356)
+++ trunk/Build/source/texk/web2c/cwebdir/ctwill-mini.ch	2023-09-24 15:20:35 UTC (rev 68357)
@@ -1408,18 +1408,28 @@
 @r @ Now here's the |reduce| procedure used in our code for productions,
 @z
 
-Section 202.
+Section 200.
 
 @x
 @ @<Print a snapsh...@>=
 @y
- at r @ @<Print a snapsh...@>=
+@ @<Print a snapsh...@>=
 @-n@>
 @%
 @$n {CTWILL}197 \&{short}@>
-@$n {CTWILL}198 \&{short}@>
 @z
 
+Section 202.
+
+ at x
+@ If we get to the end of the scrap list, category codes equal to zero are
+ at y
+ at r @ If we get to the end of the scrap list, category codes equal to zero are
+ at -j@>
+@%
+@$j {CTWILL}203 \&{scrap\_pointer}@>
+ at z
+
 Section 204.
 
 @x

Modified: trunk/Build/source/texk/web2c/cwebdir/cweave.w
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/cweave.w	2023-09-24 13:13:07 UTC (rev 68356)
+++ trunk/Build/source/texk/web2c/cwebdir/cweave.w	2023-09-24 15:20:35 UTC (rev 68357)
@@ -3242,6 +3242,32 @@
   reduce(j,k,c,d,n);
 }
 
+@ If \.{CWEAVE} is being run in debugging mode, the production numbers and
+current stack categories will be printed out when |tracing| is set to |fully|;
+a sequence of two or more irreducible scraps will be printed out when
+|tracing| is set to |partly|.
+
+ at d off 0
+ at d partly 1
+ at d fully 2
+
+@<Private...@>=
+static int tracing=off; /* can be used to show parsing details */
+
+@ @<Print a snapsh...@>=
+if (tracing==fully) {
+  printf("\n%d:",n);
+  for (i=scrap_base; i<=lo_ptr; i++) {
+    putchar(i==pp?'*':' ');
+    if (i->mathness %4 == yes_math) putchar('+');
+    else if (i->mathness %4 == no_math) putchar('-');
+    print_cat(i->cat);
+    if (i->mathness /4 == yes_math) putchar('+');
+    else if (i->mathness /4 == no_math) putchar('-');
+  }
+  if (hi_ptr<=scrap_ptr) printf("..."); /* indicate that more is coming */
+}
+
 @ And here now is the code that applies productions as long as possible.
 Before applying the production mechanism, we must make sure
 it has good input (at least four scraps, the length of the lhs of the
@@ -3278,35 +3304,9 @@
 if (lo_ptr<pp+3) {
   while (hi_ptr<=scrap_ptr && lo_ptr!=pp+3)
     *(++lo_ptr)=*(hi_ptr++);@^system dependencies@>
-  for (i=lo_ptr+1;i<=pp+3;i++) i->cat=0;
+  for (j=lo_ptr+1;j<=pp+3;j++) j->cat=0;
 }
 
-@ If \.{CWEAVE} is being run in debugging mode, the production numbers and
-current stack categories will be printed out when |tracing| is set to |fully|;
-a sequence of two or more irreducible scraps will be printed out when
-|tracing| is set to |partly|.
-
- at d off 0
- at d partly 1
- at d fully 2
-
-@<Private...@>=
-static int tracing=off; /* can be used to show parsing details */
-
-@ @<Print a snapsh...@>=
-if (tracing==fully) {
-  printf("\n%d:",n);
-  for (i=scrap_base; i<=lo_ptr; i++) {
-    putchar(i==pp?'*':' ');
-    if (i->mathness %4 == yes_math) putchar('+');
-    else if (i->mathness %4 == no_math) putchar('-');
-    print_cat(i->cat);
-    if (i->mathness /4 == yes_math) putchar('+');
-    else if (i->mathness /4 == no_math) putchar('-');
-  }
-  if (hi_ptr<=scrap_ptr) printf("..."); /* indicate that more is coming */
-}
-
 @ The |translate| function assumes that scraps have been stored in
 positions |scrap_base| through |scrap_ptr| of |cat| and |trans|. It
 applies productions as much as
@@ -3324,7 +3324,6 @@
 static text_pointer
 translate(void) /* converts a sequence of scraps */
 {
-  scrap_pointer i; /* index into |cat| */
   scrap_pointer j; /* runs through final scraps */
   pp=scrap_base; lo_ptr=pp-1; hi_ptr=pp;
   @<If tracing, print an indication of where we are@>@;



More information about the tex-live-commits mailing list.