diff options
author | Andreas Scherer <andreas_tex@freenet.de> | 2024-06-06 14:53:56 +0000 |
---|---|---|
committer | Andreas Scherer <andreas_tex@freenet.de> | 2024-06-06 14:53:56 +0000 |
commit | 5fb160c78ca596a411632f4c084e42baa8b78085 (patch) | |
tree | f9b06222a9630c8027b45ae212e7ac8e9494fd97 | |
parent | 1d04ff1518cca673a62084bb6c50953dd14166e1 (diff) |
[CWEB] Add [part.section] l.ine information.
Apply some OO/C++ knowledge from the late nineties.
git-svn-id: svn://tug.org/texlive/trunk@71449 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ChangeLog | 7 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/comm-w2c.ch | 130 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ctang-w2c.ch | 94 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ctwill-w2c.ch | 274 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/cweav-w2c.ch | 144 | ||||
-rwxr-xr-x | Build/source/texk/web2c/tests/fix-changefile-lines.py | 68 |
6 files changed, 369 insertions, 348 deletions
diff --git a/Build/source/texk/web2c/cwebdir/ChangeLog b/Build/source/texk/web2c/cwebdir/ChangeLog index 0f146a16edb..a3665a07ee9 100644 --- a/Build/source/texk/web2c/cwebdir/ChangeLog +++ b/Build/source/texk/web2c/cwebdir/ChangeLog @@ -1,3 +1,10 @@ +2024-06-06 Andreas Scherer <https://ascherer.github.io> + + * comm-w2c.ch, + * ctang-w2c.ch, + * ctwill-w2c.ch, + * cweav-w2c.ch: Add [part.section] l.ine information. + 2024-05-25 Andreas Scherer <https://ascherer.github.io> * cwebacromac.tex: HiTeX has a three-page table-of-contents. diff --git a/Build/source/texk/web2c/cwebdir/comm-w2c.ch b/Build/source/texk/web2c/cwebdir/comm-w2c.ch index 005817d831f..a4a1aa8f38e 100644 --- a/Build/source/texk/web2c/cwebdir/comm-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/comm-w2c.ch @@ -16,143 +16,143 @@ @q Please send comments, suggestions, etc. to tex-k@@tug.org. @> -@x +@x [0.0] l.25 \def\title{Common code for CTANGLE and CWEAVE (Version 4.11)} @y \def\Kpathsea/{{\mc KPATHSEA\spacefactor1000}} \ifacro\sanitizecommand\Kpathsea{KPATHSEA}\fi \def\title{Common code for CTANGLE and CWEAVE (4.11 [\TeX~Live])} @z -@x +@x [0.0] l.30 \centerline{(Version 4.11)} @y \centerline{(Version 4.11 [\TeX~Live])} @z -@x +@x [0.0] l.32 \def\botofcontents{\vfill @y \def\covernote{\vbox{% @z -@x +@x [0.0] l.45 } @y }}\datecontentspage @z -@x +@x [1.1] l.51 to both \.{CTANGLE} and \.{CWEAVE}, which roughly concerns the following @y to \.{CTANGLE}, \.{CWEAVE}, and \.{CTWILL}, which roughly concerns the following @z -@x +@x [1.1] l.57 sometimes use \.{CWEB} to refer to either of the two component @y sometimes use \.{CWEB} to refer to any of the three component @z -@x +@x [1.2] l.72 @i common.h @y @i comm-w2c.h @z -@x +@x [1.18] l.77 |program|. @y |program|. And \.{CTWILL} adds some extra twists. @z -@x +@x [1.18] l.80 boolean program; /* \.{CWEAVE} or \.{CTANGLE}? */ @y cweb program; /* \.{CTANGLE} or \.{CWEAVE} or \.{CTWILL}? */ @z -@x +@x [1.20] l.99 @<Initialize pointers@>@; @y @<Initialize pointers@>@; @<Set up \.{PROGNAME} feature and initialize the search path mechanism@>@; @z -@x +@x [1.20] l.100 @<Set the default options common to \.{CTANGLE} and \.{CWEAVE}@>@; @y @<Set locale and bind language catalogs@>@; @<Set the default options common to \.{CTANGLE} and \.{CWEAVE}@>@; @z -@x +@x [3.23] l.165 if ((*(k++) = c) != ' ') limit = k; @y if ((*(k++) = c) != ' ' && c != '\r') limit = k; @z -@x +@x [3.23] l.168 loc=buffer; err_print("! Input line too long"); @y loc=buffer; err_print(_("! Input line too long")); @z -@x +@x [4.25] l.197 static char alt_web_file_name[max_file_name_length]; /* alternate name to try */ @y char *found_filename; /* filename found by |kpse_find_file| */ @z -@x +@x [4.29] l.253 err_print("! Missing @@x in change file"); @y err_print(_("! Missing @@x in change file")); @z -@x +@x [4.30] l.264 err_print("! Change file ended after @@x"); @y err_print(_("! Change file ended after @@x")); @z -@x +@x [4.32] l.310 err_print("! Change file ended before @@y"); @y err_print(_("! Change file ended before @@y")); @z -@x +@x [4.32] l.324 err_print("! CWEB file ended during a change"); @y err_print(_("! CWEB file ended during a change")); @z -@x +@x [4.34] l.338 loc=buffer+2; err_print("! Where is the matching @@y?"); @y loc=buffer+2; err_print(_("! Where is the matching @@y?")); @z -@x +@x [4.34] l.345 err_print("of the preceding lines failed to match"); @y err_print(_("of the preceding lines failed to match")); @z -@x +@x [4.35] l.378 err_print("! Include file name not given"); @y err_print(_("! Include file name not given")); @z -@x +@x [4.35] l.383 err_print("! Too many nested includes"); @y err_print(_("! Too many nested includes")); @z -@x +@x [4.36] l.393 @ When an \.{@@i} line is found in the |cur_file|, we must temporarily stop reading it and start reading from the named include file. The \.{@@i} line should give a complete file name with or without @@ -174,13 +174,13 @@ The remainder of the \.{@@i} line after the file name is ignored. @^system dependencies@> @z -@x +@x [4.36] l.405 err_print("! Include file name too long"); goto restart;} @y err_print(_("! Include file name too long")); goto restart;} @z -@x +@x [4.36] l.408 char temp_file_name[max_file_name_length]; char *cur_file_name_end=cur_file_name+max_file_name_length-1; char *kk, *k=cur_file_name; @@ -190,7 +190,7 @@ The remainder of the \.{@@i} line after the file name is ignored. char *k=cur_file_name; @z -@x +@x [4.36] l.422 if ((cur_file=fopen(cur_file_name,"r"))!=NULL) { @y if ((found_filename=kpse_find_cweb(cur_file_name))!=NULL @| @@ -204,7 +204,7 @@ The remainder of the \.{@@i} line after the file name is ignored. } else fatal(_("! Filename too long\n"), found_filename); @z -@x +@x [4.36] l.426 if ((kk=getenv("CWEBINPUTS"))!=NULL) { if ((l=strlen(kk))>max_file_name_length-2) too_long(); strcpy(temp_file_name,kk); @@ -234,25 +234,25 @@ The remainder of the \.{@@i} line after the file name is ignored. include_depth--; err_print(_("! Cannot open include file")); goto restart; @z -@x +@x [4.38] l.473 err_print("! Change file ended without @@z"); @y err_print(_("! Change file ended without @@z")); @z -@x +@x [4.38] l.489 err_print("! Where is the matching @@z?"); @y err_print(_("! Where is the matching @@z?")); @z -@x +@x [4.39] l.509 err_print("! Change file entry did not match"); @y err_print(_("! Change file entry did not match")); @z -@x +@x [4.41] l.534 if ((web_file=fopen(web_file_name,"r"))==NULL) { strcpy(web_file_name,alt_web_file_name); if ((web_file=fopen(web_file_name,"r"))==NULL) @@ -271,7 +271,7 @@ else if (strlen(found_filename) < max_file_name_length) { } else fatal(_("! Filename too long\n"), found_filename); @z -@x +@x [4.41] l.542 if ((change_file=fopen(change_file_name,"r"))==NULL) fatal("! Cannot open change file ", change_file_name); @y @@ -287,13 +287,13 @@ else if (strlen(found_filename) < max_file_name_length) { } else fatal(_("! Filename too long\n"), found_filename); @z -@x +@x [5.46] l.619 @d hash_size 353 /* should be prime */ @y @d hash_size 8501 /* should be prime */ @z -@x +@x [5.51] l.673 if (byte_ptr+l>byte_mem_end) overflow("byte memory"); if (name_ptr>=name_dir_end) overflow("name"); @y @@ -301,13 +301,13 @@ else if (strlen(found_filename) < max_file_name_length) { if (name_ptr>=name_dir_end) overflow(_("name")); @z -@x +@x [5.51] l.677 if (program==cweave) p->ilk=t, init_node(p); @y if (program!=ctangle) p->ilk=t, init_node(p); @z -@x +@x [5.57] l.806 if (s+name_len>byte_mem_end) overflow("byte memory"); if (name_ptr+1>=name_dir_end) overflow("name"); @y @@ -315,55 +315,55 @@ else if (strlen(found_filename) < max_file_name_length) { if (name_ptr+1>=name_dir_end) overflow(_("name")); @z -@x +@x [5.58] l.833 if (name_ptr>=name_dir_end) overflow("name"); @y if (name_ptr>=name_dir_end) overflow(_("name")); @z -@x +@x [5.58] l.838 if (s+name_len>byte_mem_end) overflow("byte memory"); @y if (s+name_len>byte_mem_end) overflow(_("byte memory")); @z -@x +@x [5.60] l.883 printf("%s","\n! Ambiguous prefix: matches <"); @y printf("%s",_("\n! Ambiguous prefix: matches <")); @z -@x +@x [5.60] l.886 printf("%s",">\n and <"); @y printf("%s",_(">\n and <")); @z -@x +@x [5.62] l.912 printf("%s","\n! New name is a prefix of <"); @y printf("%s",_("\n! New name is a prefix of <")); @z -@x +@x [5.62] l.924 printf("%s","\n! New name extends <"); @y printf("%s",_("\n! New name extends <")); @z -@x +@x [5.62] l.930 printf("%s","\n! Section name incompatible with <"); @y printf("%s",_("\n! Section name incompatible with <")); @z -@x +@x [5.62] l.933 printf("%s",">,\n which abbreviates <"); @y printf("%s",_(">,\n which abbreviates <")); @z -@x +@x [6.67] l.1031 printf(". (l. %d of change file)\n", change_line); else if (cur_line>0) { if (include_depth==0) printf(". (l. %d)\n", cur_line); @@ -375,7 +375,7 @@ else if (cur_line>0) { else printf(_(". (l. %d of include file %s)\n"), cur_line, cur_file_name); @z -@x +@x [6.68] l.1057 Some implementations may wish to pass the |history| value to the operating system so that it can be used to govern whether or not other programs are started. Here, for instance, we pass the operating system @@ -397,14 +397,14 @@ can be made sensitive to these conditions. @d RETURN_FAIL 20 /* Complete or severe failure */ @z -@x +@x [6.68] l.1068 @<Print the job |history|@>@; @y @<Print the job |history|@>@; @<Remove the temporary file if not already done@>@; @z -@x +@x [6.68] l.1069 if (history > harmless_message) return EXIT_FAILURE; else return EXIT_SUCCESS; @y @@ -416,7 +416,7 @@ can be made sensitive to these conditions. } @z -@x +@x [6.69] l.1075 case spotless: if (show_happiness) puts("(No errors were found.)"); break; case harmless_message: @@ -436,13 +436,13 @@ case fatal_message: default: puts(_("(That was a fatal error, my friend.)")); @z -@x +@x [6.71] l.1106 printf("\n! Sorry, %s capacity exceeded",t); fatal("",""); @y printf(_("\n! Sorry, %s capacity exceeded"),t); fatal("",""); @z -@x +@x [7.73] l.1118 or flags to be turned on (beginning with |"+"|). @y or flags to be turned on (beginning with |"+"|). @@ -450,20 +450,20 @@ or flags to be turned on (beginning with |"+"|). see section |@<Handle flag arg...@>| for details. @z -@x +@x [7.73] l.1130 char scn_file_name[max_file_name_length]; /* name of |scn_file| */ @y char scn_file_name[max_file_name_length]; /* name of |scn_file| */ char check_file_name[max_file_name_length]; /* name of |check_file| */ @z -@x +@x [7.74] l.1138 show_banner=show_happiness=show_progress=make_xrefs=true; @y make_xrefs=true; @z -@x +@x [7.75] l.1142 file. It may have an extension, or it may omit the extension to get |".w"| or |".web"| added. The \TEX/ output file name is formed by replacing the \.{CWEB} @y @@ -471,7 +471,7 @@ file. It may have an extension, or it may omit the extension to get |".w"| added. The \TEX/ output file name is formed by replacing the \.{CWEB} @z -@x +@x [7.75] l.1149 An omitted change file argument means that |"/dev/null"| should be used, when no changes are desired. @y @@ -480,7 +480,7 @@ systems the contents of the compile-time variable |DEV_NULL| (\TeX~Live) or |_DEV_NULL| (Amiga)---should be used, when no changes are desired. @z -@x +@x [7.75] l.1165 strcpy(change_file_name,"/dev/null"); @y strcpy(change_file_name,"/dev/null"); @@ -494,7 +494,7 @@ systems the contents of the compile-time variable |DEV_NULL| (\TeX~Live) or @^system dependencies@> @z -@x +@x [7.75] l.1171 if (*s=='.') dot_pos=s++; else if (*s=='/') dot_pos=NULL,name_pos=++s; else s++; @@ -506,7 +506,7 @@ systems the contents of the compile-time variable |DEV_NULL| (\TeX~Live) or @^system dependencies@> @z -@x +@x [7.77] l.1186 @ We use all of |*argv| for the |web_file_name| if there is a |'.'| in it, otherwise we add |".w"|. If this file can't be opened, we prepare an |alt_web_file_name| by adding |"web"| after the dot. @@ -515,12 +515,12 @@ otherwise we add |".w"|. If this file can't be opened, we prepare an otherwise we add |".w"|. @z -@x +@x [7.77] l.1203 sprintf(alt_web_file_name,"%s.web",*argv); @y @z -@x +@x [7.80] l.1246 for(dot_pos=*argv+1;*dot_pos>'\0';dot_pos++) flags[(eight_bits)*dot_pos]=flag_change; @y @@ -554,7 +554,7 @@ for(dot_pos=*argv+1;*dot_pos>'\0';dot_pos++) } @z -@x +@x [7.81] l.1249 @ @<Print usage error message and quit@>= { if (program==ctangle) @@ -572,20 +572,20 @@ cb_usage(program==ctangle ? "ctangle" : program==cweave ? "cweave" : "ctwill"); @.Usage:@> @z -@x +@x [7.82] l.1261 @ @<Complain about arg...@>= fatal("! Filename too long\n", *argv); @y @ @<Complain about arg...@>= fatal(_("! Filename too long\n"), *argv); @z -@x +@x [8.83] l.1272 FILE *active_file; /* currently active file for \.{CWEAVE} output */ @y FILE *active_file; /* currently active file for \.{CWEAVE} output */ FILE *check_file; /* temporary output file */ @z -@x +@x [8.84] l.1274 @ @<Scan arguments and open output files@>= scan_args(); if (program==ctangle) { @@ -613,7 +613,7 @@ else { } @z -@x +@x [9.85] l.1286 @* Index. @y @** Extensions to {\tentex CWEB}. The following sections introduce new or diff --git a/Build/source/texk/web2c/cwebdir/ctang-w2c.ch b/Build/source/texk/web2c/cwebdir/ctang-w2c.ch index c6d74ba5d28..38773106c3d 100644 --- a/Build/source/texk/web2c/cwebdir/ctang-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/ctang-w2c.ch @@ -16,50 +16,50 @@ @q Please send comments, suggestions, etc. to tex-k@@tug.org. @> -@x +@x [0.0] l.30 \def\title{CTANGLE (Version 4.11)} @y \def\title{CTANGLE (Version 4.11 [\TeX~Live])} @z -@x +@x [0.0] l.34 \centerline{(Version 4.11)} @y \centerline{(Version 4.11 [\TeX~Live])} @z -@x +@x [0.0] l.36 \def\botofcontents{\vfill @y \def\covernote{\vbox{% @z -@x +@x [0.0] l.49 } @y }}\datecontentspage @z -@x +@x [1.1] l.64 @d banner "This is CTANGLE (Version 4.11)" @y @d banner "This is CTANGLE, Version 4.11" /* will be extended by the \TeX~Live |versionstring| */ @z -@x +@x [1.2] l.90 if (show_banner) puts(banner); /* print a ``banner line'' */ @y if (show_banner) cb_show_banner(); /* print a ``banner line'' */ @z -@x +@x [1.3] l.101 @i common.h @y @i comm-w2c.h @z -@x +@x [2.20] l.129 @ @d max_texts 4000 /* number of replacement texts, must be less than 10240 */ @d max_toks 270000 /* number of bytes in compressed \CEE/ code */ @y @@ -67,37 +67,37 @@ @d max_toks 1000000 /* number of bytes in compressed \CEE/ code */ @z -@x +@x [3.29] l.237 if (tok_ptr+2>tok_mem_end) overflow("token"); @y if (tok_ptr+2>tok_mem_end) overflow(_("token")); @z -@x +@x [4.35] l.320 if (stack_ptr==stack_end) overflow("stack"); @y if (stack_ptr==stack_end) overflow(_("stack")); @z -@x +@x [4.40] l.412 printf("%s","\n! Not present: <"); @y printf("%s",_("\n! Not present: <")); @z -@x +@x [5.47] l.510 else overflow("output files"); @y else overflow(_("output files")); @z -@x +@x [6.48] l.526 printf("%s","\n! No program text was specified."); mark_harmless(); @y printf("%s",_("\n! No program text was specified.")); mark_harmless(); @z -@x +@x [6.48] l.532 "\nWriting the output file (%s):" : @| "\nWriting the output files: (%s)",C_file_name); @y @@ -105,13 +105,13 @@ _("\nWriting the output files: (%s)"),C_file_name); @z -@x +@x [6.48] l.542 printf("%s","Done."); @y printf("%s",_("Done.")); @z -@x +@x [6.50] l.556 @<Write all the named output files@>= for (an_output_file=end_output_files; an_output_file>cur_out_file;) { an_output_file--; @@ -154,13 +154,13 @@ if (check_for_change) strcpy(check_file_name,""); /* We want to get rid of the temporary file */ @z -@x +@x [6.54] l.616 else if (a<050000) confusion("macro defs have strange char"); @y else if (a<050000) confusion(_("macro defs have strange char")); @z -@x +@x [6.59] l.703 @ @<Case of an identifier@>=@t\1\quad@> @y @ Nowadays, most computer files are encoded in some form of ``Unicode''. A very @@ -192,7 +192,7 @@ quarter) with its two-byte encoding \.{c2 bc}. @<Case of an identifier@>=@t\1\quad@> @z -@x +@x [6.59] l.708 if ((eight_bits)(*j)<0200) C_putc(*j); @^high-bit character handling@> else C_printf("%s",translit[(eight_bits)(*j)-0200]); @@ -209,91 +209,91 @@ quarter) with its two-byte encoding \.{c2 bc}. else C_putc(*j); @z -@x +@x [7.67] l.840 err_print("! Input ended in mid-comment"); @y err_print(_("! Input ended in mid-comment")); @z -@x +@x [7.67] l.853 err_print("! Section name ended in mid-comment"); loc--; @y err_print(_("! Section name ended in mid-comment")); loc--; @z -@x +@x [8.74] l.1004 err_print("! String didn't end"); loc=limit; break; @y err_print(_("! String didn't end")); loc=limit; break; @z -@x +@x [8.74] l.1008 err_print("! Input ended in middle of string"); loc=buffer; break; @y err_print(_("! Input ended in middle of string")); loc=buffer; break; @z -@x +@x [8.74] l.1026 printf("%s","\n! String too long: "); @y printf("%s",_("\n! String too long: ")); @z -@x +@x [8.75] l.1041 case translit_code: err_print("! Use @@l in limbo only"); continue; @y case translit_code: err_print(_("! Use @@l in limbo only")); continue; @z -@x +@x [8.75] l.1046 err_print("! Double @@ should be used in control text"); @y err_print(_("! Double @@ should be used in control text")); @z -@x +@x [8.76] l.1070 err_print("! Double @@ should be used in ASCII constant"); @y err_print(_("! Double @@ should be used in ASCII constant")); @z -@x +@x [8.76] l.1076 err_print("! String didn't end"); loc=limit-1; break; @y err_print(_("! String didn't end")); loc=limit-1; break; @z -@x +@x [8.79] l.1108 err_print("! Input ended in section name"); @y err_print(_("! Input ended in section name")); @z -@x +@x [8.79] l.1121 printf("%s","\n! Section name too long: "); @y printf("%s",_("\n! Section name too long: ")); @z -@x +@x [8.80] l.1135 err_print("! Section name didn't end"); break; @y err_print(_("! Section name didn't end")); break; @z -@x +@x [8.80] l.1139 err_print("! Nesting of section names not allowed"); break; @y err_print(_("! Nesting of section names not allowed")); break; @z -@x +@x [8.81] l.1153 if (loc>=limit) err_print("! Verbatim string didn't end"); @y if (loc>=limit) err_print(_("! Verbatim string didn't end")); @z -@x +@x [9.82] l.1177 @d app_repl(c) { if (tok_ptr==tok_mem_end) overflow("token"); else *(tok_ptr++)=(eight_bits)c; @@ -305,55 +305,55 @@ if (loc>=limit) err_print(_("! Verbatim string didn't end")); } @z -@x +@x [9.83] l.1204 if (text_ptr>text_info_end) overflow("text"); @y if (text_ptr>text_info_end) overflow(_("text")); @z -@x +@x [9.86] l.1250 case output_defs_code: if (t!=section_name) err_print("! Misplaced @@h"); @y case output_defs_code: if (t!=section_name) err_print(_("! Misplaced @@h")); @z -@x +@x [9.86] l.1268 err_print("! @@d, @@f and @@c are ignored in C text"); continue; @y err_print(_("! @@d, @@f and @@c are ignored in C text")); continue; @z -@x +@x [9.87] l.1278 if (*try_loc=='=') err_print ("! Missing `@@ ' before a named section"); @y if (*try_loc=='=') err_print (_("! Missing `@@ ' before a named section")); @z -@x +@x [9.88] l.1295 else err_print("! Double @@ should be used in string"); @y else err_print(_("! Double @@ should be used in string")); @z -@x +@x [9.89] l.1344 default: err_print("! Unrecognized escape sequence"); @y default: err_print(_("! Unrecognized escape sequence")); @z -@x +@x [10.93] l.1417 err_print("! Definition flushed, must start with identifier"); @y err_print(_("! Definition flushed, must start with identifier")); @z -@x +@x [10.100] l.1498 err_print("! Double @@ should be used in control text"); @y err_print(_("! Double @@ should be used in control text")); @z -@x +@x [10.100] l.1501 } @=/* otherwise fall through */@>@; default: err_print("! Double @@ should be used in limbo"); @y @@ -361,19 +361,19 @@ case output_defs_code: if (t!=section_name) err_print(_("! Misplaced @@h")); default: err_print(_("! Double @@ should be used in limbo")); @z -@x +@x [10.102] l.1516 err_print("! Improper hex number following @@l"); @y err_print(_("! Improper hex number following @@l")); @z -@x +@x [10.102] l.1526 err_print("! Replacement string in @@l too long"); @y err_print(_("! Replacement string in @@l too long")); @z -@x +@x [10.103] l.1540 puts("\nMemory usage statistics:"); printf("%td names (out of %ld)\n",@^system dependencies@> (ptrdiff_t)(name_ptr-name_dir),(long)max_names); @@ -393,7 +393,7 @@ case output_defs_code: if (t!=section_name) err_print(_("! Misplaced @@h")); printf(_("%td tokens (out of %ld)\n"), @z -@x +@x [11.104] l.1551 @** Index. @y @** Extensions to {\tentex CWEB}. The following sections introduce new or diff --git a/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch b/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch index f7e4895aeeb..d2e953401c4 100644 --- a/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch @@ -16,7 +16,7 @@ @q Please send comments, suggestions, etc. to tex-k@@tug.org. @> -@x +@x [0.0] l.1 % This file is part of CWEB. % This program by Silvio Levy and Donald E. Knuth % is based on a program by Knuth. @@ -26,7 +26,7 @@ % It's somewhat flaky, so you probably shouldn't try to use it. @z -@x +@x [0.0] l.23 % Here is TeX material that gets inserted after \input cwebmac @y % Here is TeX material that gets inserted after \input ctwimac @@ -34,38 +34,38 @@ \datethis % Put timestamp before section 1 @z -@x +@x [0.0] l.35 \def\title{CWEAVE (Version 4.11)} @y \def\Kpathsea/{{\mc KPATHSEA\spacefactor1000}} \ifacro\sanitizecommand\Kpathsea{KPATHSEA}\fi \def\title{CTWILL (Version 4.11 [\TeX~Live])} @z -@x +@x [0.0] l.37 \centerline{\titlefont The {\ttitlefont CWEAVE} processor} @y \centerline{\titlefont The {\ttitlefont CTWILL} processor} @z -@x +@x [0.0] l.39 \centerline{(Version 4.11)} @y \centerline{(Version 4.11 [\TeX~Live])} @z -@x +@x [0.0] l.41 \def\botofcontents{\vfill @y \def\covernote{\vbox{% @z -@x +@x [0.0] l.54 } @y }}\datecontentspage @z -@x +@x [1.1] l.59 This is the \.{CWEAVE} program by Silvio Levy and Donald E. Knuth, based on \.{WEAVE} by Knuth. We are thankful to Steve Avery, @@ -105,25 +105,25 @@ modified. The version number parallels the corresponding version of \.{CWEAVE}. /* will be extended by the \TeX~Live |versionstring| */ @z -@x +@x [1.2] l.94 program=cweave; @y program=ctwill; @z -@x +@x [1.2] l.98 if (show_banner) puts(banner); /* print a ``banner line'' */ @y if (show_banner) cb_show_banner(); /* print a ``banner line'' */ @z -@x +@x [1.3] l.112 @i common.h @y @i comm-w2c.h @z -@x +@x [2.21] l.183 turned on during the first phase. @<Private...@>= @@ -132,19 +132,19 @@ static boolean change_exists; /* has any section changed? */ turned on during the first phase---NOT! @z -@x +@x [2.23] l.217 @ @d max_refs 30000 /* number of cross-references; must be less than 65536 */ @y @ @d max_refs 65535 /* number of cross-references; must be less than 65536 */ @z -@x +@x [2.25] l.246 @d append_xref(c) if (xref_ptr==xmem_end) overflow("cross-reference"); @y @d append_xref(c) if (xref_ptr==xmem_end) overflow(_("cross-reference")); @z -@x +@x [2.30] l.337 @d max_toks 30000 /* number of symbols in \CEE/ texts being parsed; must be less than 65536 */ @d max_texts 8000 /* number of phrases in \CEE/ texts being parsed; @@ -156,14 +156,14 @@ turned on during the first phase---NOT! must be less than 10240 */ @z -@x +@x [2.32] l.357 @ Here are the two procedures needed to complete |id_lookup|: @y @ Here are the two procedures needed to complete |id_lookup|: @s perm_meaning int @z -@x +@x [2.32] l.374 p->xref=(void *)xmem; @y p->xref=(void *)xmem; @@ -177,7 +177,7 @@ turned on during the first phase---NOT! } @z -@x +@x [2.33] l.377 @ And here's a small helper function to simplify the code. @d update_node(p) (p)->xref=(void *)xref_ptr @@ -188,7 +188,7 @@ turned on during the first phase---NOT! @d get_meaning(p) (p)-name_dir+cur_meaning @z -@x +@x [2.34] l.436 id_lookup("extern",NULL,int_like); @y @# @@ -196,7 +196,7 @@ ext_loc=id_lookup("extern",NULL,int_like)-name_dir; @# @z -@x +@x [2.34] l.449 id_lookup("int",NULL,raw_int); @y @# @@ -204,7 +204,7 @@ int_loc=id_lookup("int",NULL,raw_int)-name_dir; @# @z -@x +@x [3.36] l.544 @d ord 0207 /* control code for `\.{@@'}' */ @d join 0210 /* control code for `\.{@@\&}' */ @d thin_space 0211 /* control code for `\.{@@,}' */ @@ -248,7 +248,7 @@ int_loc=id_lookup("int",NULL,raw_int)-name_dir; @d new_section 0235 /* control code for `\.{@@\ }' and `\.{@@*}' */ @z -@x +@x [3.38] l.587 ccode['\'']=ord; @y ccode['\'']=ord; @@ -256,7 +256,7 @@ ccode['$']=meaning; ccode['%']=temp_meaning; ccode['-']=suppress; ccode['r']=ccode['R']=right_start; @z -@x +@x [3.40] l.608 static eight_bits skip_TeX(void); @ @c @@ -269,7 +269,7 @@ part of all meanings. @c @z -@x +@x [3.41] l.614 if (loc>limit && get_line()==false) return; @y if (loc>limit && get_line()==false) return; @@ -279,44 +279,44 @@ part of all meanings. } @z -@x +@x [4.43] l.670 \yskip\hang |xref_roman|, |xref_wildcard|, |xref_typewriter|, |TeX_string|, @y \yskip\hang |xref_roman|, |xref_wildcard|, |xref_typewriter|, |TeX_string|, |meaning|, |suppress|, @z -@x +@x [4.46] l.731 @d right_preproc 0217 /* ends a preprocessor command */ @y @d right_preproc 0223 /* ends a preprocessor command */ @z -@x +@x [4.57] l.888 err_print("! String didn't end"); loc=limit; break; @y err_print(_("! String didn't end")); loc=limit; break; @z -@x +@x [4.57] l.892 err_print("! Input ended in middle of string"); loc=buffer; break; @y err_print(_("! Input ended in middle of string")); loc=buffer; break; @z -@x +@x [4.57] l.911 printf("%s","\n! String too long: "); @y printf("%s",_("\n! String too long: ")); @z -@x +@x [4.59] l.930 case translit_code: err_print("! Use @@l in limbo only"); continue; @y case translit_code: err_print(_("! Use @@l in limbo only")); continue; @z -@x +@x [4.59] l.932 case underline: xref_switch=def_flag; continue; @y case underline: xref_switch=def_flag; continue; @@ -324,38 +324,38 @@ part of all meanings. case right_start: right_start_switch=true; continue; @z -@x +@x [4.59] l.938 case xref_roman: case xref_wildcard: case xref_typewriter: case noop: @y case xref_roman: case xref_wildcard: case xref_typewriter: case noop: case meaning: case suppress: @z -@x +@x [4.62] l.968 err_print("! Input ended in section name"); @y err_print(_("! Input ended in section name")); @z -@x +@x [4.62] l.981 printf("%s","\n! Section name too long: "); @y printf("%s",_("\n! Section name too long: ")); @z -@x +@x [4.63] l.995 err_print("! Section name didn't end"); break; @y err_print(_("! Section name didn't end")); break; @z -@x +@x [4.63] l.999 err_print("! Control codes are forbidden in section name"); break; @y err_print(_("! Control codes are forbidden in section name")); break; @z -@x +@x [4.64] l.1009 skip_restricted(void) { @y @@ -363,19 +363,19 @@ skip_restricted(void) { int c=ccode[(eight_bits)*(loc-1)]; @z -@x +@x [4.64] l.1016 err_print("! Control text didn't end"); loc=limit; @y err_print(_("! Control text didn't end")); loc=limit; @z -@x +@x [4.64] l.1021 err_print("! Control codes are forbidden in control text"); @y err_print(_("! Control codes are forbidden in control text")); @z -@x +@x [4.64] l.1022 @.Control codes are forbidden...@> @y @.Control codes are forbidden...@> @@ -383,68 +383,68 @@ skip_restricted(void) else if (c==suppress && phase==2) @<Suppress mini-index entry@>@; @z -@x +@x [4.66] l.1036 if (loc>=limit) err_print("! Verbatim string didn't end"); @y if (loc>=limit) err_print(_("! Verbatim string didn't end")); @z -@x +@x [5.68] l.1061 skip_limbo(); change_exists=false; @y skip_limbo(); @<Give a default title to the program, if necessary@>@; @z -@x +@x [5.68] l.1064 changed_section[section_count]=change_exists; /* the index changes if anything does */ @y @z -@x +@x [5.70] l.1073 if (++section_count==max_sections) overflow("section number"); @y if (++section_count==max_sections) overflow(_("section number")); @z -@x +@x [5.70] l.1074 changed_section[section_count]=changing; /* it will become |true| if any line changes */ @y @z -@x +@x [5.70] l.1083 if (changed_section[section_count]) change_exists=true; @y @z -@x +@x [5.74] l.1162 case translit_code: err_print("! Use @@l in limbo only"); continue; @y case translit_code: err_print(_("! Use @@l in limbo only")); continue; @z -@x +@x [5.74] l.1167 case xref_roman: case xref_wildcard: case xref_typewriter: @y case xref_roman: case xref_wildcard: case xref_typewriter: case meaning: case suppress: @z -@x +@x [5.79] l.1249 err_print("! Missing left identifier of @@s"); @y err_print(_("! Missing left identifier of @@s")); @z -@x +@x [5.79] l.1254 err_print("! Missing right identifier of @@s"); @y err_print(_("! Missing right identifier of @@s")); @z -@x +@x [5.82] l.1302 printf("%s","\n! Never defined: <"); print_section_name(p); putchar('>'); mark_harmless(); @y @@ -452,7 +452,7 @@ if (loc>=limit) err_print(_("! Verbatim string didn't end")); print_section_name(p); putchar('>'); mark_harmless(); @z -@x +@x [5.82] l.1308 printf("%s","\n! Never used: <"); print_section_name(p); putchar('>'); mark_harmless(); @y @@ -460,7 +460,7 @@ if (loc>=limit) err_print(_("! Verbatim string didn't end")); print_section_name(p); putchar('>'); mark_harmless(); @z -@x +@x [6.89] l.1397 @ In particular, the |finish_line| procedure is called near the very beginning of phase two. We initialize the output variables in a slightly tricky way so that the first line of the output file will be @@ -494,7 +494,7 @@ tex_puts(proofing?"ctproofma":"ctwima"); *out_ptr='c'; @z -@x +@x [6.90] l.1414 @d out(c) {if (out_ptr>=out_buf_end) break_out(); *(++out_ptr)=c;} @y @d out(c) @@ -508,102 +508,102 @@ tex_puts(proofing?"ctproofma":"ctwima"); } @z -@x +@x [6.94] l.1462 printf("\n! Line had to be broken (output l. %d):\n",out_line); @y printf(_("\n! Line had to be broken (output l. %d):\n"),out_line); @z -@x +@x [6.95] l.1471 |def_flag|, so it cannot have more than five decimal digits. If the section is changed, we output `\.{\\*}' just after the number. @y |def_flag|, so it cannot have more than five decimal digits. @z -@x +@x [6.96] l.1485 if (changed_section[n]) out_str("\\*"); @.\\*@> @y @z -@x +@x [7.99] l.1543 default: err_print("! Double @@ should be used in limbo"); @y case right_start: right_start_switch=true; break; default: err_print(_("! Double @@ should be used in limbo")); @z -@x +@x [7.101] l.1585 @d app_tok(c) {if (tok_ptr+2>tok_mem_end) overflow("token"); *(tok_ptr++)=c;} @y @d app_tok(c) {if (tok_ptr+2>tok_mem_end) overflow(_("token")); *(tok_ptr++)=c;} @z -@x +@x [7.101] l.1597 err_print("! Input ended in mid-comment"); @y err_print(_("! Input ended in mid-comment")); @z -@x +@x [7.101] l.1602 if (bal>1) err_print("! Missing } in comment"); @y if (bal>1) err_print(_("! Missing } in comment")); @z -@x +@x [7.101] l.1618 else {err_print("! Extra } in comment"); @y else {err_print(_("! Extra } in comment")); @z -@x +@x [7.102] l.1630 if (bal>1) err_print("! Missing } in comment"); @y if (bal>1) err_print(_("! Missing } in comment")); @z -@x +@x [7.103] l.1638 err_print("! Illegal use of @@ in comment"); @y err_print(_("! Illegal use of @@ in comment")); @z -@x +@x [8.106] l.1755 @d attr_head 69 /* denotes beginning of attribute */ @y @d attr_head 69 /* denotes beginning of attribute */ @d title 70 /* program name or header name in a ``meaning'' */ @z -@x +@x [8.110] l.2129 @i prod.w @y @i prod-twill.w @z -@x +@x [9.113] l.2179 static scrap scrap_info[max_scraps]; /* memory array for scraps */ @y static scrap scrap_info[max_scraps]; /* memory array for scraps */ static scrap null_scrap; /* a scrap with empty translation */ @z -@x +@x [9.114] l.2188 @ @<Set init...@>= @y @ @<Set init...@>= null_scrap.trans=&tok_start[0]; @z -@x +@x [9.116] l.2249 update_terminal(); @y puts("|"); update_terminal(); @z -@x +@x [9.124] l.2560 the |for| loop below. @c @@ -618,7 +618,7 @@ static token_pointer tok_loc; /* where the first identifier appears */ @# @z -@x +@x [9.124] l.2568 token_pointer tok_loc; /* pointer to |tok_value| */ if ((tok_loc=find_first_ident(p->trans))<=operator_found) return; /* this should not happen */ @@ -626,12 +626,12 @@ static token_pointer tok_loc; /* where the first identifier appears */ if (tok_loc<=operator_found) return; /* this should not happen */ @z -@x +@x [9.125] l.2597 token_pointer tok_loc; /* where the first identifier appears */ @y @z -@x +@x [9.128] l.2651 @<Cases for |exp|@>= if (cat1==lbrace || cat1==int_like || cat1==decl) { make_underlined(pp); big_app(dindent); big_app1(pp); @@ -646,7 +646,7 @@ if(cat1==lbrace || cat1==int_like || cat1==decl) { } @z -@x +@x [9.128] l.2666 make_underlined (pp); squash(pp,2,tag,-1,7); @y make_underlined (pp); @@ -657,7 +657,7 @@ if(cat1==lbrace || cat1==int_like || cat1==decl) { squash(pp,2,tag,-1,7); @z -@x +@x [9.138] l.2755 @ @<Cases for |decl_head|@>= if (cat1==comma) { big_app2(pp); app(opt); app('9'); reduce(pp,2,decl_head,-1,33); @@ -700,7 +700,7 @@ else if (cat1==int_like || cat1==lbrace || cat1==decl) { else if (cat1==semi) squash(pp,2,decl,-1,39); @z -@x +@x [9.139] l.2777 @ @<Cases for |decl|@>= if (cat1==decl) { big_app1_insert(pp,force); reduce(pp,2,decl,-1,40); @@ -719,13 +719,13 @@ else if (cat1==stmt || cat1==function) { } @z -@x +@x [9.141] l.2803 make_underlined(pp+1); make_reserved(pp+1); @y make_underlined(pp+1); make_reserved(pp+1); make_ministring(pp+1); @z -@x +@x [9.143] l.2834 @ @<Cases for |fn_decl|@>= if (cat1==decl) { big_app1_insert(pp,force); reduce(pp,2,fn_decl,0,51); @@ -748,14 +748,14 @@ else if (cat1==stmt) { } @z -@x +@x [9.153] l.2938 big_app1_insert(pp,dindent); reduce(pp,2,fn_decl,0,73); @y big_app1(pp); if (indent_param_decl) big_app(dindent); big_app1(pp+1); reduce(pp,2,fn_decl,0,73); @z -@x +@x [9.156] l.2964 big_app1_insert(pp, (cat1==decl || cat1==function) ? big_force : force_lines ? force : break_space); reduce(pp,2,cat1,-1,76); @y @@ -764,7 +764,7 @@ else if (cat1==stmt) { ( force_lines ? force : break_space ) ); reduce(pp,2,cat1,-1,76); @z -@x +@x [9.158] l.2972 if (cat1==define_like) make_underlined(pp+2); @y if (cat1==define_like) { /* \#\&{define} is analogous to \&{extern} */ @@ -776,7 +776,7 @@ if (cat1==define_like) { /* \#\&{define} is analogous to \&{extern} */ } @z -@x +@x [9.167] l.3069 if (cat1==prelangle) reduce(pp+1,0,langle,1,100); else reduce(pp,0,exp,-2,101); @y @@ -784,13 +784,13 @@ if (cat1==prelangle) reduce(pp+1,0,langle,1,121); else reduce(pp,0,exp,-2,122); @z -@x +@x [9.168] l.3074 big_app1_insert(pp,' '); reduce(pp,2,else_like,-2,102); @y big_app1_insert(pp,' '); reduce(pp,2,else_like,-2,123); @z -@x +@x [9.173] l.3106 @ @<Cases for |typedef_like|@>= if ((cat1==int_like || cat1==cast) && (cat2==comma || cat2==semi)) reduce(pp+1,0,exp,-1,115); @@ -826,56 +826,56 @@ if (cat1==decl_head) { (cat3==semi || cat3==comma)) reduce(pp+2,0,exp,1,202); @z -@x +@x [9.186] l.3293 overflow("token"); @y overflow(_("token")); @z -@x +@x [9.186] l.3297 overflow("text"); @y overflow(_("text")); @z -@x +@x [9.190] l.3352 if (tok_ptr+6>tok_mem_end) overflow("token"); @y if (tok_ptr+6>tok_mem_end) overflow(_("token")); @z -@x +@x [9.191] l.3358 printf("\nIrreducible scrap sequence in section %d:",(int)section_count); @y printf(_("\nIrreducible scrap sequence in section %d:"),(int)section_count); @z -@x +@x [9.192] l.3368 printf("\nTracing after l. %d:\n",cur_line); mark_harmless(); @y printf(_("\nTracing after l. %d:\n"),cur_line); mark_harmless(); @z -@x +@x [10.196] l.3454 case ignore: case xref_roman: case xref_wildcard: @y case ignore: case xref_roman: case xref_wildcard: case meaning: case suppress: @z -@x +@x [10.197] l.3500 overflow("scrap/token/text"); @y overflow(_("scrap/token/text")); @z -@x +@x [10.199] l.3585 else err_print("! Double @@ should be used in strings"); @y else err_print(_("! Double @@ should be used in strings")); @z -@x +@x [10.202] l.3650 else app_scrap(p->ilk,maybe_math); } } @@ -886,62 +886,62 @@ if (cat1==decl_head) { @<Flag the usage of this identifier, for the mini-index@>@; @z -@x +@x [10.203] l.3668 if (next_control!='|') err_print("! Missing '|' after C text"); @y if (next_control!='|') err_print(_("! Missing '|' after C text")); @z -@x +@x [10.204] l.3683 to \.{\\PB}. Although \.{cwebmac} ignores \.{\\PB}, other macro packages @y to \.{\\PB}. Although \.{ctwimac} ignores \.{\\PB}, other macro packages @z -@x +@x [10.205] l.3713 app(tok_flag+(int)(p-tok_start)); @y app(tok_flag+(int)(p-tok_start)); app(inserted); @z -@x +@x [11.211] l.3809 if (stack_ptr==stack_end) overflow("stack"); @y if (stack_ptr==stack_end) overflow(_("stack")); @z -@x +@x [11.224] l.4132 printf("%s","\n! Illegal control code in section name: <"); @y printf("%s",_("\n! Illegal control code in section name: <")); @z -@x +@x [11.225] l.4147 printf("%s","\n! C text in section name didn't end: <"); @y printf("%s",_("\n! C text in section name didn't end: <")); @z -@x +@x [11.225] l.4159 if (j>buffer+long_buf_size-3) overflow("buffer"); @y if (j>buffer+long_buf_size-3) overflow(_("buffer")); @z -@x +@x [11.226] l.4167 if (j>buffer+long_buf_size-4) overflow("buffer"); @y if (j>buffer+long_buf_size-4) overflow(_("buffer")); @z -@x +@x [12.227] l.4182 if (show_progress) printf("%s","\nWriting the output file..."); @y if (show_progress) printf("%s",_("\nWriting the output file...")); @z -@x +@x [12.227] l.4184 section_count=0; format_visible=true; copy_limbo(); @y temp_switch=false; temp_meaning_ptr=temp_meaning_stack; @@ -949,7 +949,7 @@ temp_switch=false; temp_meaning_ptr=temp_meaning_stack; section_count=0; format_visible=true; right_start_switch=false; copy_limbo(); @z -@x +@x [12.229] l.4213 static boolean group_found=false; /* has a starred section occurred? */ @ @<Translate the current section@>= { @@ -966,12 +966,12 @@ static boolean temp_switch; /* has `\.{@@\%}' occurred recently? */ top_usage=usage_sentinel; @z -@x +@x [12.231] l.4231 If the section has changed, we put \.{\\*} just after the section number. @y @z -@x +@x [12.231] l.4234 if (*(loc-1)!='*') out_str("\\M"); @y if (*(loc-1)!='*') { @@ -983,7 +983,7 @@ if (*(loc-1)!='*') { } @z -@x +@x [12.231] l.4249 @.\\N@> @y @.\\N@> @@ -993,14 +993,14 @@ if (*(loc-1)!='*') { } @z -@x +@x [12.231] l.4256 out('{'); out_section(section_count); out('}'); @y out('{'); out_section(section_count); out('}'); flush_buffer(out_ptr,false,false); @z -@x +@x [12.232] l.4264 case '@@': out('@@'); break; @y case '@@': out('@@'); break; @@ -1008,26 +1008,26 @@ flush_buffer(out_ptr,false,false); case right_start: right_start_switch=true; break; @z -@x +@x [12.232] l.4267 case section_name: loc-=2; next_control=get_next(); /* skip to \.{@@>} */ @y case meaning: case suppress: case section_name: loc-=2; next_control=get_next(); /* reprocess */ @z -@x +@x [12.232] l.4269 err_print("! TeX string should be in C text only"); break; @y err_print(_("! TeX string should be in C text only")); break; @z -@x +@x [12.232] l.4275 err_print("! You can't do that in TeX text"); break; @y err_print(_("! You can't do that in TeX text")); break; @z -@x +@x [12.233] l.4289 outer_parse(); finish_C(format_visible); format_visible=true; doing_format=false; } @@ -1039,20 +1039,20 @@ flush_buffer(out_ptr,false,false); } @z -@x +@x [12.236] l.4341 @<Start a macro...@>= { @y @<Start a macro...@>= { is_macro=true; @z -@x +@x [12.236] l.4347 err_print("! Improper macro definition"); @y err_print(_("! Improper macro definition")); @z -@x +@x [12.236] l.4348 @.Improper macro definition@> else { app('$'); app_cur_id(false); @@ -1064,7 +1064,7 @@ flush_buffer(out_ptr,false,false); def_diff=(*loc!='('); @z -@x +@x [12.236] l.4360 } @=/* otherwise fall through */@>@; default: err_print("! Improper macro definition"); break; @y @@ -1072,7 +1072,7 @@ flush_buffer(out_ptr,false,false); default: err_print(_("! Improper macro definition")); break; @z -@x +@x [12.236] l.4370 @ @<Start a format...@>= { doing_format=true; @y @@ -1082,25 +1082,25 @@ flush_buffer(out_ptr,false,false); is_macro=false; @z -@x +@x [12.237] l.4387 if (scrap_ptr!=scrap_info+2) err_print("! Improper format definition"); @y if (scrap_ptr!=scrap_info+2) err_print(_("! Improper format definition")); @z -@x +@x [12.240] l.4422 err_print("! You need an = sign after the section name"); @y err_print(_("! You need an = sign after the section name")); @z -@x +@x [12.241] l.4444 err_print("! You can't do that in C text"); @y err_print(_("! You can't do that in C text")); @z -@x +@x [12.246] l.4514 out_str("\\fi"); finish_line(); @.\\fi@> @y @@ -1111,13 +1111,13 @@ out_str("}\\FI"); finish_line(); @.\\FI@> @z -@x +@x [13.247] l.4535 if (show_progress) printf("%s","\nWriting the index..."); @y if (show_progress) printf("%s",_("\nWriting the index...")); @z -@x +@x [13.247] l.4537 if (change_exists) { @<Tell about changed sections@>@; finish_line(); flush_buffer(out_buf,false,false); @@ -1126,32 +1126,32 @@ out_str("}\\FI"); finish_line(); @y @z -@x +@x [13.247] l.4546 fatal("! Cannot open index file ",idx_file_name); @y fatal(_("! Cannot open index file "),idx_file_name); @z -@x +@x [13.247] l.4558 fatal("! Cannot open section file ",scn_file_name); @y fatal(_("! Cannot open section file "),scn_file_name); @z -@x +@x [13.247] l.4570 fclose(active_file); @y fclose(active_file); active_file=tex_file=NULL; if (check_for_change) @<Update the result when it has changed@>@; @z -@x +@x [13.247] l.4573 printf("%s","Done."); @y printf("%s",_("Done.")); @z -@x +@x [13.249] l.4581 the index section itself. @<Tell about changed sections@>= @@ -1170,13 +1170,13 @@ out('.'); the index section itself---NOT! @z -@x +@x [13.257] l.4725 if (sort_ptr>=scrap_info_end) overflow("sorting"); @y if (sort_ptr>=scrap_info_end) overflow(_("sorting")); @z -@x +@x [13.262] l.4770 @ @<Output the name...@>= switch (cur_name->ilk) {@+char *p; /* index into |byte_mem| */@+@t}\6{\4@> @y @@ -1187,20 +1187,20 @@ rest of the job. Compare this code with section |@<Mini-output...@>|. switch (cur_name->ilk) { @z -@x +@x [13.262] l.4772 case normal: case func_template: @y case normal: @z -@x +@x [13.262] l.4774 else {@+boolean all_caps=true;@+@t}\6{@> @y else {@+boolean all_caps=true;@+char *p; /* index into |byte_mem| */ @+@t}\6{@> @z -@x +@x [13.262] l.4789 case roman: not_an_identifier: out_name(cur_name,false); goto name_done; case custom: out_str("$\\"); @@ -1215,13 +1215,13 @@ not_an_identifier: out_name(cur_name,false); goto name_done; @.\\\$@> @z -@x +@x [13.262] l.4799 out_name(cur_name,true); @y out_name(cur_name,proofing); @z -@x +@x [13.269] l.4862 puts("\nMemory usage statistics:"); @.Memory usage statistics:@> printf("%td names (out of %ld)\n",@^system dependencies@> @@ -1270,7 +1270,7 @@ out_name(cur_name,proofing); (ptrdiff_t)(max_sort_ptr-scrap_info),(long)max_scraps); @z -@x +@x [13.269] l.4884 @** Index. @y @q Section 270. @> diff --git a/Build/source/texk/web2c/cwebdir/cweav-w2c.ch b/Build/source/texk/web2c/cwebdir/cweav-w2c.ch index 9ddc3f00f79..83e6aaaa104 100644 --- a/Build/source/texk/web2c/cwebdir/cweav-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/cweav-w2c.ch @@ -16,62 +16,62 @@ @q Please send comments, suggestions, etc. to tex-k@@tug.org. @> -@x +@x [0.0] l.35 \def\title{CWEAVE (Version 4.11)} @y \def\title{CWEAVE (Version 4.11 [\TeX~Live])} @z -@x +@x [0.0] l.39 \centerline{(Version 4.11)} @y \centerline{(Version 4.11 [\TeX~Live])} @z -@x +@x [0.0] l.41 \def\botofcontents{\vfill @y \def\covernote{\vbox{% @z -@x +@x [0.0] l.54 } @y }}\datecontentspage @z -@x +@x [1.1] l.70 @d banner "This is CWEAVE (Version 4.11)" @y @d banner "This is CWEAVE, Version 4.11" /* will be extended by the \TeX~Live |versionstring| */ @z -@x +@x [1.2] l.98 if (show_banner) puts(banner); /* print a ``banner line'' */ @y if (show_banner) cb_show_banner(); /* print a ``banner line'' */ @z -@x +@x [1.3] l.112 @i common.h @y @i comm-w2c.h @z -@x +@x [2.23] l.217 @ @d max_refs 30000 /* number of cross-references; must be less than 65536 */ @y @ @d max_refs 65535 /* number of cross-references; must be less than 65536 */ @z -@x +@x [2.25] l.246 @d append_xref(c) if (xref_ptr==xmem_end) overflow("cross-reference"); @y @d append_xref(c) if (xref_ptr==xmem_end) overflow(_("cross-reference")); @z -@x +@x [2.30] l.337 @d max_toks 30000 /* number of symbols in \CEE/ texts being parsed; must be less than 65536 */ @d max_texts 8000 /* number of phrases in \CEE/ texts being parsed; @@ -83,97 +83,97 @@ must be less than 10240 */ @z -@x +@x [4.57] l.888 err_print("! String didn't end"); loc=limit; break; @y err_print(_("! String didn't end")); loc=limit; break; @z -@x +@x [4.57] l.892 err_print("! Input ended in middle of string"); loc=buffer; break; @y err_print(_("! Input ended in middle of string")); loc=buffer; break; @z -@x +@x [4.57] l.911 printf("%s","\n! String too long: "); @y printf("%s",_("\n! String too long: ")); @z -@x +@x [4.59] l.930 case translit_code: err_print("! Use @@l in limbo only"); continue; @y case translit_code: err_print(_("! Use @@l in limbo only")); continue; @z -@x +@x [4.62] l.968 err_print("! Input ended in section name"); @y err_print(_("! Input ended in section name")); @z -@x +@x [4.62] l.981 printf("%s","\n! Section name too long: "); @y printf("%s",_("\n! Section name too long: ")); @z -@x +@x [4.63] l.995 err_print("! Section name didn't end"); break; @y err_print(_("! Section name didn't end")); break; @z -@x +@x [4.63] l.999 err_print("! Control codes are forbidden in section name"); break; @y err_print(_("! Control codes are forbidden in section name")); break; @z -@x +@x [4.64] l.1016 err_print("! Control text didn't end"); loc=limit; @y err_print(_("! Control text didn't end")); loc=limit; @z -@x +@x [4.64] l.1021 err_print("! Control codes are forbidden in control text"); @y err_print(_("! Control codes are forbidden in control text")); @z -@x +@x [4.66] l.1036 if (loc>=limit) err_print("! Verbatim string didn't end"); @y if (loc>=limit) err_print(_("! Verbatim string didn't end")); @z -@x +@x [5.70] l.1073 if (++section_count==max_sections) overflow("section number"); @y if (++section_count==max_sections) overflow(_("section number")); @z -@x +@x [5.74] l.1162 case translit_code: err_print("! Use @@l in limbo only"); continue; @y case translit_code: err_print(_("! Use @@l in limbo only")); continue; @z -@x +@x [5.79] l.1249 err_print("! Missing left identifier of @@s"); @y err_print(_("! Missing left identifier of @@s")); @z -@x +@x [5.79] l.1254 err_print("! Missing right identifier of @@s"); @y err_print(_("! Missing right identifier of @@s")); @z -@x +@x [5.82] l.1302 printf("%s","\n! Never defined: <"); print_section_name(p); putchar('>'); mark_harmless(); @y @@ -181,7 +181,7 @@ if (loc>=limit) err_print(_("! Verbatim string didn't end")); print_section_name(p); putchar('>'); mark_harmless(); @z -@x +@x [5.82] l.1308 printf("%s","\n! Never used: <"); print_section_name(p); putchar('>'); mark_harmless(); @y @@ -189,7 +189,7 @@ if (loc>=limit) err_print(_("! Verbatim string didn't end")); print_section_name(p); putchar('>'); mark_harmless(); @z -@x +@x [6.89] l.1397 @ In particular, the |finish_line| procedure is called near the very beginning of phase two. We initialize the output variables in a slightly tricky way so that the first line of the output file will be @@ -218,61 +218,61 @@ tex_puts("cwebma"); *out_ptr='c'; @z -@x +@x [6.94] l.1462 printf("\n! Line had to be broken (output l. %d):\n",out_line); @y printf(_("\n! Line had to be broken (output l. %d):\n"),out_line); @z -@x +@x [7.99] l.1543 default: err_print("! Double @@ should be used in limbo"); @y default: err_print(_("! Double @@ should be used in limbo")); @z -@x +@x [7.101] l.1585 @d app_tok(c) {if (tok_ptr+2>tok_mem_end) overflow("token"); *(tok_ptr++)=c;} @y @d app_tok(c) {if (tok_ptr+2>tok_mem_end) overflow(_("token")); *(tok_ptr++)=c;} @z -@x +@x [7.101] l.1597 err_print("! Input ended in mid-comment"); @y err_print(_("! Input ended in mid-comment")); @z -@x +@x [7.101] l.1602 if (bal>1) err_print("! Missing } in comment"); @y if (bal>1) err_print(_("! Missing } in comment")); @z -@x +@x [7.101] l.1618 else {err_print("! Extra } in comment"); @y else {err_print(_("! Extra } in comment")); @z -@x +@x [7.102] l.1630 if (bal>1) err_print("! Missing } in comment"); @y if (bal>1) err_print(_("! Missing } in comment")); @z -@x +@x [7.103] l.1638 err_print("! Illegal use of @@ in comment"); @y err_print(_("! Illegal use of @@ in comment")); @z -@x +@x [8.110] l.2129 @i prod.w @y @i prod-cweave.w @z -@x +@x [9.128] l.2651 @<Cases for |exp|@>= if (cat1==lbrace || cat1==int_like || cat1==decl) { make_underlined(pp); big_app(dindent); big_app1(pp); @@ -286,7 +286,7 @@ if(cat1==lbrace || cat1==int_like || cat1==decl) { } @z -@x +@x [9.138] l.2755 @ @<Cases for |decl_head|@>= if (cat1==comma) { big_app2(pp); app(opt); app('9'); reduce(pp,2,decl_head,-1,33); @@ -328,7 +328,7 @@ else if (cat1==int_like || cat1==lbrace || cat1==decl) { else if (cat1==semi) squash(pp,2,decl,-1,39); @z -@x +@x [9.139] l.2777 @ @<Cases for |decl|@>= if (cat1==decl) { big_app1_insert(pp,force); reduce(pp,2,decl,-1,40); @@ -347,7 +347,7 @@ else if (cat1==stmt || cat1==function) { } @z -@x +@x [9.143] l.2834 @ @<Cases for |fn_decl|@>= if (cat1==decl) { big_app1_insert(pp,force); reduce(pp,2,fn_decl,0,51); @@ -370,14 +370,14 @@ else if (cat1==stmt) { } @z -@x +@x [9.153] l.2938 big_app1_insert(pp,dindent); reduce(pp,2,fn_decl,0,73); @y big_app1(pp); if (indent_param_decl) big_app(dindent); big_app1(pp+1); reduce(pp,2,fn_decl,0,73); @z -@x +@x [9.156] l.2964 big_app1_insert(pp, (cat1==decl || cat1==function) ? big_force : force_lines ? force : break_space); reduce(pp,2,cat1,-1,76); @y @@ -386,109 +386,109 @@ else if (cat1==stmt) { ( force_lines ? force : break_space ) ); reduce(pp,2,cat1,-1,76); @z -@x +@x [9.186] l.3293 overflow("token"); @y overflow(_("token")); @z -@x +@x [9.186] l.3297 overflow("text"); @y overflow(_("text")); @z -@x +@x [9.190] l.3352 if (tok_ptr+6>tok_mem_end) overflow("token"); @y if (tok_ptr+6>tok_mem_end) overflow(_("token")); @z -@x +@x [9.191] l.3358 printf("\nIrreducible scrap sequence in section %d:",(int)section_count); @y printf(_("\nIrreducible scrap sequence in section %d:"),(int)section_count); @z -@x +@x [9.192] l.3368 printf("\nTracing after l. %d:\n",cur_line); mark_harmless(); @y printf(_("\nTracing after l. %d:\n"),cur_line); mark_harmless(); @z -@x +@x [10.197] l.3500 overflow("scrap/token/text"); @y overflow(_("scrap/token/text")); @z -@x +@x [10.199] l.3585 else err_print("! Double @@ should be used in strings"); @y else err_print(_("! Double @@ should be used in strings")); @z -@x +@x [10.203] l.3668 if (next_control!='|') err_print("! Missing '|' after C text"); @y if (next_control!='|') err_print(_("! Missing '|' after C text")); @z -@x +@x [11.211] l.3809 if (stack_ptr==stack_end) overflow("stack"); @y if (stack_ptr==stack_end) overflow(_("stack")); @z -@x +@x [11.224] l.4132 printf("%s","\n! Illegal control code in section name: <"); @y printf("%s",_("\n! Illegal control code in section name: <")); @z -@x +@x [11.225] l.4147 printf("%s","\n! C text in section name didn't end: <"); @y printf("%s",_("\n! C text in section name didn't end: <")); @z -@x +@x [11.225] l.4159 if (j>buffer+long_buf_size-3) overflow("buffer"); @y if (j>buffer+long_buf_size-3) overflow(_("buffer")); @z -@x +@x [11.226] l.4167 if (j>buffer+long_buf_size-4) overflow("buffer"); @y if (j>buffer+long_buf_size-4) overflow(_("buffer")); @z -@x +@x [12.227] l.4182 if (show_progress) printf("%s","\nWriting the output file..."); @y if (show_progress) printf("%s",_("\nWriting the output file...")); @z -@x +@x [12.232] l.4269 err_print("! TeX string should be in C text only"); break; @y err_print(_("! TeX string should be in C text only")); break; @z -@x +@x [12.232] l.4275 err_print("! You can't do that in TeX text"); break; @y err_print(_("! You can't do that in TeX text")); break; @z -@x +@x [12.236] l.4347 err_print("! Improper macro definition"); @y err_print(_("! Improper macro definition")); @z -@x +@x [12.236] l.4360 } @=/* otherwise fall through */@>@; default: err_print("! Improper macro definition"); break; @y @@ -496,62 +496,62 @@ if (show_progress) printf("%s",_("\nWriting the output file...")); default: err_print(_("! Improper macro definition")); break; @z -@x +@x [12.237] l.4387 if (scrap_ptr!=scrap_info+2) err_print("! Improper format definition"); @y if (scrap_ptr!=scrap_info+2) err_print(_("! Improper format definition")); @z -@x +@x [12.240] l.4422 err_print("! You need an = sign after the section name"); @y err_print(_("! You need an = sign after the section name")); @z -@x +@x [12.241] l.4444 err_print("! You can't do that in C text"); @y err_print(_("! You can't do that in C text")); @z -@x +@x [13.247] l.4535 if (show_progress) printf("%s","\nWriting the index..."); @y if (show_progress) printf("%s",_("\nWriting the index...")); @z -@x +@x [13.247] l.4546 fatal("! Cannot open index file ",idx_file_name); @y fatal(_("! Cannot open index file "),idx_file_name); @z -@x +@x [13.247] l.4558 fatal("! Cannot open section file ",scn_file_name); @y fatal(_("! Cannot open section file "),scn_file_name); @z -@x +@x [13.247] l.4570 fclose(active_file); @y fclose(active_file); active_file=tex_file=NULL; if (check_for_change) @<Update the result when it has changed@>@; @z -@x +@x [13.247] l.4573 printf("%s","Done."); @y printf("%s",_("Done.")); @z -@x +@x [13.257] l.4725 if (sort_ptr>=scrap_info_end) overflow("sorting"); @y if (sort_ptr>=scrap_info_end) overflow(_("sorting")); @z -@x +@x [13.269] l.4862 puts("\nMemory usage statistics:"); @.Memory usage statistics:@> printf("%td names (out of %ld)\n",@^system dependencies@> @@ -595,7 +595,7 @@ if (check_for_change) @<Update the result when it has changed@>@; (ptrdiff_t)(max_sort_ptr-scrap_info),(long)max_scraps); @z -@x +@x [14.270] l.4884 @** Index. @y @** Extensions to {\tentex CWEB}. The following sections introduce new or diff --git a/Build/source/texk/web2c/tests/fix-changefile-lines.py b/Build/source/texk/web2c/tests/fix-changefile-lines.py index 898a1ed89a2..73c497bccff 100755 --- a/Build/source/texk/web2c/tests/fix-changefile-lines.py +++ b/Build/source/texk/web2c/tests/fix-changefile-lines.py @@ -19,31 +19,15 @@ def main(): sys.exit(1) # Read WEB file - try: - web_file = open(sys.argv[1], "r") - except OSError: - eprint(f"Could not open {sys.argv[1]}") - print(USAGE) - sys.exit(1) - with web_file: - web_lines = [line.rstrip() for line in web_file] - web_reader = WebReader(web_lines) + web_reader = WebReader(sys.argv[1]) # Read change file - try: - ch_file = open(sys.argv[2], "r") - except OSError: - eprint(f"Could not open {sys.argv[2]}") - print(USAGE) - sys.exit(1) - with ch_file: - ch_lines = [line.rstrip() for line in ch_file] + ch_reader = ChangeReader(sys.argv[2]) - ch_reader = ChangeReader(ch_lines) + # Run through the two files in parallel ch_reader.traverse(web_reader) - updated_ch_lines = ch_reader.get_lines() - for line in updated_ch_lines: + for line in ch_reader.get_lines(): print(line) @@ -52,11 +36,18 @@ class WebReader: of the current part and section number. """ - def __init__(self, web_lines): - self._web_lines = web_lines + def __init__(self, web_file): self._pos = 0 self.part_cnt = 0 self.section_cnt = 0 + try: + self._web_file = open(web_file, "r") + except OSError: + eprint(f"Could not open {web_file}") + print(USAGE) + sys.exit(1) + with self._web_file: + self._web_lines = [line.rstrip() for line in self._web_file] def next_line(self): """Returns the triple of current part, section and line numbers, as @@ -71,13 +62,26 @@ class WebReader: section = self.section_cnt line_number = self._pos - if re.search("^@\*", line): + # Look for starred section == part + if line.startswith("@*"): self.part_cnt += 1 self.section_cnt += 1 - if re.search("^@ ", line) or line == "@": + # Look for unstarred section + if line.startswith("@ ") or line == "@": self.section_cnt += 1 + # Look for '@i'nclude line + result = re.match("^@i \"?(\\w+\\.?\\w+)\"?", line) + if result: + include_file = result[1] + inc_reader = WebReader(include_file) + while inc_line := inc_reader.next_line(): + pass + self.part_cnt += inc_reader.part_cnt + self.section_cnt += inc_reader.section_cnt + # Ignore line count in include file; we're only one step beyond + return (part, section, line_number), line @@ -86,14 +90,24 @@ class ChangeReader: information from the corresponding WEB file. """ - def __init__(self, ch_lines): - self._lines = ch_lines + def __init__(self, change_file): self._pos = 0 self._chunk_start = None self._match_lines = None + try: + self._change_file = open(change_file, "r") + except OSError: + eprint(f"Could not open {change_file}") + print(USAGE) + sys.exit(1) + with self._change_file: + self._lines = [line.rstrip() for line in self._change_file] def advance_to_next_chunk(self): - """Find the next change chunk. Store where it starts and the lines to be matched.""" + """Find the next change chunk. Store where it starts and + the lines to be matched. + """ + while self._pos < len(self._lines): line = self._lines[self._pos] if line.startswith("@x"): |