texlive[67662] Build/source/texk/web2c: [CWEB] Discard rest of
commits+ascherer at tug.org
commits+ascherer at tug.org
Tue Jul 18 17:13:33 CEST 2023
Revision: 67662
http://tug.org/svn/texlive?view=revision&revision=67662
Author: ascherer
Date: 2023-07-18 17:13:33 +0200 (Tue, 18 Jul 2023)
Log Message:
-----------
[CWEB] Discard rest of overfull input lines.
In the context of the recent bug fix, I noticed that CWEAVE produced
significantly different output than WEAVE from my test case for overfull
lines, which -- in part -- had to be broken.
Although I am aware that Silvio Levy changed CWEAVE's behaviour already
in CWEB 0.5 (1987), I apply this new change in order to revert to DEK's
idea in WEAVE. Now the resulting TeX output has correctly placed comment
markers at the beginning of the broken lines. (To date, CWEAVE issued
material beyond 'buf_size' in overfull lines without such '%' markers.)
Of course, the resulting TeX output might not be processed as expected
because of the discarded material beyond 'buf_size', but the user has
been warned accordingly. :o).
Modified Paths:
--------------
trunk/Build/source/texk/web2c/ChangeLog
trunk/Build/source/texk/web2c/cwebboot.cin
trunk/Build/source/texk/web2c/cwebdir/ChangeLog
trunk/Build/source/texk/web2c/cwebdir/comm-mac.ch
trunk/Build/source/texk/web2c/cwebdir/comm-w2c.ch
trunk/Build/source/texk/web2c/cwebdir/common.c
trunk/Build/source/texk/web2c/cwebdir/common.w
Modified: trunk/Build/source/texk/web2c/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/ChangeLog 2023-07-17 23:43:18 UTC (rev 67661)
+++ trunk/Build/source/texk/web2c/ChangeLog 2023-07-18 15:13:33 UTC (rev 67662)
@@ -1,3 +1,7 @@
+2023-07-18 Andreas Scherer <https://ascherer.github.io>
+
+ * cwebboot.cin: Discard rest of overfull input line.
+
2023-07-17 Andreas Scherer <https://ascherer.github.io>
* weave.ch: Deal with malign user input.
Modified: trunk/Build/source/texk/web2c/cwebboot.cin
===================================================================
--- trunk/Build/source/texk/web2c/cwebboot.cin 2023-07-17 23:43:18 UTC (rev 67661)
+++ trunk/Build/source/texk/web2c/cwebboot.cin 2023-07-18 15:13:33 UTC (rev 67662)
@@ -630,10 +630,10 @@
#line 92 "cwebdir/comm-w2c.ch"
if((*(k++)= c)!=' '&&c!='\r')limit= k;
#line 166 "cwebdir/common.w"
-if(k> buffer_end)
-if((c= getc(fp))!=EOF&&c!='\n'){
+if(k> buffer_end){
+while((c= getc(fp))!=EOF&&c!='\n');
#line 98 "cwebdir/comm-w2c.ch"
-ungetc(c,fp);loc= buffer;err_print(_("! Input line too long"));
+loc= buffer;err_print(_("! Input line too long"));
#line 169 "cwebdir/common.w"
}
Modified: trunk/Build/source/texk/web2c/cwebdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/ChangeLog 2023-07-17 23:43:18 UTC (rev 67661)
+++ trunk/Build/source/texk/web2c/cwebdir/ChangeLog 2023-07-18 15:13:33 UTC (rev 67662)
@@ -1,3 +1,10 @@
+2023-07-18 Andreas Scherer <https://ascherer.github.io>
+
+ * cwebdir/comm-mac.ch,
+ * cwebdir/comm-w2c.ch,
+ * cwebdir/common.c,
+ * cwebdir/common.w: Discard rest of overfull input line.
+
2023-07-17 Andreas Scherer <https://ascherer.github.io>
* cweave.w: Deal with malign user input.
Modified: trunk/Build/source/texk/web2c/cwebdir/comm-mac.ch
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/comm-mac.ch 2023-07-17 23:43:18 UTC (rev 67661)
+++ trunk/Build/source/texk/web2c/cwebdir/comm-mac.ch 2023-07-18 15:13:33 UTC (rev 67662)
@@ -24,9 +24,9 @@
limit = k = buffer; /* beginning of buffer */
while (k<=buffer_end && (c=getc(fp)) != EOF && c!='\n')
if ((*(k++) = c) != ' ') limit = k;
- if (k>buffer_end)
- if ((c=getc(fp))!=EOF && c!='\n') {
- ungetc(c,fp); loc=buffer; err_print("! Input line too long");
+ if (k>buffer_end) {
+ while ((c=getc(fp))!=EOF && c!='\n'); /* discard rest of line */
+ loc=buffer; err_print("! Input line too long");
@.Input line too long@>
}
if (c==EOF && limit==buffer) return false; /* there was nothing after
@@ -61,7 +61,7 @@
return true;
}
else if (k>buffer_end) {
- ungetc(c,fp); loc=buffer; err_print("! Input line too long");
+ while ((c=getc(fp))!=EOF && c!='\n' && c!='\r'); /* discard rest of line */
return true;
@.Input line too long@>
}
Modified: trunk/Build/source/texk/web2c/cwebdir/comm-w2c.ch
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/comm-w2c.ch 2023-07-17 23:43:18 UTC (rev 67661)
+++ trunk/Build/source/texk/web2c/cwebdir/comm-w2c.ch 2023-07-18 15:13:33 UTC (rev 67662)
@@ -93,9 +93,9 @@
@z
@x
- ungetc(c,fp); loc=buffer; err_print("! Input line too long");
+ loc=buffer; err_print("! Input line too long");
@y
- ungetc(c,fp); loc=buffer; err_print(_("! Input line too long"));
+ loc=buffer; err_print(_("! Input line too long"));
@z
@x
Modified: trunk/Build/source/texk/web2c/cwebdir/common.c
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/common.c 2023-07-17 23:43:18 UTC (rev 67661)
+++ trunk/Build/source/texk/web2c/cwebdir/common.c 2023-07-18 15:13:33 UTC (rev 67662)
@@ -459,9 +459,9 @@
limit= k= buffer;
while(k<=buffer_end&&(c= getc(fp))!=EOF&&c!='\n')
if((*(k++)= c)!=' ')limit= k;
-if(k> buffer_end)
-if((c= getc(fp))!=EOF&&c!='\n'){
-ungetc(c,fp);loc= buffer;err_print("! Input line too long");
+if(k> buffer_end){
+while((c= getc(fp))!=EOF&&c!='\n');
+loc= buffer;err_print("! Input line too long");
}
if(c==EOF&&limit==buffer)return false;
Modified: trunk/Build/source/texk/web2c/cwebdir/common.w
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/common.w 2023-07-17 23:43:18 UTC (rev 67661)
+++ trunk/Build/source/texk/web2c/cwebdir/common.w 2023-07-18 15:13:33 UTC (rev 67662)
@@ -163,9 +163,9 @@
limit = k = buffer; /* beginning of buffer */
while (k<=buffer_end && (c=getc(fp)) != EOF && c!='\n')
if ((*(k++) = c) != ' ') limit = k;
- if (k>buffer_end)
- if ((c=getc(fp))!=EOF && c!='\n') {
- ungetc(c,fp); loc=buffer; err_print("! Input line too long");
+ if (k>buffer_end) {
+ while ((c=getc(fp))!=EOF && c!='\n'); /* discard rest of line */
+ loc=buffer; err_print("! Input line too long");
@.Input line too long@>
}
if (c==EOF && limit==buffer) return false; /* there was nothing after
More information about the tex-live-commits
mailing list.