summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-02-09 19:12:24 +0000
committerKarl Berry <karl@freefriends.org>2020-02-09 19:12:24 +0000
commit3ee93d47be726d793d999ded2a3639849e322f3b (patch)
tree1cd8baf566b61f82e140da33c9f2590947863d52 /Build/source/texk/web2c
parent74e8e4418738294ea0affe93807e038ef5ac35ed (diff)
\input{...} now in all engines
git-svn-id: svn://tug.org/texlive/trunk@53729 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c')
-rw-r--r--Build/source/texk/web2c/ChangeLog6
-rw-r--r--Build/source/texk/web2c/NEWS13
-rw-r--r--Build/source/texk/web2c/ptexdir/ChangeLog5
-rw-r--r--Build/source/texk/web2c/ptexdir/ptex-base.ch2
-rw-r--r--Build/source/texk/web2c/tex.ch78
5 files changed, 104 insertions, 0 deletions
diff --git a/Build/source/texk/web2c/ChangeLog b/Build/source/texk/web2c/ChangeLog
index 5a9db2620d6..ca9b6b29d9a 100644
--- a/Build/source/texk/web2c/ChangeLog
+++ b/Build/source/texk/web2c/ChangeLog
@@ -1,3 +1,9 @@
+2020-02-09 Phelype Oleinik <phe.h.o1@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.
diff --git a/Build/source/texk/web2c/NEWS b/Build/source/texk/web2c/NEWS
index 87ee39a2a5e..abd45b33601 100644
--- a/Build/source/texk/web2c/NEWS
+++ b/Build/source/texk/web2c/NEWS
@@ -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.
diff --git a/Build/source/texk/web2c/ptexdir/ChangeLog b/Build/source/texk/web2c/ptexdir/ChangeLog
index 67e7e093d33..b80ac3052ed 100644
--- a/Build/source/texk/web2c/ptexdir/ChangeLog
+++ b/Build/source/texk/web2c/ptexdir/ChangeLog
@@ -1,3 +1,8 @@
+2020-02-09 Phelype Oleinik <phe.h.o1@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@yahoo.co.jp>
* ptex-base.ch: forgot to set cur_val_level in fetching
diff --git a/Build/source/texk/web2c/ptexdir/ptex-base.ch b/Build/source/texk/web2c/ptexdir/ptex-base.ch
index 56b85ce5486..fce669324f6 100644
--- a/Build/source/texk/web2c/ptexdir/ptex-base.ch
+++ b/Build/source/texk/web2c/ptexdir/ptex-base.ch
@@ -2623,6 +2623,7 @@ loop@+begin if (cur_cmd>other_char)or(cur_chr>255) then {not a character}
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 @@ loop@+begin
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
diff --git a/Build/source/texk/web2c/tex.ch b/Build/source/texk/web2c/tex.ch
index a45b99198c2..20c1d7dd986 100644
--- a/Build/source/texk/web2c/tex.ch
+++ b/Build/source/texk/web2c/tex.ch
@@ -1892,6 +1892,27 @@ begin if (pool_ptr+name_length>pool_size)or(str_ptr=max_strings)or
area_delimiter:=save_area_delimiter; ext_delimiter:=save_ext_delimiter;
@z
+@x [29.526] l.10193 - look for a left_brace when scanning a file name
+@p procedure scan_file_name;
+label done;
+@y
+@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
+@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 @@ begin if (pool_ptr+name_length>pool_size)or(str_ptr=max_strings)or
if not more_name(cur_chr) then goto done;
@z
+@x [29.526] l.10203 - scan a bgroup/egroup-delimited file name
+done: end_name; name_in_progress:=false;
+end;
+@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.
+
+@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;
+@z
+
@x [29.530] l.10245 - prompt_file_name: prevent empty filenames.
var k:0..buf_size; {index into |buffer|}
@y