summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-05-28 21:24:36 +0000
committerKarl Berry <karl@freefriends.org>2019-05-28 21:24:36 +0000
commit0411921af7908fa9daf388b67db154e9fc51caca (patch)
treef5405f2fef2bc7b0ae9eb9c8809377b88d70c760 /Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx
parentc55b67ba30f320ddfc93fbdca08cab7512704011 (diff)
l3 (28may19)
git-svn-id: svn://tug.org/texlive/trunk@51248 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx119
1 files changed, 118 insertions, 1 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx
index 04ed6e0321e..de5a5011bb8 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx
@@ -44,7 +44,7 @@
% }^^A
% }
%
-% \date{Released 2019-05-09}
+% \date{Released 2019-05-28}
%
% \maketitle
%
@@ -299,6 +299,25 @@
%
% \section{Additions to \pkg{l3file}}
%
+% \begin{function}[added = 2019-05-13, TF]{\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
+% example the construct
+% \begin{verbatim}
+% \file_compare_timestamp:nNnT { source-file } > { derived-file }
+% {
+% % Code to regenerate derived file
+% }
+% \end{verbatim}
+% to work when the derived file is entirely absent. The timestamp
+% of two absent files is regarded as different.
+% \end{function}
+%
% \begin{function}[added = 2019-01-13]{\ior_map_variable:NNn}
% \begin{syntax}
% \cs{ior_map_variable:NNn} \meta{stream} \meta{tl~var} \Arg{code}
@@ -2346,6 +2365,104 @@
% \subsection{Additions to \pkg{l3file}}
%
% \begin{macrocode}
+%<@@=file>
+% \end{macrocode}
+%
+% \begin{macro}[EXP]{\@@_str_cmp:nn}
+% \begin{macro}[EXP]{\@@_str_escape:n}
+% As we are doing a fixed-length \enquote{big} integer comparison, it
+% is easiest to use the low-level behavior of string comparisons.
+% \begin{macrocode}
+\cs_new:Npn \@@_str_cmp:nn #1#2 { \tex_strcmp:D {#1} {#2} }
+\sys_if_engine_luatex:T
+ {
+ \cs_set:Npn \@@_str_cmp:nn #1#2
+ {
+ \lua_now:e
+ {
+ l3kernel.strcmp
+ (
+ " \@@_str_escape:n {#1}",
+ " \@@_str_escape:n {#2}"
+ )
+ }
+ }
+ \cs_new:Npn \@@_str_escape:n #1
+ {
+ \lua_escape:e
+ { \__kernel_tl_to_str:w \use:e { {#1} } }
+ }
+ }
+% \end{macrocode}
+% \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]{\@@_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.
+% \begin{macrocode}
+\prg_new_protected_conditional:Npnn \file_compare_timestamp:nNn #1#2#3
+ { 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:
+ \prg_return_true:
+ \else:
+ \group_end:
+ \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
+ {
+ \cs_new:Npn \@@_timestamp:n #1
+ {
+ \lua_now:e
+ { l3kernel.filemoddate ( " \lua_escape:e {#1} " ) }
+ }
+ }
+ { \cs_new_eq:NN \@@_timestamp:n \tex_filemoddate:D }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
%<@@=ior>
% \end{macrocode}
%