diff options
-rw-r--r-- | Build/source/texk/web2c/ChangeLog | 7 | ||||
-rw-r--r-- | Build/source/texk/web2c/help.h | 12 | ||||
-rw-r--r-- | Build/source/texk/web2c/man/ChangeLog | 5 | ||||
-rw-r--r-- | Build/source/texk/web2c/man/tangle.man | 27 | ||||
-rw-r--r-- | Build/source/texk/web2c/man/weave.man | 12 | ||||
-rw-r--r-- | Build/source/texk/web2c/tangle.ch | 14 | ||||
-rw-r--r-- | Build/source/texk/web2c/tangleboot.pin | 12 | ||||
-rw-r--r-- | Build/source/texk/web2c/weave.ch | 14 |
8 files changed, 73 insertions, 30 deletions
diff --git a/Build/source/texk/web2c/ChangeLog b/Build/source/texk/web2c/ChangeLog index bda3e1954df..1a261304ffd 100644 --- a/Build/source/texk/web2c/ChangeLog +++ b/Build/source/texk/web2c/ChangeLog @@ -1,3 +1,10 @@ +2022-03-02 Andreas Scherer <https://ascherer.github.io> + + * help.h, + * tangle.ch, + * tangleboot.pin, + * weave.ch: Permit user-defined output file names. + 2022-02-24 Karl Berry <karl@freefriends.org> * dvitype.ch (scan_bop, [99]): output a newline between diff --git a/Build/source/texk/web2c/help.h b/Build/source/texk/web2c/help.h index c3146b58f44..821b00899d9 100644 --- a/Build/source/texk/web2c/help.h +++ b/Build/source/texk/web2c/help.h @@ -486,11 +486,13 @@ const_string PTFTOPLHELP[] = { #if defined (TANGLE) || defined (TANGLEBOOT) const_string TANGLEHELP[] = { - "Usage: tangle [OPTION]... WEBFILE[.web] [CHANGEFILE[.ch]]", + "Usage: tangle [OPTION] WEBFILE[.web] [{CHANGEFILE[.ch]|-} [OUTFILE[.p]]]", " Tangle WEBFILE with CHANGEFILE into a Pascal program.", " Default CHANGEFILE is " DEV_NULL ";", " Pascal output goes to the basename of WEBFILE extended with `.p',", - " and a string pool file, if necessary, to the same extended with `.pool'.", + " unless otherwise specified by OUTFILE,", + " and a string pool file, if necessary, to the same extended with `.pool';", + " in this case, '-' specifies a null CHANGEFILE.", "", "-length=NUMBER the first NUMBER characters of an identifier have to be", " unique (default 32)", @@ -627,10 +629,12 @@ const_string VPTOVFHELP[] = { #ifdef WEAVE const_string WEAVEHELP[] = { - "Usage: weave [OPTION]... WEBFILE[.web] [CHANGEFILE[.ch]]", + "Usage: weave [OPTION] WEBFILE[.web] [{CHANGEFILE[.ch]|-} [OUTFILE[.tex]]]", " Weave WEBFILE with CHANGEFILE into a TeX document.", " Default CHANGEFILE is " DEV_NULL ";", - " TeX output goes to the basename of WEBFILE extended with `.tex'.", + " TeX output goes to the basename of WEBFILE extended with `.tex',", + " unless otherwise specified by OUTFILE;", + " in this case, '-' specifies a null CHANGEFILE.", "", "-x omit cross-reference information", "-help display this help and exit", diff --git a/Build/source/texk/web2c/man/ChangeLog b/Build/source/texk/web2c/man/ChangeLog index 708354705c1..e864cde7b68 100644 --- a/Build/source/texk/web2c/man/ChangeLog +++ b/Build/source/texk/web2c/man/ChangeLog @@ -1,3 +1,8 @@ +2022-03-02 Andreas Scherer <https://ascherer.github.io> + + * tangle.man, + * weave.man: Describe the third file name on the commandline. + 2022-02-26 Karl Berry <karl@tug.org> * Makefile.am (web_man_sources): add twill.man. diff --git a/Build/source/texk/web2c/man/tangle.man b/Build/source/texk/web2c/man/tangle.man index 3b524db6da7..6f7411d85fd 100644 --- a/Build/source/texk/web2c/man/tangle.man +++ b/Build/source/texk/web2c/man/tangle.man @@ -1,4 +1,4 @@ -.TH TANGLE 1 "16 June 2015" "Web2C @VERSION@" +.TH TANGLE 1 "02 March 2022" "Web2C @VERSION@" .\"===================================================================== .if n .ds MF Metafont .if t .ds MF Metafont @@ -21,7 +21,12 @@ tangle \- translate WEB to Pascal .B tangle .RI [ options ] .IR webfile [ \fB.web\fP ] -.RI [ changefile [ \fB.ch\fP ]] +[ { +.IR changefile [ \fB.ch\fP ] +|\-} +[ +.IR outfile [ \fB.p\fP ] +] ] .\"===================================================================== .SH DESCRIPTION This manual page is not meant to be exhaustive. The complete @@ -47,23 +52,29 @@ familiar with both \*(TX and Pascal. \*(WB also provides a relatively simple, although adequate, macro facility that permits a Pascal program to be written in small easily-understood modules. .PP -The command line should have either one or two names on it. +The command line should have one, two or three names on it. The first is taken as the \*(WB file (and .B .web is added if there is no extension). -If there is another name, it is a change file (and +If there is second name, it is a change file (and .B .ch is added if there is no extension). The change file overrides parts of the \*(WB file, as described in the \*(WB system documentation. .PP -The output files are a Pascal file and a string pool file, -whose names are formed by adding +If there is a third name, it is the Pascal output file (and .B .p -and +is added if there is no extension). In this case you can specify an empty +change file with '-' as the second argument. +Otherwise the name of the Pascal file is formed by adding +.B .p +to the root of the \*(WB file name. +.PP +An optional second output file is a string pool file, +whose name is formed by adding .B .pool -respectively to the root of the \*(WB file name. +to the root of the \*(WB file name. .\"===================================================================== .SH "OPTIONS" This version of diff --git a/Build/source/texk/web2c/man/weave.man b/Build/source/texk/web2c/man/weave.man index eb6282656d8..295a78581e9 100644 --- a/Build/source/texk/web2c/man/weave.man +++ b/Build/source/texk/web2c/man/weave.man @@ -1,4 +1,4 @@ -.TH WEAVE 1 "09 January 2022" "Web2C @VERSION@" +.TH WEAVE 1 "02 March 2022" "Web2C @VERSION@" .\"===================================================================== .if n .ds MF Metafont .if t .ds MF Metafont @@ -21,7 +21,12 @@ weave \- translate WEB to TeX .B weave .RB [ \-x ] .IR webfile [ \fB.web\fP ] -.RI [ changefile [ \fB.ch\fP ]] +[ { +.IR changefile [ \fB.ch\fP ] +|\-} +[ +.IR outfile [ \fB.tex\fP ] +] ] .\"===================================================================== .SH DESCRIPTION This manual page is not meant to be exhaustive. The complete @@ -49,7 +54,8 @@ are redefined.) .PP The output \*(TX file name is formed by adding .B .tex -to the root of the \*(WB file name. +to the root of the \*(WB file name or from the third argument. +In this case you can specify '-' as an empty change file. .PP There are several macros that probably should be redefined by diff --git a/Build/source/texk/web2c/tangle.ch b/Build/source/texk/web2c/tangle.ch index b87fae1f50f..bcf78fe700c 100644 --- a/Build/source/texk/web2c/tangle.ch +++ b/Build/source/texk/web2c/tangle.ch @@ -727,19 +727,23 @@ begin until getopt_return_val = -1; {Now |optind| is the index of first non-option on the command line.} - if (optind + 1 <> argc) and (optind + 2 <> argc) then begin - write_ln (stderr, my_name, ': Need one or two file arguments.'); + if (optind + 1 > argc) or (optind + 3 < argc) then begin + write_ln (stderr, my_name, ': Need one to three file arguments.'); usage (my_name); end; {Supply |".web"| and |".ch"| extensions if necessary.} web_name := extend_filename (cmdline (optind), 'web'); - if optind + 2 = argc then begin - chg_name := extend_filename (cmdline (optind + 1), 'ch'); + if optind + 2 <= argc then begin + if strcmp(char_to_string('-'), cmdline (optind + 1)) <> 0 then + chg_name := extend_filename (cmdline (optind + 1), 'ch'); end; {Change |".web"| to |".p"| and use the current directory.} - pascal_name := basename_change_suffix (web_name, '.web', '.p'); + if optind + 3 = argc then + pascal_name := extend_filename (cmdline (optind + 2), char_to_string('p')) + else + pascal_name := basename_change_suffix (web_name, '.web', '.p'); end; @ Here are the options we allow. The first is one of the standard GNU options. diff --git a/Build/source/texk/web2c/tangleboot.pin b/Build/source/texk/web2c/tangleboot.pin index 29746a7a266..31eb05b511c 100644 --- a/Build/source/texk/web2c/tangleboot.pin +++ b/Build/source/texk/web2c/tangleboot.pin @@ -118,12 +118,14 @@ strictmode:=false; end else if(strcmp(longoptions[optionindex].name,'length')=0)then begin len:=atoi(optarg);if(len<=0)or(len>maxidlength)then len:=maxidlength; unambiglength:=len;end;until getoptreturnval=-1; -if(optind+1<>argc)and(optind+2<>argc)then begin writeln(stderr,'tangle', -': Need one or two file arguments.');usage('tangle');end; +if(optind+1>argc)or(optind+3<argc)then begin writeln(stderr,'tangle', +': Need one to three file arguments.');usage('tangle');end; webname:=extendfilename(cmdline(optind),'web'); -if optind+2=argc then begin chgname:=extendfilename(cmdline(optind+1), -'ch');end;pascalname:=basenamechangesuffix(webname,'.web','.p');end; -{:188}procedure initialize;var{16:}i:0..255;{:16}{41:}wi:0..2; +if optind+2<=argc then begin if strcmp(chartostring('-'),cmdline(optind ++1))<>0 then chgname:=extendfilename(cmdline(optind+1),'ch');end; +if optind+3=argc then pascalname:=extendfilename(cmdline(optind+2), +chartostring('p'))else pascalname:=basenamechangesuffix(webname,'.web', +'.p');end;{:188}procedure initialize;var{16:}i:0..255;{:16}{41:}wi:0..2; {:41}{45:}zi:0..4;{:45}{51:}h:0..hashsize; {:51}begin kpsesetprogramname(argv[0],'tangle');parsearguments; {10:}history:=0;{:10}{14:}xchr[32]:=' ';xchr[33]:='!';xchr[34]:='"'; diff --git a/Build/source/texk/web2c/weave.ch b/Build/source/texk/web2c/weave.ch index 73acd401381..1bd733bcc55 100644 --- a/Build/source/texk/web2c/weave.ch +++ b/Build/source/texk/web2c/weave.ch @@ -440,19 +440,23 @@ begin until getopt_return_val = -1; {Now |optind| is the index of first non-option on the command line.} - if (optind + 1 <> argc) and (optind + 2 <> argc) then begin - write_ln (stderr, my_name, ': Need one or two file arguments.'); + if (optind + 1 > argc) or (optind + 3 < argc) then begin + write_ln (stderr, my_name, ': Need one to three file arguments.'); usage (my_name); end; {Supply |".web"| and |".ch"| extensions if necessary.} web_name := extend_filename (cmdline (optind), 'web'); - if optind + 2 = argc then begin - chg_name := extend_filename (cmdline (optind + 1), 'ch'); + if optind + 2 <= argc then begin + if strcmp(char_to_string('-'), cmdline (optind + 1)) <> 0 then + chg_name := extend_filename (cmdline (optind + 1), 'ch'); end; {Change |".web"| to |".tex"| and use the current directory.} - tex_name := basename_change_suffix (web_name, '.web', '.tex'); + if optind + 3 = argc then + tex_name := extend_filename (cmdline (optind + 2), 'tex') + else + tex_name := basename_change_suffix (web_name, '.web', '.tex'); end; @ Here are the options we allow. The first is one of the standard GNU options. |