diff options
author | Karl Berry <karl@freefriends.org> | 2012-07-23 17:15:00 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-07-23 17:15:00 +0000 |
commit | 134349701bddf7cbbacf6030c6b9f9838aff96fa (patch) | |
tree | ec1140c46e1c0347a671a6fa3cf8af5a79e95f93 /Master/texmf-dist/source/latex/l3kernel/l3prg.dtx | |
parent | f7855c12c18bb97b7b9e49ab685ee558d8c0b47b (diff) |
l3kernel 3990 (17jul12)
git-svn-id: svn://tug.org/texlive/trunk@27108 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3prg.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3prg.dtx | 1128 |
1 files changed, 431 insertions, 697 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx index 88f53e59759..6d4fb15351d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3prg.dtx Copyright (C) 2005-2011 The LaTeX3 Project +%% File: l3prg.dtx Copyright (C) 2005-2012 The LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -35,8 +35,8 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3prg.dtx 3490 2012-03-04 01:00:53Z bruno $ - {L3 Experimental control structures} +\GetIdInfo$Id: l3prg.dtx 3986 2012-07-15 19:23:51Z joseph $ + {L3 Control structures} %</driver|package> %<*driver> \documentclass[full]{l3doc} @@ -78,13 +78,13 @@ % \LaTeX3 has two forms of conditional flow processing based % on these states. The firs form is predicate functions that turn the % returned state into a boolean \meta{true} or \meta{false}. For -% example, the function |\cs_if_free_p:N| checks whether the control +% example, the function \cs{cs_if_free_p:N} checks whether the control % sequence given as its argument is free and then returns the boolean % \meta{true} or \meta{false} values to be used in testing with -% |\if_predicate:w| or in functions to be described below. The second form +% \cs{if_predicate:w} or in functions to be described below. The second form % is the kind of functions choosing a particular argument from the % input stream based on the result of the testing as in -% |\cs_if_free:NTF| which also takes one argument (the |N|) and then +% \cs{cs_if_free:NTF} which also takes one argument (the |N|) and then % executes either \texttt{true} or \texttt{false} depending on the % result. Important to note here is that the arguments are executed % after exiting the underlying |\if...\fi:| structure. @@ -182,13 +182,13 @@ % This defines the function |\foo_if_bar_p:NN|, |\foo_if_bar:NNTF| and % |\foo_if_bar:NNT| but not |\foo_if_bar:NNF| (because |F| is missing % from the \meta{conditions} list). The return statements take care of -% resolving the remaining |\else:| and |\fi:| before returning the +% resolving the remaining \cs{else:} and \cs{fi:} before returning the % state. There must be a return statement for each branch, failing to do % so will result in an error if that branch is executed. % % \begin{function}{\prg_new_eq_conditional:NNn, \prg_set_eq_conditional:NNn} % \begin{syntax} -% \cs{prg_new_eq_conditional:NNn} \cs{\meta{name1}:\meta{arg spec1}} \cs{\meta{name2}:\meta{arg spec2}} \Arg{conditions} +% \cs{prg_new_eq_conditional:NNn} \cs{\meta{name_1}:\meta{arg spec_1}} \cs{\meta{name_2}:\meta{arg spec_2}} \Arg{conditions} % \end{syntax} % These functions copies a family of conditionals. The \texttt{new} version % will check for existing definitions (\emph{cf.}~\cs{cs_new:Npn}) whereas @@ -214,12 +214,12 @@ % connected to conditional processing as sometimes you want to % execute some code depending on the value of a switch % (\emph{e.g.},~draft/final) and other times you perhaps want to use it as a -% predicate function in an |\if_predicate:w| test. The problem of the -% primitive |\if_false:| and |\if_true:| tokens is that it is not +% predicate function in an \cs{if_predicate:w} test. The problem of the +% primitive \cs{if_false:} and \cs{if_true:} tokens is that it is not % always safe to pass them around as they may interfere with scanning % for termination of primitive conditional processing. Therefore, we -% employ two canonical booleans: |\c_true_bool| or -% |\c_false_bool|. Besides preventing problems as described above, it +% employ two canonical booleans: \cs{c_true_bool} or +% \cs{c_false_bool}. Besides preventing problems as described above, it % also allows us to implement a simple boolean parser supporting the % logical operations And, Or, Not, \emph{etc.}\ which can then be used on % both the boolean type and predicate functions. @@ -265,12 +265,12 @@ % \bool_gset_eq:NN, \bool_gset_eq:cN, \bool_gset_eq:Nc, \bool_gset_eq:cc % } % \begin{syntax} -% \cs{bool_set_eq:NN} \meta{boolean1} \meta{boolean2} +% \cs{bool_set_eq:NN} \meta{boolean_1} \meta{boolean_2} % \end{syntax} -% Sets the content of \meta{boolean1} equal to that of \meta{boolean2}. +% Sets the content of \meta{boolean_1} equal to that of \meta{boolean_2}. % \end{function} % -% \begin{function} +% \begin{function}[updated = 2012-07-08] % {\bool_set:Nn, \bool_set:cn, \bool_gset:Nn, \bool_gset:cn} % \begin{syntax} % \cs{bool_set:Nn} \meta{boolean} \Arg{boolexpr} @@ -296,7 +296,7 @@ % Displays the logical truth of the \meta{boolean} on the terminal. % \end{function} % -% \begin{function}[added = 2012-02-09]{\bool_show:n} +% \begin{function}[added = 2012-02-09, updated = 2012-07-08]{\bool_show:n} % \begin{syntax} % \cs{bool_show:n} \Arg{boolean expression} % \end{syntax} @@ -314,14 +314,14 @@ % check that the \meta{boolean} really is a boolean variable. % \end{function} % -% \begin{variable}{\l_tmpa_bool} +% \begin{variable}{\l_tmpa_bool, \l_tmpb_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 % function. However, it may be overwritten by other non-kernel % code and so should only be used for short-term storage. % \end{variable} % -% \begin{variable}{\g_tmpa_bool} +% \begin{variable}{\g_tmpa_bool, \g_tmpb_bool} % A scratch boolean for global assignment. It is never used by % the kernel code, and so is safe for use with any \LaTeX3-defined % function. However, it may be overwritten by other non-kernel @@ -337,7 +337,8 @@ % A boolean expression is an expression which given input in the form % of predicate functions and boolean variables, return boolean % \meta{true} or \meta{false}. It supports the logical operations And, -% Or and Not as the well-known infix operators |&&|, \verb"||" and |!|. In +% Or and Not as the well-known infix operators |&&|, \verb"||" and |!| +% with their usual precedences. In % addition to this, parentheses can be used to isolate % sub-expressions. For example, % \begin{verbatim} @@ -354,7 +355,7 @@ % be changed any more, the remaining tests within the current group % are skipped. % -% \begin{function}[EXP,pTF]{\bool_if:n} +% \begin{function}[EXP, pTF, updated = 2012-07-08]{\bool_if:n} % \begin{syntax} % \cs{bool_if_p:n} \Arg{boolean expression} % \cs{bool_if:nTF} \Arg{boolean expression} \Arg{true code} \Arg{false code} @@ -367,7 +368,7 @@ % |!| (\enquote{Not}) and parentheses. Minimal evaluation is used % in the processing, so that once a result is defined there is % not further expansion of the tests. For example -% \begin{verbatim} +% \begin{verbatim} % \bool_if_p:n % { % \int_compare_p:nNn { 1 } = { 1 } @@ -378,17 +379,15 @@ % \int_compare_p:nNn { 1 } = { \error } % is skipped % ) % && -% ! ( \int_compare_p:nNn { 2 } = { 4 } ) +% ! \int_compare_p:nNn { 2 } = { 4 } % } % \end{verbatim} % will be \texttt{true} and will not evaluate % |\int_compare_p:nNn { 1 } = { \error }|. The logical Not applies to -% the next single predicate or group. As shown above, this means that -% any predicates requiring an argument have to be given within -% parentheses. +% the next predicate or group. % \end{function} % -% \begin{function}[EXP]{\bool_not_p:n} +% \begin{function}[EXP, updated = 2012-07-08]{\bool_not_p:n} % \begin{syntax} % \cs{bool_not_p:n} \Arg{boolean expression} % \end{syntax} @@ -396,9 +395,9 @@ % expression. % \end{function} % -% \begin{function}[EXP]{\bool_xor_p:nn} +% \begin{function}[EXP, updated = 2012-07-08]{\bool_xor_p:nn} % \begin{syntax} -% \cs{bool_xor_p:nn} \Arg{boolexpr_1} \Arg{boolexpr_1} +% \cs{bool_xor_p:nn} \Arg{boolexpr_1} \Arg{boolexpr_2} % \end{syntax} % Implements an \enquote{exclusive or} operation between two boolean % expressions. There is no infix operation for this logical @@ -431,7 +430,7 @@ % until the \meta{boolean} is \texttt{false}. % \end{function} % -% \begin{function}[rEXP]{\bool_until_do:nn} +% \begin{function}[rEXP, updated = 2012-07-08]{\bool_until_do:nn} % \begin{syntax} % \cs{bool_until_do:nn} \Arg{boolean expression} \Arg{code} % \end{syntax} @@ -443,7 +442,7 @@ % then loop until the \meta{boolean expression} is \texttt{true}. % \end{function} % -% \begin{function}[rEXP]{\bool_while_do:nn} +% \begin{function}[rEXP, updated = 2012-07-08]{\bool_while_do:nn} % \begin{syntax} % \cs{bool_while_do:nn} \Arg{boolean expression} \Arg{code} % \end{syntax} @@ -455,109 +454,6 @@ % then loop until the \meta{boolean expression} is \texttt{false}. % \end{function} % -% \section{Switching by case} -% -% For cases where a number of cases need to be considered a family of -% case-selecting functions are available. -% -% \begin{function}[updated = 2011-09-17, EXP]{\prg_case_int:nnn} -% \begin{syntax} -% \cs{prg_case_int:nnn} \Arg{test integer expression} \\ -% ~~|{| \\ -% ~~~~\Arg{intexpr case1} \Arg{code case1} \\ -% ~~~~\Arg{intexpr case2} \Arg{code case2} \\ -% ~~~~\ldots \\ -% ~~~~\Arg{intexpr case$\sb{n}$} \Arg{code case$\sb{n}$} \\ -% ~~|}| \\ -% ~~\Arg{else case} -% \end{syntax} -% This function evaluates the \meta{test integer expression} and -% compares this in turn to each of the -% \meta{integer expression cases}. If the two are equal then the -% associated \meta{code} is left in the input stream. If none of -% the tests are \texttt{true} then the \texttt{else code} will be -% left in the input stream. -% \end{function} -% -% As an example of \cs{prg_case_int:nnn}: -% \begin{verbatim} -% \prg_case_int:nnn -% { 2 * 5 } -% { -% { 5 } { Small } -% { 4 + 6 } { Medium } -% { -2 * 10 } { Negative } -% } -% { No idea! } -% \end{verbatim} -% will leave \enquote{\texttt{Medium}} in the input stream. -% -% \begin{function}[updated = 2011-07-06, EXP]{\prg_case_dim:nnn} -% \begin{syntax} -% \cs{prg_case_dim:nnn} \Arg{test dimension expression} \\ -% ~~|{| \\ -% ~~~~\Arg{dimexpr case1} \Arg{code case1} \\ -% ~~~~\Arg{dimexpr case2} \Arg{code case2} \\ -% ~~~~\ldots \\ -% ~~~~\Arg{dimexpr case$\sb{n}$} \Arg{code case$\sb{n}$} \\ -% ~~|}| \\ -% ~~\Arg{else case} -% \end{syntax} -% This function evaluates the \meta{test dimension expression} and -% compares this in turn to each of the -% \meta{dimension expression cases}. If the two are equal then the -% associated \meta{code} is left in the input stream. If none of -% the tests are \texttt{true} then the \texttt{else code} will be -% left in the input stream. -% \end{function} -% -% \begin{function}[updated = 2011-09-17, EXP] -% {\prg_case_str:nnn, \prg_case_str:onn, \prg_case_str:xxn} -% \begin{syntax} -% \cs{prg_case_str:nnn} \Arg{test string} \\ -% ~~|{| \\ -% ~~~~\Arg{string case1} \Arg{code case1} \\ -% ~~~~\Arg{string case2} \Arg{code case2} \\ -% ~~~~\ldots \\ -% ~~~~\Arg{string case$\sb{n}$} \Arg{code case$\sb{n}$} \\ -% ~~|}| \\ -% ~~\Arg{else case} -% \end{syntax} -% This function compares the \meta{test string} in turn with each -% of the \meta{string cases}. If the two are equal (as described for -% \cs{str_if_eq:nnTF} then the -% associated \meta{code} is left in the input stream. If none of -% the tests are \texttt{true} then the \texttt{else code} will be -% left in the input stream. The |xx| variant fully expands -% \meta{strings} before comparing them, but does not expand the -% corresponding \meta{code}. It is fully expandable, in the same way -% as the underlying \cs{str_if_eq:xxTF} test. -%^^A The \meta{test string} is expanded in each comparison, and must -%^^A always yield the same result: in particular, random numbers should -%^^A not be used within this string. -% \end{function} -% -% \begin{function}[updated = 2011-09-17, EXP] -% {\prg_case_tl:Nnn, \prg_case_tl:cnn} -% \begin{syntax} -% \cs{prg_case_tl:Nnn} \meta{test token list variable} \\ -% ~~"{" \\ -% ~~~~\meta{token list variable case1} \Arg{code case1} \\ -% ~~~~\meta{token list variable case2} \Arg{code case2} \\ -% ~~~~\ldots \\ -% ~~~~\meta{token list variable case$\sb{n}$} \Arg{code case$\sb{n}$} \\ -% ~~"}" \\ -% ~~\Arg{else case} -% \end{syntax} -% This function compares the \meta{test token list variable} in turn -% with each of the \meta{token list variable cases}. If the two -% are equal (as described for -% \cs{tl_if_eq:nnTF} -% then the associated \meta{code} is left in the input -% stream. If none of the tests are \texttt{true} then the -% \texttt{else code} will be left in the input stream. -% \end{function} -% % \section{Producing $n$ copies} % % \begin{function}[updated = 2011-07-04, EXP]{\prg_replicate:nn} @@ -570,54 +466,6 @@ % nesting. It yields its result after two expansion steps. % \end{function} % -% \begin{function}[updated = 2011-09-06,rEXP]{\prg_stepwise_function:nnnN} -% \begin{syntax} -% \cs{prg_stepwise_function:nnnN} \Arg{initial value} \Arg{step} \Arg{final value} \meta{function} -% \end{syntax} -% This function first evaluates the \meta{initial value}, \meta{step} -% and \meta{final value}, all of which should be integer expressions. -% The \meta{function} is then placed in front of each \meta{value} -% from the \meta{initial value} to the \meta{final value} in turn -% (using \meta{step} between each \meta{value}). Thus \meta{function} -% should absorb one numerical argument. For example -% \begin{verbatim} -% \cs_set:Npn \my_func:n #1 { [I~saw~#1] \quad } -% \prg_stepwise_function:nnnN { 1 } { 1 } { 5 } \my_func:n -% \end{verbatim} -% would print -% \begin{quote} -% [I saw 1] \quad -% [I saw 2] \quad -% [I saw 3] \quad -% [I saw 4] \quad -% [I saw 5] \quad -% \end{quote} -% \end{function} -% -% \begin{function}[updated = 2011-09-06]{\prg_stepwise_inline:nnnn} -% \begin{syntax} -% \cs{prg_stepwise_inline:nnnn} \Arg{initial value} \Arg{step} \Arg{final value} \Arg{code} -% \end{syntax} -% This function first evaluates the \meta{initial value}, \meta{step} -% and \meta{final value}, all of which should be integer expressions. -% The \meta{code} is then placed in front of each \meta{value} -% from the \meta{initial value} to the \meta{final value} in turn -% (using \meta{step} between each \meta{value}). Thus the \meta{code} -% should define a function of one argument (|#1|). -% \end{function} -% -% \begin{function}[updated = 2011-09-06]{\prg_stepwise_variable:nnnNn} -% \begin{syntax} -% \cs{prg_stepwise_variable:nnnNn} \\ -% ~~\Arg{initial value} \Arg{step} \Arg{final value} \meta{tl~var} \Arg{code} -% \end{syntax} -% This function first evaluates the \meta{initial value}, \meta{step} -% and \meta{final value}, all of which should be integer expressions. -% The \meta{code} is inserted into the input stream, with the -% \meta{tl~var} defined as the current \meta{value}. Thus the -% \meta{code} should make use of the \meta{tl~var}. -% \end{function} -% % \section{Detecting \TeX{}'s mode} % % \begin{function}[EXP,pTF]{\mode_if_horizontal:} @@ -651,6 +499,26 @@ % Detects if \TeX{} is currently in vertical mode. % \end{function} % +% \section{Primitive conditionals} +% +% \begin{function}[EXP]{\if_predicate:w} +% \begin{syntax} +% "\if_predicate:w" <predicate> <true code> "\else:" <false code> "\fi:" +% \end{syntax} +% This function takes a predicate function and +% branches according to the result. (In practice this function would also +% accept a single boolean variable in place of the <predicate> but to make the +% coding clearer this should be done through "\if_bool:N".) +% \end{function} +% +% \begin{function}[EXP]{\if_bool:N} +% \begin{syntax} +% "\if_bool:N" <boolean> <true code> "\else:" <false code> "\fi:" +% \end{syntax} +% This function takes a boolean variable and +% branches according to the result. +% \end{function} +% % \section{Internal programming functions} % % \begin{function}[updated = 2011-08-11, EXP] @@ -692,61 +560,70 @@ % \end{texnote} % \end{function} % -% \begin{function}[EXP]{\prg_variable_get_scope:N} +% \begin{function}[EXP]{\__prg_variable_get_scope:N} % \begin{syntax} -% \cs{prg_variable_get_scope:N} \meta{variable} +% \cs{__prg_variable_get_scope:N} \meta{variable} % \end{syntax} % Returns the scope (\texttt{g} for global, blank otherwise) for the % \meta{variable}. % \end{function} % -% \begin{function}[EXP]{\prg_variable_get_type:N} +% \begin{function}[EXP]{\__prg_variable_get_type:N} % \begin{syntax} -% \cs{prg_variable_get_type:N} \meta{variable} +% \cs{__prg_variable_get_type:N} \meta{variable} % \end{syntax} % Returns the type of \meta{variable} (\texttt{tl}, \texttt{int}, % \emph{etc.}) % \end{function} % -% \begin{function}[EXP]{\if_predicate:w} +% \begin{function}[EXP]{\__prg_break_point:Nn} % \begin{syntax} -% "\if_predicate:w" <predicate> <true code> "\else:" <false code> "\fi:" +% \cs{__prg_break_point:Nn} \cs{\meta{type}_map_break:} \meta{tokens} % \end{syntax} -% This function takes a predicate function and -% branches according to the result. (In practice this function would also -% accept a single boolean variable in place of the <predicate> but to make the -% coding clearer this should be done through "\if_bool:N".) +% Used to mark the end of a recursion or mapping: the functions +% \cs{\meta{type}_map_break:} and \cs{\meta{type}_map_break:n} use +% this to break out of the loop. After the loop ends, the +% \meta{tokens} are inserted into the input stream. This occurs even +% if the the break functions are \emph{not} applied: +% \cs{__prg_break_point:Nn} is functionally-equivalent in these cases +% to \cs{use_ii:nn}. % \end{function} % -% \begin{function}[EXP]{\if_bool:N} +% \begin{function}[EXP]{\__prg_map_break:Nn} % \begin{syntax} -% "\if_bool:N" <boolean> <true code> "\else:" <false code> "\fi:" +% \cs{__prg_map_break:Nn} \cs{\meta{type}_map_break:} \Arg{user code} +% \ldots{} +% \cs{__prg_break_point:Nn} \cs{\meta{type}_map_break:} \Arg{ending code} % \end{syntax} -% This function takes a boolean variable and -% branches according to the result. +% Breaks a recursion in mapping contexts, inserting in the input +% stream the \meta{user code} after the \meta{ending code} for the +% loop. The function breaks loops, inserting their \meta{ending +% code}, until reaching a loop with the same \meta{type} as its +% first argument. This \cs{\meta{type}_map_break:} argument is simply +% used as a recognizable marker for the \meta{type}. % \end{function} % -% \begin{function}[EXP]{\prg_break_point:n} -% \begin{syntax} -% \cs{prg_break_point:n} \meta{tokens} -% \end{syntax} -% Used to mark the end of a recursion or mapping: the functions -% \cs{prg_map_break:} and \cs{prg_map_break:n} use this to break out -% of the loop. After the loop ends, the \meta{tokens} are inserted into -% the input stream. This occurs even if the the break functions are -% \emph{not} applied: \cs{prg_break_point:n} is functionally-equivalent -% in these cases to \cs{use:n}. +% \begin{variable}{\g__prg_map_int} +% This integer is used by non-expandable mapping functions to track +% the level of nesting in force. The functions \cs{__prg_map_1:w}, +% \cs{__prg_map_2:w}, \emph{etc.}, labelled by \cs{g__prg_map_int} +% hold functions to be mapped over various list datatypes in inline +% and variable mappings. +% \end{variable} +% +% \begin{function}[EXP]{\__prg_break_point:} +% This copy of \cs{prg_do_nothing:} is used to mark the end of a fast +% short-term recursions: the function \cs{__prg_break:n} uses this to +% break out of the loop. % \end{function} % -% \begin{function}[EXP]{\prg_map_break:, \prg_map_break:n} +% \begin{function}[EXP]{\__prg_break:, \__prg_break:n} % \begin{syntax} -% \cs{prg_map_break:n} \Arg{user code} -% \ldots{} -% \cs{prg_break_point:n} \Arg{ending code} +% \cs{__prg_break:n} \Arg{tokens} \ldots{} \cs{__prg_break_point:} % \end{syntax} -% Breaks a recursion in mapping contexts, inserting -% in the input stream the \meta{user code} after the -% \meta{ending code} for the loop. +% Breaks a recursion which has no \meta{ending code} and which is not +% a user-breakable mapping (see for instance \cs{prop_get:Nn}), and +% inserts \meta{tokens} in the input stream. % \end{function} % % \end{documentation} @@ -765,7 +642,7 @@ %<*package> \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\package_check_loaded_expl: +\__expl_package_check: %</package> % \end{macrocode} % @@ -815,6 +692,10 @@ % % \subsection{The boolean data type} % +% \begin{macrocode} +%<@@=bool> +% \end{macrocode} +% % \begin{macro}{\bool_new:N, \bool_new:c} % \UnitTested % Boolean variables have to be initiated when they are created. Other @@ -874,7 +755,7 @@ % \begin{macro}{\bool_set:Nn,\bool_set:cn} % \begin{macro}{\bool_gset:Nn,\bool_gset:cn} % This function evaluates a boolean expression and assigns the first -% argument the meaning |\c_true_bool| or |\c_false_bool|. +% argument the meaning \cs{c_true_bool} or \cs{c_false_bool}. % \begin{macrocode} \cs_new_protected:Npn \bool_set:Nn #1#2 { \tex_chardef:D #1 = \bool_if_p:n {#2} } @@ -884,6 +765,7 @@ \cs_generate_variant:Nn \bool_gset:Nn { c } % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macro}[pTF]{\bool_if:N, \bool_if:c} % \UnitTested @@ -904,11 +786,10 @@ \cs_generate_variant:Nn \bool_if:NTF { c } % \end{macrocode} % \end{macro} -% \end{macro} % % \begin{macro}{\bool_show:N, \bool_show:c, \bool_show:n} % Show the truth value of the boolean, as \texttt{true} or -% \texttt{false}. We use \cs{msg_aux_show:x} to get a better output; +% \texttt{false}. We use \cs{__msg_show_variable:x} to get a better output; % this function requires its argument to start with |>|. % \begin{macrocode} \cs_new_protected:Npn \bool_show:N #1 @@ -916,25 +797,27 @@ \bool_if_exist:NTF #1 { \bool_show:n {#1} } { - \msg_kernel_error:nnx { kernel } { variable-not-defined } + \__msg_kernel_error:nnx { kernel } { variable-not-defined } { \token_to_str:N #1 } } } \cs_new_protected:Npn \bool_show:n #1 { \bool_if:nTF {#1} - { \msg_aux_show:x { > true } } - { \msg_aux_show:x { > false } } + { \__msg_show_variable:x { > true } } + { \__msg_show_variable:x { > false } } } \cs_generate_variant:Nn \bool_show:N { c } % \end{macrocode} % \end{macro} % -% \begin{variable}{\l_tmpa_bool, \g_tmpa_bool} +% \begin{variable}{\l_tmpa_bool, \l_tmpb_bool, \g_tmpa_bool, \g_tmpb_bool} % A few booleans just if you need them. % \begin{macrocode} \bool_new:N \l_tmpa_bool +\bool_new:N \l_tmpb_bool \bool_new:N \g_tmpa_bool +\bool_new:N \g_tmpb_bool % \end{macrocode} % \end{variable} % @@ -956,36 +839,12 @@ % % \begin{macro}[pTF]{\bool_if:n} % \UnitTested -% \begin{macro}[aux]{\bool_get_next:N} -% \begin{macro}[aux]{\bool_cleanup:N} -% \begin{macro}[aux]{\bool_choose:NN} -% \begin{macro}[aux] -% { -% bool_!:w, -% \bool_Not:w, -% \bool_Not:w, -% \bool_(:w, -% \bool_p:w, -% \bool_8_1:w, -% \bool_I_1:w, -% \bool_8_0:w, -% \bool_I_0:w, -% \bool_)_0:w, -% \bool_)_1:w, -% \bool_S_0:w, -% \bool_S_1:w -% } -% \begin{macro}[aux] -% { -% \bool_eval_skip_to_end:Nw, \bool_eval_skip_to_end_aux:Nw, -% \bool_eval_skip_to_end_aux_ii:Nw -% } -% Evaluating the truth value of a list of predicates is done using -% an input syntax somewhat similar to the one found in other -% programming languages with |(| and |)| for grouping, |!| for -% logical \enquote{Not}, |&&| for logical \enquote{And} and \verb"||" -% for logical \enquote{Or}. We shall use the terms Not, And, Or, Open and -% Close for these operations. +% Evaluating the truth value of a list of predicates is done using an +% input syntax somewhat similar to the one found in other programming +% languages with |(| and |)| for grouping, |!| for logical +% \enquote{Not}, |&&| for logical \enquote{And} and \verb"||" for +% logical \enquote{Or}. We shall use the terms Not, And, Or, Open and +% Close for these operations. % % Any expression is terminated by a Close operation. Evaluation % happens from left to right in the following manner using a GetNext @@ -993,16 +852,18 @@ % \begin{itemize} % \item If an Open is seen, start evaluating a new expression using % the Eval function and call GetNext again. -% \item If a Not is seen, insert a negating function (if-even in -% this case) and call GetNext. -% \item If none of the above, start evaluating a new expression by -% reinserting the token found (this is supposed to be a predicate -% function) in front of Eval. +% \item If a Not is seen, remove the |!| and call a GetNotNext +% function, which eventually reverses the logic compared to +% GetNext. +% \item If none of the above, reinsert the token found (this is +% supposed to be a predicate function) in front of an Eval +% function, which evaluates it to the boolean value \meta{true} or +% \meta{false}. % \end{itemize} % The Eval function then contains a post-processing operation which -% grabs the instruction following the predicate. This is either And, -% Or or Close. In each case the truth value is used to determine -% where to go next. The following situations can arise: +% grabs the instruction following the predicate. This is either And, +% Or or Close. In each case the truth value is used to determine +% where to go next. The following situations can arise: % \begin{description} % \item[\meta{true}And] Current truth value is true, logical And % seen, continue with GetNext to examine truth value of next @@ -1021,8 +882,8 @@ % \item[\meta{false}Close] Current truth value is false, Close % seen, return \meta{false}. % \end{description} -% We introduce an additional Stop operation with the following -% semantics: +% We introduce an additional Stop operation with the same +% semantics as the Close operation. % \begin{description} % \item[\meta{true}Stop] Current truth value is true, return % \meta{true}. @@ -1030,17 +891,6 @@ % \meta{false}. % \end{description} % The reasons for this follow below. -% -% Now for how these works in practice. The canonical true and false -% values have numerical values $1$ and $0$ respectively. We evaluate -% this using the primitive |\int_value:w:D| operation. First we -% issue a |\group_align_safe_begin:| as we are using |&&| as syntax -% shorthand for the And operation and we need to hide it for \TeX{}. -% We also need to finish this special group before finally -% returning a |\c_true_bool| or |\c_false_bool| as there might -% otherwise be something left in front in the input stream. For -% this we call the Stop operation, denoted simply by a |S| -% following the last Close operation. % \begin{macrocode} \prg_new_conditional:Npnn \bool_if:n #1 { T , F , TF } { @@ -1050,178 +900,195 @@ \prg_return_false: \fi: } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[EXP]{\bool_if_p:n} +% \begin{macro}[EXP, aux] +% { +% \@@_if_left_parentheses:wwwn , +% \@@_if_right_parentheses:wwwn , +% \@@_if_or:wwwn +% } +% First issue a \cs{group_align_safe_begin:} as we are using |&&| +% as syntax shorthand for the And operation and we need to hide it for +% \TeX{}. This will be closed at the end of the expression parsing +% (see |S| below). +% +% Minimal (\enquote{short-circuit}) evaluation of boolean expressions +% requires skipping to the end of the current parenthesized group when +% \meta{true}\verb"||" is seen, but to the next \verb"||" or closing +% parenthesis when \meta{false}|&&| is seen. To avoid having separate +% functions for the two cases, we transform the boolean expression by +% doubling each parenthesis and adding parenthesis around each +% \verb"||". This ensures that |&&| will bind tighter than \verb"||". +% +% The replacement is done in three passes, for left and right +% parentheses and for \verb"||". At each pass, the part of the +% expression that has been transformed is stored before \cs{q_nil}, +% the rest lies until the first \cs{q_mark}, followed by an empty +% brace group. A trailing marker ensures that the auxiliaries' +% delimited arguments will not run-away. As long as the delimiter +% matches inside the expression, material is moved before \cs{q_nil} +% and we continue. Afterwards, the trailing marker is taken as a +% delimiter, |#4| is the next auxiliary, immediately followed by a new +% \cs{q_nil} delimiter, which indicates that nothing has been treated +% at this pass. The last step calls \cs{@@_if_parse:NNNww} which +% cleans up and triggers the evaluation of the expression itself. +% \begin{macrocode} \cs_new:Npn \bool_if_p:n #1 { \group_align_safe_begin: - \bool_get_next:N ( #1 ) S + \@@_if_left_parentheses:wwwn \q_nil + #1 \q_mark { } + ( \q_mark { \@@_if_right_parentheses:wwwn \q_nil } + ) \q_mark { \@@_if_or:wwwn \q_nil } + || \q_mark \@@_if_parse:NNNww + \q_stop } +\cs_new:Npn \@@_if_left_parentheses:wwwn #1 \q_nil #2 ( #3 \q_mark #4 + { #4 \@@_if_left_parentheses:wwwn #1 #2 (( \q_nil #3 \q_mark {#4} } +\cs_new:Npn \@@_if_right_parentheses:wwwn #1 \q_nil #2 ) #3 \q_mark #4 + { #4 \@@_if_right_parentheses:wwwn #1 #2 )) \q_nil #3 \q_mark {#4} } +\cs_new:Npn \@@_if_or:wwwn #1 \q_nil #2 || #3 \q_mark #4 + { #4 \@@_if_or:wwwn #1 #2 )||( \q_nil #3 \q_mark {#4} } % \end{macrocode} -% The GetNext operation. We make it a switch: If not a |!| or |(|, we -% assume it is a predicate. +% \end{macro} +% \end{macro} +% +% \begin{macro}[EXP, aux]{\@@_if_parse:NNNww} +% After removing extra tokens from the transformation phase, start +% evaluating. At the end, we will need to finish the special +% \texttt{align_safe} group before finally +% returning a \cs{c_true_bool} or \cs{c_false_bool} as there might +% otherwise be something left in front in the input stream. For this +% we call the Stop operation, denoted simply by a |S| following the +% last Close operation. % \begin{macrocode} -\cs_new:Npn \bool_get_next:N #1 +\cs_new:Npn \@@_if_parse:NNNww #1#2#3#4 \q_mark #5 \q_stop { - \use:c - { - bool_ - \if_meaning:w !#1 ! \else: \if_meaning:w (#1 ( \else: p \fi: \fi: - :w - } - #1 + \__bool_get_next:NN \use_i:nn (( #4 )) S } % \end{macrocode} -% This variant gets called when a Not has just been entered. -% It (eventually) results in a reversal of the logic of the directly -% following material. +% \end{macro} +% +% \begin{macro}[aux]{\@@_get_next:NN} +% The GetNext operation. This is a switch: if what follows is neither +% |!| nor |(|, we assume it is a predicate. The first argument is +% \cs{use_ii:nn} if the logic must eventually be reversed (after a +% |!|), otherwise it is \cs{use_i:nn}. This function eventually +% expand to the truth value \cs{c_true_bool} or \cs{c_false_bool} of +% the expression which follows until the next unmatched closing +% parenthesis. % \begin{macrocode} -\cs_new:Npn \bool_get_not_next:N #1 +\cs_new:Npn \@@_get_next:NN #1#2 { \use:c { - bool_not_ - \if_meaning:w !#1 ! \else: \if_meaning:w (#1 ( \else: p \fi: \fi: - :w + @@_ + \if_meaning:w !#2 ! \else: \if_meaning:w (#2 ( \else: p \fi: \fi: + :Nw } - #1 - } -% \end{macrocode} -% We need these later on to nullify the unity operation |!!|. -% \begin{macrocode} -\cs_new:Npn \bool_get_next:NN #1#2 { \bool_get_next:N #2 } -\cs_new:Npn \bool_get_not_next:NN #1#2 { \bool_get_not_next:N #2 } -% \end{macrocode} -% The Not operation. Discard the token read and reverse the truth -% value of the next expression if there -% are brackets; otherwise -% if we're coming up to a |!| then we don't need to reverse anything -% (but we then want to continue scanning ahead in case some fool has written -% |!!(...)|); -% otherwise we have a boolean that we can reverse here and now. -% \begin{macrocode} -\cs_new:cpn { bool_!:w } #1#2 - { - \if_meaning:w ( #2 - \exp_after:wN \bool_Not:w - \else: - \if_meaning:w ! #2 - \exp_after:wN \exp_after:wN \exp_after:wN \bool_get_next:NN - \else: - \exp_after:wN \exp_after:wN \exp_after:wN \bool_Not:N - \fi: - \fi: - #2 - } -% \end{macrocode} -% Variant called when already inside a Not. -% Essentially the opposite of the above. -% \begin{macrocode} -\cs_new:cpn { bool_not_!:w } #1#2 - { - \if_meaning:w ( #2 - \exp_after:wN \bool_not_Not:w - \else: - \if_meaning:w ! #2 - \exp_after:wN \exp_after:wN \exp_after:wN \bool_get_not_next:NN - \else: - \exp_after:wN \exp_after:wN \exp_after:wN \bool_not_Not:N - \fi: - \fi: - #2 + #1 #2 } % \end{macrocode} -% These occur when processing |!(...)|. The idea is to use a variant -% of |\bool_get_next:N| that finishes its parsing with a logic reversal. -% Of course, the double logic reversal gets us back to where we started. +% \end{macro} +% +% \begin{macro}[aux]{\@@_!:Nw} +% The Not operation reverses the logic: discard the |!| token and call +% the GetNext operation with its first argument reversed. % \begin{macrocode} -\cs_new:Npn \bool_Not:w { \exp_after:wN \int_value:w \bool_get_not_next:N } -\cs_new:Npn \bool_not_Not:w { \exp_after:wN \int_value:w \bool_get_next:N } +\cs_new:cpn { @@_!:Nw } #1#2 + { \exp_after:wN \@@_get_next:NN #1 \use_ii:nn \use_i:nn } % \end{macrocode} -% These occur when processing |!<bool>| and can be evaluated directly. +% \end{macro} +% +% \begin{macro}[aux]{\@@_(:Nw} +% The Open operation starts a sub-expression after discarding the +% token. This is done by calling GetNext, with a post-processing step +% which looks for And, Or or Close afterwards. % \begin{macrocode} -\cs_new:Npn \bool_Not:N #1 +\cs_new:cpn { @@_(:Nw } #1#2 { - \exp_after:wN \bool_p:w - \if_meaning:w #1 \c_true_bool - \c_false_bool - \else: - \c_true_bool - \fi: + \exp_after:wN \@@_choose:NNN \exp_after:wN #1 + \__int_value:w \@@_get_next:NN \use_i:nn } -\cs_new:Npn \bool_not_Not:N #1 - { - \exp_after:wN \bool_p:w - \if_meaning:w #1 \c_true_bool - \c_true_bool - \else: - \c_false_bool - \fi: - } -% \end{macrocode} -% The Open operation. Discard the token read and start a -% sub-expression. -% |\bool_get_next:N| continues building up the logical expressions as usual; -% |\bool_not_cleanup:N| is what reverses the logic if we're inside |!(...)|. -% \begin{macrocode} -\cs_new:cpn { bool_(:w } #1 - { \exp_after:wN \bool_cleanup:N \int_value:w \bool_get_next:N } -\cs_new:cpn { bool_not_(:w } #1 - { \exp_after:wN \bool_not_cleanup:N \int_value:w \bool_get_next:N } % \end{macrocode} -% Otherwise just evaluate the predicate and look for And, Or or Close -% afterwards. +% \end{macro} +% +% \begin{macro}[aux]{\@@_p:Nw} +% If what follows GetNext is neither |!| nor |(|, evaluate the +% predicate using the primitive \cs{__int_value:w}. The canonical +% true and false values have numerical values $1$ and $0$ +% respectively. Look for And, Or or Close afterwards. % \begin{macrocode} -\cs_new:cpn { bool_p:w } { \exp_after:wN \bool_cleanup:N \int_value:w } -\cs_new:cpn { bool_not_p:w } {\exp_after:wN \bool_not_cleanup:N \int_value:w } +\cs_new:cpn { @@_p:Nw } #1 + { \exp_after:wN \@@_choose:NNN \exp_after:wN #1 \__int_value:w } % \end{macrocode} -% This cleanup function can be omitted once predicates return their -% true/false booleans outside the conditionals. +% \end{macro} +% +% \begin{macro}[aux]{\@@_choose:NNN} +% Branching the eight-way switch. The arguments are 1: \cs{use_i:nn} +% or \cs{use_ii:nn}, 2: $0$ or $1$ encoding the current truth value, +% 3: the next operation, And, Or, Close or Stop. If |#1| is +% \cs{use_ii:nn}, the logic of |#2| must be reversed. % \begin{macrocode} -\cs_new:Npn \bool_cleanup:N #1 +\cs_new:Npn \@@_choose:NNN #1#2#3 { - \exp_after:wN \bool_choose:NN \exp_after:wN #1 - \int_to_roman:w - `\q - } -\cs_new:Npn \bool_not_cleanup:N #1 - { - \exp_after:wN \bool_not_choose:NN \exp_after:wN #1 - \int_to_roman:w - `\q + \use:c + { + @@_ #3 _ + #1 #2 { \if_meaning:w 0 #2 1 \else: 0 \fi: } + :w + } } % \end{macrocode} -% Branching the six way switch. -% Reversals should be reasonably straightforward. -% \begin{macrocode} -\cs_new:Npn \bool_choose:NN #1#2 { \use:c { bool_ #2 _ #1 :w } } -\cs_new:Npn \bool_not_choose:NN #1#2 { \use:c { bool_not_ #2 _ #1 :w } } -% \end{macrocode} -% Continues scanning. Must remove the second "&" or \verb"|". -% \begin{macrocode} -\cs_new_nopar:cpn { bool_&_1:w } & { \bool_get_next:N } -\cs_new_nopar:cpn { bool_|_0:w } | { \bool_get_next:N } -\cs_new_nopar:cpn { bool_not_&_0:w } & { \bool_get_next:N } -\cs_new_nopar:cpn { bool_not_|_1:w } | { \bool_get_next:N } -% \end{macrocode} +% \end{macro} +% +% \begin{macro}[aux] +% { +% \@@_)_0:w, +% \@@_)_1:w, +% \@@_S_0:w, +% \@@_S_1:w, +% } % Closing a group is just about returning the result. The Stop % operation is similar except it closes the special alignment group % before returning the boolean. % \begin{macrocode} -\cs_new_nopar:cpn { bool_)_0:w } { \c_false_bool } -\cs_new_nopar:cpn { bool_)_1:w } { \c_true_bool } -\cs_new_nopar:cpn { bool_not_)_0:w } { \c_true_bool } -\cs_new_nopar:cpn { bool_not_)_1:w } { \c_false_bool } -\cs_new_nopar:cpn { bool_S_0:w } { \group_align_safe_end: \c_false_bool } -\cs_new_nopar:cpn { bool_S_1:w } { \group_align_safe_end: \c_true_bool } +\cs_new_nopar:cpn { @@_)_0:w } { \c_false_bool } +\cs_new_nopar:cpn { @@_)_1:w } { \c_true_bool } +\cs_new_nopar:cpn { @@_S_0:w } { \group_align_safe_end: \c_false_bool } +\cs_new_nopar:cpn { @@_S_1:w } { \group_align_safe_end: \c_true_bool } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[aux]+\@@_&_1:w+ +% \begin{macro}[aux]+\@@_|_0:w+ +% Two cases where we simply continue scanning. We must remove the +% second "&" or \verb"|". +% \begin{macrocode} +\cs_new_nopar:cpn { @@_&_1:w } & { \@@_get_next:NN \use_i:nn } +\cs_new_nopar:cpn { @@_|_0:w } | { \@@_get_next:NN \use_i:nn } % \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}[aux]+\@@_&_0:w+ +% \begin{macro}[aux]+\@@_|_1:w+ +% \begin{macro}[aux] +% { +% \@@_eval_skip_to_end:Nw, +% \@@_eval_skip_to_end_ii:Nw, +% \@@_eval_skip_to_end_iii:Nw +% } % When the truth value has already been decided, we have to throw away % the remainder of the current group as we are doing minimal % evaluation. This is slightly tricky as there are no braces so we % have to play match the |()| manually. % \begin{macrocode} -\cs_new_nopar:cpn { bool_&_0:w } & { \bool_eval_skip_to_end:Nw \c_false_bool } -\cs_new_nopar:cpn { bool_|_1:w } | { \bool_eval_skip_to_end:Nw \c_true_bool } -\cs_new_nopar:cpn { bool_not_&_1:w } & - { \bool_eval_skip_to_end:Nw \c_false_bool } -\cs_new_nopar:cpn { bool_not_|_0:w } | - { \bool_eval_skip_to_end:Nw \c_true_bool } +\cs_new_nopar:cpn { @@_&_0:w } & { \@@_eval_skip_to_end:Nw \c_false_bool } +\cs_new_nopar:cpn { @@_|_1:w } | { \@@_eval_skip_to_end:Nw \c_true_bool } % \end{macrocode} % There is always at least one |)| waiting, namely the outer % one. However, we are facing the problem that there may be more than @@ -1275,9 +1142,9 @@ % finally close the group nicely. % \begin{macrocode} %% ( -\cs_new:Npn \bool_eval_skip_to_end:Nw #1#2 ) +\cs_new:Npn \@@_eval_skip_to_end:Nw #1#2 ) { - \bool_eval_skip_to_end_aux:Nw #1#2 ( % ) + \@@_eval_skip_to_end_ii:Nw #1#2 ( % ) \q_no_value \q_stop {#2} } @@ -1286,31 +1153,29 @@ % the boolean |#1|. If there is, we need to grab a |()| pair and then % recurse % \begin{macrocode} -\cs_new:Npn \bool_eval_skip_to_end_aux:Nw #1#2 ( #3#4 \q_stop #5 % ) +\cs_new:Npn \@@_eval_skip_to_end_ii:Nw #1#2 ( #3#4 \q_stop #5 % ) { \quark_if_no_value:NTF #3 {#1} - { \bool_eval_skip_to_end_aux_ii:Nw #1 #5 } + { \@@_eval_skip_to_end_iii:Nw #1 #5 } } % \end{macrocode} % Keep the boolean, throw away anything up to the |(| as it is % irrelevant, remove a |()| pair but remember to reinsert |#3| as it may % contain |(| tokens! % \begin{macrocode} -\cs_new:Npn \bool_eval_skip_to_end_aux_ii:Nw #1#2 ( #3 ) +\cs_new:Npn \@@_eval_skip_to_end_iii:Nw #1#2 ( #3 ) { % ( - \bool_eval_skip_to_end:Nw #1#3 ) + \@@_eval_skip_to_end:Nw #1#3 ) } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} -% \end{macro} -% \end{macro} % % \begin{macro}{\bool_not_p:n} % \UnitTested -% The Not variant just reverses the outcome of |\bool_if_p:n|. Can +% The Not variant just reverses the outcome of \cs{bool_if_p:n}. Can % be optimized but this is nice and simple and according to the % implementation plan. Not even particularly useful to have it when % the infix notation is easier to use. @@ -1410,156 +1275,42 @@ % \end{macrocode} % \end{macro} % -% \subsection{Switching by case} -% -% A family of functions to select one case of a number: the same ideas -% are used for a number of different situations. -% -% \begin{macro}[aux]{\prg_case_end:nw} -% In all cases the end statement is the same. Here, |#1| will be the -% code needed, |#2| the other cases to throw away, including the -% \enquote{else} case. The \cs{c_zero} marker stops the expansion of -% \tn{romannumeral} which begins each \cs{prg_case_...} function. -% \begin{macrocode} -\cs_new:Npn \prg_case_end:nw #1 #2 \q_recursion_stop { \c_zero #1 } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\prg_case_int:nnn} -% \UnitTested -% \begin{macro}[aux]{\prg_case_int_aux:nnn,\prg_case_int_aux:nw} -% For integer cases, the first task to fully expand the check -% condition. After that, a loop is started to compare each possible -% value and stop if the test is true. The tested value is put at the -% end to ensure that there is necessarily a match, which will fire the -% \enquote{else} pathway. The leading \tn{romannumeral} triggers an -% expansion which is then stopped in \cs{prg_case_end:nw}. -% \begin{macrocode} -\cs_new:Npn \prg_case_int:nnn #1 - { - \tex_romannumeral:D - \exp_args:Nf \prg_case_int_aux:nnn { \int_eval:n {#1} } - } -\cs_new:Npn \prg_case_int_aux:nnn #1 #2 #3 - { \prg_case_int_aux:nw {#1} #2 {#1} {#3} \q_recursion_stop } -\cs_new:Npn \prg_case_int_aux:nw #1#2#3 - { - \int_compare:nNnTF {#1} = {#2} - { \prg_case_end:nw {#3} } - { \prg_case_int_aux:nw {#1} } - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\prg_case_dim:nnn} -% \UnitTested -% \begin{macro}[aux]{\prg_case_dim_aux:nnn,\prg_case_dim_aux:nw} -% The dimension function is the same, just a change of calculation -% method. -% \begin{macrocode} -\cs_new:Npn \prg_case_dim:nnn #1 - { - \tex_romannumeral:D - \exp_args:Nf \prg_case_dim_aux:nnn { \dim_eval:n {#1} } - } -\cs_new:Npn \prg_case_dim_aux:nnn #1 #2 #3 - { \prg_case_dim_aux:nw {#1} #2 {#1} {#3} \q_recursion_stop } -\cs_new:Npn \prg_case_dim_aux:nw #1#2#3 - { - \dim_compare:nNnTF {#1} = {#2} - { \prg_case_end:nw {#3} } - { \prg_case_dim_aux:nw {#1} } - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\prg_case_str:nnn, \prg_case_str:onn, \prg_case_str:xxn} -% \UnitTested -% \begin{macro}[aux]{\prg_case_str_aux:nw, \prg_case_str_x_aux:nw} -% No calculations for strings, otherwise no surprises. -% \begin{macrocode} -\cs_new:Npn \prg_case_str:nnn #1#2#3 - { - \tex_romannumeral:D - \prg_case_str_aux:nw {#1} #2 {#1} {#3} \q_recursion_stop - } -\cs_new:Npn \prg_case_str_aux:nw #1#2#3 - { - \str_if_eq:nnTF {#1} {#2} - { \prg_case_end:nw {#3} } - { \prg_case_str_aux:nw {#1} } - } -\cs_generate_variant:Nn \prg_case_str:nnn { o } -\cs_new:Npn \prg_case_str:xxn #1#2#3 - { - \tex_romannumeral:D - \prg_case_str_x_aux:nw {#1} #2 {#1} {#3} \q_recursion_stop - } -\cs_new:Npn \prg_case_str_x_aux:nw #1#2#3 - { - \str_if_eq:xxTF {#1} {#2} - { \prg_case_end:nw {#3} } - { \prg_case_str_x_aux:nw {#1} } - } -% \end{macrocode} -% \end{macro} -% \end{macro} +% \subsection{Producing $n$ copies} % -% \begin{macro}{\prg_case_tl:Nnn, \prg_case_tl:cnn} -% \UnitTested -% \begin{macro}[aux]{\prg_case_tl_aux:Nw} -% Similar again, but this time with some variants. % \begin{macrocode} -\cs_new:Npn \prg_case_tl:Nnn #1#2#3 - { - \tex_romannumeral:D - \prg_case_tl_aux:Nw #1 #2 #1 {#3} \q_recursion_stop - } -\cs_new:Npn \prg_case_tl_aux:Nw #1#2#3 - { - \tl_if_eq:NNTF #1 #2 - { \prg_case_end:nw {#3} } - { \prg_case_tl_aux:Nw #1 } - } -\cs_generate_variant:Nn \prg_case_tl:Nnn { c } +%<@@=prg> % \end{macrocode} -% \end{macro} -% \end{macro} -% -% \subsection{Producing $n$ copies} % % \begin{macro}{\prg_replicate:nn} % \UnitTested -% \begin{macro}[aux]{\prg_replicate_aux:N, \prg_replicate_first_aux:N} -% \begin{macro}[aux]{\prg_replicate_} +% \begin{macro}[aux]{\@@_replicate:N, \@@_replicate_first:N} +% \begin{macro}[aux]{\@@_replicate_} % \begin{macro}[aux] % { -% \prg_replicate_0:n, -% \prg_replicate_1:n, -% \prg_replicate_2:n, -% \prg_replicate_3:n, -% \prg_replicate_4:n, -% \prg_replicate_5:n, -% \prg_replicate_6:n, -% \prg_replicate_7:n, -% \prg_replicate_8:n, -% \prg_replicate_9:n +% \@@_replicate_0:n, +% \@@_replicate_1:n, +% \@@_replicate_2:n, +% \@@_replicate_3:n, +% \@@_replicate_4:n, +% \@@_replicate_5:n, +% \@@_replicate_6:n, +% \@@_replicate_7:n, +% \@@_replicate_8:n, +% \@@_replicate_9:n % } % \begin{macro}[aux] % { -% \prg_replicate_first_-:n, -% \prg_replicate_first_0:n, -% \prg_replicate_first_1:n, -% \prg_replicate_first_2:n, -% \prg_replicate_first_3:n, -% \prg_replicate_first_4:n, -% \prg_replicate_first_5:n, -% \prg_replicate_first_6:n, -% \prg_replicate_first_7:n, -% \prg_replicate_first_8:n, -% \prg_replicate_first_9:n +% \@@_replicate_first_-:n, +% \@@_replicate_first_0:n, +% \@@_replicate_first_1:n, +% \@@_replicate_first_2:n, +% \@@_replicate_first_3:n, +% \@@_replicate_first_4:n, +% \@@_replicate_first_5:n, +% \@@_replicate_first_6:n, +% \@@_replicate_first_7:n, +% \@@_replicate_first_8:n, +% \@@_replicate_first_9:n % } % This function uses a cascading csname technique by David Kastrup % (who else :-) @@ -1577,7 +1328,7 @@ % to avoid the last function to insert say, $100$ copies of the original % argument just to gobble them again we define separate functions to % be inserted first. These functions also close the expansion of -% \cs{int_to_roman:w}, which ensures that \cs{prg_replicate:nn} only +% \cs{__int_to_roman:w}, which ensures that \cs{prg_replicate:nn} only % requires two steps of expansion. % % This function has one flaw though: Since it constantly passes down @@ -1587,144 +1338,67 @@ % necessary, it is possible to write % |\prg_replicate:nn{1000}{\prg_replicate:nn{1000}{|\meta{code}|}}|. An % alternative approach is to create a string of |m|'s with -% \cs{int_to_roman:w} which can be done with just four macros but that +% \cs{__int_to_roman:w} which can be done with just four macros but that % method has its own problems since it can exhaust the string % pool. Also, it is considerably slower than what we use here so the % few extra csnames are well spent I would say. % \begin{macrocode} \cs_new:Npn \prg_replicate:nn #1 { - \int_to_roman:w - \exp_after:wN \prg_replicate_first_aux:N - \int_value:w \int_eval:w #1 \int_eval_end: + \__int_to_roman:w + \exp_after:wN \@@_replicate_first:N + \__int_value:w \__int_eval:w #1 \__int_eval_end: \cs_end: } -\cs_new:Npn \prg_replicate_aux:N #1 - { \cs:w prg_replicate_#1 :n \prg_replicate_aux:N } -\cs_new:Npn \prg_replicate_first_aux:N #1 - { \cs:w prg_replicate_first_ #1 :n \prg_replicate_aux:N } +\cs_new:Npn \@@_replicate:N #1 + { \cs:w @@_replicate_#1 :n \@@_replicate:N } +\cs_new:Npn \@@_replicate_first:N #1 + { \cs:w @@_replicate_first_ #1 :n \@@_replicate:N } % \end{macrocode} -% Then comes all the functions that do the hard work of inserting all -% the copies. +% Then comes all the functions that do the hard work of inserting all +% the copies. The first function takes |:n| as a parameter. % \begin{macrocode} -\cs_new:Npn \prg_replicate_ :n #1 { \cs_end: } -\cs_new:cpn { prg_replicate_0:n } #1 { \cs_end: {#1#1#1#1#1#1#1#1#1#1} } -\cs_new:cpn { prg_replicate_1:n } #1 { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1 } -\cs_new:cpn { prg_replicate_2:n } #1 { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1#1 } -\cs_new:cpn { prg_replicate_3:n } #1 +\cs_new:Npn \@@_replicate_ :n #1 { \cs_end: } +\cs_new:cpn { @@_replicate_0:n } #1 { \cs_end: {#1#1#1#1#1#1#1#1#1#1} } +\cs_new:cpn { @@_replicate_1:n } #1 { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1 } +\cs_new:cpn { @@_replicate_2:n } #1 { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1#1 } +\cs_new:cpn { @@_replicate_3:n } #1 { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1#1#1 } -\cs_new:cpn { prg_replicate_4:n } #1 +\cs_new:cpn { @@_replicate_4:n } #1 { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1#1#1#1 } -\cs_new:cpn { prg_replicate_5:n } #1 +\cs_new:cpn { @@_replicate_5:n } #1 { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1#1#1#1#1 } -\cs_new:cpn { prg_replicate_6:n } #1 +\cs_new:cpn { @@_replicate_6:n } #1 { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1#1#1#1#1#1 } -\cs_new:cpn { prg_replicate_7:n } #1 +\cs_new:cpn { @@_replicate_7:n } #1 { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1#1#1#1#1#1#1 } -\cs_new:cpn { prg_replicate_8:n } #1 +\cs_new:cpn { @@_replicate_8:n } #1 { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1#1#1#1#1#1#1#1 } -\cs_new:cpn { prg_replicate_9:n } #1 +\cs_new:cpn { @@_replicate_9:n } #1 { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1#1#1#1#1#1#1#1#1 } % \end{macrocode} % Users shouldn't ask for something to be replicated once or even % not at all but\dots % \begin{macrocode} -\cs_new:cpn { prg_replicate_first_-:n } #1 - { \c_zero \msg_expandable_kernel_error:nn { prg } { replicate-neg } } -\cs_new:cpn { prg_replicate_first_0:n } #1 { \c_zero } -\cs_new:cpn { prg_replicate_first_1:n } #1 { \c_zero #1 } -\cs_new:cpn { prg_replicate_first_2:n } #1 { \c_zero #1#1 } -\cs_new:cpn { prg_replicate_first_3:n } #1 { \c_zero #1#1#1 } -\cs_new:cpn { prg_replicate_first_4:n } #1 { \c_zero #1#1#1#1 } -\cs_new:cpn { prg_replicate_first_5:n } #1 { \c_zero #1#1#1#1#1 } -\cs_new:cpn { prg_replicate_first_6:n } #1 { \c_zero #1#1#1#1#1#1 } -\cs_new:cpn { prg_replicate_first_7:n } #1 { \c_zero #1#1#1#1#1#1#1 } -\cs_new:cpn { prg_replicate_first_8:n } #1 { \c_zero #1#1#1#1#1#1#1#1 } -\cs_new:cpn { prg_replicate_first_9:n } #1 { \c_zero #1#1#1#1#1#1#1#1#1 } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\prg_stepwise_function:nnnN} -% \begin{macro}[aux]{\prg_stepwise_aux:nnnN} -% \begin{macro}[aux]{\prg_stepwise_aux:NnnnN} -% Repeating a function by steps first needs a check on the direction -% of the steps. After that, do the function for the start value -% then step and loop around. It would be more symmetrical to test -% for a step size of zero before checking the sign, but we optimize -% for the most frequent case (positive step). -% \begin{macrocode} -\cs_new:Npn \prg_stepwise_function:nnnN #1#2#3#4 +\cs_new:cpn { @@_replicate_first_-:n } #1 { - \prg_stepwise_aux:nnnN {#1} {#2} {#3} #4 - \prg_break_point:n { } - } -\cs_new:Npn \prg_stepwise_aux:nnnN #1#2#3#4 - { - \int_compare:nNnTF {#2} > \c_zero - { \exp_args:NNf \prg_stepwise_aux:NnnnN > } - { - \int_compare:nNnTF {#2} = \c_zero - { - \msg_expandable_kernel_error:nnn { prg } { zero-step } {#4} - \prg_map_break: - } - { \exp_args:NNf \prg_stepwise_aux:NnnnN < } - } - { \int_eval:n {#1} } {#2} {#3} #4 - } -\cs_new:Npn \prg_stepwise_aux:NnnnN #1#2#3#4#5 - { - \int_compare:nNnF {#2} #1 {#4} - { - #5 {#2} - \exp_args:NNf \prg_stepwise_aux:NnnnN - #1 { \int_eval:n { #2 + #3 } } {#3} {#4} #5 - } + \c_zero + \__msg_kernel_expandable_error:nn { kernel } { negative-replication } } +\cs_new:cpn { @@_replicate_first_0:n } #1 { \c_zero } +\cs_new:cpn { @@_replicate_first_1:n } #1 { \c_zero #1 } +\cs_new:cpn { @@_replicate_first_2:n } #1 { \c_zero #1#1 } +\cs_new:cpn { @@_replicate_first_3:n } #1 { \c_zero #1#1#1 } +\cs_new:cpn { @@_replicate_first_4:n } #1 { \c_zero #1#1#1#1 } +\cs_new:cpn { @@_replicate_first_5:n } #1 { \c_zero #1#1#1#1#1 } +\cs_new:cpn { @@_replicate_first_6:n } #1 { \c_zero #1#1#1#1#1#1 } +\cs_new:cpn { @@_replicate_first_7:n } #1 { \c_zero #1#1#1#1#1#1#1 } +\cs_new:cpn { @@_replicate_first_8:n } #1 { \c_zero #1#1#1#1#1#1#1#1 } +\cs_new:cpn { @@_replicate_first_9:n } #1 { \c_zero #1#1#1#1#1#1#1#1#1 } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} -% -% \begin{macro}{\prg_stepwise_inline:nnnn} -% \begin{macro}{\prg_stepwise_variable:nnnNn} -% \UnitTested -% \begin{macro}[aux]{\prg_stepwise_aux:NNnnnn} -% The approach here is to build a function, with a global integer required -% to make the nesting safe (as seen in other in line functions), -% and map that function using \cs{prg_stepwise_function:nnnN}. -% \begin{macrocode} -\cs_new_protected:Npn \prg_stepwise_inline:nnnn - { - \exp_args:NNc \prg_stepwise_aux:NNnnnn - \cs_gset_nopar:Npn - { g_prg_stepwise_ \int_use:N \g_prg_map_int :n } - } -\cs_new_protected:Npn \prg_stepwise_variable:nnnNn #1#2#3#4#5 - { - \exp_args:NNc \prg_stepwise_aux:NNnnnn - \cs_gset_nopar:Npx - { g_prg_stepwise_ \int_use:N \g_prg_map_int :n } - {#1}{#2}{#3} - { - \tl_set:Nn \exp_not:N #4 {##1} - \exp_not:n {#5} - } - } -\cs_new_protected:Npn \prg_stepwise_aux:NNnnnn #1#2#3#4#5#6 - { - #1 #2 ##1 {#6} - \int_gincr:N \g_prg_map_int - \prg_stepwise_aux:nnnN {#3} {#4} {#5} #2 - \prg_break_point:n { \int_gdecr:N \g_prg_map_int } - } -% \end{macrocode} -% \end{macro} % \end{macro} % \end{macro} % @@ -1735,7 +1409,7 @@ % For testing vertical mode. Strikes me here on the bus with David, % that as long as we are just talking about returning true and % false states, we can just use the primitive conditionals for this -% and gobbling the |\c_zero| in the input stream. However this +% and gobbling the \cs{c_zero} in the input stream. However this % requires knowledge of the implementation so we keep things nice % and clean and use the return statements. % \begin{macrocode} @@ -1779,13 +1453,13 @@ % \TeX{}'s alignment structures present many problems. As Knuth says % himself in \emph{\TeX : The Program}: \enquote{It's sort of a miracle % whenever \tn{halign} or \tn{valign} work, [\ldots]} One problem relates -% to commands that internally issues a |\cr| but also peek ahead for +% to commands that internally issues a \tn{cr} but also peek ahead for % the next character for use in, say, an optional argument. If the % next token happens to be a |&| with category code~4 we will get some % sort of weird error message because the underlying % \tn{futurelet} will store the token at the end of the alignment % template. This could be a |&|$_4$ giving a message like -% |! Misplaced \cr.| or even worse: it could be the |\endtemplate| +% |! Misplaced \cr.| or even worse: it could be the \tn{endtemplate} % token causing even more trouble! To solve this we have to open a % special group so that \TeX{} still thinks it's on safe ground but at % the same time we don't want to introduce any brace group that may @@ -1805,11 +1479,11 @@ % % \begin{macro}[int]{\scan_align_safe_stop:} % When \TeX{} is in the beginning of an align cell (right after the -% |\cr|) it is in a somewhat strange mode as it is looking ahead to +% \tn{cr}) it is in a somewhat strange mode as it is looking ahead to % find an \tn{omit} or \tn{noalign} and hasn't looked at the % preamble yet. Thus an \tn{ifmmode} test will always fail unless -% we insert |\scan_stop:| to stop \TeX{}'s scanning ahead. On the other -% hand we don't want to insert a |\scan_stop:| every time as that will +% we insert \cs{scan_stop:} to stop \TeX{}'s scanning ahead. On the other +% hand we don't want to insert a \cs{scan_stop:} every time as that will % destroy kerning between letters\footnote{Unless we enforce an extra % pass with an appropriate value of \tn{pretolerance}.} % Unfortunately there is no way to detect if we're in the beginning of @@ -1817,7 +1491,7 @@ % on column number, \emph{etc.} However we \emph{can} detect if we're in an % alignment cell by checking the current group type and we can also % check if the previous node was a character or ligature. What is done -% here is that |\scan_stop:| is only inserted if an only +% here is that \cs{scan_stop:} is only inserted if an only % if a)~we're in the outer part of an alignment cell and b)~the last node % \emph{wasn't} a char node or a ligature node. Thus an older definition % here was @@ -1842,47 +1516,51 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\prg_variable_get_scope:N} -% \begin{macro}[aux]{\prg_variable_get_scope_aux:w} -% \begin{macro}[int]{\prg_variable_get_type:N} -% \begin{macro}[aux]{\prg_variable_get_type:w} +% \begin{macrocode} +%<@@=prg> +% \end{macrocode} +% +% \begin{macro}[int]{\@@_variable_get_scope:N} +% \begin{macro}[aux]{\@@_variable_get_scope:w} +% \begin{macro}[int]{\@@_variable_get_type:N} +% \begin{macro}[aux]{\@@_variable_get_type:w} % Expandable functions to find the type of a variable, and to % return \texttt{g} if the variable is global. The trick for -% \cs{prg_variable_get_scope:N} is the same as that in -% \cs{cs_split_function:NN}, but it can be simplified as the +% \cs{@@_variable_get_scope:N} is the same as that in +% \cs{__cs_split_function:NN}, but it can be simplified as the % requirements here are less complex. % \begin{macrocode} \group_begin: - \tex_lccode:D `\& = `\g \scan_stop: - \tex_catcode:D `\& = \c_twelve + \tex_lccode:D `* = `g \scan_stop: + \tex_catcode:D `* = \c_twelve \tl_to_lowercase:n { \group_end: - \cs_new:Npn \prg_variable_get_scope:N #1 + \cs_new:Npn \@@_variable_get_scope:N #1 { \exp_after:wN \exp_after:wN - \exp_after:wN \prg_variable_get_scope_aux:w + \exp_after:wN \@@_variable_get_scope:w \cs_to_str:N #1 \exp_stop_f: \q_stop } - \cs_new:Npn \prg_variable_get_scope_aux:w #1#2 \q_stop - { \token_if_eq_meaning:NNT & #1 { g } } + \cs_new:Npn \@@_variable_get_scope:w #1#2 \q_stop + { \token_if_eq_meaning:NNT * #1 { g } } } \group_begin: - \tex_lccode:D `\& = `\_ \scan_stop: - \tex_catcode:D `\& = \c_twelve + \tex_lccode:D `* = `_ \scan_stop: + \tex_catcode:D `* = \c_twelve \tl_to_lowercase:n { \group_end: - \cs_new:Npn \prg_variable_get_type:N #1 + \cs_new:Npn \@@_variable_get_type:N #1 { - \exp_after:wN \prg_variable_get_type_aux:w - \token_to_str:N #1 & a \q_stop + \exp_after:wN \@@_variable_get_type:w + \token_to_str:N #1 * a \q_stop } - \cs_new:Npn \prg_variable_get_type_aux:w #1 & #2#3 \q_stop + \cs_new:Npn \@@_variable_get_type:w #1 * #2#3 \q_stop { \token_if_eq_meaning:NNTF a #2 {#1} - { \prg_variable_get_type_aux:w #2#3 \q_stop } + { \@@_variable_get_type:w #2#3 \q_stop } } } % \end{macrocode} @@ -1891,20 +1569,32 @@ % \end{macro} % \end{macro} % -% \begin{variable}{\g_prg_map_int} +% \begin{variable}{\g_@@_map_int} % A nesting counter for mapping. % \begin{macrocode} -\int_new:N \g_prg_map_int +\int_new:N \g_@@_map_int % \end{macrocode} % \end{variable} % -% \begin{macro}{\prg_break_point:n} -% \begin{macro}{\prg_map_break:} -% \begin{macro}{\prg_map_break:n} -% These are all defined in \pkg{l3basics}, as they are needed +% \begin{macro}{\@@_break_point:Nn} +% \begin{macro}{\@@_map_break:Nn} +% These are defined in \pkg{l3basics}, as they are needed % \enquote{early}. This is just a reminder that that is the case! % \end{macro} % \end{macro} +% +% \begin{macro}{\@@_break_point:} +% \begin{macro}{\@@_break:, \@@_break:n} +% Very simple analogs of \cs{@@_break_point:Nn} and +% \cs{@@_map_break:Nn}, for use in fast short-term recursions which +% are not mappings, do not need to support nesting, and in which +% nothing has to be done at the end of the loop. +% \begin{macrocode} +\cs_new_eq:NN \@@_break_point: \prg_do_nothing: +\cs_new:Npn \@@_break: #1 \@@_break_point: { } +\cs_new:Npn \@@_break:n #1#2 \@@_break_point: {#1} +% \end{macrocode} +% \end{macro} % \end{macro} % % \subsection{Deprecated functions} @@ -1939,6 +1629,7 @@ % by Bernd Raichle. Firstly we define the function for parsing the % initial list and then the braced list afterwards. % \begin{macrocode} +%<*deprecated> \cs_new_protected:Npn \prg_define_quicksort:nnn #1#2#3 { \cs_set:cpx{#1_quicksort:n}##1{ \exp_not:c{#1_quicksort_start_partition:w} ##1 @@ -1956,9 +1647,11 @@ \exp_not:N \quark_if_nil:nT {##1}\exp_not:N \use_none_delimit_by_q_stop:w \exp_not:c{#1_quicksort_do_partition_i_braced:nnnn} {##1}{}{} } +%</deprecated> % \end{macrocode} % Now for doing the partitions. % \begin{macrocode} +%<*deprecated> \cs_set:cpx {#1_quicksort_do_partition_i:nnnw} ##1##2##3 #2 ##4 #3 { \exp_not:N \quark_if_nil:nTF {##4} \exp_not:c {#1_do_quicksort_braced:nnnnw} { @@ -1995,10 +1688,12 @@ } {##1}{##2}{##3}{##4} } +%</deprecated> % \end{macrocode} % This part of the code handles the two branches in each % sorting. Again we will also have to do it braced. % \begin{macrocode} +%<*deprecated> \cs_set:cpx {#1_quicksort_partition_less_i:nnnn} ##1##2##3##4{ \exp_not:c{#1_quicksort_do_partition_i:nnnw}{##1}{##2}{{##4}##3}} \cs_set:cpx {#1_quicksort_partition_less_ii:nnnn} ##1##2##3##4{ @@ -2015,15 +1710,18 @@ \exp_not:c{#1_quicksort_do_partition_i_braced:nnnn}{##1}{{##4}##2}{##3}} \cs_set:cpx {#1_quicksort_partition_greater_ii_braced:nnnn} ##1##2##3##4{ \exp_not:c{#1_quicksort_do_partition_ii_braced:nnnn}{##1}{##2{##4}}{##3}} +%</deprecated> % \end{macrocode} % Finally, the big kahuna! This is where the sub-lists are sorted. % \begin{macrocode} +%<*deprecated> \cs_set:cpx {#1_do_quicksort_braced:nnnnw} ##1##2##3##4\q_stop { \exp_not:c{#1_quicksort_braced:n}{##2} \exp_not:c{#1_quicksort_function:n}{##1} \exp_not:c{#1_quicksort_braced:n}{##3} } } +%</deprecated> % \end{macrocode} % \end{macro} % @@ -2032,15 +1730,19 @@ % |\prg_quicksort_compare:nnTF| to compare items, and places the % function |\prg_quicksort_function:n| in front of each of them. % \begin{macrocode} +%<*deprecated> \prg_define_quicksort:nnn {prg}{}{} +%</deprecated> % \end{macrocode} % \end{macro} % % \begin{macro}{\prg_quicksort_function:n} % \begin{macro}{\prg_quicksort_compare:nnTF} % \begin{macrocode} +%<*deprecated> \cs_set:Npn \prg_quicksort_function:n {\ERROR} \cs_set:Npn \prg_quicksort_compare:nnTF {\ERROR} +%</deprecated> % \end{macrocode} % \end{macro} % \end{macro} @@ -2061,6 +1763,38 @@ % \end{macro} % \end{macro} % +% Deprecated 2012-06-03 for removal after 2012-12-31. +% +% \begin{macro}[EXP] +% { +% \prg_case_int:nnn, \prg_case_str:nnn, \prg_case_str:onn, +% \prg_case_str:xxn, \prg_case_tl:Nnn, \prg_case_tl:cnn +% } +% Moved to more sensible modules. +% \begin{macrocode} +\cs_new_eq:NN \prg_case_int:nnn \int_case:nnn +\cs_new_eq:NN \prg_case_str:nnn \str_case:nnn +\cs_new_eq:NN \prg_case_str:onn \str_case:onn +\cs_new_eq:NN \prg_case_str:xxn \str_case_x:nnn +\cs_new_eq:NN \prg_case_tl:Nnn \tl_case:Nnn +\cs_new_eq:NN \prg_case_tl:cnn \tl_case:cnn +% \end{macrocode} +% \end{macro} +% +% Deprecated 2012-06-04 for removal after 2012-12-31. +% +% \begin{macro} +% { +% \prg_stepwise_function:nnnN, \prg_stepwise_inline:nnnn, +% \prg_stepwise_variable:nnnNn +% } +% \begin{macrocode} +\cs_new_eq:NN \prg_stepwise_function:nnnN \int_step_function:nnnN +\cs_new_eq:NN \prg_stepwise_inline:nnnn \int_step_inline:nnnn +\cs_new_eq:NN \prg_stepwise_variable:nnnNn \int_step_variable:nnnNn +% \end{macrocode} +% \end{macro} +% % \begin{macrocode} %</initex|package> % \end{macrocode} |