[latex3-commits] [git/LaTeX3-latex3-latex3] master: Make \file_compare_timestamp:nNn(TF) expandable (eee2cf546)

Joseph Wright joseph.wright at morningstar2.co.uk
Fri Sep 20 21:51:01 CEST 2019


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

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

commit eee2cf5466b42065b18f565ffc388c060605ead2
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Fri Sep 20 20:51:01 2019 +0100

    Make \file_compare_timestamp:nNn(TF) expandable
    
    As \(pdf)filemoddate got added along with
    \(pdf)filesize, there is no case where we can run
    into an issue here.


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

eee2cf5466b42065b18f565ffc388c060605ead2
 l3kernel/l3candidates.dtx               | 87 ++++++++++++++++-----------------
 l3kernel/testfiles/m3expl001.luatex.tlg |  4 +-
 l3kernel/testfiles/m3expl001.ptex.tlg   |  4 +-
 l3kernel/testfiles/m3expl001.tlg        |  4 +-
 l3kernel/testfiles/m3expl001.uptex.tlg  |  4 +-
 l3kernel/testfiles/m3expl001.xetex.tlg  |  4 +-
 l3kernel/testfiles/m3expl003.luatex.tlg |  4 +-
 l3kernel/testfiles/m3expl003.ptex.tlg   |  4 +-
 l3kernel/testfiles/m3expl003.tlg        |  4 +-
 l3kernel/testfiles/m3expl003.uptex.tlg  |  4 +-
 l3kernel/testfiles/m3expl003.xetex.tlg  |  4 +-
 11 files changed, 61 insertions(+), 66 deletions(-)

diff --git a/l3kernel/l3candidates.dtx b/l3kernel/l3candidates.dtx
index bb92bc0df..c33eec9d2 100644
--- a/l3kernel/l3candidates.dtx
+++ b/l3kernel/l3candidates.dtx
@@ -267,14 +267,15 @@
 %
 % \section{Additions to \pkg{l3file}}
 %
-% \begin{function}[added = 2019-05-13, TF]{\file_compare_timestamp:nNn}
+% \begin{function}[added = 2019-05-13, updated = 2019-09-20, pTF, EXP]
+%   {\file_compare_timestamp:nNn}
 %   \begin{syntax}
 %     \cs{file_compare_timestamp:nNn} \Arg{file-1} \meta{comparator} \Arg{file-2} \Arg{true code} \Arg{false code}
 %   \end{syntax}
 %   Compares the file stamps on the two \meta{files} as indicated by
 %   the \meta{comparator}, and inserts either the \meta{true code}
 %   or \meta{false case} as required. A file which is not found
-%   is treated as older than any file which is found.This allows for
+%   is treated as older than any file which is found. This allows for
 %   example the construct
 %   \begin{verbatim}
 %     \file_compare_timestamp:nNnT { source-file } > { derived-file }
@@ -1653,57 +1654,51 @@
 % \end{macro}
 % \end{macro}
 %
-% \begin{variable}{\l_@@_first_tl, \l_@@_second_tl}
-%    \begin{macrocode}
-\tl_new:N \l_@@_first_tl
-\tl_new:N \l_@@_second_tl
-%    \end{macrocode}
-% \end{variable}
-%
-% \begin{macro}[TF]{\file_compare_timestamp:nNn}
+% \begin{macro}[EXP, pTF]{\file_compare_timestamp:nNn}
+% \begin{macro}[EXP]{\@@_compare_timestamp:nnN}
 % \begin{macro}[EXP]{\@@_timestamp:n}
 %   Comparison of file date can be done by using the low-level nature of the
-%   string comparison functions. This could be expandable but that would
-%   skip any file look-up: to stay consistent we retain that at the cost of
-%   expansion.
+%   string comparison functions.
 %    \begin{macrocode}
-\prg_new_protected_conditional:Npnn \file_compare_timestamp:nNn #1#2#3
-  { T , F , TF }
+\prg_new_conditional:Npnn \file_compare_timestamp:nNn #1#2#3
+  { p , T , F , TF }
   {
-    \group_begin:
-      \file_get_full_name:nNTF {#1} \l_@@_first_tl
-        {
-          \file_get_full_name:nNTF {#3} \l_@@_second_tl
-            {
-              \if_int_compare:w
-                  \@@_str_cmp:nn
-                    { \@@_timestamp:n \exp_after:wN { \l_@@_first_tl } }
-                    { \@@_timestamp:n \exp_after:wN { \l_@@_second_tl } }
-                    #2 0 \exp_stop_f:
-              \group_end:
+    \exp_args:Nee \@@_compare_timestamp:nnN
+      { \file_full_name:n {#1} }
+      { \file_full_name:n {#3} }
+      #2
+   }
+\cs_new:Npn \@@_compare_timestamp:nnN #1#2#3
+  {
+    \tl_if_blank:nTF {#1}
+      {
+        \if_charcode:w #3 <
+          \prg_return_true:
+        \else:
+          \prg_return_false:
+        \fi:
+      }
+      {
+        \tl_if_blank:nTF {#2}
+          {
+             \if_charcode:w #3 >
+                \prg_return_true:
+              \else:
+                \prg_return_false:
+              \fi:
+          }
+          {
+            \if_int_compare:w
+              \@@_str_cmp:nn
+                { \@@_timestamp:n {#1} }
+                { \@@_timestamp:n {#2} }
+                #3 0 \exp_stop_f:
               \prg_return_true:
             \else:
-              \group_end:
-               \prg_return_false:
+              \prg_return_false:
             \fi:
-            }
-            {
-              \group_end:
-               \if_charcode:w #2 >
-                  \prg_return_true:
-                \else:
-                  \prg_return_false:
-                \fi:
-            }
-        }
-        {
-          \group_end:
-          \if_charcode:w #2 <
-            \prg_return_true:
-          \else:
-            \prg_return_false:
-          \fi:
-        }
+          }
+      }
   }
 \sys_if_engine_luatex:TF
   {
diff --git a/l3kernel/testfiles/m3expl001.luatex.tlg b/l3kernel/testfiles/m3expl001.luatex.tlg
index 36b08f30b..871046f10 100644
--- a/l3kernel/testfiles/m3expl001.luatex.tlg
+++ b/l3kernel/testfiles/m3expl001.luatex.tlg
@@ -6524,11 +6524,11 @@ Defining \__seq_indexed_map:Nw on line ...
 Defining \c_sys_engine_version_str on line ...
 Defining \__file_str_cmp:nn on line ...
 Defining \__file_str_escape:n on line ...
-Defining \l__file_first_tl on line ...
-Defining \l__file_second_tl on line ...
+Defining \file_compare_timestamp_p:nNn on line ...
 Defining \file_compare_timestamp:nNnT on line ...
 Defining \file_compare_timestamp:nNnF on line ...
 Defining \file_compare_timestamp:nNnTF on line ...
+Defining \__file_compare_timestamp:nnN on line ...
 Defining \__file_timestamp:n on line ...
 Defining \ior_shell_open:Nn on line ...
 Defining \__ior_shell_open:nN on line ...
diff --git a/l3kernel/testfiles/m3expl001.ptex.tlg b/l3kernel/testfiles/m3expl001.ptex.tlg
index d167ed1d9..6165d9192 100644
--- a/l3kernel/testfiles/m3expl001.ptex.tlg
+++ b/l3kernel/testfiles/m3expl001.ptex.tlg
@@ -6519,11 +6519,11 @@ Defining \__seq_indexed_map:NN on line ...
 Defining \__seq_indexed_map:Nw on line ...
 Defining \c_sys_engine_version_str on line ...
 Defining \__file_str_cmp:nn on line ...
-Defining \l__file_first_tl on line ...
-Defining \l__file_second_tl on line ...
+Defining \file_compare_timestamp_p:nNn on line ...
 Defining \file_compare_timestamp:nNnT on line ...
 Defining \file_compare_timestamp:nNnF on line ...
 Defining \file_compare_timestamp:nNnTF on line ...
+Defining \__file_compare_timestamp:nnN on line ...
 Defining \__file_timestamp:n on line ...
 Defining \ior_shell_open:Nn on line ...
 Defining \__ior_shell_open:nN on line ...
diff --git a/l3kernel/testfiles/m3expl001.tlg b/l3kernel/testfiles/m3expl001.tlg
index 3c513ac6c..cb95ad96b 100644
--- a/l3kernel/testfiles/m3expl001.tlg
+++ b/l3kernel/testfiles/m3expl001.tlg
@@ -6519,11 +6519,11 @@ Defining \__seq_indexed_map:NN on line ...
 Defining \__seq_indexed_map:Nw on line ...
 Defining \c_sys_engine_version_str on line ...
 Defining \__file_str_cmp:nn on line ...
-Defining \l__file_first_tl on line ...
-Defining \l__file_second_tl on line ...
+Defining \file_compare_timestamp_p:nNn on line ...
 Defining \file_compare_timestamp:nNnT on line ...
 Defining \file_compare_timestamp:nNnF on line ...
 Defining \file_compare_timestamp:nNnTF on line ...
+Defining \__file_compare_timestamp:nnN on line ...
 Defining \__file_timestamp:n on line ...
 Defining \ior_shell_open:Nn on line ...
 Defining \__ior_shell_open:nN on line ...
diff --git a/l3kernel/testfiles/m3expl001.uptex.tlg b/l3kernel/testfiles/m3expl001.uptex.tlg
index bdb67adee..c2780c8b7 100644
--- a/l3kernel/testfiles/m3expl001.uptex.tlg
+++ b/l3kernel/testfiles/m3expl001.uptex.tlg
@@ -6515,11 +6515,11 @@ Defining \__seq_indexed_map:NN on line ...
 Defining \__seq_indexed_map:Nw on line ...
 Defining \c_sys_engine_version_str on line ...
 Defining \__file_str_cmp:nn on line ...
-Defining \l__file_first_tl on line ...
-Defining \l__file_second_tl on line ...
+Defining \file_compare_timestamp_p:nNn on line ...
 Defining \file_compare_timestamp:nNnT on line ...
 Defining \file_compare_timestamp:nNnF on line ...
 Defining \file_compare_timestamp:nNnTF on line ...
+Defining \__file_compare_timestamp:nnN on line ...
 Defining \__file_timestamp:n on line ...
 Defining \ior_shell_open:Nn on line ...
 Defining \__ior_shell_open:nN on line ...
diff --git a/l3kernel/testfiles/m3expl001.xetex.tlg b/l3kernel/testfiles/m3expl001.xetex.tlg
index 03be7bf6b..da24aac31 100644
--- a/l3kernel/testfiles/m3expl001.xetex.tlg
+++ b/l3kernel/testfiles/m3expl001.xetex.tlg
@@ -6523,11 +6523,11 @@ Defining \__seq_indexed_map:NN on line ...
 Defining \__seq_indexed_map:Nw on line ...
 Defining \c_sys_engine_version_str on line ...
 Defining \__file_str_cmp:nn on line ...
-Defining \l__file_first_tl on line ...
-Defining \l__file_second_tl on line ...
+Defining \file_compare_timestamp_p:nNn on line ...
 Defining \file_compare_timestamp:nNnT on line ...
 Defining \file_compare_timestamp:nNnF on line ...
 Defining \file_compare_timestamp:nNnTF on line ...
+Defining \__file_compare_timestamp:nnN on line ...
 Defining \__file_timestamp:n on line ...
 Defining \ior_shell_open:Nn on line ...
 Defining \__ior_shell_open:nN on line ...
diff --git a/l3kernel/testfiles/m3expl003.luatex.tlg b/l3kernel/testfiles/m3expl003.luatex.tlg
index 36b08f30b..871046f10 100644
--- a/l3kernel/testfiles/m3expl003.luatex.tlg
+++ b/l3kernel/testfiles/m3expl003.luatex.tlg
@@ -6524,11 +6524,11 @@ Defining \__seq_indexed_map:Nw on line ...
 Defining \c_sys_engine_version_str on line ...
 Defining \__file_str_cmp:nn on line ...
 Defining \__file_str_escape:n on line ...
-Defining \l__file_first_tl on line ...
-Defining \l__file_second_tl on line ...
+Defining \file_compare_timestamp_p:nNn on line ...
 Defining \file_compare_timestamp:nNnT on line ...
 Defining \file_compare_timestamp:nNnF on line ...
 Defining \file_compare_timestamp:nNnTF on line ...
+Defining \__file_compare_timestamp:nnN on line ...
 Defining \__file_timestamp:n on line ...
 Defining \ior_shell_open:Nn on line ...
 Defining \__ior_shell_open:nN on line ...
diff --git a/l3kernel/testfiles/m3expl003.ptex.tlg b/l3kernel/testfiles/m3expl003.ptex.tlg
index d167ed1d9..6165d9192 100644
--- a/l3kernel/testfiles/m3expl003.ptex.tlg
+++ b/l3kernel/testfiles/m3expl003.ptex.tlg
@@ -6519,11 +6519,11 @@ Defining \__seq_indexed_map:NN on line ...
 Defining \__seq_indexed_map:Nw on line ...
 Defining \c_sys_engine_version_str on line ...
 Defining \__file_str_cmp:nn on line ...
-Defining \l__file_first_tl on line ...
-Defining \l__file_second_tl on line ...
+Defining \file_compare_timestamp_p:nNn on line ...
 Defining \file_compare_timestamp:nNnT on line ...
 Defining \file_compare_timestamp:nNnF on line ...
 Defining \file_compare_timestamp:nNnTF on line ...
+Defining \__file_compare_timestamp:nnN on line ...
 Defining \__file_timestamp:n on line ...
 Defining \ior_shell_open:Nn on line ...
 Defining \__ior_shell_open:nN on line ...
diff --git a/l3kernel/testfiles/m3expl003.tlg b/l3kernel/testfiles/m3expl003.tlg
index 3c513ac6c..cb95ad96b 100644
--- a/l3kernel/testfiles/m3expl003.tlg
+++ b/l3kernel/testfiles/m3expl003.tlg
@@ -6519,11 +6519,11 @@ Defining \__seq_indexed_map:NN on line ...
 Defining \__seq_indexed_map:Nw on line ...
 Defining \c_sys_engine_version_str on line ...
 Defining \__file_str_cmp:nn on line ...
-Defining \l__file_first_tl on line ...
-Defining \l__file_second_tl on line ...
+Defining \file_compare_timestamp_p:nNn on line ...
 Defining \file_compare_timestamp:nNnT on line ...
 Defining \file_compare_timestamp:nNnF on line ...
 Defining \file_compare_timestamp:nNnTF on line ...
+Defining \__file_compare_timestamp:nnN on line ...
 Defining \__file_timestamp:n on line ...
 Defining \ior_shell_open:Nn on line ...
 Defining \__ior_shell_open:nN on line ...
diff --git a/l3kernel/testfiles/m3expl003.uptex.tlg b/l3kernel/testfiles/m3expl003.uptex.tlg
index bdb67adee..c2780c8b7 100644
--- a/l3kernel/testfiles/m3expl003.uptex.tlg
+++ b/l3kernel/testfiles/m3expl003.uptex.tlg
@@ -6515,11 +6515,11 @@ Defining \__seq_indexed_map:NN on line ...
 Defining \__seq_indexed_map:Nw on line ...
 Defining \c_sys_engine_version_str on line ...
 Defining \__file_str_cmp:nn on line ...
-Defining \l__file_first_tl on line ...
-Defining \l__file_second_tl on line ...
+Defining \file_compare_timestamp_p:nNn on line ...
 Defining \file_compare_timestamp:nNnT on line ...
 Defining \file_compare_timestamp:nNnF on line ...
 Defining \file_compare_timestamp:nNnTF on line ...
+Defining \__file_compare_timestamp:nnN on line ...
 Defining \__file_timestamp:n on line ...
 Defining \ior_shell_open:Nn on line ...
 Defining \__ior_shell_open:nN on line ...
diff --git a/l3kernel/testfiles/m3expl003.xetex.tlg b/l3kernel/testfiles/m3expl003.xetex.tlg
index 03be7bf6b..da24aac31 100644
--- a/l3kernel/testfiles/m3expl003.xetex.tlg
+++ b/l3kernel/testfiles/m3expl003.xetex.tlg
@@ -6523,11 +6523,11 @@ Defining \__seq_indexed_map:NN on line ...
 Defining \__seq_indexed_map:Nw on line ...
 Defining \c_sys_engine_version_str on line ...
 Defining \__file_str_cmp:nn on line ...
-Defining \l__file_first_tl on line ...
-Defining \l__file_second_tl on line ...
+Defining \file_compare_timestamp_p:nNn on line ...
 Defining \file_compare_timestamp:nNnT on line ...
 Defining \file_compare_timestamp:nNnF on line ...
 Defining \file_compare_timestamp:nNnTF on line ...
+Defining \__file_compare_timestamp:nnN on line ...
 Defining \__file_timestamp:n on line ...
 Defining \ior_shell_open:Nn on line ...
 Defining \__ior_shell_open:nN on line ...





More information about the latex3-commits mailing list