summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/l3kernel/l3sys.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/l3kernel/l3sys.dtx')
-rw-r--r--macros/latex/contrib/l3kernel/l3sys.dtx124
1 files changed, 87 insertions, 37 deletions
diff --git a/macros/latex/contrib/l3kernel/l3sys.dtx b/macros/latex/contrib/l3kernel/l3sys.dtx
index 2457024b1b..6125c76928 100644
--- a/macros/latex/contrib/l3kernel/l3sys.dtx
+++ b/macros/latex/contrib/l3kernel/l3sys.dtx
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2023-04-20}
+% \date{Released 2023-05-05}
%
% \maketitle
%
@@ -121,6 +121,27 @@
% \tn{fmtname}).
% \end{variable}
%
+% \begin{variable}[added = 2018-05-02]{\c_sys_engine_version_str}
+% The version string of the current engine, in the same form as
+% given in the banner issued when running a job. For \pdfTeX{}
+% and \LuaTeX{} this is of the form
+% \begin{quote}
+% \meta{major}.\meta{minor}.\meta{revision}
+% \end{quote}
+% For \XeTeX{}, the form is
+% \begin{quote}
+% \meta{major}.\meta{minor}
+% \end{quote}
+% For \pTeX{} and \upTeX{}, only releases since \TeX{} Live 2018
+% make the data available, and the form is more complex, as it comprises
+% the \pTeX{} version, the \upTeX{} version and the e-\pTeX{} version.
+% \begin{quote}
+% p\meta{major}.\meta{minor}.\meta{revision}-u\meta{major}.\meta{minor}^^A
+% -\meta{epTeX}
+% \end{quote}
+% where the |u| part is only present for \upTeX{}.
+% \end{variable}
+%
% \begin{function}[added = 2020-09-24, EXP]{\sys_timer:}
% \begin{syntax}
% \cs{sys_timer:}
@@ -472,18 +493,69 @@
% \end{macrocode}
% \end{variable}
%
-% \subsubsection{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{variable}{\c_sys_engine_version_str}
+% Various different engines, various different ways to extract the
+% data!
% \begin{macrocode}
-\@@_const:nn { sys_if_rand_exist }
- { \cs_if_exist_p:N \tex_uniformdeviate:D }
+\str_const:Nx \c_sys_engine_version_str
+ {
+ \str_case:on \c_sys_engine_str
+ {
+ { pdftex }
+ {
+ \int_div_truncate:nn { \tex_pdftexversion:D } { 100 }
+ .
+ \int_mod:nn { \tex_pdftexversion:D } { 100 }
+ .
+ \tex_pdftexrevision:D
+ }
+ { ptex }
+ {
+ \cs_if_exist:NT \tex_ptexversion:D
+ {
+ p
+ \int_use:N \tex_ptexversion:D
+ .
+ \int_use:N \tex_ptexminorversion:D
+ \tex_ptexrevision:D
+ -
+ \int_use:N \tex_epTeXversion:D
+ }
+ }
+ { luatex }
+ {
+ \int_div_truncate:nn { \tex_luatexversion:D } { 100 }
+ .
+ \int_mod:nn { \tex_luatexversion:D } { 100 }
+ .
+ \tex_luatexrevision:D
+ }
+ { uptex }
+ {
+ \cs_if_exist:NT \tex_ptexversion:D
+ {
+ p
+ \int_use:N \tex_ptexversion:D
+ .
+ \int_use:N \tex_ptexminorversion:D
+ \tex_ptexrevision:D
+ -
+ u
+ \int_use:N \tex_uptexversion:D
+ \tex_uptexrevision:D
+ -
+ \int_use:N \tex_epTeXversion:D
+ }
+ }
+ { xetex }
+ {
+ \int_use:N \tex_XeTeXversion:D
+ \tex_XeTeXrevision:D
+ }
+ }
+ }
% \end{macrocode}
-% \end{macro}
+% \end{variable}
%
% \subsubsection{Platform}
%
@@ -856,23 +928,11 @@ end
% \subsubsection{Random numbers}
%
% \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
-% expansions needed is the same as with random numbers available).
+% Unpack the primitive.
% \begin{macrocode}
\@@_everyjob:n
{
- \sys_if_rand_exist:TF
- { \cs_new:Npn \sys_rand_seed: { \tex_the:D \tex_randomseed:D } }
- {
- \cs_new:Npn \sys_rand_seed:
- {
- \int_value:w
- \msg_expandable_error:nnn { kernel } { fp-no-random }
- { \sys_rand_seed: }
- \c_zero_int
- }
- }
+ \cs_new:Npn \sys_rand_seed: { \tex_the:D \tex_randomseed:D }
}
% \end{macrocode}
% \end{macro}
@@ -882,18 +942,8 @@ end
% \begin{macrocode}
\@@_everyjob:n
{
- \sys_if_rand_exist:TF
- {
- \cs_new_protected:Npn \sys_gset_rand_seed:n #1
- { \tex_setrandomseed:D \int_eval:n {#1} \exp_stop_f: }
- }
- {
- \cs_new_protected:Npn \sys_gset_rand_seed:n #1
- {
- \msg_error:nnn { kernel } { fp-no-random }
- { \sys_gset_rand_seed:n {#1} }
- }
- }
+ \cs_new_protected:Npn \sys_gset_rand_seed:n #1
+ { \tex_setrandomseed:D \int_eval:n {#1} \exp_stop_f: }
}
% \end{macrocode}
% \end{macro}