[latex3-commits] [git/LaTeX3-latex3-latex3] morechk: new \cs_use:N/c (7fba107)

Bruno Le Floch blflatex at gmail.com
Wed Jan 16 09:27:15 CET 2019


On 1/16/19 05:37, Will Robertson wrote:
> Repository : https://github.com/latex3/latex3
> On branch  : morechk
> Link       : https://github.com/latex3/latex3/commit/7fba10770dc0e499b75c2b95ca2a2d2608b7fbf1
> 
>> ---------------------------------------------------------------
> 
> commit 7fba10770dc0e499b75c2b95ca2a2d2608b7fbf1
> Author: Will Robertson <wspr81 at gmail.com>
> Date:   Mon Jan 14 12:43:12 2019 +0800
> 
>     new \cs_use:N/c
>     
>     with chking, of course
> 
> 
>> ---------------------------------------------------------------
> 
> 7fba10770dc0e499b75c2b95ca2a2d2608b7fbf1
>  l3kernel/l3basics.dtx |   23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/l3kernel/l3basics.dtx b/l3kernel/l3basics.dtx
> index 4da2087..6425310 100644
> --- a/l3kernel/l3basics.dtx
> +++ b/l3kernel/l3basics.dtx
> @@ -2819,6 +2819,29 @@
>  %    \end{macrocode}
>  % \end{macro}
>  %
> +% \begin{macro}{\cs_use:N, \cs_use:c}[EXP,added=2019-01-13]
> +%    \begin{macrocode}
> +\__kernel_if_debug:TF
> +  {
> +    \cs_set:Npn \cs_use:N #1
> +      {
> +        \__kernel_chk_cs_exist:N #1
> +        #1
> +      }
> +    \cs_set:Npn \cs_use:c #1
> +      {
> +        \__kernel_chk_cs_exist:c {#1}
> +        \cs:w #1 \cs_end:
> +      }
> +  }

Needs to be expandable.

For the :c version put the check just after \cs:w.

For the :N version maybe

\exp:w \__kernel_chk_cs_exist:N #1 \exp_after:wN \exp_end: #1

> +  {
> +    \cs_set:Npn \cs_use:N #1 { #1 }
> +    \cs_set:Npn \cs_use:c #1 { \cs:w #1 \cs_end: }
> +  }
> +%    \end{macrocode}
> +% \end{macro}
> +
> +%
>  % \subsection{Preliminaries for new functions}
>  %
>  %    We provide two kinds of functions that can be used to define
> 
> 
> 



More information about the latex3-commits mailing list