diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3expan.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3expan.dtx | 274 |
1 files changed, 141 insertions, 133 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx b/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx index be9c3ea942e..863413fa019 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3expan.dtx Copyright (C) 1990-2011 The LaTeX3 project +%% File: l3expan.dtx Copyright (C) 1990-2012 The LaTeX3 project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3expan.dtx 3086 2011-12-22 17:55:46Z bruno $ +\GetIdInfo$Id: l3expan.dtx 3196 2012-01-15 09:44:05Z joseph $ {L3 Experimental argument expansion} %</driver|package> %<*driver> @@ -86,9 +86,10 @@ % Internally preprocessing of arguments is done with functions from the % |\exp_| module. They all look alike, an example would be % |\exp_args:NNo|. This function has three arguments, the first and the -% second are a single tokens the third argument gets -% expanded once. If |\seq_gpush:No| was not defined the example -% above could be coded in the following way: +% second are a single tokens, while the third argument should be given +% in braces. Applying |\exp_args:NNo| will expand the content of third +% argument once before any expansion of the first and second arguments. +% If |\seq_gpush:No| was not define it could be coded in the following way: % \begin{verbatim} % \exp_args:NNo \seq_gpush:Nn % \g_file_name_stack @@ -224,7 +225,7 @@ % % \begin{function}[EXP]{\exp_args:No} % \begin{syntax} -% \cs{exp_args:No} \meta{function} \Arg{tokens} \Arg{tokens2} ... +% \cs{exp_args:No} \meta{function} \Arg{tokens} ... % \end{syntax} % This function absorbs two arguments (the \meta{function} name and % the \meta{tokens}). The \meta{tokens} are expanded once, and the result @@ -235,7 +236,7 @@ % % \begin{function}[EXP]{\exp_args:Nc, \exp_args:cc} % \begin{syntax} -% \cs{exp_args:Nc} \meta{function} \Arg{tokens} \Arg{tokens2} ... +% \cs{exp_args:Nc} \meta{function} \Arg{tokens} % \end{syntax} % This function absorbs two arguments (the \meta{function} name and % the \meta{tokens}). The \meta{tokens} are expanded until only characters @@ -251,7 +252,7 @@ % % \begin{function}[EXP]{\exp_args:NV} % \begin{syntax} -% \cs{exp_args:NV} \meta{function} \meta{variable} \Arg{tokens2} ... +% \cs{exp_args:NV} \meta{function} \meta{variable} % \end{syntax} % This function absorbs two arguments (the names of the \meta{function} and % the the \meta{variable}). The content of the \meta{variable} are recovered @@ -262,7 +263,7 @@ % % \begin{function}[EXP]{\exp_args:Nv} % \begin{syntax} -% \cs{exp_args:Nv} \meta{function} \Arg{tokens} \Arg{tokens2} ... +% \cs{exp_args:Nv} \meta{function} \Arg{tokens} % \end{syntax} % This function absorbs two arguments (the \meta{function} name and % the \meta{tokens}). The \meta{tokens} are expanded until only characters @@ -277,7 +278,7 @@ % % \begin{function}[EXP]{\exp_args:Nf} % \begin{syntax} -% \cs{exp_args:Nf} \meta{function} \Arg{tokens} \Arg{tokens2} ... +% \cs{exp_args:Nf} \meta{function} \Arg{tokens} % \end{syntax} % This function absorbs two arguments (the \meta{function} name and % the \meta{tokens}). The \meta{tokens} are fully expanded until the @@ -289,7 +290,7 @@ % % \begin{function}{\exp_args:Nx} % \begin{syntax} -% \cs{exp_args:Nx} \meta{function} \Arg{tokens} \Arg{tokens2} ... +% \cs{exp_args:Nx} \meta{function} \Arg{tokens} % \end{syntax} % This function absorbs two arguments (the \meta{function} name and % the \meta{tokens}) and exhaustively expands the \meta{tokens} @@ -322,12 +323,13 @@ % by the expansion of the second and third arguments. % \end{function} % -% \begin{function}[EXP] +% \begin{function}[EXP, updated = 2012-01-14] % { % \exp_args:Nno, % \exp_args:NnV, % \exp_args:Nnf, % \exp_args:Noo, +% \exp_args:Nof, % \exp_args:Noc, % \exp_args:Nff, % \exp_args:Nfo, @@ -485,7 +487,7 @@ % expansion (for example, if it is a character) then it will be left % unchanged. It is important to notice that \meta{token1} may be % \emph{any} single token, including group-opening and -closing -% tokens (|{| or |}"| assuming normal \TeX{} category codes). Unless +% tokens (|{| or |}| assuming normal \TeX{} category codes). Unless % specifically required, expansion should be carried out using an % appropriate argument specifier variant or the appropriate % \cs{exp_arg:N} function. @@ -538,7 +540,7 @@ % \cs{exp_not:V} \meta{variable} % \end{syntax} % Recovers the content of the \meta{variable}, then prevents expansion -% of the this material in a context where it would otherwise +% of this material in a context where it would otherwise % be expanded, for example an |x|-type argument. % \end{function} % @@ -587,7 +589,7 @@ % % \section{Internal functions and variables} % -% \begin{variable}{\l_exp_tl} +% \begin{variable}{\l_exp_internal_tl} % The |\exp_| module has its private variables to temporarily store % results of the argument expansion. This is done to avoid interference % with other functions using temporary variables. @@ -598,7 +600,7 @@ % \cs{exp_eval_register:N} \meta{variable} % \end{syntax} % These functions evaluates a \meta{variable} as part of a |V| or |v| -% expansion (respectively), preceeded by \cs{c_zero} which stops +% expansion (respectively), preceded by \cs{c_zero} which stops % the expansion of a previous \tn{romannumeral}. % A \meta{variable} might exist as % one of two things: a parameter-less non-long, non-protected macro @@ -667,11 +669,11 @@ % In section~\ref{sec:handtune} some common cases are coded by a more direct % method for efficiency, typically using calls to |\exp_after:wN|. % -% \begin{variable}{\l_exp_tl} +% \begin{variable}{\l_exp_internal_tl} % We need a scratch token list variable. % We don't use |tl| methods so that \pkg{l3expan} can be loaded earlier. % \begin{macrocode} -\cs_new_nopar:Npn \l_exp_tl { } +\cs_new_nopar:Npn \l_exp_internal_tl { } % \end{macrocode} % \end{variable} % @@ -686,8 +688,8 @@ % is the carried over result of the previous expansion steps and |#3| is % the argument about to be processed. % -% \begin{macro}[aux]{\exp_arg_next:nnn} -% \begin{macro}[aux]{\exp_arg_next_nobrace:nnn} +% \begin{macro}[aux, EXP]{\exp_arg_next:nnn} +% \begin{macro}[aux, EXP]{\exp_arg_next:Nnn} % |#1| is the result of an expansion step, |#2| is the remaining % argument manipulations and |#3| is the current result of the % expansion chain. This auxiliary function moves |#1| back after @@ -699,7 +701,7 @@ % require a set of braces. % \begin{macrocode} \cs_new:Npn \exp_arg_next:nnn #1#2#3 { #2 \::: { #3 {#1} } } -\cs_new:Npn \exp_arg_next_nobrace:nnn #1#2#3 { #2 \::: { #3 #1 } } +\cs_new:Npn \exp_arg_next:Nnn #1#2#3 { #2 \::: { #3 #1 } } % \end{macrocode} % \end{macro} % \end{macro} @@ -711,7 +713,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\::n} +% \begin{macro}[int, EXP]{\::n} % This function is used to skip an argument that doesn't need to % be expanded. % \begin{macrocode} @@ -719,7 +721,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\::N} +% \begin{macro}[int, EXP]{\::N} % This function is used to skip an argument that consists of a % single token and doesn't need to be expanded. % \begin{macrocode} @@ -727,16 +729,16 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\::c} +% \begin{macro}[int, EXP]{\::c} % This function is used to skip an argument that is turned into % as control sequence without expansion. % \begin{macrocode} \cs_new:Npn \::c #1 \::: #2#3 - { \exp_after:wN \exp_arg_next_nobrace:nnn \cs:w #3 \cs_end: {#1} {#2} } + { \exp_after:wN \exp_arg_next:Nnn \cs:w #3 \cs_end: {#1} {#2} } % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\::o} +% \begin{macro}[int, EXP]{\::o} % This function is used to expand an argument once. % \begin{macrocode} \cs_new:Npn \::o #1 \::: #2#3 @@ -744,7 +746,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\::f} +% \begin{macro}[int, EXP]{\::f} % \begin{macro}{\exp_stop_f:} % This function is used to expand a token list until the first % unexpandable token is found. The underlying \tn{romannumeral} |-`0| @@ -779,16 +781,16 @@ % \begin{macrocode} \cs_new_protected:Npn \::x #1 \::: #2#3 { - \cs_set_nopar:Npx \l_exp_tl { {#3} } - \exp_after:wN \exp_arg_next:nnn \l_exp_tl {#1} {#2} + \cs_set_nopar:Npx \l_exp_internal_tl { {#3} } + \exp_after:wN \exp_arg_next:nnn \l_exp_internal_tl {#1} {#2} } % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\::v} -% \begin{macro}[int]{\::V} +% \begin{macro}[int, EXP]{\::v} +% \begin{macro}[int, EXP]{\::V} % These functions return the value of a register, i.e., one of -% |tl|, |num|, |int|, |skip|, |dim| and |muskip|. The |V| version +% |tl|, |clist|, |int|, |skip|, |dim| and |muskip|. The |V| version % expects a single token whereas |v| like |c| creates a csname from % its argument given in braces and then evaluates it as if it was a % |V|. The primitive \tn{romannumeral} sets off an expansion @@ -811,20 +813,20 @@ % \end{macro} % \end{macro} % -% \begin{macro}[int]{\exp_eval_register:N, \exp_eval_register:c} -% \begin{macro}[aux]{\exp_eval_error_msg:w} -% This function evaluates a register. Now a register might exist as -% one of two things: A parameter-less macro or a built-in \TeX{} -% register such as |\count|. For the \TeX{} registers we have to -% utilize a \tn{the} whereas for the macros we merely have to -% expand them once. The trick is to find out when to use -% \tn{the} and when not to. What we do here is try to find out -% whether the token will expand to something else when hit with -% |\exp_after:wN|. The technique is to compare the meaning of the -% register in question when it has been prefixed with |\exp_not:N| -% and the register itself. If it is a macro, the prefixed -% |\exp_not:N| will temporarily turn it into the primitive -% |\scan_stop:|. +% \begin{macro}[int, EXP]{\exp_eval_register:N, \exp_eval_register:c} +% \begin{macro}[aux, EXP]{\exp_eval_error_msg:w} +% This function evaluates a register. Now a register might exist as +% one of two things: A parameter-less macro or a built-in \TeX{} +% register such as |\count|. For the \TeX{} registers we have to +% utilize a \tn{the} whereas for the macros we merely have to +% expand them once. The trick is to find out when to use +% \tn{the} and when not to. What we do here is try to find out +% whether the token will expand to something else when hit with +% |\exp_after:wN|. The technique is to compare the meaning of the +% register in question when it has been prefixed with |\exp_not:N| +% and the register itself. If it is a macro, the prefixed +% |\exp_not:N| will temporarily turn it into the primitive +% |\scan_stop:|. % \begin{macrocode} \cs_new:Npn \exp_eval_register:N #1 { @@ -889,9 +891,9 @@ % are fully expandable and therefore allow to prefix them with % |\tex_global:D| for example. % -% \begin{macro}{\exp_args:No} -% \begin{macro}{\exp_args:NNo} -% \begin{macro}{\exp_args:NNNo} +% \begin{macro}[EXP]{\exp_args:No} +% \begin{macro}[EXP]{\exp_args:NNo} +% \begin{macro}[EXP]{\exp_args:NNNo} % Those lovely runs of expansion! % \begin{macrocode} \cs_new:Npn \exp_args:No #1#2 { \exp_after:wN #1 \exp_after:wN {#2} } @@ -904,11 +906,12 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\exp_args:Nc} +% \begin{macro}[EXP]{\exp_args:Nc} % In \pkg{l3basics} %\end{macro} % -% \begin{macro}{\exp_args:cc, \exp_args:NNc, \exp_args:Ncc, \exp_args:Nccc} +% \begin{macro}[EXP] +% {\exp_args:cc, \exp_args:NNc, \exp_args:Ncc, \exp_args:Nccc} % Here are the functions that turn their argument into csnames but % are expandable. % \begin{macrocode} @@ -928,7 +931,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\exp_args:Nf, \exp_args:NV, \exp_args:Nv, \exp_args:Nx} +% \begin{macro}[EXP]{\exp_args:Nf, \exp_args:NV, \exp_args:Nv} % \begin{macrocode} \cs_new:Npn \exp_args:Nf #1#2 { \exp_after:wN #1 \exp_after:wN { \tex_romannumeral:D -`0 #2 } } @@ -945,13 +948,16 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\exp_args:NNV,\exp_args:NNv,\exp_args:NNf, -% \exp_args:NVV, -% \exp_args:Ncf,\exp_args:Nco} -% Some more hand-tuned function with three arguments. -% If we force that an |o| argument always has braces, -% we could implement \cs{exp_args:Nco} with less tokens -% and only two arguments. +% \begin{macro}[EXP] +% { +% \exp_args:NNV,\exp_args:NNv,\exp_args:NNf, +% \exp_args:NVV, +% \exp_args:Ncf,\exp_args:Nco +% } +% Some more hand-tuned function with three arguments. +% If we forced that an |o| argument always has braces, +% we could implement \cs{exp_args:Nco} with less tokens +% and only two arguments. % \begin{macrocode} \cs_new:Npn \exp_args:NNf #1#2#3 { @@ -991,12 +997,13 @@ \exp_after:wN { \tex_romannumeral:D \exp_eval_register:N #3 } } % \end{macrocode} -% \end{macro} +% \end{macro} % -% \begin{macro}{\exp_args:Ncco, -% \exp_args:NcNc, -% \exp_args:NcNo, -% \exp_args:NNNV} +% \begin{macro}[EXP] +% { +% \exp_args:Ncco, \exp_args:NcNc, \exp_args:NcNo, +% \exp_args:NNNV +% } % A few more that we can hand-tune. % \begin{macrocode} \cs_new:Npn \exp_args:NNNV #1#2#3#4 @@ -1028,7 +1035,7 @@ \exp_after:wN {#4} } % \end{macrocode} -% \end{macro} +% \end{macro} % % \subsection{Definitions with the automated technique} % \label{sec:gendef} @@ -1037,21 +1044,25 @@ % coding then becomes an issue. Notice that the auto-generated functions % are all not long: they don't actually take any arguments themselves. % -% \begin{macro}{\exp_args:Nx} +% \begin{macro}{\exp_args:Nx} % \begin{macrocode} \cs_new_protected_nopar:Npn \exp_args:Nx { \::x \::: } % \end{macrocode} -% \end{macro} -% -% \begin{macro}{\exp_args:NNx, -% \exp_args:Nnc, -% \exp_args:Ncx, -% \exp_args:Nfo,\exp_args:Nff, -% \exp_args:Nnf,\exp_args:Nno,\exp_args:NnV,\exp_args:Nnx, -% \exp_args:Noo,\exp_args:Noc,\exp_args:Nox, -% \exp_args:Nxo,\exp_args:Nxx} -% Here are the actual function definitions, using the helper functions -% above. +% \end{macro} +% +% \begin{macro}[EXP] +% { +% \exp_args:Nnc,\exp_args:Nfo,\exp_args:Nff,\exp_args:Nnf, +% \exp_args:Nno,\exp_args:NnV,\exp_args:Noo,\exp_args:Nof, +% \exp_args:Noc +% } +% \begin{macro} +% { +% \exp_args:NNx,\exp_args:Ncx,\exp_args:Nnx, +% \exp_args:Nox,\exp_args:Nxo,\exp_args:Nxx, +% } +% Here are the actual function definitions, using the helper functions +% above. % \begin{macrocode} \cs_new_nopar:Npn \exp_args:Nnc { \::n \::c \::: } \cs_new_nopar:Npn \exp_args:Nfo { \::f \::o \::: } @@ -1059,8 +1070,9 @@ \cs_new_nopar:Npn \exp_args:Nnf { \::n \::f \::: } \cs_new_nopar:Npn \exp_args:Nno { \::n \::o \::: } \cs_new_nopar:Npn \exp_args:NnV { \::n \::V \::: } -\cs_new_nopar:Npn \exp_args:Noc { \::o \::c \::: } \cs_new_nopar:Npn \exp_args:Noo { \::o \::o \::: } +\cs_new_nopar:Npn \exp_args:Nof { \::o \::f \::: } +\cs_new_nopar:Npn \exp_args:Noc { \::o \::c \::: } \cs_new_protected_nopar:Npn \exp_args:NNx { \::N \::x \::: } \cs_new_protected_nopar:Npn \exp_args:Ncx { \::c \::x \::: } \cs_new_protected_nopar:Npn \exp_args:Nnx { \::n \::x \::: } @@ -1068,20 +1080,19 @@ \cs_new_protected_nopar:Npn \exp_args:Nxo { \::x \::o \::: } \cs_new_protected_nopar:Npn \exp_args:Nxx { \::x \::x \::: } % \end{macrocode} -% \end{macro} -% -% \begin{macro}{\exp_args:Nccx, -% \exp_args:Ncnx, -% \exp_args:NNno, -% \exp_args:Nnno, -% \exp_args:Nnnx, -% \exp_args:Nnox, -% \exp_args:Nooo, -% \exp_args:Noox, -% \exp_args:Nnnc, -% \exp_args:NNnx, -% \exp_args:NNoo, -% \exp_args:NNox} +% \end{macro} +% \end{macro} +% +% \begin{macro}[EXP] +% { +% \exp_args:NNno,\exp_args:NNoo, +% \exp_args:Nnnc,\exp_args:Nnno,\exp_args:Nooo, +% } +% \begin{macro} +% { +% \exp_args:NNnx,\exp_args:NNox,\exp_args:Nnnx,\exp_args:Nnox, +% \exp_args:Nccx,\exp_args:Ncnx,\exp_args:Noox, +% } % \begin{macrocode} \cs_new_nopar:Npn \exp_args:NNno { \::N \::n \::o \::: } \cs_new_nopar:Npn \exp_args:NNoo { \::N \::o \::o \::: } @@ -1096,16 +1107,17 @@ \cs_new_protected_nopar:Npn \exp_args:Ncnx { \::c \::n \::x \::: } \cs_new_protected_nopar:Npn \exp_args:Noox { \::o \::o \::x \::: } % \end{macrocode} -% \end{macro} +% \end{macro} +% \end{macro} % % \subsection{Last-unbraced versions} % -% \begin{macro}[aux]{\exp_arg_last_unbraced:nn} -% \begin{macro}[aux]{\::f_unbraced} -% \begin{macro}[aux]{\::o_unbraced} -% \begin{macro}[aux]{\::V_unbraced} -% \begin{macro}[aux]{\::v_unbraced} -% \begin{macro}[aux]{\::x_unbraced} +% \begin{macro}[aux, EXP]{\exp_arg_last_unbraced:nn} +% \begin{macro}[aux, EXP]{\::f_unbraced} +% \begin{macro}[aux, EXP]{\::o_unbraced} +% \begin{macro}[aux, EXP]{\::V_unbraced} +% \begin{macro}[aux, EXP]{\::v_unbraced} +% \begin{macro}[aux, EXP]{\::x_unbraced} % There are a few places where the last argument needs to be available % unbraced. First some helper macros. % \begin{macrocode} @@ -1129,8 +1141,8 @@ } \cs_new_protected:Npn \::x_unbraced \::: #1#2 { - \cs_set_nopar:Npx \l_exp_tl { \exp_not:n {#1} #2 } - \l_exp_tl + \cs_set_nopar:Npx \l_exp_internal_tl { \exp_not:n {#1} #2 } + \l_exp_internal_tl } % \end{macrocode} % \end{macro} @@ -1140,19 +1152,19 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\exp_last_unbraced:NV} -% \begin{macro}{\exp_last_unbraced:Nv} -% \begin{macro}{\exp_last_unbraced:Nf} -% \begin{macro}{\exp_last_unbraced:No} -% \begin{macro}{\exp_last_unbraced:Nco} -% \begin{macro}{\exp_last_unbraced:NcV} -% \begin{macro}{\exp_last_unbraced:NNV} -% \begin{macro}{\exp_last_unbraced:NNo} -% \begin{macro}{\exp_last_unbraced:NNNV} -% \begin{macro}{\exp_last_unbraced:NNNo} -% \begin{macro}{\exp_last_unbraced:Nno} -% \begin{macro}{\exp_last_unbraced:Noo} -% \begin{macro}{\exp_last_unbraced:Nfo} +% \begin{macro}[EXP]{\exp_last_unbraced:NV} +% \begin{macro}[EXP]{\exp_last_unbraced:Nv} +% \begin{macro}[EXP]{\exp_last_unbraced:Nf} +% \begin{macro}[EXP]{\exp_last_unbraced:No} +% \begin{macro}[EXP]{\exp_last_unbraced:Nco} +% \begin{macro}[EXP]{\exp_last_unbraced:NcV} +% \begin{macro}[EXP]{\exp_last_unbraced:NNV} +% \begin{macro}[EXP]{\exp_last_unbraced:NNo} +% \begin{macro}[EXP]{\exp_last_unbraced:NNNV} +% \begin{macro}[EXP]{\exp_last_unbraced:NNNo} +% \begin{macro}[EXP]{\exp_last_unbraced:Nno} +% \begin{macro}[EXP]{\exp_last_unbraced:Noo} +% \begin{macro}[EXP]{\exp_last_unbraced:Nfo} % \begin{macro}{\exp_last_unbraced:Nx} % Now the business end: most of these are hand-tuned for speed, but the % general system is in place. @@ -1209,7 +1221,7 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\exp_last_two_unbraced:Noo} +% \begin{macro}[EXP]{\exp_last_two_unbraced:Noo} % If |#2| is a single token then this can be implemented as % \begin{verbatim} % \cs_new:Npn \exp_last_two_unbraced:Noo #1 #2 #3 @@ -1227,12 +1239,14 @@ % % \subsection{Preventing expansion} % -% \begin{macro}{\exp_not:o} -% \begin{macro}{\exp_not:f} -% \begin{macro}{\exp_not:V} -% \begin{macro}{\exp_not:v} +% \begin{macro}[EXP]{\exp_not:o} +% \begin{macro}[EXP]{\exp_not:c} +% \begin{macro}[EXP]{\exp_not:f} +% \begin{macro}[EXP]{\exp_not:V} +% \begin{macro}[EXP]{\exp_not:v} % \begin{macrocode} \cs_new:Npn \exp_not:o #1 { \etex_unexpanded:D \exp_after:wN {#1} } +\cs_new:Npn \exp_not:c #1 { \exp_after:wN \exp_not:N \cs:w #1 \cs_end: } \cs_new:Npn \exp_not:f #1 { \etex_unexpanded:D \exp_after:wN { \tex_romannumeral:D -`0 #1 } } \cs_new:Npn \exp_not:V #1 @@ -1250,13 +1264,7 @@ % \end{macro} % \end{macro} % \end{macro} -% -% \begin{macro}{\exp_not:c} -% A helper function. -% \begin{macrocode} -\cs_new:Npn \exp_not:c #1 { \exp_after:wN \exp_not:N \cs:w #1 \cs_end: } -% \end{macrocode} -% \end{macro} +% \end{macro} % % \subsection{Defining function variants} % @@ -1291,7 +1299,7 @@ % We discard the boolean |#3| and then set off a loop through the desired % variant forms. The original function is retained as |#4| for efficiency. % \begin{macrocode} -\cs_new:Npn \cs_generate_variant_aux:nnNNn #1#2#3#4#5 +\cs_new_protected:Npn \cs_generate_variant_aux:nnNNn #1#2#3#4#5 { \cs_generate_variant_aux:Nnnw #4 {#1}{#2} #5 , ? , \q_recursion_stop } % \end{macrocode} % Next is the real work to be done. We now have 1: original function, @@ -1309,7 +1317,7 @@ % Then build the variant function once, to avoid repeating this % relatively expensive operation. Then recurse. % \begin{macrocode} -\cs_new:Npn \cs_generate_variant_aux:Nnnw #1#2#3#4 , +\cs_new_protected:Npn \cs_generate_variant_aux:Nnnw #1#2#3#4 , { \if:w ? #4 \exp_after:wN \use_none_delimit_by_q_recursion_stop:w @@ -1342,7 +1350,7 @@ % the |\exp_args:N| form needed is defined. % Otherwise tell that it was already defined. % \begin{macrocode} -\cs_new:Npn \cs_generate_variant_aux:NNn #1 #2 #3 +\cs_new_protected:Npn \cs_generate_variant_aux:NNn #1 #2 #3 { \cs_if_free:NTF #2 { @@ -1385,7 +1393,7 @@ \tex_lowercase:D { \group_end: - \cs_new:Npn \cs_generate_variant_aux:N #1 + \cs_new_protected:Npn \cs_generate_variant_aux:N #1 { \exp_after:wN \cs_generate_variant_aux:w \token_to_meaning:N #1 @@ -1394,7 +1402,7 @@ \q_mark \cs_new_nopar:Npx \q_stop } - \cs_new:Npn \cs_generate_variant_aux:w + \cs_new_protected:Npn \cs_generate_variant_aux:w #1 ? PROTECTEZ #2 \q_mark #3 #4 \q_stop { \cs_set_eq:NN \cs_tmp:w #3 @@ -1405,7 +1413,7 @@ % \end{macro} % % \begin{macro}[int]{\cs_generate_internal_variant:n} -% \begin{macro}[aux]{\cs_generate_internal_variant_aux:N} +% \begin{macro}[aux, rEXP]{\cs_generate_internal_variant_aux:N} % Test if |exp_args:N #1| is already defined % and if not define it via the % |\::| commands using the chars in |#1| @@ -1438,7 +1446,7 @@ % %\subsection{Variants which cannot be created earlier} % -% \begin{macro}[pTF] +% \begin{macro}[EXP,pTF] % {\str_if_eq:Vn, \str_if_eq:on, \str_if_eq:nV, \str_if_eq:no, \str_if_eq:VV} % These cannot come earlier as they need \cs{cs_generate_variant:Nn}. % \begin{macrocode} |