summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3file.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-01-14 22:06:37 +0000
committerKarl Berry <karl@freefriends.org>2019-01-14 22:06:37 +0000
commit6950156f10651c7d5f976001ab97f0e8e5bcffb4 (patch)
treeee684e58ee9234f7be1395c8bc17652828f5059d /Master/texmf-dist/source/latex/l3kernel/l3file.dtx
parent255e3d2ea38b32c1acf26bbb1e92c8ec562abdfc (diff)
l3kernel (14jan19)
git-svn-id: svn://tug.org/texlive/trunk@49704 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3file.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3file.dtx42
1 files changed, 37 insertions, 5 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx
index c6edd31bf4e..75130a10858 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx
@@ -42,7 +42,7 @@
% }^^A
% }
%
-% \date{Released 2019-01-12}
+% \date{Released 2019-01-13}
%
% \maketitle
%
@@ -978,7 +978,8 @@
% \begin{macro}{\@@_map_inline_loop:NNN}
% Mapping to an input stream can be done on either a token or a string
% basis, hence the set up. Within that, there is a check to avoid reading
-% past the end of a file, hence the two applications of \cs{ior_if_eof:N}.
+% past the end of a file, hence the two applications of \cs{ior_if_eof:N}
+% and its lower-level analogue \cs{if_eof:w}.
% This mapping cannot be nested with twice the same stream, as the
% stream has only one \enquote{current line}.
% \begin{macrocode}
@@ -1003,10 +1004,10 @@
{
#2 #3 \l_@@_internal_tl
\if_eof:w #3
- \exp_after:wN \use_none:nnnnnnn
+ \exp_after:wN \ior_map_break:
\fi:
- \exp_args:No #1 \l_@@_internal_tl
- \@@_map_inline_loop:NNN #1#2#3
+ \exp_args:No #1 \l_@@_internal_tl
+ \@@_map_inline_loop:NNN #1#2#3
}
% \end{macrocode}
% \end{macro}
@@ -1014,6 +1015,37 @@
% \end{macro}
% \end{macro}
%
+% \begin{macro}{\ior_map_variable:NNn, \ior_str_map_variable:NNn}
+% \begin{macro}{\@@_map_variable:NNNn}
+% \begin{macro}{\@@_map_variable_loop:NNNn}
+% Since the \TeX{} primitive (\tn{read} or \tn{readline}) assigns the
+% tokens read in the same way as a token list assignment, we simply
+% call the appropriate primitive. The end-of-loop is checked using
+% the primitive conditional for speed.
+% \begin{macrocode}
+\cs_new_protected:Npn \ior_map_variable:NNn
+ { \@@_map_variable:NNNn \ior_get:NN }
+\cs_new_protected:Npn \ior_str_map_variable:NNn
+ { \@@_map_variable:NNNn \ior_str_get:NN }
+\cs_new_protected:Npn \@@_map_variable:NNNn #1#2#3#4
+ {
+ \ior_if_eof:NF #2 { \@@_map_variable_loop:NNNn #1#2#3 {#4} }
+ \prg_break_point:Nn \ior_map_break: { }
+ }
+\cs_new_protected:Npn \@@_map_variable_loop:NNNn #1#2#3#4
+ {
+ #1 #2 #3
+ \if_eof:w #2
+ \exp_after:wN \ior_map_break:
+ \fi:
+ #4
+ \@@_map_variable_loop:NNNn #1#2#3 {#4}
+ }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
% \subsection{Output operations}
%
% \begin{macrocode}