summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/expl3/l3prg.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-03-31 00:04:47 +0000
committerKarl Berry <karl@freefriends.org>2010-03-31 00:04:47 +0000
commit3ab55a61f6f8d2218a8f3175bc7481ce162b60d3 (patch)
treef606e0c2117a8058213441400e50ba25400ba94a /Master/texmf-dist/tex/latex/expl3/l3prg.sty
parent035ea73193af75f6ade46e306603e61d82b24950 (diff)
expl3 1881 (30mar10)
git-svn-id: svn://tug.org/texlive/trunk@17631 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/expl3/l3prg.sty')
-rw-r--r--Master/texmf-dist/tex/latex/expl3/l3prg.sty57
1 files changed, 39 insertions, 18 deletions
diff --git a/Master/texmf-dist/tex/latex/expl3/l3prg.sty b/Master/texmf-dist/tex/latex/expl3/l3prg.sty
index 63354678065..5476a648597 100644
--- a/Master/texmf-dist/tex/latex/expl3/l3prg.sty
+++ b/Master/texmf-dist/tex/latex/expl3/l3prg.sty
@@ -48,7 +48,7 @@
%%
%% -----------------------------------------------------------------------
\RequirePackage{l3names}
-\GetIdInfo$Id: l3prg.dtx 1677 2009-11-02 08:24:04Z joseph $
+\GetIdInfo$Id: l3prg.dtx 1853 2010-03-21 09:11:08Z joseph $
{L3 Experimental control structures}
\ProvidesExplPackage
{\filename}{\filedate}{\fileversion}{\filedescription}
@@ -112,6 +112,7 @@
\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_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{\cs_end: \ERROR }
\cs_new:cpn {prg_replicate_first_0:n}#1{\cs_end: }
\cs_new:cpn {prg_replicate_first_1:n}#1{\cs_end: #1}
\cs_new:cpn {prg_replicate_first_2:n}#1{\cs_end: #1#1}
@@ -147,7 +148,7 @@
}
}
\int_new:N\g_prg_inline_level_int
-\cs_new:Npn\prg_stepwise_inline:nnnn #1#2#3#4{
+\cs_new_protected:Npn\prg_stepwise_inline:nnnn #1#2#3#4{
\int_gincr:N \g_prg_inline_level_int
\cs_gset_nopar:cpn{prg_stepwise_inline_\int_use:N\g_prg_inline_level_int :n}##1{#4}
\intexpr_compare:nNnTF {#2}<\c_zero
@@ -173,13 +174,13 @@
{\intexpr_eval:n{#2 + #3}} {#3}{#4}
}
}
-\cs_new:Npn \prg_stepwise_variable:nnnNn #1#2 {
+\cs_new_protected:Npn \prg_stepwise_variable:nnnNn #1#2 {
\intexpr_compare:nNnTF {#2}<\c_zero
{\exp_args:Nf\prg_stepwise_variable_decr:nnnNn}
{\exp_args:Nf\prg_stepwise_variable_incr:nnnNn}
{\intexpr_eval:n{#1}}{#2}
}
-\cs_new:Npn \prg_stepwise_variable_incr:nnnNn #1#2#3#4#5 {
+\cs_new_protected:Npn \prg_stepwise_variable_incr:nnnNn #1#2#3#4#5 {
\intexpr_compare:nNnF {#1}>{#3}
{
\cs_set_nopar:Npn #4{#1} #5
@@ -187,7 +188,7 @@
{\intexpr_eval:n{#1 + #2}}{#2}{#3}#4{#5}
}
}
-\cs_new:Npn \prg_stepwise_variable_decr:nnnNn #1#2#3#4#5 {
+\cs_new_protected:Npn \prg_stepwise_variable_decr:nnnNn #1#2#3#4#5 {
\intexpr_compare:nNnF {#1}<{#3}
{
\cs_set_nopar:Npn #4{#1} #5
@@ -195,16 +196,16 @@
{\intexpr_eval:n{#1 + #2}}{#2}{#3}#4{#5}
}
}
-\cs_new_nopar:Npn \bool_new:N #1 { \cs_new_eq:NN #1 \c_false_bool }
-\cs_new_nopar:Npn \bool_new:c #1 { \cs_new_eq:cN {#1} \c_false_bool }
-\cs_new_nopar:Npn \bool_set_true:N #1 { \cs_set_eq:NN #1 \c_true_bool }
-\cs_new_nopar:Npn \bool_set_true:c #1 { \cs_set_eq:cN {#1} \c_true_bool }
-\cs_new_nopar:Npn \bool_set_false:N #1 { \cs_set_eq:NN #1 \c_false_bool }
-\cs_new_nopar:Npn \bool_set_false:c #1 { \cs_set_eq:cN {#1} \c_false_bool }
-\cs_new_nopar:Npn \bool_gset_true:N #1 { \cs_gset_eq:NN #1 \c_true_bool }
-\cs_new_nopar:Npn \bool_gset_true:c #1 { \cs_gset_eq:cN {#1} \c_true_bool }
-\cs_new_nopar:Npn \bool_gset_false:N #1 { \cs_gset_eq:NN #1 \c_false_bool }
-\cs_new_nopar:Npn \bool_gset_false:c #1 { \cs_gset_eq:cN {#1} \c_false_bool }
+\cs_new_protected_nopar:Npn \bool_new:N #1 { \cs_new_eq:NN #1 \c_false_bool }
+\cs_new_protected_nopar:Npn \bool_new:c #1 { \cs_new_eq:cN {#1} \c_false_bool }
+\cs_new_protected_nopar:Npn \bool_set_true:N #1 { \cs_set_eq:NN #1 \c_true_bool }
+\cs_new_protected_nopar:Npn \bool_set_true:c #1 { \cs_set_eq:cN {#1} \c_true_bool }
+\cs_new_protected_nopar:Npn \bool_set_false:N #1 { \cs_set_eq:NN #1 \c_false_bool }
+\cs_new_protected_nopar:Npn \bool_set_false:c #1 { \cs_set_eq:cN {#1} \c_false_bool }
+\cs_new_protected_nopar:Npn \bool_gset_true:N #1 { \cs_gset_eq:NN #1 \c_true_bool }
+\cs_new_protected_nopar:Npn \bool_gset_true:c #1 { \cs_gset_eq:cN {#1} \c_true_bool }
+\cs_new_protected_nopar:Npn \bool_gset_false:N #1 { \cs_gset_eq:NN #1 \c_false_bool }
+\cs_new_protected_nopar:Npn \bool_gset_false:c #1 { \cs_gset_eq:cN {#1} \c_false_bool }
\cs_new_eq:NN \bool_set_eq:NN \cs_set_eq:NN
\cs_new_eq:NN \bool_set_eq:Nc \cs_set_eq:Nc
\cs_new_eq:NN \bool_set_eq:cN \cs_set_eq:cN
@@ -249,8 +250,28 @@
:w
} #1
}
-\cs_set:cpn {bool_!:w}#1{
- \exp_after:wN \intexpr_if_even_p:n \tex_number:D \bool_get_next:N
+\cs_set: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 \use_none:n
+ \else:
+ \exp_after:wN \exp_after:wN \exp_after:wN \bool_Not:N
+ \fi:
+ \fi:
+ #2
+}
+\cs_new:Npn \bool_Not:w {
+ \exp_after:wN \intexpr_if_even_p:n \tex_number:D \bool_get_next:N
+}
+\cs_new:Npn \bool_Not:N #1 {
+ \exp_after:wN \bool_p:w
+ \if_meaning:w #1 \c_true_bool
+ \c_false_bool
+ \else:
+ \c_true_bool
+ \fi:
}
\cs_set:cpn {bool_(:w}#1{
\exp_after:wN \bool_cleanup:N \tex_number:D \bool_get_next:N
@@ -349,7 +370,7 @@
}
\cs_new:Npn \prg_end_case:nw #1#2\q_recursion_stop#3{#1}
-\cs_new_nopar:Npn \prg_define_quicksort:nnn #1#2#3 {
+\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
\exp_not:n{#2\q_nil#3\q_stop}