texlive[62337] Build/source/texk/web2c: [WEB] Optional output file
commits+ascherer at tug.org
commits+ascherer at tug.org
Wed Mar 2 13:21:24 CET 2022
Revision: 62337
http://tug.org/svn/texlive?view=revision&revision=62337
Author: ascherer
Date: 2022-03-02 13:21:24 +0100 (Wed, 02 Mar 2022)
Log Message:
-----------
[WEB] Optional output file name.
The original WEB programs had fixed arguments on the commandline, i.e.,
you had to invoke TANGLE with four file name arguments and WEAVE with
three (where '/dev/null' was permitted as an empty file).
This change makes the WEB programs a little bit like the CWEB programs
by allowing an optional third file name argument for the main output
file (the name of the .pool file still is created from the .web file).
And '-' is interpreted as an empty change file.
Modified Paths:
--------------
trunk/Build/source/texk/web2c/ChangeLog
trunk/Build/source/texk/web2c/help.h
trunk/Build/source/texk/web2c/man/ChangeLog
trunk/Build/source/texk/web2c/man/tangle.man
trunk/Build/source/texk/web2c/man/weave.man
trunk/Build/source/texk/web2c/tangle.ch
trunk/Build/source/texk/web2c/tangleboot.pin
trunk/Build/source/texk/web2c/weave.ch
Modified: trunk/Build/source/texk/web2c/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/ChangeLog 2022-03-02 02:28:11 UTC (rev 62336)
+++ trunk/Build/source/texk/web2c/ChangeLog 2022-03-02 12:21:24 UTC (rev 62337)
@@ -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 at freefriends.org>
* dvitype.ch (scan_bop, [99]): output a newline between
Modified: trunk/Build/source/texk/web2c/help.h
===================================================================
--- trunk/Build/source/texk/web2c/help.h 2022-03-02 02:28:11 UTC (rev 62336)
+++ trunk/Build/source/texk/web2c/help.h 2022-03-02 12:21:24 UTC (rev 62337)
@@ -486,11 +486,13 @@
#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 @@
#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",
Modified: trunk/Build/source/texk/web2c/man/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/man/ChangeLog 2022-03-02 02:28:11 UTC (rev 62336)
+++ trunk/Build/source/texk/web2c/man/ChangeLog 2022-03-02 12:21:24 UTC (rev 62337)
@@ -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 at tug.org>
* Makefile.am (web_man_sources): add twill.man.
Modified: trunk/Build/source/texk/web2c/man/tangle.man
===================================================================
--- trunk/Build/source/texk/web2c/man/tangle.man 2022-03-02 02:28:11 UTC (rev 62336)
+++ trunk/Build/source/texk/web2c/man/tangle.man 2022-03-02 12:21:24 UTC (rev 62337)
@@ -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 @@
.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 @@
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
Modified: trunk/Build/source/texk/web2c/man/weave.man
===================================================================
--- trunk/Build/source/texk/web2c/man/weave.man 2022-03-02 02:28:11 UTC (rev 62336)
+++ trunk/Build/source/texk/web2c/man/weave.man 2022-03-02 12:21:24 UTC (rev 62337)
@@ -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 @@
.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 @@
.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
Modified: trunk/Build/source/texk/web2c/tangle.ch
===================================================================
--- trunk/Build/source/texk/web2c/tangle.ch 2022-03-02 02:28:11 UTC (rev 62336)
+++ trunk/Build/source/texk/web2c/tangle.ch 2022-03-02 12:21:24 UTC (rev 62337)
@@ -727,19 +727,23 @@
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.
Modified: trunk/Build/source/texk/web2c/tangleboot.pin
===================================================================
--- trunk/Build/source/texk/web2c/tangleboot.pin 2022-03-02 02:28:11 UTC (rev 62336)
+++ trunk/Build/source/texk/web2c/tangleboot.pin 2022-03-02 12:21:24 UTC (rev 62337)
@@ -118,12 +118,14 @@
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]:='"';
Modified: trunk/Build/source/texk/web2c/weave.ch
===================================================================
--- trunk/Build/source/texk/web2c/weave.ch 2022-03-02 02:28:11 UTC (rev 62336)
+++ trunk/Build/source/texk/web2c/weave.ch 2022-03-02 12:21:24 UTC (rev 62337)
@@ -440,19 +440,23 @@
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.
More information about the tex-live-commits
mailing list.