[latex3-commits] [git/LaTeX3-latex3-latex3] master: Update `\ior_get:NN return value (see #538) (11793d3)

Joseph Wright joseph.wright at morningstar2.co.uk
Sun Feb 17 10:58:38 CET 2019


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/11793d343076739fb1b214ce82861d8254df76f8

>---------------------------------------------------------------

commit 11793d343076739fb1b214ce82861d8254df76f8
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Sun Feb 17 09:58:38 2019 +0000

    Update `\ior_get:NN return value (see #538)
    
    Also adds a TF variant.


>---------------------------------------------------------------

11793d343076739fb1b214ce82861d8254df76f8
 l3kernel/CHANGELOG.md                   |    5 ++--
 l3kernel/l3file.dtx                     |   45 ++++++++++++++++++++++++++-----
 l3kernel/testfiles/m3expl001.luatex.tlg |    8 ++++++
 l3kernel/testfiles/m3expl001.ptex.tlg   |    8 ++++++
 l3kernel/testfiles/m3expl001.tlg        |    8 ++++++
 l3kernel/testfiles/m3expl001.uptex.tlg  |    8 ++++++
 l3kernel/testfiles/m3expl001.xetex.tlg  |    8 ++++++
 l3kernel/testfiles/m3expl003.luatex.tlg |    8 ++++++
 l3kernel/testfiles/m3expl003.ptex.tlg   |    8 ++++++
 l3kernel/testfiles/m3expl003.tlg        |    8 ++++++
 l3kernel/testfiles/m3expl003.uptex.tlg  |    8 ++++++
 l3kernel/testfiles/m3expl003.xetex.tlg  |    8 ++++++
 12 files changed, 122 insertions(+), 8 deletions(-)

diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index 22356ab..a840813 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -10,11 +10,12 @@ this project uses date-based 'snapshot' version identifiers.
 ### Added
 
 - `\str_log:n`, `\str_log:N`
-- `TF` versions for `\file_get_...:nN` functions
+- `TF` versions for `\file_get_...:nN` and `\ior_(str_)get:NN` functions
 
 ### Changed
 
-- Return values from `\file_get:nnN`, `\file_get_...:nN`, `\sys_shell_get:nnN`
+- Return values from `\file_get:nnN`, `\file_get_...:nN`, \ior_get:NN\,
+  `\sys_shell_get:nnN`
 
 ## [2019-02-15]
 
diff --git a/l3kernel/l3file.dtx b/l3kernel/l3file.dtx
index 17a8399..1a747a2 100644
--- a/l3kernel/l3file.dtx
+++ b/l3kernel/l3file.dtx
@@ -164,9 +164,10 @@
 %
 % \subsection{Reading from files}
 %
-% \begin{function}[added = 2012-06-24]{\ior_get:NN}
+% \begin{function}[noTF, added = 2012-06-24, updated = 2019-02-17]{\ior_get:NN}
 %   \begin{syntax}
 %     \cs{ior_get:NN} \meta{stream} \meta{token list variable}
+%     \cs{ior_get:NNTF} \meta{stream} \meta{token list variable} \meta{true code} \meta{false code}
 %   \end{syntax}
 %   Function that reads one or more lines (until an equal number of left
 %   and right braces are found) from the input \meta{stream} and stores
@@ -191,6 +192,8 @@
 %   \end{verbatim}
 %   Also notice that if multiple lines are read to match braces
 %   then the resulting token list can contain \cs{par} tokens.
+%   In the non-branching version, where the file is not found the \meta{tl var}
+%   is set to |\q_no_value|.
 %   \begin{texnote}
 %     This protected macro is a wrapper around the \TeX{} primitive
 %     \tn{read}.  Regardless of settings, \TeX{} replaces trailing space
@@ -203,9 +206,11 @@
 %   \end{texnote}
 % \end{function}
 %
-% \begin{function}[added = 2016-12-04]{\ior_str_get:NN}
+% \begin{function}[noTF, added = 2016-12-04, updated = 2019-02-17]
+%   {\ior_str_get:NN}
 %   \begin{syntax}
 %     \cs{ior_str_get:NN} \meta{stream} \meta{token list variable}
+%     \cs{ior_str_get:NNTF} \meta{stream} \meta{token list variable} \meta{true code} \meta{false code}
 %   \end{syntax}
 %   Function that reads one line from the input \meta{stream} and stores
 %   the result locally in the \meta{token list} variable. If the
@@ -223,6 +228,8 @@
 %   \end{verbatim}
 %   results in a token list |a b  c| with the letters |a|, |b|, and |c|
 %   having category code~12.
+%   In the non-branching version, where the file is not found the \meta{tl var}
+%   is set to |\q_no_value|.
 %   \begin{texnote}
 %     This protected macro is a wrapper around the \eTeX{} primitive
 %     \tn{readline}.  Regardless of settings, \TeX{} removes trailing
@@ -955,19 +962,35 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\ior_get:NN}
+% \begin{macro}{\ior_get:NN, \@@_get:NN}
+% \begin{macro}[TF]{\ior_get:NN}
 %   And here we read from files.
 %    \begin{macrocode}
 \cs_new_protected:Npn \ior_get:NN #1#2
+  { \ior_get:NNF #1 #2 { \tl_set:Nn #2 { \q_no_value } } }
+\cs_new_protected:Npn \@@_get:NN #1#2
   { \tex_read:D #1 to #2 }
+\prg_new_protected_conditional:Npnn \ior_get:NN #1#2 { T , F , TF }
+  {
+    \ior_if_eof:NTF #1
+      { \prg_return_false: }
+      {
+        \@@_get:NN #1 #2
+        \prg_return_true:
+      }
+  }
 %    \end{macrocode}
 % \end{macro}
+% \end{macro}
 %
-% \begin{macro}{\ior_str_get:NN}
+% \begin{macro}{\ior_str_get:NN, \@@_str_get:NN}
+% \begin{macro}[TF]{\ior_str_get:NN}
 %   Reading as strings is a more complicated wrapper, as we wish to
 %   remove the endline character and restore it afterwards.
 %    \begin{macrocode}
 \cs_new_protected:Npn \ior_str_get:NN #1#2
+  { \ior_str_get:NNF #1 #2 { \tl_set:Nn #2 { \q_no_value } } }
+\cs_new_protected:Npn \@@_str_get:NN #1#2
   {
     \exp_args:Nno \use:n
       {
@@ -976,8 +999,18 @@
         \int_set:Nn \tex_endlinechar:D
       }   { \int_use:N \tex_endlinechar:D }
   }
+\prg_new_protected_conditional:Npnn \ior_str_get:NN #1#2 { T , F , TF }
+  {
+    \ior_if_eof:NTF #1
+      { \prg_return_false: }
+      {
+        \@@_str_get:NN #1 #2
+        \prg_return_true:
+      }
+  }
 %    \end{macrocode}
 % \end{macro}
+% \end{macro}
 %
 % \begin{macro}[EXP]{\ior_map_break:, \ior_map_break:n}
 %   Usual map breaking functions.
@@ -1001,9 +1034,9 @@
 %   stream has only one \enquote{current line}.
 %    \begin{macrocode}
 \cs_new_protected:Npn \ior_map_inline:Nn
-  { \@@_map_inline:NNn \ior_get:NN }
+  { \@@_map_inline:NNn \@@_get:NN }
 \cs_new_protected:Npn \ior_str_map_inline:Nn
-  { \@@_map_inline:NNn \ior_str_get:NN }
+  { \@@_map_inline:NNn \@@_str_get:NN }
 \cs_new_protected:Npn \@@_map_inline:NNn
   {
     \int_gincr:N \g__kernel_prg_map_int
diff --git a/l3kernel/testfiles/m3expl001.luatex.tlg b/l3kernel/testfiles/m3expl001.luatex.tlg
index d81ac48..f2ca952 100644
--- a/l3kernel/testfiles/m3expl001.luatex.tlg
+++ b/l3kernel/testfiles/m3expl001.luatex.tlg
@@ -2777,7 +2777,15 @@ Defining \ior_if_eof:NT on line ...
 Defining \ior_if_eof:NF on line ...
 Defining \ior_if_eof:NTF on line ...
 Defining \ior_get:NN on line ...
+Defining \__ior_get:NN on line ...
+Defining \ior_get:NNT on line ...
+Defining \ior_get:NNF on line ...
+Defining \ior_get:NNTF on line ...
 Defining \ior_str_get:NN on line ...
+Defining \__ior_str_get:NN on line ...
+Defining \ior_str_get:NNT on line ...
+Defining \ior_str_get:NNF on line ...
+Defining \ior_str_get:NNTF on line ...
 Defining \ior_map_break: on line ...
 Defining \ior_map_break:n on line ...
 Defining \ior_map_inline:Nn on line ...
diff --git a/l3kernel/testfiles/m3expl001.ptex.tlg b/l3kernel/testfiles/m3expl001.ptex.tlg
index e46023b..49c28b3 100644
--- a/l3kernel/testfiles/m3expl001.ptex.tlg
+++ b/l3kernel/testfiles/m3expl001.ptex.tlg
@@ -3070,7 +3070,15 @@ Defining \ior_if_eof:NT on line ...
 Defining \ior_if_eof:NF on line ...
 Defining \ior_if_eof:NTF on line ...
 Defining \ior_get:NN on line ...
+Defining \__ior_get:NN on line ...
+Defining \ior_get:NNT on line ...
+Defining \ior_get:NNF on line ...
+Defining \ior_get:NNTF on line ...
 Defining \ior_str_get:NN on line ...
+Defining \__ior_str_get:NN on line ...
+Defining \ior_str_get:NNT on line ...
+Defining \ior_str_get:NNF on line ...
+Defining \ior_str_get:NNTF on line ...
 Defining \ior_map_break: on line ...
 Defining \ior_map_break:n on line ...
 Defining \ior_map_inline:Nn on line ...
diff --git a/l3kernel/testfiles/m3expl001.tlg b/l3kernel/testfiles/m3expl001.tlg
index 1d9fe04..58a7ea4 100644
--- a/l3kernel/testfiles/m3expl001.tlg
+++ b/l3kernel/testfiles/m3expl001.tlg
@@ -3070,7 +3070,15 @@ Defining \ior_if_eof:NT on line ...
 Defining \ior_if_eof:NF on line ...
 Defining \ior_if_eof:NTF on line ...
 Defining \ior_get:NN on line ...
+Defining \__ior_get:NN on line ...
+Defining \ior_get:NNT on line ...
+Defining \ior_get:NNF on line ...
+Defining \ior_get:NNTF on line ...
 Defining \ior_str_get:NN on line ...
+Defining \__ior_str_get:NN on line ...
+Defining \ior_str_get:NNT on line ...
+Defining \ior_str_get:NNF on line ...
+Defining \ior_str_get:NNTF on line ...
 Defining \ior_map_break: on line ...
 Defining \ior_map_break:n on line ...
 Defining \ior_map_inline:Nn on line ...
diff --git a/l3kernel/testfiles/m3expl001.uptex.tlg b/l3kernel/testfiles/m3expl001.uptex.tlg
index bfe81ed..a3cad51 100644
--- a/l3kernel/testfiles/m3expl001.uptex.tlg
+++ b/l3kernel/testfiles/m3expl001.uptex.tlg
@@ -3070,7 +3070,15 @@ Defining \ior_if_eof:NT on line ...
 Defining \ior_if_eof:NF on line ...
 Defining \ior_if_eof:NTF on line ...
 Defining \ior_get:NN on line ...
+Defining \__ior_get:NN on line ...
+Defining \ior_get:NNT on line ...
+Defining \ior_get:NNF on line ...
+Defining \ior_get:NNTF on line ...
 Defining \ior_str_get:NN on line ...
+Defining \__ior_str_get:NN on line ...
+Defining \ior_str_get:NNT on line ...
+Defining \ior_str_get:NNF on line ...
+Defining \ior_str_get:NNTF on line ...
 Defining \ior_map_break: on line ...
 Defining \ior_map_break:n on line ...
 Defining \ior_map_inline:Nn on line ...
diff --git a/l3kernel/testfiles/m3expl001.xetex.tlg b/l3kernel/testfiles/m3expl001.xetex.tlg
index 350759c..9c4475c 100644
--- a/l3kernel/testfiles/m3expl001.xetex.tlg
+++ b/l3kernel/testfiles/m3expl001.xetex.tlg
@@ -2815,7 +2815,15 @@ Defining \ior_if_eof:NT on line ...
 Defining \ior_if_eof:NF on line ...
 Defining \ior_if_eof:NTF on line ...
 Defining \ior_get:NN on line ...
+Defining \__ior_get:NN on line ...
+Defining \ior_get:NNT on line ...
+Defining \ior_get:NNF on line ...
+Defining \ior_get:NNTF on line ...
 Defining \ior_str_get:NN on line ...
+Defining \__ior_str_get:NN on line ...
+Defining \ior_str_get:NNT on line ...
+Defining \ior_str_get:NNF on line ...
+Defining \ior_str_get:NNTF on line ...
 Defining \ior_map_break: on line ...
 Defining \ior_map_break:n on line ...
 Defining \ior_map_inline:Nn on line ...
diff --git a/l3kernel/testfiles/m3expl003.luatex.tlg b/l3kernel/testfiles/m3expl003.luatex.tlg
index d81ac48..f2ca952 100644
--- a/l3kernel/testfiles/m3expl003.luatex.tlg
+++ b/l3kernel/testfiles/m3expl003.luatex.tlg
@@ -2777,7 +2777,15 @@ Defining \ior_if_eof:NT on line ...
 Defining \ior_if_eof:NF on line ...
 Defining \ior_if_eof:NTF on line ...
 Defining \ior_get:NN on line ...
+Defining \__ior_get:NN on line ...
+Defining \ior_get:NNT on line ...
+Defining \ior_get:NNF on line ...
+Defining \ior_get:NNTF on line ...
 Defining \ior_str_get:NN on line ...
+Defining \__ior_str_get:NN on line ...
+Defining \ior_str_get:NNT on line ...
+Defining \ior_str_get:NNF on line ...
+Defining \ior_str_get:NNTF on line ...
 Defining \ior_map_break: on line ...
 Defining \ior_map_break:n on line ...
 Defining \ior_map_inline:Nn on line ...
diff --git a/l3kernel/testfiles/m3expl003.ptex.tlg b/l3kernel/testfiles/m3expl003.ptex.tlg
index e46023b..49c28b3 100644
--- a/l3kernel/testfiles/m3expl003.ptex.tlg
+++ b/l3kernel/testfiles/m3expl003.ptex.tlg
@@ -3070,7 +3070,15 @@ Defining \ior_if_eof:NT on line ...
 Defining \ior_if_eof:NF on line ...
 Defining \ior_if_eof:NTF on line ...
 Defining \ior_get:NN on line ...
+Defining \__ior_get:NN on line ...
+Defining \ior_get:NNT on line ...
+Defining \ior_get:NNF on line ...
+Defining \ior_get:NNTF on line ...
 Defining \ior_str_get:NN on line ...
+Defining \__ior_str_get:NN on line ...
+Defining \ior_str_get:NNT on line ...
+Defining \ior_str_get:NNF on line ...
+Defining \ior_str_get:NNTF on line ...
 Defining \ior_map_break: on line ...
 Defining \ior_map_break:n on line ...
 Defining \ior_map_inline:Nn on line ...
diff --git a/l3kernel/testfiles/m3expl003.tlg b/l3kernel/testfiles/m3expl003.tlg
index 1d9fe04..58a7ea4 100644
--- a/l3kernel/testfiles/m3expl003.tlg
+++ b/l3kernel/testfiles/m3expl003.tlg
@@ -3070,7 +3070,15 @@ Defining \ior_if_eof:NT on line ...
 Defining \ior_if_eof:NF on line ...
 Defining \ior_if_eof:NTF on line ...
 Defining \ior_get:NN on line ...
+Defining \__ior_get:NN on line ...
+Defining \ior_get:NNT on line ...
+Defining \ior_get:NNF on line ...
+Defining \ior_get:NNTF on line ...
 Defining \ior_str_get:NN on line ...
+Defining \__ior_str_get:NN on line ...
+Defining \ior_str_get:NNT on line ...
+Defining \ior_str_get:NNF on line ...
+Defining \ior_str_get:NNTF on line ...
 Defining \ior_map_break: on line ...
 Defining \ior_map_break:n on line ...
 Defining \ior_map_inline:Nn on line ...
diff --git a/l3kernel/testfiles/m3expl003.uptex.tlg b/l3kernel/testfiles/m3expl003.uptex.tlg
index bfe81ed..a3cad51 100644
--- a/l3kernel/testfiles/m3expl003.uptex.tlg
+++ b/l3kernel/testfiles/m3expl003.uptex.tlg
@@ -3070,7 +3070,15 @@ Defining \ior_if_eof:NT on line ...
 Defining \ior_if_eof:NF on line ...
 Defining \ior_if_eof:NTF on line ...
 Defining \ior_get:NN on line ...
+Defining \__ior_get:NN on line ...
+Defining \ior_get:NNT on line ...
+Defining \ior_get:NNF on line ...
+Defining \ior_get:NNTF on line ...
 Defining \ior_str_get:NN on line ...
+Defining \__ior_str_get:NN on line ...
+Defining \ior_str_get:NNT on line ...
+Defining \ior_str_get:NNF on line ...
+Defining \ior_str_get:NNTF on line ...
 Defining \ior_map_break: on line ...
 Defining \ior_map_break:n on line ...
 Defining \ior_map_inline:Nn on line ...
diff --git a/l3kernel/testfiles/m3expl003.xetex.tlg b/l3kernel/testfiles/m3expl003.xetex.tlg
index 350759c..9c4475c 100644
--- a/l3kernel/testfiles/m3expl003.xetex.tlg
+++ b/l3kernel/testfiles/m3expl003.xetex.tlg
@@ -2815,7 +2815,15 @@ Defining \ior_if_eof:NT on line ...
 Defining \ior_if_eof:NF on line ...
 Defining \ior_if_eof:NTF on line ...
 Defining \ior_get:NN on line ...
+Defining \__ior_get:NN on line ...
+Defining \ior_get:NNT on line ...
+Defining \ior_get:NNF on line ...
+Defining \ior_get:NNTF on line ...
 Defining \ior_str_get:NN on line ...
+Defining \__ior_str_get:NN on line ...
+Defining \ior_str_get:NNT on line ...
+Defining \ior_str_get:NNF on line ...
+Defining \ior_str_get:NNTF on line ...
 Defining \ior_map_break: on line ...
 Defining \ior_map_break:n on line ...
 Defining \ior_map_inline:Nn on line ...





More information about the latex3-commits mailing list