summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-09-16 22:35:41 +0000
committerKarl Berry <karl@freefriends.org>2011-09-16 22:35:41 +0000
commit6d95b4a2c1bbdaea1a3802c822808f476ac5703b (patch)
tree1abf9117bf53f2de53fbcc62c352acc92780365b /Master/texmf-dist/tex/latex/l3kernel/l3prg.sty
parentb7f762397f5df2d732326713423e31e1bf91b903 (diff)
l3kernel 2828 (15sep11)
git-svn-id: svn://tug.org/texlive/trunk@23983 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.sty81
1 files changed, 29 insertions, 52 deletions
diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty b/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty
index 67ee78ebee3..250d46a77af 100644
--- a/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty
+++ b/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty
@@ -22,7 +22,7 @@
%%
%% http://www.latex-project.org/lppl.txt
%%
-%% This file is part of the "expl3 bundle" (The Work in LPPL)
+%% This file is part of the "l3kernel bundle" (The Work in LPPL)
%% and all files in that bundle must be distributed together.
%%
%% The released version of this bundle is available from CTAN.
@@ -46,7 +46,7 @@
%%
%% -----------------------------------------------------------------------
\RequirePackage{l3names}
-\GetIdInfo$Id: l3prg.dtx 2720 2011-09-05 08:12:39Z bruno $
+\GetIdInfo$Id: l3prg.dtx 2827 2011-09-15 19:37:32Z joseph $
{L3 Experimental control structures}
%%
\ProvidesExplPackage
@@ -358,12 +358,16 @@
\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
+\cs_new:Npn \prg_stepwise_function:nnnN #1#2#3#4
{
- \int_compare:nNnTF {#2} > { 0 }
- { \exp_args:Nf \prg_stepwise_function_incr:nnnN }
- { \exp_args:Nf \prg_stepwise_function_decr:nnnN }
- { \int_eval:n {#1} } {#2}
+ \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
+ }
}
\cs_new:Npn \prg_stepwise_function_incr:nnnN #1#2#3#4
{
@@ -376,7 +380,7 @@
}
\cs_new:Npn \prg_stepwise_function_decr:nnnN #1#2#3#4
{
- \int_compare:nNnF {#1} < {#3}
+ \int_compare:nNnF {#1} < {#3}
{
#4 {#1}
\exp_args:Nf \prg_stepwise_function_decr:nnnN
@@ -384,44 +388,29 @@
}
}
\int_new:N \g_prg_stepwise_level_int
-\cs_new_protected:Npn \prg_stepwise_inline:nnnn #1#2#3#4
+\cs_new_protected:Npn \prg_stepwise_inline:nnnn
{
- \int_gincr:N \g_prg_stepwise_level_int
- \cs_gset_nopar:cpn
+ \exp_args:NNc \prg_stepwise_aux:NNnnnn
+ \cs_gset_nopar:Npn
{ g_prg_stepwise_ \int_use:N \g_prg_stepwise_level_int :n }
- ##1 {#4}
- \int_compare:nNnTF {#2} > { 0 }
- { \exp_args:Ncf \prg_stepwise_inline_incr:Nnnn }
- { \exp_args:Ncf \prg_stepwise_inline_decr:Nnnn }
- { g_prg_stepwise_ \int_use:N \g_prg_stepwise_level_int :n }
- { \int_eval:n {#1} } {#2} {#3}
- \int_gdecr:N \g_prg_stepwise_level_int
}
-\cs_new_protected:Npn \prg_stepwise_inline_incr:Nnnn #1#2#3#4
- {
- \int_compare:nNnF {#2} > {#4}
- {
- #1 {#2}
- \exp_args:NNf \prg_stepwise_inline_incr:Nnnn #1
- { \int_eval:n { #2 + #3 } } {#3} {#4}
- }
- }
-\cs_new_protected:Npn \prg_stepwise_inline_decr:Nnnn #1#2#3#4
+\cs_new_protected:Npn \prg_stepwise_variable:nnnNn #1#2#3#4#5
{
- \int_compare:nNnF {#2} < {#4}
+ \exp_args:NNc \prg_stepwise_aux:NNnnnn
+ \cs_gset_nopar:Npx
+ { g_prg_stepwise_ \int_use:N \g_prg_stepwise_level_int :n }
+ {#1}{#2}{#3}
{
- #1 {#2}
- \exp_args:NNf \prg_stepwise_inline_decr:Nnnn #1
- { \int_eval:n { #2 + #3 } } {#3} {#4}
+ \tl_set:Nn \exp_not:N #4 {##1}
+ \exp_not:n {#5}
}
}
-\cs_new_protected:Npn \prg_stepwise_variable:nnnNn #1#2#3#4#5
+\cs_new_protected:Npn \prg_stepwise_aux:NNnnnn #1#2#3#4#5#6
{
- \prg_stepwise_inline:nnnn {#1} {#2} {#3}
- {
- \tl_set:Nn #4 {##1}
- #5
- }
+ #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
}
\prg_new_conditional:Npnn \mode_if_vertical: { p , T , F , TF }
{ \if_mode_vertical: \prg_return_true: \else: \prg_return_false: \fi: }
@@ -430,22 +419,12 @@
\prg_new_conditional:Npnn \mode_if_inner: { p , T , F , TF }
{ \if_mode_inner: \prg_return_true: \else: \prg_return_false: \fi: }
\prg_new_conditional:Npnn \mode_if_math: { p , T , F , TF }
- {
- \scan_align_safe_stop:
- \if_mode_math: \prg_return_true: \else: \prg_return_false: \fi:
- }
+ { \if_mode_math: \prg_return_true: \else: \prg_return_false: \fi: }
\cs_new_nopar:Npn \group_align_safe_begin:
{ \if_int_compare:w \if_false: { \fi: `} = \c_zero \fi: }
\cs_new_nopar:Npn \group_align_safe_end:
{ \if_int_compare:w `{ = \c_zero } \fi: }
-\cs_new_nopar:Npn \scan_align_safe_stop:
- {
- \int_compare:nNnT \etex_currentgrouptype:D = \c_six
- {
- \int_compare:nNnF \etex_lastnodetype:D = \c_zero
- { \int_compare:nNnF \etex_lastnodetype:D = \c_seven { \scan_stop: } }
- }
- }
+\cs_new_protected_nopar:Npn \scan_align_safe_stop: { }
\group_begin:
\tex_lccode:D `\& = `\g \scan_stop:
\tex_catcode:D `\& = \c_twelve
@@ -556,8 +535,6 @@
\prg_define_quicksort:nnn {prg}{}{}
\cs_set:Npn \prg_quicksort_function:n {\ERROR}
\cs_set:Npn \prg_quicksort_compare:nnTF {\ERROR}
-\cs_new_protected:Npn \prg_new_map_functions:Nn #1#2 { \deprecated }
-\cs_new_protected:Npn \prg_set_map_functions:Nn #1#2 { \deprecated }
%%
%%
%% End of file `l3prg.sty'.