diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3basics.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3basics.dtx | 881 |
1 files changed, 375 insertions, 506 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx index 3a51478f5cc..95440947255 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx @@ -9,7 +9,7 @@ %% %% http://www.latex-project.org/lppl.txt %% -%% This file is part of the "expl3 bundle" (The Work in LPPL) +%% This file is part of the "l3kernel bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% %% The released version of this bundle is available from CTAN. @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3basics.dtx 2689 2011-08-29 19:50:38Z joseph $ +\GetIdInfo$Id: l3basics.dtx 2817 2011-09-12 14:16:56Z joseph $ {L3 Experimental basic definitions} %</driver|package> %<*driver> @@ -76,7 +76,7 @@ % processing are covered; conditional processing dealing with specific % data types is described in the modules specific for the respective % data types. -% +% % \section{No operation functions} % % \begin{function}[EXP]{\prg_do_nothing:} @@ -125,7 +125,7 @@ % with category code $2$ (close-group). The later will be a ^^A{ % |}| if standard category codes apply. % \end{function} -% +% % \section{Control sequences and functions} % % As \TeX{} is a macro language, creating new functions means @@ -134,21 +134,21 @@ % in the code (|#1|, |#2|, \emph{etc.}) is replaced the appropriate % arguments absorbed by the function. In the following, \meta{code} % is therefore used as a shorthand for \enquote{replacement text}. -% +% % Functions which are not \enquote{protected} will be fully expanded % inside an \texttt{x} expansion. In contrast, \enquote{protected} % functions are not expanded within \texttt{x} expansions. -% +% % \subsection{Defining functions} % % Functions can be created with no requirement that they are declared -% first (in contrast to variables, which must always be declared). +% first (in contrast to variables, which must always be declared). % Declaring a function before setting up the code means that the name % chosen will be checked and an error raised if it is already in use. % The name of a function can be checked at the point of definition using % the \cs{cs_new\ldots} functions: this is recommended for all % functions which are defined for the first time. -% +% % \subsection{Defining new functions using primitive parameter text} % % \begin{function}{\cs_new:Npn, \cs_new:cpn, \cs_new:Npx, \cs_new:cpx} @@ -201,8 +201,7 @@ % \cs_new_protected_nopar:Npx, \cs_new_protected_nopar:cpx % } % \begin{syntax} -% \cs{cs_new_protected_nopar:Npn} \meta{function} \meta{parameters} -% ~~\Arg{code} +% \cs{cs_new_protected_nopar:Npn} \meta{function} \meta{parameters} \Arg{code} % \end{syntax} % Creates \meta{function} to expand to \meta{code} as replacement text. % Within the \meta{code}, the \meta{parameters} (|#1|, |#2|, @@ -212,12 +211,12 @@ % expand within an \texttt{x}-type argument. The definition is global % and an error will result if the \meta{function} is already defined. % \end{function} -% +% % \begin{function}{\cs_set:Npn, \cs_set:cpn, \cs_set:Npx, \cs_set:cpx} % \begin{syntax} % \cs{cs_set:Npn} \meta{function} \meta{parameters} \Arg{code} % \end{syntax} -% Sets \meta{function} to expand to \meta{code} as replacement text. +% Sets \meta{function} to expand to \meta{code} as replacement text. % Within the \meta{code}, the \meta{parameters} (|#1|, |#2|, % \emph{etc.}) will be replaced by those absorbed by the function. % The assignment of a meaning to \meta{function} is restricted to @@ -226,13 +225,13 @@ % % \begin{function} % { -% \cs_set_nopar:Npn, \cs_set_nopar:cpn, +% \cs_set_nopar:Npn, \cs_set_nopar:cpn, % \cs_set_nopar:Npx, \cs_set_nopar:cpx % } % \begin{syntax} % \cs{cs_set_nopar:Npn} \meta{function} \meta{parameters} \Arg{code} % \end{syntax} -% Sets \meta{function} to expand to \meta{code} as replacement text. +% Sets \meta{function} to expand to \meta{code} as replacement text. % Within the \meta{code}, the \meta{parameters} (|#1|, |#2|, % \emph{etc.}) will be replaced by those absorbed by the function. % When the \meta{function} is used the \meta{parameters} absorbed @@ -247,10 +246,9 @@ % \cs_set_protected:Npx, \cs_set_protected:cpx % } % \begin{syntax} -% \cs{cs_set_protected:Npn} \meta{function} \meta{parameters} -% ~~\Arg{code} +% \cs{cs_set_protected:Npn} \meta{function} \meta{parameters} \Arg{code} % \end{syntax} -% Sets \meta{function} to expand to \meta{code} as replacement text. +% Sets \meta{function} to expand to \meta{code} as replacement text. % Within the \meta{code}, the \meta{parameters} (|#1|, |#2|, % \emph{etc.}) will be replaced by those absorbed by the function. % The assignment of a meaning to \meta{function} is restricted to @@ -264,11 +262,10 @@ % \cs_set_protected_nopar:Npx, \cs_set_protected_nopar:cpx , % } % \begin{syntax} -% \cs{cs_set_protected_nopar:Npn} \meta{function} -% ~~\meta{parameters} \Arg{code} +% \cs{cs_set_protected_nopar:Npn} \meta{function} \meta{parameters} \Arg{code} % \end{syntax} -% Sets \meta{function} to expand to \meta{code} as replacement text. -% Within the \meta{code}, the \meta{parameters} (|#1|, |#2|, +% Sets \meta{function} to expand to \meta{code} as replacement text. +% Within the \meta{code}, the \meta{parameters} (|#1|, |#2|, % \emph{etc.}) will be replaced by those absorbed by the function. % When the \meta{function} is used the \meta{parameters} absorbed % cannot contain \cs{par} tokens. The assignment of a meaning @@ -282,7 +279,7 @@ % \cs{cs_gset:Npn} \meta{function} \meta{parameters} \Arg{code} % \end{syntax} % Globally sets \meta{function} to expand to \meta{code} as replacement -% text. Within the \meta{code}, the \meta{parameters} (|#1|, |#2|, +% text. Within the \meta{code}, the \meta{parameters} (|#1|, |#2|, % \emph{etc.}) will be replaced by those absorbed by the function. % The assignment of a meaning to \meta{function} is \emph{not} % restricted to the current \TeX{} group level: the assignment is @@ -291,14 +288,14 @@ % % \begin{function} % { -% \cs_gset_nopar:Npn, \cs_gset_nopar:cpn, -% \cs_gset_nopar:Npx , \cs_gset_nopar:cpx +% \cs_gset_nopar:Npn, \cs_gset_nopar:cpn, +% \cs_gset_nopar:Npx, \cs_gset_nopar:cpx % } % \begin{syntax} % \cs{cs_gset_nopar:Npn} \meta{function} \meta{parameters} \Arg{code} % \end{syntax} % Globally sets \meta{function} to expand to \meta{code} as replacement -% text. Within the \meta{code}, the \meta{parameters} (|#1|, |#2|, +% text. Within the \meta{code}, the \meta{parameters} (|#1|, |#2|, % \emph{etc.}) will be replaced by those absorbed by the function. % When the \meta{function} is used the \meta{parameters} absorbed % cannot contain \cs{par} tokens. The assignment of a meaning to @@ -312,11 +309,10 @@ % \cs_gset_protected:Npx, \cs_gset_protected:cpx % } % \begin{syntax} -% \cs{cs_gset_protected:Npn} \meta{function} \meta{parameters} -% ~~\Arg{code} +% \cs{cs_gset_protected:Npn} \meta{function} \meta{parameters} \Arg{code} % \end{syntax} % Globally sets \meta{function} to expand to \meta{code} as replacement -% text. Within the \meta{code}, the \meta{parameters} (|#1|, |#2|, +% text. Within the \meta{code}, the \meta{parameters} (|#1|, |#2|, % \emph{etc.}) will be replaced by those absorbed by the function. % The assignment of a meaning to \meta{function} is \emph{not} % restricted to the current \TeX{} group level: the assignment is @@ -330,11 +326,10 @@ % \cs_gset_protected_nopar:Npx, \cs_gset_protected_nopar:cpx % } % \begin{syntax} -% \cs{cs_gset_protected_nopar:Npn} \meta{function} -% ~~\meta{parameters} \Arg{code} +% \cs{cs_gset_protected_nopar:Npn} \meta{function} \meta{parameters} \Arg{code} % \end{syntax} % Globally sets \meta{function} to expand to \meta{code} as replacement -% text. Within the \meta{code}, the \meta{parameters} (|#1|, |#2|, +% text. Within the \meta{code}, the \meta{parameters} (|#1|, |#2|, % \emph{etc.}) will be replaced by those absorbed by the function. % When the \meta{function} is used the \meta{parameters} absorbed % cannot contain \cs{par} tokens. The assignment of a meaning to @@ -342,9 +337,9 @@ % group level: the assignment is global. The \meta{function} will % not expand within an \texttt{x}-type argument. % \end{function} -% +% % \subsection{Defining new functions using the signature} -% +% % \begin{function} % { % \cs_new:Nn, \cs_new:cn, @@ -360,7 +355,7 @@ % function. The definition is global and % an error will result if the \meta{function} is already defined. % \end{function} -% +% % \begin{function} % { % \cs_new_nopar:Nn, \cs_new_nopar:cn, @@ -377,7 +372,7 @@ % absorbed cannot contain \cs{par} tokens. The definition is global and % an error will result if the \meta{function} is already defined. % \end{function} -% +% % \begin{function} % { % \cs_new_protected:Nn, \cs_new_protected:cn, @@ -394,7 +389,7 @@ % argument. The definition is global and % an error will result if the \meta{function} is already defined. % \end{function} -% +% % \begin{function} % { % \cs_new_protected_nopar:Nn, \cs_new_protected_nopar:cn, @@ -412,7 +407,7 @@ % expand within an \texttt{x}-type argument. The definition is global and % an error will result if the \meta{function} is already defined. % \end{function} -% +% % \begin{function} % { % \cs_set:Nn, \cs_set:cn, @@ -425,11 +420,11 @@ % Within the \meta{code}, the number of \meta{parameters} is detected % automatically from the function signature. These \meta{parameters} % (|#1|, |#2|, \emph{etc.}) will be replaced by those absorbed by the -% function. +% function. % The assignment of a meaning to \meta{function} is restricted to % the current \TeX{} group level. % \end{function} -% +% % \begin{function} % { % \cs_set_nopar:Nn, \cs_set_nopar:cn, @@ -447,7 +442,7 @@ % The assignment of a meaning to \meta{function} is restricted to % the current \TeX{} group level. % \end{function} -% +% % \begin{function} % { % \cs_set_protected:Nn, \cs_set_protected:cn, @@ -465,7 +460,7 @@ % The assignment of a meaning to \meta{function} is restricted to % the current \TeX{} group level. % \end{function} -% +% % \begin{function} % { % \cs_set_protected_nopar:Nn, \cs_set_protected_nopar:cn, @@ -484,7 +479,7 @@ % The assignment of a meaning to \meta{function} is restricted to % the current \TeX{} group level. % \end{function} -% +% % \begin{function} % { % \cs_gset:Nn, \cs_gset:cn, @@ -497,10 +492,10 @@ % Within the \meta{code}, the number of \meta{parameters} is detected % automatically from the function signature. These \meta{parameters} % (|#1|, |#2|, \emph{etc.}) will be replaced by those absorbed by the -% function. +% function. % The assignment of a meaning to \meta{function} is global. % \end{function} -% +% % \begin{function} % { % \cs_gset_nopar:Nn, \cs_gset_nopar:cn, @@ -517,7 +512,7 @@ % absorbed cannot contain \cs{par} tokens. % The assignment of a meaning to \meta{function} is global. % \end{function} -% +% % \begin{function} % { % \cs_gset_protected:Nn, \cs_gset_protected:cn, @@ -534,7 +529,7 @@ % argument. % The assignment of a meaning to \meta{function} is global. % \end{function} -% +% % \begin{function} % { % \cs_gset_protected_nopar:Nn, \cs_gset_protected_nopar:cn, @@ -552,12 +547,11 @@ % expand within an \texttt{x}-type argument. % The assignment of a meaning to \meta{function} is global. % \end{function} -% -% \begin{function} +% +% \begin{function}[updated = 2011-09-05] % {\cs_generate_from_arg_count:NNnn, \cs_generate_from_arg_count:cNnn} % \begin{syntax} -% \cs{cs_generate_from_arg_count:NNnn} \meta{function} -% ~~\meta{creator} \meta{number} \meta{code} +% \cs{cs_generate_from_arg_count:NNnn} \meta{function} \meta{creator} \meta{number} \meta{code} % \end{syntax} % Uses the \meta{creator} function (which should have signature % |Npn|, for example \cs{cs_new:Npn}) to define a \meta{function} @@ -574,30 +568,31 @@ % second control sequence is a \emph{copy} of the first (rather than % a pointer to it). Thus the old and new control sequence are not % tided together: changes to one are not reflected in the other. -% +% % In the following text \enquote{cs} is used as an abbreviation for % \enquote{control sequence}. -% +% % \begin{function} % {\cs_new_eq:NN, \cs_new_eq:Nc, \cs_new_eq:cN, \cs_new_eq:cc} % \begin{syntax} % \cs{cs_new_eq:NN} \meta{cs 1} \meta{cs 2} +% \cs{cs_new_eq:NN} \meta{cs 1} \meta{token} % \end{syntax} -% Creates \meta{control sequence 1} and sets it to have the same -% meaning as \meta{control sequence 2} at the point where -% \cs{cs_new_eq:NN} is executed. The two control sequences may -% subsequently be altered without affecting the copy. The assignment -% of a meaning to \meta{control sequence 1} is global. +% Globally creates \meta{control sequence 1} and sets it to have the same +% meaning as \meta{control sequence 2} or <token>. +% The second control sequence may +% subsequently be altered without affecting the copy. % \end{function} -% +% % \begin{function} % {\cs_set_eq:NN, \cs_set_eq:Nc, \cs_set_eq:cN, \cs_set_eq:cc} % \begin{syntax} % \cs{cs_set_eq:NN} \meta{cs 1} \meta{cs 2} +% \cs{cs_set_eq:NN} \meta{cs 1} \meta{token} % \end{syntax} % Sets \meta{control sequence 1} to have the same meaning as -% \meta{control sequence 2} at the point where \cs{cs_set_eq:NN} -% is executed. The two control sequences may subsequently be +% \meta{control sequence 2} (or <token>). +% The second control sequence may subsequently be % altered without affecting the copy. The assignment of a meaning % to \meta{control sequence 1} is restricted to the current % \TeX{} group level. @@ -607,10 +602,11 @@ % {\cs_gset_eq:NN, \cs_gset_eq:Nc, \cs_gset_eq:cN, \cs_gset_eq:cc} % \begin{syntax} % \cs{cs_gset_eq:NN} \meta{cs 1} \meta{cs 2} +% \cs{cs_gset_eq:NN} \meta{cs 1} \meta{token} % \end{syntax} % Globally sets \meta{control sequence 1} to have the same meaning as -% \meta{control sequence 2} at the point where \cs{cs_gset_eq:NN} -% is executed. The two control sequences may subsequently be +% \meta{control sequence 2} (or <token>). +% The second control sequence may subsequently be % altered without affecting the copy. The assignment of a meaning to % \meta{control sequence 1} is \emph{not} restricted to the current % \TeX{} group level: the assignment is global. @@ -620,7 +616,7 @@ % % There are occasions where control sequences need to be deleted. % This is handled in a very simple manner. -% +% % \begin{function}{\cs_undefine:N, \cs_undefine:c} % \begin{syntax} % \cs{cs_undefine:N} \meta{control sequence} @@ -629,7 +625,7 @@ % \end{function} % % \subsection{Showing control sequences} -% +% % \begin{function}[EXP]{\cs_meaning:N, \cs_meaning:c} % \begin{syntax} % \cs{cs_meaning:N} \meta{control sequence} @@ -638,7 +634,7 @@ % control sequence. This will show the \meta{replacement text} for a % macro. % \begin{texnote} -% This is \TeX{}'s \cs{meaning} primitive. +% This is \TeX{}'s \tn{meaning} primitive. % \end{texnote} % \end{function} % @@ -649,11 +645,10 @@ % Displays the definition of the \meta{control sequence} on the % terminal. % \begin{texnote} -% This is the \TeX{} primitive \cs{show}. +% This is the \TeX{} primitive \tn{show}. % \end{texnote} % \end{function} -% - +% % \subsection{Converting to and from control sequences} % % \begin{function}[EXP]{\use:c} @@ -661,13 +656,16 @@ % \cs{use:c} \Arg{control sequence name} % \end{syntax} % Converts the given \meta{control sequence name} into a single -% control sequence token. This process requires two expansions. +% control sequence token. This process requires two expansions. % The content for \meta{control sequence name} may be literal % material or from other expandable functions. The % \meta{control sequence name} must, when fully expanded, consist % of character tokens which are not active: typically, they will % be of category code $10$ (space), $11$ (letter) -% or $12$ (other), or a mixture of these. As an example, both +% or $12$ (other), or a mixture of these. +% \end{function} +% +% As an example of the \cs{use:c} function, both % \begin{verbatim} % \use:c { a b c } % \end{verbatim} @@ -682,20 +680,25 @@ % \abc % \end{verbatim} % after two expansions of \cs{use:c}. -% \end{function} -% +% % \begin{function}[EXP]{\cs:w, \cs_end:} % \begin{syntax} % \cs{cs:w} \meta{control sequence name} \cs{cs_end:} % \end{syntax} % Converts the given \meta{control sequence name} into a single -% control sequence token. This process requires one expansion. +% control sequence token. This process requires one expansion. % The content for \meta{control sequence name} may be literal % material or from other expandable functions. The % \meta{control sequence name} must, when fully expanded, consist % of character tokens which are not active: typically, they will % be of category code $10$ (space), $11$ (letter) -% or $12$ (other), or a mixture of these. As an example, both +% or $12$ (other), or a mixture of these. +% \begin{texnote} +% These are the \TeX{} primitives \tn{csname} and \tn{endcsname}. +% \end{texnote} +% \end{function} +% +% As an example of the \cs{cs:w} and \cs{cs_end:} functions, both % \begin{verbatim} % \cs:w a b c \cs_end: % \end{verbatim} @@ -710,10 +713,6 @@ % \abc % \end{verbatim} % after one expansion of \cs{cs:w}. -% \begin{texnote} -% These are the \TeX{} primitives \cs{csname} and \cs{endcsname}. -% \end{texnote} -% \end{function} % % \begin{function}[EXP]{\cs_to_str:N} % \begin{syntax} @@ -738,7 +737,7 @@ % of each token is set when the token is read by a function (if it % is read more than once, the category code is determined by the % the situation in force when first function absorbs the token). -% +% % \begin{function}[EXP]{\use:n, \use:nn, \use:nnn, \use:nnnn} % \begin{syntax} % \cs{use:n} \Arg{group1} @@ -788,7 +787,7 @@ % \end{function} % % \begin{function}[EXP] -% {\use_i:nnnn, \use_ii:nnnn, \use_iii:nnnn , \use_iv:nnnn} +% {\use_i:nnnn, \use_ii:nnnn, \use_iii:nnnn, \use_iv:nnnn} % \begin{syntax} % \cs{use_i:nnnn} \Arg{group1} \Arg{group2} \Arg{group3} \Arg{group4} % \end{syntax} @@ -870,7 +869,7 @@ % the marker given in the function name, leaving nothing in the % input stream. % \end{function} -% +% % \begin{function}[EXP] % { % \use_i_delimit_by_q_nil:nw, @@ -886,39 +885,7 @@ % in the input stream for further processing. % \end{function} % -% -% \begin{function}[EXP] -% { -% \use_i_after_fi:nw, -% \use_i_after_else:nw, -% \use_i_after_or:nw, -% \use_i_after_orelse:nw -% } -% \begin{syntax} -% \cs{use_i_after_fi:nw} \Arg{inserted tokens} \cs{fi:} -% \cs{use_i_after_else:nw} \Arg{inserted tokens} \cs{else:} -% ~~\meta{balanced text} \cs{fi:} -% \cs{use_i_after_or:nw} \Arg{inserted tokens} \cs{or:} -% ~~\meta{balanced text} \cs{fi:} -% \cs{use_i_after_orelse:nw} \Arg{inserted tokens} \cs{or:} or \cs{else:} -% ~~\meta{balanced text} \cs{fi:} -% \end{syntax} -% Absorb the \meta{balanced text}, if appropriate, delimited by -% the function name given. The \meta{inserted tokens} are then placed -% in the input stream after the delimiter. Thus for example -% \begin{verbatim} -% \use_i_after_fi:nw { some tokens } \fi: -% \end{verbatim} -% will leave -% \begin{verbatim} -% \fi: some tokens -% \end{verbatim} -% in the input stream for further processing. See the discussion of the -% primitive \TeX{} conditionals for more detail on \cs{else:}, \cs{fi:} -% and \cs{or:}. -% \end{function} -% -% \subsection{Decomposing control sequences} +% \subsection{Decomposing control sequences} % % \begin{function}[EXP]{\cs_get_arg_count_from_signature:N} % \begin{syntax} @@ -933,7 +900,7 @@ % % \begin{function}[EXP]{\cs_get_function_name:N} % \begin{syntax} -% \cs{cs_get_function_name:NN} \meta{function} +% \cs{cs_get_function_name:N} \meta{function} % \end{syntax} % Splits the \meta{function} into the name (\emph{i.e.}~the part % before the colon) and the signature (\emph{i.e.}~after the colon). @@ -944,14 +911,14 @@ % % \begin{function}[EXP]{\cs_get_function_signature:N} % \begin{syntax} -% \cs{cs_get_function_signature:NN} \meta{function} +% \cs{cs_get_function_signature:N} \meta{function} % \end{syntax} % Splits the \meta{function} into the name (\emph{i.e.}~the part % before the colon) and the signature (\emph{i.e.}~after the colon). % The \meta{signature} is then left in the input stream made up of % tokens with category code $12$ (other). % \end{function} -% +% % \begin{function}[EXP]{\cs_split_function:NN} % \begin{syntax} % \cs{cs_split_function:NN} \meta{function} \meta{processor} @@ -968,21 +935,6 @@ % specification \texttt{:nnN} (plus any trailing arguments needed). % \end{function} % -% \begin{function}[EXP]{\cs_to_str:N} -% \begin{syntax} -% \cs{cs_to_str:N} \Arg{control sequence} -% \end{syntax} -% Converts the given \meta{control sequence} into a series of -% characters with category code $12$ (other), except spaces, -% of category code $10$. The sequence will \emph{not} include -% the current escape token, \emph{cf.}~\cs{token_to_str:N}. -% Full expansion of this function requires a variable number -% of expansion steps (either 3 or 4), and so an -% \texttt{f}- or \texttt{x}-type expansion will be required to -% convert the \meta{control sequence} to a sequence of characters -% in the input stream. -% \end{function} -% % \section{Predicates and conditionals} % \label{sec:predicates} % @@ -990,8 +942,8 @@ % \begin{description} % \item[Branching conditionals] % Functions that carry out a test and then execute, depending on its -% result, either the code supplied in the \meta{true arg} or the -% \meta{false arg}. +% result, either the code supplied in the \meta{true arg} or the +% \meta{false arg}. % These arguments are denoted with |T| and |F|, respectively. An % example would be % \begin{quote} @@ -1003,7 +955,7 @@ % the second argument (true case) or in the third argument (false % case). % -% These type of functions are known as \enquote{conditionals}; +% These type of functions are known as \enquote{conditionals}; % whenever a |TF| function is defined it will usually be accompanied by % |T| and |F| functions as well. These are provided for convenience when % the branch only needs to go a single way. Package writers are free to @@ -1021,8 +973,8 @@ % % \item[Predicates] % \enquote{Predicates} are functions that return a special type of -% boolean value which can be tested by the function \cs{if_predicate:w} -% or in the boolean expression parser. All functions of this type +% boolean value which can be tested by the boolean expression parser. +% All functions of this type % are expandable and have names that end with |_p| in the % description part. For example, % \begin{quote} @@ -1033,26 +985,13 @@ % argument (a single token denoted by |N|) is still free for definition. % It would be used in constructions like % \begin{quote} -% |\if_predicate:w \cs_if_free_p:N \l_tmpz_tl| \\ -% | |\meta{true code} \\ -% |else:| \\ -% | |\meta{false code}\\ -% |\fi:| \\ -% \end{quote} -% or in expressions utilizing the boolean logic parser: -% \begin{quote} % |\bool_if:nTF {| \\ % \verb" \cs_if_free_p:N \l_tmpz_tl || \cs_if_free_p:N \g_tmpz_tl " \\ % |}| -% \Arg{true code} \Arg{false code} +% \Arg{true code} \Arg{false code} % \end{quote} -% -% Like their branching cousins, predicate functions ensure that all -% underlying primitive |\else:| or |\fi:| have been removed before -% returning the boolean true or false values.\footnote{If defined -% using the interface provided.} % -% For each predicate defined, a \enquote{predicate conditional} will +% For each predicate defined, a \enquote{branching conditional} will % also exist that behaves like a conditional described above. % % \item[Primitive conditionals] @@ -1060,22 +999,21 @@ % concept used in plain \TeX{} and \LaTeXe{}. Their use is discouraged % in \pkg{expl3} (although still used in low-level definitions) % because they are more fragile and in many cases require more -% expansion control (hence more code) than the two types of +% expansion control (hence more code) than the two types of % conditionals described above. % \end{description} -% +% % \begin{variable}{\c_true_bool, \c_false_bool} % Constants that represent |true| and |false|, respectively. Used to % implement predicates. -% \end{variable} -% +% \end{variable} +% % \subsection{Tests on control sequences} % % \begin{function}[EXP,pTF]{\cs_if_eq:NN} % \begin{syntax} % \cs{cs_if_eq_p:NN} \Arg{cs1} \Arg{cs2} -% \cs{cs_if_eq:NNTF} \Arg{cs1} \Arg{cs2} \Arg{true code} -% ~~\Arg{false code} +% \cs{cs_if_eq:NNTF} \Arg{cs1} \Arg{cs2} \Arg{true code} \Arg{false code} % \end{syntax} % Compares the definition of two \meta{control sequences} and % is logically \texttt{true} if the two are the same. @@ -1084,8 +1022,7 @@ % \begin{function}[EXP,pTF]{\cs_if_exist:N, \cs_if_exist:c} % \begin{syntax} % \cs{cs_if_exist_p:N} \meta{control sequence} -% \cs{cs_if_exist:NTF} \meta{control sequence} \meta{true code} -% ~~\meta{false code} +% \cs{cs_if_exist:NTF} \meta{control sequence} \Arg{true code} \Arg{false code} % \end{syntax} % Tests whether the \meta{control sequence} is currently defined % (whether as a function or another control sequence type). Any @@ -1096,19 +1033,18 @@ % \begin{function}[EXP,pTF]{\cs_if_free:N, \cs_if_free:c} % \begin{syntax} % \cs{cs_if_free_p:N} \meta{control sequence} -% \cs{cs_if_free:NTF} \meta{control sequence} \meta{true code} -% ~~\meta{false code} +% \cs{cs_if_free:NTF} \meta{control sequence} \Arg{true code} \Arg{false code} % \end{syntax} % Tests whether the \meta{control sequence} is currently free to % be defined. This test will be \texttt{false} if the % \meta{control sequence} currently exists (as defined by % \cs{cs_if_exist:N}). % \end{function} -% +% % \subsection{Testing string equality} % % \begin{function}[EXP,pTF] -% { +% { % \str_if_eq:nn, \str_if_eq:Vn, \str_if_eq:on, \str_if_eq:no, % \str_if_eq:nV, \str_if_eq:VV, \str_if_eq:xx % } @@ -1126,39 +1062,30 @@ % expandable (including those involving an \texttt{x}-type % expansion). % \end{function} -% +% % \subsection{Engine-specific conditionals} % -% \begin{function}[EXP,TF]{\luatex_if_engine:} +% \begin{function}[updated = 2011-09-06,EXP,pTF]{\luatex_if_engine:} % \begin{syntax} % \cs{luatex_if_luatex:TF} \Arg{true code} \Arg{false code} % \end{syntax} % Detects is the document is being compiled using \LuaTeX{}. % \end{function} % -% \begin{function}[EXP,TF]{\pdftex_if_engine:} +% \begin{function}[updated = 2011-09-06,EXP,pTF]{\pdftex_if_engine:} % \begin{syntax} % \cs{pdftex_if_engine:TF} \Arg{true code} \Arg{false code} % \end{syntax} % Detects is the document is being compiled using \pdfTeX{}. % \end{function} % -% \begin{function}[EXP,TF]{\xetex_if_engine:} +% \begin{function}[updated = 2011-09-06,EXP,pTF]{\xetex_if_engine:} % \begin{syntax} % \cs{xetex_if_engine:TF} \Arg{true code} \Arg{false code} % \end{syntax} % Detects is the document is being compiled using \XeTeX{}. % \end{function} % -% \begin{variable} -% { -% \c_luatex_is_engine_bool, \c_pdftex_is_engine_bool, -% \c_xetex_is_engine_bool -% } -% Boolean versions of the engine conditionals, for use in predicate -% tests. -% \end{variable} -% % \subsection{Primitive conditionals} % % The \eTeX{} engine itself provides many different conditionals. Some @@ -1171,60 +1098,59 @@ % fonts and are described there. The ones described below are either % the universal conditionals or deal with control sequences. We will % prefix primitive conditionals with |\if_|. -% +% % \begin{function}[EXP] % {\if_true:, \if_false:, \or:, \else:, \fi:, \reverse_if:N} -% \begin{syntax} -% "\if_true:" <true code> "\else:" <false code> "\fi:" \\ -% "\if_false:" <true code> "\else:" <false code> "\fi:" \\ -% "\reverse_if:N" <primitive conditional> -% \end{syntax} -% "\if_true:" always executes <true code>, while "\if_false:" always -% executes <false code>. "\reverse_if:N" reverses any two-way primitive -% conditional. "\else:" and "\fi:" delimit the branches of the -% conditional. "\or:" is used in case switches, see \pkg{l3intexpr} -% for more. -% \begin{texnote} -% These are equivalent to their corresponding \TeX\ primitive -% conditionals; |\reverse_if:N| is \eTeX's |\unless|. -% \end{texnote} -% \end{function} -% +% \begin{syntax} +% "\if_true:" <true code> "\else:" <false code> "\fi:" \\ +% "\if_false:" <true code> "\else:" <false code> "\fi:" \\ +% "\reverse_if:N" <primitive conditional> +% \end{syntax} +% "\if_true:" always executes <true code>, while "\if_false:" always +% executes <false code>. "\reverse_if:N" reverses any two-way primitive +% conditional. "\else:" and "\fi:" delimit the branches of the +% conditional. "\or:" is used in case switches, see \pkg{l3int} +% for more. +% \begin{texnote} +% These are equivalent to their corresponding \TeX\ primitive +% conditionals; |\reverse_if:N| is \eTeX's |\unless|. +% \end{texnote} +% \end{function} +% % \begin{function}[EXP]{\if_meaning:w} -% \begin{syntax} -% "\if_meaning:w" <arg1> <arg2> <true code> "\else:" <false code> "\fi:" -% \end{syntax} -% "\if_meaning:w" executes <true code> when <arg1> and <arg2> are the same, -% otherwise it executes <false code>. -% <arg1> and <arg2> could be functions, variables, tokens; in all cases the -% \emph{unexpanded} definitions are compared. -% \begin{texnote} -% This is \TeX's |\ifx|. -% \end{texnote} +% \begin{syntax} +% "\if_meaning:w" <arg1> <arg2> <true code> "\else:" <false code> "\fi:" +% \end{syntax} +% "\if_meaning:w" executes <true code> when <arg1> and <arg2> are the same, +% otherwise it executes <false code>. +% <arg1> and <arg2> could be functions, variables, tokens; in all cases the +% \emph{unexpanded} definitions are compared. +% \begin{texnote} +% This is \TeX's |\ifx|. +% \end{texnote} % \end{function} % % \begin{function}[EXP]{\if:w, \if_charcode:w,\if_catcode:w} -% \begin{syntax} -% "\if:w" <token1> <token2> <true code> "\else:" <false code> "\fi:" \\ -% "\if_catcode:w" <token1> <token2> <true code> "\else:" <false -% code> "\fi:" -% \end{syntax} -% These conditionals will expand any following tokens until two -% unexpandable tokens are left. If you wish to prevent this expansion, -% prefix the token in question with "\exp_not:N". "\if_catcode:w" -% tests if the category codes of the two tokens are the same whereas -% "\if:w" tests if the character codes are -% identical. "\if_charcode:w" is an alternative name for "\if:w". +% \begin{syntax} +% "\if:w" <token1> <token2> <true code> "\else:" <false code> "\fi:" \\ +% "\if_catcode:w" <token1> <token2> <true code> "\else:" <false code> "\fi:" +% \end{syntax} +% These conditionals will expand any following tokens until two +% unexpandable tokens are left. If you wish to prevent this expansion, +% prefix the token in question with "\exp_not:N". "\if_catcode:w" +% tests if the category codes of the two tokens are the same whereas +% "\if:w" tests if the character codes are +% identical. "\if_charcode:w" is an alternative name for "\if:w". % \end{function} % % \begin{function}[EXP]{\if_predicate:w} -% \begin{syntax} -% "\if_predicate:w" <predicate> <true code> "\else:" <false code> "\fi:" -% \end{syntax} -% This function takes a predicate function and -% branches according to the result. (In practice this function would also -% accept a single boolean variable in place of the <predicate> but to make the -% coding clearer this should be done through "\if_bool:N".) +% \begin{syntax} +% "\if_predicate:w" <predicate> <true code> "\else:" <false code> "\fi:" +% \end{syntax} +% This function takes a predicate function and +% branches according to the result. (In practice this function would also +% accept a single boolean variable in place of the <predicate> but to make the +% coding clearer this should be done through "\if_bool:N".) % \end{function} % % \begin{function}[EXP]{\if_bool:N} @@ -1238,8 +1164,7 @@ % \begin{function}[EXP]{\if_cs_exist:N, \if_cs_exist:w} % \begin{syntax} % "\if_cs_exist:N" <cs> <true code> "\else:" <false code> "\fi:" \\ -% "\if_cs_exist:w" <tokens> "\cs_end:" <true code> "\else:" <false -% code> "\fi:" +% "\if_cs_exist:w" <tokens> "\cs_end:" <true code> "\else:" <false code> "\fi:" % \end{syntax} % Check if <cs> appears in the hash table or if the control sequence % that can be formed from <tokens> appears in the hash table. The @@ -1259,9 +1184,9 @@ % Execute <true code> if currently in horizontal mode, otherwise % execute <false code>. Similar for the other functions. % \end{function} -% +% % \section{Internal kernel functions} -% +% % \begin{function}{\chk_if_exist_cs:N, \chk_if_exist_cs:c} % \begin{syntax} % \cs{chk_if_exist_cs:N} \meta{cs} @@ -1279,28 +1204,6 @@ % criteria for \cs{cs_if_free_p:N}, and if not raises a kernel-level % error. % \end{function} -% -% \begin{function}{\pref_global:D, \pref_long:D, \pref_protected:D} -% \begin{syntax} -% \cs{pref_global:D} \cs{cs_set_nopar:Npn} -% \end{syntax} -% Prefix functions that can be used in front of some definition -% functions (namely \ldots). The result of prefixing a function -% definition with \cs{pref_global:D} makes the definition global, -% \cs{pref_long:D} change the argument scanning mechanism so that it -% allows \cs{par} tokens in the argument of the prefixed function, -% and \cs{pref_protected:D} makes the definition robust inside -% \texttt{x}-type expansions. -% -% None of these internal functions should be used by a programmer since -% the necessary combinations are all available as separate function, -% \emph{e.g.} \cs{cs_set:Npn} is internally implemented as \cs{pref_long:D} -% \c{cs_set_nopar:Npn}. -% \begin{texnote} -% These prefixes are the primitives \tn{global}, \tn{long}, and -% \cs{protected}. -% \end{texnote} -% \end{function} % % \end{documentation} % @@ -1321,7 +1224,7 @@ % \end{macrocode} % % \subsection{Renaming some \TeX{} primitives (again)} -% +% % Having given all the \TeX{} primitives a consistent name, we need to % give sensible names to the ones we actually want to use. % These will be defined as needed in the appropriate modules, but @@ -1329,13 +1232,6 @@ % in terms of csname usage, an alternative scheme would be to just use % the \cs{tex\ldots:D} name in the cases where no good alternative exists.} % -% \begin{macro}{\cs_set_eq:NwN} -% A pretty basic requirement: \cs{let} one control sequence to another. -% \begin{macrocode}> -\tex_let:D \cs_set_eq:NwN \tex_let:D -% \end{macrocode} -% \end{macro} -% % \begin{macro}{\if_true:} % \begin{macro}{\if_false:} % \begin{macro}{\or:} @@ -1347,19 +1243,21 @@ % \begin{macro}{\if_predicate:w} % \begin{macro}{\if_charcode:w} % \begin{macro}{\if_catcode:w} +% \begin{macro}{\if_meaning:w} % Then some conditionals. % \begin{macrocode} -\cs_set_eq:NwN \if_true: \tex_iftrue:D -\cs_set_eq:NwN \if_false: \tex_iffalse:D -\cs_set_eq:NwN \or: \tex_or:D -\cs_set_eq:NwN \else: \tex_else:D -\cs_set_eq:NwN \fi: \tex_fi:D -\cs_set_eq:NwN \reverse_if:N \etex_unless:D -\cs_set_eq:NwN \if:w \tex_if:D -\cs_set_eq:NwN \if_bool:N \tex_ifodd:D -\cs_set_eq:NwN \if_predicate:w \tex_ifodd:D -\cs_set_eq:NwN \if_charcode:w \tex_if:D -\cs_set_eq:NwN \if_catcode:w \tex_ifcat:D +\tex_let:D \if_true: \tex_iftrue:D +\tex_let:D \if_false: \tex_iffalse:D +\tex_let:D \or: \tex_or:D +\tex_let:D \else: \tex_else:D +\tex_let:D \fi: \tex_fi:D +\tex_let:D \reverse_if:N \etex_unless:D +\tex_let:D \if:w \tex_if:D +\tex_let:D \if_bool:N \tex_ifodd:D +\tex_let:D \if_predicate:w \tex_ifodd:D +\tex_let:D \if_charcode:w \tex_if:D +\tex_let:D \if_catcode:w \tex_ifcat:D +\tex_let:D \if_meaning:w \tex_ifx:D % \end{macrocode} % \end{macro} % \end{macro} @@ -1372,11 +1270,6 @@ % \end{macro} % \end{macro} % \end{macro} -% -% \begin{macro}{\if_meaning:w} -% \begin{macrocode} -\cs_set_eq:NwN \if_meaning:w \tex_ifx:D -% \end{macrocode} % \end{macro} % % \begin{macro}{\if_mode_math:} @@ -1385,21 +1278,21 @@ % \begin{macro}{\if_mode_inner:} % \TeX{} lets us detect some if its modes. % \begin{macrocode} -\cs_set_eq:NwN \if_mode_math: \tex_ifmmode:D -\cs_set_eq:NwN \if_mode_horizontal: \tex_ifhmode:D -\cs_set_eq:NwN \if_mode_vertical: \tex_ifvmode:D -\cs_set_eq:NwN \if_mode_inner: \tex_ifinner:D +\tex_let:D \if_mode_math: \tex_ifmmode:D +\tex_let:D \if_mode_horizontal: \tex_ifhmode:D +\tex_let:D \if_mode_vertical: \tex_ifvmode:D +\tex_let:D \if_mode_inner: \tex_ifinner:D % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} -% +% % \begin{macro}{\if_cs_exist:N} % \begin{macro}{\if_cs_exist:w} % \begin{macrocode} -\cs_set_eq:NwN \if_cs_exist:N \etex_ifdefined:D -\cs_set_eq:NwN \if_cs_exist:w \etex_ifcsname:D +\tex_let:D \if_cs_exist:N \etex_ifdefined:D +\tex_let:D \if_cs_exist:w \etex_ifcsname:D % \end{macrocode} % \end{macro} % \end{macro} @@ -1410,14 +1303,14 @@ % The three |\exp_| functions are used in the \textsf{l3expan} module % where they are described. % \begin{macrocode} -\cs_set_eq:NwN \exp_after:wN \tex_expandafter:D -\cs_set_eq:NwN \exp_not:N \tex_noexpand:D -\cs_set_eq:NwN \exp_not:n \etex_unexpanded:D +\tex_let:D \exp_after:wN \tex_expandafter:D +\tex_let:D \exp_not:N \tex_noexpand:D +\tex_let:D \exp_not:n \etex_unexpanded:D % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} -% +% % \begin{macro}{\token_to_meaning:N} % \begin{macro}{\token_to_str:N} % \begin{macro}{\cs:w} @@ -1425,12 +1318,12 @@ % \begin{macro}{\cs_meaning:N} % \begin{macro}{\cs_show:N} % \begin{macrocode} -\cs_set_eq:NwN \token_to_meaning:N \tex_meaning:D -\cs_set_eq:NwN \token_to_str:N \tex_string:D -\cs_set_eq:NwN \cs:w \tex_csname:D -\cs_set_eq:NwN \cs_end: \tex_endcsname:D -\cs_set_eq:NwN \cs_meaning:N \tex_meaning:D -\cs_set_eq:NwN \cs_show:N \tex_show:D +\tex_let:D \token_to_meaning:N \tex_meaning:D +\tex_let:D \token_to_str:N \tex_string:D +\tex_let:D \cs:w \tex_csname:D +\tex_let:D \cs_end: \tex_endcsname:D +\tex_let:D \cs_meaning:N \tex_meaning:D +\tex_let:D \cs_show:N \tex_show:D % \end{macrocode} % \end{macro} % \end{macro} @@ -1446,48 +1339,48 @@ % versions that are safe inside alignments. These safe versions are % defined in the \textsf{l3prg} module. % \begin{macrocode} -\cs_set_eq:NwN \scan_stop: \tex_relax:D -\cs_set_eq:NwN \group_begin: \tex_begingroup:D -\cs_set_eq:NwN \group_end: \tex_endgroup:D +\tex_let:D \scan_stop: \tex_relax:D +\tex_let:D \group_begin: \tex_begingroup:D +\tex_let:D \group_end: \tex_endgroup:D % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} -% +% % \begin{macro}{\if_int_compare:w} % \begin{macro}{\int_to_roman:w} % \begin{macrocode} -\cs_set_eq:NwN \if_int_compare:w \tex_ifnum:D -\cs_set_eq:NwN \int_to_roman:w \tex_romannumeral:D +\tex_let:D \if_int_compare:w \tex_ifnum:D +\tex_let:D \int_to_roman:w \tex_romannumeral:D % \end{macrocode} % \end{macro} % \end{macro} -% +% % \begin{macro}{\group_insert_after:N} % \begin{macrocode} -\cs_set_eq:NwN \group_insert_after:N \tex_aftergroup:D +\tex_let:D \group_insert_after:N \tex_aftergroup:D % \end{macrocode} % \end{macro} -% -% \begin{macro}{\pref_global:D} -% \begin{macro}{\pref_long:D} -% \begin{macro}{\pref_protected:D} +% +% \begin{macro}{\tex_global:D} +% \begin{macro}{\tex_long:D} +% \begin{macro}{\tex_protected:D} % \begin{macrocode} -\cs_set_eq:NwN \pref_global:D \tex_global:D -\cs_set_eq:NwN \pref_long:D \tex_long:D -\cs_set_eq:NwN \pref_protected:D \etex_protected:D +\tex_let:D \tex_global:D \tex_global:D +\tex_let:D \tex_long:D \tex_long:D +\tex_let:D \tex_protected:D \etex_protected:D % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} -% +% % \begin{macro}{\exp_args:Nc} % Discussed in \pkg{l3expan}, but needed much earlier. % \begin{macrocode} \tex_long:D \tex_def:D \exp_args:Nc #1#2 { \exp_after:wN #1 \cs:w #2 \cs_end: } % \end{macrocode} % \end{macro} -% +% % \begin{macro}{\token_to_str:c} % \begin{macro}{\cs_meaning:c} % \begin{macro}{\cs_show:c} @@ -1518,20 +1411,20 @@ % after all, the \TeX{} primitives for assignments are and it can be % a cause of problems if others aren't. % \begin{macrocode} -\cs_set_eq:NwN \cs_set_nopar:Npn \tex_def:D -\cs_set_eq:NwN \cs_set_nopar:Npx \tex_edef:D -\pref_protected:D \cs_set_nopar:Npn \cs_set:Npn - { \pref_long:D \cs_set_nopar:Npn } -\pref_protected:D \cs_set_nopar:Npn \cs_set:Npx - { \pref_long:D \cs_set_nopar:Npx } -\pref_protected:D \cs_set_nopar:Npn \cs_set_protected_nopar:Npn - { \pref_protected:D \cs_set_nopar:Npn } -\pref_protected:D \cs_set_nopar:Npn \cs_set_protected_nopar:Npx - { \pref_protected:D \cs_set_nopar:Npx } +\tex_let:D \cs_set_nopar:Npn \tex_def:D +\tex_let:D \cs_set_nopar:Npx \tex_edef:D +\tex_protected:D \cs_set_nopar:Npn \cs_set:Npn + { \tex_long:D \cs_set_nopar:Npn } +\tex_protected:D \cs_set_nopar:Npn \cs_set:Npx + { \tex_long:D \cs_set_nopar:Npx } +\tex_protected:D \cs_set_nopar:Npn \cs_set_protected_nopar:Npn + { \tex_protected:D \cs_set_nopar:Npn } +\tex_protected:D \cs_set_nopar:Npn \cs_set_protected_nopar:Npx + { \tex_protected:D \cs_set_nopar:Npx } \cs_set_protected_nopar:Npn \cs_set_protected:Npn - { \pref_protected:D \pref_long:D \cs_set_nopar:Npn } + { \tex_protected:D \tex_long:D \cs_set_nopar:Npn } \cs_set_protected_nopar:Npn \cs_set_protected:Npx - { \pref_protected:D \pref_long:D \cs_set_nopar:Npx } + { \tex_protected:D \tex_long:D \cs_set_nopar:Npx } % \end{macrocode} % \end{macro} % \end{macro} @@ -1552,20 +1445,20 @@ % \begin{macro}{\cs_gset_protected:Npx} % Global versions of the above functions. % \begin{macrocode} -\cs_set_eq:NwN \cs_gset_nopar:Npn \tex_gdef:D -\cs_set_eq:NwN \cs_gset_nopar:Npx \tex_xdef:D +\tex_let:D \cs_gset_nopar:Npn \tex_gdef:D +\tex_let:D \cs_gset_nopar:Npx \tex_xdef:D \cs_set_protected_nopar:Npn \cs_gset:Npn - { \pref_long:D \cs_gset_nopar:Npn } + { \tex_long:D \cs_gset_nopar:Npn } \cs_set_protected_nopar:Npn \cs_gset:Npx - { \pref_long:D \cs_gset_nopar:Npx } + { \tex_long:D \cs_gset_nopar:Npx } \cs_set_protected_nopar:Npn \cs_gset_protected_nopar:Npn - { \pref_protected:D \cs_gset_nopar:Npn } + { \tex_protected:D \cs_gset_nopar:Npn } \cs_set_protected_nopar:Npn \cs_gset_protected_nopar:Npx - { \pref_protected:D \cs_gset_nopar:Npx } + { \tex_protected:D \cs_gset_nopar:Npx } \cs_set_protected_nopar:Npn \cs_gset_protected:Npn - { \pref_protected:D \pref_long:D \cs_gset_nopar:Npn } + { \tex_protected:D \tex_long:D \cs_gset_nopar:Npn } \cs_set_protected_nopar:Npn \cs_gset_protected:Npx - { \pref_protected:D \pref_long:D \cs_gset_nopar:Npx } + { \tex_protected:D \tex_long:D \cs_gset_nopar:Npx } % \end{macrocode} % \end{macro} % \end{macro} @@ -1621,7 +1514,7 @@ % % \begin{macro}{\use_i:nn} % \begin{macro}{\use_ii:nn} -% The equivalent to \LaTeXe{}'s \cs{@firstoftwo} and \cs{@secondoftwo}. +% The equivalent to \LaTeXe{}'s \tn{@firstoftwo} and \tn{@secondoftwo}. % \begin{macrocode} \cs_set:Npn \use_i:nn #1#2 {#1} \cs_set:Npn \use_ii:nn #1#2 {#2} @@ -1687,22 +1580,6 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\use_i_after_fi:nw} -% \begin{macro}{\use_i_after_else:nw} -% \begin{macro}{\use_i_after_or:nw} -% \begin{macro}{\use_i_after_orelse:nw} -% Returns the first argument after ending the conditional. -% \begin{macrocode} -\cs_set:Npn \use_i_after_fi:nw #1 \fi: { \fi: #1 } -\cs_set:Npn \use_i_after_else:nw #1 \else: #2 \fi: { \fi: #1 } -\cs_set:Npn \use_i_after_or:nw #1 \or: #2 \fi: { \fi: #1 } -\cs_set:Npn \use_i_after_orelse:nw #1#2#3 \fi: { \fi: #1 } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% % \subsection{Gobbling tokens from input} % % \begin{macro}{\use_none:n} @@ -1749,9 +1626,9 @@ % testing and processing must return the \meta{state} this leaves % \TeX{} in. Therefore, a simple user interface could be something like % \begin{verbatim} -% \if_meaning:w #1#2 \prg_return_true: \else: +% \if_meaning:w #1#2 \prg_return_true: \else: % \if_meaning:w #1#3 \prg_return_true: \else: -% \prg_return_false: +% \prg_return_false: % \fi: \fi: % \end{verbatim} % Usually, a \TeX{} programmer would have to insert a number of @@ -1793,7 +1670,7 @@ { \prg_get_parm_aux:nw { - \cs_split_function:NN #1 \prg_generate_conditional_aux:nnNNnnnn + \cs_split_function:NN #1 \prg_generate_conditional_aux:nnNNnnnn \cs_set:Npn { parm } } } @@ -1801,14 +1678,14 @@ { \prg_get_parm_aux:nw { - \cs_split_function:NN #1 \prg_generate_conditional_aux:nnNNnnnn + \cs_split_function:NN #1 \prg_generate_conditional_aux:nnNNnnnn \cs_new:Npn { parm } } } \cs_set_protected:Npn \prg_set_protected_conditional:Npnn #1 { \prg_get_parm_aux:nw{ - \cs_split_function:NN #1 \prg_generate_conditional_aux:nnNNnnnn + \cs_split_function:NN #1 \prg_generate_conditional_aux:nnNNnnnn \cs_set_protected:Npn { parm } } } @@ -1821,7 +1698,7 @@ } } % \end{macrocode} -% \end{macro} +% \end{macro} % % \begin{macro}{\prg_set_conditional:Nnn,\prg_new_conditional:Nnn, % \prg_set_protected_conditional:Nnn,\prg_new_protected_conditional:Nnn} @@ -1868,7 +1745,7 @@ } % \end{macrocode} % \end{macro} -% +% % \begin{macro}{\prg_set_eq_conditional:NNn,\prg_new_eq_conditional:NNn} % The obvious setting-equal functions. % \begin{macrocode} @@ -1889,6 +1766,7 @@ \cs_set:Npn \prg_get_parm_aux:nw #1#2# { #1 {#2} } % \end{macrocode} % \end{macro} +% % \begin{macro}[aux]{\prg_generate_conditional_parm_aux:nnNNnnnn, % \prg_generate_conditional_parm_aux:nw} % The workhorse here is going through a list of desired forms, \emph{i.e.}, @@ -1946,7 +1824,7 @@ { \exp_args:Nc #1 { #2 _p: #3 } #4 { - #5 \c_zero + #5 \c_zero \c_true_bool \c_false_bool } } @@ -1973,6 +1851,7 @@ } % \end{macrocode} % \end{macro} +% % \begin{macro}[aux] % { % \prg_generate_p_form_count:Nnnnn, @@ -1987,7 +1866,7 @@ { \cs_generate_from_arg_count:cNnn { #2 _p: #3 } #1 {#4} { - #5 \c_zero + #5 \c_zero \c_true_bool \c_false_bool } } @@ -2014,7 +1893,7 @@ } % \end{macrocode} % \end{macro} -% +% % \begin{macro}[aux]{\prg_set_eq_conditional_aux:NNNn, % \prg_set_eq_conditional_aux:NNNw} % \begin{macrocode} @@ -2078,7 +1957,7 @@ % |\token_to_str:N \a|. If there are two tokens, then the escape % character is printable, while if it is non-printable then only % one is present. -% +% % However, there is an additional complication: the control % sequence itself may start with a space. Clearly that should \emph{not} be % lost in the process of converting to a string. So the approach adopted is @@ -2086,7 +1965,7 @@ % \verb*|\token_to_str:N \ | yields the escape character itself and a space. % The escape sequence will terminate the expansion started by % \cs{int_to_roman:w}, which is a negative number and so will not -% gobble the escape character even if it's a number. The \cs{tex_if:D} +% gobble the escape character even if it's a number. The \cs{if:w} % test will then be \texttt{false}, and the na\"ive approach of gobbling % the first character of the \cs{token_to_str:N} version of the control % sequence will work, even if the first character is a space. @@ -2103,7 +1982,7 @@ % space, which terminates the first \cs{int_to_roman:w} but leaves no % token for the \cs{if:w} test. This means that the \cs{int_to_roman:w} % is executed before the test is finished. The result is that the -% \cs{fi:}, expanded before the \cs{tex_if:D} is finished, becomes +% \cs{fi:}, expanded before the \cs{if:w} is finished, becomes % \cs{scan_stop:} \cs{fi:}, and the \cs{scan_stop:} is then used in % the \cs{if:w} test. % In this case, \cs{token_to_str:N} is therefore used with no gobbling at @@ -2152,8 +2031,8 @@ % \begin{macrocode} \cs_set:Npn \cs_split_function:NN #1#2 { - \exp_after:wN \cs_split_function_aux:w - \int_to_roman:w - `\q \cs_to_str:N #1 @ a \q_stop #2 + \exp_after:wN \cs_split_function_aux:w + \int_to_roman:w - `\q \cs_to_str:N #1 @ a \q_stop #2 } % \end{macrocode} % If no colon in the name, |#2| is |a| with catcode 11 and |#3| is @@ -2166,11 +2045,11 @@ % \begin{macrocode} \cs_set:Npn \cs_split_function_aux:w #1 @ #2#3 \q_stop #4 { - \if_meaning:w a #2 - \exp_after:wN \use_i:nn + \if_meaning:w a #2 + \exp_after:wN \use_i:nn \else: \exp_after:wN\use_ii:nn - \fi: + \fi: { #4 {#1} { } \c_false_bool } { \cs_split_function_auxii:w #2#3 \q_stop #4 {#1} } } @@ -2232,7 +2111,7 @@ % \begin{macrocode} \prg_set_conditional:Npnn \cs_if_exist:c #1 { p , T , F , TF } { - \if_cs_exist:w #1 \cs_end: + \if_cs_exist:w #1 \cs_end: \exp_after:wN \use_i:nn \else: \exp_after:wN \use_ii:nn @@ -2240,7 +2119,7 @@ { \exp_after:wN \if_meaning:w \cs:w #1 \cs_end: \scan_stop: \prg_return_false: - \else: + \else: \prg_return_true: \fi: } @@ -2267,7 +2146,7 @@ } \prg_set_conditional:Npnn \cs_if_free:c #1 { p , T , F , TF } { - \if_cs_exist:w #1 \cs_end: + \if_cs_exist:w #1 \cs_end: \exp_after:wN \use_i:nn \else: \exp_after:wN \use_ii:nn @@ -2275,7 +2154,7 @@ { \exp_after:wN \if_meaning:w \cs:w #1 \cs_end: \scan_stop: \prg_return_true: - \else: + \else: \prg_return_false: \fi: } @@ -2301,7 +2180,7 @@ % |\c_minus_one|. % \begin{macrocode} %<*package> -\cs_set_eq:NwN \c_minus_one \m@ne +\tex_let:D \c_minus_one \m@ne %</package> %<*initex> \tex_countdef:D \c_minus_one = 10 ~ @@ -2357,7 +2236,7 @@ % a reasonable response. % \begin{macrocode} \cs_set_protected_nopar:Npn \msg_kernel_error:nnxx #1#2#3#4 - { + { \tex_errmessage:D { !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!~! ^^J @@ -2376,7 +2255,7 @@ % \end{macro} % \end{macro} % \end{macro} -% +% % \begin{macro}{\msg_line_context:} % Another one from \pkg{l3msg} which will be altered later. % \begin{macrocode} @@ -2385,15 +2264,6 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\cs_record_meaning:N} -% This macro will be used later on for tracing purposes. But we -% need some more modules to define it, so we just give some dummy -% definition here. -% \begin{macrocode} -\cs_set:Npn \cs_record_meaning:N #1 { } -% \end{macrocode} -% \end{macro} -% % \begin{macro}{\chk_if_free_cs:N, \chk_if_free_cs:c} % This command is called by |\cs_new_nopar:Npn| and |\cs_new_eq:NN| % \emph{etc.}\ @@ -2402,7 +2272,7 @@ % undefined or |\scan_stop:|. Otherwise an error message is % issued. We have to make sure we don't put the argument into the % conditional processing since it may be an |\if...| type function! -% \begin {macrocode} +% \begin{macrocode} \cs_set_protected_nopar:Npn \chk_if_free_cs:N #1 { \cs_if_free:NF #1 @@ -2424,7 +2294,7 @@ } \fi: %</package> -\cs_set_protected_nopar:Npn \chk_if_free_cs:c +\cs_set_protected_nopar:Npn \chk_if_free_cs:c { \exp_args:Nc \chk_if_free_cs:N } % \end{macrocode} % \end{macro} @@ -2457,11 +2327,11 @@ % \begin{macro}{\cs_new_protected:Npn} % \begin{macro}{\cs_new_protected:Npx} % Global versions of the above functions. -% \begin {macrocode} +% \begin{macrocode} \cs_set:Npn \cs_tmp:w #1#2 { - \cs_set_protected_nopar:Npn #1 ##1 - { + \cs_set_protected_nopar:Npn #1 ##1 + { \chk_if_free_cs:N ##1 #2 ##1 } @@ -2497,16 +2367,16 @@ % versions are also provided. % % |\cs_set_nopar:cpn|\meta{string}\meta{rep-text} will turn \meta{string} -% into a csname and then assign \m {rep-text} to it by using +% into a csname and then assign \meta{rep-text} to it by using % |\cs_set_nopar:Npn|. This means that there might be a parameter % string between the two arguments. % \begin{macrocode} \cs_set:Npn \cs_tmp:w #1#2 { \cs_new_protected_nopar:Npn #1 { \exp_args:Nc #2 } } -\cs_tmp:w \cs_set_nopar:cpn \cs_set_nopar:Npn -\cs_tmp:w \cs_set_nopar:cpx \cs_set_nopar:Npx -\cs_tmp:w \cs_gset_nopar:cpn \cs_gset_nopar:Npn -\cs_tmp:w \cs_gset_nopar:cpx \cs_gset_nopar:Npx +\cs_tmp:w \cs_set_nopar:cpn \cs_set_nopar:Npn +\cs_tmp:w \cs_set_nopar:cpx \cs_set_nopar:Npx +\cs_tmp:w \cs_gset_nopar:cpn \cs_gset_nopar:Npn +\cs_tmp:w \cs_gset_nopar:cpx \cs_gset_nopar:Npx \cs_tmp:w \cs_new_nopar:cpn \cs_new_nopar:Npn \cs_tmp:w \cs_new_nopar:cpx \cs_new_nopar:Npx % \end{macrocode} @@ -2526,12 +2396,12 @@ % Variants of the |\cs_set:Npn| versions which make a csname out % of the first arguments. We may also do this globally. % \begin{macrocode} -\cs_tmp:w \cs_set:cpn \cs_set:Npn -\cs_tmp:w \cs_set:cpx \cs_set:Npx -\cs_tmp:w \cs_gset:cpn \cs_gset:Npn -\cs_tmp:w \cs_gset:cpx \cs_gset:Npx -\cs_tmp:w \cs_new:cpn \cs_new:Npn -\cs_tmp:w \cs_new:cpx \cs_new:Npx +\cs_tmp:w \cs_set:cpn \cs_set:Npn +\cs_tmp:w \cs_set:cpx \cs_set:Npx +\cs_tmp:w \cs_gset:cpn \cs_gset:Npn +\cs_tmp:w \cs_gset:cpx \cs_gset:Npx +\cs_tmp:w \cs_new:cpn \cs_new:Npn +\cs_tmp:w \cs_new:cpx \cs_new:Npx % \end{macrocode} % \end{macro} % \end{macro} @@ -2549,12 +2419,12 @@ % Variants of the |\cs_set_protected_nopar:Npn| versions which make a csname % out of the first arguments. We may also do this globally. % \begin{macrocode} -\cs_tmp:w \cs_set_protected_nopar:cpn \cs_set_protected_nopar:Npn -\cs_tmp:w \cs_set_protected_nopar:cpx \cs_set_protected_nopar:Npx +\cs_tmp:w \cs_set_protected_nopar:cpn \cs_set_protected_nopar:Npn +\cs_tmp:w \cs_set_protected_nopar:cpx \cs_set_protected_nopar:Npx \cs_tmp:w \cs_gset_protected_nopar:cpn \cs_gset_protected_nopar:Npn \cs_tmp:w \cs_gset_protected_nopar:cpx \cs_gset_protected_nopar:Npx \cs_tmp:w \cs_new_protected_nopar:cpn \cs_new_protected_nopar:Npn -\cs_tmp:w \cs_new_protected_nopar:cpx \cs_new_protected_nopar:Npx +\cs_tmp:w \cs_new_protected_nopar:cpx \cs_new_protected_nopar:Npx % \end{macrocode} % \end{macro} % \end{macro} @@ -2572,46 +2442,12 @@ % Variants of the |\cs_set_protected:Npn| versions which make a csname % out of the first arguments. We may also do this globally. % \begin{macrocode} -\cs_tmp:w \cs_set_protected:cpn \cs_set_protected:Npn +\cs_tmp:w \cs_set_protected:cpn \cs_set_protected:Npn \cs_tmp:w \cs_set_protected:cpx \cs_set_protected:Npx -\cs_tmp:w \cs_gset_protected:cpn \cs_gset_protected:Npn +\cs_tmp:w \cs_gset_protected:cpn \cs_gset_protected:Npn \cs_tmp:w \cs_gset_protected:cpx \cs_gset_protected:Npx -\cs_tmp:w \cs_new_protected:cpn \cs_new_protected:Npn -\cs_tmp:w \cs_new_protected:cpx \cs_new_protected:Npx -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}[aux]{\use_0_parameter:} -% \begin{macro}[aux]{\use_1_parameter:} -% \begin{macro}[aux]{\use_2_parameter:} -% \begin{macro}[aux]{\use_3_parameter:} -% \begin{macro}[aux]{\use_4_parameter:} -% \begin{macro}[aux]{\use_5_parameter:} -% \begin{macro}[aux]{\use_6_parameter:} -% \begin{macro}[aux]{\use_7_parameter:} -% \begin{macro}[aux]{\use_8_parameter:} -% \begin{macro}[aux]{\use_9_parameter:} -% For using parameters, \emph{i.e.}, when you need to define a function to -% process three parameters. See \textsf{xparse} for an application. -% \begin{macrocode} -\cs_new_nopar:cpn { use_0_parameter: } { } -\cs_new_nopar:cpn { use_1_parameter: } { {##1} } -\cs_new_nopar:cpn { use_2_parameter: } { {##1} {##2} } -\cs_new_nopar:cpn { use_3_parameter: } { {##1} {##2} {##3} } -\cs_new_nopar:cpn { use_4_parameter: } { {##1} {##2} {##3} {##4} } -\cs_new_nopar:cpn { use_5_parameter: } { {##1} {##2} {##3} {##4} {##5} } -\cs_new_nopar:cpn { use_6_parameter: } { {##1} {##2} {##3} {##4} {##5} {##6} } -\cs_new_nopar:cpn { use_7_parameter: } - { {##1} {##2} {##3} {##4} {##5}{##6} {##7} } -\cs_new_nopar:cpn { use_8_parameter: } - { {##1} {##2} {##3} {##4} {##5} {##6} {##7} {##8} } -\cs_new_nopar:cpn{ use_9_parameter: } - { {##1} {##2} {##3} {##4} {##5} {##6} {##7} {##8} {##9} } +\cs_tmp:w \cs_new_protected:cpn \cs_new_protected:Npn +\cs_tmp:w \cs_new_protected:cpx \cs_new_protected:Npx % \end{macrocode} % \end{macro} % \end{macro} @@ -2619,10 +2455,6 @@ % \end{macro} % \end{macro} % \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % % \subsection{Copying definitions} % @@ -2643,7 +2475,7 @@ % an \enquote{already defined} error rather than % \enquote{runaway argument}. % \begin{macrocode} -\cs_new_protected:Npn \cs_set_eq:NN #1 { \cs_set_eq:NwN #1 =~ } +\cs_new_protected:Npn \cs_set_eq:NN #1 { \tex_let:D #1 =~ } \cs_new_protected_nopar:Npn \cs_set_eq:cN { \exp_args:Nc \cs_set_eq:NN } \cs_new_protected_nopar:Npn \cs_set_eq:Nc { \exp_args:NNc \cs_set_eq:NN } \cs_new_protected_nopar:Npn \cs_set_eq:cc { \exp_args:Ncc \cs_set_eq:NN } @@ -2658,10 +2490,10 @@ % \begin{macro}{\cs_new_eq:Nc} % \begin{macro}{\cs_new_eq:cc} % \begin{macrocode} -\cs_new_protected:Npn \cs_new_eq:NN #1 +\cs_new_protected:Npn \cs_new_eq:NN #1 { \chk_if_free_cs:N #1 - \pref_global:D \cs_set_eq:NN #1 + \tex_global:D \cs_set_eq:NN #1 } \cs_new_protected_nopar:Npn \cs_new_eq:cN { \exp_args:Nc \cs_new_eq:NN } \cs_new_protected_nopar:Npn \cs_new_eq:Nc { \exp_args:NNc \cs_new_eq:NN } @@ -2677,7 +2509,7 @@ % \begin{macro}{\cs_gset_eq:Nc} % \begin{macro}{\cs_gset_eq:cc} % \begin{macrocode} -\cs_new_protected_nopar:Npn \cs_gset_eq:NN { \pref_global:D \cs_set_eq:NN } +\cs_new_protected_nopar:Npn \cs_gset_eq:NN { \tex_global:D \cs_set_eq:NN } \cs_new_protected_nopar:Npn \cs_gset_eq:Nc { \exp_args:NNc \cs_gset_eq:NN } \cs_new_protected_nopar:Npn \cs_gset_eq:cN { \exp_args:Nc \cs_gset_eq:NN } \cs_new_protected_nopar:Npn \cs_gset_eq:cc { \exp_args:Ncc \cs_gset_eq:NN } @@ -2689,7 +2521,7 @@ % % \subsection{Undefining functions} % -% \begin{macro}{\cs_undefine:N , \cs_undefine:c} +% \begin{macro}{\cs_undefine:N, \cs_undefine:c} % The following function is used to free the main memory from the % definition of some function that isn't in use any longer. % \begin{macrocode} @@ -2720,13 +2552,13 @@ \cs_new:Npn \cs_get_arg_count_from_signature_aux:nnN #1#2#3 { \if_predicate:w #3 - \exp_after:wN \use_i:nn + \exp_after:wN \use_i:nn \else: \exp_after:wN\use_ii:nn - \fi: + \fi: { - \exp_after:wN \cs_get_arg_count_from_signature_auxii:w - \use_none:nnnnnnnnn #2 9876543210 \q_stop + \exp_after:wN \cs_get_arg_count_from_signature_auxii:w + \use_none:nnnnnnnnn #2 9876543210 \q_stop } { -1 } } @@ -2743,6 +2575,7 @@ % % \begin{macro}[aux]{\cs_generate_from_arg_count:NNnn} % \begin{macro}[aux]{\cs_generate_from_arg_count_error_msg:Nn} +% \begin{macro}[aux]{\cs_generate_from_arg_count_aux:nwn} % We provide a constructor function for defining functions with a % given number of arguments. For this we need to choose the correct % parameter text and then use that when defining. Since \TeX{} @@ -2757,34 +2590,26 @@ \cs_new_protected:Npn \cs_generate_from_arg_count:NNnn #1#2#3#4 { \if_case:w \int_eval:w #3 \int_eval_end: - \use_i_after_orelse:nw {#2#1} - \or: - \use_i_after_orelse:nw {#2#1 ##1} - \or: - \use_i_after_orelse:nw {#2#1 ##1##2} - \or: - \use_i_after_orelse:nw {#2#1 ##1##2##3} - \or: - \use_i_after_orelse:nw {#2#1 ##1##2##3##4} - \or: - \use_i_after_orelse:nw {#2#1 ##1##2##3##4##5} - \or: - \use_i_after_orelse:nw {#2#1 ##1##2##3##4##5##6} - \or: - \use_i_after_orelse:nw {#2#1 ##1##2##3##4##5##6##7} - \or: - \use_i_after_orelse:nw {#2#1 ##1##2##3##4##5##6##7##8} - \or: - \use_i_after_orelse:nw {#2#1 ##1##2##3##4##5##6##7##8##9} + \cs_generate_from_arg_count_aux:nwn {} + \or: \cs_generate_from_arg_count_aux:nwn {##1} + \or: \cs_generate_from_arg_count_aux:nwn {##1##2} + \or: \cs_generate_from_arg_count_aux:nwn {##1##2##3} + \or: \cs_generate_from_arg_count_aux:nwn {##1##2##3##4} + \or: \cs_generate_from_arg_count_aux:nwn {##1##2##3##4##5} + \or: \cs_generate_from_arg_count_aux:nwn {##1##2##3##4##5##6} + \or: \cs_generate_from_arg_count_aux:nwn {##1##2##3##4##5##6##7} + \or: \cs_generate_from_arg_count_aux:nwn {##1##2##3##4##5##6##7##8} + \or: \cs_generate_from_arg_count_aux:nwn {##1##2##3##4##5##6##7##8##9} \else: - \use_i_after_fi:nw - { - \cs_generate_from_arg_count_error_msg:Nn #1 {#3} - \use_none:n - } + \cs_generate_from_arg_count_error_msg:Nn #1 {#3} + \use_i:nnn \fi: + {#2#1} {#4} } +\cs_new_protected_nopar:Npn + \cs_generate_from_arg_count_aux:nwn #1 #2 \fi: #3 + { \fi: #3 #1 } % \end{macrocode} % A variant form we need right away. % \begin{macrocode} @@ -2798,10 +2623,11 @@ { \msg_kernel_error:nnxx { kernel } { bad-number-of-arguments } { \token_to_str:N #1 } { \int_eval:n {#2} } - } + } % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} % % \subsection{Using the signature to define functions} % @@ -2810,7 +2636,6 @@ % with user interface |\cs_set:Nn \foo_bar:nn {#1,#2}|, \emph{i.e.}, the % number of arguments is read from the signature. % -% % \begin{macro}{\cs_set:Nn} % \begin{macro}{\cs_set:Nx} % \begin{macro}{\cs_set_nopar:Nn} @@ -2827,11 +2652,11 @@ % \begin{macro}{\cs_gset_protected:Nx} % \begin{macro}{\cs_gset_protected_nopar:Nn} % \begin{macro}{\cs_gset_protected_nopar:Nx} -% We want to define |\cs_set:Nn| as +% We want to define |\cs_set:Nn| as % \begin{verbatim} % \cs_set_protected:Npn \cs_set:Nn #1#2 % { -% \cs_generate_from_arg_count:NNnn #1 \cs_set:Npn +% \cs_generate_from_arg_count:NNnn #1 \cs_set:Npn % { \cs_get_arg_count_from_signature:N #1 } {#2} % } % \end{verbatim} @@ -2845,12 +2670,12 @@ \cs_set_protected:cpx { cs_ #1 : #2 } ##1##2 { \exp_not:N \cs_generate_from_arg_count:NNnn ##1 - \exp_after:wN \exp_not:N \cs:w cs_#1 : #3 \cs_end: + \exp_after:wN \exp_not:N \cs:w cs_#1 : #3 \cs_end: { \exp_not:N\cs_get_arg_count_from_signature:N ##1 }{##2} } } % \end{macrocode} -% Then we define the 32 variants beginning with |N|. +% Then we define the 32 variants beginning with |N|. % \begin{macrocode} \cs_tmp:w { set } { Nn } { Npn } \cs_tmp:w { set } { Nx } { Npx } @@ -2913,11 +2738,11 @@ % \end{macro} % \end{macro} % -% Then something similar for the |c| variants. +% Then something similar for the |c| variants. % \begin{verbatim} % \cs_set_protected:Npn \cs_set:cn #1#2 % { -% \cs_generate_from_arg_count:cNnn {#1} \cs_set:Npn +% \cs_generate_from_arg_count:cNnn {#1} \cs_set:Npn % { \cs_get_arg_count_from_signature:c {#1} } {#2} % } % \end{verbatim} @@ -2926,7 +2751,7 @@ { \cs_set_protected:cpx {cs_#1:#2}##1##2{ \exp_not:N\cs_generate_from_arg_count:cNnn {##1} - \exp_after:wN \exp_not:N \cs:w cs_#1:#3 \cs_end: + \exp_after:wN \exp_not:N \cs:w cs_#1:#3 \cs_end: { \exp_not:N \cs_get_arg_count_from_signature:c {##1} } {##2} } } @@ -3009,7 +2834,7 @@ % \end{macro} % \end{macro} % \end{macro} -% +% % \subsection{Checking control sequence equality} % % \begin{macro}[pTF]{\cs_if_eq:NN,\cs_if_eq:cN,\cs_if_eq:Nc,\cs_if_eq:cc} @@ -3034,7 +2859,7 @@ \cs_new_nopar:Npn \cs_if_eq:ccF { \exp_args:Ncc \cs_if_eq:NNF } % \end{macrocode} % \end{macro} -% +% % \subsection{Diagnostic wrapper functions} % % \begin{macro}{\kernel_register_show:N, \kernel_register_show:c} @@ -3054,15 +2879,9 @@ % % \subsection{Engine specific definitions} % -% \begin{macro} -% { -% \c_pdftex_is_engine_bool, \c_luatex_is_engine_bool, -% \c_xetex_is_engine_bool -% } -% \begin{macro}[TF]{\xetex_if_engine:, \luatex_if_engine:, \pdftex_if_engine:} +% \begin{macro}[pTF]{\xetex_if_engine:, \luatex_if_engine:, \pdftex_if_engine:} % In some cases it will be useful to know which engine we're running. -% Don't provide a |_p| predicate because the |_bool| is used for the -% same thing. This can all be hard-coded for speed. +% This can all be hard-coded for speed. % \begin{macrocode} \cs_new_eq:NN \luatex_if_engine:T \use_none:n \cs_new_eq:NN \luatex_if_engine:F \use:n @@ -3073,9 +2892,9 @@ \cs_new_eq:NN \xetex_if_engine:T \use_none:n \cs_new_eq:NN \xetex_if_engine:F \use:n \cs_new_eq:NN \xetex_if_engine:TF \use_ii:nn -\cs_new_eq:NN \c_luatex_is_engine_bool \c_false_bool -\cs_new_eq:NN \c_pdftex_is_engine_bool \c_true_bool -\cs_new_eq:NN \c_xetex_is_engine_bool \c_false_bool +\cs_new_eq:NN \luatex_if_engine_p: \c_false_bool +\cs_new_eq:NN \pdftex_if_engine_p: \c_true_bool +\cs_new_eq:NN \xetex_if_engine_p: \c_false_bool \cs_if_exist:NT \xetex_XeTeXversion:D { \cs_set_eq:NN \pdftex_if_engine:T \use_none:n @@ -3084,8 +2903,8 @@ \cs_set_eq:NN \xetex_if_engine:T \use:n \cs_set_eq:NN \xetex_if_engine:F \use_none:n \cs_set_eq:NN \xetex_if_engine:TF \use_i:nn - \cs_set_eq:NN \c_pdftex_is_engine_bool \c_false_bool - \cs_set_eq:NN \c_xetex_is_engine_bool \c_true_bool + \cs_set_eq:NN \pdftex_if_engine_p: \c_false_bool + \cs_set_eq:NN \xetex_if_engine_p: \c_true_bool } \cs_if_exist:NT \luatex_directlua:D { @@ -3095,12 +2914,11 @@ \cs_set_eq:NN \pdftex_if_engine:T \use_none:n \cs_set_eq:NN \pdftex_if_engine:F \use:n \cs_set_eq:NN \pdftex_if_engine:TF \use_ii:nn - \cs_set_eq:NN \c_luatex_is_engine_bool \c_true_bool - \cs_set_eq:NN \c_pdftex_is_engine_bool \c_false_bool + \cs_set_eq:NN \luatex_if_engine_p: \c_true_bool + \cs_set_eq:NN \pdftex_if_engine_p: \c_false_bool } % \end{macrocode} % \end{macro} -% \end{macro} % % \subsection{Doing nothing functions} % @@ -3110,7 +2928,7 @@ \cs_new_nopar:Npn \prg_do_nothing: { } % \end{macrocode} % \end{macro} -% +% % \subsection{String comparisons} % % \begin{macro}[pTF]{\str_if_eq:nn} @@ -3125,22 +2943,23 @@ { \if_int_compare:w \pdftex_strcmp:D { \exp_not:n {#1} } { \exp_not:n {#2} } = \c_zero - \prg_return_true: \else: \prg_return_false: \fi: + \prg_return_true: \else: \prg_return_false: \fi: } \prg_new_conditional:Npnn \str_if_eq:xx #1#2 { p , T , F , TF } { \if_int_compare:w \pdftex_strcmp:D {#1} {#2} = \c_zero - \prg_return_true: \else: \prg_return_false: \fi: + \prg_return_true: \else: \prg_return_false: \fi: } % \end{macrocode} % \end{macro} % \end{macro} % % \subsection{Deprecated functions} -% +% % Deprecated on 2011-05-27, for removal by 2011-08-31. -% +% % \begin{macrocode} +%<*deprecated> \cs_new_eq:NN \cs_gnew_nopar:Npn \cs_new_nopar:Npn \cs_new_eq:NN \cs_gnew:Npn \cs_new:Npn \cs_new_eq:NN \cs_gnew_protected_nopar:Npn \cs_new_protected_nopar:Npn @@ -3157,24 +2976,74 @@ \cs_new_eq:NN \cs_gnew:cpx \cs_new:cpx \cs_new_eq:NN \cs_gnew_protected_nopar:cpx \cs_new_protected_nopar:cpx \cs_new_eq:NN \cs_gnew_protected:cpx \cs_new_protected:cpx +%</deprecated> % \end{macrocode} -% +% % \begin{macrocode} +%<*deprecated> \cs_new_eq:NN \cs_gnew_eq:NN \cs_new_eq:NN \cs_new_eq:NN \cs_gnew_eq:cN \cs_new_eq:cN \cs_new_eq:NN \cs_gnew_eq:Nc \cs_new_eq:Nc \cs_new_eq:NN \cs_gnew_eq:cc \cs_new_eq:cc +%</deprecated> % \end{macrocode} -% +% % \begin{macrocode} +%<*deprecated> \cs_new_eq:NN \cs_gundefine:N \cs_undefine:N \cs_new_eq:NN \cs_gundefine:c \cs_undefine:c +%</deprecated> % \end{macrocode} -% +% % \begin{macrocode} +%<*deprecated> \cs_new_eq:NN \group_execute_after:N \group_insert_after:N +%</deprecated> % \end{macrocode} % +% Deprecated 2011-09-06, for removal by 2012-09-05. +% +% \begin{macro} +% { +% \c_pdftex_is_engine_bool, \c_luatex_is_engine_bool, +% \c_xetex_is_engine_bool +% } +% Predicates are better +% \begin{macrocode} +\cs_new_eq:NN \c_luatex_is_engine_bool \luatex_if_engine_p: +\cs_new_eq:NN \c_pdftex_is_engine_bool \pdftex_if_engine_p: +\cs_new_eq:NN \c_xetex_is_engine_bool \xetex_if_engine_p: +% \end{macrocode} +% \end{macro} +% +% Deprecated 2011-09-06, for removal by 2012-10-06. +% +% \begin{macro}{\use_i_after_fi:nw} +% \begin{macro}{\use_i_after_else:nw} +% \begin{macro}{\use_i_after_or:nw} +% \begin{macro}{\use_i_after_orelse:nw} +% These functions return the first argument after ending the conditional. +% This is rather specialized, and we want to de-emphasize the use of +% primitive \TeX{} conditionals. +% \begin{macrocode} +\cs_set:Npn \use_i_after_fi:nw #1 \fi: { \fi: #1 } +\cs_set:Npn \use_i_after_else:nw #1 \else: #2 \fi: { \fi: #1 } +\cs_set:Npn \use_i_after_or:nw #1 \or: #2 \fi: { \fi: #1 } +\cs_set:Npn \use_i_after_orelse:nw #1#2#3 \fi: { \fi: #1 } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% Deprecated 2011-09-07, for removal by 2011-10-07. +% +% \begin{macro}{\cs_set_eq:NwN} +% \begin{macrocode} +\tex_let:D \cs_set_eq:NwN \tex_let:D +% \end{macrocode} +% \end{macro} +% % \begin{macrocode} %</initex|package> % \end{macrocode} |