[latex3-commits] [git/LaTeX3-latex3-latex3] master: Add platform tests (8fac84d)

Unknown joseph.wright at morningstar2.co.uk
Thu Jul 26 09:28:14 CEST 2018


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

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

commit 8fac84d4aa4b686b72e1647a2951f928821e687d
Author: Unknown <joseph.wright at morningstar2.co.uk>
Date:   Thu Jul 26 08:28:14 2018 +0100

    Add platform tests


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

8fac84d4aa4b686b72e1647a2951f928821e687d
 l3kernel/CHANGELOG.md                   |    1 +
 l3kernel/l3candidates.dtx               |   73 +++++++++++++++++++++++++++++++
 l3kernel/testfiles/m3expl001.luatex.tlg |    9 ++++
 l3kernel/testfiles/m3expl001.ptex.tlg   |    9 ++++
 l3kernel/testfiles/m3expl001.tlg        |    9 ++++
 l3kernel/testfiles/m3expl001.uptex.tlg  |    9 ++++
 l3kernel/testfiles/m3expl001.xetex.tlg  |    9 ++++
 l3kernel/testfiles/m3expl003.luatex.tlg |    9 ++++
 l3kernel/testfiles/m3expl003.ptex.tlg   |    9 ++++
 l3kernel/testfiles/m3expl003.tlg        |    9 ++++
 l3kernel/testfiles/m3expl003.uptex.tlg  |    9 ++++
 l3kernel/testfiles/m3expl003.xetex.tlg  |    9 ++++
 12 files changed, 164 insertions(+)

diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index 298295f..1962b30 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -10,6 +10,7 @@ this project uses date-based 'snapshot' version identifiers.
 ## Added
 - `\lua_escape:e`, `\lua_now:e` and `\lua_shipout_e:n`
 - `\str_case_e:nn(TF)` and `\str_if_eq:ee(TF)`
+- `\sys_if_platform_unix:(TF)` and `\sys_if_platform_windows:(TF)`
 - `\tl_(g)set_from_shell:Nnn`
 
 ## Deprecated
diff --git a/l3kernel/l3candidates.dtx b/l3kernel/l3candidates.dtx
index 716f28d..b892874 100644
--- a/l3kernel/l3candidates.dtx
+++ b/l3kernel/l3candidates.dtx
@@ -892,6 +892,24 @@
 %   \end{texnote}
 % \end{function}
 %
+% \begin{function}[added = 2018-07-27, EXP, pTF]
+%   {
+%     \sys_if_platform_unix:,
+%     \sys_if_platform_windows:
+%   }
+%   \begin{syntax}
+%     \cs{sys_if_platform_unix:TF} \Arg{true code} \Arg{false code}
+%   \end{syntax}
+%   Conditionals which allow platform-specific code to be used. The names
+%   follow the \Lua{} |os.type()| function, \emph{i.e.}~all Unix-like systems
+%   are |unix| (including Linux and MacOS).
+% \end{function}
+%
+% \begin{variable}[added = 2018-07-27]{\c_sys_platform_str}
+%   The current platform given as a lower case string: one of
+%   |unix|, |windows| or |unknown|.
+% \end{variable}
+%
 % \begin{variable}[added = 2017-05-27]{\c_sys_shell_escape_int}
 %   This variable exposes the internal triple of the shell escape
 %   status.  The possible values are
@@ -2942,6 +2960,61 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{variable}{\c_sys_platform_str}
+% \begin{macro}[pTF]{\sys_if_platform_unix:}
+% \begin{macro}[pTF]{\sys_if_platform_windows:}
+%   Detecting the platform on \LuaTeX{} is easy: for other engines, we use
+%   the fact that the two common cases have special null files. It is possible
+%   to probe further (see package \pkg{platform}), but that requires shell
+%   escape and seems unlikely to be useful.
+%    \begin{macrocode}
+\sys_if_engine_luatex:TF
+  {
+    \str_const:Nx \c_sys_platform_str
+      { \lua_now:n { tex.print(os.type) } }
+  }
+  {
+    \file_if_exist:nTF { nul: }
+      {
+        \file_if_exist:nF { /dev/null }
+          { \str_const:Nn \c_sys_platform_str { windows } }
+      }
+      {
+        \file_if_exist:nT { /dev/null }
+          { \str_const:Nn \c_sys_platform_str { unix } }
+      }
+  }
+\cs_if_exist:NF \c_sys_platform_str
+  { \str_const:Nn \c_sys_platform_str { unknown }  }
+\cs_new_eq:NN \sys_if_platform_unix:T \use_none:n
+\cs_new_eq:NN \sys_if_platform_unix:F \use:n
+\cs_new_eq:NN \sys_if_platform_unix:TF \use_ii:nn
+\cs_new_eq:NN \sys_if_platform_unix_p: \c_false_bool
+\cs_new_eq:NN \sys_if_platform_windows:T \use_none:n
+\cs_new_eq:NN \sys_if_platform_windows:F \use:n
+\cs_new_eq:NN \sys_if_platform_windows:TF \use_ii:nn
+\cs_new_eq:NN \sys_if_platform_windows_p: \c_false_bool
+\str_if_eq:VnTF \c_sys_platform_str { unix }
+  {
+    \cs_set_eq:NN \sys_if_platform_unix:T \use:n
+    \cs_set_eq:NN \sys_if_platform_unix:F \use_none:n
+    \cs_set_eq:NN \sys_if_platform_unix:TF \use_i:nn
+    \cs_set_eq:NN \sys_if_platform_unix_p: \c_true_bool
+  }
+  {
+    \str_if_eq:VnT \c_sys_platform_str { windows }
+      {
+        \cs_set_eq:NN \sys_if_platform_windows:T \use:n
+        \cs_set_eq:NN \sys_if_platform_windows:F \use_none:n
+        \cs_set_eq:NN \sys_if_platform_windows:TF \use_i:nn
+        \cs_set_eq:NN \sys_if_platform_windows_p: \c_true_bool
+      }
+  }
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{variable}
+%
 % \subsection{Additions to \pkg{l3tl}}
 %
 %    \begin{macrocode}
diff --git a/l3kernel/testfiles/m3expl001.luatex.tlg b/l3kernel/testfiles/m3expl001.luatex.tlg
index a9d95a6..5a11e68 100644
--- a/l3kernel/testfiles/m3expl001.luatex.tlg
+++ b/l3kernel/testfiles/m3expl001.luatex.tlg
@@ -5841,6 +5841,15 @@ Defining \sys_shell_now:n on line ...
 Defining \sys_shell_now:x on line ...
 Defining \sys_shell_shipout:n on line ...
 Defining \sys_shell_shipout:x on line ...
+Defining \c_sys_platform_str on line ...
+Defining \sys_if_platform_unix:T on line ...
+Defining \sys_if_platform_unix:F on line ...
+Defining \sys_if_platform_unix:TF on line ...
+Defining \sys_if_platform_unix_p: on line ...
+Defining \sys_if_platform_windows:T on line ...
+Defining \sys_if_platform_windows:F on line ...
+Defining \sys_if_platform_windows:TF on line ...
+Defining \sys_if_platform_windows_p: on line ...
 Defining \tl_if_single_token_p:n on line ...
 Defining \tl_if_single_token:nT on line ...
 Defining \tl_if_single_token:nF on line ...
diff --git a/l3kernel/testfiles/m3expl001.ptex.tlg b/l3kernel/testfiles/m3expl001.ptex.tlg
index 3aa6bb2..08e28c1 100644
--- a/l3kernel/testfiles/m3expl001.ptex.tlg
+++ b/l3kernel/testfiles/m3expl001.ptex.tlg
@@ -5875,6 +5875,15 @@ Defining \sys_shell_now:n on line ...
 Defining \sys_shell_now:x on line ...
 Defining \sys_shell_shipout:n on line ...
 Defining \sys_shell_shipout:x on line ...
+Defining \c_sys_platform_str on line ...
+Defining \sys_if_platform_unix:T on line ...
+Defining \sys_if_platform_unix:F on line ...
+Defining \sys_if_platform_unix:TF on line ...
+Defining \sys_if_platform_unix_p: on line ...
+Defining \sys_if_platform_windows:T on line ...
+Defining \sys_if_platform_windows:F on line ...
+Defining \sys_if_platform_windows:TF on line ...
+Defining \sys_if_platform_windows_p: on line ...
 Defining \tl_if_single_token_p:n on line ...
 Defining \tl_if_single_token:nT on line ...
 Defining \tl_if_single_token:nF on line ...
diff --git a/l3kernel/testfiles/m3expl001.tlg b/l3kernel/testfiles/m3expl001.tlg
index c74803d..fdef654 100644
--- a/l3kernel/testfiles/m3expl001.tlg
+++ b/l3kernel/testfiles/m3expl001.tlg
@@ -5875,6 +5875,15 @@ Defining \sys_shell_now:n on line ...
 Defining \sys_shell_now:x on line ...
 Defining \sys_shell_shipout:n on line ...
 Defining \sys_shell_shipout:x on line ...
+Defining \c_sys_platform_str on line ...
+Defining \sys_if_platform_unix:T on line ...
+Defining \sys_if_platform_unix:F on line ...
+Defining \sys_if_platform_unix:TF on line ...
+Defining \sys_if_platform_unix_p: on line ...
+Defining \sys_if_platform_windows:T on line ...
+Defining \sys_if_platform_windows:F on line ...
+Defining \sys_if_platform_windows:TF on line ...
+Defining \sys_if_platform_windows_p: on line ...
 Defining \tl_if_single_token_p:n on line ...
 Defining \tl_if_single_token:nT on line ...
 Defining \tl_if_single_token:nF on line ...
diff --git a/l3kernel/testfiles/m3expl001.uptex.tlg b/l3kernel/testfiles/m3expl001.uptex.tlg
index 4a1e93a..d1a57f3 100644
--- a/l3kernel/testfiles/m3expl001.uptex.tlg
+++ b/l3kernel/testfiles/m3expl001.uptex.tlg
@@ -5872,6 +5872,15 @@ Defining \sys_shell_now:n on line ...
 Defining \sys_shell_now:x on line ...
 Defining \sys_shell_shipout:n on line ...
 Defining \sys_shell_shipout:x on line ...
+Defining \c_sys_platform_str on line ...
+Defining \sys_if_platform_unix:T on line ...
+Defining \sys_if_platform_unix:F on line ...
+Defining \sys_if_platform_unix:TF on line ...
+Defining \sys_if_platform_unix_p: on line ...
+Defining \sys_if_platform_windows:T on line ...
+Defining \sys_if_platform_windows:F on line ...
+Defining \sys_if_platform_windows:TF on line ...
+Defining \sys_if_platform_windows_p: on line ...
 Defining \tl_if_single_token_p:n on line ...
 Defining \tl_if_single_token:nT on line ...
 Defining \tl_if_single_token:nF on line ...
diff --git a/l3kernel/testfiles/m3expl001.xetex.tlg b/l3kernel/testfiles/m3expl001.xetex.tlg
index 479d9c9..1a16de0 100644
--- a/l3kernel/testfiles/m3expl001.xetex.tlg
+++ b/l3kernel/testfiles/m3expl001.xetex.tlg
@@ -5845,6 +5845,15 @@ Defining \sys_shell_now:n on line ...
 Defining \sys_shell_now:x on line ...
 Defining \sys_shell_shipout:n on line ...
 Defining \sys_shell_shipout:x on line ...
+Defining \c_sys_platform_str on line ...
+Defining \sys_if_platform_unix:T on line ...
+Defining \sys_if_platform_unix:F on line ...
+Defining \sys_if_platform_unix:TF on line ...
+Defining \sys_if_platform_unix_p: on line ...
+Defining \sys_if_platform_windows:T on line ...
+Defining \sys_if_platform_windows:F on line ...
+Defining \sys_if_platform_windows:TF on line ...
+Defining \sys_if_platform_windows_p: on line ...
 Defining \tl_if_single_token_p:n on line ...
 Defining \tl_if_single_token:nT on line ...
 Defining \tl_if_single_token:nF on line ...
diff --git a/l3kernel/testfiles/m3expl003.luatex.tlg b/l3kernel/testfiles/m3expl003.luatex.tlg
index a9d95a6..5a11e68 100644
--- a/l3kernel/testfiles/m3expl003.luatex.tlg
+++ b/l3kernel/testfiles/m3expl003.luatex.tlg
@@ -5841,6 +5841,15 @@ Defining \sys_shell_now:n on line ...
 Defining \sys_shell_now:x on line ...
 Defining \sys_shell_shipout:n on line ...
 Defining \sys_shell_shipout:x on line ...
+Defining \c_sys_platform_str on line ...
+Defining \sys_if_platform_unix:T on line ...
+Defining \sys_if_platform_unix:F on line ...
+Defining \sys_if_platform_unix:TF on line ...
+Defining \sys_if_platform_unix_p: on line ...
+Defining \sys_if_platform_windows:T on line ...
+Defining \sys_if_platform_windows:F on line ...
+Defining \sys_if_platform_windows:TF on line ...
+Defining \sys_if_platform_windows_p: on line ...
 Defining \tl_if_single_token_p:n on line ...
 Defining \tl_if_single_token:nT on line ...
 Defining \tl_if_single_token:nF on line ...
diff --git a/l3kernel/testfiles/m3expl003.ptex.tlg b/l3kernel/testfiles/m3expl003.ptex.tlg
index 3aa6bb2..08e28c1 100644
--- a/l3kernel/testfiles/m3expl003.ptex.tlg
+++ b/l3kernel/testfiles/m3expl003.ptex.tlg
@@ -5875,6 +5875,15 @@ Defining \sys_shell_now:n on line ...
 Defining \sys_shell_now:x on line ...
 Defining \sys_shell_shipout:n on line ...
 Defining \sys_shell_shipout:x on line ...
+Defining \c_sys_platform_str on line ...
+Defining \sys_if_platform_unix:T on line ...
+Defining \sys_if_platform_unix:F on line ...
+Defining \sys_if_platform_unix:TF on line ...
+Defining \sys_if_platform_unix_p: on line ...
+Defining \sys_if_platform_windows:T on line ...
+Defining \sys_if_platform_windows:F on line ...
+Defining \sys_if_platform_windows:TF on line ...
+Defining \sys_if_platform_windows_p: on line ...
 Defining \tl_if_single_token_p:n on line ...
 Defining \tl_if_single_token:nT on line ...
 Defining \tl_if_single_token:nF on line ...
diff --git a/l3kernel/testfiles/m3expl003.tlg b/l3kernel/testfiles/m3expl003.tlg
index c74803d..fdef654 100644
--- a/l3kernel/testfiles/m3expl003.tlg
+++ b/l3kernel/testfiles/m3expl003.tlg
@@ -5875,6 +5875,15 @@ Defining \sys_shell_now:n on line ...
 Defining \sys_shell_now:x on line ...
 Defining \sys_shell_shipout:n on line ...
 Defining \sys_shell_shipout:x on line ...
+Defining \c_sys_platform_str on line ...
+Defining \sys_if_platform_unix:T on line ...
+Defining \sys_if_platform_unix:F on line ...
+Defining \sys_if_platform_unix:TF on line ...
+Defining \sys_if_platform_unix_p: on line ...
+Defining \sys_if_platform_windows:T on line ...
+Defining \sys_if_platform_windows:F on line ...
+Defining \sys_if_platform_windows:TF on line ...
+Defining \sys_if_platform_windows_p: on line ...
 Defining \tl_if_single_token_p:n on line ...
 Defining \tl_if_single_token:nT on line ...
 Defining \tl_if_single_token:nF on line ...
diff --git a/l3kernel/testfiles/m3expl003.uptex.tlg b/l3kernel/testfiles/m3expl003.uptex.tlg
index 4a1e93a..d1a57f3 100644
--- a/l3kernel/testfiles/m3expl003.uptex.tlg
+++ b/l3kernel/testfiles/m3expl003.uptex.tlg
@@ -5872,6 +5872,15 @@ Defining \sys_shell_now:n on line ...
 Defining \sys_shell_now:x on line ...
 Defining \sys_shell_shipout:n on line ...
 Defining \sys_shell_shipout:x on line ...
+Defining \c_sys_platform_str on line ...
+Defining \sys_if_platform_unix:T on line ...
+Defining \sys_if_platform_unix:F on line ...
+Defining \sys_if_platform_unix:TF on line ...
+Defining \sys_if_platform_unix_p: on line ...
+Defining \sys_if_platform_windows:T on line ...
+Defining \sys_if_platform_windows:F on line ...
+Defining \sys_if_platform_windows:TF on line ...
+Defining \sys_if_platform_windows_p: on line ...
 Defining \tl_if_single_token_p:n on line ...
 Defining \tl_if_single_token:nT on line ...
 Defining \tl_if_single_token:nF on line ...
diff --git a/l3kernel/testfiles/m3expl003.xetex.tlg b/l3kernel/testfiles/m3expl003.xetex.tlg
index 479d9c9..1a16de0 100644
--- a/l3kernel/testfiles/m3expl003.xetex.tlg
+++ b/l3kernel/testfiles/m3expl003.xetex.tlg
@@ -5845,6 +5845,15 @@ Defining \sys_shell_now:n on line ...
 Defining \sys_shell_now:x on line ...
 Defining \sys_shell_shipout:n on line ...
 Defining \sys_shell_shipout:x on line ...
+Defining \c_sys_platform_str on line ...
+Defining \sys_if_platform_unix:T on line ...
+Defining \sys_if_platform_unix:F on line ...
+Defining \sys_if_platform_unix:TF on line ...
+Defining \sys_if_platform_unix_p: on line ...
+Defining \sys_if_platform_windows:T on line ...
+Defining \sys_if_platform_windows:F on line ...
+Defining \sys_if_platform_windows:TF on line ...
+Defining \sys_if_platform_windows_p: on line ...
 Defining \tl_if_single_token_p:n on line ...
 Defining \tl_if_single_token:nT on line ...
 Defining \tl_if_single_token:nF on line ...





More information about the latex3-commits mailing list