summaryrefslogtreecommitdiff
path: root/Build/source
diff options
context:
space:
mode:
authorAndreas Scherer <andreas_tex@freenet.de>2023-09-24 15:20:35 +0000
committerAndreas Scherer <andreas_tex@freenet.de>2023-09-24 15:20:35 +0000
commitbdcc3b635c62be2f70fd82ffa9037c6b450c8fe6 (patch)
tree2373a8e3d3e82b375fc0de59e1464b734b52e03b /Build/source
parent21b1f96dbacee9d2f8785471926a82f297efaf70 (diff)
[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. git-svn-id: svn://tug.org/texlive/trunk@68357 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r--Build/source/texk/web2c/cwebdir/ChangeLog3
-rw-r--r--Build/source/texk/web2c/cwebdir/ctwill-hint.ch14
-rw-r--r--Build/source/texk/web2c/cwebdir/ctwill-mini.ch16
-rw-r--r--Build/source/texk/web2c/cwebdir/cweave.w55
4 files changed, 54 insertions, 34 deletions
diff --git a/Build/source/texk/web2c/cwebdir/ChangeLog b/Build/source/texk/web2c/cwebdir/ChangeLog
index 80fe8f4731a..8a74ad881d0 100644
--- a/Build/source/texk/web2c/cwebdir/ChangeLog
+++ b/Build/source/texk/web2c/cwebdir/ChangeLog
@@ -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>
diff --git a/Build/source/texk/web2c/cwebdir/ctwill-hint.ch b/Build/source/texk/web2c/cwebdir/ctwill-hint.ch
index ee200c49394..59366ed8c13 100644
--- a/Build/source/texk/web2c/cwebdir/ctwill-hint.ch
+++ b/Build/source/texk/web2c/cwebdir/ctwill-hint.ch
@@ -539,7 +539,7 @@ Section 155.
@$force_lines {CTWILL}155 =\\{flags}[\.{'f'}]@>
@z
-Section 187.
+Section 185.
@x
@ @<Print a snapsh...@>=
@@ -548,7 +548,17 @@ Section 187.
@-n@>
@%
@$n {CTWILL}182 \&{short}@>
-@$n {CTWILL}183 \&{short}@>
+@z
+
+Section 187.
+
+@x
+@ If we get to the end of the scrap list, category codes equal to zero are
+@y
+@ If we get to the end of the scrap list, category codes equal to zero are
+@-j@>
+@%
+@$j {CTWILL}188 \&{scrap\_pointer}@>
@z
Section 189.
diff --git a/Build/source/texk/web2c/cwebdir/ctwill-mini.ch b/Build/source/texk/web2c/cwebdir/ctwill-mini.ch
index 396d46cbd90..3184d6cf1c0 100644
--- a/Build/source/texk/web2c/cwebdir/ctwill-mini.ch
+++ b/Build/source/texk/web2c/cwebdir/ctwill-mini.ch
@@ -1408,16 +1408,26 @@ Section 197.
@r @ Now here's the |reduce| procedure used in our code for productions,
@z
-Section 202.
+Section 200.
@x
@ @<Print a snapsh...@>=
@y
-@r @ @<Print a snapsh...@>=
+@ @<Print a snapsh...@>=
@-n@>
@%
@$n {CTWILL}197 \&{short}@>
-@$n {CTWILL}198 \&{short}@>
+@z
+
+Section 202.
+
+@x
+@ If we get to the end of the scrap list, category codes equal to zero are
+@y
+@r @ If we get to the end of the scrap list, category codes equal to zero are
+@-j@>
+@%
+@$j {CTWILL}203 \&{scrap\_pointer}@>
@z
Section 204.
diff --git a/Build/source/texk/web2c/cwebdir/cweave.w b/Build/source/texk/web2c/cwebdir/cweave.w
index cef3de6454f..a7b8b81031d 100644
--- a/Build/source/texk/web2c/cwebdir/cweave.w
+++ b/Build/source/texk/web2c/cwebdir/cweave.w
@@ -3242,6 +3242,32 @@ short d, short n)
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|.
+
+@d off 0
+@d partly 1
+@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,33 +3304,7 @@ stored, since zero does not match anything in a production.
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;
-}
-
-@ 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|.
-
-@d off 0
-@d partly 1
-@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 */
+ for (j=lo_ptr+1;j<=pp+3;j++) j->cat=0;
}
@ The |translate| function assumes that scraps have been stored in
@@ -3324,7 +3324,6 @@ for overflow.
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@>@;