summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/tangle.ch
diff options
context:
space:
mode:
authorAndreas Scherer <andreas_tex@freenet.de>2022-03-03 16:21:45 +0000
committerAndreas Scherer <andreas_tex@freenet.de>2022-03-03 16:21:45 +0000
commitd1a3abe6e9644abcdaacf5efcec775d4bbf11297 (patch)
tree72b1fc8febd5dcbfd8d757e934843b0c9cb3300e /Build/source/texk/web2c/tangle.ch
parente6e209ef65c46908ad1cd49185ddb5e13f051b8f (diff)
[WEB] Always create the pool file next to the Pascal file.
If TANGLE creates a pool file at all, this will always be placed next to the Pascal file, irrespective whether a full output path was specified for the third file argument on the commandline. (If no Pascal file name is given, both the Pascal output file and the associated pool file will be created in the 'current' directory, with names derived from the Web input file.) git-svn-id: svn://tug.org/texlive/trunk@62367 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/tangle.ch')
-rw-r--r--Build/source/texk/web2c/tangle.ch54
1 files changed, 33 insertions, 21 deletions
diff --git a/Build/source/texk/web2c/tangle.ch b/Build/source/texk/web2c/tangle.ch
index bcf78fe700c..abd35170dd0 100644
--- a/Build/source/texk/web2c/tangle.ch
+++ b/Build/source/texk/web2c/tangle.ch
@@ -177,6 +177,12 @@ if chg_name then change_file := kpse_open_file(chg_name, kpse_web_format);
@z
@x [26] Open output files (except for the pool file).
+@ The following code opens |Pascal_file| and |pool|.
+@y
+@ The following code opens |Pascal_file|. Opening |pool| will be deferred
+until section~\&{64}.
+@z
+@x
rewrite(Pascal_file); rewrite(pool);
@y
rewrite (Pascal_file, pascal_name);
@@ -313,11 +319,7 @@ if l-double_chars=2 then {this string is for a single character}
equiv[p]:=buffer[id_first+1]+@'10000000000
else begin
{Avoid creating empty pool files.}
- if string_ptr = 256 then begin
- {Change |".web"| to |".pool"| and use the current directory.}
- pool_name := basename_change_suffix (web_name, '.web', '.pool');
- rewritebin (pool, pool_name);
- end;
+ if string_ptr = 256 then rewritebin (pool, pool_name);
equiv[p]:=string_ptr+@'10000000000;
l:=l-double_chars-1;
@z
@@ -726,24 +728,34 @@ begin
end; {Else it was a flag; |getopt| has already done the assignment.}
until getopt_return_val = -1;
- {Now |optind| is the index of first non-option on the command line.}
- 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;
+ @<Handle file name arguments@>@;
+end;
- {Supply |".web"| and |".ch"| extensions if necessary.}
- web_name := extend_filename (cmdline (optind), 'web');
- 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;
+@ Now |optind| is the index of first non-option on the command line.
+
+@<Handle file name...@>=
+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
+ {|'-'| is shortcut for an empty changefile.}
+ 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.}
- 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');
+if optind + 3 = argc then begin
+ {User has provided an explicit Pascal output file, possibly with path.}
+ pascal_name := extend_filename (cmdline (optind + 2), char_to_string('p'));
+ pool_name := extend_filename (remove_suffix (pascal_name), 'pool');
+end
+else begin
+ {Change |".web"| to |".p"| and |".pool"| and use the current directory.}
+ pascal_name := basename_change_suffix (web_name, '.web', '.p');
+ pool_name := basename_change_suffix (web_name, '.web', '.pool');
end;
@ Here are the options we allow. The first is one of the standard GNU options.