[latex3-commits] [git/LaTeX3-latex3-latex3] master: Add \c_sys_engine_version_str (39cb3fa)

Bruno Le Floch blflatex at gmail.com
Wed May 2 23:20:26 CEST 2018


Just a quick comment: \fp_eval:n { round(...,2) } will give fewer than 2
digits after the decimal point in case the results ends with zero.  For
instance \fp_eval:n { round(0.199,2) } gives 0.2 while \fp_eval:n {
round(0.999, 2) } gives 1 without even a period.

We only have some l3trial code for fp formatting.

On 05/02/2018 11:10 PM, Joseph Wright wrote:
> Repository : https://github.com/latex3/latex3
> On branch  : master
> Link       : https://github.com/latex3/latex3/commit/39cb3fa6e8fafc175f0b579fa2e76fdeb26f9c7d
> 
>> ---------------------------------------------------------------
> 
> commit 39cb3fa6e8fafc175f0b579fa2e76fdeb26f9c7d
> Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
> Date:   Wed May 2 22:10:00 2018 +0100
> 
>     Add \c_sys_engine_version_str
>     
>     Thoughts on the nature of the string welcome!
> 
> 
>> ---------------------------------------------------------------
> 
> 39cb3fa6e8fafc175f0b579fa2e76fdeb26f9c7d
>  l3kernel/l3candidates.dtx               |   80 +++++++++++++++++++++++++++++++
>  l3kernel/testfiles/m3expl001.luatex.tlg |    1 +
>  l3kernel/testfiles/m3expl001.ptex.tlg   |    1 +
>  l3kernel/testfiles/m3expl001.tlg        |    1 +
>  l3kernel/testfiles/m3expl001.uptex.tlg  |    1 +
>  l3kernel/testfiles/m3expl001.xetex.tlg  |    1 +
>  l3kernel/testfiles/m3expl003.luatex.tlg |    1 +
>  l3kernel/testfiles/m3expl003.ptex.tlg   |    1 +
>  l3kernel/testfiles/m3expl003.tlg        |    1 +
>  l3kernel/testfiles/m3expl003.uptex.tlg  |    1 +
>  l3kernel/testfiles/m3expl003.xetex.tlg  |    1 +
>  11 files changed, 90 insertions(+)
> 
> diff --git a/l3kernel/l3candidates.dtx b/l3kernel/l3candidates.dtx
> index c6f6e2f..aaaf525 100644
> --- a/l3kernel/l3candidates.dtx
> +++ b/l3kernel/l3candidates.dtx
> @@ -695,6 +695,27 @@
>  %
>  % \section{Additions to \pkg{l3sys}}
>  %
> +% \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 = 2017-05-27, EXP, pTF]{\sys_if_rand_exist:}
>  %   \begin{syntax}
>  %     \cs{sys_if_rand_exist_p:}
> @@ -2530,6 +2551,65 @@
>  %<@@=sys>
>  %    \end{macrocode}
>  %
> +% \begin{variable}{\c_sys_engine_version_str}
> +%   Various different engines, various different ways to extract the
> +%   data!
> +%    \begin{macrocode}
> +\str_const:Nx \c_sys_engine_version_str
> +  {
> +    \str_case:on \c_sys_engine_str
> +      {
> +        { pdftex }
> +          {
> +            \fp_eval:n { round(\int_use:N \tex_pdftexversion:D / 100 , 2) }
> +            .
> +            \tex_pdftexrevision:D
> +          }
> +        { ptex }
> +          {
> +            \cs_if_exist:NT \tex_ptexversion:D
> +              {
> +                p
> +                \int_use:N  \tex_ptexversion:D
> +                \tex_ptexrevision:D
> +                \int_use:N \tex_ptexminorversion:D
> +                -
> +                \int_use:N \tex_epTeXversion:D
> +              }
> +          }
> +        { luatex }
> +          {
> +            \fp_eval:n { round(\int_use:N \tex_luatexversion:D / 100, 2) }
> +            .
> +            \tex_luatexrevision:D
> +          }
> +        { uptex }
> +          {
> +            \cs_if_exist:NT \tex_ptexversion:D
> +              {
> +                p
> +                \int_use:N  \tex_ptexversion:D
> +                \tex_ptexrevision:D
> +                \int_use:N \tex_ptexminorversion: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{variable}
> +%
>  % \begin{macro}[EXP, pTF]{\sys_if_rand_exist:}
>  %   Currently, randomness exists under \pdfTeX{}, \LuaTeX{}, \pTeX{} and \upTeX{}.
>  %    \begin{macrocode}
> diff --git a/l3kernel/testfiles/m3expl001.luatex.tlg b/l3kernel/testfiles/m3expl001.luatex.tlg
> index 6a580e9..6d20d4c 100644
> --- a/l3kernel/testfiles/m3expl001.luatex.tlg
> +++ b/l3kernel/testfiles/m3expl001.luatex.tlg
> @@ -5732,6 +5732,7 @@ Defining \__seq_shuffle:NN on line ...
>  Defining \__seq_shuffle_item:n on line ...
>  Defining message LaTeX/kernel/shuffle-too-large 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 ...
> diff --git a/l3kernel/testfiles/m3expl001.ptex.tlg b/l3kernel/testfiles/m3expl001.ptex.tlg
> index e1638f7..87588df 100644
> --- a/l3kernel/testfiles/m3expl001.ptex.tlg
> +++ b/l3kernel/testfiles/m3expl001.ptex.tlg
> @@ -5725,6 +5725,7 @@ Defining \__seq_shuffle:NN on line ...
>  Defining \__seq_shuffle_item:n on line ...
>  Defining message LaTeX/kernel/shuffle-too-large 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 ...
> diff --git a/l3kernel/testfiles/m3expl001.tlg b/l3kernel/testfiles/m3expl001.tlg
> index 3c353b9..9d80104 100644
> --- a/l3kernel/testfiles/m3expl001.tlg
> +++ b/l3kernel/testfiles/m3expl001.tlg
> @@ -5725,6 +5725,7 @@ Defining \__seq_shuffle:NN on line ...
>  Defining \__seq_shuffle_item:n on line ...
>  Defining message LaTeX/kernel/shuffle-too-large 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 ...
> diff --git a/l3kernel/testfiles/m3expl001.uptex.tlg b/l3kernel/testfiles/m3expl001.uptex.tlg
> index f303722..6010072 100644
> --- a/l3kernel/testfiles/m3expl001.uptex.tlg
> +++ b/l3kernel/testfiles/m3expl001.uptex.tlg
> @@ -5723,6 +5723,7 @@ Defining \__seq_shuffle:NN on line ...
>  Defining \__seq_shuffle_item:n on line ...
>  Defining message LaTeX/kernel/shuffle-too-large 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 ...
> diff --git a/l3kernel/testfiles/m3expl001.xetex.tlg b/l3kernel/testfiles/m3expl001.xetex.tlg
> index 6dfc094..f9ed97d 100644
> --- a/l3kernel/testfiles/m3expl001.xetex.tlg
> +++ b/l3kernel/testfiles/m3expl001.xetex.tlg
> @@ -5698,6 +5698,7 @@ Defining \seq_const_from_clist:cn on line ...
>  Defining \seq_shuffle:N on line ...
>  Defining \seq_gshuffle:N 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 ...
> diff --git a/l3kernel/testfiles/m3expl003.luatex.tlg b/l3kernel/testfiles/m3expl003.luatex.tlg
> index 6a580e9..6d20d4c 100644
> --- a/l3kernel/testfiles/m3expl003.luatex.tlg
> +++ b/l3kernel/testfiles/m3expl003.luatex.tlg
> @@ -5732,6 +5732,7 @@ Defining \__seq_shuffle:NN on line ...
>  Defining \__seq_shuffle_item:n on line ...
>  Defining message LaTeX/kernel/shuffle-too-large 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 ...
> diff --git a/l3kernel/testfiles/m3expl003.ptex.tlg b/l3kernel/testfiles/m3expl003.ptex.tlg
> index e1638f7..87588df 100644
> --- a/l3kernel/testfiles/m3expl003.ptex.tlg
> +++ b/l3kernel/testfiles/m3expl003.ptex.tlg
> @@ -5725,6 +5725,7 @@ Defining \__seq_shuffle:NN on line ...
>  Defining \__seq_shuffle_item:n on line ...
>  Defining message LaTeX/kernel/shuffle-too-large 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 ...
> diff --git a/l3kernel/testfiles/m3expl003.tlg b/l3kernel/testfiles/m3expl003.tlg
> index 3c353b9..9d80104 100644
> --- a/l3kernel/testfiles/m3expl003.tlg
> +++ b/l3kernel/testfiles/m3expl003.tlg
> @@ -5725,6 +5725,7 @@ Defining \__seq_shuffle:NN on line ...
>  Defining \__seq_shuffle_item:n on line ...
>  Defining message LaTeX/kernel/shuffle-too-large 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 ...
> diff --git a/l3kernel/testfiles/m3expl003.uptex.tlg b/l3kernel/testfiles/m3expl003.uptex.tlg
> index f303722..6010072 100644
> --- a/l3kernel/testfiles/m3expl003.uptex.tlg
> +++ b/l3kernel/testfiles/m3expl003.uptex.tlg
> @@ -5723,6 +5723,7 @@ Defining \__seq_shuffle:NN on line ...
>  Defining \__seq_shuffle_item:n on line ...
>  Defining message LaTeX/kernel/shuffle-too-large 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 ...
> diff --git a/l3kernel/testfiles/m3expl003.xetex.tlg b/l3kernel/testfiles/m3expl003.xetex.tlg
> index 6dfc094..f9ed97d 100644
> --- a/l3kernel/testfiles/m3expl003.xetex.tlg
> +++ b/l3kernel/testfiles/m3expl003.xetex.tlg
> @@ -5698,6 +5698,7 @@ Defining \seq_const_from_clist:cn on line ...
>  Defining \seq_shuffle:N on line ...
>  Defining \seq_gshuffle:N 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 ...
> 
> 
> 



More information about the latex3-commits mailing list