diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/expl3/l3prg.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/expl3/l3prg.sty | 102 |
1 files changed, 43 insertions, 59 deletions
diff --git a/Master/texmf-dist/tex/latex/expl3/l3prg.sty b/Master/texmf-dist/tex/latex/expl3/l3prg.sty index fad727278da..ccb7657e076 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3prg.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3prg.sty @@ -48,24 +48,27 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3prg.dtx 574 2006-08-21 23:30:10Z morten $ +\GetIdInfo$Id: l3prg.dtx 697 2007-11-27 14:14:54Z morten $ {L3 Experimental control structures} +\ProvidesExplPackage + {\filename}{\filedate}{\fileversion}{\filedescription} \RequirePackage{l3quark} \RequirePackage{l3toks} \RequirePackage{l3int} -\def_new:Npn \mode_vertical_p: { +\def_new:Npn \mode_if_vertical_p: { \if_mode_vertical: \c_true \else: \c_false\fi:} -\def_test_function_new:npn{mode_vertical:}{\if_mode_vertical:} -\def_new:Npn \mode_horizontal_p: { +\def_test_function_new:npn{mode_if_vertical:}{\if_mode_vertical:} +\def_new:Npn \mode_if_horizontal_p: { \if_mode_horizontal: \c_true \else: \c_false\fi:} -\def_test_function_new:npn{mode_horizontal:}{\if_mode_horizontal:} -\def_new:Npn \mode_inner_p: { +\def_test_function_new:npn{mode_if_horizontal:}{\if_mode_horizontal:} +\def_new:Npn \mode_if_inner_p: { \if_mode_inner: \c_true \else: \c_false\fi:} -\def_test_function_new:npn{mode_inner:}{\if_mode_inner:} -\def_test_function_new:npn{mode_math:} { +\def_test_function_new:npn{mode_if_inner:}{\if_mode_inner:} +\def_test_function_new:npn{mode_if_math:} { \scan_align_safe_stop: \if_mode_math: } -\def_new:Npn \group_align_safe_begin: {\if_false:{\fi:\if_num:w0=`}\fi:} -\def_new:Npn \group_align_safe_end: {\if_num:w0=`{\fi:\if_false:}\fi:} +\def_new:Npn \group_align_safe_begin: { + \if_false:{\fi:\if_num:w`}=\c_zero\fi:} +\def_new:Npn \group_align_safe_end: {\if_num:w`{=\c_zero}\fi:} \def_new:Npn \scan_align_safe_stop: { \num_compare:nNnT \etex_currentgrouptype:D = \c_six { @@ -190,15 +193,15 @@ } } \def_new:Npn \bool_new:N #1 { \let_new:NN #1 \c_false } -\def_new:Npn \bool_new:c #1 { \let_new:cN #1 \c_false } +\def_new:Npn \bool_new:c #1 { \let_new:cN {#1} \c_false } \def_new:Npn \bool_set_true:N #1 { \let:NN #1 \c_true } -\def_new:Npn \bool_set_true:c #1 { \let:cN #1 \c_true } +\def_new:Npn \bool_set_true:c #1 { \let:cN {#1} \c_true } \def_new:Npn \bool_set_false:N #1 { \let:NN #1 \c_false } -\def_new:Npn \bool_set_false:c #1 { \let:cN #1 \c_false } +\def_new:Npn \bool_set_false:c #1 { \let:cN {#1} \c_false } \def_new:Npn \bool_gset_true:N #1 { \glet:NN #1 \c_true } -\def_new:Npn \bool_gset_true:c #1 { \glet:cN #1 \c_true } +\def_new:Npn \bool_gset_true:c #1 { \glet:cN {#1} \c_true } \def_new:Npn \bool_gset_false:N #1 { \glet:NN #1 \c_false } -\def_new:Npn \bool_gset_false:c #1 { \glet:cN #1 \c_false } +\def_new:Npn \bool_gset_false:c #1 { \glet:cN {#1} \c_false } \let_new:NN \bool_set_eq:NN \let:NN \let_new:NN \bool_set_eq:Nc \let:Nc \let_new:NN \bool_set_eq:cN \let:cN @@ -261,55 +264,36 @@ \def_long_new:Npn \prg_dowhile:nF #1#2{ #2 #1 {\prg_dowhile:nF {#1}{#2}} } -\let_new:NN \prg_if_predicate:nTF \bool_if:NTF -\let_new:NN \prg_if_predicate:nT \bool_if:NT -\let_new:NN \prg_if_predicate:nF \bool_if:NF -\def_new:Npn \prg_if_predicate_or_p:nn #1#2{ - \if_num:w #1#2<\c_hundred_one - \c_true - \else: - \c_false - \fi: -} -\def_new:Npn \prg_if_predicate_and_p:nn #1#2{ - \if_case:w #1#2 ~ - \c_true - \else: - \c_false - \fi: +\def_long_new:Npn \predicate_p:n #1{ + \group_align_safe_begin: + \exp_after:NN \predicate_auxi:NN + \int_to_roman:w-`\q #1 02\scan_stop: } -\def_new:Npn \prg_if_predicate_not_p:n #1{ - \if_case:w #1 ~ - \c_false - \or: - \c_true - \fi: +\def_long_test_function_new:npn {predicate:n}#1{ + \group_align_safe_begin: + \if:w \exp_after:NN \predicate_auxi:NN + \int_to_roman:w-`\q #1 02\scan_stop: } -\def_long_new:Npn \prg_if_predicate_ands_p:n #1{ - \exp_after:NN \prg_if_predicate_andor_aux:NNN \exp_after:NN \c_true - \int_to_roman:w -`0 #1 \scan_stop: \scan_stop: +\def_new:Npn \predicate_auxi:NN 0 #1{ + \exp_after:NN \predicate_auxii:NNN \exp_after:NN #1 + \int_to_roman:w-`\q } -\def_long_new:Npn \prg_if_predicate_ors_p:n #1{ - \exp_after:NN \prg_if_predicate_andor_aux:NNN \exp_after:NN \c_false - \int_to_roman:w -`0 #1 \scan_stop: \scan_stop: +\def_new:Npn \predicate_auxii:NNN #1#2#3{ + \cs_use:c{predicate_#2#3_#1:w} } +\def_new:cpn{predicate_&&_0:w}{ + \exp_after:NN \predicate_auxi:NN\int_to_roman:w-`\q } -\def_new:Npn \prg_if_predicate_andor_aux:NNN #1#2#3{ - \token_if_eq_meaning:NNTF \scan_stop: #2 - { #1 } - { - \int_compare:nNnTF #3 = #1 - { \exp_after:NN \prg_if_predicate_andor_aux:NNN } - { \exp_after:NN \prg_if_predicate_andor_break:NNN } - \exp_after:NN #1 \int_to_roman:w -`0 - } +\def_long_new:cpn{predicate_&&_1:w} #1 02\scan_stop:{ + \group_align_safe_end: 01} +\def_long_new:cpn{predicate_||_0:w} #1 02\scan_stop:{ + \group_align_safe_end: 00} +\def_new:cpn{predicate_||_1:w}{ + \exp_after:NN \predicate_auxi:NN\int_to_roman:w-`\q } -\def_new:Npn \prg_if_predicate_andor_break:NNN #1#2#3{ - \token_if_eq_meaning:NNTF \scan_stop: #2 - { \if:w #1\c_false\else:\c_true\fi: } - { - \exp_after:NN \prg_if_predicate_andor_break:NNN \exp_after:NN #1 - \int_to_roman:w -`0 - } +\def_new:cpn{predicate_02_0:w}\scan_stop:{ \group_align_safe_end: 00 } +\def_new:cpn{predicate_02_1:w}\scan_stop:{ \group_align_safe_end: 01 } +\def_long_new:Npn \predicate_not_p:n #1{ + \if:w \predicate_p:n{#1} \c_false \else: \c_true \fi: } \def_new:NNn \prg_define_quicksort:nnn 3 { \def_long:cNx{#1_quicksort:n}1{ |