From 7908c999333330cd64e5632107f879070c9f3b68 Mon Sep 17 00:00:00 2001 From: Andreas Scherer Date: Wed, 20 Sep 2023 10:24:51 +0000 Subject: [CWEB] Factor out cwebacromac.tex. Extract common macros from cwebmac.tex and the PDF variants of the CTWILL macros. Update cwebman.tex accordingly. Fixes in CWEB code: - Consistent formatting of terminal output in cases of error - Revert fputs back to printf - Add curly braces for progress report (harmless glitch in CWEB 2.0) git-svn-id: svn://tug.org/texlive/trunk@68327 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/ctangleboot.cin | 10 +- Build/source/texk/web2c/cwebboot.cin | 50 ++++--- Build/source/texk/web2c/cwebdir/Makefile | 12 +- Build/source/texk/web2c/cwebdir/README | 1 + Build/source/texk/web2c/cwebdir/comm-ql.ch | 12 +- Build/source/texk/web2c/cwebdir/comm-w2c.ch | 24 +-- Build/source/texk/web2c/cwebdir/comm-w2c.h | 2 +- Build/source/texk/web2c/cwebdir/common.c | 44 +++--- Build/source/texk/web2c/cwebdir/common.h | 2 +- Build/source/texk/web2c/cwebdir/common.w | 24 +-- Build/source/texk/web2c/cwebdir/ctang-w2c.ch | 20 +-- Build/source/texk/web2c/cwebdir/ctangle.c | 10 +- Build/source/texk/web2c/cwebdir/ctangle.w | 10 +- Build/source/texk/web2c/cwebdir/ctwill-proofsort | 3 +- Build/source/texk/web2c/cwebdir/ctwill-w2c.ch | 36 ++--- Build/source/texk/web2c/cwebdir/cweav-w2c.ch | 36 ++--- Build/source/texk/web2c/cwebdir/cweave.w | 26 ++-- Build/source/texk/web2c/cwebdir/cweb.1 | 4 +- Build/source/texk/web2c/cwebdir/cwebmac.tex | 155 +------------------- Build/source/texk/web2c/cwebdir/cwebman-w2c.ch | 10 +- Build/source/texk/web2c/cwebdir/cwebman.tex | 28 ++-- .../texk/web2c/cwebdir/texinputs/pdfctproofmac.tex | 161 +-------------------- .../texk/web2c/cwebdir/texinputs/pdfctwimac.tex | 152 +------------------ 23 files changed, 207 insertions(+), 625 deletions(-) diff --git a/Build/source/texk/web2c/ctangleboot.cin b/Build/source/texk/web2c/ctangleboot.cin index bb015ef2598..58b9bdf5a14 100644 --- a/Build/source/texk/web2c/ctangleboot.cin +++ b/Build/source/texk/web2c/ctangleboot.cin @@ -665,7 +665,7 @@ a-= 024000; if((a+name_dir)->equiv!=(void*)text_info)push_level(a+name_dir); else if(a!=0){ #line 85 "cwebdir/ctang-w2c.ch" -fputs(_("\n! Not present: <"),stdout); +printf("%s",_("\n! Not present: <")); #line 405 "cwebdir/ctangle.w" print_section_name(a+name_dir);err_print(">"); @@ -727,7 +727,7 @@ output_defs(); if(text_info->text_link==macro&&cur_out_file==end_output_files){ #line 97 "cwebdir/ctang-w2c.ch" -fputs(_("\n! No program text was specified."),stdout);mark_harmless(); +printf("%s",_("\n! No program text was specified."));mark_harmless(); #line 519 "cwebdir/ctangle.w" } @@ -1007,7 +1007,7 @@ strcpy(check_file_name,""); if(show_happiness){ if(show_progress)new_line(); #line 111 "cwebdir/ctang-w2c.ch" -fputs(_("Done."),stdout); +printf("%s",_("Done.")); #line 537 "cwebdir/ctangle.w" } } @@ -1343,7 +1343,7 @@ if(++id_loc<=section_text_end)*id_loc= (char)c; } if(id_loc>=section_text_end){ #line 247 "cwebdir/ctang-w2c.ch" -fputs(_("\n! String too long: "),stdout); +printf("%s",_("\n! String too long: ")); #line 1022 "cwebdir/ctangle.w" term_write(section_text+1,25); @@ -1440,7 +1440,7 @@ c= (eight_bits)' ';if(*(k-1)==' ')k--; } if(k>=section_text_end){ #line 283 "cwebdir/ctang-w2c.ch" -fputs(_("\n! Section name too long: "),stdout); +printf("%s",_("\n! Section name too long: ")); #line 1117 "cwebdir/ctangle.w" term_write(section_text+1,25); diff --git a/Build/source/texk/web2c/cwebboot.cin b/Build/source/texk/web2c/cwebboot.cin index 069e867d7c6..cddf82e87bd 100644 --- a/Build/source/texk/web2c/cwebboot.cin +++ b/Build/source/texk/web2c/cwebboot.cin @@ -389,7 +389,7 @@ char check_file_name[max_file_name_length]; boolean flags[128]; /*:73*//*83:*/ -#line 1266 "cwebdir/common.w" +#line 1268 "cwebdir/common.w" FILE*C_file; FILE*tex_file; @@ -398,7 +398,7 @@ FILE*scn_file; #line 582 "cwebdir/comm-w2c.ch" FILE*active_file; FILE*check_file; -#line 1272 "cwebdir/common.w" +#line 1274 "cwebdir/common.w" #line 599 "cwebdir/comm-w2c.ch" /*:83*//*86:*/ @@ -612,7 +612,7 @@ fatal(_("! Cannot open output file "),check_file_name); else if((tex_file= fopen(tex_file_name,"wb"))==NULL) fatal(_("! Cannot open output file "),tex_file_name); } -#line 1284 "cwebdir/common.w" +#line 1286 "cwebdir/common.w" #line 617 "cwebdir/comm-w2c.ch" /*:84*/ @@ -1190,12 +1190,12 @@ p= (c==less?p->llink:p->rlink); }else{ if(r!=NULL){ #line 333 "cwebdir/comm-w2c.ch" -fputs(_("\n! Ambiguous prefix: matches <"),stdout); +printf("%s",_("\n! Ambiguous prefix: matches <")); #line 887 "cwebdir/common.w" print_prefix_name(p); #line 339 "cwebdir/comm-w2c.ch" -fputs(_(">\n and <"),stdout); +printf("%s",_(">\n and <")); #line 890 "cwebdir/common.w" print_prefix_name(r); err_print(">"); @@ -1229,7 +1229,7 @@ switch(section_name_cmp(&first,name_len,r)){ case prefix: if(!ispref){ #line 345 "cwebdir/comm-w2c.ch" -fputs(_("\n! New name is a prefix of <"),stdout); +printf("%s",_("\n! New name is a prefix of <")); #line 916 "cwebdir/common.w" print_section_name(r); @@ -1243,7 +1243,7 @@ extend_section_name(r,first,last+1,ispref); break; case bad_extension: #line 351 "cwebdir/comm-w2c.ch" -fputs(_("\n! New name extends <"),stdout); +printf("%s",_("\n! New name extends <")); #line 928 "cwebdir/common.w" print_section_name(r); @@ -1251,12 +1251,12 @@ err_print(">"); break; default: #line 357 "cwebdir/comm-w2c.ch" -fputs(_("\n! Section name incompatible with <"),stdout); +printf("%s",_("\n! Section name incompatible with <")); #line 934 "cwebdir/common.w" print_prefix_name(r); #line 363 "cwebdir/comm-w2c.ch" -fputs(_(">,\n which abbreviates <"),stdout); +printf("%s",_(">,\n which abbreviates <")); #line 937 "cwebdir/common.w" print_section_name(r); err_print(">"); @@ -1309,7 +1309,7 @@ void err_print( const char*s) { -*s=='!'?printf("\n%s",s):printf("%s",s); +printf(*s=='!'?"\n%s":"%s",s); if(web_file_open)/*67:*/ #line 1031 "cwebdir/common.w" @@ -1343,7 +1343,7 @@ update_terminal();mark_error(); #line 1064 "cwebdir/common.w" int wrap_up(void){ -if(show_progress)new_line(); +if(show_progress||show_happiness||history!=spotless)new_line(); if(show_stats) print_stats(); #line 401 "cwebdir/comm-w2c.ch" @@ -1394,7 +1394,7 @@ void fatal( const char*s,const char*t) { -if(*s)err_print(s); +if(*s)printf("%s",s); err_print(t); history= fatal_message;exit(wrap_up()); } @@ -1438,7 +1438,7 @@ change_file_name[max_file_name_length-2]= '\0'; #line 1167 "cwebdir/common.w" while(--argc> 0){ if((**(++argv)=='-'||**argv=='+')&&*(*argv+1))/*80:*/ -#line 1244 "cwebdir/common.w" +#line 1246 "cwebdir/common.w" #line 525 "cwebdir/comm-w2c.ch" { @@ -1483,7 +1483,7 @@ if(sscanf(++dot_pos,"%u",&kpathsea_debug)!=1)/*81:*/ cb_usage(program==ctangle?"ctangle":program==cweave?"cweave":"ctwill"); -#line 1259 "cwebdir/common.w" +#line 1261 "cwebdir/common.w" #line 576 "cwebdir/comm-w2c.ch" /*:81*/ @@ -1498,7 +1498,7 @@ default:flags[(eight_bits)*dot_pos]= flag_change;continue; break; } } -#line 1247 "cwebdir/common.w" +#line 1249 "cwebdir/common.w" #line 568 "cwebdir/comm-w2c.ch" /*:80*/ @@ -1522,7 +1522,7 @@ if(s-*argv> max_file_name_length-5) /*82:*/ #line 576 "cwebdir/comm-w2c.ch" fatal(_("! Filename too long\n"),*argv); -#line 1261 "cwebdir/common.w" +#line 1263 "cwebdir/common.w" /*:82*/ @@ -1536,8 +1536,10 @@ strcpy(web_file_name,*argv); } #line 1205 "cwebdir/common.w" sprintf(tex_file_name,"%s.tex",name_pos); +if(make_xrefs){ sprintf(idx_file_name,"%s.idx",name_pos); sprintf(scn_file_name,"%s.scn",name_pos); +} sprintf(C_file_name,"%s.c",name_pos); found_web= true; } @@ -1546,7 +1548,7 @@ found_web= true; #line 1176 "cwebdir/common.w" else if(!found_change)/*78:*/ -#line 1212 "cwebdir/common.w" +#line 1214 "cwebdir/common.w" { if(strcmp(*argv,"-")!=0){ @@ -1554,11 +1556,11 @@ if(s-*argv> max_file_name_length-4) /*82:*/ #line 576 "cwebdir/comm-w2c.ch" fatal(_("! Filename too long\n"),*argv); -#line 1261 "cwebdir/common.w" +#line 1263 "cwebdir/common.w" /*:82*/ -#line 1216 "cwebdir/common.w" +#line 1218 "cwebdir/common.w" if(dot_pos==NULL) sprintf(change_file_name,"%s.ch",*argv); @@ -1571,18 +1573,18 @@ found_change= true; #line 1177 "cwebdir/common.w" else if(!found_out)/*79:*/ -#line 1224 "cwebdir/common.w" +#line 1226 "cwebdir/common.w" { if(s-*argv> max_file_name_length-5) /*82:*/ #line 576 "cwebdir/comm-w2c.ch" fatal(_("! Filename too long\n"),*argv); -#line 1261 "cwebdir/common.w" +#line 1263 "cwebdir/common.w" /*:82*/ -#line 1227 "cwebdir/common.w" +#line 1229 "cwebdir/common.w" if(dot_pos==NULL){ sprintf(tex_file_name,"%s.tex",*argv); @@ -1607,7 +1609,7 @@ else/*81:*/ cb_usage(program==ctangle?"ctangle":program==cweave?"cweave":"ctwill"); -#line 1259 "cwebdir/common.w" +#line 1261 "cwebdir/common.w" #line 576 "cwebdir/comm-w2c.ch" /*:81*/ @@ -1620,7 +1622,7 @@ if(!found_web)/*81:*/ cb_usage(program==ctangle?"ctangle":program==cweave?"cweave":"ctwill"); -#line 1259 "cwebdir/common.w" +#line 1261 "cwebdir/common.w" #line 576 "cwebdir/comm-w2c.ch" /*:81*/ diff --git a/Build/source/texk/web2c/cwebdir/Makefile b/Build/source/texk/web2c/cwebdir/Makefile index c547ef91546..ed85fc70f28 100644 --- a/Build/source/texk/web2c/cwebdir/Makefile +++ b/Build/source/texk/web2c/cwebdir/Makefile @@ -77,13 +77,15 @@ CTANGLE = ./ctangle SOURCES = cweave.w common.w ctangle.w ALL = common.w ctangle.w cweave.w prod.w \ Makefile README common.c common.h ctangle.c \ - cwebman.tex cwebmac.tex comm-vms.ch ctang-vms.ch \ - cweav-vms.ch comm-man.ch ctang-man.ch cweav-man.ch \ - comm-pc.ch ctang-pc.ch cweav-pc.ch comm-amiga.ch \ + cwebman.tex cwebacromac.tex cwebmac.tex \ + cweb.1 cweb.el c++lib.w iso_types.w \ + comm-man.ch ctang-man.ch cweav-man.ch \ comm-bs.ch ctang-bs.ch cweav-bs.ch makefile.bs \ + comm-pc.ch ctang-pc.ch cweav-pc.ch comm-amiga.ch \ comm-ql.ch ctang-ql.ch cweav-ql.ch readme.ql \ + comm-vms.ch ctang-vms.ch cweav-vms.ch \ comm-w32.ch ctang-w32.ch cweav-w32.ch \ - comm-os2.ch comm-mac.ch cweb.1 cweb.el c++lib.w iso_types.w + comm-os2.ch comm-mac.ch .SUFFIXES: .dvi .tex .w .pdf @@ -178,6 +180,8 @@ install: all $(CP) cweb.1 $(MANDIR)/cweb.$(MANEXT) chmod 644 $(MANDIR)/cweb.$(MANEXT) - mkdir $(MACROSDIR) + $(CP) cwebacromac.tex $(MACROSDIR) + chmod 644 $(MACROSDIR)/cwebacromac.tex $(CP) cwebmac.tex $(MACROSDIR) chmod 644 $(MACROSDIR)/cwebmac.tex - mkdir $(EMACSDIR) diff --git a/Build/source/texk/web2c/cwebdir/README b/Build/source/texk/web2c/cwebdir/README index e2caca4133c..086f6af3083 100644 --- a/Build/source/texk/web2c/cwebdir/README +++ b/Build/source/texk/web2c/cwebdir/README @@ -59,6 +59,7 @@ cweave-w32.ch cweave.w cweb.1 cweb.el +cwebacromac.tex cwebmac.tex cwebman.tex examples/ diff --git a/Build/source/texk/web2c/cwebdir/comm-ql.ch b/Build/source/texk/web2c/cwebdir/comm-ql.ch index 592c7e04a14..7d6fb05d396 100644 --- a/Build/source/texk/web2c/cwebdir/comm-ql.ch +++ b/Build/source/texk/web2c/cwebdir/comm-ql.ch @@ -152,8 +152,10 @@ the routine as if it would work. } sprintf(alt_web_file_name,"%s.web",*argv); sprintf(tex_file_name,"%s.tex",name_pos); /* strip off directory name */ - sprintf(idx_file_name,"%s.idx",name_pos); - sprintf(scn_file_name,"%s.scn",name_pos); + if (make_xrefs) { /* indexes will be generated */ + sprintf(idx_file_name,"%s.idx",name_pos); + sprintf(scn_file_name,"%s.scn",name_pos); + } sprintf(C_file_name,"%s.c",name_pos); found_web=true; } @@ -170,8 +172,10 @@ the routine as if it would work. } sprintf(alt_web_file_name,"%s_web",*argv); sprintf(tex_file_name,"%s_tex",name_pos); /* strip off directory name */ - sprintf(idx_file_name,"%s_idx",name_pos); - sprintf(scn_file_name,"%s_scn",name_pos); + if (make_xrefs) { /* indexes will be generated */ + sprintf(idx_file_name,"%s_idx",name_pos); + sprintf(scn_file_name,"%s_scn",name_pos); + } sprintf(C_file_name,"%s_c",name_pos); found_web=true; } diff --git a/Build/source/texk/web2c/cwebdir/comm-w2c.ch b/Build/source/texk/web2c/cwebdir/comm-w2c.ch index 906003989f6..d37c02d23ce 100644 --- a/Build/source/texk/web2c/cwebdir/comm-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/comm-w2c.ch @@ -328,39 +328,39 @@ else if (strlen(found_filename) < max_file_name_length) { @z @x - fputs("\n! Ambiguous prefix: matches <",stdout); + printf("%s","\n! Ambiguous prefix: matches <"); @y - fputs(_("\n! Ambiguous prefix: matches <"),stdout); + printf("%s",_("\n! Ambiguous prefix: matches <")); @z @x - fputs(">\n and <",stdout); + printf("%s",">\n and <"); @y - fputs(_(">\n and <"),stdout); + printf("%s",_(">\n and <")); @z @x - fputs("\n! New name is a prefix of <",stdout); + printf("%s","\n! New name is a prefix of <"); @y - fputs(_("\n! New name is a prefix of <"),stdout); + printf("%s",_("\n! New name is a prefix of <")); @z @x - fputs("\n! New name extends <",stdout); + printf("%s","\n! New name extends <"); @y - fputs(_("\n! New name extends <"),stdout); + printf("%s",_("\n! New name extends <")); @z @x - fputs("\n! Section name incompatible with <",stdout); + printf("%s","\n! Section name incompatible with <"); @y - fputs(_("\n! Section name incompatible with <"),stdout); + printf("%s",_("\n! Section name incompatible with <")); @z @x - fputs(">,\n which abbreviates <",stdout); + printf("%s",">,\n which abbreviates <"); @y - fputs(_(">,\n which abbreviates <"),stdout); + printf("%s",_(">,\n which abbreviates <")); @z @x diff --git a/Build/source/texk/web2c/cwebdir/comm-w2c.h b/Build/source/texk/web2c/cwebdir/comm-w2c.h index 2a8eba15108..eb465ba7e04 100644 --- a/Build/source/texk/web2c/cwebdir/comm-w2c.h +++ b/Build/source/texk/web2c/cwebdir/comm-w2c.h @@ -41,7 +41,7 @@ extern int phase; /* which phase are we in? */ @ The procedure that gets everything rolling: @= -extern void common_init(void);@/ +extern void common_init(void); @ You may have noticed that almost all \.{"strings"} in the \.{CWEB} sources are placed in the context of the `|_|'~macro. This is just a shortcut for the diff --git a/Build/source/texk/web2c/cwebdir/common.c b/Build/source/texk/web2c/cwebdir/common.c index ccedc5e914d..f5970b5c195 100644 --- a/Build/source/texk/web2c/cwebdir/common.c +++ b/Build/source/texk/web2c/cwebdir/common.c @@ -323,7 +323,7 @@ char scn_file_name[max_file_name_length]; boolean flags[128]; /*:73*//*83:*/ -#line 1266 "common.w" +#line 1268 "common.w" FILE*C_file; FILE*tex_file; @@ -432,7 +432,7 @@ show_banner= show_happiness= show_progress= make_xrefs= true; #line 100 "common.w" /*84:*/ -#line 1273 "common.w" +#line 1275 "common.w" scan_args(); if(program==ctangle){ @@ -979,10 +979,10 @@ par= p; p= (c==less?p->llink:p->rlink); }else{ if(r!=NULL){ -fputs("\n! Ambiguous prefix: matches <",stdout); +printf("%s","\n! Ambiguous prefix: matches <"); print_prefix_name(p); -fputs(">\n and <",stdout); +printf("%s",">\n and <"); print_prefix_name(r); err_print(">"); return name_dir; @@ -1014,7 +1014,7 @@ switch(section_name_cmp(&first,name_len,r)){ case prefix: if(!ispref){ -fputs("\n! New name is a prefix of <",stdout); +printf("%s","\n! New name is a prefix of <"); print_section_name(r); err_print(">"); @@ -1026,16 +1026,16 @@ case extension:if(!ispref||first<=last) extend_section_name(r,first,last+1,ispref); break; case bad_extension: -fputs("\n! New name extends <",stdout); +printf("%s","\n! New name extends <"); print_section_name(r); err_print(">"); break; default: -fputs("\n! Section name incompatible with <",stdout); +printf("%s","\n! Section name incompatible with <"); print_prefix_name(r); -fputs(">,\n which abbreviates <",stdout); +printf("%s",">,\n which abbreviates <"); print_section_name(r); err_print(">"); } @@ -1087,7 +1087,7 @@ void err_print( const char*s) { -*s=='!'?printf("\n%s",s):printf("%s",s); +printf(*s=='!'?"\n%s":"%s",s); if(web_file_open)/*67:*/ #line 1031 "common.w" @@ -1119,7 +1119,7 @@ update_terminal();mark_error(); #line 1064 "common.w" int wrap_up(void){ -if(show_progress)new_line(); +if(show_progress||show_happiness||history!=spotless)new_line(); if(show_stats) print_stats(); /*69:*/ @@ -1149,7 +1149,7 @@ void fatal( const char*s,const char*t) { -if(*s)err_print(s); +if(*s)printf("%s",s); err_print(t); history= fatal_message;exit(wrap_up()); } @@ -1179,7 +1179,7 @@ boolean found_web= false,found_change= false,found_out= false; strcpy(change_file_name,"/dev/null"); while(--argc> 0){ if((**(++argv)=='-'||**argv=='+')&&*(*argv+1))/*80:*/ -#line 1244 "common.w" +#line 1246 "common.w" for(dot_pos= *argv+1;*dot_pos> '\0';dot_pos++) flags[(eight_bits)*dot_pos]= flag_change; @@ -1199,7 +1199,7 @@ if(!found_web)/*77:*/ { if(s-*argv> max_file_name_length-5) /*82:*/ -#line 1260 "common.w" +#line 1262 "common.w" fatal("! Filename too long\n",*argv); @@ -1214,8 +1214,10 @@ strcpy(web_file_name,*argv); } sprintf(alt_web_file_name,"%s.web",*argv); sprintf(tex_file_name,"%s.tex",name_pos); +if(make_xrefs){ sprintf(idx_file_name,"%s.idx",name_pos); sprintf(scn_file_name,"%s.scn",name_pos); +} sprintf(C_file_name,"%s.c",name_pos); found_web= true; } @@ -1224,18 +1226,18 @@ found_web= true; #line 1176 "common.w" else if(!found_change)/*78:*/ -#line 1212 "common.w" +#line 1214 "common.w" { if(strcmp(*argv,"-")!=0){ if(s-*argv> max_file_name_length-4) /*82:*/ -#line 1260 "common.w" +#line 1262 "common.w" fatal("! Filename too long\n",*argv); /*:82*/ -#line 1216 "common.w" +#line 1218 "common.w" if(dot_pos==NULL) sprintf(change_file_name,"%s.ch",*argv); @@ -1248,17 +1250,17 @@ found_change= true; #line 1177 "common.w" else if(!found_out)/*79:*/ -#line 1224 "common.w" +#line 1226 "common.w" { if(s-*argv> max_file_name_length-5) /*82:*/ -#line 1260 "common.w" +#line 1262 "common.w" fatal("! Filename too long\n",*argv); /*:82*/ -#line 1227 "common.w" +#line 1229 "common.w" if(dot_pos==NULL){ sprintf(tex_file_name,"%s.tex",*argv); @@ -1279,7 +1281,7 @@ found_out= true; #line 1178 "common.w" else/*81:*/ -#line 1248 "common.w" +#line 1250 "common.w" { if(program==ctangle) @@ -1298,7 +1300,7 @@ else fatal( } } if(!found_web)/*81:*/ -#line 1248 "common.w" +#line 1250 "common.w" { if(program==ctangle) diff --git a/Build/source/texk/web2c/cwebdir/common.h b/Build/source/texk/web2c/cwebdir/common.h index 41049659172..2cd3c7032d1 100644 --- a/Build/source/texk/web2c/cwebdir/common.h +++ b/Build/source/texk/web2c/cwebdir/common.h @@ -41,7 +41,7 @@ extern int phase; /* which phase are we in? */ @ The procedure that gets everything rolling: @= -extern void common_init(void);@/ +extern void common_init(void); @ Interface to the standard \CEE/ library: diff --git a/Build/source/texk/web2c/cwebdir/common.w b/Build/source/texk/web2c/cwebdir/common.w index dbcd57e31f7..4bbaaf21093 100644 --- a/Build/source/texk/web2c/cwebdir/common.w +++ b/Build/source/texk/web2c/cwebdir/common.w @@ -883,10 +883,10 @@ while (p) { /* compare shortest prefix of |p| with new name */ p=(c==less?p->llink:p->rlink); } else { /* new name matches |p| */ if (r!=NULL) { /* and also |r|: illegal */ - fputs("\n! Ambiguous prefix: matches <",stdout); + printf("%s","\n! Ambiguous prefix: matches <"); @.Ambiguous prefix ... @> print_prefix_name(p); - fputs(">\n and <",stdout); + printf("%s",">\n and <"); print_prefix_name(r); err_print(">"); return name_dir; /* the unsection */ @@ -912,7 +912,7 @@ switch(section_name_cmp(&first,name_len,r)) { /* compare all of |r| with new name */ case prefix: if (!ispref) { - fputs("\n! New name is a prefix of <",stdout); + printf("%s","\n! New name is a prefix of <"); @.New name is a prefix...@> print_section_name(r); err_print(">"); @@ -924,16 +924,16 @@ switch(section_name_cmp(&first,name_len,r)) { extend_section_name(r,first,last+1,ispref); break; case bad_extension: - fputs("\n! New name extends <",stdout); + printf("%s","\n! New name extends <"); @.New name extends...@> print_section_name(r); err_print(">"); break; default: /* no match: illegal */ - fputs("\n! Section name incompatible with <",stdout); + printf("%s","\n! Section name incompatible with <"); @.Section name incompatible...@> print_prefix_name(r); - fputs(">,\n which abbreviates <",stdout); + printf("%s",">,\n which abbreviates <"); print_section_name(r); err_print(">"); } @@ -1014,7 +1014,7 @@ void err_print( /* prints `\..' and location of error message */ const char *s) { - *s=='!'? printf("\n%s",s) : printf("%s",s); + printf(*s=='!' ? "\n%s" : "%s",s); if (web_file_open) @@; update_terminal(); mark_error(); } @@ -1063,7 +1063,7 @@ a status of |EXIT_SUCCESS| if and only if only harmless messages were printed. @c int wrap_up(void) { - if (show_progress) new_line(); + if (show_progress || show_happiness || history != spotless) new_line(); if (show_stats) print_stats(); /* print statistics about memory usage */ @@; @@ -1093,7 +1093,7 @@ concatenated to print the final error message. fatal( const char *s,const char *t) { - if (*s) err_print(s); + if (*s) printf("%s",s); err_print(t); history=fatal_message; exit(wrap_up()); } @@ -1203,8 +1203,10 @@ after the dot. We must check that there is enough room in } sprintf(alt_web_file_name,"%s.web",*argv); sprintf(tex_file_name,"%s.tex",name_pos); /* strip off directory name */ - sprintf(idx_file_name,"%s.idx",name_pos); - sprintf(scn_file_name,"%s.scn",name_pos); + if (make_xrefs) { /* indexes will be generated */ + sprintf(idx_file_name,"%s.idx",name_pos); + sprintf(scn_file_name,"%s.scn",name_pos); + } sprintf(C_file_name,"%s.c",name_pos); found_web=true; } diff --git a/Build/source/texk/web2c/cwebdir/ctang-w2c.ch b/Build/source/texk/web2c/cwebdir/ctang-w2c.ch index 3cc109ccc59..674f5755c79 100644 --- a/Build/source/texk/web2c/cwebdir/ctang-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/ctang-w2c.ch @@ -80,9 +80,9 @@ @z @x - fputs("\n! Not present: <",stdout); + printf("%s","\n! Not present: <"); @y - fputs(_("\n! Not present: <"),stdout); + printf("%s",_("\n! Not present: <")); @z @x @@ -92,9 +92,9 @@ @z @x - fputs("\n! No program text was specified.",stdout); mark_harmless(); + printf("%s","\n! No program text was specified."); mark_harmless(); @y - fputs(_("\n! No program text was specified."),stdout); mark_harmless(); + printf("%s",_("\n! No program text was specified.")); mark_harmless(); @z @x @@ -106,9 +106,9 @@ @z @x - fputs("Done.",stdout); + printf("%s","Done."); @y - fputs(_("Done."),stdout); + printf("%s",_("Done.")); @z @x @@ -242,9 +242,9 @@ quarter) with its two-byte encoding \.{c2 bc}. @z @x - fputs("\n! String too long: ",stdout); + printf("%s","\n! String too long: "); @y - fputs(_("\n! String too long: "),stdout); + printf("%s",_("\n! String too long: ")); @z @x @@ -278,9 +278,9 @@ quarter) with its two-byte encoding \.{c2 bc}. @z @x - fputs("\n! Section name too long: ",stdout); + printf("%s","\n! Section name too long: "); @y - fputs(_("\n! Section name too long: "),stdout); + printf("%s",_("\n! Section name too long: ")); @z @x diff --git a/Build/source/texk/web2c/cwebdir/ctangle.c b/Build/source/texk/web2c/cwebdir/ctangle.c index 2c31732e22b..683c5b0c1a9 100644 --- a/Build/source/texk/web2c/cwebdir/ctangle.c +++ b/Build/source/texk/web2c/cwebdir/ctangle.c @@ -620,7 +620,7 @@ else/*40:*/ a-= 024000; if((a+name_dir)->equiv!=(void*)text_info)push_level(a+name_dir); else if(a!=0){ -fputs("\n! Not present: <",stdout); +printf("%s","\n! Not present: <"); print_section_name(a+name_dir);err_print(">"); } @@ -680,7 +680,7 @@ output_defs(); #line 516 "ctangle.w" if(text_info->text_link==macro&&cur_out_file==end_output_files){ -fputs("\n! No program text was specified.",stdout);mark_harmless(); +printf("%s","\n! No program text was specified.");mark_harmless(); } else{ @@ -720,7 +720,7 @@ flush_buffer(); if(show_happiness){ if(show_progress)new_line(); -fputs("Done.",stdout); +printf("%s","Done."); } } } @@ -1034,7 +1034,7 @@ c= (eight_bits)*loc++; if(++id_loc<=section_text_end)*id_loc= (char)c; } if(id_loc>=section_text_end){ -fputs("\n! String too long: ",stdout); +printf("%s","\n! String too long: "); term_write(section_text+1,25); err_print("..."); @@ -1119,7 +1119,7 @@ c= (eight_bits)' ';if(*(k-1)==' ')k--; *k= (char)c; } if(k>=section_text_end){ -fputs("\n! Section name too long: ",stdout); +printf("%s","\n! Section name too long: "); term_write(section_text+1,25); printf("...");mark_harmless(); diff --git a/Build/source/texk/web2c/cwebdir/ctangle.w b/Build/source/texk/web2c/cwebdir/ctangle.w index c8ae55df855..cd97d028b18 100644 --- a/Build/source/texk/web2c/cwebdir/ctangle.w +++ b/Build/source/texk/web2c/cwebdir/ctangle.w @@ -401,7 +401,7 @@ or the \CEE/ text may have been associated with a different name by mistake. a-=024000; if ((a+name_dir)->equiv!=(void *)text_info) push_level(a+name_dir); else if (a!=0) { - fputs("\n! Not present: <",stdout); + printf("%s","\n! Not present: <"); print_section_name(a+name_dir); err_print(">"); @.Not present:
@> } @@ -515,7 +515,7 @@ phase_two (void) { @@; @@; if (text_info->text_link==macro && cur_out_file==end_output_files) { - fputs("\n! No program text was specified.",stdout); mark_harmless(); + printf("%s","\n! No program text was specified."); mark_harmless(); @.No program text...@> } else { @@ -533,7 +533,7 @@ phase_two (void) { @@; if (show_happiness) { if (show_progress) new_line(); - fputs("Done.",stdout); + printf("%s","Done."); } } } @@ -1018,7 +1018,7 @@ convention, but do not allow the string to be longer than |longest_name|. if (++id_loc<=section_text_end) *id_loc=(char)c; } if (id_loc>=section_text_end) { - fputs("\n! String too long: ",stdout); + printf("%s","\n! String too long: "); @.String too long@> term_write(section_text+1,25); err_print("..."); @@ -1113,7 +1113,7 @@ while (true) { *k=(char)c; } if (k>=section_text_end) { - fputs("\n! Section name too long: ",stdout); + printf("%s","\n! Section name too long: "); @.Section name too long@> term_write(section_text+1,25); printf("..."); mark_harmless(); diff --git a/Build/source/texk/web2c/cwebdir/ctwill-proofsort b/Build/source/texk/web2c/cwebdir/ctwill-proofsort index dbf61958fab..71e71dd4b3a 100755 --- a/Build/source/texk/web2c/cwebdir/ctwill-proofsort +++ b/Build/source/texk/web2c/cwebdir/ctwill-proofsort @@ -16,11 +16,10 @@ BEGIN { $progname = basename $0; # Unicode::Collate has been around a long time, # but it's not part of core Perl. - my $rc = eval { + eval { require Unicode::Collate; $collator = Unicode::Collate->new(); }; - die "$progname: the Unicode::Collate module is required\n" unless $rc; } # We expect a TeX file as the single command-line parameter. diff --git a/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch b/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch index 5ab95d2d611..40e571d0d55 100644 --- a/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch @@ -305,9 +305,9 @@ part of all meanings. @z @x - fputs("\n! String too long: ",stdout); + printf("%s","\n! String too long: "); @y - fputs(_("\n! String too long: "),stdout); + printf("%s",_("\n! String too long: ")); @z @x @@ -338,9 +338,9 @@ part of all meanings. @z @x - fputs("\n! Section name too long: ",stdout); + printf("%s","\n! Section name too long: "); @y - fputs(_("\n! Section name too long: "),stdout); + printf("%s",_("\n! Section name too long: ")); @z @x @@ -445,18 +445,18 @@ if (loc>=limit) err_print(_("! Verbatim string didn't end")); @z @x - fputs("\n! Never defined: <",stdout); + printf("%s","\n! Never defined: <"); print_section_name(p); putchar('>'); mark_harmless(); @y - fputs(_("\n! Never defined: <"),stdout); + printf("%s",_("\n! Never defined: <")); print_section_name(p); putchar('>'); mark_harmless(); @z @x - fputs("\n! Never used: <",stdout); + printf("%s","\n! Never used: <"); print_section_name(p); putchar('>'); mark_harmless(); @y - fputs(_("\n! Never used: <"),stdout); + printf("%s",_("\n! Never used: <")); print_section_name(p); putchar('>'); mark_harmless(); @z @@ -912,15 +912,15 @@ to \.{\\PB}. Although \.{ctwimac} ignores \.{\\PB}, other macro packages @z @x - fputs("\n! Illegal control code in section name: <",stdout); + printf("%s","\n! Illegal control code in section name: <"); @y - fputs(_("\n! Illegal control code in section name: <"),stdout); + printf("%s",_("\n! Illegal control code in section name: <")); @z @x - fputs("\n! C text in section name didn't end: <",stdout); + printf("%s","\n! C text in section name didn't end: <"); @y - fputs(_("\n! C text in section name didn't end: <"),stdout); + printf("%s",_("\n! C text in section name didn't end: <")); @z @x @@ -936,9 +936,9 @@ to \.{\\PB}. Although \.{ctwimac} ignores \.{\\PB}, other macro packages @z @x -if (show_progress) fputs("\nWriting the output file...",stdout); +if (show_progress) printf("%s","\nWriting the output file..."); @y -if (show_progress) fputs(_("\nWriting the output file..."),stdout); +if (show_progress) printf("%s",_("\nWriting the output file...")); @z @x @@ -1112,9 +1112,9 @@ out_str("}\\FI"); finish_line(); @z @x - if (show_progress) fputs("\nWriting the index...",stdout); + if (show_progress) printf("%s","\nWriting the index..."); @y - if (show_progress) fputs(_("\nWriting the index..."),stdout); + if (show_progress) printf("%s",_("\nWriting the index...")); @z @x @@ -1146,9 +1146,9 @@ if (check_for_change) @@; @z @x - fputs("Done.",stdout); + printf("%s","Done."); @y - fputs(_("Done."),stdout); + printf("%s",_("Done.")); @z @x diff --git a/Build/source/texk/web2c/cwebdir/cweav-w2c.ch b/Build/source/texk/web2c/cwebdir/cweav-w2c.ch index faf1b6ad8b7..4a1526462f4 100644 --- a/Build/source/texk/web2c/cwebdir/cweav-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/cweav-w2c.ch @@ -96,9 +96,9 @@ @z @x - fputs("\n! String too long: ",stdout); + printf("%s","\n! String too long: "); @y - fputs(_("\n! String too long: "),stdout); + printf("%s",_("\n! String too long: ")); @z @x @@ -114,9 +114,9 @@ @z @x - fputs("\n! Section name too long: ",stdout); + printf("%s","\n! Section name too long: "); @y - fputs(_("\n! Section name too long: "),stdout); + printf("%s",_("\n! Section name too long: ")); @z @x @@ -174,18 +174,18 @@ if (loc>=limit) err_print(_("! Verbatim string didn't end")); @z @x - fputs("\n! Never defined: <",stdout); + printf("%s","\n! Never defined: <"); print_section_name(p); putchar('>'); mark_harmless(); @y - fputs(_("\n! Never defined: <"),stdout); + printf("%s",_("\n! Never defined: <")); print_section_name(p); putchar('>'); mark_harmless(); @z @x - fputs("\n! Never used: <",stdout); + printf("%s","\n! Never used: <"); print_section_name(p); putchar('>'); mark_harmless(); @y - fputs(_("\n! Never used: <"),stdout); + printf("%s",_("\n! Never used: <")); print_section_name(p); putchar('>'); mark_harmless(); @z @@ -441,15 +441,15 @@ else if (cat1==stmt) { @z @x - fputs("\n! Illegal control code in section name: <",stdout); + printf("%s","\n! Illegal control code in section name: <"); @y - fputs(_("\n! Illegal control code in section name: <"),stdout); + printf("%s",_("\n! Illegal control code in section name: <")); @z @x - fputs("\n! C text in section name didn't end: <",stdout); + printf("%s","\n! C text in section name didn't end: <"); @y - fputs(_("\n! C text in section name didn't end: <"),stdout); + printf("%s",_("\n! C text in section name didn't end: <")); @z @x @@ -465,9 +465,9 @@ else if (cat1==stmt) { @z @x -if (show_progress) fputs("\nWriting the output file...",stdout); +if (show_progress) printf("%s","\nWriting the output file..."); @y -if (show_progress) fputs(_("\nWriting the output file..."),stdout); +if (show_progress) printf("%s",_("\nWriting the output file...")); @z @x @@ -515,9 +515,9 @@ if (show_progress) fputs(_("\nWriting the output file..."),stdout); @z @x - if (show_progress) fputs("\nWriting the index...",stdout); + if (show_progress) printf("%s","\nWriting the index..."); @y - if (show_progress) fputs(_("\nWriting the index..."),stdout); + if (show_progress) printf("%s",_("\nWriting the index...")); @z @x @@ -540,9 +540,9 @@ if (check_for_change) @@; @z @x - fputs("Done.",stdout); + printf("%s","Done."); @y - fputs(_("Done."),stdout); + printf("%s",_("Done.")); @z @x diff --git a/Build/source/texk/web2c/cwebdir/cweave.w b/Build/source/texk/web2c/cwebdir/cweave.w index 70654828c19..2c398748c97 100644 --- a/Build/source/texk/web2c/cwebdir/cweave.w +++ b/Build/source/texk/web2c/cwebdir/cweave.w @@ -646,7 +646,7 @@ skip_TeX(void) /* skip past pure \TEX/ code */ } } -@*1 Inputting the next token. +@* Inputting the next token. As stated above, \.{CWEAVE}'s most interesting lexical scanning routine is the |get_next| function that inputs the next token of \CEE/ input. However, |get_next| is not especially complicated. @@ -911,7 +911,7 @@ convention, but do not allow the string to be longer than |longest_name|. if (++id_loc<=section_text_end) *id_loc=c; } if (id_loc>=section_text_end) { - fputs("\n! String too long: ",stdout); + printf("%s","\n! String too long: "); @.String too long@> term_write(section_text+1,25); printf("..."); mark_error(); @@ -981,7 +981,7 @@ while (true) { *k=c; } if (k>=section_text_end) { - fputs("\n! Section name too long: ",stdout); + printf("%s","\n! Section name too long: "); @.Section name too long@> term_write(section_text+1,25); printf("..."); mark_harmless(); @@ -1302,13 +1302,13 @@ name_pointer p) /* print anomalies in subtree |p| */ cur_xref=(xref_pointer)p->xref; if ((an_output=(cur_xref->num==file_flag))==true) cur_xref=cur_xref->xlink; if (cur_xref->num '); mark_harmless(); @.Never defined:
@> } while (cur_xref->num >=cite_flag) cur_xref=cur_xref->xlink; if (cur_xref==xmem && !an_output) { - fputs("\n! Never used: <",stdout); + printf("%s","\n! Never used: <"); print_section_name(p); putchar('>'); mark_harmless(); @.Never used:
@> } @@ -4130,7 +4130,7 @@ while (k= if (*k++!='@@') { - fputs("\n! Illegal control code in section name: <",stdout); + printf("%s","\n! Illegal control code in section name: <"); @.Illegal control code...@> print_section_name(cur_section_name); printf("> "); mark_error(); } @@ -4145,7 +4145,7 @@ equals the delimiter that began the string being copied. j=limit+1; *j='|'; delim=0; while (true) { if (k>=k_limit) { - fputs("\n! C text in section name didn't end: <",stdout); + printf("%s","\n! C text in section name didn't end: <"); @.C text...didn't end@> print_section_name(cur_section_name); printf("> "); mark_error(); break; } @@ -4180,7 +4180,7 @@ actually output the \TEX/ material instead of merely looking at the static void phase_two(void) { phase=2; reset_input(); -if (show_progress) fputs("\nWriting the output file...",stdout); +if (show_progress) printf("%s","\nWriting the output file..."); @.Writing the output file...@> section_count=0; format_visible=true; copy_limbo(); finish_line(); flush_buffer(out_buf,false,false); @@ -4249,8 +4249,10 @@ else { out_str("\\N"); @.\\N@> {@+ char s[32];@+snprintf(s,32,"{%d}",sec_depth+1);@+out_str(s);@+} - if (show_progress) - printf("*%d",(int)section_count); update_terminal(); /* print a progress report */ + if (show_progress) { + printf("*%d",(int)section_count); + update_terminal(); /* print a progress report */ + } } out('{'); out_section(section_count); out('}'); @@ -4531,7 +4533,7 @@ if (no_xref) out_str("\\end"); @.\\end@> else { - if (show_progress) fputs("\nWriting the index...",stdout); + if (show_progress) printf("%s","\nWriting the index..."); @.Writing the index...@> if (change_exists) { @@; @@ -4569,7 +4571,7 @@ finish_line(); fclose(active_file); if (show_happiness) { if (show_progress) new_line(); - fputs("Done.",stdout); + printf("%s","Done."); } check_complete(); /* was all of the change file used? */ } diff --git a/Build/source/texk/web2c/cwebdir/cweb.1 b/Build/source/texk/web2c/cwebdir/cweb.1 index 4c35edb754d..192c7c9597e 100644 --- a/Build/source/texk/web2c/cwebdir/cweb.1 +++ b/Build/source/texk/web2c/cwebdir/cweb.1 @@ -1,4 +1,4 @@ -.TH CWEB 1 2021-Apr-24 +.TH CWEB 1 2023-Aug-20 . .SH NAME ctangle, cweave \- translate CWEB to C and/or TeX @@ -108,7 +108,7 @@ means treat 'typename' in templates like 'typedef'. .SH FILES The location of the files mentioned below varies from system to system. .TP -cwebmac.tex +cwebmac.tex, cwebacromac.tex TeX macros used by cweave output. .TP cwebman.tex diff --git a/Build/source/texk/web2c/cwebdir/cwebmac.tex b/Build/source/texk/web2c/cwebdir/cwebmac.tex index 382400a3f7f..c304d3cd693 100644 --- a/Build/source/texk/web2c/cwebdir/cwebmac.tex +++ b/Build/source/texk/web2c/cwebdir/cwebmac.tex @@ -134,160 +134,7 @@ \newif\iftokprocessed \newif\ifTnum \newif\ifinstr {\def\\{\global\let\spacechar= }\\ } -\ifacro % The following are pdf macros -\def\thewidth{\the\wd0 \space} -\def\theheight{\the\ht\strutbox\space} -\def\thedepth{\the\dp\strutbox\space} -\ifpdftex - \ifx\pdfannotlink\undefined\let\pdfannotlink\pdfstartlink\fi% for pdfTeX 0.14 - \def\pdflink#1#2{\hbox{\pdfannotlink height \theheight depth \thedepth - attr{/Border [0 0 0]} goto num #1 \Blue #1\Black\pdfendlink}} % changed 3.69 -\else\def\pdflink#1#2{\setbox0=\hbox{\special{pdf: bc [ \pdflinkcolor ]}{#1}% - \special{pdf: ec}}\special{pdf: ann width \thewidth height \theheight - depth \thedepth << /Type /Annot /Subtype /Link - /Border [0 0 0] /A << /S /GoTo /D (#2) >> >>}\box0\relax}\fi -\def\sanitizecommand#1#2{\addtokens\usersanitizer - {\noexpand\dosanitizecommand\noexpand#1{#2}}} -\def\dosanitizecommand#1#2{\ifx\nxt#1\addF{#2}\fi} - -\catcode`\[=1 \catcode`\]=2 \catcode`\{=12 \catcode`\}=12 - \def\lbchar[{] \def\rbchar[}] -\catcode`\[=12 \catcode`\]=12 \catcode`\{=1 \catcode`\}=2 -\catcode`\~=12 \def\tildechar{~} \catcode`\~=13 -\catcode`\|=0 |catcode`|\=12 |def|bschar{\} |catcode`|\=0 \catcode`\|=12 -\def\makeoutlinetoks{\Tnumfalse\afterassignment\makeolproctok\let\nxt= } -\def\makeolnexttok{\afterassignment\makeolproctok\let\nxt= } -\def\makeolgobbletok{\afterassignment\makeolnexttok\let\nxt= } -\def\addF#1{\addtokens\toksF{#1}\tokprocessedtrue} -% now comes a routine to "sanitize" section names, for pdf outlines -\def\makeolproctok{\tokprocessedfalse - \let\next\makeolnexttok % default - \ifx\nxt\outlinedone\let\next\outlinedone - \else\ifx{\nxt \else\ifx}\nxt \Tnumfalse \instrfalse % skip braces - \else\ifx$\nxt % or a $ sign - \else\ifx^\nxt \addF^\else\ifx_\nxt \addF_% sanitize ^ and _ - \else\ifx\nxt\spacechar \addF\space - \else\if\noexpand\nxt\relax % we have a control sequence; is it one we know? - \ifx\nxt~\addF\space - \else\ifx\nxt\onespace\addF\space - \else\the\usersanitizer - \iftokprocessed\else\makeolproctokctli - \iftokprocessed\else\makeolproctokctlii - \iftokprocessed\else\makeolproctokctliii % if not recognised, skip it - \fi\fi\fi\fi\fi - \else % we don't have a control sequence, it's an ordinary char - \ifx/\nxt \addF{\string\/}% quote chars special to PDF with backslash - \else\ifx(\nxt \addF{\string\(}\else\ifx)\nxt \addF{\string\)}% - \else\ifx[\nxt \addF{\string\[}\else\ifx]\nxt \addF{\string\]}% - \else\expandafter\makeolproctokchar\meaning\nxt - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi - \next -} -\def\makeolproctokchar#1 #2 #3{\addF{#3}} -\def\makeolproctokctli{% - \ifx\nxt\CEE\addF{C}\let\next\makeolgobbletok % \CEE/ - \else\ifx\nxt\UNIX\addF{UNIX}\let\next\makeolgobbletok % \UNIX/ - \else\ifx\nxt\TEX\addF{TeX}\let\next\makeolgobbletok % \TEX/ - \else\ifx\nxt\TeX\addF{TeX}\else\ifx\nxt\LaTeX\addF{LaTeX}% - \else\ifx\nxt\CPLUSPLUS\addF{C++}\let\next\makeolgobbletok % \CPLUSPLUS/ - \else\ifx\nxt\Cee\addF{C}% - \else\ifx\nxt\PB \let\next\makeolgobbletok \tokprocessedtrue % \PB{...} - \else\ifx\nxt\.\tokprocessedtrue\instrtrue % \.{...} - % skip \| - \else\ifx\nxt\\\ifinstr\addF{\bschar\bschar}\else\tokprocessedtrue\fi - \else\ifx\nxt\&\ifinstr\addF&\else\tokprocessedtrue\fi - \else\ifx\nxt\~\ifTnum\addF{0}\else\addF\tildechar\fi % 077->\T{\~77} - \else\ifx\nxt\_\ifTnum\addF{E}\else\addF_\fi % 0.1E5->\T{0.1\_5} - \else\ifx\nxt\^\ifTnum\addF{0x}\else\addF^\fi % 0x77 -> \T{\^77} - \else\ifx\nxt\\\\\ifTnum\addF{0b}\else\addF\\\fi % 0b10111 -> \T{\\10111} - \else\ifx\nxt\$\ifTnum\tokprocessedtrue\else\addF$\fi %$% \T{77\$L} - \else\ifx\nxt\{\addF\lbchar \else\ifx\nxt\}\addF\rbchar - \else\ifx\nxt\ \addF\space \else\ifx\nxt\#\addF{\string\#}% - \else\ifx\nxt\PP\addF{++}\else\ifx\nxt\MM\addF{--}% - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi -} -\def\makeolproctokctlii{% - \ifx\nxt\MG\addF{->}\else\ifx\nxt\GG\addF{>>}% - \else\ifx\nxt\LL\addF{<<}\else\ifx\nxt\NULL\addF{NULL}% - \else\ifx\nxt\AND\addF&\else\ifx\nxt\OR\addF|% - \else\ifx\nxt\XOR\addF^\else\ifx\nxt\CM\addF\tildechar - \else\ifx\nxt\MOD\addF{\string\%}\else\ifx\nxt\DC\addF{::}% - \else\ifx\nxt\PA\addF{.*}\else\ifx\nxt\MGA\addF{->*}% - \else\ifx\nxt\this\addF{this}\else\ifx\nxt\?\addF?% - \else\ifx\nxt\E\addF{==}\else\ifx\nxt\G\addF{>=}% - \else\ifx\nxt\I\addF{!=}\else\ifx\nxt\K\addF{=}% - \else\ifx\nxt\l\addF{l}\else\ifx\nxt\L\addF{L}% - \else\ifx\nxt\o\addF{o}\else\ifx\nxt\O\addF{O}% - \else\ifx\nxt\R\addF!% - \else\ifx\nxt\T \Tnumtrue \let\next\makeolgobbletok - \tokprocessedtrue % \T{number} - \else\ifx\nxt\AM\addF&\else\ifx\nxt\%\addF{\string\%}% - \fi\fi\fi\fi\fi \fi\fi\fi\fi\fi - \fi\fi\fi\fi\fi \fi\fi\fi\fi\fi - \fi\fi\fi\fi\fi\fi -} -\def\makeolproctokctliii{% - \ifx\nxt\V\addF{||}\else\ifx\nxt\W\addF{&&}\else\ifx\nxt\Z\addF{<=}% - \else\ifx\nxt\*\addF*\else\ifx\nxt\Xand\addF{\space and\space}% - \else\ifx\nxt\Xandxeq\addF{\space and_eq\space}% - \else\ifx\nxt\Xbitand\addF{\space bitand\space}% - \else\ifx\nxt\Xbitor\addF{\space bitor\space}% - \else\ifx\nxt\Xcompl\addF{\space compl\space}% - \else\ifx\nxt\Xnot\addF{\space not\space}% - \else\ifx\nxt\Xnotxeq\addF{\space not_eq\space}% - \else\ifx\nxt\Xor\addF{\space or\space}% - \else\ifx\nxt\Xorxeq\addF{\space or_eq\space}% - \else\ifx\nxt\Xxor\addF{\space xor\space}% - \else\ifx\nxt\Xxorxeq\addF{\space xor_eq\space}% - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi - \fi\fi\fi\fi\fi -} -\def\outlinedone{\edef\outlinest{\global\noexpand\toksE={\the\toksF}}% - \outlinest\let\outlinedone=\relax} -\fi % End of pdf macros - -\ifhint -% The following uses HINT primitives to implement: -% \HINThome to mark the position of the home page -% \HINTlabel to attach a label to the top of a section -% \HINTlink to link a section number to the section label -% \HINTcontents to produce an 'outline' item -% These are the top level HINT macros that are used in this file -% No HINT primitives are used directly. -\def\HINThome{\HINTdest name {HINT.home}% - \HINToutline goto name {HINT.home} depth 1 {Table of Contents}} -\def\HINTlabel{{\let\*=\empty\HINTdest num \secstar top}} -\def\HINTlink#1#2{\HINTstartlink goto num #1 {#1}\HINTendlink}% #2 not used ??? -\def\HINTcontents#1#2#3{\HINToutline goto num #3 depth #2 {#1}} -\let\pdflink=\HINTlink -\fi % End of HINT macros - -% Common macros for \ifacro and \ifhint -\ifacrohint -\def\pdfnote#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}\maketoks}\the\toksA} -\def\firstsecno#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}% - \def\makenote{\addtokens\toksB{\the\toksC}\def\makenote{\toksD={} - \toksC={}\let\space\empty}\makenote}\maketoks}} -\def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} -\def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}% - \ifcat\noexpand\first0\countB=`#1\else\countB=0\fi\toksA={#2}} -\def\maketoks{\expandafter\poptoks\the\toksA|ENDTOKS|% - \ifnum\countB>`9 \countB=0 \fi - \ifnum\countB<`0 - \ifnum0=\countC\else\makenote\fi - \ifx\first.\let\next=\maketoksdone\else - \let\next=\maketoks - \addtokens\toksB{\the\toksD} - \ifx\first,\addtokens\toksB{\space}\fi - \fi - \else \addtokens\toksC{\the\toksD}\global\countC=1\let\next=\maketoks - \fi - \next -} -\def\makenote{\addtokens\toksB - {\noexpand\pdflink{\the\toksC}{\romannumeral\the\toksC}}\toksC={}\global\countC=0} -\def\maketoksdone{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} -\fi % End of common macros +\ifacrohint \input cwebacromac \fi % load hypertext macros \def\pdfURL#1#2{\ifpdf \ifpdftex\pdfannotlink height \theheight depth \thedepth attr {/Border [0 0 0]} user { /Type /Annot /Subtype /Link /A diff --git a/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch b/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch index 929fd58d385..b9352a3da9d 100644 --- a/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch @@ -241,10 +241,10 @@ As an example of a real program written in \.{CWEB}, \Appendix A @z @x -Appendix B is the file that sets \TEX/ up to accept +Appendix B displays the files that set \TEX/ up to accept the output of \.{CWEAVE}, and Appendix~C discusses how to use some of those @y -\Appendix B is the file that sets \TEX/ up to accept +\Appendix B displays the files that set \TEX/ up to accept the output of \.{CWEAVE}, and \Appendix C discusses how to use some of those @z @@ -327,10 +327,16 @@ And here's what the same excerpt looks like when typeset. @x if you have a duplex printer. Appendices D, E, and F of the complete +version of this manual are printed using a commented-out option that +substitutes `$\gets$' for `$=$' in the program listings. Looking at those @y if you have a duplex printer. Appendices \pdfURL{D}{common.pdf}, \pdfURL{E}{ctangle.pdf}, and \pdfURL{F}{cweave.pdf}\cwebfootnote{And \pdfURL{Appendix~G}{ctwill.pdf}.} of the complete +version of this manual are printed using a commented-out option that +substitutes `$\gets$' for `$=$' in the program listings.\cwebfootnote{They +also make use of the alternative format for \CEE/ comments.} +Looking at those @z @x diff --git a/Build/source/texk/web2c/cwebdir/cwebman.tex b/Build/source/texk/web2c/cwebdir/cwebman.tex index 108bd32f88d..3804c56cb4f 100644 --- a/Build/source/texk/web2c/cwebdir/cwebman.tex +++ b/Build/source/texk/web2c/cwebdir/cwebman.tex @@ -1187,7 +1187,7 @@ contains an excerpt from the \.{CWEB} program itself. The reader who examines the listings in this appendix carefully will get a good feeling for the basic ideas of \.{CWEB}. -Appendix B is the file that sets \TEX/ up to accept +Appendix B displays the files that set \TEX/ up to accept the output of \.{CWEAVE}, and Appendix~C discusses how to use some of those macros to vary the output formats. @@ -1524,20 +1524,28 @@ features needed by the output of \.{CWEAVE}. \vskip6pt \begingroup \def\tt{\eighttt} \baselineskip9pt -\def\printmacs{\begingroup +\def\printmacs#1{\begingroup \def\do##1{\catcode`##1=12 } \dospecials \parskip 0pt \parindent 0pt \catcode`\ =13 \catcode`\^^M=13 - \tt \verbatimdefs \input cwebmac \endgroup} -\printmacs + \tt \verbatimdefs \input cweb#1mac \endgroup} +\printmacs{\empty} + +\vskip6pt \baselineskip12pt +\noindent And here comes the file that extends \.{cwebmac.tex} in order to +support the ``hypertext'' features needed by the enhanced \TEX/ engines when +processing the output of \.{CWEAVE}. + +\vskip6pt \baselineskip9pt +\printmacs{acro} \endgroup \vfill\eject \def\runninghead{APPENDIX C --- NOTES ON FORMATTING} \section Appendix C: How to use \.{CWEB} macros. -The macros in \.{cwebmac} make it possible to produce a variety of formats -without editing the output of \.{CWEAVE}, and the purpose of this appendix -is to explain some of the possibilities. +The macros in \.{cwebmac} and \.{cwebacromac} make it possible to produce a +variety of formats without editing the output of \.{CWEAVE}, and the purpose +of this appendix is to explain some of the possibilities. \def\point#1.{\yskip\indent#1.\quad\ignorespaces} @@ -1615,8 +1623,8 @@ contents page. \point 9. Data for the table of contents is written to a file that is read after the indexes have been \TEX/ed; there's one line of data for every starred section. The file \.{common.toc} might look like this: -$$\lpile{\.{\\ZZ \{Introduction\}\{0\}\{1\}\{29\}\{\}}\cr - \.{\\ZZ \{The character set\}\{1\}\{21\}\{35\}\{\}}\cr}$$ +$$\lpile{\.{\\ZZ \{Introduction\}\{1\}\{1\}\{30\}\{\}}\cr + \.{\\ZZ \{The character set\}\{1\}\{21\}\{36\}\{\}}\cr}$$ and so on. The \.{\\topofcontents} macro could redefine \.{\\ZZ} so that the information appears in any desired format. (See also point~19 below.) @@ -1752,7 +1760,7 @@ Moreover, the final group title, `Names of the sections', can be opened up to list every section name; Acrobat users can therefore navigate easily to any desired section. -The macros of \.{cwebmac.tex} are careful to ``sanitize'' all the names +The macros of \.{cwebacromac.tex} are careful to ``sanitize'' all the names that appear as bookmarks, by removing special characters and formatting codes that are inappropriate for the limited typographic capabilities of {\mc PDF} outlines. For example, one section of \.{CWEAVE} diff --git a/Build/source/texk/web2c/cwebdir/texinputs/pdfctproofmac.tex b/Build/source/texk/web2c/cwebdir/texinputs/pdfctproofmac.tex index 811af251499..9a64c366a4d 100644 --- a/Build/source/texk/web2c/cwebdir/texinputs/pdfctproofmac.tex +++ b/Build/source/texk/web2c/cwebdir/texinputs/pdfctproofmac.tex @@ -1,10 +1,10 @@ % standard macros for CWEB listings (in addition to plain.tex) -% Version 4.9 --- June 2023 +% Version 4.10 --- August 2023 % modified for proofs in CTWILL % modified for PDF output with 'tex "\let\pdf+', 'pdftex', 'xetex', and 'hitex' % This file is not copyrighted and can be used freely. \ifx\renewenvironment\undefined\else\endinput\fi % LaTeX will use other macros -\xdef\fmtversion{\fmtversion+CTWILL4.9+PROOFS+PDF} +\xdef\fmtversion{\fmtversion+CTWILL4.10+PROOFS+PDF} \input iftex.sty % TeX engine tests \ifx\pdf+\pdftrue\fi % for plain TeX in combination with dvipdfm % Uncomment the following line if you want PDF goodies to be the default @@ -13,7 +13,7 @@ \ifxetex\pdftrue\fi % XeTeX produces PDF output \ifpdftex % pdfTeX produces PDF output if \pdfoutput>0 \def\Black{\pdfliteral{0 g 0 G}} % use rgb colors for direct PDF output too - \def\PDFlinkcolor{\pdfliteral{\pdflinkcolor\space rg \pdflinkcolor\space RG}} + \def\Blue{\pdfliteral{\pdflinkcolor\space rg \pdflinkcolor\space RG}} \fi \let\ifacro=\ifpdf \newif\ifacrohint \ifacro\acrohinttrue\fi \ifhint\acrohinttrue\fi @@ -135,160 +135,7 @@ \newif\iftokprocessed \newif\ifTnum \newif\ifinstr {\def\\{\global\let\spacechar= }\\ } -\ifacro % The following are pdf macros -\def\thewidth{\the\wd0 \space} -\def\theheight{\the\ht\strutbox\space} -\def\thedepth{\the\dp\strutbox\space} -\ifpdftex - \ifx\pdfannotlink\undefined\let\pdfannotlink\pdfstartlink\fi% for pdfTeX 0.14 - \def\pdflink#1#2{\hbox{\pdfannotlink height \theheight depth \thedepth - attr{/Border [0 0 0]} goto num #1 \PDFlinkcolor #1\Black\pdfendlink}} -\else\def\pdflink#1#2{\setbox0=\hbox{\special{pdf: bc [ \pdflinkcolor ]}{#1}% - \special{pdf: ec}}\special{pdf: ann width \thewidth height \theheight - depth \thedepth << /Type /Annot /Subtype /Link - /Border [0 0 0] /A << /S /GoTo /D (#2) >> >>}\box0\relax}\fi -\def\sanitizecommand#1#2{\addtokens\usersanitizer - {\noexpand\dosanitizecommand\noexpand#1{#2}}} -\def\dosanitizecommand#1#2{\ifx\nxt#1\addF{#2}\fi} - -\catcode`\[=1 \catcode`\]=2 \catcode`\{=12 \catcode`\}=12 - \def\lbchar[{] \def\rbchar[}] -\catcode`\[=12 \catcode`\]=12 \catcode`\{=1 \catcode`\}=2 -\catcode`\~=12 \def\tildechar{~} \catcode`\~=13 -\catcode`\|=0 |catcode`|\=12 |def|bschar{\} |catcode`|\=0 \catcode`\|=12 -\def\makeoutlinetoks{\Tnumfalse\afterassignment\makeolproctok\let\nxt= } -\def\makeolnexttok{\afterassignment\makeolproctok\let\nxt= } -\def\makeolgobbletok{\afterassignment\makeolnexttok\let\nxt= } -\def\addF#1{\addtokens\toksF{#1}\tokprocessedtrue} -% now comes a routine to "sanitize" section names, for pdf outlines -\def\makeolproctok{\tokprocessedfalse - \let\next\makeolnexttok % default - \ifx\nxt\outlinedone\let\next\outlinedone - \else\ifx{\nxt \else\ifx}\nxt \Tnumfalse \instrfalse % skip braces - \else\ifx$\nxt % or a $ sign - \else\ifx^\nxt \addF^\else\ifx_\nxt \addF_% sanitize ^ and _ - \else\ifx\nxt\spacechar \addF\space - \else\if\noexpand\nxt\relax % we have a control sequence; is it one we know? - \ifx\nxt~\addF\space - \else\ifx\nxt\onespace\addF\space - \else\the\usersanitizer - \iftokprocessed\else\makeolproctokctli - \iftokprocessed\else\makeolproctokctlii - \iftokprocessed\else\makeolproctokctliii % if not recognised, skip it - \fi\fi\fi\fi\fi - \else % we don't have a control sequence, it's an ordinary char - \ifx/\nxt \addF{\string\/}% quote chars special to PDF with backslash - \else\ifx(\nxt \addF{\string\(}\else\ifx)\nxt \addF{\string\)}% - \else\ifx[\nxt \addF{\string\[}\else\ifx]\nxt \addF{\string\]}% - \else\expandafter\makeolproctokchar\meaning\nxt - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi - \next -} -\def\makeolproctokchar#1 #2 #3{\addF{#3}} -\def\makeolproctokctli{% - \ifx\nxt\CEE\addF{C}\let\next\makeolgobbletok % \CEE/ - \else\ifx\nxt\UNIX\addF{UNIX}\let\next\makeolgobbletok % \UNIX/ - \else\ifx\nxt\TEX\addF{TeX}\let\next\makeolgobbletok % \TEX/ - \else\ifx\nxt\TeX\addF{TeX}\else\ifx\nxt\LaTeX\addF{LaTeX}% - \else\ifx\nxt\CPLUSPLUS\addF{C++}\let\next\makeolgobbletok % \CPLUSPLUS/ - \else\ifx\nxt\Cee\addF{C}% - \else\ifx\nxt\PB \let\next\makeolgobbletok \tokprocessedtrue % \PB{...} - \else\ifx\nxt\.\tokprocessedtrue\instrtrue % \.{...} - % skip \| - \else\ifx\nxt\\\ifinstr\addF{\bschar\bschar}\else\tokprocessedtrue\fi - \else\ifx\nxt\&\ifinstr\addF&\else\tokprocessedtrue\fi - \else\ifx\nxt\~\ifTnum\addF{0}\else\addF\tildechar\fi % 077->\T{\~77} - \else\ifx\nxt\_\ifTnum\addF{E}\else\addF_\fi % 0.1E5->\T{0.1\_5} - \else\ifx\nxt\^\ifTnum\addF{0x}\else\addF^\fi % 0x77 -> \T{\^77} - \else\ifx\nxt\\\\\ifTnum\addF{0b}\else\addF\\\fi % 0b10111 -> \T{\\10111} - \else\ifx\nxt\$\ifTnum\tokprocessedtrue\else\addF$\fi %$% \T{77\$L} - \else\ifx\nxt\{\addF\lbchar \else\ifx\nxt\}\addF\rbchar - \else\ifx\nxt\ \addF\space \else\ifx\nxt\#\addF{\string\#}% - \else\ifx\nxt\PP\addF{++}\else\ifx\nxt\MM\addF{--}% - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi -} -\def\makeolproctokctlii{% - \ifx\nxt\MG\addF{->}\else\ifx\nxt\GG\addF{>>}% - \else\ifx\nxt\LL\addF{<<}\else\ifx\nxt\NULL\addF{NULL}% - \else\ifx\nxt\AND\addF&\else\ifx\nxt\OR\addF|% - \else\ifx\nxt\XOR\addF^\else\ifx\nxt\CM\addF\tildechar - \else\ifx\nxt\MOD\addF{\string\%}\else\ifx\nxt\DC\addF{::}% - \else\ifx\nxt\PA\addF{.*}\else\ifx\nxt\MGA\addF{->*}% - \else\ifx\nxt\this\addF{this}\else\ifx\nxt\?\addF?% - \else\ifx\nxt\E\addF{==}\else\ifx\nxt\G\addF{>=}% - \else\ifx\nxt\I\addF{!=}\else\ifx\nxt\K\addF{=}% - \else\ifx\nxt\l\addF{l}\else\ifx\nxt\L\addF{L}% - \else\ifx\nxt\o\addF{o}\else\ifx\nxt\O\addF{O}% - \else\ifx\nxt\R\addF!% - \else\ifx\nxt\T \Tnumtrue \let\next\makeolgobbletok - \tokprocessedtrue % \T{number} - \else\ifx\nxt\AM\addF&\else\ifx\nxt\%\addF{\string\%}% - \fi\fi\fi\fi\fi \fi\fi\fi\fi\fi - \fi\fi\fi\fi\fi \fi\fi\fi\fi\fi - \fi\fi\fi\fi\fi\fi -} -\def\makeolproctokctliii{% - \ifx\nxt\V\addF{||}\else\ifx\nxt\W\addF{&&}\else\ifx\nxt\Z\addF{<=}% - \else\ifx\nxt\*\addF*\else\ifx\nxt\Xand\addF{\space and\space}% - \else\ifx\nxt\Xandxeq\addF{\space and_eq\space}% - \else\ifx\nxt\Xbitand\addF{\space bitand\space}% - \else\ifx\nxt\Xbitor\addF{\space bitor\space}% - \else\ifx\nxt\Xcompl\addF{\space compl\space}% - \else\ifx\nxt\Xnot\addF{\space not\space}% - \else\ifx\nxt\Xnotxeq\addF{\space not_eq\space}% - \else\ifx\nxt\Xor\addF{\space or\space}% - \else\ifx\nxt\Xorxeq\addF{\space or_eq\space}% - \else\ifx\nxt\Xxor\addF{\space xor\space}% - \else\ifx\nxt\Xxorxeq\addF{\space xor_eq\space}% - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi - \fi\fi\fi\fi\fi -} -\def\outlinedone{\edef\outlinest{\global\noexpand\toksE={\the\toksF}}% - \outlinest\let\outlinedone=\relax} -\fi % End of pdf macros - -\ifhint -% The following uses HINT primitives to implement: -% \HINThome to mark the position of the home page -% \HINTlabel to attach a label to the top of a section -% \HINTlink to link a section number to the section label -% \HINTcontents to produce an 'outline' item -% These are the top level HINT macros that are used in this file -% No HINT primitives are used directly. -\def\HINThome{\HINTdest name {HINT.home}% - \HINToutline goto name {HINT.home} depth 1 {Table of Contents}} -\def\HINTlabel{{\let\*=\empty\HINTdest num \secstar top}} -\def\HINTlink#1#2{\HINTstartlink goto num #1 {#1}\HINTendlink}% #2 not used ??? -\def\HINTcontents#1#2#3{\HINToutline goto num #3 depth #2 {#1}} -\let\pdflink=\HINTlink -\fi % End of HINT macros - -% Common macros for \ifpdf and \ifhint -\ifacrohint -\def\pdfnote#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}\maketoks}\the\toksA} -\def\firstsecno#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}% - \def\makenote{\addtokens\toksB{\the\toksC}\def\makenote{\toksD={} - \toksC={}\let\space\empty}\makenote}\maketoks}} -\def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} -\def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}% - \ifcat\noexpand\first0\countB=`#1\else\countB=0\fi\toksA={#2}} -\def\maketoks{\expandafter\poptoks\the\toksA|ENDTOKS|% - \ifnum\countB>`9 \countB=0 \fi - \ifnum\countB<`0 - \ifnum0=\countC\else\makenote\fi - \ifx\first.\let\next=\maketoksdone\else - \let\next=\maketoks - \addtokens\toksB{\the\toksD} - \ifx\first,\addtokens\toksB{\space}\fi - \fi - \else \addtokens\toksC{\the\toksD}\global\countC=1\let\next=\maketoks - \fi - \next -} -\def\makenote{\addtokens\toksB - {\noexpand\pdflink{\the\toksC}{\romannumeral\the\toksC}}\toksC={}\global\countC=0} -\def\maketoksdone{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} -\fi % End of common macros +\ifacrohint \input cwebacromac \fi % load hypertext macros \def\pdfURL#1#2{\ifpdf \ifpdftex\pdfannotlink height \theheight depth \thedepth attr {/Border [0 0 0]} user { /Type /Annot /Subtype /Link /A diff --git a/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex b/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex index f76d22ae8d9..c982784fd2d 100644 --- a/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex +++ b/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex @@ -1,11 +1,11 @@ % standard macros for CWEB listings (in addition to plain.tex) -% Version 4.9 --- June 2023 +% Version 4.10 --- August 2023 % modified for pages produced by CTWILL % further modified for page size of the MMIXware book % modified for PDF output with 'tex "\let\pdf+', 'pdftex', and 'xetex' % This file is not copyrighted and can be used freely. \ifx\renewenvironment\undefined\else\endinput\fi % LaTeX will use other macros -\xdef\fmtversion{\fmtversion+CTWILL4.9+LNCS+PDF} +\xdef\fmtversion{\fmtversion+CTWILL4.10+LNCS+PDF} \input iftex.sty % TeX engine tests \ifx\pdf+\pdftrue\fi % for plain TeX in combination with dvipdfm % Uncomment the following line if you want PDF goodies to be the default @@ -14,13 +14,14 @@ \ifxetex\pdftrue\fi % XeTeX produces PDF output \ifpdftex % pdfTeX produces PDF output if \pdfoutput>0 \def\Black{\pdfliteral{0 g 0 G}} % use rgb colors for direct PDF output too - \def\PDFlinkcolor{\pdfliteral{\pdflinkcolor\space rg \pdflinkcolor\space RG}} + \def\Blue{\pdfliteral{\pdflinkcolor\space rg \pdflinkcolor\space RG}} \fi \let\ifacro=\ifpdf \ifhint\message{These macros are not suitable for HiTeX.} \message{Please use 'ctwill +P [+lpdf]' instead.} \end \fi +\newif\ifacrohint \ifacro\acrohinttrue\fi \ifhint\acrohinttrue\fi \let\:=\. % preserve a way to get the dot accent % (all other accents will still work as usual) @@ -250,150 +251,7 @@ \newif\iftokprocessed \newif\ifTnum \newif\ifinstr {\def\\{\global\let\spacechar= }\\ } -\ifacro % The following are pdf macros -\def\thewidth{\the\wd0 \space} -\def\theheight{\the\ht\strutbox\space} -\def\thedepth{\the\dp\strutbox\space} -\ifpdftex - \ifx\pdfannotlink\undefined\let\pdfannotlink\pdfstartlink\fi% for pdfTeX 0.14 - \def\pdflink#1#2{\hbox{\pdfannotlink height \theheight depth \thedepth - attr{/Border [0 0 0]} goto num #1 \PDFlinkcolor #1\Black\pdfendlink}} -\else\def\pdflink#1#2{\setbox0=\hbox{\special{pdf: bc [ \pdflinkcolor ]}{#1}% - \special{pdf: ec}}\special{pdf: ann width \thewidth height \theheight - depth \thedepth << /Type /Annot /Subtype /Link - /Border [0 0 0] /A << /S /GoTo /D (#2) >> >>}\box0\relax}\fi -\def\pdfnote#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}\maketoks}\the\toksA} -\def\firstsecno#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}% - \def\makenote{\addtokens\toksB{\the\toksC}\def\makenote{\toksD={} - \toksC={}\let\space\empty}\makenote}\maketoks}} -\def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} -\def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}% - \ifcat\noexpand\first0\countB=`#1\else\countB=0\fi\toksA={#2}} -\def\maketoks{\expandafter\poptoks\the\toksA|ENDTOKS|% - \ifnum\countB>`9 \countB=0 \fi - \ifnum\countB<`0 - \ifnum0=\countC\else\makenote\fi - \ifx\first.\let\next=\maketoksdone\else - \let\next=\maketoks - \addtokens\toksB{\the\toksD} - \ifx\first,\addtokens\toksB{\space}\fi - \fi - \else \addtokens\toksC{\the\toksD}\global\countC=1\let\next=\maketoks - \fi - \next -} -\def\makenote{\addtokens\toksB - {\noexpand\pdflink{\the\toksC}{\romannumeral\the\toksC}}\toksC={}\global\countC=0} -\def\maketoksdone{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} -\def\pdfURL#1#2{\ifpdf \ifpdftex\pdfannotlink height \theheight depth \thedepth - attr {/Border [0 0 0]} user { /Type /Annot /Subtype /Link /A - << /S /URI /URI (#2) >>}\Blue #1\Black \pdfendlink % changed in 3.69 - \else {\setbox0=\hbox{\special{pdf: bc [ \pdflinkcolor ]}{#1}% - \special{pdf: ec}}\special{pdf: ann width \thewidth height \theheight - depth \thedepth << /Border [0 0 0] /Type /Annot /Subtype /Link /A - << /S /URI /URI (#2) >> >>}\box0\relax}\fi - \else #1 ({\tt#2})\fi} -{\catcode`\~=12 \gdef\TILDE/{~}} % ~ in a URL -{\catcode`\_=12 \gdef\UNDER/{_}} % _ in a URL -\def\sanitizecommand#1#2{\addtokens\usersanitizer - {\noexpand\dosanitizecommand\noexpand#1{#2}}} -\def\dosanitizecommand#1#2{\ifx\nxt#1\addF{#2}\fi} - -\catcode`\[=1 \catcode`\]=2 \catcode`\{=12 \catcode`\}=12 - \def\lbchar[{] \def\rbchar[}] -\catcode`\[=12 \catcode`\]=12 \catcode`\{=1 \catcode`\}=2 -\catcode`\~=12 \def\tildechar{~} \catcode`\~=13 -\catcode`\|=0 |catcode`|\=12 |def|bschar{\} |catcode`|\=0 \catcode`\|=12 -\def\makeoutlinetoks{\Tnumfalse\afterassignment\makeolproctok\let\nxt= } -\def\makeolnexttok{\afterassignment\makeolproctok\let\nxt= } -\def\makeolgobbletok{\afterassignment\makeolnexttok\let\nxt= } -\def\addF#1{\addtokens\toksF{#1}\tokprocessedtrue} -% now comes a routine to "sanitize" section names, for pdf outlines -\def\makeolproctok{\tokprocessedfalse - \let\next\makeolnexttok % default - \ifx\nxt\outlinedone\let\next\outlinedone - \else\ifx{\nxt \else\ifx}\nxt \Tnumfalse \instrfalse % skip braces - \else\ifx$\nxt % or a $ sign - \else\ifx^\nxt \addF^\else\ifx_\nxt \addF_% sanitize ^ and _ - \else\ifx\nxt\spacechar \addF\space - \else\if\noexpand\nxt\relax % we have a control sequence; is it one we know? - \ifx\nxt~\addF\space - \else\ifx\nxt\onespace\addF\space - \else\the\usersanitizer - \iftokprocessed\else\makeolproctokctli - \iftokprocessed\else\makeolproctokctlii - \iftokprocessed\else\makeolproctokctliii % if not recognised, skip it - \fi\fi\fi\fi\fi - \else % we don't have a control sequence, it's an ordinary char - \ifx/\nxt \addF{\string\/}% quote chars special to PDF with backslash - \else\ifx(\nxt \addF{\string\(}\else\ifx)\nxt \addF{\string\)}% - \else\ifx[\nxt \addF{\string\[}\else\ifx]\nxt \addF{\string\]}% - \else\expandafter\makeolproctokchar\meaning\nxt - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi - \next -} -\def\makeolproctokchar#1 #2 #3{\addF{#3}} -\def\makeolproctokctli{% - \ifx\nxt\CEE\addF{C}\let\next\makeolgobbletok % \CEE/ - \else\ifx\nxt\UNIX\addF{UNIX}\let\next\makeolgobbletok % \UNIX/ - \else\ifx\nxt\TEX\addF{TeX}\let\next\makeolgobbletok % \TEX/ - \else\ifx\nxt\TeX\addF{TeX}\else\ifx\nxt\LaTeX\addF{LaTeX}% - \else\ifx\nxt\CPLUSPLUS\addF{C++}\let\next\makeolgobbletok % \CPLUSPLUS/ - \else\ifx\nxt\Cee\addF{C}% - \else\ifx\nxt\PB \let\next\makeolgobbletok \tokprocessedtrue % \PB{...} - \else\ifx\nxt\.\tokprocessedtrue\instrtrue % \.{...} - % skip \| - \else\ifx\nxt\\\ifinstr\addF{\bschar\bschar}\else\tokprocessedtrue\fi - \else\ifx\nxt\&\ifinstr\addF&\else\tokprocessedtrue\fi - \else\ifx\nxt\~\ifTnum\addF{0}\else\addF\tildechar\fi % 077->\T{\~77} - \else\ifx\nxt\_\ifTnum\addF{E}\else\addF_\fi % 0.1E5->\T{0.1\_5} - \else\ifx\nxt\^\ifTnum\addF{0x}\else\addF^\fi % 0x77 -> \T{\^77} - \else\ifx\nxt\\\\\ifTnum\addF{0b}\else\addF\\\fi % 0b10111 -> \T{\\10111} - \else\ifx\nxt\$\ifTnum\tokprocessedtrue\else\addF$\fi %$% \T{77\$L} - \else\ifx\nxt\{\addF\lbchar \else\ifx\nxt\}\addF\rbchar - \else\ifx\nxt\ \addF\space \else\ifx\nxt\#\addF{\string\#}% - \else\ifx\nxt\PP\addF{++}\else\ifx\nxt\MM\addF{--}% - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi -} -\def\makeolproctokctlii{% - \ifx\nxt\MG\addF{->}\else\ifx\nxt\GG\addF{>>}% - \else\ifx\nxt\LL\addF{<<}\else\ifx\nxt\NULL\addF{NULL}% - \else\ifx\nxt\AND\addF&\else\ifx\nxt\OR\addF|% - \else\ifx\nxt\XOR\addF^\else\ifx\nxt\CM\addF\tildechar - \else\ifx\nxt\MOD\addF{\string\%}\else\ifx\nxt\DC\addF{::}% - \else\ifx\nxt\PA\addF{.*}\else\ifx\nxt\MGA\addF{->*}% - \else\ifx\nxt\this\addF{this}\else\ifx\nxt\?\addF?% - \else\ifx\nxt\E\addF{==}\else\ifx\nxt\G\addF{>=}% - \else\ifx\nxt\I\addF{!=}\else\ifx\nxt\K\addF{=}% - \else\ifx\nxt\l\addF{l}\else\ifx\nxt\L\addF{L}% - \else\ifx\nxt\o\addF{o}\else\ifx\nxt\O\addF{O}% - \else\ifx\nxt\R\addF!% - \else\ifx\nxt\T \Tnumtrue \let\next\makeolgobbletok - \tokprocessedtrue % \T{number} - \else\ifx\nxt\AM\addF&\else\ifx\nxt\%\addF{\string\%}% - \fi\fi\fi\fi\fi \fi\fi\fi\fi\fi - \fi\fi\fi\fi\fi \fi\fi\fi\fi\fi - \fi\fi\fi\fi\fi\fi -} -\def\makeolproctokctliii{% - \ifx\nxt\V\addF{||}\else\ifx\nxt\W\addF{&&}\else\ifx\nxt\Z\addF{<=}% - \else\ifx\nxt\*\addF*\else\ifx\nxt\Xand\addF{\space and\space}% - \else\ifx\nxt\Xandxeq\addF{\space and_eq\space}% - \else\ifx\nxt\Xbitand\addF{\space bitand\space}% - \else\ifx\nxt\Xbitor\addF{\space bitor\space}% - \else\ifx\nxt\Xcompl\addF{\space compl\space}% - \else\ifx\nxt\Xnot\addF{\space not\space}% - \else\ifx\nxt\Xnotxeq\addF{\space not_eq\space}% - \else\ifx\nxt\Xor\addF{\space or\space}% - \else\ifx\nxt\Xorxeq\addF{\space or_eq\space}% - \else\ifx\nxt\Xxor\addF{\space xor\space}% - \else\ifx\nxt\Xxorxeq\addF{\space xor_eq\space}% - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi - \fi\fi\fi\fi\fi -} -\def\outlinedone{\edef\outlinest{\global\noexpand\toksE={\the\toksF}}% - \outlinest\let\outlinedone=\relax} -\fi % End of pdf macros +\ifacrohint \input cwebacromac \fi % load hypertext macros \def\lapstar{\rlap{*}} \def\stsec{\tenpoint\rightskip=0pt % get out of C mode (cf. \B) -- cgit v1.2.3