diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3prg.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3prg.dtx | 77 |
1 files changed, 34 insertions, 43 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx index 79585b9c36c..c849e21ab77 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 3014 2011-11-27 06:55:43Z bruno $ +\GetIdInfo$Id: l3prg.dtx 3086 2011-12-22 17:55:46Z bruno $ {L3 Experimental control structures} %</driver|package> %<*driver> @@ -173,9 +173,9 @@ % } % \begin{syntax} % \cs{prg_set_protected_conditional:Npnn} -% ~~\cs{\meta{name}:\meta{arg spec}} \meta{parameters} \meta{conditions} \Arg{code} \\ +% ~~\cs{\meta{name}:\meta{arg spec}} \meta{parameters} \Arg{conditions} \Arg{code} \\ % \cs{prg_set_protected_conditional:Nnn} -% ~~\cs{\meta{name}:\meta{arg spec}} \meta{conditions} \Arg{code} +% ~~\cs{\meta{name}:\meta{arg spec}} \Arg{conditions} \Arg{code} % \end{syntax} % These functions creates a family of conditionals using the same % \Arg{code} to perform the test created. The \texttt{new} version will @@ -214,29 +214,18 @@ % the test. \cs{prg_set_protected_conditional:Npn} will generate % a family of protected conditional functions, and so \meta{code} % does not need to be expandable. All of the functions are created -% globally.% -% \begin{function}{\prg_new_eq_conditional:NN, \prg_set_eq_conditional:NN} +% globally. +% +% \begin{function}{\prg_new_eq_conditional:NNn, \prg_set_eq_conditional:NNn} % \begin{syntax} -% \cs{prg_new_eq_conditional:NN} \cs{\meta{name1}:\meta{arg spec1}} \cs{\meta{name2}:\meta{arg spec2}} +% \cs{prg_new_eq_conditional:NNn} \cs{\meta{name1}:\meta{arg spec1}} \cs{\meta{name2}:\meta{arg spec2}} \Arg{conditions} % \end{syntax} -% These will set the definitions of the functions -% \begin{itemize}\parskip=0pt -% \item \cs{\meta{name1}_p:\meta{arg spec1}} -% \item \cs{\meta{name1}:\meta{arg spec1}T} -% \item \cs{\meta{name1}:\meta{arg spec1}F} -% \item \cs{\meta{name1}:\meta{arg spec1}TF} -% \end{itemize} -% equal to those for -% \begin{itemize}\parskip=0pt -% \item \cs{\meta{name2}_p:\meta{arg spec2}} -% \item \cs{\meta{name2}:\meta{arg spec2}T} -% \item \cs{\meta{name2}:\meta{arg spec2}F} -% \item \cs{\meta{name2}:\meta{arg spec2}TF} -% \end{itemize} -% In most cases, the two \meta{arg specs} will be identical, although -% this is not enforced. In the case of the \texttt{new} function, a -% check is made for any existing definitions for \meta{name1}. The -% functions are set globally. +% These functions copies a family of conditionals. The \texttt{new} version +% will check for existing definitions (\emph{cf.}~\cs{cs_new:Npn}) whereas +% the \texttt{set} version will not (\emph{cf.}~\cs{cs_set:Npn}). The +% conditionals copied are depended on the comma-separated list of +% \meta{conditions}, which should be one or more of \texttt{p}, \texttt{T}, +% \texttt{F} and \texttt{TF}. % \end{function} % % \begin{function}[EXP]{\prg_return_true:, \prg_return_false:} @@ -896,7 +885,7 @@ % Boolean variables have to be initiated when they are created. Other % than that there is not much to say here. % \begin{macrocode} -\cs_new_protected_nopar:Npn \bool_new:N #1 { \cs_new_eq:NN #1 \c_false_bool } +\cs_new_protected:Npn \bool_new:N #1 { \cs_new_eq:NN #1 \c_false_bool } \cs_generate_variant:Nn \bool_new:N { c } % \end{macrocode} % \end{macro} @@ -911,13 +900,13 @@ % \UnitTested % Setting is already pretty easy. % \begin{macrocode} -\cs_new_protected_nopar:Npn \bool_set_true:N #1 +\cs_new_protected:Npn \bool_set_true:N #1 { \cs_set_eq:NN #1 \c_true_bool } -\cs_new_protected_nopar:Npn \bool_set_false:N #1 +\cs_new_protected:Npn \bool_set_false:N #1 { \cs_set_eq:NN #1 \c_false_bool } -\cs_new_protected_nopar:Npn \bool_gset_true:N #1 +\cs_new_protected:Npn \bool_gset_true:N #1 { \cs_gset_eq:NN #1 \c_true_bool } -\cs_new_protected_nopar:Npn \bool_gset_false:N #1 +\cs_new_protected:Npn \bool_gset_false:N #1 { \cs_gset_eq:NN #1 \c_false_bool } \cs_generate_variant:Nn \bool_set_true:N { c } \cs_generate_variant:Nn \bool_set_false:N { c } @@ -1228,8 +1217,8 @@ % Branching the six way switch. % Reversals should be reasonably straightforward. % \begin{macrocode} -\cs_new_nopar:Npn \bool_choose:NN #1#2 { \use:c { bool_ #2 _ #1 :w } } -\cs_new_nopar:Npn \bool_not_choose:NN #1#2 { \use:c { bool_not_ #2 _ #1 :w } } +\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} @@ -1630,22 +1619,22 @@ % 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_nopar:Npn \prg_replicate:nn #1 +\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: \cs_end: } -\cs_new_nopar:Npn \prg_replicate_aux:N #1 +\cs_new:Npn \prg_replicate_aux:N #1 { \cs:w prg_replicate_#1 :n \prg_replicate_aux:N } -\cs_new_nopar:Npn \prg_replicate_first_aux:N #1 +\cs_new:Npn \prg_replicate_first_aux:N #1 { \cs:w prg_replicate_first_ #1 :n \prg_replicate_aux:N } % \end{macrocode} % Then comes all the functions that do the hard work of inserting all % the copies. % \begin{macrocode} -\cs_new_nopar:Npn \prg_replicate_ :n #1 { \cs_end: } +\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 } @@ -1667,7 +1656,8 @@ % 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 \negative_replication } +\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 } @@ -1895,12 +1885,13 @@ \tl_to_lowercase:n { \group_end: - \cs_new_nopar:Npn \prg_variable_get_scope:N #1 + \cs_new:Npn \prg_variable_get_scope:N #1 { - \exp_last_unbraced:Nf \prg_variable_get_scope_aux:w - { \cs_to_str:N #1 \exp_stop_f: \q_stop } + \exp_after:wN \exp_after:wN + \exp_after:wN \prg_variable_get_scope_aux:w + \cs_to_str:N #1 \exp_stop_f: \q_stop } - \cs_new_nopar:Npn \prg_variable_get_scope_aux:w #1#2 \q_stop + \cs_new:Npn \prg_variable_get_scope_aux:w #1#2 \q_stop { \token_if_eq_meaning:NNT & #1 { g } } } \group_begin: @@ -1909,12 +1900,12 @@ \tl_to_lowercase:n { \group_end: - \cs_new_nopar:Npn \prg_variable_get_type:N #1 + \cs_new:Npn \prg_variable_get_type:N #1 { \exp_after:wN \prg_variable_get_type_aux:w \token_to_str:N #1 & a \q_stop } - \cs_new_nopar:Npn \prg_variable_get_type_aux:w #1 & #2#3 \q_stop + \cs_new:Npn \prg_variable_get_type_aux:w #1 & #2#3 \q_stop { \token_if_eq_meaning:NNTF a #2 {#1} @@ -1973,7 +1964,7 @@ % by Bernd Raichle. Firstly we define the function for parsing the % initial list and then the braced list afterwards. % \begin{macrocode} -\cs_new_protected_nopar:Npn \prg_define_quicksort:nnn #1#2#3 { +\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 \exp_not:n{#2\q_nil#3\q_stop} |