diff options
author | Karl Berry <karl@freefriends.org> | 2012-02-07 22:42:14 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-02-07 22:42:14 +0000 |
commit | 8b88d8570ac83e33a29938f8799ab728a94a6b70 (patch) | |
tree | 2389ca3bc088a4fe26c26bd2c0b01fa2d1b87600 /Master/texmf-dist/source/latex/l3kernel/l3basics.dtx | |
parent | 7dd80542eb368ed18c1298c24250b409350a2059 (diff) |
l3kernel 3331 (7feb12)
git-svn-id: svn://tug.org/texlive/trunk@25329 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3basics.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3basics.dtx | 199 |
1 files changed, 85 insertions, 114 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx index 9a2b94c4a3e..d16781461b0 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 3196 2012-01-15 09:44:05Z joseph $ +\GetIdInfo$Id: l3basics.dtx 3317 2012-02-06 12:26:40Z bruno $ {L3 Experimental basic definitions} %</driver|package> %<*driver> @@ -253,7 +253,7 @@ % Sets \meta{function} to expand to \meta{code} as replacement text. % Within the \meta{code}, the \meta{parameters} (|#1|, |#2|, % \emph{etc.}) will be replaced by those absorbed by the function. -% The assignment of a meaning to \meta{function} is restricted to +% The assignment of a meaning to the \meta{function} is restricted to % the current \TeX{} group level. % \end{function} % @@ -270,7 +270,7 @@ % \emph{etc.}) will be replaced by those absorbed by the function. % When the \meta{function} is used the \meta{parameters} absorbed % cannot contain \cs{par} tokens. The assignment of a meaning -% to \meta{function} is restricted to the current \TeX{} group +% to the \meta{function} is restricted to the current \TeX{} group % level. % \end{function} % @@ -285,7 +285,7 @@ % Sets \meta{function} to expand to \meta{code} as replacement text. % Within the \meta{code}, the \meta{parameters} (|#1|, |#2|, % \emph{etc.}) will be replaced by those absorbed by the function. -% The assignment of a meaning to \meta{function} is restricted to +% The assignment of a meaning to the \meta{function} is restricted to % the current \TeX{} group level. The \meta{function} will % not expand within an \texttt{x}-type argument. % \end{function} @@ -303,7 +303,7 @@ % \emph{etc.}) will be replaced by those absorbed by the function. % When the \meta{function} is used the \meta{parameters} absorbed % cannot contain \cs{par} tokens. The assignment of a meaning -% to \meta{function} is restricted to the current \TeX{} group +% to the \meta{function} is restricted to the current \TeX{} group % level. The \meta{function} will not expand within an % \texttt{x}-type argument. % \end{function} @@ -315,7 +315,7 @@ % Globally sets \meta{function} to expand to \meta{code} as replacement % text. Within the \meta{code}, the \meta{parameters} (|#1|, |#2|, % \emph{etc.}) will be replaced by those absorbed by the function. -% The assignment of a meaning to \meta{function} is \emph{not} +% The assignment of a meaning to the \meta{function} is \emph{not} % restricted to the current \TeX{} group level: the assignment is % global. % \end{function} @@ -332,7 +332,7 @@ % text. Within the \meta{code}, the \meta{parameters} (|#1|, |#2|, % \emph{etc.}) will be replaced by those absorbed by the function. % When the \meta{function} is used the \meta{parameters} absorbed -% cannot contain \cs{par} tokens. The assignment of a meaning to +% cannot contain \cs{par} tokens. The assignment of a meaning to the % \meta{function} is \emph{not} restricted to the current \TeX{} % group level: the assignment is global. % \end{function} @@ -348,7 +348,7 @@ % Globally sets \meta{function} to expand to \meta{code} as replacement % text. Within the \meta{code}, the \meta{parameters} (|#1|, |#2|, % \emph{etc.}) will be replaced by those absorbed by the function. -% The assignment of a meaning to \meta{function} is \emph{not} +% The assignment of a meaning to the \meta{function} is \emph{not} % restricted to the current \TeX{} group level: the assignment is % global. The \meta{function} will not expand within an % \texttt{x}-type argument. @@ -366,7 +366,7 @@ % text. Within the \meta{code}, the \meta{parameters} (|#1|, |#2|, % \emph{etc.}) will be replaced by those absorbed by the function. % When the \meta{function} is used the \meta{parameters} absorbed -% cannot contain \cs{par} tokens. The assignment of a meaning to +% cannot contain \cs{par} tokens. The assignment of a meaning to the % \meta{function} is \emph{not} restricted to the current \TeX{} % group level: the assignment is global. The \meta{function} will % not expand within an \texttt{x}-type argument. @@ -455,7 +455,7 @@ % automatically from the function signature. These \meta{parameters} % (|#1|, |#2|, \emph{etc.}) will be replaced by those absorbed by the % function. -% The assignment of a meaning to \meta{function} is restricted to +% The assignment of a meaning to the \meta{function} is restricted to % the current \TeX{} group level. % \end{function} % @@ -473,7 +473,7 @@ % (|#1|, |#2|, \emph{etc.}) will be replaced by those absorbed by the % function. When the \meta{function} is used the \meta{parameters} % absorbed cannot contain \cs{par} tokens. -% The assignment of a meaning to \meta{function} is restricted to +% The assignment of a meaning to the \meta{function} is restricted to % the current \TeX{} group level. % \end{function} % @@ -491,7 +491,7 @@ % (|#1|, |#2|, \emph{etc.}) will be replaced by those absorbed by the % function. The \meta{function} will not expand within an \texttt{x}-type % argument. -% The assignment of a meaning to \meta{function} is restricted to +% The assignment of a meaning to the \meta{function} is restricted to % the current \TeX{} group level. % \end{function} % @@ -510,7 +510,7 @@ % function. When the \meta{function} is used the \meta{parameters} % absorbed cannot contain \cs{par} tokens. The \meta{function} will not % expand within an \texttt{x}-type argument. -% The assignment of a meaning to \meta{function} is restricted to +% The assignment of a meaning to the \meta{function} is restricted to % the current \TeX{} group level. % \end{function} % @@ -527,7 +527,7 @@ % automatically from the function signature. These \meta{parameters} % (|#1|, |#2|, \emph{etc.}) will be replaced by those absorbed by the % function. -% The assignment of a meaning to \meta{function} is global. +% The assignment of a meaning to the \meta{function} is global. % \end{function} % % \begin{function} @@ -544,7 +544,7 @@ % (|#1|, |#2|, \emph{etc.}) will be replaced by those absorbed by the % function. When the \meta{function} is used the \meta{parameters} % absorbed cannot contain \cs{par} tokens. -% The assignment of a meaning to \meta{function} is global. +% The assignment of a meaning to the \meta{function} is global. % \end{function} % % \begin{function} @@ -561,7 +561,7 @@ % (|#1|, |#2|, \emph{etc.}) will be replaced by those absorbed by the % function. The \meta{function} will not expand within an \texttt{x}-type % argument. -% The assignment of a meaning to \meta{function} is global. +% The assignment of a meaning to the \meta{function} is global. % \end{function} % % \begin{function} @@ -579,7 +579,7 @@ % function. When the \meta{function} is used the \meta{parameters} % absorbed cannot contain \cs{par} tokens. The \meta{function} will not % expand within an \texttt{x}-type argument. -% The assignment of a meaning to \meta{function} is global. +% The assignment of a meaning to the \meta{function} is global. % \end{function} % % \begin{function}[updated = 2012-01-14] @@ -632,7 +632,7 @@ % \meta{control sequence 2} (or <token>). % The second control sequence may subsequently be % altered without affecting the copy. The assignment of a meaning -% to \meta{control sequence 1} is restricted to the current +% to the \meta{control sequence 1} is restricted to the current % \TeX{} group level. % \end{function} % @@ -646,7 +646,7 @@ % \meta{control sequence 2} (or <token>). % The second control sequence may subsequently be % altered without affecting the copy. The assignment of a meaning to -% \meta{control sequence 1} is \emph{not} restricted to the current +% the \meta{control sequence 1} is \emph{not} restricted to the current % \TeX{} group level: the assignment is global. % \end{function} % @@ -1768,92 +1768,78 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\prg_set_conditional:Npnn,\prg_new_conditional:Npnn, -% \prg_set_protected_conditional:Npnn,\prg_new_protected_conditional:Npnn} +% \begin{macro} +% { +% \prg_set_conditional:Npnn , +% \prg_new_conditional:Npnn , +% \prg_set_protected_conditional:Npnn , +% \prg_new_protected_conditional:Npnn , +% } +% \begin{macro}[aux]{\prg_generate_conditional_parm_aux:NNpnn} % The user functions for the types using parameter text from the -% programmer. Call aux function to grab parameters, split the base -% function into name and signature and then use, \emph{e.g.}, |\cs_set:Npn| -% to define it with. -% \begin{macrocode} -\cs_set_protected:Npn \prg_set_conditional:Npnn #1 - { - \prg_get_parm_aux:nw - { - \cs_split_function:NN #1 \prg_generate_conditional_aux:nnNNnnnn - \cs_set:Npn { parm } - } - } -\cs_set_protected:Npn \prg_new_conditional:Npnn #1 - { - \prg_get_parm_aux:nw - { - \cs_split_function:NN #1 \prg_generate_conditional_aux:nnNNnnnn - \cs_new:Npn { parm } - } - } -\cs_set_protected:Npn \prg_set_protected_conditional:Npnn #1 - { - \prg_get_parm_aux:nw{ - \cs_split_function:NN #1 \prg_generate_conditional_aux:nnNNnnnn - \cs_set_protected:Npn { parm } - } - } -\cs_set_protected:Npn \prg_new_protected_conditional:Npnn #1 +% programmer. The various functions only differ by which function is +% used for the assignment. For those |Npnn| type functions, we must +% grab the parameter text, reading everything up to a left brace +% before continuing. Then split the base function into name and +% signature, and feed \Arg{name} \Arg{signature} \meta{boolean} +% \meta{defining~function} |{parm}| \Arg{parameters} |{TF,...}| +% \Arg{code} to the auxiliary function responsible for defining all +% conditionals. +% \begin{macrocode} +\cs_set_protected_nopar:Npn \prg_set_conditional:Npnn + { \prg_generate_conditional_parm_aux:NNpnn \cs_set:Npn } +\cs_set_protected_nopar:Npn \prg_new_conditional:Npnn + { \prg_generate_conditional_parm_aux:NNpnn \cs_new:Npn } +\cs_set_protected_nopar:Npn \prg_set_protected_conditional:Npnn + { \prg_generate_conditional_parm_aux:NNpnn \cs_set_protected:Npn } +\cs_set_protected_nopar:Npn \prg_new_protected_conditional:Npnn + { \prg_generate_conditional_parm_aux:NNpnn \cs_new_protected:Npn } +\cs_set_protected:Npn \prg_generate_conditional_parm_aux:NNpnn #1#2#3# { - \prg_get_parm_aux:nw - { - \cs_split_function:NN #1 \prg_generate_conditional_aux:nnNNnnnn - \cs_new_protected:Npn { parm } - } + \cs_split_function:NN #2 \prg_generate_conditional_aux:nnNNnnnn + #1 { parm } {#3} } % \end{macrocode} % \end{macro} +% \end{macro} % -% \begin{macro}{\prg_set_conditional:Nnn,\prg_new_conditional:Nnn, -% \prg_set_protected_conditional:Nnn,\prg_new_protected_conditional:Nnn} -% The user functions for the types automatically inserting the -% correct parameter text based on the signature. Call aux function -% after calculating number of arguments, split the base function -% into name and signature and then use, \emph{e.g.}, |\cs_set:Npn| to -% define it with. -% \begin{macrocode} -\cs_set_protected:Npn \prg_set_conditional:Nnn #1 - { - \exp_args:Nnf \prg_get_count_aux:nn - { - \cs_split_function:NN #1 \prg_generate_conditional_aux:nnNNnnnn - \cs_set:Npn { count } - } - { \cs_get_arg_count_from_signature:N #1 } - } -\cs_set_protected:Npn \prg_new_conditional:Nnn #1 - { - \exp_args:Nnf \prg_get_count_aux:nn - { - \cs_split_function:NN #1 \prg_generate_conditional_aux:nnNNnnnn - \cs_new:Npn { count} - } - { \cs_get_arg_count_from_signature:N #1 } - } - -\cs_set_protected:Npn \prg_set_protected_conditional:Nnn #1{ - \exp_args:Nnf \prg_get_count_aux:nn{ - \cs_split_function:NN #1 \prg_generate_conditional_aux:nnNNnnnn - \cs_set_protected:Npn {count} - }{\cs_get_arg_count_from_signature:N #1} -} - -\cs_set_protected:Npn \prg_new_protected_conditional:Nnn #1 +% \begin{macro} +% { +% \prg_set_conditional:Nnn , +% \prg_new_conditional:Nnn , +% \prg_set_protected_conditional:Nnn , +% \prg_new_protected_conditional:Nnn , +% } +% \begin{macro}[aux]{\prg_generate_conditional_count_aux:NNnn} +% The user functions for the types automatically inserting the correct +% parameter text based on the signature. The various functions only +% differ by which function is used for the assignment. For those |Nnn| +% type functions, we calculate the number of arguments. Then split the +% base function into name and signature, and feed \Arg{name} +% \Arg{signature} \meta{boolean} \meta{defining~function} |{count}| +% \Arg{arg~count} |{TF,...}| \Arg{code} to the auxiliary function +% responsible for defining all conditionals. +% \begin{macrocode} +\cs_set_protected_nopar:Npn \prg_set_conditional:Nnn + { \prg_generate_conditional_count_aux:NNnn \cs_set:Npn } +\cs_set_protected_nopar:Npn \prg_new_conditional:Nnn + { \prg_generate_conditional_count_aux:NNnn \cs_new:Npn } +\cs_set_protected_nopar:Npn \prg_set_protected_conditional:Nnn + { \prg_generate_conditional_count_aux:NNnn \cs_set_protected:Npn } +\cs_set_protected_nopar:Npn \prg_new_protected_conditional:Nnn + { \prg_generate_conditional_count_aux:NNnn \cs_new_protected:Npn } +\cs_set_protected:Npn \prg_generate_conditional_count_aux:NNnn #1#2 { - \exp_args:Nnf \prg_get_count_aux:nn + \exp_args:Nnf \use:n { - \cs_split_function:NN #1 \prg_generate_conditional_aux:nnNNnnnn - \cs_new_protected:Npn {count} + \cs_split_function:NN #2 \prg_generate_conditional_aux:nnNNnnnn + #1 { count } } - { \cs_get_arg_count_from_signature:N #1 } + { \cs_get_arg_count_from_signature:N #2 } } % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macro}{\prg_set_eq_conditional:NNn,\prg_new_eq_conditional:NNn} % The obvious setting-equal functions. @@ -1863,21 +1849,10 @@ \cs_set_protected:Npn \prg_new_eq_conditional:NNn #1#2#3 { \prg_set_eq_conditional_aux:NNNn \cs_new_eq:cc #1#2 {#3} } % \end{macrocode} -% \end{macro} -% -% \begin{macro}[aux]{\prg_get_parm_aux:nw,\prg_get_count_aux:nn} -% For the |Npnn| type we must grab the parameter text before -% continuing. We make this a very generic function that takes one -% argument before reading everything up to a left brace. Something -% similar for the |Nnn| type. -% \begin{macrocode} -\cs_set:Npn \prg_get_count_aux:nn #1#2 { #1 {#2} } -\cs_set:Npn \prg_get_parm_aux:nw #1#2# { #1 {#2} } -% \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\prg_generate_conditional_parm_aux:nnNNnnnn, -% \prg_generate_conditional_parm_aux:nw} +% \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 @@ -2003,14 +1978,12 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\prg_set_eq_conditional_aux:NNNn, -% \prg_set_eq_conditional_aux:NNNw} +% \begin{macro}[aux] +% {\prg_set_eq_conditional_aux:NNNn, \prg_set_eq_conditional_aux:NNNw} +% Manual clist loop over argument |#4|. % \begin{macrocode} \cs_set_protected:Npn \prg_set_eq_conditional_aux:NNNn #1#2#3#4 - { \prg_set_eq_conditional_aux:NNNw #1#2#3#4 , ? , \q_recursion_stop } -% \end{macrocode} -% Manual clist loop over argument |#4|. -% \begin{macrocode} + { \prg_set_eq_conditional_aux:NNNw #1#2#3#4 , ? , \q_recursion_stop } \cs_set_protected:Npn \prg_set_eq_conditional_aux:NNNw #1#2#3#4 , { \if:w ? #4 \scan_stop: @@ -2021,8 +1994,6 @@ { \exp_args:NNc \cs_split_function:NN #3 { prg_conditional_form_#4:nnn } } \prg_set_eq_conditional_aux:NNNw #1 {#2} {#3} } -% \end{macrocode} -% \begin{macrocode} \cs_set:Npn \prg_conditional_form_p:nnn #1#2#3 { #1 _p : #2 } \cs_set:Npn \prg_conditional_form_TF:nnn #1#2#3 { #1 : #2 TF } \cs_set:Npn \prg_conditional_form_T:nnn #1#2#3 { #1 : #2 T } |