diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/expl3/l3prg.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/expl3/l3prg.sty | 95 |
1 files changed, 73 insertions, 22 deletions
diff --git a/Master/texmf-dist/tex/latex/expl3/l3prg.sty b/Master/texmf-dist/tex/latex/expl3/l3prg.sty index 38112ebffa8..b4f8ec44ed6 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3prg.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3prg.sty @@ -15,7 +15,7 @@ %% Do not distribute a modified version of this file. %% %% -%% File: l3prg.dtx Copyright (C) 2005-2009 LaTeX3 project +%% File: l3prg.dtx Copyright (C) 2005-2010 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 @@ -48,7 +48,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3prg.dtx 1992 2010-08-04 20:41:40Z joseph $ +\GetIdInfo$Id: l3prg.dtx 2043 2010-09-22 02:10:43Z will $ {L3 Experimental control structures} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} @@ -239,31 +239,59 @@ #2 \bool_if:NF #1 {\bool_do_until:Nn #1 {#2}} } \cs_generate_variant:Nn \bool_do_until:Nn {c} -\cs_set:Npn \bool_if_p:n #1{ +\cs_new:Npn \bool_if_p:n #1{ \group_align_safe_begin: \bool_get_next:N ( #1 )S } -\cs_set:Npn \bool_get_next:N #1{ +\cs_new:Npn \bool_get_next:N #1{ \use:c { bool_ \if_meaning:w !#1 ! \else: \if_meaning:w (#1 ( \else: p \fi: \fi: :w } #1 } -\cs_set:cpn { bool_!:w } #1#2 { +\cs_new:Npn \bool_get_not_next:N #1{ + \use:c { + bool_not_ + \if_meaning:w !#1 ! \else: \if_meaning:w (#1 ( \else: p \fi: \fi: + :w + } #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 \use_none:n + \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 +} \cs_new:Npn \bool_Not:w { - \exp_after:wN \intexpr_if_even_p:n \tex_number:D \bool_get_next:N + \exp_after:wN \tex_number:D \bool_get_not_next:N +} +\cs_new:Npn \bool_not_Not:w { + \exp_after:wN \tex_number:D \bool_get_next:N } \cs_new:Npn \bool_Not:N #1 { \exp_after:wN \bool_p:w @@ -273,32 +301,55 @@ \c_true_bool \fi: } -\cs_set:cpn {bool_(:w}#1{ +\cs_new:Npn \bool_not_Not:N #1 { + \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 \tex_number:D \bool_get_next:N } -\cs_set:cpn {bool_p:w}{\exp_after:wN \bool_cleanup:N \tex_number:D } +\cs_new:cpn {bool_not_(:w}#1{ + \exp_after:wN \bool_not_cleanup:N \tex_number:D \bool_get_next:N +} +\cs_new:cpn {bool_p:w}{\exp_after:wN \bool_cleanup:N \tex_number:D } +\cs_new:cpn {bool_not_p:w}{\exp_after:wN \bool_not_cleanup:N \tex_number:D } \cs_new_nopar:Npn \bool_cleanup:N #1{ \exp_after:wN \bool_choose:NN \exp_after:wN #1 \int_to_roman:w-`\q } +\cs_new_nopar:Npn \bool_not_cleanup:N #1{ + \exp_after:wN \bool_not_choose:NN \exp_after:wN #1 + \int_to_roman:w-`\q +} \cs_new_nopar:Npn \bool_choose:NN #1#2{ \use:c{bool_#2_#1:w} } +\cs_new_nopar: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_set:cpn{bool_&_0:w}&{\bool_eval_skip_to_end:Nw \c_false_bool} -\cs_set:cpn{bool_|_1:w}|{\bool_eval_skip_to_end:Nw \c_true_bool} -\cs_set:Npn \bool_eval_skip_to_end:Nw #1#2){ - \bool_eval_skip_to_end_aux:Nw #1 #2(\q_no_value\q_nil{#2} -} -\cs_set:Npn \bool_eval_skip_to_end_aux:Nw #1#2(#3#4\q_nil#5{ +\cs_new:cpn{bool_&_0:w}&{\bool_eval_skip_to_end:Nw \c_false_bool} +\cs_new:cpn{bool_|_1:w}|{\bool_eval_skip_to_end:Nw \c_true_bool} +\cs_new:cpn{bool_not_&_1:w}&{\bool_eval_skip_to_end:Nw \c_false_bool} +\cs_new:cpn{bool_not_|_0:w}|{\bool_eval_skip_to_end:Nw \c_true_bool} +\cs_new:Npn \bool_eval_skip_to_end:Nw #1#2){ + \bool_eval_skip_to_end_aux: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{ \quark_if_no_value:NTF #3 { #1 } { \bool_eval_skip_to_end_auxii:Nw #1 #5 } } -\cs_set:Npn \bool_eval_skip_to_end_auxii:Nw #1#2(#3){ +\cs_new:Npn \bool_eval_skip_to_end_auxii:Nw #1#2(#3){ \bool_eval_skip_to_end:Nw #1#3 ) } \cs_new:Npn \bool_set:Nn #1#2 {\tex_chardef:D #1 = \bool_if_p:n {#2}} @@ -354,7 +405,7 @@ } \cs_new:Npn \prg_case_str_aux:nnn #1#2#3{ \quark_if_recursion_tail_stop_do:nn{#2}{\use:n} - \tl_if_eq:xxTF{#1}{#2} + \str_if_eq:xxTF{#1}{#2} { \prg_end_case:nw {#3} } { \prg_case_str_aux:nnn {#1}} } @@ -455,9 +506,9 @@ \group_end: \cs_new_nopar:Npn \prg_variable_get_scope:N #1 { \exp_last_unbraced:Nf \prg_variable_get_scope_aux:w - { \cs_to_str:N #1 \exp_stop_f: \q_nil } + { \cs_to_str:N #1 \exp_stop_f: \q_stop } } - \cs_new_nopar:Npn \prg_variable_get_scope_aux:w #1#2 \q_nil { + \cs_new_nopar:Npn \prg_variable_get_scope_aux:w #1#2 \q_stop { \token_if_eq_meaning:NNT & #1 {g} } } @@ -468,13 +519,13 @@ \group_end: \cs_new_nopar:Npn \prg_variable_get_type:N #1 { \exp_after:wN \p;rg_variable_get_type_aux:w - \token_to_str:N #1 & a \q_nil + \token_to_str:N #1 & a \q_stop } - \cs_new_nopar:Npn \prg_variable_get_type_aux:w #1 & #2#3 \q_nil { + \cs_new_nopar:Npn \prg_variable_get_type_aux:w #1 & #2#3 \q_stop { \token_if_eq_meaning:NNTF a #2 { #1 }{ - \prg_variable_get_type_aux:w #2#3 \q_nil + \prg_variable_get_type_aux:w #2#3 \q_stop } } } |