diff options
author | Karl Berry <karl@freefriends.org> | 2012-04-23 23:35:34 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-04-23 23:35:34 +0000 |
commit | 06f92e7988867477e0e8ba1b2dea3752d90f7fbe (patch) | |
tree | 6cc2f8ec5dbfc078c9c5f37bfb15814c704b1793 /Master/texmf-dist/source/latex/l3kernel/l3basics.dtx | |
parent | 84c410717bd484db4ccea240224d83fbb42b464a (diff) |
l3kernel 3570 (23apr12)
git-svn-id: svn://tug.org/texlive/trunk@26111 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3basics.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3basics.dtx | 850 |
1 files changed, 328 insertions, 522 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx index bd3b608daf7..f6be95ab725 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3basics.dtx 3460 2012-02-26 12:16:41Z will $ +\GetIdInfo$Id: l3basics.dtx 3491 2012-03-04 06:13:18Z bruno $ {L3 Experimental basic definitions} %</driver|package> %<*driver> @@ -1291,17 +1291,12 @@ % 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}{\if_true:} -% \begin{macro}{\if_false:} -% \begin{macro}{\or:} -% \begin{macro}{\else:} -% \begin{macro}{\fi:} -% \begin{macro}{\reverse_if:N} -% \begin{macro}{\if:w} -% \begin{macro}{\if_charcode:w} -% \begin{macro}{\if_catcode:w} -% \begin{macro}{\if_meaning:w} -% Then some conditionals. +% \begin{macro}[EXP] +% { +% \if_true:, \if_false:, \or:, \else:, \fi:, \reverse_if:N, +% \if:w, \if_charcode:w, \if_catcode:w, \if_meaning:w +% } +% Then some conditionals. % \begin{macrocode} \tex_let:D \if_true: \tex_iftrue:D \tex_let:D \if_false: \tex_iffalse:D @@ -1315,20 +1310,14 @@ \tex_let:D \if_meaning:w \tex_ifx:D % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % -% \begin{macro}{\if_mode_math:} -% \begin{macro}{\if_mode_horizontal:} -% \begin{macro}{\if_mode_vertical:} -% \begin{macro}{\if_mode_inner:} +% \begin{macro}[EXP] +% { +% \if_mode_math:, +% \if_mode_horizontal:, +% \if_mode_vertical:, +% \if_mode_inner: +% } % \TeX{} lets us detect some if its modes. % \begin{macrocode} \tex_let:D \if_mode_math: \tex_ifmmode:D @@ -1337,22 +1326,18 @@ \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{macro}[EXP]{\if_cs_exist:N, \if_cs_exist:w, \cs:w, \cs_end:} +% Building csnames and testing if control sequences exist. % \begin{macrocode} \tex_let:D \if_cs_exist:N \etex_ifdefined:D \tex_let:D \if_cs_exist:w \etex_ifcsname:D +\tex_let:D \cs:w \tex_csname:D +\tex_let:D \cs_end: \tex_endcsname:D % \end{macrocode} % \end{macro} -% \end{macro} % -% \begin{macro}{\exp_after:wN} -% \begin{macro}{\exp_not:N} -% \begin{macro}{\exp_not:n} +% \begin{macro}[EXP]{\exp_after:wN, \exp_not:N, \exp_not:n} % The three |\exp_| functions are used in the \textsf{l3expan} module % where they are described. % \begin{macrocode} @@ -1361,33 +1346,20 @@ \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} -% \begin{macro}{\cs_end:} -% \begin{macro}{\cs_meaning:N} +% \begin{macro}[EXP]{\token_to_meaning:N, \token_to_str:N, \cs_meaning:N} % \begin{macro}{\cs_show:N} +% Examining a control sequence or token. % \begin{macrocode} \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} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % -% \begin{macro}{\scan_stop:} -% \begin{macro}{\group_begin:} -% \begin{macro}{\group_end:} +% \begin{macro}{\scan_stop:, \group_begin:, \group_end:} % The next three are basic functions for which there also exist % versions that are safe inside alignments. These safe versions are % defined in the \textsf{l3prg} module. @@ -1397,54 +1369,49 @@ \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{macro}[EXP]{\if_int_compare:w, \int_to_roman:w} +% For integers. % \begin{macrocode} \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} +% Adding material after the end of a group. % \begin{macrocode} \tex_let:D \group_insert_after:N \tex_aftergroup:D % \end{macrocode} % \end{macro} % -% \begin{macro}{\tex_global:D} -% \begin{macro}{\tex_long:D} -% \begin{macro}{\tex_protected:D} +% \begin{macro}{\tex_global:D, \tex_long:D, \etex_protected:D} +% Three prefixes for assignments. % \begin{macrocode} \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} +% \begin{macro}[EXP]{\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}[EXP]{\token_to_str:c, \cs_meaning:c} % \begin{macro}{\cs_show:c} -% A small number of variants by hand. Some of the necessary functions -% (\cs{use_i:nn}, \cs{use_ii:nn}, and \cs{exp_args:NNc}) are not defined -% at that point yet, but will be defined before those variants are used. -% The \cs{cs_meaning:c} command must check for an undefined control -% sequence to avoid defining it mistakenly. -% The \cs{cs_show:c} command is \enquote{protected} because its action -% is not expandable. Also, the conversion of its argument to a control -% sequence is done within a group to avoid converting it to \tn{relax}. +% A small number of variants by hand. Some of the necessary functions +% (\cs{use_i:nn}, \cs{use_ii:nn}, and \cs{exp_args:NNc}) are not +% defined at that point yet, but will be defined before those variants +% are used. The \cs{cs_meaning:c} command must check for an undefined +% control sequence to avoid defining it mistakenly. The +% \cs{cs_show:c} command is \enquote{protected} because its action is +% not expandable. Also, the conversion of its argument to a control +% sequence is done within a group to avoid converting it to +% \tn{relax}. % \begin{macrocode} \tex_def:D \token_to_str:c { \exp_args:Nc \token_to_str:N } \tex_long:D \tex_def:D \cs_meaning:c #1 @@ -1462,12 +1429,11 @@ % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} % % \subsection{Defining some constants} % -% \begin{macro}{\c_minus_one, \c_zero, \c_sixteen} -% \begin{macro}{\c_six, \c_seven, \c_twelve} +% \begin{variable}{\c_minus_one, \c_zero, \c_sixteen} +% \begin{variable}{\c_six, \c_seven, \c_twelve} % We need the constants |\c_minus_one| and |\c_sixteen| now for % writing information to the log and the terminal and |\c_zero| % which is used by some functions in the \textsf{l3alloc} module. The @@ -1493,8 +1459,8 @@ \tex_chardef:D \c_seven = 7~ \tex_chardef:D \c_twelve = 12~ % \end{macrocode} -% \end{macro} -% \end{macro} +% \end{variable} +% \end{variable} % % \begin{variable}{\c_max_register_int} % This is here as this particular integer is needed both in package @@ -1513,14 +1479,13 @@ % We start by providing functions for the typical definition % functions. First the local ones. % -% \begin{macro}{\cs_set_nopar:Npn} -% \begin{macro}{\cs_set_nopar:Npx} -% \begin{macro}{\cs_set:Npn} -% \begin{macro}{\cs_set:Npx} -% \begin{macro}{\cs_set_protected_nopar:Npn} -% \begin{macro}{\cs_set_protected_nopar:Npx} -% \begin{macro}{\cs_set_protected:Npn} -% \begin{macro}{\cs_set_protected:Npx} +% \begin{macro} +% { +% \cs_set_nopar:Npn , \cs_set_nopar:Npx , +% \cs_set:Npn , \cs_set:Npx , +% \cs_set_protected_nopar:Npn , \cs_set_protected_nopar:Npx , +% \cs_set_protected:Npn , \cs_set_protected:Npx +% } % All assignment functions in \LaTeX3 should be naturally robust; % after all, the \TeX{} primitives for assignments are and it can be % a cause of problems if others aren't. @@ -1541,22 +1506,14 @@ { \tex_protected:D \tex_long:D \cs_set_nopar:Npx } % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % -% \begin{macro}{\cs_gset_nopar:Npn} -% \begin{macro}{\cs_gset_nopar:Npx} -% \begin{macro}{\cs_gset:Npn} -% \begin{macro}{\cs_gset:Npx} -% \begin{macro}{\cs_gset_protected_nopar:Npn} -% \begin{macro}{\cs_gset_protected_nopar:Npx} -% \begin{macro}{\cs_gset_protected:Npn} -% \begin{macro}{\cs_gset_protected:Npx} +% \begin{macro} +% { +% \cs_gset_nopar:Npn , \cs_gset_nopar:Npx , +% \cs_gset:Npn , \cs_gset:Npx , +% \cs_gset_protected_nopar:Npn , \cs_gset_protected_nopar:Npx , +% \cs_gset_protected:Npn , \cs_gset_protected:Npx +% } % Global versions of the above functions. % \begin{macrocode} \tex_let:D \cs_gset_nopar:Npn \tex_gdef:D @@ -1575,17 +1532,10 @@ { \tex_protected:D \tex_long:D \cs_gset_nopar:Npx } % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % % \subsection{Selecting tokens} % -% \begin{macro}{\use:c} +% \begin{macro}[EXP]{\use:c} % This macro grabs its argument and returns a csname from it. % \begin{macrocode} \cs_set:Npn \use:c #1 { \cs:w #1 \cs_end: } @@ -1604,10 +1554,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\use:n} -% \begin{macro}{\use:nn} -% \begin{macro}{\use:nnn} -% \begin{macro}{\use:nnnn} +% \begin{macro}[EXP]{\use:n, \use:nn, \use:nnn, \use:nnnn} % These macro grabs its arguments and returns it back to the input % (with outer braces removed). % \begin{macrocode} @@ -1617,30 +1564,21 @@ \cs_set:Npn \use:nnnn #1#2#3#4 {#1#2#3#4} % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % -% \begin{macro}{\use_i:nn} -% \begin{macro}{\use_ii:nn} +% \begin{macro}[EXP]{\use_i:nn, \use_ii:nn} % 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} % \end{macrocode} % \end{macro} -% \end{macro} % -% \begin{macro}{\use_i:nnn} -% \begin{macro}{\use_ii:nnn} -% \begin{macro}{\use_iii:nnn} -% \begin{macro}{\use_i_ii:nnn} -% \begin{macro}{\use_i:nnnn} -% \begin{macro}{\use_ii:nnnn} -% \begin{macro}{\use_iii:nnnn} -% \begin{macro}{\use_iv:nnnn} -% We also need something for picking up arguments from a longer -% list. +% \begin{macro}[EXP] +% { +% \use_i:nnn , \use_ii:nnn , \use_iii:nnn , \use_i_ii:nnn , +% \use_i:nnnn, \use_ii:nnnn, \use_iii:nnnn, \use_iv:nnnn +% } +% We also need something for picking up arguments from a longer list. % \begin{macrocode} \cs_set:Npn \use_i:nnn #1#2#3 {#1} \cs_set:Npn \use_ii:nnn #1#2#3 {#2} @@ -1652,61 +1590,59 @@ \cs_set:Npn \use_iv:nnnn #1#2#3#4 {#4} % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % -% \begin{macro}{\use_none_delimit_by_q_nil:w} -% \begin{macro}{\use_none_delimit_by_q_stop:w} -% \begin{macro}{\use_none_delimit_by_q_recursion_stop:w} -% Functions that gobble everything until they see either \cs{q_nil} or -% \cs{q_stop}, respectively. +% \begin{macro}[EXP] +% { +% \use_none_delimit_by_q_nil:w , +% \use_none_delimit_by_q_stop:w , +% \use_none_delimit_by_q_recursion_stop:w +% } +% Functions that gobble everything until they see either \cs{q_nil}, +% \cs{q_stop}, or \cs{q_recursion_stop}, respectively. % \begin{macrocode} \cs_set:Npn \use_none_delimit_by_q_nil:w #1 \q_nil { } \cs_set:Npn \use_none_delimit_by_q_stop:w #1 \q_stop { } \cs_set:Npn \use_none_delimit_by_q_recursion_stop:w #1 \q_recursion_stop { } % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} % -% \begin{macro}{\use_i_delimit_by_q_nil:nw} -% \begin{macro}{\use_i_delimit_by_q_stop:nw} -% \begin{macro}{\use_i_delimit_by_q_recursion_stop:nw} -% Same as above but execute first argument after gobbling. Very -% useful when you need to skip the rest of a mapping sequence but -% want an easy way to control what should be expanded next. +% \begin{macro} +% { +% \use_i_delimit_by_q_nil:nw , +% \use_i_delimit_by_q_stop:nw , +% \use_i_delimit_by_q_recursion_stop:nw +% } +% Same as above but execute first argument after gobbling. Very useful +% when you need to skip the rest of a mapping sequence but want an +% easy way to control what should be expanded next. % \begin{macrocode} \cs_set:Npn \use_i_delimit_by_q_nil:nw #1#2 \q_nil {#1} \cs_set:Npn \use_i_delimit_by_q_stop:nw #1#2 \q_stop {#1} \cs_set:Npn \use_i_delimit_by_q_recursion_stop:nw #1#2 \q_recursion_stop {#1} % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} % % \subsection{Gobbling tokens from input} % -% \begin{macro}{\use_none:n} -% \begin{macro}{\use_none:nn} -% \begin{macro}{\use_none:nnn} -% \begin{macro}{\use_none:nnnn} -% \begin{macro}{\use_none:nnnnn} -% \begin{macro}{\use_none:nnnnnn} -% \begin{macro}{\use_none:nnnnnnn} -% \begin{macro}{\use_none:nnnnnnnn} -% \begin{macro}{\use_none:nnnnnnnnn} -% To gobble tokens from the input we use a standard naming -% convention: the number of tokens gobbled is given by the number of -% |n|'s following the |:| in the name. Although defining -% |\use_none:nnn| and above as separate calls of |\use_none:n| and -% |\use_none:nn| is slightly faster, this is very non-intuitive to -% the programmer who will assume that expanding such a function once -% will take care of gobbling all the tokens in one go. +% \begin{macro}[EXP] +% { +% \use_none:n, +% \use_none:nn, +% \use_none:nnn, +% \use_none:nnnn, +% \use_none:nnnnn, +% \use_none:nnnnnn, +% \use_none:nnnnnnn, +% \use_none:nnnnnnnn, +% \use_none:nnnnnnnnn +% } +% To gobble tokens from the input we use a standard naming convention: +% the number of tokens gobbled is given by the number of |n|'s +% following the |:| in the name. Although we could define functions to +% remove ten arguments or more using separate calls of +% \cs{use_none:nnnnn}, this is very non-intuitive to the programmer +% who will assume that expanding such a function once will take care +% of gobbling all the tokens in one go. % \begin{macrocode} \cs_set:Npn \use_none:n #1 { } \cs_set:Npn \use_none:nn #1#2 { } @@ -1719,14 +1655,6 @@ \cs_set:Npn \use_none:nnnnnnnnn #1#2#3#4#5#6#7#8#9 { } % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % % \subsection{Conditional processing and definitions} % @@ -1747,8 +1675,7 @@ % he/she knows the $2^{n}-1$ table. We therefore provide the simpler % interface. % -% \begin{macro}{\prg_return_true:} -% \begin{macro}{\prg_return_false:} +% \begin{macro}[EXP]{\prg_return_true:, \prg_return_false:} % The idea here is that \cs{int_to_roman:w} will expand fully any % \cs{else:} and the \cs{fi:} that are waiting to be discarded, % before reaching the \cs{c_zero} which will leave the expansion null. @@ -1766,7 +1693,6 @@ % elaborate function in place of \cs{use_i:nn}/\cs{use_ii:nn}. Provided % two arguments are absorbed then the code will work. % \end{macro} -% \end{macro} % % \begin{macro} % { @@ -1851,8 +1777,11 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\prg_generate_conditional_aux:nnNNnnnn, -% \prg_generate_conditional_aux:nnw} +% \begin{macro}[aux] +% { +% \prg_generate_conditional_aux:nnNNnnnn, +% \prg_generate_conditional_aux:nnw +% } % The workhorse here is going through a list of desired forms, \emph{i.e.}, % |p|, |TF|, |T| and |F|. The first three arguments come from splitting up % the base form of the conditional, which gives the name, signature @@ -1980,6 +1909,13 @@ % % \begin{macro}[aux] % {\prg_set_eq_conditional_aux:NNNn, \prg_set_eq_conditional_aux:NNNw} +% \begin{macro}[aux, EXP] +% { +% \prg_conditional_form_p:nnn , +% \prg_conditional_form_TF:nnn , +% \prg_conditional_form_T:nnn , +% \prg_conditional_form_F:nnn , +% } % Manual clist loop over argument |#4|. % \begin{macrocode} \cs_set_protected:Npn \prg_set_eq_conditional_aux:NNNn #1#2#3#4 @@ -2000,6 +1936,7 @@ \cs_set:Npn \prg_conditional_form_F:nnn #1#2#3 { #1 : #2 F } % \end{macrocode} % \end{macro} +% \end{macro} % % All that is left is to define the canonical boolean true and false. % I think Michael originated the idea of expandable boolean tests. At @@ -2010,21 +1947,18 @@ % constants with values of $1$ for true and $0$ for false. We need % this from the get-go. % -% \begin{macro}{\c_true_bool} -% \begin{macro}{\c_false_bool} +% \begin{variable}{\c_true_bool, \c_false_bool} % Here are the canonical boolean values. % \begin{macrocode} \tex_chardef:D \c_true_bool = 1~ \tex_chardef:D \c_false_bool = 0~ % \end{macrocode} -% \end{macro} -% \end{macro} +% \end{variable} % % \subsection{Dissecting a control sequence} % -% \begin{macro}{\cs_to_str:N} -% \begin{macro}[aux]{\cs_to_str_aux:N} -% \begin{macro}[aux]{\cs_to_str_aux:w} +% \begin{macro}[EXP]{\cs_to_str:N} +% \begin{macro}[aux, EXP]{\cs_to_str_aux:N, \cs_to_str_aux:w} % This converts a control sequence into the character string of its % name, removing the leading escape character. This turns out to be % a non-trivial matter as there a different cases: @@ -2076,17 +2010,16 @@ % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} % -% \begin{macro}{\cs_split_function:NN} -% \begin{macro}[aux]{\cs_split_function_aux:w} -% \begin{macro}[aux]{\cs_split_function_auxii:w} +% \begin{macro}[EXP]{\cs_split_function:NN} +% \begin{macro}[aux, EXP] +% {\cs_split_function_aux:w, \cs_split_function_auxii:w} % This function takes a function name and splits it into name with % the escape char removed and argument specification. In addition to % this, a third argument, a boolean \meta{true} or \meta{false} is % returned with \meta{true} for when there is a colon in the function % and \meta{false} if there is not. Lastly, the second argument of -% |\cs_split_function:NN| is supposed to be a function +% \cs{cs_split_function:NN} is supposed to be a function % taking three variables, one for name, one for signature, and one % for the boolean. For example, % |\cs_split_function:NN\foo_bar:cnx\use_i:nnn| as input @@ -2103,7 +2036,7 @@ \group_end: % \end{macrocode} % First ensure that we actually get a properly evaluated str -% by expanding |\cs_to_str:N| twice. Insert +% by expanding \cs{cs_to_str:N} twice. Insert % extra colon to catch the error cases. % \begin{macrocode} \cs_set:Npn \cs_split_function:NN #1#2 @@ -2118,7 +2051,7 @@ % first letter of the signature. The letters here have catcode 12. % If a colon was given we need to a) split off the colon and quark at % the end and b) ensure we return the name, signature and boolean true -% We can't use |\quark_if_no_value:NTF| yet but this is very safe +% We can't use \cs{quark_if_no_value:NTF} yet but this is very safe % anyway as all tokens have catcode~12. % \begin{macrocode} \cs_set:Npn \cs_split_function_aux:w #1 @ #2#3 \q_stop #4 @@ -2140,9 +2073,8 @@ % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} % -% \begin{macro}{\cs_get_function_name:N, \cs_get_function_signature:N} +% \begin{macro}[EXP]{\cs_get_function_name:N, \cs_get_function_signature:N} % Now returning the name is trivial: just discard the last two % arguments. Similar for signature. % \begin{macrocode} @@ -2160,7 +2092,7 @@ % |\tex_relax:D| token. A control sequence is said to be \emph{free} % (to be defined) if it does not already exist. % -% \begin{macro}[pTF]{\cs_if_exist:N,\cs_if_exist:c} +% \begin{macro}[pTF, EXP]{\cs_if_exist:N,\cs_if_exist:c} % Two versions for checking existence. For the |N| form we firstly % check for |\scan_stop:| and then if it is in the hash % table. There is no problem when inputting something like |\else:| @@ -2206,7 +2138,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[pTF]{\cs_if_free:N,\cs_if_free:c} +% \begin{macro}[pTF, EXP]{\cs_if_free:N,\cs_if_free:c} % The logical reversal of the above. % \begin{macrocode} \prg_set_conditional:Npnn \cs_if_free:N #1 { p , T , F , TF } @@ -2251,11 +2183,11 @@ % sequence in the hash table if it does not exist. % \begin{macrocode} \cs_set:Npn \cs_if_exist_use:NTF #1#2 - { \cs_if_exist:NTF #1 { #1 #2} } + { \cs_if_exist:NTF #1 { #1 #2 } } \cs_set:Npn \cs_if_exist_use:NF #1 { \cs_if_exist:NTF #1 { #1 } } \cs_set:Npn \cs_if_exist_use:NT #1 #2 - { \cs_if_exist:NTF #1 { #1#2 } { } } + { \cs_if_exist:NTF #1 { #1 #2 } { } } \cs_set:Npn \cs_if_exist_use:N #1 { \cs_if_exist:NTF #1 { #1 } { } } \cs_set:Npn \cs_if_exist_use:cTF #1#2 @@ -2282,8 +2214,7 @@ % allow us to generate error messages. The definitions here are % only temporary, they will be redefined later on. % -% \begin{macro}{\iow_log:x} -% \begin{macro}{\iow_term:x} +% \begin{macro}{\iow_log:x, \iow_term:x} % We define a routine to write only to the log file. And a % similar one for writing to both the log file and the terminal. % These will be redefined later by \pkg{l3io}. @@ -2294,11 +2225,9 @@ { \tex_immediate:D \tex_write:D \c_sixteen } % \end{macrocode} % \end{macro} -% \end{macro} % -% \begin{macro}{\msg_kernel_error:nnxx} -% \begin{macro}{\msg_kernel_error:nnx} -% \begin{macro}{\msg_kernel_error:nn} +% \begin{macro} +% {\msg_kernel_error:nnxx, \msg_kernel_error:nnx, \msg_kernel_error:nn} % If an internal error occurs before \LaTeX3 has loaded \pkg{l3msg} then % the code should issue a usable if terse error message and halt. This % can only happen if a coding error is made by the team, so this is @@ -2322,10 +2251,8 @@ { \msg_kernel_error:nnxx {#1} {#2} { } { } } % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} % -% \begin{macro}{\msg_line_context:} +% \begin{macro}[rEXP]{\msg_line_context:} % Another one from \pkg{l3msg} which will be altered later. % \begin{macrocode} \cs_set_nopar:Npn \msg_line_context: @@ -2333,12 +2260,12 @@ % \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| +% \begin{macro}[int]{\chk_if_free_cs:N, \chk_if_free_cs:c} +% This command is called by \cs{cs_new_nopar:Npn} and \cs{cs_new_eq:NN} % \emph{etc.}\ % to make sure that the argument sequence is not already in use. If % it is, an error is signalled. It checks if \meta{csname} is -% undefined or |\scan_stop:|. Otherwise an error message is +% undefined or \cs{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} @@ -2368,7 +2295,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\chk_if_exist_cs:N, \chk_if_exist_cs:c} +% \begin{macro}[int]{\chk_if_exist_cs:N, \chk_if_exist_cs:c} % This function issues a warning message when the control sequence % in its argument does not exist. % \begin{macrocode} @@ -2387,15 +2314,15 @@ % % \subsection{More new definitions} % -% \begin{macro}{\cs_new_nopar:Npn} -% \begin{macro}{\cs_new_nopar:Npx} -% \begin{macro}{\cs_new:Npn} -% \begin{macro}{\cs_new:Npx} -% \begin{macro}{\cs_new_protected_nopar:Npn} -% \begin{macro}{\cs_new_protected_nopar:Npx} -% \begin{macro}{\cs_new_protected:Npn} -% \begin{macro}{\cs_new_protected:Npx} -% Global versions of the above functions. +% \begin{macro} +% { +% \cs_new_nopar:Npn , \cs_new_nopar:Npx , +% \cs_new:Npn , \cs_new:Npx , +% \cs_new_protected_nopar:Npn , \cs_new_protected_nopar:Npx , +% \cs_new_protected:Npn , \cs_new_protected:Npx +% } +% Function which check that the control sequence is free before +% defining it. % \begin{macrocode} \cs_set:Npn \cs_tmp:w #1#2 { @@ -2415,29 +2342,22 @@ \cs_tmp:w \cs_new_protected:Npx \cs_gset_protected:Npx % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % -% \begin{macro}{\cs_set_nopar:cpn} -% \begin{macro}{\cs_set_nopar:cpx} -% \begin{macro}{\cs_gset_nopar:cpn} -% \begin{macro}{\cs_gset_nopar:cpx} -% \begin{macro}{\cs_new_nopar:cpn} -% \begin{macro}{\cs_new_nopar:cpx} -% Like |\cs_set_nopar:Npn| and |\cs_new_nopar:Npn|, except that the +% \begin{macro} +% { +% \cs_set_nopar:cpn , \cs_set_nopar:cpx , +% \cs_gset_nopar:cpn , \cs_gset_nopar:cpx , +% \cs_new_nopar:cpn , \cs_new_nopar:cpx +% } +% Like \cs{cs_set_nopar:Npn} and \cs{cs_new_nopar:Npn}, except that the % first argument consists of the sequence of characters that should % be used to form the name of the desired control sequence (the |c| % stands for csname argument, see the expansion module). Global % versions are also provided. % -% |\cs_set_nopar:cpn|\meta{string}\meta{rep-text} will turn \meta{string} +% \cs{cs_set_nopar:cpn}\meta{string}\meta{rep-text} will turn \meta{string} % 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 +% \cs{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 @@ -2450,19 +2370,14 @@ \cs_tmp:w \cs_new_nopar:cpx \cs_new_nopar:Npx % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % -% \begin{macro}{\cs_set:cpn} -% \begin{macro}{\cs_set:cpx} -% \begin{macro}{\cs_gset:cpn} -% \begin{macro}{\cs_gset:cpx} -% \begin{macro}{\cs_new:cpn} -% \begin{macro}{\cs_new:cpx} -% Variants of the |\cs_set:Npn| versions which make a csname out +% \begin{macro} +% { +% \cs_set:cpn , \cs_set:cpx , +% \cs_gset:cpn , \cs_gset:cpx , +% \cs_new:cpn , \cs_new:cpx +% } +% Variants of the \cs{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 @@ -2473,20 +2388,15 @@ \cs_tmp:w \cs_new:cpx \cs_new:Npx % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % -% \begin{macro}{\cs_set_protected_nopar:cpn} -% \begin{macro}{\cs_set_protected_nopar:cpx} -% \begin{macro}{\cs_gset_protected_nopar:cpn} -% \begin{macro}{\cs_gset_protected_nopar:cpx} -% \begin{macro}{\cs_new_protected_nopar:cpn} -% \begin{macro}{\cs_new_protected_nopar:cpx} -% 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{macro} +% { +% \cs_set_protected_nopar:cpn , \cs_set_protected_nopar:cpx , +% \cs_gset_protected_nopar:cpn , \cs_gset_protected_nopar:cpx , +% \cs_new_protected_nopar:cpn , \cs_new_protected_nopar:cpx +% } +% Variants of the \cs{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 @@ -2496,19 +2406,14 @@ \cs_tmp:w \cs_new_protected_nopar:cpx \cs_new_protected_nopar:Npx % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % -% \begin{macro}{\cs_set_protected:cpn} -% \begin{macro}{\cs_set_protected:cpx} -% \begin{macro}{\cs_gset_protected:cpn} -% \begin{macro}{\cs_gset_protected:cpx} -% \begin{macro}{\cs_new_protected:cpn} -% \begin{macro}{\cs_new_protected:cpx} -% Variants of the |\cs_set_protected:Npn| versions which make a csname +% \begin{macro} +% { +% \cs_set_protected:cpn , \cs_set_protected:cpx , +% \cs_gset_protected:cpn , \cs_gset_protected:cpx , +% \cs_new_protected:cpn , \cs_new_protected:cpx +% } +% Variants of the \cs{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 @@ -2519,46 +2424,36 @@ \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} % % \subsection{Copying definitions} % -% \begin{macro}{\cs_set_eq:NN} -% \begin{macro}{\cs_set_eq:cN} -% \begin{macro}{\cs_set_eq:Nc} -% \begin{macro}{\cs_set_eq:cc} -% These macros allow us to copy the definition of a control sequence -% to another control sequence. +% \begin{macro} +% { +% \cs_set_eq:NN , \cs_set_eq:cN , \cs_set_eq:Nc , \cs_set_eq:cc , +% \cs_gset_eq:NN , \cs_gset_eq:cN , \cs_gset_eq:Nc , \cs_gset_eq:cc , +% \cs_new_eq:NN , \cs_new_eq:cN , \cs_new_eq:Nc , \cs_new_eq:cc +% } +% These macros allow us to copy the definition of a control sequence +% to another control sequence. % -% The |=| sign allows us to define funny char tokens like |=| -% itself or \verb*| | with this function. For the definition of -% |\c_space_char{~}| to work we need the |~| after the |=|. +% The |=| sign allows us to define funny char tokens like |=| itself +% or \verb*| | with this function. For the definition of +% |\c_space_char{~}| to work we need the |~| after the |=|. % -% |\cs_set_eq:NN| is long to avoid problems with a literal argument -% of |\par|. While |\cs_new_eq:NN| will probably never be correct -% with a first argument of |\par|, define it long in order to throw -% an \enquote{already defined} error rather than -% \enquote{runaway argument}. +% \cs{cs_set_eq:NN} is long to avoid problems with a literal argument +% of \cs{par}. While \cs{cs_new_eq:NN} will probably never be correct +% with a first argument of \cs{par}, define it long in order to throw +% an \enquote{already defined} error rather than +% \enquote{runaway argument}. % \begin{macrocode} \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 } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\cs_new_eq:NN} -% \begin{macro}{\cs_new_eq:cN} -% \begin{macro}{\cs_new_eq:Nc} -% \begin{macro}{\cs_new_eq:cc} -% \begin{macrocode} +\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 } \cs_new_protected:Npn \cs_new_eq:NN #1 { \chk_if_free_cs:N #1 @@ -2569,33 +2464,15 @@ \cs_new_protected_nopar:Npn \cs_new_eq:cc { \exp_args:Ncc \cs_new_eq:NN } % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\cs_gset_eq:NN} -% \begin{macro}{\cs_gset_eq:cN} -% \begin{macro}{\cs_gset_eq:Nc} -% \begin{macro}{\cs_gset_eq:cc} -% \begin{macrocode} -\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 } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % % \subsection{Undefining functions} % % \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. -% The \texttt{c} variant is careful not to add the control sequence -% to the hash table if it isn't there yet, and it also avoids nesting -% \TeX{} conditionals in case |#1| is unbalanced in this matter. +% The following function is used to free the main memory from the +% definition of some function that isn't in use any longer. +% The \texttt{c} variant is careful not to add the control sequence +% to the hash table if it isn't there yet, and it also avoids nesting +% \TeX{} conditionals in case |#1| is unbalanced in this matter. % \begin{macrocode} \cs_new_protected:Npn \cs_undefine:N #1 { \cs_gset_eq:NN #1 \c_undefined:D } @@ -2613,9 +2490,12 @@ % % \subsection{Defining functions from a given number of arguments} % -% \begin{macro}{\cs_get_arg_count_from_signature:N} -% \begin{macro}[aux]{\cs_get_arg_count_from_signature_aux:nnN} -% \begin{macro}[aux]{\cs_get_arg_count_from_signature_auxii:w} +% \begin{macro}[EXP]{\cs_get_arg_count_from_signature:N} +% \begin{macro}[aux, EXP] +% { +% \cs_get_arg_count_from_signature_aux:nnN, +% \cs_get_arg_count_from_signature_auxii:w +% } % Counting the number of tokens in the signature, i.e., the number % of arguments the function should take. If there is no signature, % we return that there is $-1$ arguments to signal an error. @@ -2650,7 +2530,6 @@ % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} % % \begin{macro}[aux] % { @@ -2703,8 +2582,8 @@ \cs_new_protected_nopar:Npn \cs_generate_from_arg_count:Ncnn { \exp_args:NNc \cs_generate_from_arg_count:NNnn } % \end{macrocode} -% The error message. Elsewhere we use the value of $-1$ to signal a -% missing colon in a function, so provide a hint for help on this. +% The error message. Elsewhere we use the value of $-1$ to signal a +% missing colon in a function, so provide a hint for help on this. % \begin{macrocode} \cs_new_protected:Npn \cs_generate_from_arg_count_error_msg:Nn #1#2 { @@ -2723,46 +2602,45 @@ % 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} -% \begin{macro}{\cs_set_nopar:Nx} -% \begin{macro}{\cs_set_protected:Nn} -% \begin{macro}{\cs_set_protected:Nx} -% \begin{macro}{\cs_set_protected_nopar:Nn} -% \begin{macro}{\cs_set_protected_nopar:Nx} -% \begin{macro}{\cs_gset:Nn} -% \begin{macro}{\cs_gset:Nx} -% \begin{macro}{\cs_gset_nopar:Nn} -% \begin{macro}{\cs_gset_nopar:Nx} -% \begin{macro}{\cs_gset_protected:Nn} -% \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 -% \begin{verbatim} -% \cs_set_protected:Npn \cs_set:Nn #1#2 -% { -% \cs_generate_from_arg_count:NNnn #1 \cs_set:Npn -% { \cs_get_arg_count_from_signature:N #1 } {#2} -% } -% \end{verbatim} -% In short, to define |\cs_set:Nn| we need just use |\cs_set:Npn|, -% everything else is the same for each variant. Therefore, we can -% make it simpler by temporarily defining a function to do this for -% us. +% \begin{macro} +% { +% \cs_set:Nn , \cs_set:Nx , +% \cs_set_nopar:Nn , \cs_set_nopar:Nx , +% \cs_set_protected:Nn , \cs_set_protected:Nx , +% \cs_set_protected_nopar:Nn , \cs_set_protected_nopar:Nx , +% \cs_gset:Nn , \cs_gset:Nx , +% \cs_gset_nopar:Nn , \cs_gset_nopar:Nx , +% \cs_gset_protected:Nn , \cs_gset_protected:Nx , +% \cs_gset_protected_nopar:Nn , \cs_gset_protected_nopar:Nx , +% \cs_new:Nn , \cs_new:Nx , +% \cs_new_nopar:Nn , \cs_new_nopar:Nx , +% \cs_new_protected:Nn , \cs_new_protected:Nx , +% \cs_new_protected_nopar:Nn , \cs_new_protected_nopar:Nx , +% } +% We want to define \cs{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_get_arg_count_from_signature:N #1 } {#2} +% } +% \end{verbatim} +% In short, to define \cs{cs_set:Nn} we need just use \cs{cs_set:Npn}, +% everything else is the same for each variant. Therefore, we can +% make it simpler by temporarily defining a function to do this for +% us. % \begin{macrocode} \cs_set:Npn \cs_tmp:w #1#2#3 { - \cs_set_protected:cpx { cs_ #1 : #2 } ##1##2 + \cs_new_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_not:N\cs_get_arg_count_from_signature:N ##1 }{##2} + { \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 24 variants beginning with |N|. % \begin{macrocode} \cs_tmp:w { set } { Nn } { Npn } \cs_tmp:w { set } { Nx } { Npx } @@ -2780,87 +2658,51 @@ \cs_tmp:w { gset_protected } { Nx } { Npx } \cs_tmp:w { gset_protected_nopar } { Nn } { Npn } \cs_tmp:w { gset_protected_nopar } { Nx } { Npx } +\cs_tmp:w { new } { Nn } { Npn } +\cs_tmp:w { new } { Nx } { Npx } +\cs_tmp:w { new_nopar } { Nn } { Npn } +\cs_tmp:w { new_nopar } { Nx } { Npx } +\cs_tmp:w { new_protected } { Nn } { Npn } +\cs_tmp:w { new_protected } { Nx } { Npx } +\cs_tmp:w { new_protected_nopar } { Nn } { Npn } +\cs_tmp:w { new_protected_nopar } { Nx } { Npx } % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\cs_new:Nn} -% \begin{macro}{\cs_new:Nx} -% \begin{macro}{\cs_new_nopar:Nn} -% \begin{macro}{\cs_new_nopar:Nx} -% \begin{macro}{\cs_new_protected:Nn} -% \begin{macro}{\cs_new_protected:Nx} -% \begin{macro}{\cs_new_protected_nopar:Nn} -% \begin{macro}{\cs_new_protected_nopar:Nx} -% \begin{macrocode} -\cs_tmp:w { new } { Nn } { Npn } -\cs_tmp:w { new } { Nx } { Npx } -\cs_tmp:w { new_nopar } { Nn } { Npn } -\cs_tmp:w { new_nopar } { Nx } { Npx } -\cs_tmp:w { new_protected } { Nn } { Npn } -\cs_tmp:w { new_protected } { Nx } { Npx } -\cs_tmp:w { new_protected_nopar } { Nn } { Npn } -\cs_tmp:w { new_protected_nopar } { Nx } { Npx } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % -% 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_get_arg_count_from_signature:c {#1} } {#2} -% } -% \end{verbatim} +% \begin{macro} +% { +% \cs_set:cn , \cs_set:cx , +% \cs_set_nopar:cn , \cs_set_nopar:cx , +% \cs_set_protected:cn , \cs_set_protected:cx , +% \cs_set_protected_nopar:cn , \cs_set_protected_nopar:cx , +% \cs_gset:cn , \cs_gset:cx , +% \cs_gset_nopar:cn , \cs_gset_nopar:cx , +% \cs_gset_protected:cn , \cs_gset_protected:cx , +% \cs_gset_protected_nopar:cn , \cs_gset_protected_nopar:cx , +% \cs_new:cn , \cs_new:cx , +% \cs_new_nopar:cn , \cs_new_nopar:cx , +% \cs_new_protected:cn , \cs_new_protected:cx , +% \cs_new_protected_nopar:cn , \cs_new_protected_nopar:cx , +% } +% 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_get_arg_count_from_signature:c {#1} } {#2} +% } +% \end{verbatim} +% The 24 |c| variants. % \begin{macrocode} \cs_set:Npn \cs_tmp:w #1#2#3 { - \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_not:N \cs_get_arg_count_from_signature:c {##1} } {##2} - } + \cs_new_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_not:N \cs_get_arg_count_from_signature:c {##1} } {##2} + } } -% \end{macrocode} -% \begin{macro}{\cs_set:cn} -% \begin{macro}{\cs_set:cx} -% \begin{macro}{\cs_set_nopar:cn} -% \begin{macro}{\cs_set_nopar:cx} -% \begin{macro}{\cs_set_protected:cn} -% \begin{macro}{\cs_set_protected:cx} -% \begin{macro}{\cs_set_protected_nopar:cn} -% \begin{macro}{\cs_set_protected_nopar:cx} -% \begin{macro}{\cs_gset:cn} -% \begin{macro}{\cs_gset:cx} -% \begin{macro}{\cs_gset_nopar:cn} -% \begin{macro}{\cs_gset_nopar:cx} -% \begin{macro}{\cs_gset_protected:cn} -% \begin{macro}{\cs_gset_protected:cx} -% \begin{macro}{\cs_gset_protected_nopar:cn} -% \begin{macro}{\cs_gset_protected_nopar:cx} -% The 32 |c| variants. -% \begin{macrocode} \cs_tmp:w { set } { cn } { Npn } \cs_tmp:w { set } { cx } { Npx } \cs_tmp:w { set_nopar } { cn } { Npn } @@ -2877,55 +2719,22 @@ \cs_tmp:w { gset_protected } { cx } { Npx } \cs_tmp:w { gset_protected_nopar } { cn } { Npn } \cs_tmp:w { gset_protected_nopar } { cx } { Npx } +\cs_tmp:w { new } { cn } { Npn } +\cs_tmp:w { new } { cx } { Npx } +\cs_tmp:w { new_nopar } { cn } { Npn } +\cs_tmp:w { new_nopar } { cx } { Npx } +\cs_tmp:w { new_protected } { cn } { Npn } +\cs_tmp:w { new_protected } { cx } { Npx } +\cs_tmp:w { new_protected_nopar } { cn } { Npn } +\cs_tmp:w { new_protected_nopar } { cx } { Npx } % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\cs_new:cn} -% \begin{macro}{\cs_new:cx} -% \begin{macro}{\cs_new_nopar:cn} -% \begin{macro}{\cs_new_nopar:cx} -% \begin{macro}{\cs_new_protected:cn} -% \begin{macro}{\cs_new_protected:cx} -% \begin{macro}{\cs_new_protected_nopar:cn} -% \begin{macro}{\cs_new_protected_nopar:cx} -% \begin{macrocode} -\cs_tmp:w { new } { cn } { Npn } -\cs_tmp:w { new } { cx } { Npx } -\cs_tmp:w { new_nopar } { cn } { Npn } -\cs_tmp:w { new_nopar } { cx } { Npx } -\cs_tmp:w { new_protected } { cn } { Npn } -\cs_tmp:w { new_protected } { cx } { Npx } -\cs_tmp:w { new_protected_nopar } { cn } { Npn } -\cs_tmp:w { new_protected_nopar } { cx } { Npx } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \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} -% Check if two control sequences are identical. +% \begin{macro}[pTF, EXP] +% {\cs_if_eq:NN, \cs_if_eq:cN, \cs_if_eq:Nc, \cs_if_eq:cc} +% Check if two control sequences are identical. % \begin{macrocode} \prg_new_conditional:Npnn \cs_if_eq:NN #1#2 { p , T , F , TF } { @@ -2950,15 +2759,17 @@ % \subsection{Diagnostic wrapper functions} % % \begin{macro}{\kernel_register_show:N, \kernel_register_show:c} +% Check that the variable, then apply the \tn{showthe} primitive to +% the variable. The odd-looking \cs{use:n} gives a nicer output. % \begin{macrocode} \cs_new:Npn \kernel_register_show:N #1 { \cs_if_exist:NTF #1 - { \tex_showthe:D \use:n #1 } - { - \msg_kernel_error:nnx { kernel } { variable-not-defined } - { \token_to_str:N #1 } - } + { \tex_showthe:D \use:n {#1} } + { + \msg_kernel_error:nnx { kernel } { variable-not-defined } + { \token_to_str:N #1 } + } } \cs_new_nopar:Npn \kernel_register_show:c { \exp_args:Nc \kernel_register_show:N } @@ -2967,7 +2778,8 @@ % % \subsection{Engine specific definitions} % -% \begin{macro}[pTF]{\xetex_if_engine:, \luatex_if_engine:, \pdftex_if_engine:} +% \begin{macro}[pTF, EXP] +% {\xetex_if_engine:, \luatex_if_engine:, \pdftex_if_engine:} % In some cases it will be useful to know which engine we're running. % This can all be hard-coded for speed. % \begin{macrocode} @@ -2985,32 +2797,32 @@ \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 - \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 \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 \pdftex_if_engine_p: \c_false_bool - \cs_set_eq:NN \xetex_if_engine_p: \c_true_bool + \cs_gset_eq:NN \pdftex_if_engine:T \use_none:n + \cs_gset_eq:NN \pdftex_if_engine:F \use:n + \cs_gset_eq:NN \pdftex_if_engine:TF \use_ii:nn + \cs_gset_eq:NN \xetex_if_engine:T \use:n + \cs_gset_eq:NN \xetex_if_engine:F \use_none:n + \cs_gset_eq:NN \xetex_if_engine:TF \use_i:nn + \cs_gset_eq:NN \pdftex_if_engine_p: \c_false_bool + \cs_gset_eq:NN \xetex_if_engine_p: \c_true_bool } \cs_if_exist:NT \luatex_directlua:D { - \cs_set_eq:NN \luatex_if_engine:T \use:n - \cs_set_eq:NN \luatex_if_engine:F \use_none:n - \cs_set_eq:NN \luatex_if_engine:TF \use_i:nn - \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 \luatex_if_engine_p: \c_true_bool - \cs_set_eq:NN \pdftex_if_engine_p: \c_false_bool + \cs_gset_eq:NN \luatex_if_engine:T \use:n + \cs_gset_eq:NN \luatex_if_engine:F \use_none:n + \cs_gset_eq:NN \luatex_if_engine:TF \use_i:nn + \cs_gset_eq:NN \pdftex_if_engine:T \use_none:n + \cs_gset_eq:NN \pdftex_if_engine:F \use:n + \cs_gset_eq:NN \pdftex_if_engine:TF \use_ii:nn + \cs_gset_eq:NN \luatex_if_engine_p: \c_true_bool + \cs_gset_eq:NN \pdftex_if_engine_p: \c_false_bool } % \end{macrocode} % \end{macro} % % \subsection{Doing nothing functions} % -% \begin{macro}{\prg_do_nothing:} +% \begin{macro}[EXP]{\prg_do_nothing:} % This does not fit anywhere else! % \begin{macrocode} \cs_new_nopar:Npn \prg_do_nothing: { } @@ -3019,8 +2831,7 @@ % % \subsection{String comparisons} % -% \begin{macro}[pTF]{\str_if_eq:nn} -% \begin{macro}[pTF]{\str_if_eq:xx} +% \begin{macro}[pTF, EXP]{\str_if_eq:nn, \str_if_eq:xx} % Modern engines provide a direct way of comparing two token lists, % but returning a number. This set of conditionals therefore make life % a bit clearer. The \texttt{nn} and \texttt{xx} versions are created @@ -3031,7 +2842,7 @@ { \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 } { @@ -3040,13 +2851,10 @@ } % \end{macrocode} % \end{macro} -% \end{macro} % % \subsection{Breaking out of mapping functions} % -% \begin{macro}[EXP]{\prg_break_point:n} -% \begin{macro}[EXP]{\prg_map_break:} -% \begin{macro}[EXP]{\prg_map_break:n} +% \begin{macro}[EXP]{\prg_break_point:n, \prg_map_break:, \prg_map_break:n} % In inline mappings, the nesting level must be reset % at the end of the mapping, even when the user decides % to break out. This is done by putting the code that @@ -3060,8 +2868,6 @@ \cs_new:Npn \prg_map_break:n #1 #2 \prg_break_point:n #3 { #3 #1 } % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} % % \subsection{Deprecated functions} % @@ -3112,7 +2918,7 @@ % % Deprecated 2011-09-06, for removal by 2011-12-31. % -% \begin{macro} +% \begin{variable} % { % \c_pdftex_is_engine_bool, \c_luatex_is_engine_bool, % \c_xetex_is_engine_bool @@ -3125,12 +2931,15 @@ \cs_new_eq:NN \c_xetex_is_engine_bool \xetex_if_engine_p: %</deprecated> % \end{macrocode} -% \end{macro} +% \end{variable} % -% \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} +% \begin{macro}[EXP] +% { +% \use_i_after_fi:nw, +% \use_i_after_else:nw, +% \use_i_after_or:nw, +% \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. @@ -3143,9 +2952,6 @@ %</deprecated> % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % % Deprecated 2011-09-07, for removal by 2011-12-31. % |