summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/tangle.ch
diff options
context:
space:
mode:
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.