texlive[53729] Build/source/texk/web2c: \input{...} now in all

commits+karl at tug.org commits+karl at tug.org
Sun Feb 9 20:12:24 CET 2020


Revision: 53729
          http://tug.org/svn/texlive?view=revision&revision=53729
Author:   karl
Date:     2020-02-09 20:12:24 +0100 (Sun, 09 Feb 2020)
Log Message:
-----------
\input{...} now in all engines

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/ChangeLog
    trunk/Build/source/texk/web2c/NEWS
    trunk/Build/source/texk/web2c/ptexdir/ChangeLog
    trunk/Build/source/texk/web2c/ptexdir/ptex-base.ch
    trunk/Build/source/texk/web2c/tex.ch

Modified: trunk/Build/source/texk/web2c/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/ChangeLog	2020-02-09 18:08:15 UTC (rev 53728)
+++ trunk/Build/source/texk/web2c/ChangeLog	2020-02-09 19:12:24 UTC (rev 53729)
@@ -1,3 +1,9 @@
+2020-02-09  Phelype Oleinik  <phe.h.o1 at gmail.com>
+
+	* tex.ch (29.256, scan_file_name): new procedure to implement
+	group-delimited filenames for \input.
+	* ptexdir/ptex-base.ch: extra end; needed.
+
 2020-02-01  Andreas Scherer  <https://ascherer.github.io>
 
 	* ctangleboot.cin: Regenerate after verbosity bugfix.

Modified: trunk/Build/source/texk/web2c/NEWS
===================================================================
--- trunk/Build/source/texk/web2c/NEWS	2020-02-09 18:08:15 UTC (rev 53728)
+++ trunk/Build/source/texk/web2c/NEWS	2020-02-09 19:12:24 UTC (rev 53729)
@@ -1,10 +1,23 @@
 This file records noteworthy changes.  (Public domain.)
 
 2020 (for TeX Live 2020)
+* \input now also accepts a group-delimited filename, e.g.,
+\input{foo.tex}. The usage with a standard space/token-delimited
+filename is completely unchanged.
+
+The group-delimited name was previously implemented in LuaTeX; now it is
+available in all engines. ASCII double quote characters (") are removed
+from the filename, but it is otherwise left unchanged after
+tokenization. This does not currently impact LaTeX's \input command, as
+that is a macro redefinition of the standard \input primitive.
+
 * New cross-engine option -cnf-line=STR.
+
 * All TeX engines except tex and etex now compress (with zlib) .fmt files
   (XeTeX and LuaTeX already did so).
 
+pTeX: new primitives \ifjfont and \iftfont.
+
 BibTeX: now reallocates on large (>20k) field values instead of aborting.
 
 


Modified: trunk/Build/source/texk/web2c/ptexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/ptexdir/ChangeLog	2020-02-09 18:08:15 UTC (rev 53728)
+++ trunk/Build/source/texk/web2c/ptexdir/ChangeLog	2020-02-09 19:12:24 UTC (rev 53729)
@@ -1,3 +1,8 @@
+2020-02-09  Phelype Oleinik  <phe.h.o1 at gmail.com>
+
+	* ptexdir/ptex-base.ch: extra end; needed for the scan_file_name
+	change in tex.ch.
+
 2020-02-09  Hironori Kitagawa  <h_kitagawa2001 at yahoo.co.jp>
 
 	* ptex-base.ch: forgot to set cur_val_level in fetching

Modified: trunk/Build/source/texk/web2c/ptexdir/ptex-base.ch
===================================================================
--- trunk/Build/source/texk/web2c/ptexdir/ptex-base.ch	2020-02-09 18:08:15 UTC (rev 53728)
+++ trunk/Build/source/texk/web2c/ptexdir/ptex-base.ch	2020-02-09 19:12:24 UTC (rev 53729)
@@ -2623,6 +2623,7 @@
   if not more_name(cur_chr) then goto done;
   get_x_token;
   end;
+  end;
 done: end_name; name_in_progress:=false;
 @y
 skip_mode:=false;
@@ -2641,6 +2642,7 @@
    else if ((cur_chr=" ") and (state<>token_list) and (loc>limit)) or not more_name(cur_chr) then goto done;
   get_x_token;
   end;
+  end;
 done: end_name; name_in_progress:=false;
 skip_mode:=true;
 @z

Modified: trunk/Build/source/texk/web2c/tex.ch
===================================================================
--- trunk/Build/source/texk/web2c/tex.ch	2020-02-09 18:08:15 UTC (rev 53728)
+++ trunk/Build/source/texk/web2c/tex.ch	2020-02-09 19:12:24 UTC (rev 53729)
@@ -1892,6 +1892,27 @@
   area_delimiter:=save_area_delimiter; ext_delimiter:=save_ext_delimiter;
 @z
 
+ at x [29.526] l.10193 - look for a left_brace when scanning a file name
+ at p procedure scan_file_name;
+label done;
+ at y
+ at p procedure scan_file_name;
+label done;
+var
+  @!save_warning_index: pointer;
+begin
+  save_warning_index := warning_index;
+  warning_index := cur_cs; {store |cur_cs| here to remember until later}
+  @<Get the next non-blank non-relax non-call...@>; {here the program expands
+    tokens and removes spaces and \.{\\relax}es from the input. The \.{\\relax}
+    removal follows LuaTeX''s implementation, and other cases of
+    balanced text scanning.}
+  back_input; {return the last token to be read by either code path}
+  if cur_cmd=left_brace then
+    scan_file_name_braced
+  else
+ at z
+
 @x [29.526] l.10194 - stop scanning file name if we're at end-of-line.
   if not more_name(cur_chr) then goto done;
 @y
@@ -1902,6 +1923,63 @@
   if not more_name(cur_chr) then goto done;
 @z
 
+ at x [29.526] l.10203 - scan a bgroup/egroup-delimited file name
+done: end_name; name_in_progress:=false;
+end;
+ at y
+  end;
+done: end_name; name_in_progress:=false;
+warning_index := save_warning_index; {restore |warning_index|}
+end;
+
+@ When |scan_file_name| starts it looks for a |left_brace|
+(skipping \.{\\relax}es, as other \.{\\toks}-like primitives).
+If a |left_brace| is found, then the procedure scans a file
+name contained in a balanced token list, expanding tokens as
+it goes. When the scanner finds the balanced token list, it
+is converted into a string and fed character-by-character to
+|more_name| to do its job the same as in the ``normal'' file
+name scanning.
+
+ at p procedure scan_file_name_braced;
+var
+  @!save_scanner_status: small_number; {|scanner_status| upon entry}
+  @!save_def_ref: pointer; {|def_ref| upon entry, important if inside `\.{\\message}}
+  @!save_cur_cs: pointer;
+  @!s: str_number; {temp string}
+  @!p: pointer; {temp pointer}
+  @!i: integer; {loop tally}
+  @!save_stop_at_space: boolean; {this should be in tex.ch}
+  @!dummy: boolean;
+    {Initialising}
+begin save_scanner_status := scanner_status; {|scan_toks| sets |scanner_status| to |absorbing|}
+  save_def_ref := def_ref; {|scan_toks| uses |def_ref| to point to the token list just read}
+  save_cur_cs := cur_cs; {we set |cur_cs| back a few tokens to use in runaway errors}
+    {Scanning a token list}
+  cur_cs := warning_index; {for possible runaway error}
+  {mimick |call_func| from pdfTeX}
+  if scan_toks(false, true) <> 0 then do_nothing; {actually do the scanning}
+  {s := tokens_to_string(def_ref);}
+  old_setting := selector; selector:=new_string;
+  show_token_list(link(def_ref),null,pool_size-pool_ptr);
+  selector := old_setting;
+  s := make_string;
+  {turns the token list read in a string to input}
+    {Restoring some variables}
+  delete_token_ref(def_ref); {remove the token list from memory}
+  def_ref := save_def_ref; {and restore |def_ref|}
+  cur_cs := save_cur_cs; {restore |cur_cs|}
+  scanner_status := save_scanner_status; {restore |scanner_status|}
+    {Passing the read string to the input machinery}
+  save_stop_at_space := stop_at_space; {save |stop_at_space|}
+  stop_at_space := false; {set |stop_at_space| to false to allow spaces in file names}
+  begin_name;
+  for i:=str_start[s] to str_start[s+1]-1 do
+    dummy := more_name(str_pool[i]); {add each read character to the current file name}
+  stop_at_space := save_stop_at_space; {restore |stop_at_space|}
+end;
+ at z
+
 @x [29.530] l.10245 - prompt_file_name: prevent empty filenames.
 var k:0..buf_size; {index into |buffer|}
 @y



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