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/tex/latex/l3kernel/l3prg.sty | |
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/tex/latex/l3kernel/l3prg.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/l3kernel/l3prg.sty | 456 |
1 files changed, 115 insertions, 341 deletions
diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty b/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty index 51b98fabb03..6433a8eb325 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty @@ -13,7 +13,7 @@ %% %% Do not distribute a modified version of this file. %% -%% 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 @@ -46,12 +46,12 @@ %% %% ----------------------------------------------------------------------- \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} %% \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\package_check_loaded_expl: +\__expl_package_check: \tex_let:D \if_bool:N \tex_ifodd:D \tex_let:D \if_predicate:w \tex_ifodd:D \cs_new_protected:Npn \bool_new:N #1 { \cs_new_eq:NN #1 \c_false_bool } @@ -99,19 +99,21 @@ \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 } \bool_new:N \l_tmpa_bool +\bool_new:N \l_tmpb_bool \bool_new:N \g_tmpa_bool +\bool_new:N \g_tmpb_bool \cs_new_eq:NN \bool_if_exist:NTF \cs_if_exist:NTF \cs_new_eq:NN \bool_if_exist:NT \cs_if_exist:NT \cs_new_eq:NN \bool_if_exist:NF \cs_if_exist:NF @@ -131,126 +133,75 @@ \cs_new:Npn \bool_if_p:n #1 { \group_align_safe_begin: - \bool_get_next:N ( #1 ) S + \__bool_if_left_parentheses:wwwn \q_nil + #1 \q_mark { } + ( \q_mark { \__bool_if_right_parentheses:wwwn \q_nil } + ) \q_mark { \__bool_if_or:wwwn \q_nil } + || \q_mark \__bool_if_parse:NNNww + \q_stop } -\cs_new:Npn \bool_get_next:N #1 +\cs_new:Npn \__bool_if_left_parentheses:wwwn #1 \q_nil #2 ( #3 \q_mark #4 + { #4 \__bool_if_left_parentheses:wwwn #1 #2 (( \q_nil #3 \q_mark {#4} } +\cs_new:Npn \__bool_if_right_parentheses:wwwn #1 \q_nil #2 ) #3 \q_mark #4 + { #4 \__bool_if_right_parentheses:wwwn #1 #2 )) \q_nil #3 \q_mark {#4} } +\cs_new:Npn \__bool_if_or:wwwn #1 \q_nil #2 || #3 \q_mark #4 + { #4 \__bool_if_or:wwwn #1 #2 )||( \q_nil #3 \q_mark {#4} } +\cs_new:Npn \__bool_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 } -\cs_new:Npn \bool_get_not_next:N #1 +\cs_new:Npn \__bool_get_next:NN #1#2 { \use:c { - bool_not_ - \if_meaning:w !#1 ! \else: \if_meaning:w (#1 ( \else: p \fi: \fi: - :w + __bool_ + \if_meaning:w !#2 ! \else: \if_meaning:w (#2 ( \else: p \fi: \fi: + :Nw } - #1 - } -\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 } -\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 - } -\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 } -\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:Npn \bool_Not:N #1 +\cs_new:cpn { __bool_!:Nw } #1#2 + { \exp_after:wN \__bool_get_next:NN #1 \use_ii:nn \use_i:nn } +\cs_new:cpn { __bool_(: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 \__bool_choose:NNN \exp_after:wN #1 + \__int_value:w \__bool_get_next:NN \use_i:nn } -\cs_new:Npn \bool_not_Not:N #1 +\cs_new:cpn { __bool_p:Nw } #1 + { \exp_after:wN \__bool_choose:NNN \exp_after:wN #1 \__int_value:w } +\cs_new:Npn \__bool_choose:NNN #1#2#3 { - \exp_after:wN \bool_p:w - \if_meaning:w #1 \c_true_bool - \c_true_bool - \else: - \c_false_bool - \fi: - } -\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 } -\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:Npn \bool_cleanup:N #1 - { - \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 + { + __bool_ #3 _ + #1 #2 { \if_meaning:w 0 #2 1 \else: 0 \fi: } + :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 } } -\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 } -\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 { 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 { __bool_)_0:w } { \c_false_bool } +\cs_new_nopar:cpn { __bool_)_1:w } { \c_true_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 { __bool_&_1:w } & { \__bool_get_next:NN \use_i:nn } +\cs_new_nopar:cpn { __bool_|_0:w } | { \__bool_get_next:NN \use_i:nn } +\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:Npn \bool_eval_skip_to_end:Nw #1#2 ) +\cs_new:Npn \__bool_eval_skip_to_end:Nw #1#2 ) { - \bool_eval_skip_to_end_aux:Nw #1#2 ( % ) + \__bool_eval_skip_to_end_ii:Nw #1#2 ( % ) \q_no_value \q_stop {#2} } -\cs_new:Npn \bool_eval_skip_to_end_aux:Nw #1#2 ( #3#4 \q_stop #5 % ) +\cs_new:Npn \__bool_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 } + { \__bool_eval_skip_to_end_iii:Nw #1 #5 } } -\cs_new:Npn \bool_eval_skip_to_end_aux_ii:Nw #1#2 ( #3 ) +\cs_new:Npn \__bool_eval_skip_to_end_iii:Nw #1#2 ( #3 ) { % ( - \bool_eval_skip_to_end:Nw #1#3 ) + \__bool_eval_skip_to_end:Nw #1#3 ) } \cs_new:Npn \bool_not_p:n #1 { \bool_if_p:n { ! ( #1 ) } } \cs_new:Npn \bool_xor_p:nn #1#2 @@ -297,161 +248,50 @@ #2 \bool_if:nF {#1} { \bool_do_until:nn {#1} {#2} } } -\cs_new:Npn \prg_case_end:nw #1 #2 \q_recursion_stop { \c_zero #1 } -\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} } - } -\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} } - } -\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} } - } -\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 } \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 \__prg_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 \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 \__prg_replicate:N #1 + { \cs:w __prg_replicate_#1 :n \__prg_replicate:N } +\cs_new:Npn \__prg_replicate_first:N #1 + { \cs:w __prg_replicate_first_ #1 :n \__prg_replicate:N } +\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_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 { __prg_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 { __prg_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 { __prg_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 { __prg_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 { __prg_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 { __prg_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 } -\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 } -\cs_new:Npn \prg_stepwise_function:nnnN #1#2#3#4 - { - \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 - } - } -\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 } - } +\cs_new:cpn { __prg_replicate_first_-:n } #1 + { + \c_zero + \__msg_kernel_expandable_error:nn { kernel } { negative-replication } + } +\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 } \prg_new_conditional:Npnn \mode_if_vertical: { p , T , F , TF } { \if_mode_vertical: \prg_return_true: \else: \prg_return_false: \fi: } \prg_new_conditional:Npnn \mode_if_horizontal: { p , T , F , TF } @@ -466,117 +306,51 @@ { \if_int_compare:w `{ = \c_zero } \fi: } \cs_new_protected_nopar:Npn \scan_align_safe_stop: { } \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 \__prg_variable_get_scope:N #1 { \exp_after:wN \exp_after:wN - \exp_after:wN \prg_variable_get_scope_aux:w + \exp_after:wN \__prg_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 \__prg_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 \__prg_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 \__prg_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 \__prg_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 } + { \__prg_variable_get_type:w #2#3 \q_stop } } } -\int_new:N \g_prg_map_int -\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} - } - \cs_set:cpx{#1_quicksort_braced:n}##1{ - \exp_not:c{#1_quicksort_start_partition_braced:n} ##1 - \exp_not:N\q_nil\exp_not:N\q_stop - } - \cs_set:cpx {#1_quicksort_start_partition:w} #2 ##1 #3{ - \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:nnnw} {##1}{}{} - } - \cs_set:cpx {#1_quicksort_start_partition_braced:n} ##1 { - \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}{}{} - } - \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} - { - \exp_not:c{#1_quicksort_compare:nnTF}{##1}{##4} - \exp_not:c{#1_quicksort_partition_greater_ii:nnnn} - \exp_not:c{#1_quicksort_partition_less_ii:nnnn} - } - {##1}{##2}{##3}{##4} - } - \cs_set:cpx {#1_quicksort_do_partition_i_braced:nnnn} ##1##2##3##4 { - \exp_not:N \quark_if_nil:nTF {##4} \exp_not:c {#1_do_quicksort_braced:nnnnw} - { - \exp_not:c{#1_quicksort_compare:nnTF}{##1}{##4} - \exp_not:c{#1_quicksort_partition_greater_ii_braced:nnnn} - \exp_not:c{#1_quicksort_partition_less_ii_braced:nnnn} - } - {##1}{##2}{##3}{##4} - } - \cs_set:cpx {#1_quicksort_do_partition_ii:nnnw} ##1##2##3 #2 ##4 #3 { - \exp_not:N \quark_if_nil:nTF {##4} \exp_not:c {#1_do_quicksort_braced:nnnnw} - { - \exp_not:c{#1_quicksort_compare:nnTF}{##4}{##1} - \exp_not:c{#1_quicksort_partition_less_i:nnnn} - \exp_not:c{#1_quicksort_partition_greater_i:nnnn} - } - {##1}{##2}{##3}{##4} - } - \cs_set:cpx {#1_quicksort_do_partition_ii_braced:nnnn} ##1##2##3##4 { - \exp_not:N \quark_if_nil:nTF {##4} \exp_not:c {#1_do_quicksort_braced:nnnnw} - { - \exp_not:c{#1_quicksort_compare:nnTF}{##4}{##1} - \exp_not:c{#1_quicksort_partition_less_i_braced:nnnn} - \exp_not:c{#1_quicksort_partition_greater_i_braced:nnnn} - } - {##1}{##2}{##3}{##4} - } - \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{ - \exp_not:c{#1_quicksort_do_partition_ii:nnnw}{##1}{##2}{##3{##4}}} - \cs_set:cpx {#1_quicksort_partition_greater_i:nnnn} ##1##2##3##4{ - \exp_not:c{#1_quicksort_do_partition_i:nnnw}{##1}{{##4}##2}{##3}} - \cs_set:cpx {#1_quicksort_partition_greater_ii:nnnn} ##1##2##3##4{ - \exp_not:c{#1_quicksort_do_partition_ii:nnnw}{##1}{##2{##4}}{##3}} - \cs_set:cpx {#1_quicksort_partition_less_i_braced:nnnn} ##1##2##3##4{ - \exp_not:c{#1_quicksort_do_partition_i_braced:nnnn}{##1}{##2}{{##4}##3}} - \cs_set:cpx {#1_quicksort_partition_less_ii_braced:nnnn} ##1##2##3##4{ - \exp_not:c{#1_quicksort_do_partition_ii_braced:nnnn}{##1}{##2}{##3{##4}}} - \cs_set:cpx {#1_quicksort_partition_greater_i_braced:nnnn} ##1##2##3##4{ - \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}} - \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} - } -} -\prg_define_quicksort:nnn {prg}{}{} -\cs_set:Npn \prg_quicksort_function:n {\ERROR} -\cs_set:Npn \prg_quicksort_compare:nnTF {\ERROR} +\int_new:N \g__prg_map_int +\cs_new_eq:NN \__prg_break_point: \prg_do_nothing: +\cs_new:Npn \__prg_break: #1 \__prg_break_point: { } +\cs_new:Npn \__prg_break:n #1#2 \__prg_break_point: {#1} +\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 +\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 of file `l3prg.sty'. |