[latex3-commits] [git/LaTeX3-latex3-latex3] master: Move the code of a candidate sys function to l3sys (ccae8f1)
Bruno Le Floch
bruno at le-floch.fr
Sat May 5 13:26:36 CEST 2018
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/ccae8f1ba2164f0baf17a9316a88306dd1164f5a
>---------------------------------------------------------------
commit ccae8f1ba2164f0baf17a9316a88306dd1164f5a
Author: Bruno Le Floch <bruno at le-floch.fr>
Date: Sat May 5 13:26:36 2018 +0200
Move the code of a candidate sys function to l3sys
(to use it in l3fp-random instead of some more ad-hoc primitive
existence test).
>---------------------------------------------------------------
ccae8f1ba2164f0baf17a9316a88306dd1164f5a
l3kernel/l3candidates.dtx | 8 --------
l3kernel/l3fp-random.dtx | 14 ++++++--------
l3kernel/l3sys.dtx | 13 +++++++++++++
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 ++++----
13 files changed, 59 insertions(+), 56 deletions(-)
diff --git a/l3kernel/l3candidates.dtx b/l3kernel/l3candidates.dtx
index 6e46e26..4f95edb 100644
--- a/l3kernel/l3candidates.dtx
+++ b/l3kernel/l3candidates.dtx
@@ -2761,14 +2761,6 @@
% \end{macrocode}
% \end{variable}
%
-% \begin{macro}[EXP, pTF]{\sys_if_rand_exist:}
-% Currently, randomness exists under \pdfTeX{}, \LuaTeX{}, \pTeX{} and \upTeX{}.
-% \begin{macrocode}
-\@@_const:nn { sys_if_rand_exist }
- { \cs_if_exist_p:N \tex_uniformdeviate:D }
-% \end{macrocode}
-% \end{macro}
-%
% \begin{macro}[EXP]{\sys_rand_seed:}
% Unpack the primitive. When random numbers are not available, we
% return zero after an error (and incidentally make sure the number of
diff --git a/l3kernel/l3fp-random.dtx b/l3kernel/l3fp-random.dtx
index 1159e6c..3d34135 100644
--- a/l3kernel/l3fp-random.dtx
+++ b/l3kernel/l3fp-random.dtx
@@ -71,12 +71,10 @@
%
% \subsection{Engine support}
%
-% At present, \XeTeX{} does not provide random
-% numbers, while \pdfTeX{}, \LuaTeX{}, \pTeX{} and \upTeX{} provide the primitive
-% \cs{pdftex_uniformdeviate:D}. We write the test twice simply in
-% order to write the \texttt{false} branch first.
+% Most engines provide random numbers, but not all. We write the test
+% twice simply in order to write the \texttt{false} branch first.
% \begin{macrocode}
-\cs_if_exist:NF \tex_uniformdeviate:D
+\sys_if_rand_exist:F
{
\__kernel_msg_new:nnn { kernel } { fp-no-random }
{ Random~numbers~unavailable~for~#1 }
@@ -94,7 +92,7 @@
\int_eval:n {#1}
}
}
-\cs_if_exist:NT \tex_uniformdeviate:D
+\sys_if_rand_exist:T
{
% \end{macrocode}
%
@@ -105,12 +103,12 @@
% \c_@@_rand_four_int,
% \c_@@_rand_eight_int,
% }
-% The \cs{pdftex_uniformdeviate:D} primitive gives a pseudo-random
+% The \cs{tex_uniformdeviate:D} primitive gives a pseudo-random
% integer in a range $[0,n-1]$ of the user's choice. This number is
% meant to be uniformly distributed, but is produced by rescaling a
% uniform pseudo-random integer in $[0,2^{28}-1]$. For instance,
% setting~$n$ to (any multiple of) $2^{29}$ gives only even values.
-% Thus it is only safe to call \cs{pdftex_uniformdeviate:D} with
+% Thus it is only safe to call \cs{tex_uniformdeviate:D} with
% argument $2^{28}$. This integer is also used in the implementation
% of \cs{int_rand:nn}. We also use variants of this number
% rounded down to multiples of $10^4$ and $10^8$.
diff --git a/l3kernel/l3sys.dtx b/l3kernel/l3sys.dtx
index b3d0d3f..5789b3b 100644
--- a/l3kernel/l3sys.dtx
+++ b/l3kernel/l3sys.dtx
@@ -268,6 +268,19 @@
% \end{variable}
% \end{macro}
%
+% \subsection{Randomness}
+%
+% This candidate function is placed there because
+% \cs{sys_if_rand_exist:TF} is used in \pkg{l3fp-rand}.
+%
+% \begin{macro}[EXP, pTF]{\sys_if_rand_exist:}
+% Currently, randomness exists under \pdfTeX{}, \LuaTeX{}, \pTeX{} and \upTeX{}.
+% \begin{macrocode}
+\@@_const:nn { sys_if_rand_exist }
+ { \cs_if_exist_p:N \tex_uniformdeviate:D }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macrocode}
%</initex|package>
% \end{macrocode}
diff --git a/l3kernel/testfiles/m3expl001.luatex.tlg b/l3kernel/testfiles/m3expl001.luatex.tlg
index 750c3098..d1ac3cc 100644
--- a/l3kernel/testfiles/m3expl001.luatex.tlg
+++ b/l3kernel/testfiles/m3expl001.luatex.tlg
@@ -1681,6 +1681,10 @@ Defining \sys_if_output_pdf:T on line ...
Defining \sys_if_output_pdf:F on line ...
Defining \sys_if_output_pdf:TF on line ...
Defining \sys_if_output_pdf_p: on line ...
+Defining \sys_if_rand_exist:T on line ...
+Defining \sys_if_rand_exist:F on line ...
+Defining \sys_if_rand_exist:TF on line ...
+Defining \sys_if_rand_exist_p: on line ...
Defining \c_empty_clist on line ...
Defining \l__clist_internal_clist on line ...
Defining \__clist_tmp:w on line ...
@@ -5769,10 +5773,6 @@ Defining \__seq_indexed_map:NN on line ...
Defining \__seq_indexed_map:Nw on line ...
Defining \skip_split_finite_else_action:nnNN on line ...
Defining \c_sys_engine_version_str on line ...
-Defining \sys_if_rand_exist:T on line ...
-Defining \sys_if_rand_exist:F on line ...
-Defining \sys_if_rand_exist:TF on line ...
-Defining \sys_if_rand_exist_p: on line ...
Defining \sys_rand_seed: on line ...
Defining \sys_gset_rand_seed:n on line ...
Defining \c_sys_shell_escape_int on line ...
diff --git a/l3kernel/testfiles/m3expl001.ptex.tlg b/l3kernel/testfiles/m3expl001.ptex.tlg
index 6b03273..d565f92 100644
--- a/l3kernel/testfiles/m3expl001.ptex.tlg
+++ b/l3kernel/testfiles/m3expl001.ptex.tlg
@@ -1679,6 +1679,10 @@ Defining \sys_if_output_pdf:T on line ...
Defining \sys_if_output_pdf:F on line ...
Defining \sys_if_output_pdf:TF on line ...
Defining \sys_if_output_pdf_p: on line ...
+Defining \sys_if_rand_exist:T on line ...
+Defining \sys_if_rand_exist:F on line ...
+Defining \sys_if_rand_exist:TF on line ...
+Defining \sys_if_rand_exist_p: on line ...
Defining \c_empty_clist on line ...
Defining \l__clist_internal_clist on line ...
Defining \__clist_tmp:w on line ...
@@ -5762,10 +5766,6 @@ Defining \__seq_indexed_map:NN on line ...
Defining \__seq_indexed_map:Nw on line ...
Defining \skip_split_finite_else_action:nnNN on line ...
Defining \c_sys_engine_version_str on line ...
-Defining \sys_if_rand_exist:T on line ...
-Defining \sys_if_rand_exist:F on line ...
-Defining \sys_if_rand_exist:TF on line ...
-Defining \sys_if_rand_exist_p: on line ...
Defining \sys_rand_seed: on line ...
Defining \sys_gset_rand_seed:n on line ...
Defining \c_sys_shell_escape_int on line ...
diff --git a/l3kernel/testfiles/m3expl001.tlg b/l3kernel/testfiles/m3expl001.tlg
index d96ece1..17623c4 100644
--- a/l3kernel/testfiles/m3expl001.tlg
+++ b/l3kernel/testfiles/m3expl001.tlg
@@ -1679,6 +1679,10 @@ Defining \sys_if_output_pdf:T on line ...
Defining \sys_if_output_pdf:F on line ...
Defining \sys_if_output_pdf:TF on line ...
Defining \sys_if_output_pdf_p: on line ...
+Defining \sys_if_rand_exist:T on line ...
+Defining \sys_if_rand_exist:F on line ...
+Defining \sys_if_rand_exist:TF on line ...
+Defining \sys_if_rand_exist_p: on line ...
Defining \c_empty_clist on line ...
Defining \l__clist_internal_clist on line ...
Defining \__clist_tmp:w on line ...
@@ -5762,10 +5766,6 @@ Defining \__seq_indexed_map:NN on line ...
Defining \__seq_indexed_map:Nw on line ...
Defining \skip_split_finite_else_action:nnNN on line ...
Defining \c_sys_engine_version_str on line ...
-Defining \sys_if_rand_exist:T on line ...
-Defining \sys_if_rand_exist:F on line ...
-Defining \sys_if_rand_exist:TF on line ...
-Defining \sys_if_rand_exist_p: on line ...
Defining \sys_rand_seed: on line ...
Defining \sys_gset_rand_seed:n on line ...
Defining \c_sys_shell_escape_int on line ...
diff --git a/l3kernel/testfiles/m3expl001.uptex.tlg b/l3kernel/testfiles/m3expl001.uptex.tlg
index a82a63f..6335bdf 100644
--- a/l3kernel/testfiles/m3expl001.uptex.tlg
+++ b/l3kernel/testfiles/m3expl001.uptex.tlg
@@ -1679,6 +1679,10 @@ Defining \sys_if_output_pdf:T on line ...
Defining \sys_if_output_pdf:F on line ...
Defining \sys_if_output_pdf:TF on line ...
Defining \sys_if_output_pdf_p: on line ...
+Defining \sys_if_rand_exist:T on line ...
+Defining \sys_if_rand_exist:F on line ...
+Defining \sys_if_rand_exist:TF on line ...
+Defining \sys_if_rand_exist_p: on line ...
Defining \c_empty_clist on line ...
Defining \l__clist_internal_clist on line ...
Defining \__clist_tmp:w on line ...
@@ -5760,10 +5764,6 @@ Defining \__seq_indexed_map:NN on line ...
Defining \__seq_indexed_map:Nw on line ...
Defining \skip_split_finite_else_action:nnNN on line ...
Defining \c_sys_engine_version_str on line ...
-Defining \sys_if_rand_exist:T on line ...
-Defining \sys_if_rand_exist:F on line ...
-Defining \sys_if_rand_exist:TF on line ...
-Defining \sys_if_rand_exist_p: on line ...
Defining \sys_rand_seed: on line ...
Defining \sys_gset_rand_seed:n on line ...
Defining \c_sys_shell_escape_int on line ...
diff --git a/l3kernel/testfiles/m3expl001.xetex.tlg b/l3kernel/testfiles/m3expl001.xetex.tlg
index 0984f1f..e461b7a 100644
--- a/l3kernel/testfiles/m3expl001.xetex.tlg
+++ b/l3kernel/testfiles/m3expl001.xetex.tlg
@@ -1679,6 +1679,10 @@ Defining \sys_if_output_pdf:T on line ...
Defining \sys_if_output_pdf:F on line ...
Defining \sys_if_output_pdf:TF on line ...
Defining \sys_if_output_pdf_p: on line ...
+Defining \sys_if_rand_exist:T on line ...
+Defining \sys_if_rand_exist:F on line ...
+Defining \sys_if_rand_exist:TF on line ...
+Defining \sys_if_rand_exist_p: on line ...
Defining \c_empty_clist on line ...
Defining \l__clist_internal_clist on line ...
Defining \__clist_tmp:w on line ...
@@ -5735,10 +5739,6 @@ Defining \__seq_indexed_map:NN on line ...
Defining \__seq_indexed_map:Nw on line ...
Defining \skip_split_finite_else_action:nnNN on line ...
Defining \c_sys_engine_version_str on line ...
-Defining \sys_if_rand_exist:T on line ...
-Defining \sys_if_rand_exist:F on line ...
-Defining \sys_if_rand_exist:TF on line ...
-Defining \sys_if_rand_exist_p: on line ...
Defining \sys_rand_seed: on line ...
Defining \sys_gset_rand_seed:n on line ...
Defining \c_sys_shell_escape_int on line ...
diff --git a/l3kernel/testfiles/m3expl003.luatex.tlg b/l3kernel/testfiles/m3expl003.luatex.tlg
index 750c3098..d1ac3cc 100644
--- a/l3kernel/testfiles/m3expl003.luatex.tlg
+++ b/l3kernel/testfiles/m3expl003.luatex.tlg
@@ -1681,6 +1681,10 @@ Defining \sys_if_output_pdf:T on line ...
Defining \sys_if_output_pdf:F on line ...
Defining \sys_if_output_pdf:TF on line ...
Defining \sys_if_output_pdf_p: on line ...
+Defining \sys_if_rand_exist:T on line ...
+Defining \sys_if_rand_exist:F on line ...
+Defining \sys_if_rand_exist:TF on line ...
+Defining \sys_if_rand_exist_p: on line ...
Defining \c_empty_clist on line ...
Defining \l__clist_internal_clist on line ...
Defining \__clist_tmp:w on line ...
@@ -5769,10 +5773,6 @@ Defining \__seq_indexed_map:NN on line ...
Defining \__seq_indexed_map:Nw on line ...
Defining \skip_split_finite_else_action:nnNN on line ...
Defining \c_sys_engine_version_str on line ...
-Defining \sys_if_rand_exist:T on line ...
-Defining \sys_if_rand_exist:F on line ...
-Defining \sys_if_rand_exist:TF on line ...
-Defining \sys_if_rand_exist_p: on line ...
Defining \sys_rand_seed: on line ...
Defining \sys_gset_rand_seed:n on line ...
Defining \c_sys_shell_escape_int on line ...
diff --git a/l3kernel/testfiles/m3expl003.ptex.tlg b/l3kernel/testfiles/m3expl003.ptex.tlg
index 6b03273..d565f92 100644
--- a/l3kernel/testfiles/m3expl003.ptex.tlg
+++ b/l3kernel/testfiles/m3expl003.ptex.tlg
@@ -1679,6 +1679,10 @@ Defining \sys_if_output_pdf:T on line ...
Defining \sys_if_output_pdf:F on line ...
Defining \sys_if_output_pdf:TF on line ...
Defining \sys_if_output_pdf_p: on line ...
+Defining \sys_if_rand_exist:T on line ...
+Defining \sys_if_rand_exist:F on line ...
+Defining \sys_if_rand_exist:TF on line ...
+Defining \sys_if_rand_exist_p: on line ...
Defining \c_empty_clist on line ...
Defining \l__clist_internal_clist on line ...
Defining \__clist_tmp:w on line ...
@@ -5762,10 +5766,6 @@ Defining \__seq_indexed_map:NN on line ...
Defining \__seq_indexed_map:Nw on line ...
Defining \skip_split_finite_else_action:nnNN on line ...
Defining \c_sys_engine_version_str on line ...
-Defining \sys_if_rand_exist:T on line ...
-Defining \sys_if_rand_exist:F on line ...
-Defining \sys_if_rand_exist:TF on line ...
-Defining \sys_if_rand_exist_p: on line ...
Defining \sys_rand_seed: on line ...
Defining \sys_gset_rand_seed:n on line ...
Defining \c_sys_shell_escape_int on line ...
diff --git a/l3kernel/testfiles/m3expl003.tlg b/l3kernel/testfiles/m3expl003.tlg
index d96ece1..17623c4 100644
--- a/l3kernel/testfiles/m3expl003.tlg
+++ b/l3kernel/testfiles/m3expl003.tlg
@@ -1679,6 +1679,10 @@ Defining \sys_if_output_pdf:T on line ...
Defining \sys_if_output_pdf:F on line ...
Defining \sys_if_output_pdf:TF on line ...
Defining \sys_if_output_pdf_p: on line ...
+Defining \sys_if_rand_exist:T on line ...
+Defining \sys_if_rand_exist:F on line ...
+Defining \sys_if_rand_exist:TF on line ...
+Defining \sys_if_rand_exist_p: on line ...
Defining \c_empty_clist on line ...
Defining \l__clist_internal_clist on line ...
Defining \__clist_tmp:w on line ...
@@ -5762,10 +5766,6 @@ Defining \__seq_indexed_map:NN on line ...
Defining \__seq_indexed_map:Nw on line ...
Defining \skip_split_finite_else_action:nnNN on line ...
Defining \c_sys_engine_version_str on line ...
-Defining \sys_if_rand_exist:T on line ...
-Defining \sys_if_rand_exist:F on line ...
-Defining \sys_if_rand_exist:TF on line ...
-Defining \sys_if_rand_exist_p: on line ...
Defining \sys_rand_seed: on line ...
Defining \sys_gset_rand_seed:n on line ...
Defining \c_sys_shell_escape_int on line ...
diff --git a/l3kernel/testfiles/m3expl003.uptex.tlg b/l3kernel/testfiles/m3expl003.uptex.tlg
index a82a63f..6335bdf 100644
--- a/l3kernel/testfiles/m3expl003.uptex.tlg
+++ b/l3kernel/testfiles/m3expl003.uptex.tlg
@@ -1679,6 +1679,10 @@ Defining \sys_if_output_pdf:T on line ...
Defining \sys_if_output_pdf:F on line ...
Defining \sys_if_output_pdf:TF on line ...
Defining \sys_if_output_pdf_p: on line ...
+Defining \sys_if_rand_exist:T on line ...
+Defining \sys_if_rand_exist:F on line ...
+Defining \sys_if_rand_exist:TF on line ...
+Defining \sys_if_rand_exist_p: on line ...
Defining \c_empty_clist on line ...
Defining \l__clist_internal_clist on line ...
Defining \__clist_tmp:w on line ...
@@ -5760,10 +5764,6 @@ Defining \__seq_indexed_map:NN on line ...
Defining \__seq_indexed_map:Nw on line ...
Defining \skip_split_finite_else_action:nnNN on line ...
Defining \c_sys_engine_version_str on line ...
-Defining \sys_if_rand_exist:T on line ...
-Defining \sys_if_rand_exist:F on line ...
-Defining \sys_if_rand_exist:TF on line ...
-Defining \sys_if_rand_exist_p: on line ...
Defining \sys_rand_seed: on line ...
Defining \sys_gset_rand_seed:n on line ...
Defining \c_sys_shell_escape_int on line ...
diff --git a/l3kernel/testfiles/m3expl003.xetex.tlg b/l3kernel/testfiles/m3expl003.xetex.tlg
index 0984f1f..e461b7a 100644
--- a/l3kernel/testfiles/m3expl003.xetex.tlg
+++ b/l3kernel/testfiles/m3expl003.xetex.tlg
@@ -1679,6 +1679,10 @@ Defining \sys_if_output_pdf:T on line ...
Defining \sys_if_output_pdf:F on line ...
Defining \sys_if_output_pdf:TF on line ...
Defining \sys_if_output_pdf_p: on line ...
+Defining \sys_if_rand_exist:T on line ...
+Defining \sys_if_rand_exist:F on line ...
+Defining \sys_if_rand_exist:TF on line ...
+Defining \sys_if_rand_exist_p: on line ...
Defining \c_empty_clist on line ...
Defining \l__clist_internal_clist on line ...
Defining \__clist_tmp:w on line ...
@@ -5735,10 +5739,6 @@ Defining \__seq_indexed_map:NN on line ...
Defining \__seq_indexed_map:Nw on line ...
Defining \skip_split_finite_else_action:nnNN on line ...
Defining \c_sys_engine_version_str on line ...
-Defining \sys_if_rand_exist:T on line ...
-Defining \sys_if_rand_exist:F on line ...
-Defining \sys_if_rand_exist:TF on line ...
-Defining \sys_if_rand_exist_p: on line ...
Defining \sys_rand_seed: on line ...
Defining \sys_gset_rand_seed:n on line ...
Defining \c_sys_shell_escape_int on line ...
More information about the latex3-commits
mailing list