texlive[62367] Build/source/texk/web2c: [WEB] Always create the pool

commits+ascherer at tug.org commits+ascherer at tug.org
Thu Mar 3 17:21:45 CET 2022


Revision: 62367
          http://tug.org/svn/texlive?view=revision&revision=62367
Author:   ascherer
Date:     2022-03-03 17:21:45 +0100 (Thu, 03 Mar 2022)
Log Message:
-----------
[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.)

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/ChangeLog
    trunk/Build/source/texk/web2c/cpascal.h
    trunk/Build/source/texk/web2c/man/ChangeLog
    trunk/Build/source/texk/web2c/man/tangle.man
    trunk/Build/source/texk/web2c/tangle.ch
    trunk/Build/source/texk/web2c/tangleboot.pin
    trunk/Build/source/texk/web2c/web2c/ChangeLog
    trunk/Build/source/texk/web2c/web2c/common.defines

Modified: trunk/Build/source/texk/web2c/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/ChangeLog	2022-03-03 14:30:56 UTC (rev 62366)
+++ trunk/Build/source/texk/web2c/ChangeLog	2022-03-03 16:21:45 UTC (rev 62367)
@@ -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,

Modified: trunk/Build/source/texk/web2c/cpascal.h
===================================================================
--- trunk/Build/source/texk/web2c/cpascal.h	2022-03-03 14:30:56 UTC (rev 62366)
+++ trunk/Build/source/texk/web2c/cpascal.h	2022-03-03 16:21:45 UTC (rev 62367)
@@ -285,6 +285,7 @@
 #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.  */

Modified: trunk/Build/source/texk/web2c/man/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/man/ChangeLog	2022-03-03 14:30:56 UTC (rev 62366)
+++ trunk/Build/source/texk/web2c/man/ChangeLog	2022-03-03 16:21:45 UTC (rev 62367)
@@ -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,

Modified: trunk/Build/source/texk/web2c/man/tangle.man
===================================================================
--- trunk/Build/source/texk/web2c/man/tangle.man	2022-03-03 14:30:56 UTC (rev 62366)
+++ trunk/Build/source/texk/web2c/man/tangle.man	2022-03-03 16:21:45 UTC (rev 62367)
@@ -74,7 +74,7 @@
 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

Modified: trunk/Build/source/texk/web2c/tangle.ch
===================================================================
--- trunk/Build/source/texk/web2c/tangle.ch	2022-03-03 14:30:56 UTC (rev 62366)
+++ trunk/Build/source/texk/web2c/tangle.ch	2022-03-03 16:21:45 UTC (rev 62367)
@@ -177,6 +177,12 @@
 @z
 
 @x [26] Open output files (except for the pool file).
+@ The following code opens |Pascal_file| and |pool|.
+ at y
+@ The following code opens |Pascal_file|. Opening |pool| will be deferred
+until section~\&{64}.
+ at z
+ at x
 rewrite(Pascal_file); rewrite(pool);
 @y
 rewrite (Pascal_file, pascal_name);
@@ -313,11 +319,7 @@
   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,26 +728,36 @@
     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.
 
-  {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');
+@<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;
+
+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.
 @.-help@>
 

Modified: trunk/Build/source/texk/web2c/tangleboot.pin
===================================================================
--- trunk/Build/source/texk/web2c/tangleboot.pin	2022-03-03 14:30:56 UTC (rev 62366)
+++ trunk/Build/source/texk/web2c/tangleboot.pin	2022-03-03 16:21:45 UTC (rev 62367)
@@ -45,9 +45,9 @@
 {: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 @@
 {: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 @@
 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 @@
 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;

Modified: trunk/Build/source/texk/web2c/web2c/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/web2c/ChangeLog	2022-03-03 14:30:56 UTC (rev 62366)
+++ trunk/Build/source/texk/web2c/web2c/ChangeLog	2022-03-03 16:21:45 UTC (rev 62367)
@@ -1,3 +1,7 @@
+2022-03-03  Andreas Scherer  <https://ascherer.github.io>
+
+	* common.defines: Add 'removesuffix' declaration.
+
 2022-01-17  Karl Berry  <karl at freefriends.org>
 
 	* Makefile.am (web2c_DEPENDENCIES),

Modified: trunk/Build/source/texk/web2c/web2c/common.defines
===================================================================
--- trunk/Build/source/texk/web2c/web2c/common.defines	2022-03-03 14:30:56 UTC (rev 62366)
+++ trunk/Build/source/texk/web2c/web2c/common.defines	2022-03-03 16:21:45 UTC (rev 62367)
@@ -141,6 +141,7 @@
 @define function makesuffix ();
 @define function odd ();
 @define function ord ();
+ at define function removesuffix ();
 @define function round ();
 @define function strcmp ();
 @define function stringcast ();



More information about the tex-live-commits mailing list.