summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/web2c/ChangeLog6
-rw-r--r--Build/source/texk/web2c/cpascal.h1
-rw-r--r--Build/source/texk/web2c/man/ChangeLog4
-rw-r--r--Build/source/texk/web2c/man/tangle.man2
-rw-r--r--Build/source/texk/web2c/tangle.ch54
-rw-r--r--Build/source/texk/web2c/tangleboot.pin42
-rw-r--r--Build/source/texk/web2c/web2c/ChangeLog4
-rw-r--r--Build/source/texk/web2c/web2c/common.defines1
8 files changed, 72 insertions, 42 deletions
diff --git a/Build/source/texk/web2c/ChangeLog b/Build/source/texk/web2c/ChangeLog
index 1a261304ffd..15ce99f9290 100644
--- a/Build/source/texk/web2c/ChangeLog
+++ b/Build/source/texk/web2c/ChangeLog
@@ -1,3 +1,9 @@
+2022-03-03 Andreas Scherer <https://ascherer.github.io>
+
+ * cpascal.h,
+ * tangle.ch,
+ * tangleboot.pin: Always create pool file next to Pascal file.
+
2022-03-02 Andreas Scherer <https://ascherer.github.io>
* help.h,
diff --git a/Build/source/texk/web2c/cpascal.h b/Build/source/texk/web2c/cpascal.h
index ccebfc5f901..14f6e1be62b 100644
--- a/Build/source/texk/web2c/cpascal.h
+++ b/Build/source/texk/web2c/cpascal.h
@@ -285,6 +285,7 @@ typedef const unsigned char *const_w2custring;
#define kpsesrccompile kpse_src_compile
#define recorderchangefilename recorder_change_filename
#define recorderenabled recorder_enabled
+#define removesuffix remove_suffix
#define texmfyesno texmf_yesno
/* We need a new type for the argument parsing, too. */
diff --git a/Build/source/texk/web2c/man/ChangeLog b/Build/source/texk/web2c/man/ChangeLog
index e864cde7b68..6c591c67390 100644
--- a/Build/source/texk/web2c/man/ChangeLog
+++ b/Build/source/texk/web2c/man/ChangeLog
@@ -1,3 +1,7 @@
+2022-03-03 Andreas Scherer <https://ascherer.github.io>
+
+ * tangle.man: Clarify the creation of the pool file name.
+
2022-03-02 Andreas Scherer <https://ascherer.github.io>
* tangle.man,
diff --git a/Build/source/texk/web2c/man/tangle.man b/Build/source/texk/web2c/man/tangle.man
index 6f7411d85fd..d35e1c3eaa5 100644
--- a/Build/source/texk/web2c/man/tangle.man
+++ b/Build/source/texk/web2c/man/tangle.man
@@ -74,7 +74,7 @@ to the root of the \*(WB file name.
An optional second output file is a string pool file,
whose name is formed by adding
.B .pool
-to the root of the \*(WB file name.
+to the root of the Pascal file name.
.\"=====================================================================
.SH "OPTIONS"
This version of
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.
diff --git a/Build/source/texk/web2c/tangleboot.pin b/Build/source/texk/web2c/tangleboot.pin
index 31eb05b511c..e13c47fcdb0 100644
--- a/Build/source/texk/web2c/tangleboot.pin
+++ b/Build/source/texk/web2c/tangleboot.pin
@@ -45,9 +45,9 @@ scanninghex:boolean;{:143}{156:}nextcontrol:eightbits;
{:156}{164:}currepltext:textpointer;{:164}{171:}modulecount:0..12287;
{:171}{179:}{troubleshooting:boolean;ddt:integer;dd:integer;
debugcycle:integer;debugskipped:integer;}{:179}{185:}{wo:0..2;}
-{:185}{199:}webname,chgname,pascalname,poolname:constcstring;
+{:185}{200:}webname,chgname,pascalname,poolname:constcstring;
forceuppercase,forcelowercase,allowunderlines,strictmode:boolean;
-unambiglength:0..maxidlength;{:199}{30:}{procedure debughelp;forward;}
+unambiglength:0..maxidlength;{:200}{30:}{procedure debughelp;forward;}
{:30}{31:}procedure error;var j:0..outbufsize;k,l:0..bufsize;
begin if phaseone then{32:}begin if changing then write(stdout,
'. (change file ')else write(stdout,'. (');
@@ -64,37 +64,37 @@ write(stdout,'... ');end{:33};fflush(stdout);history:=2;
{:31}{188:}procedure parsearguments;const noptions=10;
var longoptions:array[0..noptions]of getoptstruct;
getoptreturnval:integer;optionindex:cinttype;currentoption:0..noptions;
-len:integer;begin{189:}currentoption:=0;
+len:integer;begin{190:}currentoption:=0;
longoptions[currentoption].name:='help';
longoptions[currentoption].hasarg:=0;longoptions[currentoption].flag:=0;
longoptions[currentoption].val:=0;currentoption:=currentoption+1;
-{:189}{190:}longoptions[currentoption].name:='version';
+{:190}{191:}longoptions[currentoption].name:='version';
longoptions[currentoption].hasarg:=0;longoptions[currentoption].flag:=0;
longoptions[currentoption].val:=0;currentoption:=currentoption+1;
-{:190}{191:}longoptions[currentoption].name:='mixedcase';
+{:191}{192:}longoptions[currentoption].name:='mixedcase';
longoptions[currentoption].hasarg:=0;longoptions[currentoption].flag:=0;
longoptions[currentoption].val:=0;currentoption:=currentoption+1;
-{:191}{192:}longoptions[currentoption].name:='uppercase';
+{:192}{193:}longoptions[currentoption].name:='uppercase';
longoptions[currentoption].hasarg:=0;longoptions[currentoption].flag:=0;
longoptions[currentoption].val:=0;currentoption:=currentoption+1;
-{:192}{193:}longoptions[currentoption].name:='lowercase';
+{:193}{194:}longoptions[currentoption].name:='lowercase';
longoptions[currentoption].hasarg:=0;longoptions[currentoption].flag:=0;
longoptions[currentoption].val:=0;currentoption:=currentoption+1;
-{:193}{194:}longoptions[currentoption].name:='underlines';
+{:194}{195:}longoptions[currentoption].name:='underlines';
longoptions[currentoption].hasarg:=0;longoptions[currentoption].flag:=0;
longoptions[currentoption].val:=0;currentoption:=currentoption+1;
-{:194}{195:}longoptions[currentoption].name:='strict';
+{:195}{196:}longoptions[currentoption].name:='strict';
longoptions[currentoption].hasarg:=0;longoptions[currentoption].flag:=0;
longoptions[currentoption].val:=0;currentoption:=currentoption+1;
-{:195}{196:}longoptions[currentoption].name:='loose';
+{:196}{197:}longoptions[currentoption].name:='loose';
longoptions[currentoption].hasarg:=0;longoptions[currentoption].flag:=0;
longoptions[currentoption].val:=0;currentoption:=currentoption+1;
-{:196}{197:}longoptions[currentoption].name:='length';
+{:197}{198:}longoptions[currentoption].name:='length';
longoptions[currentoption].hasarg:=1;longoptions[currentoption].flag:=0;
longoptions[currentoption].val:=0;currentoption:=currentoption+1;
-{:197}{198:}longoptions[currentoption].name:=0;
+{:198}{199:}longoptions[currentoption].name:=0;
longoptions[currentoption].hasarg:=0;longoptions[currentoption].flag:=0;
-longoptions[currentoption].val:=0;{:198};
+longoptions[currentoption].val:=0;{:199};
unambiglength:=defunambiglength;
repeat getoptreturnval:=getoptlongonly(argc,argv,'',longoptions,
addressof(optionindex));if getoptreturnval=-1 then begin;
@@ -118,14 +118,17 @@ 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)or(optind+3<argc)then begin writeln(stderr,'tangle',
-': Need one to three file arguments.');usage('tangle');end;
+{189:}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 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;
+if optind+3=argc then begin pascalname:=extendfilename(cmdline(optind+2)
+,chartostring('p'));
+poolname:=extendfilename(removesuffix(pascalname),'pool');
+end else begin pascalname:=basenamechangesuffix(webname,'.web','.p');
+poolname:=basenamechangesuffix(webname,'.web','.pool');end;{:189}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]:='"';
@@ -229,8 +232,7 @@ k:=k+1;i:=i+1;end;byteptr[w]:=k;bytestart[nameptr+3]:=k;
nameptr:=nameptr+1;
if buffer[idfirst]<>34 then ilk[p]:=t else{64:}begin ilk[p]:=1;
if l-doublechars=2 then equiv[p]:=buffer[idfirst+1]+1073741824 else
-begin if stringptr=256 then begin poolname:=basenamechangesuffix(webname
-,'.web','.pool');rewritebin(pool,poolname);end;
+begin if stringptr=256 then rewritebin(pool,poolname);
equiv[p]:=stringptr+1073741824;l:=l-doublechars-1;
if l>99 then begin writeln(stdout);
write(stdout,'! Preprocessed string is too long');error;end;
diff --git a/Build/source/texk/web2c/web2c/ChangeLog b/Build/source/texk/web2c/web2c/ChangeLog
index 0d1904d68a2..b6d6abd6dac 100644
--- a/Build/source/texk/web2c/web2c/ChangeLog
+++ b/Build/source/texk/web2c/web2c/ChangeLog
@@ -1,3 +1,7 @@
+2022-03-03 Andreas Scherer <https://ascherer.github.io>
+
+ * common.defines: Add 'removesuffix' declaration.
+
2022-01-17 Karl Berry <karl@freefriends.org>
* Makefile.am (web2c_DEPENDENCIES),
diff --git a/Build/source/texk/web2c/web2c/common.defines b/Build/source/texk/web2c/web2c/common.defines
index 47fcf57e690..4fbe25d4e56 100644
--- a/Build/source/texk/web2c/web2c/common.defines
+++ b/Build/source/texk/web2c/web2c/common.defines
@@ -141,6 +141,7 @@
@define function makesuffix ();
@define function odd ();
@define function ord ();
+@define function removesuffix ();
@define function round ();
@define function strcmp ();
@define function stringcast ();