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 | |
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')
19 files changed, 1252 insertions, 1723 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx index 5dbfdd60bce..b9a053a8a27 100644 --- a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx @@ -48,8 +48,8 @@ %<package> } \def\ExplFileName{expl3} \def\ExplFileDescription{L3 Experimental code bundle wrapper} -\def\ExplFileDate{2012/02/26} -\def\ExplFileVersion{3471} +\def\ExplFileDate{2012/04/23} +\def\ExplFileVersion{3570} %</driver|package> %<*driver> \documentclass[full]{l3doc} @@ -878,7 +878,6 @@ % \item Johannes Braams % \item David Carlisle % \item Robin Fairbairns -% \item Morten H{\o}gholm % \item Bruno Le Floch % \item Thomas Lotze % \item Frank Mittelbach @@ -892,6 +891,7 @@ % \item Michael Downes % \item Denys Duchier % \item Alan Jeffrey +% \item Morten H{\o}gholm % \item Martin Schr{\"o}der % \end{itemize} % 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. % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx index 7497971d2d6..8ec1f62babe 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3box.dtx 3432 2012-02-18 12:16:20Z joseph $ +\GetIdInfo$Id: l3box.dtx 3490 2012-03-04 01:00:53Z bruno $ {L3 Experimental boxes} %</driver|package> %<*driver> @@ -135,6 +135,16 @@ % clears \meta{box2}. These assignments are global. % \end{function} % +% \begin{function}[EXP, pTF, added=2012-03-03] +% {\box_if_exist:N, \box_if_exist:c} +% \begin{syntax} +% \cs{box_if_exist_p:N} \meta{box} +% \cs{box_if_exist:NTF} \meta{box} \Arg{true code} \Arg{false code} +% \end{syntax} +% Tests whether the \meta{box} is currently defined. This does not +% check that the \meta{box} really is a box. +% \end{function} +% % \section{Using boxes} % % \begin{function}{\box_use:N, \box_use:c} @@ -832,17 +842,9 @@ % Clear or new. % \begin{macrocode} \cs_new_protected:Npn \box_clear_new:N #1 - { - \cs_if_exist:NTF #1 - { \box_set_eq:NN #1 \c_empty_box } - { \box_new:N #1 } - } + { \box_if_exist:NTF #1 { \box_clear:N #1 } { \box_new:N #1 } } \cs_new_protected:Npn \box_gclear_new:N #1 - { - \cs_if_exist:NTF #1 - { \box_gset_eq:NN #1 \c_empty_box } - { \box_new:N #1 } - } + { \box_if_exist:NTF #1 { \box_gclear:N #1 } { \box_new:N #1 } } \cs_generate_variant:Nn \box_clear_new:N { c } \cs_generate_variant:Nn \box_gclear_new:N { c } % \end{macrocode} @@ -892,6 +894,20 @@ % \end{macro} % \end{macro} % +% \begin{macro}[pTF]{\box_if_exist:N, \box_if_exist:c} +% Copies of the \texttt{cs} functions defined in \pkg{l3basics}. +% \begin{macrocode} +\cs_new_eq:NN \box_if_exist:NTF \cs_if_exist:NTF +\cs_new_eq:NN \box_if_exist:NT \cs_if_exist:NT +\cs_new_eq:NN \box_if_exist:NF \cs_if_exist:NF +\cs_new_eq:NN \box_if_exist_p:N \cs_if_exist_p:N +\cs_new_eq:NN \box_if_exist:cTF \cs_if_exist:cTF +\cs_new_eq:NN \box_if_exist:cT \cs_if_exist:cT +\cs_new_eq:NN \box_if_exist:cF \cs_if_exist:cF +\cs_new_eq:NN \box_if_exist_p:c \cs_if_exist_p:c +% \end{macrocode} +% \end{macro} +% % \subsection{Measuring and setting box dimensions} % % \begin{macro}{\box_ht:N,\box_ht:c} @@ -1069,7 +1085,7 @@ % \begin{macrocode} \cs_new_protected:Npn \box_show:N #1 { - \cs_if_exist:NTF #1 + \box_if_exist:NTF #1 { \tex_showbox:D \use:n {#1} } { \msg_kernel_error:nnx { kernel } { variable-not-defined } diff --git a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx index 8cd9e6d6687..31a429e61ef 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx @@ -37,7 +37,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3clist.dtx 3460 2012-02-26 12:16:41Z will $ +\GetIdInfo$Id: l3clist.dtx 3490 2012-03-04 01:00:53Z bruno $ {L3 Experimental comma separated lists} %</driver|package> %<*driver> @@ -149,6 +149,16 @@ % \meta{comma list2} will be placed at the left side of the new comma list. % \end{function} % +% \begin{function}[EXP, pTF, added=2012-03-03] +% {\clist_if_exist:N, \clist_if_exist:c} +% \begin{syntax} +% \cs{clist_if_exist_p:N} \meta{comma list} +% \cs{clist_if_exist:NTF} \meta{comma list} \Arg{true code} \Arg{false code} +% \end{syntax} +% Tests whether the \meta{comma list} is currently defined. This does +% not check that the \meta{comma list} really is a comma list. +% \end{function} +% % \section{Adding data to comma lists} % % \begin{function}[added = 2011-09-06] @@ -274,8 +284,8 @@ % \begin{function}[EXP,pTF] % {\clist_if_eq:NN, \clist_if_eq:Nc, \clist_if_eq:cN, \clist_if_eq:cc} % \begin{syntax} -% \cs{clist_if_eq_p:NN} \Arg{clist_1} \Arg{clist_2} -% \cs{clist_if_eq:NNTF} \Arg{clist_1} \Arg{clist_2} \Arg{true code} \Arg{false code} +% \cs{clist_if_eq_p:NN} \meta{clist_1} \meta{clist_2} +% \cs{clist_if_eq:NNTF} \meta{clist_1} \meta{clist_2} \Arg{true code} \Arg{false code} % \end{syntax} % Compares the content of two \meta{comma lists} and % is logically \texttt{true} if the two contain the same list of @@ -729,6 +739,20 @@ % \end{macro} % \end{macro} % +% \begin{macro}[pTF]{\clist_if_exist:N, \clist_if_exist:c} +% Copies of the \texttt{cs} functions defined in \pkg{l3basics}. +% \begin{macrocode} +\cs_new_eq:NN \clist_if_exist:NTF \cs_if_exist:NTF +\cs_new_eq:NN \clist_if_exist:NT \cs_if_exist:NT +\cs_new_eq:NN \clist_if_exist:NF \cs_if_exist:NF +\cs_new_eq:NN \clist_if_exist_p:N \cs_if_exist_p:N +\cs_new_eq:NN \clist_if_exist:cTF \cs_if_exist:cTF +\cs_new_eq:NN \clist_if_exist:cT \cs_if_exist:cT +\cs_new_eq:NN \clist_if_exist:cF \cs_if_exist:cF +\cs_new_eq:NN \clist_if_exist_p:c \cs_if_exist_p:c +% \end{macrocode} +% \end{macro} +% % \subsection{Removing spaces around items} % % \begin{macro}[int,EXP]{\clist_trim_spaces_generic:nw} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx index 28c9de60e50..54575bde8ce 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx @@ -36,7 +36,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3coffins.dtx 3460 2012-02-26 12:16:41Z will $ +\GetIdInfo$Id: l3coffins.dtx 3482 2012-03-03 18:48:06Z bruno $ {L3 Experimental coffin code layer} %</driver|package> %<*driver> @@ -2216,7 +2216,7 @@ % \begin{macrocode} \cs_new_protected:Npn \coffin_show_structure:N #1 { - \cs_if_exist:cTF { l_coffin_poles_ \int_value:w #1 _prop } + \coffin_if_exist:NT #1 { \msg_aux_show:Nnx #1 { coffins } { @@ -2225,10 +2225,6 @@ \msg_aux_show_unbraced:nn } } - { - \msg_aux_use:nn { LaTeX / coffins } { no-pole } - \msg_aux_show:x { } - } } \cs_generate_variant:Nn \coffin_show_structure:N { c } % \end{macrocode} @@ -2263,11 +2259,6 @@ > ~ wd~=~\dim_use:N \box_wd:N #1 \\ Poles~of~coffin~\token_to_str:N #1 : } -\msg_kernel_new:nnn { coffins } { no-pole } - { - ---~No~poles~found~--- \\ - Is~this~really~a~coffin? - } % \end{macrocode} % % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx index 67d073be832..8eec496836e 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx @@ -78,7 +78,7 @@ Do not distribute a modified version of this file. % \end{macrocode} % %<*driver|class> -\GetIdInfo$Id: l3doc.dtx 3464 2012-02-26 15:30:29Z bruno $ +\GetIdInfo$Id: l3doc.dtx 3491 2012-03-04 06:13:18Z bruno $ {L3 Experimental documentation class} %</driver|class> % @@ -1003,7 +1003,7 @@ Do not distribute a modified version of this file. \vcoffin_set:Nnw \l_doc_descr_coffin {\textwidth} \noindent\ignorespaces } -\cs_gset_nopar:Npn \function_typeset:n #1 +\cs_gset_nopar:Npn \function_typeset:n #1 %^^A todo: use "\cs_new:Npn" here { \tl_gclear:N \g_doc_macro_tl diff --git a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx index 28f53230235..9b8bd6b1a0a 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3file.dtx 3464 2012-02-26 15:30:29Z bruno $ +\GetIdInfo$Id: l3file.dtx 3520 2012-03-09 19:34:07Z joseph $ {L3 Experimental file and I/O operations} %</driver|package> %<*driver> @@ -976,20 +976,20 @@ \cs_generate_variant:Nn \iow_open:Nn { c } \cs_new_protected:Npn \ior_open_aux:Nn #1#2 { - \file_add_path:nN {#2} \l_file_name_internal_tl + \file_add_path:nN {#2} \l_file_internal_name_tl \quark_if_no_value:NTF \l_file_internal_name_tl { \file_input_error:n {#2} } - { \ior_open_unsafe:No #1 \l_file_name_internal_tl } + { \ior_open_unsafe:No #1 \l_file_internal_name_tl } } \prg_new_protected_conditional:Npnn \ior_open:Nn #1#2 { T , F , TF } { \file_name_sanitize:nn {#2} { \ior_open_aux:NnTF #1 } } \cs_new_protected:Npn \ior_open_aux:NnTF #1#2 { - \file_add_path:nN {#2} \l_file_name_internal_tl + \file_add_path:nN {#2} \l_file_internal_name_tl \quark_if_no_value:NTF \l_file_internal_name_tl { \prg_return_false: } { - \ior_open_unsafe:No #1 \l_file_name_internal_tl + \ior_open_unsafe:No #1 \l_file_internal_name_tl \prg_return_true: } } @@ -1073,8 +1073,7 @@ \ior_new:N \g_ior_internal_ior \cs_new_protected:Npn \iow_stream_alloc:N #1 { - \cs_if_exist:cTF { g_iow_ \int_use:N \l_iow_stream_int _iow } - { \cs_gset_eq:Nc #1 { g_iow_ \int_use:N \l_iow_stream_int _iow } } + \cs_if_exist:cF { g_iow_ \int_use:N \l_iow_stream_int _iow } { %<*package> \iow_stream_alloc_aux: @@ -1089,8 +1088,8 @@ %<*initex> \iow_raw_new:c { g_iow_ \int_use:N \l_iow_stream_int _iow } %</initex> - \cs_gset_eq:Nc #1 { g_iow_ \int_use:N \l_iow_stream_int _iow } } + \cs_gset_eq:Nc #1 { g_iow_ \int_use:N \l_iow_stream_int _iow } } %<*package> \cs_new_protected_nopar:Npn \iow_stream_alloc_aux: @@ -1098,19 +1097,18 @@ \int_incr:N \l_iow_stream_int \int_compare:nNnT \l_iow_stream_int < \c_sixteen { - \cs_if_exist:cTF { g_iow_ \int_use:N \l_iow_stream_int _iow } - { - \prop_if_in:NVT \g_iow_streams_prop \l_iow_stream_int - { \iow_stream_alloc_aux: } - } - { \iow_stream_alloc_aux: } + \cs_if_exist:cTF { g_iow_ \int_use:N \l_iow_stream_int _iow } + { + \prop_if_in:NVT \g_iow_streams_prop \l_iow_stream_int + { \iow_stream_alloc_aux: } + } + { \iow_stream_alloc_aux: } } } %</package> \cs_new_protected:Npn \ior_stream_alloc:N #1 { - \cs_if_exist:cTF { g_ior_ \int_use:N \l_ior_stream_int _ior } - { \cs_gset_eq:Nc #1 { g_ior_ \int_use:N \l_ior_stream_int _ior } } + \cs_if_exist:cF { g_ior_ \int_use:N \l_ior_stream_int _ior } { %<*package> \ior_stream_alloc_aux: @@ -1125,8 +1123,8 @@ %<*initex> \ior_raw_new:c { g_ior_ \int_use:N \l_ior_stream_int _ior } %</initex> - \cs_gset_eq:Nc #1 { g_ior_ \int_use:N \l_ior_stream_int _ior } } + \cs_gset_eq:Nc #1 { g_ior_ \int_use:N \l_ior_stream_int _ior } } %<*package> \cs_new_protected_nopar:Npn \ior_stream_alloc_aux: @@ -1134,12 +1132,12 @@ \int_incr:N \l_ior_stream_int \int_compare:nNnT \l_ior_stream_int < \c_sixteen { - \cs_if_exist:cTF { g_ior_ \int_use:N \l_ior_stream_int _ior } - { - \prop_if_in:NVT \g_ior_streams_prop \l_ior_stream_int - { \ior_stream_alloc_aux: } - } - { \ior_stream_alloc_aux: } + \cs_if_exist:cTF { g_ior_ \int_use:N \l_ior_stream_int _ior } + { + \prop_if_in:NVT \g_ior_streams_prop \l_ior_stream_int + { \ior_stream_alloc_aux: } + } + { \ior_stream_alloc_aux: } } } %</package> @@ -1758,10 +1756,10 @@ % % \begin{macrocode} \msg_kernel_new:nnnn { file } { file-not-found } - { Space~in~file~name~'#1'. } + { File~'#1'~not~found. } { - Spaces~are~not~permitted~in~files~loaded~by~LaTeX: \\ - Further~errors~may~follow! + The~requested~file~could~not~be~found~in~the~current~directory,~ + in~the~TeX~search~path~or~in~the~LaTeX~search~path. } \msg_kernel_new:nnnn { file } { space-in-file-name } { Space~in~file~name~'#1'. } diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx index ea947680f43..64a6b39252f 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3fp.dtx 3315 2012-02-06 11:17:04Z bruno $ +\GetIdInfo$Id: l3fp.dtx 3490 2012-03-04 01:00:53Z bruno $ {L3 Experimental floating-point operations} %</driver|package> %<*driver> @@ -93,7 +93,7 @@ % % Operations which give an undefined result (such as division by % $0$) will not lead to errors. Instead special marker values are -% returned, which can be tested for using fr example +% returned, which can be tested for using for example % \cs{fp_if_undefined:N(TF)}. In this way it is possible to work with % asymptotic functions without first checking the input. If these % special values are carried forward in calculations they will be @@ -202,6 +202,15 @@ % terminal. % \end{function} % +% \begin{function}[EXP, pTF, added=2012-03-03]{\fp_if_exist:N, \fp_if_exist:c} +% \begin{syntax} +% \cs{fp_if_exist_p:N} \meta{fp~var} +% \cs{fp_if_exist:NTF} \meta{fp~var} \Arg{true code} \Arg{false code} +% \end{syntax} +% Tests whether the \meta{fp~var} is currently defined. This does not +% check that the \meta{fp~var} really is a floating point variable. +% \end{function} +% % \section{Conversion of floating point values to other formats} % % It is useful to be able to convert floating point variables to @@ -1209,9 +1218,9 @@ % Create a floating point if needed, otherwise clear it. % \begin{macrocode} \cs_new_protected:Npn \fp_zero_new:N #1 - { \cs_if_exist:NTF #1 { \fp_zero:N #1 } { \fp_new:N #1 } } + { \fp_if_exist:NTF #1 { \fp_zero:N #1 } { \fp_new:N #1 } } \cs_new_protected:Npn \fp_gzero_new:N #1 - { \cs_if_exist:NTF #1 { \fp_gzero:N #1 } { \fp_new:N #1 } } + { \fp_if_exist:NTF #1 { \fp_gzero:N #1 } { \fp_new:N #1 } } \cs_generate_variant:Nn \fp_zero_new:N { c } \cs_generate_variant:Nn \fp_gzero_new:N { c } % \end{macrocode} @@ -1482,6 +1491,20 @@ % \end{macro} % \end{macro} % +% \begin{macro}[pTF]{\fp_if_exist:N, \fp_if_exist:c} +% Copies of the \texttt{cs} functions defined in \pkg{l3basics}. +% \begin{macrocode} +\cs_new_eq:NN \fp_if_exist:NTF \cs_if_exist:NTF +\cs_new_eq:NN \fp_if_exist:NT \cs_if_exist:NT +\cs_new_eq:NN \fp_if_exist:NF \cs_if_exist:NF +\cs_new_eq:NN \fp_if_exist_p:N \cs_if_exist_p:N +\cs_new_eq:NN \fp_if_exist:cTF \cs_if_exist:cTF +\cs_new_eq:NN \fp_if_exist:cT \cs_if_exist:cT +\cs_new_eq:NN \fp_if_exist:cF \cs_if_exist:cF +\cs_new_eq:NN \fp_if_exist_p:c \cs_if_exist_p:c +% \end{macrocode} +% \end{macro} +% % \subsection{Transferring to other types} % % The \cs{fp_use:N} function converts a floating point variable to diff --git a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx index fa633515f99..fdae7fa1046 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3int.dtx 3460 2012-02-26 12:16:41Z will $ +\GetIdInfo$Id: l3int.dtx 3490 2012-03-04 01:00:53Z bruno $ {L3 Experimental integers} %</driver|package> %<*driver> @@ -208,6 +208,16 @@ % \meta{integer2}. % \end{function} % +% \begin{function}[EXP, pTF, added=2012-03-03] +% {\int_if_exist:N, \int_if_exist:c} +% \begin{syntax} +% \cs{int_if_exist_p:N} \meta{int} +% \cs{int_if_exist:NTF} \meta{int} \Arg{true code} \Arg{false code} +% \end{syntax} +% Tests whether the \meta{int} is currently defined. This does not +% check that the \meta{int} really is an integer variable. +% \end{function} +% % \section{Setting and incrementing integers} % % \begin{function}[updated = 2011-10-22] @@ -1056,9 +1066,9 @@ % Create a register if needed, otherwise clear it. % \begin{macrocode} \cs_new_protected:Npn \int_zero_new:N #1 - { \cs_if_exist:NTF #1 { \int_zero:N #1 } { \int_new:N #1 } } + { \int_if_exist:NTF #1 { \int_zero:N #1 } { \int_new:N #1 } } \cs_new_protected:Npn \int_gzero_new:N #1 - { \cs_if_exist:NTF #1 { \int_gzero:N #1 } { \int_new:N #1 } } + { \int_if_exist:NTF #1 { \int_gzero:N #1 } { \int_new:N #1 } } \cs_generate_variant:Nn \int_zero_new:N { c } \cs_generate_variant:Nn \int_gzero_new:N { c } % \end{macrocode} @@ -1082,6 +1092,20 @@ % \end{macro} % \end{macro} % +% \begin{macro}[pTF]{\int_if_exist:N, \int_if_exist:c} +% Copies of the \texttt{cs} functions defined in \pkg{l3basics}. +% \begin{macrocode} +\cs_new_eq:NN \int_if_exist:NTF \cs_if_exist:NTF +\cs_new_eq:NN \int_if_exist:NT \cs_if_exist:NT +\cs_new_eq:NN \int_if_exist:NF \cs_if_exist:NF +\cs_new_eq:NN \int_if_exist_p:N \cs_if_exist_p:N +\cs_new_eq:NN \int_if_exist:cTF \cs_if_exist:cTF +\cs_new_eq:NN \int_if_exist:cT \cs_if_exist:cT +\cs_new_eq:NN \int_if_exist:cF \cs_if_exist:cF +\cs_new_eq:NN \int_if_exist_p:c \cs_if_exist_p:c +% \end{macrocode} +% \end{macro} +% % \subsection{Setting and incrementing integers} % % \begin{macro}{\int_add:Nn, \int_add:cn} @@ -1167,152 +1191,118 @@ \cs_new_eq:NN \int_use:N \tex_the:D \cs_new:Npn \int_use:c #1 { \int_use:N \cs:w #1 \cs_end: } % \end{macrocode} -% \end{macro} +% \end{macro} % % \subsection{Integer expression conditionals} % -% \begin{macro}[pTF]{\int_compare:n} -% \begin{macro}[aux]{\int_compare_aux:nw} -% \begin{macro}[aux]{\int_compare_aux:Nw} -% \begin{macro}[aux]{int_compare_=:w} -% \begin{macro}[aux]{int_compare_==:w} -% \begin{macro}[aux]{int_compare_!=:w} -% \begin{macro}[aux]{int_compare_<:w} -% \begin{macro}[aux]{int_compare_>:w} -% \begin{macro}[aux]{int_compare_<=:w} -% \begin{macro}[aux]{int_compare_>=:w} -% Comparison tests using a simple syntax where only one set of braces -% is required and additional operators such as |!=| and |>=| are -% supported. First some notes on the idea behind this. We wish to -% support writing code like -% \begin{verbatim} -% \int_compare_p:n { 5 + \l_tmpa_int != 4 - \l_tmpb_int } -% \end{verbatim} -% In other words, we want to somehow add the missing \cs{int_eval:w} -% where required. We can start evaluating from the left using -% \cs{int_eval:w}, and we know that since the relation symbols |<|, |>|, -% |=| and |!| are not allowed in such expressions, they will terminate -% the expression. Therefore, we first let \TeX{} evaluate this left -% hand side of the (in)equality. +% \begin{macro}[aux, EXP]{\kernel_compare_error:, \kernel_compare_error:NNw} +% Those functions are used for comparison tests which use a simple +% syntax where only one set of braces is required and additional +% operators such as |!=| and |>=| are supported. The tests first +% evaluate their left-hand side, with a trailing +% \cs{kernel_compare_error:}. This marker is normally not expanded, +% but if the relation symbol is missing from the test's argument, then +% the marker inserts |=| (and itself) after triggering the relevant +% \TeX{} error. If the first token which appears after evaluating and +% removing the left-hand side is not a known relation symbol, then a +% judiciously placed \cs{kernel_compare_error:Nw} gets expanded, +% cleaning up the end of the test and telling the user what the +% problem was. % \begin{macrocode} -\prg_new_conditional:Npnn \int_compare:n #1 { p , T , F , TF } - { \exp_after:wN \int_compare_aux:nw \int_value:w \int_eval:w #1 \q_stop } -% \end{macrocode} -% Then the next step is to figure out which relation we should use, so -% we have to somehow get rid of the first evaluation so that we can -% see what stopped it. \cs{int_to_roman:w} is handy here since its -% expansion given a non-positive number is \meta{null}. We therefore -% simply check if the first token of the left hand side evaluation is -% a minus. If not, we insert it and issue \cs{int_to_roman:w}, -% thereby ridding us of the left hand side evaluation. We do however -% save it for later. -% \begin{macrocode} -\cs_new:Npn \int_compare_aux:nw #1#2 \q_stop +\cs_new_protected_nopar:Npn \kernel_compare_error: { - \exp_after:wN \int_compare_aux:Nw - \int_to_roman:w - \if:w #1 - - \else: - - - \fi: - #1#2 \q_mark #1#2 \q_stop + \if_num:w \c_zero \c_zero \fi: + = + \kernel_compare_error: } -% \end{macrocode} -% This leaves the first relation symbol in front and assuming the -% right hand side has been input, at least one other token as well. We -% support the following forms: |=|, |<|, |>| and the extended |!=|, -% |==|, |<=| and |>=|. All the extended forms have an extra |=| so we -% check if that is present as well. Then use specific function to -% perform the test. -% \begin{macrocode} -\cs_new:Npn \int_compare_aux:Nw #1#2#3 \q_mark - { \use:c { int_compare_ #1 \if_meaning:w = #2 = \fi: :w } } -% \end{macrocode} -% The actual comparisons are then simple function calls, using the -% relation as delimiter for a delimited argument. -% Equality is easy: -% \begin{macrocode} -\cs_new:cpn { int_compare_=:w } #1 = #2 \q_stop +\cs_new:Npn \kernel_compare_error:Nw + #1#2 \prg_return_true: \else: \prg_return_false: \fi: { - \if_int_compare:w #1 = \int_eval:w #2 \int_eval_end: - \prg_return_true: - \else: - \prg_return_false: - \fi: + \msg_expandable_kernel_error:nnn + { kernel } { unknown-comparison } {#1} + \prg_return_false: } % \end{macrocode} -% So is the one using |==| we just have to use |==| in the -% parameter text. +% \end{macro} +% +% \begin{macro}[pTF, EXP]{\int_compare:n} +% \begin{macro}[aux, EXP]{\int_compare_aux:Nw, \int_compare_aux:NNw} +% \begin{macro}[aux, EXP] +% { +% \int_compare_=:NNw, +% \int_compare_<:NNw, +% \int_compare_>:NNw, +% \int_compare_==:NNw, +% \int_compare_!=:NNw, +% \int_compare_<=:NNw, +% \int_compare_>=:NNw +% } +% Comparison tests using a simple syntax where only one set of braces +% is required and additional operators such as |!=| and |>=| are +% supported. We can start evaluating from the left using +% \cs{int_eval:w}, and we know that since the relation symbols |<|, +% |>|, |=| and |!| are not allowed in such expressions, they will +% terminate the expression. Therefore, we first let \TeX{} evaluate +% this left hand side of the (in)equality. We also insert at that +% stage the end of the test: \cs{int_eval_end:} will end the +% evaluation of the right-hand side. % \begin{macrocode} -\cs_new:cpn { int_compare_==:w } #1 == #2 \q_stop +\prg_new_conditional:Npnn \int_compare:n #1 { p , T , F , TF } { - \if_int_compare:w #1 = \int_eval:w #2 \int_eval_end: + \exp_after:wN \int_compare_aux:Nw \int_use:N \int_eval:w #1 + \kernel_compare_error: \int_eval_end: \prg_return_true: \else: \prg_return_false: \fi: } % \end{macrocode} -% Not equal is just about reversing the truth value. -% \begin{macrocode} -\cs_new:cpn { int_compare_!=:w } #1 != #2 \q_stop - { - \if_int_compare:w #1 = \int_eval:w #2 \int_eval_end: - \prg_return_false: - \else: - \prg_return_true: - \fi: - } -% \end{macrocode} -% Less than and greater than are also straight forward. +% We have just evaluated the left-hand side. To access the relation +% symbol, we remove the number by applying \cs{int_to_roman:w}, after +% making sure that the argument becomes non-positive: its roman +% numeral representation is then empty. The \cs{int_compare_aux:NNw} +% auxiliary then probes the first two tokens to determine the relation +% symbol, building a control sequence from it. All the extended forms +% have an extra |=| hence the test for that as a second token. If the +% relation symbol is unknown, then the control sequence is turned by +% \TeX{} into \cs{scan_stop:}, and \cs{kernel_compare_error:Nw} +% raises an error. % \begin{macrocode} -\cs_new:cpn { int_compare_<:w } #1 < #2 \q_stop +\cs_new:Npn \int_compare_aux:Nw #1#2 \kernel_compare_error: { - \if_int_compare:w #1 < \int_eval:w #2 \int_eval_end: - \prg_return_true: - \else: - \prg_return_false: - \fi: + \exp_after:wN \int_compare_aux:NNw + \int_to_roman:w - 0 #2 ?? \q_mark + #1#2 } -\cs_new:cpn { int_compare_>:w } #1 > #2 \q_stop +\cs_new:Npn \int_compare_aux:NNw #1#2#3 \q_mark { - \if_int_compare:w #1 > \int_eval:w #2 \int_eval_end: - \prg_return_true: - \else: - \prg_return_false: - \fi: + \use:c { int_compare_ #1 \if_meaning:w = #2 = \fi: :NNw } + \kernel_compare_error:Nw #1 } % \end{macrocode} -% The less than or equal operation is just the opposite of the greater -% than operation. \emph{Vice versa} for less than or equal. +% The actual comparisons are then simple function calls, using the +% relation as delimiter for a delimited argument and discarding +% \cs{kernel_compare_error:Nw} \meta{token} responsible for error +% detection. % \begin{macrocode} -\cs_new:cpn { int_compare_<=:w } #1 <= #2 \q_stop - { - \if_int_compare:w #1 > \int_eval:w #2 \int_eval_end: - \prg_return_false: - \else: - \prg_return_true: - \fi: - } -\cs_new:cpn { int_compare_>=:w } #1 >= #2 \q_stop - { - \if_int_compare:w #1 < \int_eval:w #2 \int_eval_end: - \prg_return_false: - \else: - \prg_return_true: - \fi: - } +\cs_new:cpn { int_compare_=:NNw } #1#2#3 = + { \if_int_compare:w #3 = \int_eval:w } +\cs_new:cpn { int_compare_<:NNw } #1#2#3 < + { \if_int_compare:w #3 < \int_eval:w } +\cs_new:cpn { int_compare_>:NNw } #1#2#3 > + { \if_int_compare:w #3 > \int_eval:w } +\cs_new:cpn { int_compare_==:NNw } #1#2#3 == + { \if_int_compare:w #3 = \int_eval:w } +\cs_new:cpn { int_compare_!=:NNw } #1#2#3 != + { \reverse_if:N \if_int_compare:w #3 = \int_eval:w } +\cs_new:cpn { int_compare_<=:NNw } #1#2#3 <= + { \reverse_if:N \if_int_compare:w #3 > \int_eval:w } +\cs_new:cpn { int_compare_>=:NNw } #1#2#3 >= + { \reverse_if:N \if_int_compare:w #3 < \int_eval:w } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % % \begin{macro}[pTF]{\int_compare:nNn} % \UnitTested @@ -1946,16 +1936,16 @@ { \str_if_eq:nnTF {#2} { Q } { - \cs_if_exist:cF { c_int_from_roman_ #1 _int } + \int_if_exist:cF { c_int_from_roman_ #1 _int } { \int_from_roman_clean_up:w } + \use:c { c_int_from_roman_ #1 _int } #2 } { - \cs_if_exist:cF { c_int_from_roman_ #1 _int } + \int_if_exist:cF { c_int_from_roman_ #1 _int } { \int_from_roman_clean_up:w } - \cs_if_exist:cF { c_int_from_roman_ #2 _int } + \int_if_exist:cF { c_int_from_roman_ #2 _int } { \int_from_roman_clean_up:w } \int_compare:nNnTF { \use:c { c_int_from_roman_ #1 _int } } diff --git a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx index 42e32bb9ac5..e0becb45696 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3keys.dtx 3086 2011-12-22 17:55:46Z bruno $ +\GetIdInfo$Id: l3keys.dtx 3487 2012-03-03 19:36:51Z bruno $ {L3 Experimental key-value interfaces} %</driver|package> %<*driver> @@ -722,8 +722,8 @@ % % \begin{function}[added = 2011-08-21,EXP,pTF]{\keys_if_choice_exist:nn} % \begin{syntax} -% \cs{keys_if_exist_p:nnn} \meta{module} \meta{key} \meta{choice} \\ -% \cs{keys_if_exist:nnnTF} \meta{module} \meta{key} \meta{choice} \Arg{true code} \Arg{false code} +% \cs{keys_if_choice_exist_p:nnn} \meta{module} \meta{key} \meta{choice} \\ +% \cs{keys_if_choice_exist:nnnTF} \meta{module} \meta{key} \meta{choice} \Arg{true code} \Arg{false code} % \end{syntax} % Tests if the \meta{choice} is defined for the \meta{key} within the % \meta{module},, \emph{i.e.}~if any code has been defined for @@ -1157,15 +1157,16 @@ \bool_set_false:N \l_keys_no_value_bool \keys_define_elt_aux:nn {#1} {#2} } -\cs_new_protected:Npn \keys_define_elt_aux:nn #1#2 { - \keys_property_find:n {#1} - \cs_if_exist:cTF { \c_keys_props_root_tl \l_keys_property_tl } - { \keys_define_key:n {#2} } - { - \msg_kernel_error:nnxx { keys } { property-unknown } - { \l_keys_property_tl } { \l_keys_path_tl } - } -} +\cs_new_protected:Npn \keys_define_elt_aux:nn #1#2 + { + \keys_property_find:n {#1} + \cs_if_exist:cTF { \c_keys_props_root_tl \l_keys_property_tl } + { \keys_define_key:n {#2} } + { + \msg_kernel_error:nnxx { keys } { property-unknown } + { \l_keys_property_tl } { \l_keys_path_tl } + } + } % \end{macrocode} % \end{macro} % \end{macro} @@ -1236,7 +1237,7 @@ % \begin{macrocode} \cs_new:Npn \keys_bool_set:NN #1#2 { - \cs_if_exist:NF #1 { \bool_new:N #1 } + \bool_if_exist:NF #1 { \bool_new:N #1 } \keys_choice_make: \keys_cmd_set:nx { \l_keys_path_tl / true } { \exp_not:c { bool_ #2 set_true:N } \exp_not:N #1 } @@ -1257,7 +1258,7 @@ % \begin{macrocode} \cs_new:Npn \keys_bool_set_inverse:NN #1#2 { - \cs_if_exist:NF #1 { \bool_new:N #1 } + \bool_if_exist:NF #1 { \bool_new:N #1 } \keys_choice_make: \keys_cmd_set:nx { \l_keys_path_tl / true } { \exp_not:c { bool_ #2 set_false:N } \exp_not:N #1 } @@ -1478,7 +1479,7 @@ % \begin{macrocode} \cs_new_protected:Npn \keys_variable_set:NnNN #1#2#3#4 { - \cs_if_exist:NF #1 { \use:c { #2 _new:N } #1 } + \use:c { #2_if_exist:NF } #1 { \use:c { #2 _new:N } #1 } \keys_cmd_set:nx { \l_keys_path_tl } { \exp_not:c { #2 _ #3 set:N #4 } \exp_not:N #1 {##1} } } @@ -1886,7 +1887,7 @@ { \cs_if_exist:cTF { \c_keys_code_root_tl #1 } { - \exp_args:Nno \use:c { \c_keys_code_root_tl #1 } + \exp_args:Nc \exp_args:No { \c_keys_code_root_tl #1 } \l_keys_value_tl } {#2} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx index 472196ac62a..89362b7e7d4 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3msg.dtx 3470 2012-02-26 19:10:24Z bruno $ +\GetIdInfo$Id: l3msg.dtx 3568 2012-04-23 13:23:58Z joseph $ {L3 Experimental messages} %</driver|package> %<*driver> @@ -91,6 +91,8 @@ % % \section{Creating new messages} % +% ^^A Wrong: "\msg_new:nnnn" is (as it should) global. +% ^^A However, redirections are indeed local. % All messages have to be created before they can be used. All message % setting is local, with the general assumption that messages will % be managed as part of module set up outside of any \TeX{} grouping. @@ -99,6 +101,19 @@ % available in the console. As a result, formatting is only needed % where it will help to show meaning. In particular, |\\| may be % used to force a new line and \verb*|\ | forces an explicit space. +% Additionally, |\{|, |\#|, |\}|, |\%| and |\~| can be used to produce +% the corresponding character. +% +% Messages may be subdivided \emph{by one level} using the~|/| +% character. This is used within the message filtering system to allow +% for example the \LaTeX{} kernel messages to belong to the module +% \texttt{LaTeX} while still being filterable at a more granular level. +% Thus for example +% \begin{verbatim} +% \msg_new:nnnn { mymodule } { submodule / message } ... +% \end{verbatim} +% will allow only those messages from the \texttt{submodule} to be filtered +% out. % % \begin{function}[updated = 2011-08-16]{\msg_new:nnnn, \msg_new:nnn} % \begin{syntax} @@ -110,9 +125,8 @@ % available then a standard text is given instead. Within \meta{text} % and \meta{more text} four parameters (|#1| to |#4|) can be used: % these will be supplied at the time the message is used. The -% parameters will be expanded when the message is used. Within the -% \meta{text} and \meta{more text} |\\| can be used to start a new -% line. An error will be raised if the \meta{message} already exists. +% parameters will be expanded when the message is used. An error will +% be raised if the \meta{message} already exists. % \end{function} % % \begin{function}{\msg_set:nnnn, \msg_set:nnn, \msg_gset:nnnn, \msg_gset:nnn} @@ -125,9 +139,16 @@ % available then a standard text is given instead. Within \meta{text} % and \meta{more text} four parameters (|#1| to |#4|) can be used: % these will be supplied at the time the message is used. The -% parameters will be expanded when the message is used. Within the -% \meta{text} and \meta{more text} |\\| can be used to start a new -% line. +% parameters will be expanded when the message is used. +% \end{function} +% +% \begin{function}[EXP,pTF, added=2012-03-03]{\msg_if_exist:nn} +% \begin{syntax} +% \cs{msg_if_exist_p:nn} \Arg{module} \Arg{message} +% \cs{msg_if_exist:nnTF} \Arg{module} \Arg{message} \Arg{true code} \Arg{false code} +% \end{syntax} +% Tests whether the \meta{message} for the \meta{module} is currently +% defined. % \end{function} % % \section{Contextual information for messages} @@ -176,7 +197,7 @@ % Fatal <module> error % \end{verbatim} % This function can be redefined to alter the language in which the -% message is give, using |#1| as the name of the \meta{module} to +% message is given, using |#1| as the name of the \meta{module} to % be included. % \end{function} % @@ -189,7 +210,7 @@ % Critical <module> error % \end{verbatim} % This function can be redefined to alter the language in which the -% message is give, using |#1| as the name of the \meta{module} to +% message is given, using |#1| as the name of the \meta{module} to % be included. % \end{function} % @@ -202,7 +223,7 @@ % <module> error % \end{verbatim} % This function can be redefined to alter the language in which the -% message is give, using |#1| as the name of the \meta{module} to +% message is given, using |#1| as the name of the \meta{module} to % be included. % \end{function} % @@ -215,7 +236,7 @@ % <module> warning % \end{verbatim} % This function can be redefined to alter the language in which the -% message is give, using |#1| as the name of the \meta{module} to +% message is given, using |#1| as the name of the \meta{module} to % be included. % \end{function} % @@ -228,7 +249,7 @@ % <module> info % \end{verbatim} % This function can be redefined to alter the language in which the -% message is give, using |#1| as the name of the \meta{module} to +% message is given, using |#1| as the name of the \meta{module} to % be included. % \end{function} % @@ -242,22 +263,26 @@ % \cs{tl_to_str:n} or \cs{token_to_str:N} to prevent unwanted expansion % of the material. % -% \begin{function}{\msg_class_set:nn} +% \begin{function}[updated = 2012-04-12]{\msg_class_set:nn} % \begin{syntax} % \cs{msg_class_set:nn} \Arg{class} \Arg{code} % \end{syntax} % Sets a \meta{class} to output a message, using \meta{code} % to process the message text. The \meta{class} should be a text % value, while the \meta{code} may be any arbitrary material. -% The \meta{code} will receive $6$ arguments: the module +% The \meta{code} will receive~$6$ arguments: the module % name (|#1|), the message name (|#2|) and the four arguments % taken by the message text (|#3| to |#6|). +% ^^A Add an example? An application could be that an IDE redirects +% ^^A classes from 'error' to 'IDEerror', 'warning' to 'IDEwarning', +% ^^A etc, and defines 'IDEerror' and 'IDEwarning' to produce messages +% ^^A which are simpler to parse. % \end{function} % % The kernel defines several common message classes. The following % describes the standard behaviour of each class if no redirection of % the class or message is active. In all cases, the message may be -% issued supplying $0$ to $4$ arguments. The code will +% issued supplying~$0$ to~$4$ arguments. The code will % ensure that there an no errors if the number of arguments supplied % here does not match the number in the definition of the message % (although of course the sense of the message may be impaired). @@ -271,8 +296,7 @@ % \msg_fatal:nn % } % \begin{syntax} -% \cs{msg_fatal:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} -% ~~\Arg{arg two} \Arg{arg three} \Arg{arg four} +% \cs{msg_fatal:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} % \end{syntax} % Issues \meta{module} error \meta{message}, passing \meta{arg one} to % \meta{arg four} to the text-creating functions. After issuing a @@ -281,15 +305,14 @@ % % \begin{function} % { -% \msg_critical:nnxxxx , -% \msg_critical:nnxxx , -% \msg_critical:nnxx , -% \msg_critical:nnx , -% \msg_critical:nn -% } +% \msg_critical:nnxxxx , +% \msg_critical:nnxxx , +% \msg_critical:nnxx , +% \msg_critical:nnx , +% \msg_critical:nn +% } % \begin{syntax} -% \cs{msg_critical:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} -% ~~\Arg{arg two} \Arg{arg three} \Arg{arg four} +% \cs{msg_critical:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} % \end{syntax} % Issues \meta{module} error \meta{message}, passing \meta{arg one} to % \meta{arg four} to the text-creating functions. After issuing the @@ -297,6 +320,8 @@ % the \TeX{} run (if the current file is the main file) or % may abort reading a sub-file. % \end{function} +% ^^A Perhaps add detection that we are in the main file to really do +% ^^A '\tex_end:D' in that case? % % \begin{function} % { @@ -307,8 +332,7 @@ % \msg_error:nn % } % \begin{syntax} -% \cs{msg_error:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} -% ~~\Arg{arg two} \Arg{arg three} \Arg{arg four} +% \cs{msg_error:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} % \end{syntax} % Issues \meta{module} error \meta{message}, passing \meta{arg one} to % \meta{arg four} to the text-creating functions. The error will @@ -325,8 +349,7 @@ % \msg_warning:nn % } % \begin{syntax} -% \cs{msg_warning:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} -% ~~\Arg{arg two} \Arg{arg three} \Arg{arg four} +% \cs{msg_warning:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} % \end{syntax} % Issues \meta{module} warning \meta{message}, passing \meta{arg one} to % \meta{arg four} to the text-creating functions. The warning text @@ -343,8 +366,7 @@ % \msg_info:nn % } % \begin{syntax} -% \cs{msg_info:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} -% ~~\Arg{arg two} \Arg{arg three} \Arg{arg four} +% \cs{msg_info:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} % \end{syntax} % Issues \meta{module} information \meta{message}, passing % \meta{arg one} to \meta{arg four} to the text-creating functions. @@ -360,8 +382,7 @@ % \msg_log:nn % } % \begin{syntax} -% \cs{msg_log:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} -% ~~\Arg{arg two} \Arg{arg three} \Arg{arg four} +% \cs{msg_log:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} % \end{syntax} % Issues \meta{module} information \meta{message}, passing % \meta{arg one} to \meta{arg four} to the text-creating functions. @@ -378,8 +399,7 @@ % \msg_none:nn % } % \begin{syntax} -% \cs{msg_none:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} -% ~~\Arg{arg two} \Arg{arg three} \Arg{arg four} +% \cs{msg_none:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} % \end{syntax} % Does nothing: used as a message class to prevent any output at % all (see the discussion of message redirection). @@ -405,13 +425,16 @@ % \begin{verbatim} % \msg_redirect_module:nnn { module } { error } { warning } % \end{verbatim} -% to alter just those messages for module, or even +% to alter only messages from that module, or even % \begin{verbatim} % \msg_redirect_name:nnn { module } { my-message } { warning } % \end{verbatim} -% to target just one message. +% to target just one message. Redirection applies first to individual messages, +% then to messages from one module and finally to messages of one class. Thus +% it is possible to select out an individual message for special treatment +% even if the entire class is already redirected. % -% \begin{function}{\msg_redirect_class:nn} +% \begin{function}[updated = 2012-04-12]{\msg_redirect_class:nn} % \begin{syntax} % \cs{msg_redirect_class:nn} \Arg{class one} \Arg{class two} % \end{syntax} @@ -422,7 +445,7 @@ % rather than at the point of redirection. % \end{function} % -% \begin{function}{\msg_redirect_module:nnn} +% \begin{function}[updated = 2012-04-12]{\msg_redirect_module:nnn} % \begin{syntax} % \cs{msg_redirect_module:nnn} \Arg{module} \Arg{class one} \Arg{class two} % \end{syntax} @@ -437,9 +460,9 @@ % \end{verbatim} % \end{function} % -% \begin{function}{\msg_redirect_name:nnn} +% \begin{function}[updated = 2012-04-12]{\msg_redirect_name:nnn} % \begin{syntax} -% \cs{msg_redirect_name:nn} \Arg{module} \Arg{message} \Arg{class} +% \cs{msg_redirect_name:nnn} \Arg{module} \Arg{message} \Arg{class} % \end{syntax} % Redirects a specific \meta{message} from a specific \meta{module} % to act as a member of \meta{class} of messages. This function can @@ -538,9 +561,8 @@ % available then a standard text is given instead. Within \meta{text} % and \meta{more text} four parameters (|#1| to |#4|) can be used: % these will be supplied at the time the message is used. The -% parameters will be expanded when the message is used. Within the -% \meta{text} and \meta{more text} |\\| can be used to start a new -% line. An error will be raised if the \meta{message} already exists. +% parameters will be expanded when the message is used. An error will +% be raised if the \meta{message} already exists. % \end{function} % % \begin{function}{\msg_kernel_set:nnnn, \msg_kernel_set:nnn} @@ -553,9 +575,7 @@ % available then a standard text is given instead. Within \meta{text} % and \meta{more text} four parameters (|#1| to |#4|) can be used: % these will be supplied at the time the message is used. The -% parameters will be expanded when the message is used. Within the -% \meta{text} and \meta{more text} |\\| can be used to start a new -% line. +% parameters will be expanded when the message is used. % \end{function} % % \begin{function} @@ -567,8 +587,7 @@ % \msg_kernel_fatal:nn % } % \begin{syntax} -% \cs{msg_kernel_fatal:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} -% ~~\Arg{arg two} \Arg{arg three} \Arg{arg four} +% \cs{msg_kernel_fatal:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} % \end{syntax} % Issues kernel \meta{module} error \meta{message}, passing \meta{arg one} % to \meta{arg four} to the text-creating functions. After issuing a @@ -584,8 +603,7 @@ % \msg_kernel_error:nn % } % \begin{syntax} -% \cs{msg_kernel_error:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} -% ~~\Arg{arg two} \Arg{arg three} \Arg{arg four} +% \cs{msg_kernel_error:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} % \end{syntax} % Issues kernel \meta{module} error \meta{message}, passing \meta{arg one} % to @@ -603,8 +621,7 @@ % \msg_kernel_warning:nn % } % \begin{syntax} -% \cs{msg_kernel_warning:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} -% ~~\Arg{arg two} \Arg{arg three} \Arg{arg four} +% \cs{msg_kernel_warning:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} % \end{syntax} % Issues kernel \meta{module} warning \meta{message}, passing % \meta{arg one} to @@ -622,8 +639,7 @@ % \msg_kernel_info:nn % } % \begin{syntax} -% \cs{msg_kernel_info:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} -% ~~\Arg{arg two} \Arg{arg three} \Arg{arg four} +% \cs{msg_kernel_info:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} % \end{syntax} % Issues kernel \meta{module} information \meta{message}, passing % \meta{arg one} to \meta{arg four} to the text-creating functions. @@ -636,7 +652,9 @@ % expansion only context. This must be handled internally very % differently from normal error messages, as none of the tools % to print to the terminal or the log file are expandable. -% However, the interface is similar. +% However, the interface is similar, with the important caveat that the +% message text and arguments are not expanded, and messages should be +% very short. % % \begin{function}[EXP, added = 2011-11-23] % { @@ -647,8 +665,7 @@ % \msg_expandable_kernel_error:nn % } % \begin{syntax} -% \cs{msg_expandable_kernel_error:nnnnnn} \Arg{module} \Arg{message} -% ~~\Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} +% \cs{msg_expandable_kernel_error:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} % \end{syntax} % Issues an error, passing \meta{arg one} to \meta{arg four} % to the text-creating functions. The resulting string must @@ -677,8 +694,7 @@ % % \begin{function}{\msg_aux_use:nn, \msg_aux_use:nnxxxx} % \begin{syntax} -% \cs{msg_aux_use:nnxxxx} \Arg{module} \Arg{message} -% ~~\Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} +% \cs{msg_aux_use:nnxxxx} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} % \end{syntax} % Prints the \meta{message} from \meta{module} in the terminal, % without formatting. @@ -733,7 +749,7 @@ % the code here. First, a mechanism for creating message text. % This is pretty simple, as there is not actually a lot to do. % -%\begin{variable}{\c_msg_text_prefix_tl, \c_msg_more_text_prefix_tl} +% \begin{variable}{\c_msg_text_prefix_tl, \c_msg_more_text_prefix_tl} % Locations for the text of messages. % \begin{macrocode} \tl_const:Nn \c_msg_text_prefix_tl { msg~text~>~ } @@ -741,6 +757,18 @@ % \end{macrocode} % \end{variable} % +% \begin{macro}[EXP,pTF]{\msg_if_exist:nn} +% Test whether the control sequence containing the message text exists +% or not. +% \begin{macrocode} +\prg_new_conditional:Npnn \msg_if_exist:nn #1#2 { p , T , F , TF } + { + \cs_if_exist:cTF { \c_msg_text_prefix_tl #1 / #2 } + { \prg_return_true: } { \prg_return_false: } + } +% \end{macrocode} +% \end{macro} +% % \begin{macro}[aux]{\chk_if_free_msg:nn} % This auxiliary is similar to \cs{chk_if_free_cs:N}, and is used when % defining messages with \cs{msg_new:nnnn}. It could be inlined in @@ -750,7 +778,7 @@ % \begin{macrocode} \cs_new_protected:Npn \chk_if_free_msg:nn #1#2 { - \cs_if_free:cF { \c_msg_text_prefix_tl #1 / #2 } + \msg_if_exist:nnT {#1} {#2} { \msg_kernel_error:nnxx { msg } { message-already-defined } {#1} {#2} @@ -760,7 +788,7 @@ \tex_ifodd:D \l@expl@log@functions@bool \cs_gset_protected:Npn \chk_if_free_msg:nn #1#2 { - \cs_if_free:cF { \c_msg_text_prefix_tl #1 / #2 } + \msg_if_exist:nnT {#1} {#2} { \msg_kernel_error:nnxx { msg } { message-already-defined } {#1} {#2} @@ -867,12 +895,12 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\msg_line_number:} -% \begin{macro}{\msg_line_context:} -% For writing the line number nicely. +% \begin{macro}{\msg_line_number, \msg_line_context:} +% For writing the line number nicely. \cs{msg_line_context:} was set up +% earlier, so this is not \texttt{new}. % \begin{macrocode} \cs_new_nopar:Npn \msg_line_number: { \int_use:N \tex_inputlineno:D } -\cs_set_nopar:Npn \msg_line_context: +\cs_gset_nopar:Npn \msg_line_context: { \c_msg_on_line_text_tl \c_space_tl @@ -880,116 +908,87 @@ } % \end{macrocode} % \end{macro} -% \end{macro} % % \subsection{Showing messages: low level mechanism} % -% \begin{variable}{\c_msg_hide_tl} -% \begin{variable}{\c_msg_hide_tl<dots>} -% An empty variable with a number of (category code 11) periods at the -% end of its name. This is used to push the \TeX{} part of an error -% message \enquote{off the screen}. Using two variables here means that -% later life is a little easier. -% \begin{macrocode} -\char_set_catcode_letter:N \. -\tl_new:N - \c_msg_hide_tl.......................................................... -\tl_const:Nn \c_msg_hide_tl - { \c_msg_hide_tl.......................................................... } -\char_set_catcode_other:N \. -% \end{macrocode} -% \end{variable} -% \end{variable} -% -% \begin{variable}{\l_msg_text_tl} -% For wrapping message text. -% \begin{macrocode} -\tl_new:N \l_msg_text_tl -% \end{macrocode} -%\end{variable} -% % \begin{macro}{\msg_interrupt:xxx} -% \begin{macro}[aux]{\msg_interrupt_no_details:xx} -% \begin{macro}[aux]{\msg_interrupt_details:xxx} -% \begin{macro}[aux]{\msg_interrupt_text:n} -% \begin{macro}[aux]{\msg_interrupt_more_text:n} -% \begin{macro}[aux]{\msg_interrupt_aux:} -% The low-level interruption macro is rather opaque, unfortunately. The -% idea here is to create a a message which hides all of \TeX{}'s own -% information by filling the output up with dots. To achieve this, -% dots have to be letters. The odd -% \cs{c_msg_hide_tl<dots>} actually does the hiding: it is the -% large run of dots in the name that is important here. The meaning -% of |\\| is altered so that the explanation text is a simple run -% whilst the initial error has line-continuation shown. +% The low-level interruption macro is rather opaque, unfortunately. +% Depending on the availability of more information there is a choice +% of how to set up the further help. We feed the extra help text and +% the message itself to a wrapping auxiliary, in this order because we +% must first setup \TeX{}'s \tn{errhelp} register before issuing an +% \tn{errmessage}. % \begin{macrocode} \cs_new_protected:Npn \msg_interrupt:xxx #1#2#3 { - \group_begin: - \tl_if_empty:nTF {#3} - { \msg_interrupt_no_details:xx {#1} {#2} } - { \msg_interrupt_details:xxx {#1} {#2} {#3} } - \msg_interrupt_aux: - \group_end: + \tl_if_empty:nTF {#3} + { + \msg_interrupt_wrap:xx { \\ \c_msg_no_info_text_tl } + {#1 \\\\ #2 \\\\ \c_msg_continue_text_tl } + } + { + \msg_interrupt_wrap:xx { \\ #3 } + {#1 \\\\ #2 \\\\ \c_msg_help_text_tl } + } } % \end{macrocode} -% Depending on the availability of more information there is a choice of -% how to set up the further help. The extra help text has to be set -% before the message itself can be issued. Everything is done using -% \texttt{x}-type expansion as the new line markers are different for -% the two type of text and need to be correctly set up. +% \end{macro} +% +% \begin{macro}[aux]{\msg_interrupt_wrap:xx} +% \begin{macro}[aux]{\msg_interrupt_more_text:n} +% First setup \TeX{}'s \tn{errhelp} register with the extra help |#1|, +% then build a nice-looking error message with |#2|. Everything is +% done using \texttt{x}-type expansion as the new line markers are +% different for the two type of text and need to be correctly set up. +% The auxiliary \cs{msg_interrupt_more_text:n} recieves its argument +% as a line-wrapped string, which is thus unaffected by expansion. % \begin{macrocode} -\cs_new_protected:Npn \msg_interrupt_no_details:xx #1#2 +\cs_new_protected:Npn \msg_interrupt_wrap:xx #1#2 { - \iow_wrap:xnnnN - { \\ \c_msg_no_info_text_tl } - { |~ } { 2 } { } \msg_interrupt_more_text:n - \iow_wrap:xnnnN { #1 \\ \\ #2 \\ \\ \c_msg_continue_text_tl } - { ! ~ } { 2 } {} \msg_interrupt_text:n - } -\cs_new_protected:Npn \msg_interrupt_details:xxx #1#2#3 - { - \iow_wrap:xnnnN - { \\ #3 } - { |~ } { 2 } { } \msg_interrupt_more_text:n - \iow_wrap:xnnnN { #1 \\ \\ #2 \\ \\ \c_msg_help_text_tl } - { ! ~ } { 2 } { } \msg_interrupt_text:n + \iow_wrap:xnnnN {#1} { | ~ } { 2 } { } \msg_interrupt_more_text:n + \iow_wrap:xnnnN {#2} { ! ~ } { 2 } { } \msg_interrupt_text:n } -\cs_new_protected:Npn \msg_interrupt_text:n #1 - { \tl_set:Nn \l_msg_text_tl {#1} } \cs_new_protected:Npn \msg_interrupt_more_text:n #1 { -%<*initex> - \tl_set:Nx \l_msg_internal_tl -%</initex> -%<*package> - \protected@edef \l_msg_internal_tl -%</package> - { - |''''''''''''''''''''''''''''''''''''''''''''''' - #1 - \msg_newline: - |............................................... - } - \tex_errhelp:D \exp_after:wN { \l_msg_internal_tl } + \exp_args:Nx \tex_errhelp:D + { + |''''''''''''''''''''''''''''''''''''''''''''''' + #1 \iow_newline: + |............................................... + } } % \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}[aux]{\msg_interrupt_text:n} +% \begin{variable}{\c_msg_hide_tl<dots>} % The business end of the process starts by producing some visual -% separation of the message from the main part of the log. It then -% adds the hiding text to the message to print. The error message needs -% to be printed with everything made \enquote{invisible}: this is where -% the strange business with |&| comes in: this is made into another -% |!|. There is also a closing brace that will show up in the output, -% which is turned into a blank space. +% separation of the message from the main part of the log. The error +% message needs to be printed with everything made +% \enquote{invisible}: \TeX{}'s own information involves the macro in +% which \tn{errmessage} is called, and the end of the argument of the +% \tn{errmessage}, including the closing brace. We use an active |!| +% to call the \tn{errmessage} primitive, and end its argument with an +% odd \cs{c_msg_hide_tl<dots>} which fills the output with dots. The +% trailing closing brace is turned into a space to hide it as well. +% The group in which we alter the definition of the active |!| is +% closed before producing the message: this ensures that tokens +% inserted by typing |I| in the command-line will bee inserted after +% the message is entirely cleaned up. % \begin{macrocode} -\group_begin: % { +\group_begin: + \char_set_lccode:nn {`\{} {`\ } \char_set_lccode:nn {`\}} {`\ } \char_set_lccode:nn {`\&} {`\!} \char_set_catcode_active:N \& + \char_set_catcode_letter:N \. + \tl_new:N + \c_msg_hide_tl............................................ \tl_to_lowercase:n { \group_end: - \cs_new_protected:Npn \msg_interrupt_aux: + \cs_new_protected:Npn \msg_interrupt_text:n #1 { \iow_term:x { @@ -998,18 +997,22 @@ \iow_newline: ! } - \tl_put_right:No \l_msg_text_tl { \c_msg_hide_tl } - \cs_set_protected_nopar:Npx & - { \tex_errmessage:D { \exp_not:o { \l_msg_text_tl } } } + \group_begin: + \cs_set_protected_nopar:Npn & + { + \tex_errmessage:D + { + #1 + \c_msg_hide_tl............................................ + } + } + \exp_after:wN + \group_end: & } } % \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} +% \end{variable} % \end{macro} % % \begin{macro}{\msg_log:x} @@ -1034,11 +1037,12 @@ % \end{macrocode} % \end{macro} % \end{macro} +% % \subsection{Displaying messages} % % \LaTeX{} is handling error messages and so the \TeX{} ones are disabled. % \begin{macrocode} -\int_set:Nn \tex_errorcontextlines:D { -1 } +\int_gset:Nn \tex_errorcontextlines:D { -1 } % \end{macrocode} % % \begin{macro} @@ -1068,15 +1072,6 @@ % \end{macrocode} % \end{macro} % -% \begin{variable}{\l_msg_redirect_classes_prop, \l_msg_redirect_names_prop} -% For filtering messages, a list of all messages and of those which have -% to be modified is required. -% \begin{macrocode} -\prop_new:N \l_msg_redirect_classes_prop -\prop_new:N \l_msg_redirect_names_prop -% \end{macrocode} -% \end{variable} -% % \begin{macro}{\msg_class_set:nn} % Setting up a message class does two tasks. Any existing redirection % is cleared, and the various message functions are created @@ -1103,6 +1098,7 @@ % \begin{macro}[aux]{\msg_no_more_text:xxxx} % A test to see if any more text is available, using a % permanently-empty text function. +% ^^A It would be more efficient to not define the more-text when absent. % \begin{macrocode} \prg_new_conditional:Npnn \msg_if_more_text:N #1 { p , T , F , TF } { @@ -1278,102 +1274,117 @@ % \end{macrocode} % \end{macro} % -% \begin{variable} -% { -% \l_msg_redirect_classes_seq , -% \l_msg_class_tl , -% \l_msg_current_class_tl , -% \l_msg_current_module_tl -% } +% \begin{variable}{\l_msg_class_tl, \l_msg_current_class_tl} % Support variables needed for the redirection system. % \begin{macrocode} -\seq_new:N \l_msg_redirect_classes_seq \tl_new:N \l_msg_class_tl \tl_new:N \l_msg_current_class_tl -\tl_new:N \l_msg_current_module_tl % \end{macrocode} -%\end{variable} +% \end{variable} +% +% \begin{variable}{\l_msg_redirect_classes_prop, \l_msg_redirect_names_prop} +% For filtering messages, a list of all messages and of those which have +% to be modified is required. +% \begin{macrocode} +\prop_new:N \l_msg_redirect_classes_prop +\prop_new:N \l_msg_redirect_names_prop +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_msg_redirect_prop} +% For redirection of individually-named messages +% \begin{macrocode} +\prop_new:N \l_msg_redirect_prop +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_msg_use_direct_bool} +% Used to force redirection when a name is given directly. +% \begin{macrocode} +\bool_new:N \l_msg_use_direct_bool +% \end{macrocode} +% \end{variable} % % \begin{macro}[int]{\msg_use:nnnnxxxx} -% \begin{macro}[aux]{\msg_use_aux:nnn} -% \begin{macro}[aux]{\msg_use_aux:nn} -% \begin{macro}[aux]{\msg_use_loop_check:nn} -% \begin{macro}[aux]{\msg_use_code:} -% \begin{macro}[aux]{\msg_use_loop:n, \msg_use_loop:o} -% The main message-using macro creates two auxiliary functions: one -% containing the code for the message, and the second a loop function. -% There is then a hand-off to the system for checking if redirection is -% needed. +% \begin{macro}[aux]{\msg_use_code:, \msg_use_or_change_class:} +% \begin{macro}[aux]{\msg_use_aux_i:nn, \msg_use_aux_ii:nn} +% \begin{macro}[aux]{\msg_use_aux_iii:w} +% \begin{macro}[aux]{\msg_use_aux_iv:w} +% \begin{macro}[aux]{\msg_use_aux_v:} +% Actually using a message is a multi-step process. First, some safety +% checks on the message and class requested. The code and arguments are +% then stored to avoid passing them around. % \begin{macrocode} \cs_new_protected:Npn \msg_use:nnnnxxxx #1#2#3#4#5#6#7#8 { - \cs_set_protected_nopar:Npx \msg_use_code: - { - \seq_clear:N \exp_not:N \l_msg_redirect_classes_seq - \exp_not:n {#2} - } - \cs_set_protected:Npx \msg_use_loop:n ##1 + \msg_if_exist:nnTF {#3} {#4} { - \seq_if_in:NnTF \exp_not:n \l_msg_redirect_classes_seq {#1} - { \msg_kernel_error:nn { msg } { message-loop } {#1} } + \cs_if_exist:cTF { msg_ #1 :nnxxxx } { - \seq_put_right:Nn \exp_not:N \l_msg_redirect_classes_seq {#1} - \exp_not:N \cs_if_exist:cTF { msg_ ##1 :nnxxxx } + \tl_set:Nn \l_msg_current_class_tl {#1} + \cs_set_protected_nopar:Npx \msg_use_code: { \exp_not:n {#2} } + \cs_set_protected_nopar:Npn \msg_use_or_change_class: { - \exp_not:N \use:c { msg_ ##1 :nnxxxx } - \exp_not:n { {#3} {#4} {#5} {#6} {#7} {#8} } + \tl_if_eq:NNTF \l_msg_current_class_tl \l_msg_class_tl + { \msg_use_code: } + { + \use:c { msg_ \l_msg_class_tl :nnxxxx } + {#3} {#4} {#5} {#6} {#7} {#8} + } } + \bool_if:NTF \l_msg_use_direct_bool { - \msg_kernel_error:nnx { msg } { message-class-unknown } {##1} + \bool_set_false:N \l_msg_use_direct_bool + \msg_use_code: } + { \msg_use_aux_i:nn {#3} {#4} } } + { \msg_kernel_error:nnx { msg } { message-class-unknown } {#1} } } - \cs_if_exist:cTF { \c_msg_text_prefix_tl #3 / #4 } - { \msg_use_aux:nnn {#1} {#3} {#4} } { \msg_kernel_error:nnxx { msg } { message-unknown } {#3} {#4} } } +\cs_new_protected_nopar:Npn \msg_use_code: { } +\cs_new_protected_nopar:Npn \msg_use_or_change_class: { } % \end{macrocode} -% The first auxiliary macro looks for a match by name: the most -% restrictive check. +% The first check is for a individual message redirection. If this applies +% then no further redirection is attempted. % \begin{macrocode} -\cs_new_protected:Npn \msg_use_aux:nnn #1#2#3 +\cs_new_protected:Npn \msg_use_aux_i:nn #1#2 { - \tl_set:Nn \l_msg_current_class_tl {#1} - \tl_set:Nn \l_msg_current_module_tl {#2} - \prop_if_in:NnTF \l_msg_redirect_names_prop { // #2 / #3 / } - { \msg_use_loop_check:nn { names } { // #2 / #3 / } } - { \msg_use_aux:nn {#1} {#2} } + \prop_get:NnNTF \l_msg_redirect_prop { #1 / #2 } \l_msg_class_tl + { + \bool_set_true:N \l_msg_use_direct_bool + \msg_use_or_change_class: + } + { \msg_use_aux_ii:nn {#1} {#2} } } % \end{macrocode} -% The second function checks for general matches by module or for -% all modules. +% Next check if there is a redirection by module or by submodule. % \begin{macrocode} -\cs_new_protected:Npn \msg_use_aux:nn #1#2 +\cs_new_protected:Npn \msg_use_aux_ii:nn #1#2 { - \prop_if_in:cnTF { l_msg_redirect_ #1 _prop } {#2} - { \msg_use_loop_check:nn {#1} {#2} } + \prop_get:coNTF { l_msg_redirect_ \l_msg_current_class_tl _ prop } + { \msg_use_aux_iii:w #1 / #2 / \q_stop } \l_msg_class_tl + { \msg_use_or_change_class: } { - \prop_if_in:cnTF { l_msg_redirect_ #1 _prop } { * } - { \msg_use_loop_check:nn {#1} { * } } - { \msg_use_code: } + \prop_get:coNTF { l_msg_redirect_ \l_msg_current_class_tl _ prop } + { \msg_use_aux_iv:w #1 / #2 \q_stop } \l_msg_class_tl + { \msg_use_or_change_class: } + { \msg_use_aux_v: } } } +\cs_new:Npn \msg_use_aux_iii:w #1 / #2 / #3 \q_stop { #1 / #2 } +\cs_new:Npn \msg_use_aux_iv:w #1 / #2 \q_stop { #1 } % \end{macrocode} -% When checking whether to loop, the same code is needed in a few -% places. +% Finally test for redirection of an entire class. % \begin{macrocode} -\cs_new_protected:Npn \msg_use_loop_check:nn #1#2 +\cs_new_protected:Npn \msg_use_aux_v: { - \prop_get:cnN { l_msg_redirect_ #1 _prop } {#2} \l_msg_class_tl - \tl_if_eq:NNTF \l_msg_current_class_tl \l_msg_class_tl - { - { \msg_use_code: } - { \msg_use_loop:o \l_msg_class_tl } - } + \prop_get:cnNF { l_msg_redirect_ \l_msg_current_class_tl _ prop } + { * } \l_msg_class_tl + { \tl_set_eq:NN \l_msg_class_tl \l_msg_current_class_tl } + \msg_use_or_change_class: } -\cs_new_protected_nopar:Npn \msg_use_code: { } -\cs_new_protected:Npn \msg_use_loop:n #1 { } -\cs_generate_variant:Nn \msg_use_loop:n { o } % \end{macrocode} % \end{macro} % \end{macro} @@ -1383,26 +1394,80 @@ % \end{macro} % % \begin{macro}{\msg_redirect_class:nn} +% \begin{macro}[aux]{\msg_redirect_class_aux:nnn, \msg_redirect_class_aux:nVn} % Converts class one into class two. % \begin{macrocode} \cs_new_protected:Npn \msg_redirect_class:nn #1#2 - { \prop_put:cnn { l_msg_redirect_ #1 _prop } { * } {#2} } + { + \cs_if_exist:cTF { msg_ #1 :nnxxxx } + { + \cs_if_exist:cTF { msg_ #2 :nnxxxx } + { + \tl_set:Nn \l_msg_current_class_tl {#1} + \msg_redirect_class_aux:nnn {#1} {#2} {#2} + } + { \msg_kernel_error:nnx { msg } { message-class-unknown } {#2} } + } + { \msg_kernel_error:nnx { msg } { message-class-unknown } {#1} } + } +\cs_new_protected:Npn \msg_redirect_class_aux:nnn #1#2#3 + { + \prop_get:cnNTF { l_msg_redirect_ #2 _prop } { * } \l_msg_class_tl + { + \tl_if_eq:NNTF \l_msg_class_tl \l_msg_current_class_tl + { \msg_kernel_error:nnxx { msg } { message-loop } {#1} {#3} } + { \msg_redirect_class_aux:nVn {#1} \l_msg_class_tl {#3} } + } + { \prop_put:cnn { l_msg_redirect_ #1 _prop } { * } {#3} } + } +\cs_generate_variant:Nn \msg_redirect_class_aux:nnn { nV } % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macro}{\msg_redirect_module:nnn} +% \begin{macro}[aux] +% {\msg_redirect_module_aux:nnnn, \msg_redirect_module_aux:nnVn} % For when all messages of a class should be altered for a given module. % \begin{macrocode} \cs_new_protected:Npn \msg_redirect_module:nnn #1#2#3 - { \prop_put:cnn { l_msg_redirect_ #2 _prop } {#1} {#3} } + { + \cs_if_exist:cTF { msg_ #2 :nnxxxx } + { + \cs_if_exist:cTF { msg_ #3 :nnxxxx } + { + \tl_set:Nn \l_msg_current_class_tl {#1} + \msg_redirect_module_aux:nnnn {#1} {#2} {#3} {#3} + } + { \msg_kernel_error:nnx { msg } { message-class-unknown } {#3} } + } + { \msg_kernel_error:nnx { msg } { message-class-unknown } {#2} } + } +\cs_new_protected:Npn \msg_redirect_module_aux:nnnn #1#2#3#4 + { + \prop_get:cnNTF { l_msg_redirect_ #3 _prop } {#1} \l_msg_class_tl + { + \tl_if_eq:NNTF \l_msg_class_tl \l_msg_current_class_tl + { \msg_kernel_error:nnxx { msg } { message-loop } {#2} {#4} } + { \msg_redirect_moduel_aux:nVn {#1} {#2} \l_msg_class_tl {#4} } + } + { \prop_put:cnn { l_msg_redirect_ #2 _prop } {#1} {#4} } + } +\cs_generate_variant:Nn \msg_redirect_module_aux:nnnn { nnV } % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macro}{\msg_redirect_name:nnn} -% Named message will always use the given class. +% Named message will always use the given class even if that class is +% redirected further. % \begin{macrocode} \cs_new_protected:Npn \msg_redirect_name:nnn #1#2#3 - { \prop_put:Nnn \l_msg_redirect_names_prop { // #1 / #2 / } {#3} } + { + \cs_if_exist:cTF { msg_ #3 :nnxxxx } + { \prop_put:Nnn \l_msg_redirect_prop { #1 / #2 } {#3} } + { \msg_kernel_error:nnx { msg } { message-class-unknown } {#3} } + } % \end{macrocode} % \end{macro} % @@ -1469,7 +1534,7 @@ % \begin{macro}{\msg_kernel_error:nnxx} % \begin{macro}{\msg_kernel_error:nnx} % \begin{macro}{\msg_kernel_error:nn} -% Neither can kernel errors. +% Neither can kernel errors. % \begin{macrocode} \cs_new_protected:Npn \msg_kernel_error:nnxxxx #1#2#3#4#5#6 { @@ -1500,11 +1565,11 @@ } \cs_new_protected:Npn \msg_kernel_error:nnxxx #1#2#3#4#5 {\msg_kernel_error:nnxxxx {#1} {#2} {#3} {#4} {#5} { } } -\cs_set_protected:Npn \msg_kernel_error:nnxx #1#2#3#4 +\cs_gset_protected:Npn \msg_kernel_error:nnxx #1#2#3#4 { \msg_kernel_error:nnxxxx {#1} {#2} {#3} {#4} { } { } } -\cs_set_protected:Npn \msg_kernel_error:nnx #1#2#3 +\cs_gset_protected:Npn \msg_kernel_error:nnx #1#2#3 { \msg_kernel_error:nnxxxx {#1} {#2} {#3} { } { } { } } -\cs_set_protected:Npn \msg_kernel_error:nn #1#2 +\cs_gset_protected:Npn \msg_kernel_error:nn #1#2 { \msg_kernel_error:nnxxxx {#1} {#2} { } { } { } { } } % \end{macrocode} % \end{macro} @@ -1690,6 +1755,8 @@ { Zero~step~size~for~stepwise~function~#1. } \msg_kernel_new:nnn { prg } { replicate-neg } { Negative~argument~for~\prg_replicate:nn. } +\msg_kernel_new:nnn { kernel } { unknown-comparison } + { Relation~symbol~'#1'~unknown:~use~=,~<,~>,~==,~!=,~<=,~>=. } % \end{macrocode} % % Messages used by the \enquote{\texttt{show}} functions. diff --git a/Master/texmf-dist/source/latex/l3kernel/l3names.dtx b/Master/texmf-dist/source/latex/l3kernel/l3names.dtx index dc6ff4ba9b6..13d403f4633 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3names.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3names.dtx @@ -35,7 +35,7 @@ % %<*package> \RequirePackage{l3bootstrap}[2011-12-29] -\GetIdInfo$Id: l3names.dtx 3113 2011-12-30 09:05:11Z joseph $ +\GetIdInfo$Id: l3names.dtx 3494 2012-03-04 09:58:29Z joseph $ {L3 Experimental namespace for primitives} %</package> %<*driver> @@ -545,7 +545,7 @@ \name_primitive:NN \savingvdiscards \etex_savingvdiscards:D \name_primitive:NN \pagediscards \etex_pagediscards:D \name_primitive:NN \splitdiscards \etex_splitdiscards:D - \name_primitive:NN \TeXXETstate \etex_TeXXETstate:D + \name_primitive:NN \TeXXeTstate \etex_TeXXeTstate:D \name_primitive:NN \beginL \etex_beginL:D \name_primitive:NN \endL \etex_endL:D \name_primitive:NN \beginR \etex_beginR:D diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx index 9b3ad6dae1c..88f53e59759 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3prg.dtx 3464 2012-02-26 15:30:29Z bruno $ +\GetIdInfo$Id: l3prg.dtx 3490 2012-03-04 01:00:53Z bruno $ {L3 Experimental control structures} %</driver|package> %<*driver> @@ -224,9 +224,9 @@ % logical operations And, Or, Not, \emph{etc.}\ which can then be used on % both the boolean type and predicate functions. % -% All conditional |\bool_| functions are expandable and expect the -% input to also be fully expandable (which will generally mean being -% constructed from predicate functions, possibly nested). +% All conditional |\bool_| functions except assignments are expandable +% and expect the input to also be fully expandable (which will generally +% mean being constructed from predicate functions, possibly nested). % % \begin{function}{\bool_new:N, \bool_new:c} % \begin{syntax} @@ -304,6 +304,16 @@ % terminal. % \end{function} % +% \begin{function}[EXP, pTF, added=2012-03-03] +% {\bool_if_exist:N, \bool_if_exist:c} +% \begin{syntax} +% \cs{bool_if_exist_p:N} \meta{boolean} +% \cs{bool_if_exist:NTF} \meta{boolean} \Arg{true code} \Arg{false code} +% \end{syntax} +% Tests whether the \meta{boolean} is currently defined. This does not +% check that the \meta{boolean} really is a boolean variable. +% \end{function} +% % \begin{variable}{\l_tmpa_bool} % A scratch boolean for local assignment. It is never used by % the kernel code, and so is safe for use with any \LaTeX3-defined @@ -903,7 +913,7 @@ % \begin{macrocode} \cs_new_protected:Npn \bool_show:N #1 { - \cs_if_exist:NTF #1 + \bool_if_exist:NTF #1 { \bool_show:n {#1} } { \msg_kernel_error:nnx { kernel } { variable-not-defined } @@ -928,6 +938,20 @@ % \end{macrocode} % \end{variable} % +% \begin{macro}[pTF]{\bool_if_exist:N, \bool_if_exist:c} +% Copies of the \texttt{cs} functions defined in \pkg{l3basics}. +% \begin{macrocode} +\cs_new_eq:NN \bool_if_exist:NTF \cs_if_exist:NTF +\cs_new_eq:NN \bool_if_exist:NT \cs_if_exist:NT +\cs_new_eq:NN \bool_if_exist:NF \cs_if_exist:NF +\cs_new_eq:NN \bool_if_exist_p:N \cs_if_exist_p:N +\cs_new_eq:NN \bool_if_exist:cTF \cs_if_exist:cTF +\cs_new_eq:NN \bool_if_exist:cT \cs_if_exist:cT +\cs_new_eq:NN \bool_if_exist:cF \cs_if_exist:cF +\cs_new_eq:NN \bool_if_exist_p:c \cs_if_exist_p:c +% \end{macrocode} +% \end{macro} +% % \subsection{Boolean expressions} % % \begin{macro}[pTF]{\bool_if:n} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx index 177d467a0b7..b90ff41e63a 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3prop.dtx 3460 2012-02-26 12:16:41Z will $ +\GetIdInfo$Id: l3prop.dtx 3490 2012-03-04 01:00:53Z bruno $ {L3 Experimental property lists} %</driver|package> %<*driver> @@ -235,6 +235,16 @@ % % \section{Property list conditionals} % +% \begin{function}[EXP, pTF, added=2012-03-03] +% {\prop_if_exist:N, \prop_if_exist:c} +% \begin{syntax} +% \cs{prop_if_exist_p:N} \meta{property list} +% \cs{prop_if_exist:NTF} \meta{property list} \Arg{true code} \Arg{false code} +% \end{syntax} +% Tests whether the \meta{property list} is currently defined. This does not +% check that the \meta{property list} really is a property list variable. +% \end{function} +% % \begin{function}[EXP,pTF]{\prop_if_empty:N, \prop_if_empty:c} % \begin{syntax} % \cs{prop_if_empty_p:N} \meta{property list} @@ -402,9 +412,17 @@ % \begin{syntax} % \cs{prop_map_tokens:Nn} \meta{property list} \Arg{code} % \end{syntax} -% Analogue of \cs{prop_map_function:NN} which maps several tokens instead -% of a single function. Useful in particular when mapping through a -% property list while keeping track of a given key. +% Analogue of \cs{prop_map_function:NN} which maps several tokens +% instead of a single function. The \meta{code} receives each +% key--value pair in the \meta{property list} as two trailing brace +% groups. For instance, +% \begin{verbatim} +% \prop_map_tokens:Nn \l_my_prop { \str_if_eq:nnT { mykey } } +% \end{verbatim} +% will expand to the value corresponding to \texttt{mykey}: for each +% pair in \cs{l_my_prop} the function \cs{str_if_eq:nnT} receives +% \texttt{mykey}, the \meta{key} and the \meta{value} as its three +% arguments. For that specific task, \cs{prop_get:Nn} is faster. % \end{function} % % \begin{function}[updated = 2012-01-08,EXP]{\prop_get:Nn, \prop_get:cn} @@ -546,10 +564,10 @@ % Once again a simple copy from the token list functions. % \begin{macrocode} \cs_new_protected:Npn \prop_clear_new:N #1 - { \cs_if_exist:NTF #1 { \prop_clear:N #1 } { \prop_new:N #1 } } + { \prop_if_exist:NTF #1 { \prop_clear:N #1 } { \prop_new:N #1 } } \cs_generate_variant:Nn \prop_clear_new:N { c } \cs_new_protected:Npn \prop_gclear_new:N #1 - { \cs_if_exist:NTF #1 { \prop_gclear:N #1 } { \prop_new:N #1 } } + { \prop_if_exist:NTF #1 { \prop_gclear:N #1 } { \prop_new:N #1 } } \cs_generate_variant:Nn \prop_gclear_new:N { c } % \end{macrocode} % \end{macro} @@ -799,6 +817,20 @@ % % \subsection{Property list conditionals} % +% \begin{macro}[pTF]{\prop_if_exist:N, \prop_if_exist:c} +% Copies of the \texttt{cs} functions defined in \pkg{l3basics}. +% \begin{macrocode} +\cs_new_eq:NN \prop_if_exist:NTF \cs_if_exist:NTF +\cs_new_eq:NN \prop_if_exist:NT \cs_if_exist:NT +\cs_new_eq:NN \prop_if_exist:NF \cs_if_exist:NF +\cs_new_eq:NN \prop_if_exist_p:N \cs_if_exist_p:N +\cs_new_eq:NN \prop_if_exist:cTF \cs_if_exist:cTF +\cs_new_eq:NN \prop_if_exist:cT \cs_if_exist:cT +\cs_new_eq:NN \prop_if_exist:cF \cs_if_exist:cF +\cs_new_eq:NN \prop_if_exist_p:c \cs_if_exist_p:c +% \end{macrocode} +% \end{macro} +% % \begin{macro}[pTF]{\prop_if_empty:N, \prop_if_empty:c} % The test here uses \cs{c_empty_prop} as it is not really empty! % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx index 6d1e8c71991..d8dd80c75ed 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3seq.dtx 3158 2012-01-09 00:47:42Z bruno $ +\GetIdInfo$Id: l3seq.dtx 3490 2012-03-04 01:00:53Z bruno $ {L3 Experimental sequences and stacks} %</driver|package> %<*driver> @@ -144,6 +144,16 @@ % \meta{sequence2} will be placed at the left side of the new sequence. % \end{function} % +% \begin{function}[EXP, pTF, added=2012-03-03] +% {\seq_if_exist:N, \seq_if_exist:c} +% \begin{syntax} +% \cs{seq_if_exist_p:N} \meta{sequence} +% \cs{seq_if_exist:NTF} \meta{sequence} \Arg{true code} \Arg{false code} +% \end{syntax} +% Tests whether the \meta{sequence} is currently defined. This does not +% check that the \meta{sequence} really is a sequence variable. +% \end{function} +% % \section{Appending data to sequences} % % \begin{function}{ @@ -922,6 +932,20 @@ % \end{macro} % \end{macro} % +% \begin{macro}[pTF]{\seq_if_exist:N, \seq_if_exist:c} +% Copies of the \texttt{cs} functions defined in \pkg{l3basics}. +% \begin{macrocode} +\cs_new_eq:NN \seq_if_exist:NTF \cs_if_exist:NTF +\cs_new_eq:NN \seq_if_exist:NT \cs_if_exist:NT +\cs_new_eq:NN \seq_if_exist:NF \cs_if_exist:NF +\cs_new_eq:NN \seq_if_exist_p:N \cs_if_exist_p:N +\cs_new_eq:NN \seq_if_exist:cTF \cs_if_exist:cTF +\cs_new_eq:NN \seq_if_exist:cT \cs_if_exist:cT +\cs_new_eq:NN \seq_if_exist:cF \cs_if_exist:cF +\cs_new_eq:NN \seq_if_exist_p:c \cs_if_exist_p:c +% \end{macrocode} +% \end{macro} +% % \subsection{Appending data to either end} % % \begin{macro}{ diff --git a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx index 1110130bc13..9bb1fa1eadc 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx @@ -36,7 +36,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3skip.dtx 3460 2012-02-26 12:16:41Z will $ +\GetIdInfo$Id: l3skip.dtx 3499 2012-03-05 16:08:55Z bruno $ {L3 Experimental dimensions and skips} %</driver|package> %<*driver> @@ -89,6 +89,15 @@ % will initially be equal to $0$\,pt. % \end{function} % +% \begin{function}[added = 2012-03-05]{\dim_const:Nn, \dim_const:cn} +% \begin{syntax} +% \cs{dim_const:Nn} \meta{dimension} \Arg{dimension expression} +% \end{syntax} +% Creates a new constant \meta{dimension} or raises an error if the +% name is already taken. The value of the \meta{dimension} will be set +% globally to the \meta{dimension expression}. +% \end{function} +% % \begin{function}{\dim_zero:N, \dim_zero:c, \dim_gzero:N, \dim_gzero:c} % \begin{syntax} % \cs{dim_zero:N} \meta{dimension} @@ -106,6 +115,15 @@ % the \meta{dimension} set to zero. % \end{function} % +% \begin{function}[EXP, pTF, added=2012-03-03]{\dim_if_exist:N, \dim_if_exist:c} +% \begin{syntax} +% \cs{dim_if_exist_p:N} \meta{dimension} +% \cs{dim_if_exist:NTF} \meta{dimension} \Arg{true code} \Arg{false code} +% \end{syntax} +% Tests whether the \meta{dimension} is currently defined. This does +% not check that the \meta{dimension} really is a dimension variable. +% \end{function} +% % \section{Setting \texttt{dim} variables} % % \begin{function}[updated = 2011-10-22] @@ -426,6 +444,15 @@ % will initially be equal to $0$\,pt. % \end{function} % +% \begin{function}[added = 2012-03-05]{\skip_const:Nn, \skip_const:cn} +% \begin{syntax} +% \cs{skip_const:Nn} \meta{skip} \Arg{skip expression} +% \end{syntax} +% Creates a new constant \meta{skip} or raises an error if the +% name is already taken. The value of the \meta{skip} will be set +% globally to the \meta{skip expression}. +% \end{function} +% % \begin{function}{\skip_zero:N, \skip_zero:c, \skip_gzero:N, \skip_gzero:c} % \begin{syntax} % \cs{skip_zero:N} \meta{skip} @@ -443,6 +470,16 @@ % the \meta{skip} set to zero. % \end{function} % +% \begin{function}[EXP, pTF, added=2012-03-03] +% {\skip_if_exist:N, \skip_if_exist:c} +% \begin{syntax} +% \cs{skip_if_exist_p:N} \meta{skip} +% \cs{skip_if_exist:NTF} \meta{skip} \Arg{true code} \Arg{false code} +% \end{syntax} +% Tests whether the \meta{skip} is currently defined. This does not +% check that the \meta{skip} really is a skip variable. +% \end{function} +% % \section{Setting \texttt{skip} variables} % % \begin{function}[updated = 2011-10-22] @@ -486,21 +523,21 @@ % % \section{Skip expression conditionals} % -% \begin{function}[EXP,pTF]{\skip_if_eq:nn} -% \begin{syntax} -% \cs{skip_if_eq_p:nn} \Arg{skipexpr_1} \Arg{skipexpr_2} -% \cs{dim_compare:nTF} -% ~~\Arg{skip expr1} \Arg{skip expr2} -% ~~\Arg{true code} \Arg{false code} -% \end{syntax} -% This function first evaluates each of the -% \meta{skip expressions} as described for \cs{skip_eval:n}. -% The two results are then compared for exact equality, -% \emph{i.e.}~both the fixed and rubber components must be the same -% for the test to be true. -% \end{function} -% -% \begin{function}[EXP,pTF]{\skip_if_infinite_glue:n} +% \begin{function}[EXP,pTF]{\skip_if_eq:nn} +% \begin{syntax} +% \cs{skip_if_eq_p:nn} \Arg{skipexpr_1} \Arg{skipexpr_2} +% \cs{dim_compare:nTF} +% ~~\Arg{skip expr1} \Arg{skip expr2} +% ~~\Arg{true code} \Arg{false code} +% \end{syntax} +% This function first evaluates each of the +% \meta{skip expressions} as described for \cs{skip_eval:n}. +% The two results are then compared for exact equality, +% \emph{i.e.}~both the fixed and rubber components must be the same +% for the test to be true. +% \end{function} +% +% \begin{function}[EXP, pTF, updated = 2012-03-05]{\skip_if_infinite_glue:n} % \begin{syntax} % \cs{skip_if_infinite_glue_p:n} \Arg{skipexpr} % \cs{skip_if_infinite_glue:nTF} \Arg{skipexpr} \Arg{true code} \Arg{false code} @@ -510,6 +547,15 @@ % component (or both). % \end{function} % +% \begin{function}[EXP, pTF, added = 2012-03-05]{\skip_if_finite:n} +% \begin{syntax} +% \cs{skip_if_finite_p:n} \Arg{skipexpr} +% \cs{skip_if_finite:nTF} \Arg{skipexpr} \Arg{true code} \Arg{false code} +% \end{syntax} +% Evaluates the \meta{skip expression} as described for \cs{skip_eval:n}, +% and then tests if all of its components are finite. +% \end{function} +% % \section{Using \texttt{skip} expressions and variables} % % \begin{function}[updated = 2011-10-22, EXP]{\skip_eval:n} @@ -596,6 +642,15 @@ % will initially be equal to $0$\,mu. % \end{function} % +% \begin{function}[added = 2012-03-05]{\muskip_const:Nn, \muskip_const:cn} +% \begin{syntax} +% \cs{muskip_const:Nn} \meta{muskip} \Arg{muskip expression} +% \end{syntax} +% Creates a new constant \meta{muskip} or raises an error if the +% name is already taken. The value of the \meta{muskip} will be set +% globally to the \meta{muskip expression}. +% \end{function} +% % \begin{function} % {\muskip_zero:N, \muskip_zero:c, \muskip_gzero:N, \muskip_gzero:c} % \begin{syntax} @@ -617,6 +672,16 @@ % to leave the \meta{muskip} set to zero. % \end{function} % +% \begin{function}[EXP, pTF, added=2012-03-03] +% {\muskip_if_exist:N, \muskip_if_exist:c} +% \begin{syntax} +% \cs{muskip_if_exist_p:N} \meta{muskip} +% \cs{muskip_if_exist:NTF} \meta{muskip} \Arg{true code} \Arg{false code} +% \end{syntax} +% Tests whether the \meta{muskip} is currently defined. This does not +% check that the \meta{muskip} really is a muskip variable. +% \end{function} +% % \section{Setting \texttt{muskip} variables} % % \begin{function}[updated = 2011-10-22] @@ -857,6 +922,19 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\dim_const:Nn, \dim_const:cn} +% Contrarily to integer constants, we cannot avoid using a register, +% even for constants. +% \begin{macrocode} +\cs_new_protected:Npn \dim_const:Nn #1 + { + \dim_new:N #1 + \dim_gset:Nn #1 + } +\cs_generate_variant:Nn \dim_const:Nn { c } +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\dim_zero:N, \dim_zero:c} % \begin{macro}{\dim_gzero:N, \dim_gzero:c} % Reset the register to zero. @@ -874,14 +952,28 @@ % Create a register if needed, otherwise clear it. % \begin{macrocode} \cs_new_protected:Npn \dim_zero_new:N #1 - { \cs_if_exist:NTF #1 { \dim_zero:N #1 } { \dim_new:N #1 } } + { \dim_if_exist:NTF #1 { \dim_zero:N #1 } { \dim_new:N #1 } } \cs_new_protected:Npn \dim_gzero_new:N #1 - { \cs_if_exist:NTF #1 { \dim_gzero:N #1 } { \dim_new:N #1 } } + { \dim_if_exist:NTF #1 { \dim_gzero:N #1 } { \dim_new:N #1 } } \cs_generate_variant:Nn \dim_zero_new:N { c } \cs_generate_variant:Nn \dim_gzero_new:N { c } % \end{macrocode} % \end{macro} % +% \begin{macro}[pTF]{\dim_if_exist:N, \dim_if_exist:c} +% Copies of the \texttt{cs} functions defined in \pkg{l3basics}. +% \begin{macrocode} +\cs_new_eq:NN \dim_if_exist:NTF \cs_if_exist:NTF +\cs_new_eq:NN \dim_if_exist:NT \cs_if_exist:NT +\cs_new_eq:NN \dim_if_exist:NF \cs_if_exist:NF +\cs_new_eq:NN \dim_if_exist_p:N \cs_if_exist_p:N +\cs_new_eq:NN \dim_if_exist:cTF \cs_if_exist:cTF +\cs_new_eq:NN \dim_if_exist:cT \cs_if_exist:cT +\cs_new_eq:NN \dim_if_exist:cF \cs_if_exist:cF +\cs_new_eq:NN \dim_if_exist_p:c \cs_if_exist_p:c +% \end{macrocode} +% \end{macro} +% % \subsection{Setting \texttt{dim} variables} % % \begin{macro}{\dim_set:Nn, \dim_set:cn} @@ -1002,6 +1094,7 @@ % % \begin{macro}{\dim_compare_p:nNn} % \begin{macro}[TF]{\dim_compare:nNn} +% Simple comparison. % \begin{macrocode} \prg_new_conditional:Npnn \dim_compare:nNn #1#2#3 { p , T , F , TF } { @@ -1012,116 +1105,63 @@ % \end{macro} % \end{macro} % -% \begin{macro}[pTF]{\dim_compare:n} -% \begin{macro}[aux]{\dim_compare_aux:wNN} -% \begin{macro}[aux]{\dim_compare_<:nw} -% \begin{macro}[aux]{\dim_compare_=:nw} -% \begin{macro}[aux]{\dim_compare_>:nw} -% \begin{macro}[aux]{\dim_compare_==:nw} -% \begin{macro}[aux]{\dim_compare_<=:nw} -% \begin{macro}[aux]{\dim_compare_!=:nw} -% \begin{macro}[aux]{\dim_compare_>=:nw} -% [This code plus comments are adapted from the \cs{int_compare:nTF} -% function.] -% Comparison tests using a simple syntax where only one set of braces -% is required and additional operators such as |!=| and |>=| are -% supported. First some notes on the idea behind this. We wish to -% support writing code like -% \begin{verbatim} -% \dim_compare_p:n { 5mm + \l_tmpa_dim >= 4pt - \l_tmpb_dim } -% \end{verbatim} -% In other words, we want to somehow add the missing |\dim_eval:w| -% where required. We can start evaluating from the left using -% |\dim_use:N \dim_eval:w|, and we know that since the relation -% symbols |<|, |>|, |=| and |!| are not allowed in such expressions, -% they will terminate the expression. Therefore, we first let \TeX{} -% evaluate this left hand side of the (in)equality. -% -% Eventually, we will convert the relation symbol to the appropriate -% version of \cs{if_dim:w}, and add \cs{dim_eval:w} after it. We -% optimize by placing the end-code already here: this avoids needless -% grabbing of arguments later. +% \begin{macro}[pTF, EXP]{\dim_compare:n} +% \begin{macro}[aux, EXP]{\dim_compare_aux:w, \dim_compare_aux:NNw} +% \begin{macro}[aux, EXP] +% { +% \dim_compare_=:NNw, +% \dim_compare_<:NNw, +% \dim_compare_>:NNw, +% \dim_compare_==:NNw, +% \dim_compare_!=:NNw, +% \dim_compare_<=:NNw, +% \dim_compare_>=:NNw +% } +% This code is adapted from the \cs{int_compare:nTF} function. First +% evaluate the left-hand side. Then access the relation symbol by +% grabbing until \texttt{pt} (with category other), and pursue +% otherwise just as for \cs{int_compare:nTF}. % \begin{macrocode} \prg_new_conditional:Npnn \dim_compare:n #1 { p , T , F , TF } { - \exp_after:wN \dim_compare_aux:wNN \dim_use:N \dim_eval:w #1 - \dim_eval_end: + \exp_after:wN \dim_compare_aux:w \dim_use:N \dim_eval:w #1 + \kernel_compare_error: \dim_eval_end: \prg_return_true: \else: \prg_return_false: \fi: } -% \end{macrocode} -% -% Contrarily to the case of integers, where we have to remove the -% result in order to access the relation, \cs{dim_use:N} nicely -% produces a result which ends in |pt|. We can thus use a delimited -% argument to find the relation. \cs{tl_to_str:n} is needed to -% convert |pt| to \enquote{other} characters. -% -% The relation might be one character, |#2|, or two characters |#2#3|. -% We support the following forms: |=|, |<|, |>| and the extended |!=|, -% |==|, |<=| and |>=|. All the extended forms have an extra |=| so we -% check if that is present as well. Then use specific function to -% perform the (unbalanced) test. -% \begin{macrocode} \exp_args:Nno \use:nn - { \cs_new:Npn \dim_compare_aux:wNN #1 } + { \cs_new:Npn \dim_compare_aux:w #1 } { \tl_to_str:n { pt } } - #2 #3 - { - \use:c - { - dim_compare_ #2 - \if_meaning:w = #3 = \fi: - :nw - } - { #1 pt } #3 - } -% \end{macrocode} -% Here, \cs{dim_eval:w} will begin the right hand side of a dimension -% comparison (with \cs{if_dim:w}), closed cleanly by the trailing tokens -% we put in the definition of \cs{dim_compare:n}. -% -% The actual comparisons take as a first argument the left-hand side -% of the comparison (a length). In the case of normal comparisons, -% just place the relevant \cs{if_dim:w}, with a trailing \cs{dim_eval:w} -% to evaluate the right hand side. For extended comparisons, remove -% the trailing |=| that we left, before evaluating with \cs{dim_eval:w}. -% In both cases, the expansion of \cs{dim_eval:w} is stopped properly, -% and the conditional ended correctly by the tokens we put in the -% definition of \cs{dim_compare:n}. -% -% Equal, less than and greater than are straighforward. -% \begin{macrocode} -\cs_new:cpn { dim_compare_<:nw } #1 { \if_dim:w #1 < \dim_eval:w } -\cs_new:cpn { dim_compare_=:nw } #1 { \if_dim:w #1 = \dim_eval:w } -\cs_new:cpn { dim_compare_>:nw } #1 { \if_dim:w #1 > \dim_eval:w } -% \end{macrocode} -% For the extended syntax |==|, we remove |#2|, trailing |=| sign, -% and otherwise act as for |=|. -% \begin{macrocode} -\cs_new:cpn {dim_compare_==:nw} #1#2 { \if_dim:w #1 = \dim_eval:w } -% \end{macrocode} -% -% Not equal, greater than or equal, less than or equal follow the -% same scheme as the extended equality syntax, with an additional -% \cs{reverse_if:N} to get the opposite of their \enquote{simple} -% analog. -% \begin{macrocode} -\cs_new:cpn {dim_compare_<=:nw} #1#2 {\reverse_if:N \if_dim:w #1 > \dim_eval:w} -\cs_new:cpn {dim_compare_!=:nw} #1#2 {\reverse_if:N \if_dim:w #1 = \dim_eval:w} -\cs_new:cpn {dim_compare_>=:nw} #1#2 {\reverse_if:N \if_dim:w #1 < \dim_eval:w} + #2 \kernel_compare_error: + { + \exp_after:wN \dim_compare_aux:NNw #2 ?? \q_mark + #1 pt #2 + } +\cs_new:Npn \dim_compare_aux:NNw #1#2#3 \q_mark + { + \use:c { dim_compare_ #1 \if_meaning:w = #2 = \fi: :NNw } + \kernel_compare_error:Nw #1 + } +\cs_new:cpn { dim_compare_=:NNw } #1#2#3 = + { \if_dim:w #3 = \dim_eval:w } +\cs_new:cpn { dim_compare_<:NNw } #1#2#3 < + { \if_dim:w #3 < \dim_eval:w } +\cs_new:cpn { dim_compare_>:NNw } #1#2#3 > + { \if_dim:w #3 > \dim_eval:w } +\cs_new:cpn { dim_compare_==:NNw } #1#2#3 == + { \if_dim:w #3 = \dim_eval:w } +\cs_new:cpn { dim_compare_!=:NNw } #1#2#3 != + { \reverse_if:N \if_dim:w #3 = \dim_eval:w } +\cs_new:cpn { dim_compare_<=:NNw } #1#2#3 <= + { \reverse_if:N \if_dim:w #3 > \dim_eval:w } +\cs_new:cpn { dim_compare_>=:NNw } #1#2#3 >= + { \reverse_if:N \if_dim:w #3 < \dim_eval:w } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % % \subsection{Dimension expression loops} % @@ -1328,6 +1368,19 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\skip_const:Nn, \skip_const:cn} +% Contrarily to integer constants, we cannot avoid using a register, +% even for constants. +% \begin{macrocode} +\cs_new_protected:Npn \skip_const:Nn #1 + { + \skip_new:N #1 + \skip_gset:Nn #1 + } +\cs_generate_variant:Nn \skip_const:Nn { c } +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\skip_zero:N, \skip_zero:c} % \begin{macro}{\skip_gzero:N, \skip_gzero:c} % Reset the register to zero. @@ -1345,14 +1398,28 @@ % Create a register if needed, otherwise clear it. % \begin{macrocode} \cs_new_protected:Npn \skip_zero_new:N #1 - { \cs_if_exist:NTF #1 { \skip_zero:N #1 } { \skip_new:N #1 } } + { \skip_if_exist:NTF #1 { \skip_zero:N #1 } { \skip_new:N #1 } } \cs_new_protected:Npn \skip_gzero_new:N #1 - { \cs_if_exist:NTF #1 { \skip_gzero:N #1 } { \skip_new:N #1 } } + { \skip_if_exist:NTF #1 { \skip_gzero:N #1 } { \skip_new:N #1 } } \cs_generate_variant:Nn \skip_zero_new:N { c } \cs_generate_variant:Nn \skip_gzero_new:N { c } % \end{macrocode} % \end{macro} % +% \begin{macro}[pTF]{\skip_if_exist:N, \skip_if_exist:c} +% Copies of the \texttt{cs} functions defined in \pkg{l3basics}. +% \begin{macrocode} +\cs_new_eq:NN \skip_if_exist:NTF \cs_if_exist:NTF +\cs_new_eq:NN \skip_if_exist:NT \cs_if_exist:NT +\cs_new_eq:NN \skip_if_exist:NF \cs_if_exist:NF +\cs_new_eq:NN \skip_if_exist_p:N \cs_if_exist_p:N +\cs_new_eq:NN \skip_if_exist:cTF \cs_if_exist:cTF +\cs_new_eq:NN \skip_if_exist:cT \cs_if_exist:cT +\cs_new_eq:NN \skip_if_exist:cF \cs_if_exist:cF +\cs_new_eq:NN \skip_if_exist_p:c \cs_if_exist_p:c +% \end{macrocode} +% \end{macro} +% % \subsection{Setting \texttt{skip} variables} % % \begin{macro}{\skip_set:Nn, \skip_set:cn} @@ -1425,27 +1492,38 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[pTF]{\skip_if_infinite_glue:n} -% With \eTeX{} we all of a sudden get access to a lot information we -% should otherwise consider ourselves lucky to get. One is -% the stretch and shrink components of a skip register and the order -% or those components. cs{skip_if_infinite_glue:nTF} tests it directly by -% looking at the stretch and shrink order. If either of the predicate -% functions return \meta{true}, |\bool_if:nTF| will return \meta{true} -% and the logic test will take the true branch. +% \begin{macro}[EXP,pTF]{\skip_if_finite:n} +% \begin{macro}[EXP,aux]{\skip_if_finite_aux:wwNw} +% With \eTeX{}, we have an easy access to the order of infinities of +% the stretch and shrink components of a skip. However, to access +% both, we either need to evaluate the expression twice, or evaluate +% it, then call an auxiliary to extract both pieces of information +% from the result. Since we are going to need an auxiliary anyways, +% it is quicker to make it search for the string \texttt{fil} which +% characterizes infinite glue. % \begin{macrocode} -\prg_new_conditional:Npnn \skip_if_infinite_glue:n #1 { p , T , F , TF } +\cs_set_protected:Npn \cs_tmp:w #1 { - \bool_if:nTF + \prg_new_conditional:Npnn \skip_if_finite:n ##1 { p , T , F , TF } { - \int_compare_p:nNn { \etex_gluestretchorder:D #1 } > \c_zero || - \int_compare_p:nNn { \etex_glueshrinkorder:D #1 } > \c_zero + \exp_after:wN \skip_if_finite_aux:wwNw + \skip_use:N \etex_glueexpr:D ##1 ; \prg_return_false: + #1 ; \prg_return_true: \q_stop } - { \prg_return_true: } - { \prg_return_false: } - } + \cs_new:Npn \skip_if_finite_aux:wwNw ##1 #1 ##2 ; ##3 ##4 \q_stop {##3} + } +\exp_args:No \cs_tmp:w { \tl_to_str:n { fil } } % \end{macrocode} -% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}[EXP, pTF]{\skip_if_infinite_glue:n} +% Reverse of \cs{skip_if_finite:nTF}. +% \begin{macrocode} +\prg_new_conditional:Npnn \skip_if_infinite_glue:n #1 { p , T , F , TF } + { \skip_if_finite:nTF {#1} \prg_return_false: \prg_return_true: } +% \end{macrocode} +% \end{macro} % % \subsection{Using \texttt{skip} expressions and variables} % @@ -1545,6 +1623,19 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\muskip_const:Nn, \muskip_const:cn} +% Contrarily to integer constants, we cannot avoid using a register, +% even for constants. +% \begin{macrocode} +\cs_new_protected:Npn \muskip_const:Nn #1 + { + \muskip_new:N #1 + \muskip_gset:Nn #1 + } +\cs_generate_variant:Nn \muskip_const:Nn { c } +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\muskip_zero:N, \muskip_zero:c} % \begin{macro}{\muskip_gzero:N, \muskip_gzero:c} % Reset the register to zero. @@ -1566,14 +1657,28 @@ % Create a register if needed, otherwise clear it. % \begin{macrocode} \cs_new_protected:Npn \muskip_zero_new:N #1 - { \cs_if_exist:NTF #1 { \muskip_zero:N #1 } { \muskip_new:N #1 } } + { \muskip_if_exist:NTF #1 { \muskip_zero:N #1 } { \muskip_new:N #1 } } \cs_new_protected:Npn \muskip_gzero_new:N #1 - { \cs_if_exist:NTF #1 { \muskip_gzero:N #1 } { \muskip_new:N #1 } } + { \muskip_if_exist:NTF #1 { \muskip_gzero:N #1 } { \muskip_new:N #1 } } \cs_generate_variant:Nn \muskip_zero_new:N { c } \cs_generate_variant:Nn \muskip_gzero_new:N { c } % \end{macrocode} % \end{macro} % +% \begin{macro}[pTF]{\muskip_if_exist:N, \muskip_if_exist:c} +% Copies of the \texttt{cs} functions defined in \pkg{l3basics}. +% \begin{macrocode} +\cs_new_eq:NN \muskip_if_exist:NTF \cs_if_exist:NTF +\cs_new_eq:NN \muskip_if_exist:NT \cs_if_exist:NT +\cs_new_eq:NN \muskip_if_exist:NF \cs_if_exist:NF +\cs_new_eq:NN \muskip_if_exist_p:N \cs_if_exist_p:N +\cs_new_eq:NN \muskip_if_exist:cTF \cs_if_exist:cTF +\cs_new_eq:NN \muskip_if_exist:cT \cs_if_exist:cT +\cs_new_eq:NN \muskip_if_exist:cF \cs_if_exist:cF +\cs_new_eq:NN \muskip_if_exist_p:c \cs_if_exist_p:c +% \end{macrocode} +% \end{macro} +% % \subsection{Setting \texttt{muskip} variables} % % \begin{macro}{\muskip_set:Nn, \muskip_set:cn} @@ -1681,16 +1786,16 @@ % \begin{macrocode} \cs_new:Npn \skip_split_finite_else_action:nnNN #1#2#3#4 { - \skip_if_infinite_glue:nTF {#1} - { - #3 = \c_zero_skip - #4 = \c_zero_skip - #2 - } - { - #3 = \etex_gluestretch:D #1 \scan_stop: - #4 = \etex_glueshrink:D #1 \scan_stop: - } + \skip_if_finite:nTF {#1} + { + #3 = \etex_gluestretch:D #1 \scan_stop: + #4 = \etex_glueshrink:D #1 \scan_stop: + } + { + #3 = \c_zero_skip + #4 = \c_zero_skip + #2 + } } % \end{macrocode} % \end{macro} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx index 9fa0a297d51..51fcddc242e 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3tl.dtx 3460 2012-02-26 12:16:41Z will $ +\GetIdInfo$Id: l3tl.dtx 3490 2012-03-04 01:00:53Z bruno $ {L3 Experimental token lists} %</driver|package> %<*driver> @@ -154,6 +154,15 @@ % \meta{tl~var2}. % \end{function} % +% \begin{function}[EXP, pTF, added=2012-03-03]{\tl_if_exist:N, \tl_if_exist:c} +% \begin{syntax} +% \cs{tl_if_exist_p:N} \meta{tl~var} +% \cs{tl_if_exist:NTF} \meta{tl~var} \Arg{true code} \Arg{false code} +% \end{syntax} +% Tests whether the \meta{tl~var} is currently defined. This does not +% check that the \meta{tl~var} really is a token list variable. +% \end{function} +% % \section{Adding data to token list variables} % % \begin{function} @@ -1100,9 +1109,9 @@ % Error checking will be sorted out by the parent function. % \begin{macrocode} \cs_new_protected:Npn \tl_clear_new:N #1 - { \cs_if_exist:NTF #1 { \tl_clear:N #1 } { \tl_new:N #1 } } + { \tl_if_exist:NTF #1 { \tl_clear:N #1 } { \tl_new:N #1 } } \cs_new_protected:Npn \tl_gclear_new:N #1 - { \cs_if_exist:NTF #1 { \tl_gclear:N #1 } { \tl_new:N #1 } } + { \tl_if_exist:NTF #1 { \tl_gclear:N #1 } { \tl_new:N #1 } } \cs_generate_variant:Nn \tl_clear_new:N { c } \cs_generate_variant:Nn \tl_gclear_new:N { c } % \end{macrocode} @@ -1125,6 +1134,20 @@ % \end{macro} % \end{macro} % +% \begin{macro}[pTF]{\tl_if_exist:N, \tl_if_exist:c} +% Copies of the \texttt{cs} functions defined in \pkg{l3basics}. +% \begin{macrocode} +\cs_new_eq:NN \tl_if_exist:NTF \cs_if_exist:NTF +\cs_new_eq:NN \tl_if_exist:NT \cs_if_exist:NT +\cs_new_eq:NN \tl_if_exist:NF \cs_if_exist:NF +\cs_new_eq:NN \tl_if_exist_p:N \cs_if_exist_p:N +\cs_new_eq:NN \tl_if_exist:cTF \cs_if_exist:cTF +\cs_new_eq:NN \tl_if_exist:cT \cs_if_exist:cT +\cs_new_eq:NN \tl_if_exist:cF \cs_if_exist:cF +\cs_new_eq:NN \tl_if_exist_p:c \cs_if_exist_p:c +% \end{macrocode} +% \end{macro} +% % \subsection{Adding to token list variables} % % \begin{macro} @@ -1787,7 +1810,7 @@ % \begin{macrocode} \cs_new:Npn \tl_use:N #1 { - \cs_if_exist:NTF #1 {#1} + \tl_if_exist:NTF #1 {#1} { \msg_expandable_kernel_error:nnn { kernel } { bad-var } {#1} } } \cs_generate_variant:Nn \tl_use:N { c } diff --git a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx index 151901bd2dd..b811e4a168a 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3token.dtx 3460 2012-02-26 12:16:41Z will $ +\GetIdInfo$Id: l3token.dtx 3491 2012-03-04 06:13:18Z bruno $ {L3 Experimental token manipulation} %</driver|package> %<*driver> @@ -2131,7 +2131,7 @@ } \cs_set:Npn \peek_def_aux:nnnnn #1#2#3#4#5 { - \cs_gset_nopar:cpx { #1 #5 } + \cs_new_nopar:cpx { #1 #5 } { \tl_if_empty:nF {#2} { \exp_not:n { \cs_set_eq:NN \peek_execute_branches: #2 } } diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tree.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tree.dtx deleted file mode 100644 index 27e5b7e5d44..00000000000 --- a/Master/texmf-dist/source/latex/l3kernel/l3tree.dtx +++ /dev/null @@ -1,595 +0,0 @@ -% \iffalse -% -%% File l3tree.dtx (C) Copyright 2012 The LaTeX3 Project -%% -%% It may be distributed and/or modified under the conditions of the -%% LaTeX Project Public License (LPPL), either version 1.3c of this -%% license or (at your option) any later version. The latest version -%% of this license is in the file -%% -%% http://www.latex-project.org/lppl.txt -%% -%% This file is part of the "l3trial 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. -%% -%% ----------------------------------------------------------------------- -%% -%% The development version of the bundle can be found at -%% -%% http://www.latex-project.org/svnroot/experimental/trunk/ -%% -%% for those people who are interested. -%% -%%%%%%%%%%% -%% NOTE: %% -%%%%%%%%%%% -%% -%% Snapshots taken from the repository represent work in progress and may -%% not work or may contain conflicting material! We therefore ask -%% people _not_ to put them into distributions, archives, etc. without -%% prior consultation with the LaTeX Project Team. -%% -%% ----------------------------------------------------------------------- -%% -% -%<*driver|package> -\RequirePackage{expl3} -\GetIdInfo$Id: l3tree.dtx 3177 2012-01-11 02:11:43Z bruno $ - {L3 Experimental tree manipulations} -%</driver|package> -%<*driver> -\documentclass[full]{l3doc} -\usepackage{amsmath} -\begin{document} - \DocInput{\jobname.dtx} -\end{document} -%</driver> -% \fi -% -% \title{^^A -% The \pkg{l3tree} package\\ Trees^^A -% \thanks{This file describes v\ExplFileVersion, -% last revised \ExplFileDate.}^^A -% } -% -% \author{^^A -% The \LaTeX3 Project\thanks -% {^^A -% E-mail: -% \href{mailto:latex-team@latex-project.org} -% {latex-team@latex-project.org}^^A -% }^^A -% } -% -% \date{Released \ExplFileDate} -% -% \maketitle -% -% \begin{documentation} -% -% \section{\pkg{l3tree} documentation} -% -% \LaTeX3 comes with a tree data-type, whose keys are integers. -% ^^A Currently, we only support binary trees, but that will probably -% ^^A be extended as the need arises. -% -% A tree is a box containing -% -% \begin{function}{\tree_new:N, \tree_new:c} -% \begin{syntax} -% \cs{tree_new:N} \meta{tree} -% \end{syntax} -% Creates a new tree, with no node. -% \end{function} -% -% \begin{function}{\tree_put:Nn, \tree_put:cn, \tree_gput:Nn, \tree_gput:cn} -% \begin{syntax} -% \cs{tree_put:Nn} \meta{tree} \Arg{integer expression} -% \end{syntax} -% Evaluates the \meta{integer expression}, and puts the -% \end{function} -% -% \end{documentation} -% -% \begin{implementation} -% -% \section{\pkg{l3tree} implementation} -% -% \begin{macrocode} -%<*initex|package> -% \end{macrocode} -% -% \begin{macrocode} -%<*package> -\ProvidesExplPackage - {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\package_check_loaded_expl: -%</package> -% \end{macrocode} -% -% \subsection{Variables} -% -% \begin{variable}{\l_tree_index_int} -% -% \begin{macrocode} -\int_new:N \l_tree_index_int -% \end{macrocode} -% \end{variable} -% -% \begin{variable}{\l_tree_item_box} -% -% \begin{macrocode} -\box_new:N \l_tree_item_box -% \end{macrocode} -% \end{variable} -% -% \begin{variable}{\l_tree_left_box,\l_tree_right_box} -% During the splaying step, these two boxes hold the left and right -% children of the node which we splay. -% \begin{macrocode} -\box_new:N \l_tree_left_box -\box_new:N \l_tree_right_box -% \end{macrocode} -% \end{variable} -% -% \begin{variable}{\l_tree_first_box, \l_tree_second_box} -% Temporary variables holding subtrees of the full tree -% in various circumstances. -% \begin{macrocode} -\box_new:N \l_tree_first_box -\box_new:N \l_tree_second_box -% \end{macrocode} -% \end{variable} -% -% \begin{variable}{\l_tree_parent_box, \l_tree_grandpa_box} -% -% \begin{macrocode} -\box_new:N \l_tree_parent_box -\box_new:N \l_tree_grandpa_box -% \end{macrocode} -% \end{variable} -% -% \begin{variable}{\c_one_sp_dim} -% Smallest dimension that \TeX{} recognizes. When implicitly -% converting from integers to dimensions, this is the conversion -% factor. -% \begin{macrocode} -\dim_new:N \c_one_sp_dim -\dim_set:Nn \c_one_sp_dim { 1 sp } -% \end{macrocode} -% \end{variable} -% -% \begin{variable}{\l_tree_parent_dim,\l_tree_grandpa_dim} -% -% \begin{macrocode} -\dim_new:N \l_tree_parent_dim -\dim_new:N \l_tree_grandpa_dim -% \end{macrocode} -% \end{variable} -% -% \begin{variable}{\g_tree_result_seq} -% When extracting keys from a tree, the result is temporarily stored -% globally in \cs{g_tree_result_seq} to exit a group. -% \begin{macrocode} -\seq_new:N \g_tree_result_seq -% \end{macrocode} -% \end{variable} -% -% \begin{variable}{\l_tree_internal_box} -% Scratch box register for temporary use. -% \begin{macrocode} -\box_new:N \l_tree_internal_box -% \end{macrocode} -% \end{variable} -% -% \subsection{Generic helpers} -% -% \begin{macro}{\tree_end:} -% Used to end box assignments started by \cs{tree_edit:Nw}, -% \cs{tree_gedit:Nw}, or \cs{tree_cat:Nw}. -% \begin{macrocode} -\cs_new_eq:NN \tree_end: \c_group_end_token -% \end{macrocode} -% \end{macro} -% -%^^A explain that we need protection against a potential \tn{everyhbox}. -% -% \begin{macro}{\tree_edit:Nw, \tree_gedit:Nw} -% Accessing the contents of a tree requires unpacking its contents, -% to access them using the \tn{lastbox} primitive. We may not do -% that in the current list. Instead, this is done within a box -% assignment to the tree itself: this choice allows us to modify -% (\enquote{edit}) the tree and not only access the nodes. -% This editing should be ended by \cs{tree_end:}. -% \begin{macrocode} -\cs_new_protected:Npn \tree_edit:Nw #1 - { - \tex_afterassignment:D \use_none_delimit_by_q_stop:w - \tex_setbox:D #1 \tex_hbox:D \c_group_begin_token - \q_stop - \tex_everyhbox:D { } - \hbox_unpack_clear:N #1 - } -\cs_new_protected:Npn \tree_gedit:Nw #1 - { - \tex_afterassignment:D \use_none_delimit_by_q_stop:w - \tex_global:D \tex_setbox:D #1 \tex_hbox:D \c_group_begin_token - \q_stop - \tex_everyhbox:D { } - \hbox_unpack_clear:N #1 - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\tree_cat:Nw} -% Similar to \cs{tree_edit:Nw}, but without altering the tree contents. -% \begin{macrocode} -\cs_new_protected:Npn \tree_cat:Nw #1 - { - \tex_afterassignment:D \use_none_delimit_by_q_stop:w - \tex_setbox:D \l_tree_internal_box \tex_hbox:D \c_group_begin_token - \q_stop - \tex_everyhbox:D { } - \hbox_unpack:N #1 - } -% \end{macrocode} -% \end{macro} -% -% \subsection{Empty trees} -% -% \begin{macro}{\tree_new:N, \tree_new:c} -% \begin{macro}{\tree_clear:N, \tree_clear:c} -% \begin{macro}{\tree_gclear:N, \tree_gclear:c} -% Trees are simply boxes, so we copy the box functions. -% \begin{macrocode} -\cs_new_eq:NN \tree_new:N \box_new:N -\cs_new_eq:NN \tree_new:c \box_new:c -\cs_new_eq:NN \tree_clear:N \box_clear:N -\cs_new_eq:NN \tree_clear:c \box_clear:c -\cs_new_eq:NN \tree_gclear:N \box_gclear:N -\cs_new_eq:NN \tree_gclear:c \box_gclear:c -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}[pTF, EXP]{\tree_if_empty:N} -% Test whether a tree is empty, \emph{i.e.}, contains no node at all. -% \begin{macrocode} -\prg_new_eq_conditional:NNn \tree_if_empty:N - \box_if_empty:N { p , T , F , TF } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[EXP]{\if_tree_empty:N} -% The primitive conditional is used in the code because it expands -% in only one step. -% \begin{macrocode} -\cs_new_eq:NN \if_tree_empty:N \if_box_empty:N -% \end{macrocode} -% \end{macro} -% -% \subsection{Extracting the keys} -% -% \begin{macro}{\seq_set_from_tree:NN, \seq_gset_from_tree:NN} -% \begin{macro}[aux]{\tree_extract_aux:NNN} -% The local and global versions only differ by how the sequence -% is assigned once it has been built in \cs{g_tree_result_seq}. -% We open the tree with \cs{tree_cat:Nw}, then extract the keys -% non-expandably into \tn{dimen} registers (used as integers) -% using \cs{tree_extract_loop:}, and store the values of those -% \tn{dimen} registers expandably as the sequence -% \cs{g_tree_result_seq}. After closing the tree, store the -% result sequence into the user's variable, and clear the -% internal sequence (a small cost operation to avoid memory leaks). -% \begin{macrocode} -\cs_new_protected_nopar:Npn \seq_set_from_tree:NN - { \tree_extract_aux:NNN \seq_set_eq:NN } -\cs_new_protected_nopar:Npn \seq_gset_from_tree:NN - { \tree_extract_aux:NNN \seq_gset_eq:NN } -\cs_new_protected:Npn \tree_extract_aux:NNN #1#2#3 - { - \int_zero:N \l_tree_index_int - \tree_cat:Nw #3 - \tree_extract_loop: - \tl_gset:Nx \g_tree_result_seq - { - \exp_after:wN \tree_extract_loop:w - \int_use:N \l_tree_index_int ; - \prg_break_point:n { } - } - \tree_end: - #1 #2 \g_tree_result_seq - \tl_gclear:N \g_tree_result_seq - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}[aux]{\tree_extract_loop:} -% -% \begin{macrocode} -\cs_new_protected:Npn \tree_extract_loop: - { - \tex_setbox:D \l_tree_first_box \tex_lastbox:D - \if_hbox:N \l_tree_first_box - \hbox_unpack_clear:N \l_tree_first_box - \else: - \if_num:w \tex_ht:D \l_tree_first_box = \c_zero - \exp_after:wN \exp_after:wN \exp_after:wN \use_none:n - \else: - \tex_advance:D \l_tree_index_int \c_one - \tex_dimen:D \l_tree_index_int \tex_ht:D \l_tree_first_box - \fi: - \fi: - \tree_extract_loop: - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[aux, EXP]{\tree_extract_loop:w} -% -% \begin{macrocode} -\cs_new:Npn \tree_extract_loop:w #1 ; - { - \if_num:w #1 = \c_zero - \exp_after:wN \prg_map_break: - \fi: - \exp_not:N \seq_item:n { \int_value:w \tex_dimen:D #1 } - \exp_after:wN \tree_extract_loop:w - \int_use:N \int_eval:w #1 - \c_one ; - } -% \end{macrocode} -% \end{macro} -% -% \subsection{Comparison} -% -% \begin{macro}{\tree_compare:NN} -% -% \begin{macrocode} -\cs_new_protected:Npn \tree_compare:NN #1 #2 - { - \if_num:w \tex_ht:D #1 > \tex_ht:D #2 \exp_stop_f: - \tree_reversed: - \else: - \tree_ordered: - \fi: - } -% \end{macrocode} -% \end{macro} -% -% \subsection{Adding nodes to a tree} -% -% \begin{macro}{\tree_put:Nnn, \tree_gput:Nnn} -% \begin{macro}[aux]{\tree_put_aux:NNnn} -% -% \begin{macrocode} -\cs_new_protected:Npn \tree_put:Nnn - { \tree_put_aux:NNnn \tree_edit:Nw } -\cs_new_protected:Npn \tree_gput:Nnn - { \tree_put_aux:NNnn \tree_gedit:Nw } -\cs_new_protected:Npn \tree_put_aux:NNnn #1#2#3#4 - { - \tex_setbox:D \l_tree_left_box \tex_box:D \c_empty_box - \tex_setbox:D \l_tree_right_box \tex_box:D \c_empty_box - \tex_setbox:D \l_tree_item_box - \tex_vbox:D to \int_eval:w #3 \int_eval_end: \c_one_sp_dim {#4} - \exp_after:wN #1 \exp_after:wN #2 - \if_tree_empty:N #2 - \else: - \tree_put_loop: - \tree_splay_loop: - \fi: - \box_use_clear:N \l_tree_left_box - \box_use_clear:N \l_tree_item_box - \box_use_clear:N \l_tree_right_box - \tree_end: - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}[aux]{\tree_put_loop:} -% -% \begin{macrocode} -\cs_new_protected:Npn \tree_put_loop: - { - \tex_setbox:D \l_tree_first_box \tex_lastbox:D - \tex_setbox:D \l_tree_parent_box - \if_vbox:N \l_tree_first_box - \tex_box:D \l_tree_first_box - \else: - \tex_lastbox:D - \fi: - \tree_compare:NN \l_tree_parent_box \l_tree_item_box - \if_box_empty:N \l_tree_first_box - \exp_after:wN \use_none:n - \else: - \hbox_unpack_clear:N \l_tree_first_box - \fi: - \tree_put_loop: - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\tree_ordered:, \tree_reversed:} -% -% \begin{macrocode} -\cs_new_protected:Npn \tree_ordered: - { - \box_use_clear:N \l_tree_parent_box - \tex_kern:D \c_one_sp_dim - } -\cs_new_protected:Npn \tree_reversed: - { - \tex_setbox:D \l_tree_second_box \tex_lastbox:D - \box_use_clear:N \l_tree_first_box - \tex_setbox:D \l_tree_first_box \tex_box:D \l_tree_second_box - \box_use_clear:N \l_tree_parent_box - \tex_kern:D - \c_one_sp_dim - } -% \end{macrocode} -% \end{macro} -% -% \subsection{Splaying} -% -% \begin{macro}[int]{\tree_splay_loop:} -% -% \begin{macrocode} -\cs_new_protected:Npn \tree_splay_loop: - { - \l_tree_parent_dim \tex_lastkern:D - \tex_unkern:D - \tex_setbox:D \l_tree_parent_box \tex_lastbox:D - \tex_setbox:D \l_tree_first_box \tex_lastbox:D - \l_tree_grandpa_dim \tex_lastkern:D - \tex_unkern:D - \tex_setbox:D \l_tree_grandpa_box \tex_lastbox:D - \tex_setbox:D \l_tree_second_box \tex_lastbox:D - \cs:w - tree_splay - _\int_value:w \l_tree_parent_dim - _\int_value:w \l_tree_grandpa_dim - : - \cs_end: - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[aux]{\tree_splay_0_0:} -% -% \begin{macrocode} -\cs_new_protected:cpn { tree_splay_0_0: } { } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[aux]{\tree_splay_1_0:} -% -% \begin{macrocode} -\cs_new_protected:cpn { tree_splay_1_0: } - { - \tex_setbox:D \l_tree_left_box \tex_hbox:D - { - \box_use_clear:N \l_tree_first_box - \box_use_clear:N \l_tree_parent_box - \box_use_clear:N \l_tree_left_box - } - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[aux]{\tree_splay_-1_0:} -% -% \begin{macrocode} -\cs_new_protected:cpn { tree_splay_-1_0: } - { - \tex_setbox:D \l_tree_right_box \tex_hbox:D - { - \box_use_clear:N \l_tree_right_box - \box_use_clear:N \l_tree_parent_box - \box_use_clear:N \l_tree_first_box - } - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[aux]{\tree_splay_1_1:} -% -% \begin{macrocode} -\cs_new_protected:cpn { tree_splay_1_1: } - { - \tex_setbox:D \l_tree_left_box \tex_hbox:D - { - \tex_hbox:D - { - \box_use_clear:N \l_tree_second_box - \box_use_clear:N \l_tree_grandpa_box - \box_use_clear:N \l_tree_first_box - } - \box_use_clear:N \l_tree_parent_box - \box_use_clear:N \l_tree_left_box - } - \tree_splay_loop: - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[aux]{\tree_splay_1_-1:} -% -% \begin{macrocode} -\cs_new_protected:cpn { tree_splay_1_-1: } - { - \tex_setbox:D \l_tree_right_box \tex_hbox:D - { - \box_use_clear:N \l_tree_right_box - \box_use_clear:N \l_tree_grandpa_box - \box_use_clear:N \l_tree_second_box - } - \tex_setbox:D \l_tree_left_box \tex_hbox:D - { - \box_use_clear:N \l_tree_first_box - \box_use_clear:N \l_tree_parent_box - \box_use_clear:N \l_tree_left_box - } - \tree_splay_loop: - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[aux]{\tree_splay_-1_1:} -% -% \begin{macrocode} -\cs_new_protected:cpn { tree_splay_-1_1: } - { - \tex_setbox:D \l_tree_right_box \tex_hbox:D - { - \box_use_clear:N \l_tree_right_box - \box_use_clear:N \l_tree_parent_box - \box_use_clear:N \l_tree_first_box - } - \tex_setbox:D \l_tree_left_box \tex_hbox:D - { - \box_use_clear:N \l_tree_second_box - \box_use_clear:N \l_tree_grandpa_box - \box_use_clear:N \l_tree_left_box - } - \tree_splay_loop: - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[aux]{\tree_splay_-1_-1:} -% -% \begin{macrocode} -\cs_new_protected:cpn { tree_splay_-1_-1: } - { - \tex_setbox:D \l_tree_right_box \tex_hbox:D - { - \box_use_clear:N \l_tree_right_box - \box_use_clear:N \l_tree_parent_box - \tex_hbox:D - { - \box_use_clear:N \l_tree_first_box - \box_use_clear:N \l_tree_grandpa_box - \box_use_clear:N \l_tree_second_box - } - } - \tree_splay_loop: - } -% \end{macrocode} -% \end{macro} -% -% \subsection{Sorting} -% -% \begin{macrocode} -% \end{macrocode} -% -% \begin{macrocode} -%</initex|package> -% \end{macrocode} -% -% \end{implementation} -% -% \PrintIndex
\ No newline at end of file |