diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3skip.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3skip.dtx | 122 |
1 files changed, 44 insertions, 78 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx index 1a9d70f8756..f7af3985dd1 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{l3bootstrap} -\GetIdInfo$Id: l3skip.dtx 4444 2013-01-13 20:27:20Z bruno $ +\GetIdInfo$Id: l3skip.dtx 4581 2013-07-28 08:38:50Z joseph $ {L3 Dimensions and skips} %</driver|package> %<*driver> @@ -271,26 +271,30 @@ % \end{center} % \end{function} % -% \begin{function}[added = 2012-06-03, EXP]{\dim_case:nnn} +% \begin{function}[added = 2013-07-24, EXP, TF]{\dim_case:nn} % \begin{syntax} -% \cs{dim_case:nnn} \Arg{test dimension expression} \\ +% \cs{dim_case:nnTF} \Arg{test dimension expression} \\ % ~~|{| \\ % ~~~~\Arg{dimexpr case_1} \Arg{code case_1} \\ % ~~~~\Arg{dimexpr case_2} \Arg{code case_2} \\ % ~~~~\ldots \\ % ~~~~\Arg{dimexpr case_n} \Arg{code case_n} \\ % ~~|}| \\ -% ~~\Arg{else code} +% ~~\Arg{true code} +% ~~\Arg{false code} % \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. For example +% associated \meta{code} is left in the input stream. If any of the +% cases are matched, the \meta{true code} is also inserted into the +% input stream (after the code for the appropriate case), while if none +% match then the \meta{false code} is inserted. The function +% \cs{dim_case:nn}, which does nothing if there is no match, is also +% available. For example % \begin{verbatim} % \dim_set:Nn \l_tmpa_dim { 5 pt } -% \dim_case:nnn +% \dim_case:nnF % { 2 \l_tmpa_dim } % { % { 5 pt } { Small } @@ -1209,30 +1213,48 @@ % \end{macro} % \end{macro} % -% \begin{macro}[EXP]{\dim_case:nnn} -% \begin{macro}[aux, EXP]{\@@_case_aux:nnn} -% \begin{macro}[aux, EXP]{\@@_case_aux:nw,\@@_case_end:nw} -% The dimension function is the same as the \texttt{int} version, so there -% is not much to say here. +% \begin{macro}[EXP]{\dim_case:nn} +% \begin{macro}[EXP, TF]{\dim_case:nn} +% \begin{macro}[aux]{\@@_case:nnTF} +% \begin{macro}[aux]{\@@_case:nw, \@@_case_end:nw} +% For dimension cases, the first task to fully expand the check +% condition. The over all idea is then much the same as for +% \cs{str_case:nn(TF)} as described in \pkg{l3basics}. % \begin{macrocode} -\cs_new:Npn \dim_case:nnn #1 +\cs_new:Npn \dim_case:nnTF #1 { \tex_romannumeral:D - \exp_args:Nf \@@_case_aux:nnn { \dim_eval:n {#1} } + \exp_args:Nf \@@_case:nnTF { \dim_eval:n {#1} } } -\cs_new:Npn \@@_case_aux:nnn #1#2#3 - { \@@_case_aux:nw {#1} #2 {#1} {#3} \q_recursion_stop } -\cs_new:Npn \@@_case_aux:nw #1#2#3 +\cs_new:Npn \dim_case:nnT #1#2#3 + { + \tex_romannumeral:D + \exp_args:Nf \@@_case:nnTF { \dim_eval:n {#1} } {#2} {#3} { } + } +\cs_new:Npn \dim_case:nnF #1#2 + { + \tex_romannumeral:D + \exp_args:Nf \@@_case:nnTF { \dim_eval:n {#1} } {#2} { } + } +\cs_new:Npn \dim_case:nn #1#2 + { + \tex_romannumeral:D + \exp_args:Nf \@@_case:nnTF { \dim_eval:n {#1} } {#2} { } { } + } +\cs_new:Npn \@@_case:nnTF #1#2#3#4 + { \@@_case:nw {#1} #2 {#1} { } \q_mark {#3} \q_mark {#4} \q_stop } +\cs_new:Npn \@@_case:nw #1#2#3 { \dim_compare:nNnTF {#1} = {#2} { \@@_case_end:nw {#3} } - { \@@_case_aux:nw {#1} } + { \@@_case:nw {#1} } } \cs_new_eq:NN \@@_case_end:nw \__prg_case_end:nw % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % % \subsection{Dimension expression loops} % @@ -1848,69 +1870,13 @@ % % \subsection{Deprecated functions} % -% Deprecated on 2012-05-10, for removal by 2012-08-31. -% -% \begin{macro}[EXP, pTF]{\skip_if_infinite_glue:n} -% Reverse of \cs{skip_if_finite:nTF}. +% \begin{macro}{\dim_case:nnn} +% Deprecated 2013-07-15. % \begin{macrocode} -%<*deprecated> -\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: } -%</deprecated> +\cs_new_eq:NN \dim_case:nnn \dim_case:nnF % \end{macrocode} % \end{macro} % -% Deprecated 2012-06-03 for removal after 2012-12-31. -% -% \begin{macro}[EXP]{\prg_case_dim:nnn} -% Moved here, was in \pkg{l3prg} but load order means we define it here -% now. -% \begin{macrocode} -%<*deprecated> -\cs_new_eq:NN \prg_case_dim:nnn \dim_case:nnn -%</deprecated> -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\dim_eval:w, \dim_eval_end:} -% \begin{macrocode} -%<*deprecated> -\cs_new_eq:NN \dim_eval:w \__dim_eval:w -\cs_new_eq:NN \dim_eval_end: \__dim_eval_end: -%</deprecated> -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\dim_set_max:Nn, \dim_set_max:cn} -% \begin{macro}{\dim_set_min:Nn, \dim_set_min:cn} -% \begin{macro}{\dim_gset_max:Nn, \dim_gset_max:cn} -% \begin{macro}{\dim_gset_min:Nn, \dim_gset_min:cn} -% \begin{macro}[aux]{\@@_set_max:NNNn} -% Deprecated on 2012-09-09 for removal after 2012-12-31. -% \begin{macrocode} -%<*deprecated> -\cs_new_protected_nopar:Npn \dim_set_max:Nn - { \@@_set_max:NNNn < \dim_set:Nn } -\cs_new_protected_nopar:Npn \dim_gset_max:Nn - { \@@_set_max:NNNn < \dim_gset:Nn } -\cs_new_protected_nopar:Npn \dim_set_min:Nn - { \@@_set_max:NNNn > \dim_set:Nn } -\cs_new_protected_nopar:Npn \dim_gset_min:Nn - { \@@_set_max:NNNn > \dim_gset:Nn } -\cs_new_protected:Npn \@@_set_max:NNNn #1#2#3#4 - { \dim_compare:nNnT {#3} #1 {#4} { #2 #3 {#4} } } -\cs_generate_variant:Nn \dim_set_max:Nn { c } -\cs_generate_variant:Nn \dim_gset_max:Nn { c } -\cs_generate_variant:Nn \dim_set_min:Nn { c } -\cs_generate_variant:Nn \dim_gset_min:Nn { c } -%</deprecated> -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% % \begin{macrocode} %</initex|package> % \end{macrocode} |