diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3kernel/l3int.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/l3kernel/l3int.sty | 117 |
1 files changed, 51 insertions, 66 deletions
diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3int.sty b/Master/texmf-dist/tex/latex/l3kernel/l3int.sty index f12cda36783..76b61a861c6 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3int.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3int.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3int.dtx 3460 2012-02-26 12:16:41Z will $ +\GetIdInfo$Id: l3int.dtx 3490 2012-03-04 01:00:53Z bruno $ {L3 Experimental integers} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -157,9 +157,9 @@ \cs_generate_variant:Nn \int_zero:N { c } \cs_generate_variant:Nn \int_gzero:N { c } \cs_new_protected:Npn \int_zero_new:N #1 - { \cs_if_exist:NTF #1 { \int_zero:N #1 } { \int_new:N #1 } } + { \int_if_exist:NTF #1 { \int_zero:N #1 } { \int_new:N #1 } } \cs_new_protected:Npn \int_gzero_new:N #1 - { \cs_if_exist:NTF #1 { \int_gzero:N #1 } { \int_new:N #1 } } + { \int_if_exist:NTF #1 { \int_gzero:N #1 } { \int_new:N #1 } } \cs_generate_variant:Nn \int_zero_new:N { c } \cs_generate_variant:Nn \int_gzero_new:N { c } \cs_new_protected:Npn \int_set_eq:NN #1#2 { #1 = #2 } @@ -168,6 +168,14 @@ \cs_new_protected:Npn \int_gset_eq:NN #1#2 { \tex_global:D #1 = #2 } \cs_generate_variant:Nn \int_gset_eq:NN { c } \cs_generate_variant:Nn \int_gset_eq:NN { Nc , cc } +\cs_new_eq:NN \int_if_exist:NTF \cs_if_exist:NTF +\cs_new_eq:NN \int_if_exist:NT \cs_if_exist:NT +\cs_new_eq:NN \int_if_exist:NF \cs_if_exist:NF +\cs_new_eq:NN \int_if_exist_p:N \cs_if_exist_p:N +\cs_new_eq:NN \int_if_exist:cTF \cs_if_exist:cTF +\cs_new_eq:NN \int_if_exist:cT \cs_if_exist:cT +\cs_new_eq:NN \int_if_exist:cF \cs_if_exist:cF +\cs_new_eq:NN \int_if_exist_p:c \cs_if_exist_p:c \cs_new_protected:Npn \int_add:Nn #1#2 { \tex_advance:D #1 by \int_eval:w #2 \int_eval_end: } \cs_new_protected:Npn \int_sub:Nn #1#2 @@ -199,76 +207,53 @@ \cs_generate_variant:Nn \int_gset:Nn { c } \cs_new_eq:NN \int_use:N \tex_the:D \cs_new:Npn \int_use:c #1 { \int_use:N \cs:w #1 \cs_end: } -\prg_new_conditional:Npnn \int_compare:n #1 { p , T , F , TF } - { \exp_after:wN \int_compare_aux:nw \int_value:w \int_eval:w #1 \q_stop } -\cs_new:Npn \int_compare_aux:nw #1#2 \q_stop - { - \exp_after:wN \int_compare_aux:Nw - \int_to_roman:w - \if:w #1 - - \else: - - - \fi: - #1#2 \q_mark #1#2 \q_stop - } -\cs_new:Npn \int_compare_aux:Nw #1#2#3 \q_mark - { \use:c { int_compare_ #1 \if_meaning:w = #2 = \fi: :w } } -\cs_new:cpn { int_compare_=:w } #1 = #2 \q_stop - { - \if_int_compare:w #1 = \int_eval:w #2 \int_eval_end: - \prg_return_true: - \else: - \prg_return_false: - \fi: - } -\cs_new:cpn { int_compare_==:w } #1 == #2 \q_stop +\cs_new_protected_nopar:Npn \kernel_compare_error: { - \if_int_compare:w #1 = \int_eval:w #2 \int_eval_end: - \prg_return_true: - \else: - \prg_return_false: - \fi: + \if_num:w \c_zero \c_zero \fi: + = + \kernel_compare_error: } -\cs_new:cpn { int_compare_!=:w } #1 != #2 \q_stop +\cs_new:Npn \kernel_compare_error:Nw + #1#2 \prg_return_true: \else: \prg_return_false: \fi: { - \if_int_compare:w #1 = \int_eval:w #2 \int_eval_end: - \prg_return_false: - \else: - \prg_return_true: - \fi: + \msg_expandable_kernel_error:nnn + { kernel } { unknown-comparison } {#1} + \prg_return_false: } -\cs_new:cpn { int_compare_<:w } #1 < #2 \q_stop - { - \if_int_compare:w #1 < \int_eval:w #2 \int_eval_end: - \prg_return_true: - \else: - \prg_return_false: - \fi: - } -\cs_new:cpn { int_compare_>:w } #1 > #2 \q_stop +\prg_new_conditional:Npnn \int_compare:n #1 { p , T , F , TF } { - \if_int_compare:w #1 > \int_eval:w #2 \int_eval_end: + \exp_after:wN \int_compare_aux:Nw \int_use:N \int_eval:w #1 + \kernel_compare_error: \int_eval_end: \prg_return_true: \else: \prg_return_false: \fi: } -\cs_new:cpn { int_compare_<=:w } #1 <= #2 \q_stop - { - \if_int_compare:w #1 > \int_eval:w #2 \int_eval_end: - \prg_return_false: - \else: - \prg_return_true: - \fi: - } -\cs_new:cpn { int_compare_>=:w } #1 >= #2 \q_stop - { - \if_int_compare:w #1 < \int_eval:w #2 \int_eval_end: - \prg_return_false: - \else: - \prg_return_true: - \fi: - } +\cs_new:Npn \int_compare_aux:Nw #1#2 \kernel_compare_error: + { + \exp_after:wN \int_compare_aux:NNw + \int_to_roman:w - 0 #2 ?? \q_mark + #1#2 + } +\cs_new:Npn \int_compare_aux:NNw #1#2#3 \q_mark + { + \use:c { int_compare_ #1 \if_meaning:w = #2 = \fi: :NNw } + \kernel_compare_error:Nw #1 + } +\cs_new:cpn { int_compare_=:NNw } #1#2#3 = + { \if_int_compare:w #3 = \int_eval:w } +\cs_new:cpn { int_compare_<:NNw } #1#2#3 < + { \if_int_compare:w #3 < \int_eval:w } +\cs_new:cpn { int_compare_>:NNw } #1#2#3 > + { \if_int_compare:w #3 > \int_eval:w } +\cs_new:cpn { int_compare_==:NNw } #1#2#3 == + { \if_int_compare:w #3 = \int_eval:w } +\cs_new:cpn { int_compare_!=:NNw } #1#2#3 != + { \reverse_if:N \if_int_compare:w #3 = \int_eval:w } +\cs_new:cpn { int_compare_<=:NNw } #1#2#3 <= + { \reverse_if:N \if_int_compare:w #3 > \int_eval:w } +\cs_new:cpn { int_compare_>=:NNw } #1#2#3 >= + { \reverse_if:N \if_int_compare:w #3 < \int_eval:w } \prg_new_conditional:Npnn \int_compare:nNn #1#2#3 { p , T , F , TF} { \if_int_compare:w \int_eval:w #1 #2 \int_eval:w #3 \int_eval_end: @@ -658,16 +643,16 @@ { \str_if_eq:nnTF {#2} { Q } { - \cs_if_exist:cF { c_int_from_roman_ #1 _int } + \int_if_exist:cF { c_int_from_roman_ #1 _int } { \int_from_roman_clean_up:w } + \use:c { c_int_from_roman_ #1 _int } #2 } { - \cs_if_exist:cF { c_int_from_roman_ #1 _int } + \int_if_exist:cF { c_int_from_roman_ #1 _int } { \int_from_roman_clean_up:w } - \cs_if_exist:cF { c_int_from_roman_ #2 _int } + \int_if_exist:cF { c_int_from_roman_ #2 _int } { \int_from_roman_clean_up:w } \int_compare:nNnTF { \use:c { c_int_from_roman_ #1 _int } } |