summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3kernel/l3prg.sty')
-rw-r--r--Master/texmf-dist/tex/latex/l3kernel/l3prg.sty49
1 files changed, 24 insertions, 25 deletions
diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty b/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty
index 45e1aa17ddb..e86d4214429 100644
--- a/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty
+++ b/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty
@@ -46,7 +46,7 @@
%%
%% -----------------------------------------------------------------------
\RequirePackage{l3names}
-\GetIdInfo$Id: l3prg.dtx 2915 2011-10-15 21:21:08Z bruno $
+\GetIdInfo$Id: l3prg.dtx 3014 2011-11-27 06:55:43Z bruno $
{L3 Experimental control structures}
%%
\ProvidesExplPackage
@@ -377,45 +377,43 @@
\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
{
- \int_compare:nNnTF {#2} = \c_zero
- { \msg_expandable_error:n { Zero~step~size~for~stepwise~function. } }
- {
- \int_compare:nNnTF {#2} > \c_zero
- { \exp_args:Nf \prg_stepwise_function_incr:nnnN }
- { \exp_args:Nf \prg_stepwise_function_decr:nnnN }
- { \int_eval:n {#1} } {#2} {#3} #4
- }
+ \prg_stepwise_aux:nnnN {#1} {#2} {#3} #4
+ \prg_break_point:n { }
}
-\cs_new:Npn \prg_stepwise_function_incr:nnnN #1#2#3#4
+\cs_new:Npn \prg_stepwise_aux:nnnN #1#2#3#4
{
- \int_compare:nNnF {#1} > {#3}
+ \int_compare:nNnTF {#2} > \c_zero
+ { \exp_args:NNf \prg_stepwise_aux:NnnnN > }
{
- #4 {#1}
- \exp_args:Nf \prg_stepwise_function_incr:nnnN
- { \int_eval:n { #1 + #2 } } {#2} {#3} #4
+ \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_function_decr:nnnN #1#2#3#4
+\cs_new:Npn \prg_stepwise_aux:NnnnN #1#2#3#4#5
{
- \int_compare:nNnF {#1} < {#3}
+ \int_compare:nNnF {#2} #1 {#4}
{
- #4 {#1}
- \exp_args:Nf \prg_stepwise_function_decr:nnnN
- { \int_eval:n { #1 + #2 } } {#2} {#3} #4
+ #5 {#2}
+ \exp_args:NNf \prg_stepwise_aux:NnnnN
+ #1 { \int_eval:n { #2 + #3 } } {#3} {#4} #5
}
}
-\int_new:N \g_prg_stepwise_level_int
\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_stepwise_level_int :n }
+ { 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_stepwise_level_int :n }
+ { g_prg_stepwise_ \int_use:N \g_prg_map_int :n }
{#1}{#2}{#3}
{
\tl_set:Nn \exp_not:N #4 {##1}
@@ -425,9 +423,9 @@
\cs_new_protected:Npn \prg_stepwise_aux:NNnnnn #1#2#3#4#5#6
{
#1 #2 ##1 {#6}
- \int_gincr:N \g_prg_stepwise_level_int
- \prg_stepwise_function:nnnN {#3}{#4}{#5} #2
- \int_gdecr:N \g_prg_stepwise_level_int
+ \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 }
}
\prg_new_conditional:Npnn \mode_if_vertical: { p , T , F , TF }
{ \if_mode_vertical: \prg_return_true: \else: \prg_return_false: \fi: }
@@ -474,6 +472,7 @@
{ \prg_variable_get_type_aux:w #2#3 \q_stop }
}
}
+\int_new:N \g_prg_map_int
\cs_new_protected_nopar:Npn \prg_define_quicksort:nnn #1#2#3 {
\cs_set:cpx{#1_quicksort:n}##1{
\exp_not:c{#1_quicksort_start_partition:w} ##1