diff options
author | Karl Berry <karl@freefriends.org> | 2012-07-23 17:15:00 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-07-23 17:15:00 +0000 |
commit | 134349701bddf7cbbacf6030c6b9f9838aff96fa (patch) | |
tree | ec1140c46e1c0347a671a6fa3cf8af5a79e95f93 /Master/texmf-dist/tex/latex | |
parent | f7855c12c18bb97b7b9e49ab685ee558d8c0b47b (diff) |
l3kernel 3990 (17jul12)
git-svn-id: svn://tug.org/texlive/trunk@27108 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
25 files changed, 9678 insertions, 8162 deletions
diff --git a/Master/texmf-dist/tex/latex/l3kernel/expl3.sty b/Master/texmf-dist/tex/latex/l3kernel/expl3.sty index f264342f725..7b8c68154f9 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/expl3.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/expl3.sty @@ -45,22 +45,23 @@ %% prior consultation with the LaTeX3 Project. %% %% ----------------------------------------------------------------------- -\RequirePackage{l3names}[2011/12/30] -\@ifpackagelater{l3names}{2011/12/30} +\RequirePackage{l3names}[2012/07/15] +\@ifpackagelater{l3names}{2012/07/15} {} - { + {% \PackageError{expl3}{Mismatched LaTeX3 packages detected.} - { + {% Please install an up to date version of l3kernel - using your TeX package manager or from CTAN.\\ \\ - Loading expl3 will abort! - } + using your TeX package manager or from CTAN.% + \MessageBreak \MessageBreak + Loading expl3 will abort!% + }% \endinput } \def\ExplFileName{expl3} \def\ExplFileDescription{L3 Experimental code bundle wrapper} -\def\ExplFileDate{2012/04/23} -\def\ExplFileVersion{3570} +\def\ExplFileDate{2012/07/16} +\def\ExplFileVersion{3990} \RequirePackage{etex} \reserveinserts{32} \ProvidesExplPackage @@ -75,129 +76,128 @@ \expl@create@bool@option { check-declarations } \l@expl@check@declarations@bool \expl@create@bool@option { log-functions } \l@expl@log@functions@bool \expl@create@bool@option { native-drivers } \l@expl@native@drivers@bool -\ProcessOptions \relax \let \expl@create@bool@option \@undefined -\ifodd \l@expl@native@drivers@bool \relax -\else - \RequirePackage { color , graphics } -\fi -\RequirePackage{ l3basics, l3expan, l3tl } +\ProcessOptions \relax +\RequirePackage { l3basics, l3expan, l3tl } \ifodd \l@expl@check@declarations@bool \relax - \cs_new_protected:Npn \cs_check_exists:N #1 + \cs_new_protected:Npn \__cs_check_exists:N #1 { \cs_if_exist:NF #1 { - \msg_kernel_error:nnx { check } { non-declared-variable } + \__msg_kernel_error:nnx { check } { non-declared-variable } { \token_to_str:N #1 } } } \cs_set_protected:Npn \tl_set:Nn #1#2 { - \cs_check_exists:N #1 + \__cs_check_exists:N #1 \cs_set_nopar:Npx #1 { \exp_not:n {#2} } } \cs_set_protected:Npn \tl_set:Nx #1#2 { - \cs_check_exists:N #1 + \__cs_check_exists:N #1 \cs_set_nopar:Npx #1 {#2} } \cs_set_protected:Npn \tl_gset:Nn #1#2 { - \cs_check_exists:N #1 + \__cs_check_exists:N #1 \cs_gset_nopar:Npx #1 { \exp_not:n {#2} } } \cs_set_protected:Npn \tl_gset:Nx #1#2 { - \cs_check_exists:N #1 + \__cs_check_exists:N #1 \cs_gset_nopar:Npx #1 {#2} } \cs_set_protected:Npn \tl_set_eq:NN #1#2 { - \cs_check_exists:N #1 - \cs_check_exists:N #2 + \__cs_check_exists:N #1 + \__cs_check_exists:N #2 \cs_set_eq:NN #1 #2 } \cs_set_protected:Npn \tl_gset_eq:NN #1#2 { - \cs_check_exists:N #1 - \cs_check_exists:N #2 + \__cs_check_exists:N #1 + \__cs_check_exists:N #2 \cs_gset_eq:NN #1 #2 } \fi -\RequirePackage{ - l3seq, - l3int, - l3quark, - l3prg} +\RequirePackage { l3seq, l3int, l3quark, l3prg } \ifodd \l@expl@check@declarations@bool \relax \cs_set_protected:Npn \bool_set_true:N #1 { - \cs_check_exists:N #1 + \__cs_check_exists:N #1 \cs_set_eq:NN #1 \c_true_bool } \cs_set_protected:Npn \bool_set_false:N #1 { - \cs_check_exists:N #1 + \__cs_check_exists:N #1 \cs_set_eq:NN #1 \c_false_bool } \cs_set_protected:Npn \bool_gset_true:N #1 { - \cs_check_exists:N #1 + \__cs_check_exists:N #1 \cs_gset_eq:NN #1 \c_true_bool } \cs_set_protected:Npn \bool_gset_false:N #1 { - \cs_check_exists:N #1 + \__cs_check_exists:N #1 \cs_gset_eq:NN #1 \c_false_bool } \cs_set_protected:Npn \bool_set_eq:NN #1 { - \cs_check_exists:N #1 + \__cs_check_exists:N #1 \cs_set_eq:NN #1 } \cs_set_protected:Npn \bool_gset_eq:NN #1 { - \cs_check_exists:N #1 + \__cs_check_exists:N #1 \cs_gset_eq:NN #1 } \cs_set_protected:Npn \bool_set:Nn #1#2 { - \cs_check_exists:N #1 + \__cs_check_exists:N #1 \tex_chardef:D #1 = \bool_if_p:n {#2} } \cs_set_protected:Npn \bool_gset:Nn #1#2 { - \cs_check_exists:N #1 + \__cs_check_exists:N #1 \tex_global:D \tex_chardef:D #1 = \bool_if_p:n {#2} } \fi -\RequirePackage{ - l3clist, - l3token, - l3prop, - l3msg, - l3file, - l3skip, - l3keys, - l3fp, - l3box, - l3coffins, - l3color, - l3luatex -} +\RequirePackage + { + l3clist, + l3token, + l3prop, + l3msg, + l3file, + l3skip, + l3keys, + l3fp, + l3box, + l3coffins, + l3color, + l3luatex, + l3candidates + } \bool_if:nT { \l@expl@check@declarations@bool } { - \msg_kernel_new:nnnn { check } { non-declared-variable } + \__msg_kernel_new:nnnn { check } { non-declared-variable } { The~variable~#1~has~not~been~declared~\msg_line_context:. } { Checking~is~active,~and~you~have~tried~do~so~something~like: \\ - \ \ \tl_set:Nn ~ #1 ~ \iow_char:N \{ ~ ... ~ \iow_char:N \} \\ + \ \ \tl_set:Nn ~ #1 ~ \{ ~ ... ~ \} \\ without~first~having: \\ \ \ \tl_new:N ~ #1 \\ \\ LaTeX~will~create~the~variable~and~continue. } } +\AtBeginDocument + { + \cs_if_exist:NF \color + { \DeclareRobustCommand \color [2] [ ] { } } + } \bool_if:nTF { \l@expl@native@drivers@bool } { \xetex_if_engine:TF @@ -210,13 +210,20 @@ \file_input:n { l3dvips.def } \fi } - \AtBeginDocument - { - \cs_if_free:NT \color - { \DeclareRobustCommand \color [2] [ ] { } } - } } { + \tl_gput_left:Nn \@begindocumenthook { \RequirePackage { graphics } } + \__msg_kernel_new:nnnn { box } { clipping-not-available } + { Box~clipping~not~available. } + { + The~\box_clip:N~function~is~only~available~when~loading~expl3~ + with~the~"native-drivers"~option. + } + \cs_set_protected:Npn \box_clip:N #1 + { + \hbox_set:Nn #1 { \box_use:N #1 } + \__msg_kernel_error:nn { box } { clipping-not-available } + } \cs_set_protected:Npn \box_rotate:Nn #1#2 { \hbox_set:Nn #1 { \rotatebox {#2} { \box_use:N #1 } } } \cs_set_protected:Npn \box_resize:Nnn #1#2#3 @@ -224,8 +231,8 @@ \hbox_set:Nn #1 { \resizebox * - { \etex_dimexpr:D #2 \scan_stop: } - { \etex_dimexpr:D #3 \scan_stop: } + { \__dim_eval:w #2 \__dim_eval_end: } + { \__dim_eval:w #3 \__dim_eval_end: } { \box_use:N #1 } } } @@ -233,7 +240,7 @@ { \hbox_set:Nn #1 { - \resizebox * { ! } { \etex_dimexpr:D #2 \scan_stop: } + \resizebox * { ! } { \__dim_eval:w #2 \__dim_eval_end: } { \box_use:N #1 } } } @@ -241,16 +248,23 @@ { \hbox_set:Nn #1 { - \resizebox * { \etex_dimexpr:D #2 \scan_stop: } { ! } + \resizebox * { \__dim_eval:w #2 \__dim_eval_end: } { ! } { \box_use:N #1 } } } \cs_set_protected:Npn \box_scale:Nnn #1#2#3 - { \hbox_set:Nn #1 { \scalebox {#2} [#3] { \box_use:N #1 } } } + { + \hbox_set:Nn #1 + { + \exp_last_unbraced:Nx \scalebox + { { \fp_eval:n {#2} } [ \fp_eval:n {#3} ] } + { \box_use:N #1 } + } + } } \cs_set_protected_nopar:Npn \ExplSyntaxOn { - \bool_if:NF \l_expl_status_bool + \bool_if:NF \l__kernel_expl_bool { \cs_set_protected_nopar:Npx \ExplSyntaxOff { @@ -265,7 +279,7 @@ \char_set_catcode:nn { 124 } { \char_value_catcode:n { 124 } } \char_set_catcode:nn { 126 } { \char_value_catcode:n { 126 } } \tex_endlinechar:D = \tex_the:D \tex_endlinechar:D \scan_stop: - \bool_set_false:N \l_expl_status_bool + \bool_set_false:N \l__kernel_expl_bool \cs_set_protected_nopar:Npn \ExplSyntaxOff { } } } @@ -280,7 +294,7 @@ \char_set_catcode_other:n { 124 } % pipe \char_set_catcode_space:n { 126 } % tilde \tex_endlinechar:D = 32 \scan_stop: - \bool_set_true:N \l_expl_status_bool + \bool_set_true:N \l__kernel_expl_bool } \cs_set_protected_nopar:Npx \ExplSyntaxOff { diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3basics.sty b/Master/texmf-dist/tex/latex/l3kernel/l3basics.sty index 182505d931f..6b6c8e90276 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3basics.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3basics.sty @@ -46,11 +46,11 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3basics.dtx 3491 2012-03-04 06:13:18Z bruno $ - {L3 Experimental basic definitions} +\GetIdInfo$Id: l3basics.dtx 3987 2012-07-15 21:57:39Z joseph $ + {L3 Basic definitions} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\package_check_loaded_expl: +\__expl_package_check: \tex_let:D \if_true: \tex_iftrue:D \tex_let:D \if_false: \tex_iffalse:D \tex_let:D \or: \tex_or:D @@ -80,11 +80,8 @@ \tex_let:D \group_begin: \tex_begingroup:D \tex_let:D \group_end: \tex_endgroup:D \tex_let:D \if_int_compare:w \tex_ifnum:D -\tex_let:D \int_to_roman:w \tex_romannumeral:D +\tex_let:D \__int_to_roman:w \tex_romannumeral:D \tex_let:D \group_insert_after:N \tex_aftergroup:D -\tex_let:D \tex_global:D \tex_global:D -\tex_let:D \tex_long:D \tex_long:D -\tex_let:D \tex_protected:D \etex_protected:D \tex_long:D \tex_def:D \exp_args:Nc #1#2 { \exp_after:wN #1 \cs:w #2 \cs_end: } \tex_def:D \token_to_str:c { \exp_args:Nc \token_to_str:N } \tex_long:D \tex_def:D \cs_meaning:c #1 @@ -97,14 +94,14 @@ { \exp_args:Nc \cs_meaning:N {#1} } { \tl_to_str:n {undefined} } } -\tex_protected:D \tex_def:D \cs_show:c +\etex_protected:D \tex_def:D \cs_show:c { \group_begin: \exp_args:NNc \group_end: \cs_show:N } \tex_let:D \c_minus_one \m@ne -\tex_chardef:D \c_sixteen = 16~ -\tex_chardef:D \c_zero = 0~ -\tex_chardef:D \c_six = 6~ -\tex_chardef:D \c_seven = 7~ -\tex_chardef:D \c_twelve = 12~ +\tex_chardef:D \c_sixteen = 16 ~ +\tex_chardef:D \c_zero = 0 ~ +\tex_chardef:D \c_six = 6 ~ +\tex_chardef:D \c_seven = 7 ~ +\tex_chardef:D \c_twelve = 12 ~ \etex_ifdefined:D \luatex_luatexversion:D \tex_chardef:D \c_max_register_int = 65 535 ~ \tex_else:D @@ -112,18 +109,18 @@ \tex_fi:D \tex_let:D \cs_set_nopar:Npn \tex_def:D \tex_let:D \cs_set_nopar:Npx \tex_edef:D -\tex_protected:D \cs_set_nopar:Npn \cs_set:Npn +\etex_protected:D \cs_set_nopar:Npn \cs_set:Npn { \tex_long:D \cs_set_nopar:Npn } -\tex_protected:D \cs_set_nopar:Npn \cs_set:Npx +\etex_protected:D \cs_set_nopar:Npn \cs_set:Npx { \tex_long:D \cs_set_nopar:Npx } -\tex_protected:D \cs_set_nopar:Npn \cs_set_protected_nopar:Npn - { \tex_protected:D \cs_set_nopar:Npn } -\tex_protected:D \cs_set_nopar:Npn \cs_set_protected_nopar:Npx - { \tex_protected:D \cs_set_nopar:Npx } +\etex_protected:D \cs_set_nopar:Npn \cs_set_protected_nopar:Npn + { \etex_protected:D \cs_set_nopar:Npn } +\etex_protected:D \cs_set_nopar:Npn \cs_set_protected_nopar:Npx + { \etex_protected:D \cs_set_nopar:Npx } \cs_set_protected_nopar:Npn \cs_set_protected:Npn - { \tex_protected:D \tex_long:D \cs_set_nopar:Npn } + { \etex_protected:D \tex_long:D \cs_set_nopar:Npn } \cs_set_protected_nopar:Npn \cs_set_protected:Npx - { \tex_protected:D \tex_long:D \cs_set_nopar:Npx } + { \etex_protected:D \tex_long:D \cs_set_nopar:Npx } \tex_let:D \cs_gset_nopar:Npn \tex_gdef:D \tex_let:D \cs_gset_nopar:Npx \tex_xdef:D \cs_set_protected_nopar:Npn \cs_gset:Npn @@ -131,18 +128,18 @@ \cs_set_protected_nopar:Npn \cs_gset:Npx { \tex_long:D \cs_gset_nopar:Npx } \cs_set_protected_nopar:Npn \cs_gset_protected_nopar:Npn - { \tex_protected:D \cs_gset_nopar:Npn } + { \etex_protected:D \cs_gset_nopar:Npn } \cs_set_protected_nopar:Npn \cs_gset_protected_nopar:Npx - { \tex_protected:D \cs_gset_nopar:Npx } + { \etex_protected:D \cs_gset_nopar:Npx } \cs_set_protected_nopar:Npn \cs_gset_protected:Npn - { \tex_protected:D \tex_long:D \cs_gset_nopar:Npn } + { \etex_protected:D \tex_long:D \cs_gset_nopar:Npn } \cs_set_protected_nopar:Npn \cs_gset_protected:Npx - { \tex_protected:D \tex_long:D \cs_gset_nopar:Npx } + { \etex_protected:D \tex_long:D \cs_gset_nopar:Npx } \cs_set:Npn \use:c #1 { \cs:w #1 \cs_end: } \cs_set_protected:Npn \use:x #1 { - \cs_set_nopar:Npx \l_exp_internal_tl {#1} - \l_exp_internal_tl + \cs_set_nopar:Npx \l__exp_internal_tl {#1} + \l__exp_internal_tl } \cs_set:Npn \use:n #1 {#1} \cs_set:Npn \use:nn #1#2 {#1#2} @@ -174,173 +171,198 @@ \cs_set:Npn \use_none:nnnnnnnn #1#2#3#4#5#6#7#8 { } \cs_set:Npn \use_none:nnnnnnnnn #1#2#3#4#5#6#7#8#9 { } \cs_set_nopar:Npn \prg_return_true: - { \exp_after:wN \use_i:nn \int_to_roman:w } + { \exp_after:wN \use_i:nn \__int_to_roman:w } \cs_set_nopar:Npn \prg_return_false: - { \exp_after:wN \use_ii:nn \int_to_roman:w} + { \exp_after:wN \use_ii:nn \__int_to_roman:w} \cs_set_protected_nopar:Npn \prg_set_conditional:Npnn - { \prg_generate_conditional_parm_aux:NNpnn \cs_set:Npn } + { \__prg_generate_conditional_parm:nnNpnn { set } { } } \cs_set_protected_nopar:Npn \prg_new_conditional:Npnn - { \prg_generate_conditional_parm_aux:NNpnn \cs_new:Npn } + { \__prg_generate_conditional_parm:nnNpnn { new } { } } \cs_set_protected_nopar:Npn \prg_set_protected_conditional:Npnn - { \prg_generate_conditional_parm_aux:NNpnn \cs_set_protected:Npn } + { \__prg_generate_conditional_parm:nnNpnn { set } { _protected } } \cs_set_protected_nopar:Npn \prg_new_protected_conditional:Npnn - { \prg_generate_conditional_parm_aux:NNpnn \cs_new_protected:Npn } -\cs_set_protected:Npn \prg_generate_conditional_parm_aux:NNpnn #1#2#3# + { \__prg_generate_conditional_parm:nnNpnn { new } { _protected } } +\cs_set_protected:Npn \__prg_generate_conditional_parm:nnNpnn #1#2#3#4# { - \cs_split_function:NN #2 \prg_generate_conditional_aux:nnNNnnnn - #1 { parm } {#3} + \__cs_split_function:NN #3 \__prg_generate_conditional:nnNnnnnn + {#1} {#2} {#4} } \cs_set_protected_nopar:Npn \prg_set_conditional:Nnn - { \prg_generate_conditional_count_aux:NNnn \cs_set:Npn } + { \__prg_generate_conditional_count:nnNnn { set } { } } \cs_set_protected_nopar:Npn \prg_new_conditional:Nnn - { \prg_generate_conditional_count_aux:NNnn \cs_new:Npn } + { \__prg_generate_conditional_count:nnNnn { new } { } } \cs_set_protected_nopar:Npn \prg_set_protected_conditional:Nnn - { \prg_generate_conditional_count_aux:NNnn \cs_set_protected:Npn } + { \__prg_generate_conditional_count:nnNnn { set } { _protected } } \cs_set_protected_nopar:Npn \prg_new_protected_conditional:Nnn - { \prg_generate_conditional_count_aux:NNnn \cs_new_protected:Npn } -\cs_set_protected:Npn \prg_generate_conditional_count_aux:NNnn #1#2 + { \__prg_generate_conditional_count:nnNnn { new } { _protected } } +\cs_set_protected:Npn \__prg_generate_conditional_count:nnNnn #1#2#3 { - \exp_args:Nnf \use:n - { - \cs_split_function:NN #2 \prg_generate_conditional_aux:nnNNnnnn - #1 { count } - } - { \cs_get_arg_count_from_signature:N #2 } + \__cs_split_function:NN #3 \__prg_generate_conditional_count:nnNnnnn + {#1} {#2} } -\cs_set_protected:Npn \prg_set_eq_conditional:NNn #1#2#3 - { \prg_set_eq_conditional_aux:NNNn \cs_set_eq:cc #1#2 {#3} } -\cs_set_protected:Npn \prg_new_eq_conditional:NNn #1#2#3 - { \prg_set_eq_conditional_aux:NNNn \cs_new_eq:cc #1#2 {#3} } -\cs_set_protected:Npn \prg_generate_conditional_aux:nnNNnnnn #1#2#3#4#5#6#7#8 +\cs_set_protected:Npn \__prg_generate_conditional_count:nnNnnnn #1#2#3#4#5 { - \prg_generate_conditional_aux:nnw {#5} + \__cs_parm_from_arg_count:nnF + { \__prg_generate_conditional:nnNnnnnn {#1} {#2} #3 {#4} {#5} } + { \tl_count:n {#2} } { - #4 {#1} {#2} {#6} {#8} + \__msg_kernel_error:nnxx { kernel } { bad-number-of-arguments } + { \token_to_str:c { #1 : #2 } } + { \tl_count:n {#2} } + \use_none:nn } - #7 , ? , \q_recursion_stop } -\cs_set_protected:Npn \prg_generate_conditional_aux:nnw #1#2#3 , +\cs_set_protected:Npn \__prg_generate_conditional:nnNnnnnn #1#2#3#4#5#6#7#8 { - \if:w ?#3 - \exp_after:wN \use_none_delimit_by_q_recursion_stop:w + \if_meaning:w \c_true_bool #3 + \exp_after:wN \use_i:nn + \else: + \exp_after:wN \use_ii:nn \fi: - \use:c { prg_generate_#3_form_#1:Nnnnn } #2 - \prg_generate_conditional_aux:nnw {#1} {#2} + { + \__prg_generate_conditional:nnnnnnw + {#4} {#5} {#1} {#2} {#6} {#8} + #7 , , \q_recursion_stop + } + { + \__msg_kernel_error:nnx { kernel } { missing-colon } + { \token_to_str:c {#1} } + } } -\cs_set_protected:Npn \prg_generate_p_form_parm:Nnnnn #1#2#3#4#5 +\cs_set_protected:Npn \__prg_generate_conditional:nnnnnnw #1#2#3#4#5#6#7 , { - \exp_args:Nc #1 { #2 _p: #3 } #4 + \if_catcode:w \scan_stop: \etex_detokenize:D {#7} \scan_stop: + \exp_after:wN \use_none_delimit_by_q_recursion_stop:w + \fi: + \use:c { __prg_generate_ \etex_detokenize:D {#7} _form:wnnnnnn } + \__msg_kernel_error:nnxx + { kernel } { conditional-form-unknown } + { \tl_to_str:n {#7} } { \token_to_str:c { #3 : #4 } } + \use_none:nnnnnnn + \q_stop + {#1} {#2} {#3} {#4} {#5} {#6} + \__prg_generate_conditional:nnnnnnw {#1} {#2} {#3} {#4} {#5} {#6} + } +\cs_set_protected:Npn \__prg_generate_p_form:wnnnnnn #1 \q_stop #2#3#4#5#6#7 + { + \if_meaning:w \scan_stop: #3 \scan_stop: + \exp_after:wN \use_i:nn + \else: + \exp_after:wN \use_ii:nn + \fi: { - #5 \c_zero - \c_true_bool \c_false_bool + \exp_args:Nc \exp_args:Nc { cs_ #2 #3 :Npn } { #4 _p: #5 } #6 + { #7 \c_zero \c_true_bool \c_false_bool } } - } -\cs_set_protected:Npn \prg_generate_T_form_parm:Nnnnn #1#2#3#4#5 - { - \exp_args:Nc #1 { #2 : #3 T } #4 { - #5 \c_zero - \use:n \use_none:n + \__msg_kernel_error:nnx { kernel } { protected-predicate } + { \token_to_str:c { #4 _p: #5 } } } } -\cs_set_protected:Npn \prg_generate_F_form_parm:Nnnnn #1#2#3#4#5 +\cs_set_protected:Npn \__prg_generate_T_form:wnnnnnn #1 \q_stop #2#3#4#5#6#7 { - \exp_args:Nc #1 { #2 : #3 F } #4 - { - #5 \c_zero - { } - } + \exp_args:Nc \exp_args:Nc { cs_ #2 #3 :Npn } { #4 : #5 T } #6 + { #7 \c_zero \use:n \use_none:n } } -\cs_set_protected:Npn \prg_generate_TF_form_parm:Nnnnn #1#2#3#4#5 +\cs_set_protected:Npn \__prg_generate_F_form:wnnnnnn #1 \q_stop #2#3#4#5#6#7 { - \exp_args:Nc #1 { #2 : #3 TF } #4 - { #5 \c_zero } + \exp_args:Nc \exp_args:Nc { cs_ #2 #3 :Npn } { #4 : #5 F } #6 + { #7 \c_zero { } } } -\cs_set_protected:Npn \prg_generate_p_form_count:Nnnnn #1#2#3#4#5 +\cs_set_protected:Npn \__prg_generate_TF_form:wnnnnnn #1 \q_stop #2#3#4#5#6#7 { - \cs_generate_from_arg_count:cNnn { #2 _p: #3 } #1 {#4} - { - #5 \c_zero - \c_true_bool \c_false_bool - } + \exp_args:Nc \exp_args:Nc { cs_ #2 #3 :Npn } { #4 : #5 TF } #6 + { #7 \c_zero } } -\cs_set_protected:Npn \prg_generate_T_form_count:Nnnnn #1#2#3#4#5 +\cs_set_protected:Npn \prg_set_eq_conditional:NNn #1#2 { - \cs_generate_from_arg_count:cNnn { #2 : #3 T } #1 {#4} - { - #5 \c_zero - \use:n \use_none:n - } + \__cs_split_function:NN #2 \__prg_set_eq_conditional:nnNNNn + \cs_set_eq:cc #1 } -\cs_set_protected:Npn \prg_generate_F_form_count:Nnnnn #1#2#3#4#5 +\cs_set_protected:Npn \prg_new_eq_conditional:NNn #1#2 { - \cs_generate_from_arg_count:cNnn { #2 : #3 F } #1 {#4} - { - #5 \c_zero - { } - } + \__cs_split_function:NN #2 \__prg_set_eq_conditional:nnNNNn + \cs_new_eq:cc #1 } -\cs_set_protected:Npn \prg_generate_TF_form_count:Nnnnn #1#2#3#4#5 +\cs_set_protected:Npn \__prg_set_eq_conditional:nnNNNn #1#2#3#4#5#6 { - \cs_generate_from_arg_count:cNnn { #2 : #3 TF } #1 {#4} - { #5 \c_zero } + \__cs_split_function:NN #5 \__prg_set_eq_conditional:nnNnnNNw + {#1} {#2} #3 #4 + #6 , \scan_stop: , \q_recursion_stop + } +\cs_set_protected:Npn \__prg_set_eq_conditional:nnNnnNNw #1#2#3#4#5#6 + { + \if_meaning:w \c_false_bool #3 + \__msg_kernel_error:nnx { kernel } { missing-colon } + { \token_to_str:c {#1} } + \exp_after:wN \use_none_delimit_by_q_recursion_stop:w + \fi: + \if_meaning:w \c_false_bool #6 + \__msg_kernel_error:nnx { kernel } { missing-colon } + { \token_to_str:c {#4} } + \exp_after:wN \use_none_delimit_by_q_recursion_stop:w + \fi: + \__prg_set_eq_conditional_loop:nnnnNw {#1} {#2} {#4} {#5} } -\cs_set_protected:Npn \prg_set_eq_conditional_aux:NNNn #1#2#3#4 - { \prg_set_eq_conditional_aux:NNNw #1#2#3#4 , ? , \q_recursion_stop } -\cs_set_protected:Npn \prg_set_eq_conditional_aux:NNNw #1#2#3#4 , +\cs_set_protected:Npn \__prg_set_eq_conditional_loop:nnnnNw #1#2#3#4#5#6 , { - \if:w ? #4 \scan_stop: + \if_meaning:w \scan_stop: #6 \scan_stop: \exp_after:wN \use_none_delimit_by_q_recursion_stop:w \fi: - #1 - { \exp_args:NNc \cs_split_function:NN #2 { prg_conditional_form_#4:nnn } } - { \exp_args:NNc \cs_split_function:NN #3 { prg_conditional_form_#4:nnn } } - \prg_set_eq_conditional_aux:NNNw #1 {#2} {#3} - } -\cs_set:Npn \prg_conditional_form_p:nnn #1#2#3 { #1 _p : #2 } -\cs_set:Npn \prg_conditional_form_TF:nnn #1#2#3 { #1 : #2 TF } -\cs_set:Npn \prg_conditional_form_T:nnn #1#2#3 { #1 : #2 T } -\cs_set:Npn \prg_conditional_form_F:nnn #1#2#3 { #1 : #2 F } -\tex_chardef:D \c_true_bool = 1~ -\tex_chardef:D \c_false_bool = 0~ + \cs_if_exist:cTF + { \use:c { __prg_conditional_ #6 _form:nn } {#3} {#4} } + { + #5 + { \use:c { __prg_conditional_ #6 _form:nn } {#1} {#2} } + { \use:c { __prg_conditional_ #6 _form:nn } {#3} {#4} } + } + { + \__msg_kernel_error:nnx { kernel } { command-not-defined } + { + \token_to_str:c + { \use:c { __prg_conditional_ #6 _form:nn } {#3} {#4} } + } + } + \__prg_set_eq_conditional_loop:nnnnNw {#1} {#2} {#3} {#4} #5 + } +\cs_set:Npn \__prg_conditional_p_form:nn #1#2 { #1 _p : #2 } +\cs_set:Npn \__prg_conditional_TF_form:nn #1#2 { #1 : #2 TF } +\cs_set:Npn \__prg_conditional_T_form:nn #1#2 { #1 : #2 T } +\cs_set:Npn \__prg_conditional_F_form:nn #1#2 { #1 : #2 F } +\tex_chardef:D \c_true_bool = 1 ~ +\tex_chardef:D \c_false_bool = 0 ~ \cs_set_nopar:Npn \cs_to_str:N { - \int_to_roman:w - \if:w \token_to_str:N \ \cs_to_str_aux:w \fi: - \exp_after:wN \cs_to_str_aux:N \token_to_str:N + \__int_to_roman:w + \if:w \token_to_str:N \ \__cs_to_str:w \fi: + \exp_after:wN \__cs_to_str:N \token_to_str:N } -\cs_set:Npn \cs_to_str_aux:N #1 { \c_zero } -\cs_set:Npn \cs_to_str_aux:w #1 \cs_to_str_aux:N - { - \int_value:w \fi: \exp_after:wN \c_zero } +\cs_set:Npn \__cs_to_str:N #1 { \c_zero } +\cs_set:Npn \__cs_to_str:w #1 \__cs_to_str:N + { - \__int_value:w \fi: \exp_after:wN \c_zero } \group_begin: - \tex_lccode:D `\@ = `\: \scan_stop: - \tex_catcode:D `\@ = 12~ +\tex_lccode:D `\@ = `\: \scan_stop: +\tex_catcode:D `\@ = 12 ~ \tex_lowercase:D { \group_end: - \cs_set:Npn \cs_split_function:NN #1#2 + \cs_set:Npn \__cs_split_function:NN #1 { \exp_after:wN \exp_after:wN - \exp_after:wN \cs_split_function_aux:w - \cs_to_str:N #1 @ a \q_stop #2 + \exp_after:wN \__cs_split_function_i:w + \cs_to_str:N #1 \q_mark \c_true_bool + @ \q_mark \c_false_bool + \q_stop } - \cs_set:Npn \cs_split_function_aux:w #1 @ #2#3 \q_stop #4 - { - \if_meaning:w a #2 - \exp_after:wN \use_i:nn - \else: - \exp_after:wN\use_ii:nn - \fi: - { #4 {#1} { } \c_false_bool } - { \cs_split_function_auxii:w #2#3 \q_stop #4 {#1} } - } - \cs_set:Npn \cs_split_function_auxii:w #1 @a \q_stop #2#3 - { #2{#3}{#1}\c_true_bool } - } -\cs_set:Npn \cs_get_function_name:N #1 - { \cs_split_function:NN #1 \use_i:nnn } -\cs_set:Npn \cs_get_function_signature:N #1 - { \cs_split_function:NN #1 \use_ii:nnn } + \cs_set:Npn \__cs_split_function_i:w #1 @ #2 \q_mark #3#4 \q_stop #5 + { \__cs_split_function_ii:w #5 #1 \q_mark \q_stop {#2} #3 } + \cs_set:Npn \__cs_split_function_ii:w #1#2 \q_mark #3 \q_stop + { #1 {#2} } + } +\cs_set:Npn \__cs_get_function_name:N #1 + { \__cs_split_function:NN #1 \use_i:nnn } +\cs_set:Npn \__cs_get_function_signature:N #1 + { \__cs_split_function:NN #1 \use_ii:nnn } \prg_set_conditional:Npnn \cs_if_exist:N #1 { p , T , F , TF } { \if_meaning:w #1 \scan_stop: @@ -417,7 +439,7 @@ { \tex_immediate:D \tex_write:D \c_minus_one } \cs_set_protected_nopar:Npn \iow_term:x { \tex_immediate:D \tex_write:D \c_sixteen } -\cs_set_protected:Npn \msg_kernel_error:nnxx #1#2#3#4 +\cs_set_protected:Npn \__msg_kernel_error:nnxx #1#2#3#4 { \tex_errmessage:D { @@ -429,85 +451,85 @@ } \tex_end:D } -\cs_set_protected:Npn \msg_kernel_error:nnx #1#2#3 - { \msg_kernel_error:nnxx {#1} {#2} {#3} { } } -\cs_set_protected:Npn \msg_kernel_error:nn #1#2 - { \msg_kernel_error:nnxx {#1} {#2} { } { } } +\cs_set_protected:Npn \__msg_kernel_error:nnx #1#2#3 + { \__msg_kernel_error:nnxx {#1} {#2} {#3} { } } +\cs_set_protected:Npn \__msg_kernel_error:nn #1#2 + { \__msg_kernel_error:nnxx {#1} {#2} { } { } } \cs_set_nopar:Npn \msg_line_context: - { on~line~\tex_the:D \tex_inputlineno:D } -\cs_set_protected:Npn \chk_if_free_cs:N #1 + { on~line~ \tex_the:D \tex_inputlineno:D } +\cs_set_protected:Npn \__chk_if_free_cs:N #1 { \cs_if_free:NF #1 { - \msg_kernel_error:nnxx { kernel } { command-already-defined } + \__msg_kernel_error:nnxx { kernel } { command-already-defined } { \token_to_str:N #1 } { \token_to_meaning:N #1 } } } \tex_ifodd:D \l@expl@log@functions@bool - \cs_set_protected:Npn \chk_if_free_cs:N #1 + \cs_set_protected:Npn \__chk_if_free_cs:N #1 { \cs_if_free:NF #1 { - \msg_kernel_error:nnxx { kernel } { command-already-defined } + \__msg_kernel_error:nnxx { kernel } { command-already-defined } { \token_to_str:N #1 } { \token_to_meaning:N #1 } } \iow_log:x { Defining~\token_to_str:N #1~ \msg_line_context: } } \fi: -\cs_set_protected_nopar:Npn \chk_if_free_cs:c - { \exp_args:Nc \chk_if_free_cs:N } -\cs_set_protected:Npn \chk_if_exist_cs:N #1 +\cs_set_protected_nopar:Npn \__chk_if_free_cs:c + { \exp_args:Nc \__chk_if_free_cs:N } +\cs_set_protected:Npn \__chk_if_exist_cs:N #1 { \cs_if_exist:NF #1 { - \msg_kernel_error:nnxx { kernel } { command-not-defined } - { \token_to_str:N #1 } { \token_to_meaning:N #1 } + \__msg_kernel_error:nnx { kernel } { command-not-defined } + { \token_to_str:N #1 } } } -\cs_set_protected_nopar:Npn \chk_if_exist_cs:c - { \exp_args:Nc \chk_if_exist_cs:N } -\cs_set:Npn \cs_tmp:w #1#2 +\cs_set_protected_nopar:Npn \__chk_if_exist_cs:c + { \exp_args:Nc \__chk_if_exist_cs:N } +\cs_set:Npn \__cs_tmp:w #1#2 { \cs_set_protected:Npn #1 ##1 { - \chk_if_free_cs:N ##1 + \__chk_if_free_cs:N ##1 #2 ##1 } } -\cs_tmp:w \cs_new_nopar:Npn \cs_gset_nopar:Npn -\cs_tmp:w \cs_new_nopar:Npx \cs_gset_nopar:Npx -\cs_tmp:w \cs_new:Npn \cs_gset:Npn -\cs_tmp:w \cs_new:Npx \cs_gset:Npx -\cs_tmp:w \cs_new_protected_nopar:Npn \cs_gset_protected_nopar:Npn -\cs_tmp:w \cs_new_protected_nopar:Npx \cs_gset_protected_nopar:Npx -\cs_tmp:w \cs_new_protected:Npn \cs_gset_protected:Npn -\cs_tmp:w \cs_new_protected:Npx \cs_gset_protected:Npx -\cs_set:Npn \cs_tmp:w #1#2 +\__cs_tmp:w \cs_new_nopar:Npn \cs_gset_nopar:Npn +\__cs_tmp:w \cs_new_nopar:Npx \cs_gset_nopar:Npx +\__cs_tmp:w \cs_new:Npn \cs_gset:Npn +\__cs_tmp:w \cs_new:Npx \cs_gset:Npx +\__cs_tmp:w \cs_new_protected_nopar:Npn \cs_gset_protected_nopar:Npn +\__cs_tmp:w \cs_new_protected_nopar:Npx \cs_gset_protected_nopar:Npx +\__cs_tmp:w \cs_new_protected:Npn \cs_gset_protected:Npn +\__cs_tmp:w \cs_new_protected:Npx \cs_gset_protected:Npx +\cs_set:Npn \__cs_tmp:w #1#2 { \cs_new_protected_nopar:Npn #1 { \exp_args:Nc #2 } } -\cs_tmp:w \cs_set_nopar:cpn \cs_set_nopar:Npn -\cs_tmp:w \cs_set_nopar:cpx \cs_set_nopar:Npx -\cs_tmp:w \cs_gset_nopar:cpn \cs_gset_nopar:Npn -\cs_tmp:w \cs_gset_nopar:cpx \cs_gset_nopar:Npx -\cs_tmp:w \cs_new_nopar:cpn \cs_new_nopar:Npn -\cs_tmp:w \cs_new_nopar:cpx \cs_new_nopar:Npx -\cs_tmp:w \cs_set:cpn \cs_set:Npn -\cs_tmp:w \cs_set:cpx \cs_set:Npx -\cs_tmp:w \cs_gset:cpn \cs_gset:Npn -\cs_tmp:w \cs_gset:cpx \cs_gset:Npx -\cs_tmp:w \cs_new:cpn \cs_new:Npn -\cs_tmp:w \cs_new:cpx \cs_new:Npx -\cs_tmp:w \cs_set_protected_nopar:cpn \cs_set_protected_nopar:Npn -\cs_tmp:w \cs_set_protected_nopar:cpx \cs_set_protected_nopar:Npx -\cs_tmp:w \cs_gset_protected_nopar:cpn \cs_gset_protected_nopar:Npn -\cs_tmp:w \cs_gset_protected_nopar:cpx \cs_gset_protected_nopar:Npx -\cs_tmp:w \cs_new_protected_nopar:cpn \cs_new_protected_nopar:Npn -\cs_tmp:w \cs_new_protected_nopar:cpx \cs_new_protected_nopar:Npx -\cs_tmp:w \cs_set_protected:cpn \cs_set_protected:Npn -\cs_tmp:w \cs_set_protected:cpx \cs_set_protected:Npx -\cs_tmp:w \cs_gset_protected:cpn \cs_gset_protected:Npn -\cs_tmp:w \cs_gset_protected:cpx \cs_gset_protected:Npx -\cs_tmp:w \cs_new_protected:cpn \cs_new_protected:Npn -\cs_tmp:w \cs_new_protected:cpx \cs_new_protected:Npx +\__cs_tmp:w \cs_set_nopar:cpn \cs_set_nopar:Npn +\__cs_tmp:w \cs_set_nopar:cpx \cs_set_nopar:Npx +\__cs_tmp:w \cs_gset_nopar:cpn \cs_gset_nopar:Npn +\__cs_tmp:w \cs_gset_nopar:cpx \cs_gset_nopar:Npx +\__cs_tmp:w \cs_new_nopar:cpn \cs_new_nopar:Npn +\__cs_tmp:w \cs_new_nopar:cpx \cs_new_nopar:Npx +\__cs_tmp:w \cs_set:cpn \cs_set:Npn +\__cs_tmp:w \cs_set:cpx \cs_set:Npx +\__cs_tmp:w \cs_gset:cpn \cs_gset:Npn +\__cs_tmp:w \cs_gset:cpx \cs_gset:Npx +\__cs_tmp:w \cs_new:cpn \cs_new:Npn +\__cs_tmp:w \cs_new:cpx \cs_new:Npx +\__cs_tmp:w \cs_set_protected_nopar:cpn \cs_set_protected_nopar:Npn +\__cs_tmp:w \cs_set_protected_nopar:cpx \cs_set_protected_nopar:Npx +\__cs_tmp:w \cs_gset_protected_nopar:cpn \cs_gset_protected_nopar:Npn +\__cs_tmp:w \cs_gset_protected_nopar:cpx \cs_gset_protected_nopar:Npx +\__cs_tmp:w \cs_new_protected_nopar:cpn \cs_new_protected_nopar:Npn +\__cs_tmp:w \cs_new_protected_nopar:cpx \cs_new_protected_nopar:Npx +\__cs_tmp:w \cs_set_protected:cpn \cs_set_protected:Npn +\__cs_tmp:w \cs_set_protected:cpx \cs_set_protected:Npx +\__cs_tmp:w \cs_gset_protected:cpn \cs_gset_protected:Npn +\__cs_tmp:w \cs_gset_protected:cpx \cs_gset_protected:Npx +\__cs_tmp:w \cs_new_protected:cpn \cs_new_protected:Npn +\__cs_tmp:w \cs_new_protected:cpx \cs_new_protected:Npx \cs_new_protected:Npn \cs_set_eq:NN #1 { \tex_let:D #1 =~ } \cs_new_protected_nopar:Npn \cs_set_eq:cN { \exp_args:Nc \cs_set_eq:NN } \cs_new_protected_nopar:Npn \cs_set_eq:Nc { \exp_args:NNc \cs_set_eq:NN } @@ -518,7 +540,7 @@ \cs_new_protected_nopar:Npn \cs_gset_eq:cc { \exp_args:Ncc \cs_gset_eq:NN } \cs_new_protected:Npn \cs_new_eq:NN #1 { - \chk_if_free_cs:N #1 + \__chk_if_free_cs:N #1 \tex_global:D \cs_set_eq:NN #1 } \cs_new_protected_nopar:Npn \cs_new_eq:cN { \exp_args:Nc \cs_new_eq:NN } @@ -535,122 +557,142 @@ \fi: { \cs_gset_eq:cN {#1} \c_undefined:D } } -\cs_new:Npn \cs_get_arg_count_from_signature:N #1 - { \cs_split_function:NN #1 \cs_get_arg_count_from_signature_aux:nnN } -\cs_new:Npn \cs_get_arg_count_from_signature_aux:nnN #1#2#3 +\cs_set_protected:Npn \__cs_parm_from_arg_count:nnF #1#2 { - \if_meaning:w \c_true_bool #3 - \exp_after:wN \use_i:nn + \exp_args:Nx \__cs_parm_from_arg_count_test:nnF + { + \exp_after:wN \exp_not:n + \if_case:w \__int_eval:w #2 \__int_eval_end: + { } + \or: { ##1 } + \or: { ##1##2 } + \or: { ##1##2##3 } + \or: { ##1##2##3##4 } + \or: { ##1##2##3##4##5 } + \or: { ##1##2##3##4##5##6 } + \or: { ##1##2##3##4##5##6##7 } + \or: { ##1##2##3##4##5##6##7##8 } + \or: { ##1##2##3##4##5##6##7##8##9 } + \else: { \c_false_bool } + \fi: + } + {#1} + } +\cs_set_protected:Npn \__cs_parm_from_arg_count_test:nnF #1#2 + { + \if_meaning:w \c_false_bool #1 + \exp_after:wN \use_ii:nn \else: - \exp_after:wN\use_ii:nn + \exp_after:wN \use_i:nn \fi: - { - \exp_after:wN \cs_get_arg_count_from_signature_auxii:w - \use_none:nnnnnnnnn #2 9876543210 \q_stop - } - { -1 } -} -\cs_new:Npn \cs_get_arg_count_from_signature_auxii:w #1#2 \q_stop {#1} -\cs_new_nopar:Npn \cs_get_arg_count_from_signature:c - { \exp_args:Nc \cs_get_arg_count_from_signature:N } -\cs_new_protected:Npn \cs_generate_from_arg_count:NNnn #1#2#3#4 + { #2 {#1} } + } +\cs_new:Npn \__cs_count_signature:N #1 + { \int_eval:n { \__cs_split_function:NN #1 \__cs_count_signature:nnN } } +\cs_new:Npn \__cs_count_signature:nnN #1#2#3 { - \if_case:w \int_eval:w #3 \int_eval_end: - \cs_generate_from_arg_count_aux:nwn {} - \or: \cs_generate_from_arg_count_aux:nwn {##1} - \or: \cs_generate_from_arg_count_aux:nwn {##1##2} - \or: \cs_generate_from_arg_count_aux:nwn {##1##2##3} - \or: \cs_generate_from_arg_count_aux:nwn {##1##2##3##4} - \or: \cs_generate_from_arg_count_aux:nwn {##1##2##3##4##5} - \or: \cs_generate_from_arg_count_aux:nwn {##1##2##3##4##5##6} - \or: \cs_generate_from_arg_count_aux:nwn {##1##2##3##4##5##6##7} - \or: \cs_generate_from_arg_count_aux:nwn {##1##2##3##4##5##6##7##8} - \or: \cs_generate_from_arg_count_aux:nwn {##1##2##3##4##5##6##7##8##9} + \if_meaning:w \c_true_bool #3 + \tl_count:n {#2} \else: - \cs_generate_from_arg_count_error_msg:Nn #1 {#3} - \use_i:nnn + \c_minus_one \fi: - {#2#1} - {#4} } -\cs_new_protected:Npn - \cs_generate_from_arg_count_aux:nwn #1 #2 \fi: #3 - { \fi: #3 #1 } +\cs_new_nopar:Npn \__cs_count_signature:c + { \exp_args:Nc \__cs_count_signature:N } +\cs_new_protected:Npn \cs_generate_from_arg_count:NNnn #1#2#3#4 + { + \__cs_parm_from_arg_count:nnF { \use:nnn #2 #1 } {#3} + { + \__msg_kernel_error:nnxx { kernel } { bad-number-of-arguments } + { \token_to_str:N #1 } { \int_eval:n {#3} } + } + {#4} + } \cs_new_protected_nopar:Npn \cs_generate_from_arg_count:cNnn { \exp_args:Nc \cs_generate_from_arg_count:NNnn } \cs_new_protected_nopar:Npn \cs_generate_from_arg_count:Ncnn { \exp_args:NNc \cs_generate_from_arg_count:NNnn } -\cs_new_protected:Npn \cs_generate_from_arg_count_error_msg:Nn #1#2 +\cs_set:Npn \__cs_tmp:w #1#2#3 + { + \cs_new_protected_nopar:cpx { cs_ #1 : #2 } + { + \exp_not:N \__cs_generate_from_signature:NNn + \exp_after:wN \exp_not:N \cs:w cs_ #1 : #3 \cs_end: + } + } +\cs_new_protected:Npn \__cs_generate_from_signature:NNn #1#2 { - \msg_kernel_error:nnxx { kernel } { bad-number-of-arguments } - { \token_to_str:N #1 } { \int_eval:n {#2} } + \__cs_split_function:NN #2 \__cs_generate_from_signature:nnNNNn + #1 #2 } -\cs_set:Npn \cs_tmp:w #1#2#3 +\cs_new_protected:Npn \__cs_generate_from_signature:nnNNNn #1#2#3#4#5#6 { - \cs_new_protected:cpx { cs_ #1 : #2 } ##1##2 + \bool_if:NTF #3 + { + \cs_generate_from_arg_count:NNnn + #5 #4 { \tl_count:n {#2} } {#6} + } { - \exp_not:N \cs_generate_from_arg_count:NNnn ##1 - \exp_after:wN \exp_not:N \cs:w cs_#1 : #3 \cs_end: - { \exp_not:N \cs_get_arg_count_from_signature:N ##1 }{##2} + \__msg_kernel_error:nnx { kernel } { missing-colon } + { \token_to_str:N #5 } } } -\cs_tmp:w { set } { Nn } { Npn } -\cs_tmp:w { set } { Nx } { Npx } -\cs_tmp:w { set_nopar } { Nn } { Npn } -\cs_tmp:w { set_nopar } { Nx } { Npx } -\cs_tmp:w { set_protected } { Nn } { Npn } -\cs_tmp:w { set_protected } { Nx } { Npx } -\cs_tmp:w { set_protected_nopar } { Nn } { Npn } -\cs_tmp:w { set_protected_nopar } { Nx } { Npx } -\cs_tmp:w { gset } { Nn } { Npn } -\cs_tmp:w { gset } { Nx } { Npx } -\cs_tmp:w { gset_nopar } { Nn } { Npn } -\cs_tmp:w { gset_nopar } { Nx } { Npx } -\cs_tmp:w { gset_protected } { Nn } { Npn } -\cs_tmp:w { gset_protected } { Nx } { Npx } -\cs_tmp:w { gset_protected_nopar } { Nn } { Npn } -\cs_tmp:w { gset_protected_nopar } { Nx } { Npx } -\cs_tmp:w { new } { Nn } { Npn } -\cs_tmp:w { new } { Nx } { Npx } -\cs_tmp:w { new_nopar } { Nn } { Npn } -\cs_tmp:w { new_nopar } { Nx } { Npx } -\cs_tmp:w { new_protected } { Nn } { Npn } -\cs_tmp:w { new_protected } { Nx } { Npx } -\cs_tmp:w { new_protected_nopar } { Nn } { Npn } -\cs_tmp:w { new_protected_nopar } { Nx } { Npx } -\cs_set:Npn \cs_tmp:w #1#2#3 - { - \cs_new_protected:cpx {cs_#1:#2} ##1##2 +\__cs_tmp:w { set } { Nn } { Npn } +\__cs_tmp:w { set } { Nx } { Npx } +\__cs_tmp:w { set_nopar } { Nn } { Npn } +\__cs_tmp:w { set_nopar } { Nx } { Npx } +\__cs_tmp:w { set_protected } { Nn } { Npn } +\__cs_tmp:w { set_protected } { Nx } { Npx } +\__cs_tmp:w { set_protected_nopar } { Nn } { Npn } +\__cs_tmp:w { set_protected_nopar } { Nx } { Npx } +\__cs_tmp:w { gset } { Nn } { Npn } +\__cs_tmp:w { gset } { Nx } { Npx } +\__cs_tmp:w { gset_nopar } { Nn } { Npn } +\__cs_tmp:w { gset_nopar } { Nx } { Npx } +\__cs_tmp:w { gset_protected } { Nn } { Npn } +\__cs_tmp:w { gset_protected } { Nx } { Npx } +\__cs_tmp:w { gset_protected_nopar } { Nn } { Npn } +\__cs_tmp:w { gset_protected_nopar } { Nx } { Npx } +\__cs_tmp:w { new } { Nn } { Npn } +\__cs_tmp:w { new } { Nx } { Npx } +\__cs_tmp:w { new_nopar } { Nn } { Npn } +\__cs_tmp:w { new_nopar } { Nx } { Npx } +\__cs_tmp:w { new_protected } { Nn } { Npn } +\__cs_tmp:w { new_protected } { Nx } { Npx } +\__cs_tmp:w { new_protected_nopar } { Nn } { Npn } +\__cs_tmp:w { new_protected_nopar } { Nx } { Npx } +\cs_set:Npn \__cs_tmp:w #1#2 + { + \cs_new_protected_nopar:cpx { cs_ #1 : c #2 } { - \exp_not:N \cs_generate_from_arg_count:cNnn {##1} - \exp_after:wN \exp_not:N \cs:w cs_#1:#3 \cs_end: - { \exp_not:N \cs_get_arg_count_from_signature:c {##1} } {##2} + \exp_not:N \exp_args:Nc + \exp_after:wN \exp_not:N \cs:w cs_ #1 : N #2 \cs_end: } } -\cs_tmp:w { set } { cn } { Npn } -\cs_tmp:w { set } { cx } { Npx } -\cs_tmp:w { set_nopar } { cn } { Npn } -\cs_tmp:w { set_nopar } { cx } { Npx } -\cs_tmp:w { set_protected } { cn } { Npn } -\cs_tmp:w { set_protected } { cx } { Npx } -\cs_tmp:w { set_protected_nopar } { cn } { Npn } -\cs_tmp:w { set_protected_nopar } { cx } { Npx } -\cs_tmp:w { gset } { cn } { Npn } -\cs_tmp:w { gset } { cx } { Npx } -\cs_tmp:w { gset_nopar } { cn } { Npn } -\cs_tmp:w { gset_nopar } { cx } { Npx } -\cs_tmp:w { gset_protected } { cn } { Npn } -\cs_tmp:w { gset_protected } { cx } { Npx } -\cs_tmp:w { gset_protected_nopar } { cn } { Npn } -\cs_tmp:w { gset_protected_nopar } { cx } { Npx } -\cs_tmp:w { new } { cn } { Npn } -\cs_tmp:w { new } { cx } { Npx } -\cs_tmp:w { new_nopar } { cn } { Npn } -\cs_tmp:w { new_nopar } { cx } { Npx } -\cs_tmp:w { new_protected } { cn } { Npn } -\cs_tmp:w { new_protected } { cx } { Npx } -\cs_tmp:w { new_protected_nopar } { cn } { Npn } -\cs_tmp:w { new_protected_nopar } { cx } { Npx } +\__cs_tmp:w { set } { n } +\__cs_tmp:w { set } { x } +\__cs_tmp:w { set_nopar } { n } +\__cs_tmp:w { set_nopar } { x } +\__cs_tmp:w { set_protected } { n } +\__cs_tmp:w { set_protected } { x } +\__cs_tmp:w { set_protected_nopar } { n } +\__cs_tmp:w { set_protected_nopar } { x } +\__cs_tmp:w { gset } { n } +\__cs_tmp:w { gset } { x } +\__cs_tmp:w { gset_nopar } { n } +\__cs_tmp:w { gset_nopar } { x } +\__cs_tmp:w { gset_protected } { n } +\__cs_tmp:w { gset_protected } { x } +\__cs_tmp:w { gset_protected_nopar } { n } +\__cs_tmp:w { gset_protected_nopar } { x } +\__cs_tmp:w { new } { n } +\__cs_tmp:w { new } { x } +\__cs_tmp:w { new_nopar } { n } +\__cs_tmp:w { new_nopar } { x } +\__cs_tmp:w { new_protected } { n } +\__cs_tmp:w { new_protected } { x } +\__cs_tmp:w { new_protected_nopar } { n } +\__cs_tmp:w { new_protected_nopar } { x } \prg_new_conditional:Npnn \cs_if_eq:NN #1#2 { p , T , F , TF } { \if_meaning:w #1#2 @@ -668,17 +710,17 @@ \cs_new_nopar:Npn \cs_if_eq:ccTF { \exp_args:Ncc \cs_if_eq:NNTF } \cs_new_nopar:Npn \cs_if_eq:ccT { \exp_args:Ncc \cs_if_eq:NNT } \cs_new_nopar:Npn \cs_if_eq:ccF { \exp_args:Ncc \cs_if_eq:NNF } -\cs_new:Npn \kernel_register_show:N #1 +\cs_new_protected:Npn \__kernel_register_show:N #1 { \cs_if_exist:NTF #1 { \tex_showthe:D \use:n {#1} } { - \msg_kernel_error:nnx { kernel } { variable-not-defined } + \__msg_kernel_error:nnx { kernel } { variable-not-defined } { \token_to_str:N #1 } } } -\cs_new_nopar:Npn \kernel_register_show:c - { \exp_args:Nc \kernel_register_show:N } +\cs_new_protected_nopar:Npn \__kernel_register_show:c + { \exp_args:Nc \__kernel_register_show:N } \cs_new_eq:NN \luatex_if_engine:T \use_none:n \cs_new_eq:NN \luatex_if_engine:F \use:n \cs_new_eq:NN \luatex_if_engine:TF \use_ii:nn @@ -720,14 +762,57 @@ = \c_zero \prg_return_true: \else: \prg_return_false: \fi: } -\prg_new_conditional:Npnn \str_if_eq:xx #1#2 { p , T , F , TF } +\prg_new_conditional:Npnn \str_if_eq_x:nn #1#2 { p , T , F , TF } { \if_int_compare:w \pdftex_strcmp:D {#1} {#2} = \c_zero \prg_return_true: \else: \prg_return_false: \fi: } -\cs_new_eq:NN \prg_break_point:n \use:n -\cs_new:Npn \prg_map_break: #1 \prg_break_point:n #2 { #2 } -\cs_new:Npn \prg_map_break:n #1 #2 \prg_break_point:n #3 { #3 #1 } +\cs_new:Npn \__str_if_eq_x_return:nn #1 #2 + { + \if_int_compare:w \pdftex_strcmp:D {#1} {#2} = \c_zero + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\cs_new:Npn \str_case:nnn #1#2#3 + { + \tex_romannumeral:D + \__str_case:nw {#1} #2 {#1} {#3} \q_recursion_stop + } +\cs_new:Npn \__str_case:nw #1#2#3 + { + \str_if_eq:nnTF {#1} {#2} + { \__str_case_end:nw {#3} } + { \__str_case:nw {#1} } + } +\cs_new:Npn \str_case_x:nnn #1#2#3 + { + \tex_romannumeral:D + \__str_case_x:nw {#1} #2 {#1} {#3} \q_recursion_stop + } +\cs_new:Npn \__str_case_x:nw #1#2#3 + { + \str_if_eq_x:nnTF {#1} {#2} + { \__str_case_end:nw {#3} } + { \__str_case_x:nw {#1} } + } +\cs_new:Npn \__prg_case_end:nw #1#2 \q_recursion_stop { \c_zero #1 } +\cs_new_eq:NN \__str_case_end:nw \__prg_case_end:nw +\cs_new_eq:NN \__prg_break_point:Nn \use_ii:nn +\cs_new:Npn \__prg_map_break:Nn #1#2#3 \__prg_break_point:Nn #4#5 + { + #5 + \if_meaning:w #1 #4 + \exp_after:wN \use_iii:nnn + \fi: + \__prg_map_break:Nn #1 {#2} + } +\cs_new_eq:NN \str_if_eq_p:xx \str_if_eq_x_p:nn +\cs_new_eq:NN \str_if_eq:xxT \str_if_eq_x:nnT +\cs_new_eq:NN \str_if_eq:xxF \str_if_eq_x:nnF +\cs_new_eq:NN \str_if_eq:xxTF \str_if_eq_x:nnTF +\cs_new_eq:NN \chk_if_free_cs:N \__chk_if_free_cs:N %% %% %% End of file `l3basics.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3bootstrap.sty b/Master/texmf-dist/tex/latex/l3kernel/l3bootstrap.sty index f5320078a78..8a260b26410 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3bootstrap.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3bootstrap.sty @@ -13,7 +13,7 @@ %% %% Do not distribute a modified version of this file. %% -%% File: l3bootstrap.dtx Copyright (C) 2011 The LaTeX3 project +%% File: l3bootstrap.dtx Copyright (C) 2011-2012 The 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 @@ -46,20 +46,20 @@ %% %% ----------------------------------------------------------------------- \protected\def\GetIdInfo - { + {% \begingroup - \catcode 32 = 10 \relax - \GetIdInfoAuxI + \catcode 32 = 10 % + \GetIdInfoAuxI } \protected\def\GetIdInfoAuxI$#1$#2% - { + {% \def\tempa{#1}% \def\tempb{Id}% \ifx\tempa\tempb \def\tempa {% \endgroup - \def\ExplFileDate{9999/99/99}% + \def\ExplFileDate{9999/12/31}% \def\ExplFileDescription{#2}% \def\ExplFileName{[unknown name]}% \def\ExplFileExtension{[unknown extension]}% @@ -69,33 +69,41 @@ \def\tempa {% \endgroup - \GetIdInfoAuxII$#1${#2}% + \def\ExplFileDescription{#2}% + \GetIdInfoAuxII$#1 $% }% \fi \tempa } -\protected\def\GetIdInfoAuxII$#1 #2.#3 #4 #5 #6 #7 #8$#9% +\protected\def\GetIdInfoAuxII$#1 #2.#3 #4 #5 #6$% {% \def\ExplFileName{#2}% \def\ExplFileExtension{#3}% \def\ExplFileVersion{#4}% - \def\ExplFileDescription{#9}% - \GetIdInfoAuxIII#5\relax#3\relax#5\relax#6\relax + \begingroup + \def\tempa{#4}% + \def\tempb{-1}% + \ifx\tempa\tempb + \def\tempa + {% + \endgroup + \def\ExplFileDate{0000/00/00}% + }% + \else + \def\tempa + {% + \endgroup + \GetIdInfoAuxIII$#5$% + }% + \fi + \tempa } -\protected\def\GetIdInfoAuxIII#1#2#3#4#5#6\relax +\protected\def\GetIdInfoAuxIII$#1-#2-#3$% {% - \ifx#5/% - \expandafter\GetIdInfoAuxCVS - \else - \expandafter\GetIdInfoAuxSVN - \fi + \def\ExplFileDate{#1/#2/#3}% } -\protected\def\GetIdInfoAuxCVS#1,v\relax#2\relax#3\relax - {\def\ExplFileDate{#2}} -\protected\def\GetIdInfoAuxSVN#1\relax#2-#3-#4\relax#5Z\relax - {\def\ExplFileDate{#2/#3/#4}} -\GetIdInfo$Id: l3bootstrap.dtx 3110 2011-12-29 14:23:48Z joseph $ - {L3 experimental bootstrap code} +\GetIdInfo$Id: l3bootstrap.dtx 3986 2012-07-15 19:23:51Z joseph $ + {L3 Bootstrap code} \ProvidesPackage{l3bootstrap} [% \ExplFileDate\space v\ExplFileVersion\space @@ -113,6 +121,26 @@ \else \expandafter\@tempa \fi +\begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname pdfstrcmp\endcsname\relax + \let\pdfstrcmp\strcmp +\fi +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname pdfstrcmp\endcsname\relax + \PackageError{expl3}{Required primitives not found} + {% + LaTeX3 requires the e-TeX primitives and \string\pdfstrcmp.\MessageBreak + \MessageBreak + These are available in engine versions:\MessageBreak + - pdfTeX 1.30\MessageBreak + - XeTeX 0.9994\MessageBreak + - LuaTeX 0.40\MessageBreak + or later.\MessageBreak + \MessageBreak + Loading of expl3 will abort!% + } + \expandafter\endinput +\fi \protected\edef\ExplSyntaxOff {% \catcode 9 = \the\catcode 9\relax @@ -125,7 +153,7 @@ \catcode 124 = \the\catcode 124\relax \catcode 126 = \the\catcode 126\relax \endlinechar = \the\endlinechar\relax - \chardef\csname\detokenize{l_expl_status_bool}\endcsname = 0 \relax + \chardef\csname\detokenize{l__kernel_expl_bool}\endcsname = 0 \relax } \protected\edef\ExplSyntaxOn { @@ -138,56 +166,9 @@ \catcode 124 = 12 \relax \catcode 126 = 10 \relax \endlinechar = 32 \relax - \chardef\csname\detokenize{l_expl_status_bool}\endcsname = 1 \relax + \chardef\csname\detokenize{l__kernel_expl_bool}\endcsname = 1 \relax } -\expandafter\chardef\csname\detokenize{l_expl_status_bool}\endcsname = 0 \relax -\protected\def\GetIdInfo - { - \begingroup - \catcode 32 = 10 \relax - \GetIdInfoAuxI - } -\protected\def\GetIdInfoAuxI$#1$#2% - { - \def\tempa{#1}% - \def\tempb{Id}% - \ifx\tempa\tempb - \def\tempa - {% - \endgroup - \def\ExplFileDate{9999/99/99}% - \def\ExplFileDescription{#2}% - \def\ExplFileName{[unknown name]}% - \def\ExplFileVersion{999}% - }% - \else - \def\tempa - {% - \endgroup - \GetIdInfoAuxII$#1${#2}% - }% - \fi - \tempa - } -\protected\def\GetIdInfoAuxII$#1 #2.#3 #4 #5 #6 #7 #8$#9% - {% - \def\ExplFileName{#2}% - \def\ExplFileVersion{#4}% - \def\ExplFileDescription{#9}% - \GetIdInfoAuxIII#5\relax#3\relax#5\relax#6\relax - } -\protected\def\GetIdInfoAuxIII#1#2#3#4#5#6\relax - {% - \ifx#5/% - \expandafter\GetIdInfoAuxCVS - \else - \expandafter\GetIdInfoAuxSVN - \fi - } -\protected\def\GetIdInfoAuxCVS#1,v\relax#2\relax#3\relax - {\def\ExplFileDate{#2}} -\protected\def\GetIdInfoAuxSVN#1\relax#2-#3-#4\relax#5Z\relax - {\def\ExplFileDate{#2/#3/#4}} +\expandafter\chardef\csname\detokenize{l__kernel_expl_bool}\endcsname = 0 \relax \protected\def\ProvidesExplPackage#1#2#3#4% {% \ProvidesPackage{#1}[#2 v#3 #4]% @@ -206,16 +187,16 @@ \edef\@pushfilename {% \edef\expandafter\noexpand - \csname\detokenize{l_expl_status_stack_tl}\endcsname + \csname\detokenize{l__expl_status_stack_tl}\endcsname {% \noexpand\ifodd\expandafter\noexpand - \csname\detokenize{l_expl_status_bool}\endcsname + \csname\detokenize{l__kernel_expl_bool}\endcsname 1% \noexpand\else 0% \noexpand\fi \expandafter\noexpand - \csname\detokenize{l_expl_status_stack_tl}\endcsname + \csname\detokenize{l__expl_status_stack_tl}\endcsname }% \ExplSyntaxOff \unexpanded\expandafter{\@pushfilename}% @@ -224,22 +205,22 @@ {% \unexpanded\expandafter{\@popfilename}% \noexpand\if a\expandafter\noexpand\csname - \detokenize{l_expl_status_stack_tl}\endcsname a% + \detokenize{l__expl_status_stack_tl}\endcsname a% \ExplSyntaxOff \noexpand\else \noexpand\expandafter \expandafter\noexpand\csname - \detokenize{expl_status_pop:w}\endcsname + \detokenize{__expl_status_pop:w}\endcsname \expandafter\noexpand\csname - \detokenize{l_expl_status_stack_tl}\endcsname + \detokenize{l__expl_status_stack_tl}\endcsname \noexpand\@nil \noexpand\fi } -\@namedef{\detokenize{l_expl_status_stack_tl}}{0} -\expandafter\edef\csname\detokenize{expl_status_pop:w}\endcsname#1#2\@nil +\@namedef{\detokenize{l__expl_status_stack_tl}}{0} +\expandafter\edef\csname\detokenize{__expl_status_pop:w}\endcsname#1#2\@nil {% \def\expandafter\noexpand - \csname\detokenize{l_expl_status_stack_tl}\endcsname{#2}% + \csname\detokenize{l__expl_status_stack_tl}\endcsname{#2}% \noexpand\ifodd#1\space \noexpand\expandafter\noexpand\ExplSyntaxOn \noexpand\else @@ -247,7 +228,7 @@ \noexpand\fi } \expandafter\protected\expandafter\def - \csname\detokenize{package_check_loaded_expl:}\endcsname + \csname\detokenize{__expl_package_check:}\endcsname {% \@ifpackageloaded{expl3} {} @@ -256,30 +237,10 @@ {Cannot load the expl3 modules separately} {% The expl3 modules cannot be loaded separately;\MessageBreak - please \string\usepackage\string{expl3\string} instead. + please \string\usepackage\string{expl3\string} instead.% }% }% } -\begingroup\expandafter\expandafter\expandafter\endgroup - \expandafter\ifx\csname pdfstrcmp\endcsname\relax - \let\pdfstrcmp\strcmp -\fi -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname pdfstrcmp\endcsname\relax - \PackageError{l3names}{Required primitive not found: \protect\pdfstrcmp} - {% - LaTeX3 requires the e-TeX primitives and - \string\pdfstrcmp.\MessageBreak - These are available in engine versions: \MessageBreak - - pdfTeX 1.30 \MessageBreak - - XeTeX 0.9994 \MessageBreak - - LuaTeX 0.60 \MessageBreak - or later. \MessageBreak - \MessageBreak - Loading of expl3 will abort! - } - \expandafter\endinput -\fi \protected\edef\ExplSyntaxNamesOn {% \expandafter\noexpand diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3box.sty b/Master/texmf-dist/tex/latex/l3kernel/l3box.sty index c78a4f2122e..7e275624379 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3box.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3box.sty @@ -46,14 +46,14 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3box.dtx 3490 2012-03-04 01:00:53Z bruno $ +\GetIdInfo$Id: l3box.dtx 3986 2012-07-15 19:23:51Z joseph $ {L3 Experimental boxes} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\package_check_loaded_expl: +\__expl_package_check: \cs_new_protected:Npn \box_new:N #1 { - \chk_if_free_cs:N #1 + \__chk_if_free_cs:N #1 \newbox #1 } \cs_generate_variant:Nn \box_new:N { c } @@ -73,14 +73,14 @@ { \tex_setbox:D #1 \tex_copy:D #2 } \cs_new_protected:Npn \box_gset_eq:NN { \tex_global:D \box_set_eq:NN } -\cs_generate_variant:Nn \box_set_eq:NN { cN , Nc , cc } -\cs_generate_variant:Nn \box_gset_eq:NN { cN , Nc , cc } +\cs_generate_variant:Nn \box_set_eq:NN { c , Nc , cc } +\cs_generate_variant:Nn \box_gset_eq:NN { c , Nc , cc } \cs_new_protected:Npn \box_set_eq_clear:NN #1#2 { \tex_setbox:D #1 \tex_box:D #2 } \cs_new_protected:Npn \box_gset_eq_clear:NN { \tex_global:D \box_set_eq_clear:NN } -\cs_generate_variant:Nn \box_set_eq_clear:NN { cN , Nc , cc } -\cs_generate_variant:Nn \box_gset_eq_clear:NN { cN , Nc , cc } +\cs_generate_variant:Nn \box_set_eq_clear:NN { c , Nc , cc } +\cs_generate_variant:Nn \box_gset_eq_clear:NN { c , Nc , cc } \cs_new_eq:NN \box_if_exist:NTF \cs_if_exist:NTF \cs_new_eq:NN \box_if_exist:NT \cs_if_exist:NT \cs_new_eq:NN \box_if_exist:NF \cs_if_exist:NF @@ -96,11 +96,11 @@ \cs_generate_variant:Nn \box_dp:N { c } \cs_generate_variant:Nn \box_wd:N { c } \cs_new_protected:Npn \box_set_dp:Nn #1#2 - { \box_dp:N #1 \dim_eval:w #2 \dim_eval_end: } + { \box_dp:N #1 \__dim_eval:w #2 \__dim_eval_end: } \cs_new_protected:Npn \box_set_ht:Nn #1#2 - { \box_ht:N #1 \dim_eval:w #2 \dim_eval_end: } + { \box_ht:N #1 \__dim_eval:w #2 \__dim_eval_end: } \cs_new_protected:Npn \box_set_wd:Nn #1#2 - { \box_wd:N #1 \dim_eval:w #2 \dim_eval_end: } + { \box_wd:N #1 \__dim_eval:w #2 \__dim_eval_end: } \cs_generate_variant:Nn \box_set_ht:Nn { c } \cs_generate_variant:Nn \box_set_dp:Nn { c } \cs_generate_variant:Nn \box_set_wd:Nn { c } @@ -109,13 +109,13 @@ \cs_generate_variant:Nn \box_use_clear:N { c } \cs_generate_variant:Nn \box_use:N { c } \cs_new_protected:Npn \box_move_left:nn #1#2 - { \tex_moveleft:D \dim_eval:w #1 \dim_eval_end: #2 } + { \tex_moveleft:D \__dim_eval:w #1 \__dim_eval_end: #2 } \cs_new_protected:Npn \box_move_right:nn #1#2 - { \tex_moveright:D \dim_eval:w #1 \dim_eval_end: #2 } + { \tex_moveright:D \__dim_eval:w #1 \__dim_eval_end: #2 } \cs_new_protected:Npn \box_move_up:nn #1#2 - { \tex_raise:D \dim_eval:w #1 \dim_eval_end: #2 } + { \tex_raise:D \__dim_eval:w #1 \__dim_eval_end: #2 } \cs_new_protected:Npn \box_move_down:nn #1#2 - { \tex_lower:D \dim_eval:w #1 \dim_eval_end: #2 } + { \tex_lower:D \__dim_eval:w #1 \__dim_eval_end: #2 } \cs_new_eq:NN \if_hbox:N \tex_ifhbox:D \cs_new_eq:NN \if_vbox:N \tex_ifvbox:D \cs_new_eq:NN \if_box_empty:N \tex_ifvoid:D @@ -146,36 +146,50 @@ \cs_new_eq:NN \c_empty_box \voidb@x \cs_new_eq:NN \l_tmpa_box \@tempboxa \box_new:N \l_tmpb_box +\box_new:N \g_tmpa_box +\box_new:N \g_tmpb_box \cs_new_protected:Npn \box_show:N #1 + { \box_show:Nnn #1 \c_max_int \c_max_int } +\cs_generate_variant:Nn \box_show:N { c } +\cs_new_protected_nopar:Npn \box_show:Nnn + { \__box_show:NNnn \c_one } +\cs_generate_variant:Nn \box_show:Nnn { c } +\cs_new_protected:Npn \box_log:N #1 + { \box_log:Nnn #1 \c_max_int \c_max_int } +\cs_generate_variant:Nn \box_log:N { c } +\cs_new_protected:Npn \box_log:Nnn #1#2#3 { - \box_if_exist:NTF #1 - { \tex_showbox:D \use:n {#1} } + \use:x { - \msg_kernel_error:nnx { kernel } { variable-not-defined } - { \token_to_str:N #1 } + \etex_interactionmode:D \c_zero + \__box_show:NNnn \c_zero \exp_not:N #1 + { \int_eval:n {#2} } { \int_eval:n {#3} } + \etex_interactionmode:D + = \tex_the:D \etex_interactionmode:D \scan_stop: } } -\cs_generate_variant:Nn \box_show:N { c } -\cs_new_protected:Npn \box_show:Nnn #1#2#3 +\cs_generate_variant:Nn \box_log:Nnn { c } +\cs_new_protected:Npn \__box_show:NNnn #1#2#3#4 { \group_begin: - \int_set:Nn \tex_showboxbreadth:D {#2} - \int_set:Nn \tex_showboxdepth:D {#3} - \int_set_eq:NN \tex_tracingonline:D \c_one - \box_show:N #1 + \int_set:Nn \tex_showboxbreadth:D {#3} + \int_set:Nn \tex_showboxdepth:D {#4} + \int_set_eq:NN \tex_tracingonline:D #1 + \box_if_exist:NTF #2 + { \tex_showbox:D \use:n {#2} } + { + \__msg_kernel_error:nnx { kernel } { variable-not-defined } + { \token_to_str:N #2 } + } \group_end: } -\cs_generate_variant:Nn \box_show:Nnn { c } -\cs_new_protected:Npn \box_show_full:N #1 - { \box_show:Nnn #1 { \c_max_int } { \c_max_int } } -\cs_generate_variant:Nn \box_show_full:N { c } \cs_new_protected:Npn \hbox:n { \tex_hbox:D \scan_stop: } \cs_new_protected:Npn \hbox_set:Nn #1#2 { \tex_setbox:D #1 \tex_hbox:D {#2} } \cs_new_protected:Npn \hbox_gset:Nn { \tex_global:D \hbox_set:Nn } \cs_generate_variant:Nn \hbox_set:Nn { c } \cs_generate_variant:Nn \hbox_gset:Nn { c } \cs_new_protected:Npn \hbox_set_to_wd:Nnn #1#2#3 - { \tex_setbox:D #1 \tex_hbox:D to \dim_eval:w #2 \dim_eval_end: {#3} } + { \tex_setbox:D #1 \tex_hbox:D to \__dim_eval:w #2 \__dim_eval_end: {#3} } \cs_new_protected:Npn \hbox_gset_to_wd:Nnn { \tex_global:D \hbox_set_to_wd:Nnn } \cs_generate_variant:Nn \hbox_set_to_wd:Nnn { c } @@ -195,7 +209,7 @@ \cs_new_eq:NN \hbox_gset_inline_begin:c \hbox_gset:cw \cs_new_eq:NN \hbox_gset_inline_end: \hbox_gset_end: \cs_new_protected:Npn \hbox_to_wd:nn #1#2 - { \tex_hbox:D to \dim_eval:w #1 \dim_eval_end: {#2} } + { \tex_hbox:D to \__dim_eval:w #1 \__dim_eval_end: {#2} } \cs_new_protected:Npn \hbox_to_zero:n #1 { \tex_hbox:D to \c_zero_skip {#1} } \cs_new_protected:Npn \hbox_overlap_left:n #1 { \hbox_to_zero:n { \tex_hss:D #1 } } @@ -208,7 +222,7 @@ \cs_new_protected:Npn \vbox:n #1 { \tex_vbox:D { #1 \par } } \cs_new_protected:Npn \vbox_top:n #1 { \tex_vtop:D { #1 \par } } \cs_new_protected:Npn \vbox_to_ht:nn #1#2 - { \tex_vbox:D to \dim_eval:w #1 \dim_eval_end: { #2 \par } } + { \tex_vbox:D to \__dim_eval:w #1 \__dim_eval_end: { #2 \par } } \cs_new_protected:Npn \vbox_to_zero:n #1 { \tex_vbox:D to \c_zero_dim { #1 \par } } \cs_new_protected:Npn \vbox_set:Nn #1#2 @@ -223,7 +237,7 @@ \cs_generate_variant:Nn \vbox_set_top:Nn { c } \cs_generate_variant:Nn \vbox_gset_top:Nn { c } \cs_new_protected:Npn \vbox_set_to_ht:Nnn #1#2#3 - { \tex_setbox:D #1 \tex_vbox:D to \dim_eval:w #2 \dim_eval_end: { #3 \par } } + { \tex_setbox:D #1 \tex_vbox:D to \__dim_eval:w #2 \__dim_eval_end: { #3 \par } } \cs_new_protected:Npn \vbox_gset_to_ht:Nnn { \tex_global:D \vbox_set_to_ht:Nnn } \cs_generate_variant:Nn \vbox_set_to_ht:Nnn { c } @@ -251,358 +265,7 @@ \cs_generate_variant:Nn \vbox_unpack:N { c } \cs_generate_variant:Nn \vbox_unpack_clear:N { c } \cs_new_protected:Npn \vbox_set_split_to_ht:NNn #1#2#3 - { \tex_setbox:D #1 \tex_vsplit:D #2 to \dim_eval:w #3 \dim_eval_end: } -\fp_new:N \l_box_angle_fp -\fp_new:N \l_box_cos_fp -\fp_new:N \l_box_sin_fp -\dim_new:N \l_box_top_dim -\dim_new:N \l_box_bottom_dim -\dim_new:N \l_box_left_dim -\dim_new:N \l_box_right_dim -\dim_new:N \l_box_top_new_dim -\dim_new:N \l_box_bottom_new_dim -\dim_new:N \l_box_left_new_dim -\dim_new:N \l_box_right_new_dim -\box_new:N \l_box_internal_box -\fp_new:N \l_box_internal_fp -\fp_new:N \l_box_x_fp -\fp_new:N \l_box_y_fp -\fp_new:N \l_box_x_new_fp -\fp_new:N \l_box_y_new_fp -\cs_new_protected:Npn \box_rotate:Nn #1#2 - { - \hbox_set:Nn #1 - { - \group_begin: - \fp_set:Nn \l_box_angle_fp {#2} - \box_rotate_set_sin_cos: - \fp_compare:NNNTF \l_box_sin_fp = \c_zero_fp - { - \fp_compare:NNNTF \l_box_cos_fp = \c_one_fp - { \box_use:N #1 } - { \box_rotate_aux:N #1 } - } - { \box_rotate_aux:N #1 } - \group_end: - } - } -\cs_new_protected:Npn \box_rotate_aux:N #1 - { - \dim_set:Nn \l_box_top_dim { \box_ht:N #1 } - \dim_set:Nn \l_box_bottom_dim { -\box_dp:N #1 } - \dim_set:Nn \l_box_right_dim { \box_wd:N #1 } - \dim_zero:N \l_box_left_dim - \fp_compare:NNNTF \l_box_sin_fp > \c_zero_fp - { - \fp_compare:NNNTF \l_box_cos_fp > \c_zero_fp - { \box_rotate_quadrant_one: } - { \box_rotate_quadrant_two: } - } - { - \fp_compare:NNNTF \l_box_cos_fp < \c_zero_fp - { \box_rotate_quadrant_three: } - { \box_rotate_quadrant_four: } - } - \hbox_set:Nn \l_box_internal_box { \box_use:N #1 } - \hbox_set:Nn \l_box_internal_box - { - \tex_kern:D -\l_box_left_new_dim - \hbox:n - { - \driver_box_rotate_begin: - \box_use:N \l_box_internal_box - \driver_box_rotate_end: - } - } - \box_set_ht:Nn \l_box_internal_box { \l_box_top_new_dim } - \box_set_dp:Nn \l_box_internal_box { -\l_box_bottom_new_dim } - \box_set_wd:Nn \l_box_internal_box - { \l_box_right_new_dim - \l_box_left_new_dim } - \box_use:N \l_box_internal_box - } -\cs_new_protected:Npn \box_rotate_set_sin_cos: - { - \fp_set_eq:NN \l_box_internal_fp \l_box_angle_fp - \fp_div:Nn \l_box_internal_fp { 180 } - \fp_mul:Nn \l_box_internal_fp { \c_pi_fp } - \fp_sin:Nn \l_box_sin_fp { \l_box_internal_fp } - \fp_cos:Nn \l_box_cos_fp { \l_box_internal_fp } - } -\cs_new_protected:Npn \box_rotate_x:nnN #1#2#3 - { - \fp_set_from_dim:Nn \l_box_x_fp {#1} - \fp_set_from_dim:Nn \l_box_y_fp {#2} - \fp_set_eq:NN \l_box_x_new_fp \l_box_x_fp - \fp_set_eq:NN \l_box_internal_fp \l_box_y_fp - \fp_mul:Nn \l_box_x_new_fp { \l_box_cos_fp } - \fp_mul:Nn \l_box_internal_fp { \l_box_sin_fp } - \fp_sub:Nn \l_box_x_new_fp { \l_box_internal_fp } - \dim_set:Nn #3 { \fp_to_dim:N \l_box_x_new_fp } - } -\cs_new_protected:Npn \box_rotate_y:nnN #1#2#3 - { - \fp_set_from_dim:Nn \l_box_x_fp {#1} - \fp_set_from_dim:Nn \l_box_y_fp {#2} - \fp_set_eq:NN \l_box_y_new_fp \l_box_y_fp - \fp_set_eq:NN \l_box_internal_fp \l_box_x_fp - \fp_mul:Nn \l_box_y_new_fp { \l_box_cos_fp } - \fp_mul:Nn \l_box_internal_fp { \l_box_sin_fp } - \fp_add:Nn \l_box_y_new_fp { \l_box_internal_fp } - \dim_set:Nn #3 { \fp_to_dim:N \l_box_y_new_fp } -} -\cs_new_protected:Npn \box_rotate_quadrant_one: - { - \box_rotate_y:nnN \l_box_right_dim \l_box_top_dim - \l_box_top_new_dim - \box_rotate_y:nnN \l_box_left_dim \l_box_bottom_dim - \l_box_bottom_new_dim - \box_rotate_x:nnN \l_box_left_dim \l_box_top_dim - \l_box_left_new_dim - \box_rotate_x:nnN \l_box_right_dim \l_box_bottom_dim - \l_box_right_new_dim - } -\cs_new_protected:Npn \box_rotate_quadrant_two: - { - \box_rotate_y:nnN \l_box_right_dim \l_box_bottom_dim - \l_box_top_new_dim - \box_rotate_y:nnN \l_box_left_dim \l_box_top_dim - \l_box_bottom_new_dim - \box_rotate_x:nnN \l_box_right_dim \l_box_top_dim - \l_box_left_new_dim - \box_rotate_x:nnN \l_box_left_dim \l_box_bottom_dim - \l_box_right_new_dim - } -\cs_new_protected:Npn \box_rotate_quadrant_three: - { - \box_rotate_y:nnN \l_box_left_dim \l_box_bottom_dim - \l_box_top_new_dim - \box_rotate_y:nnN \l_box_right_dim \l_box_top_dim - \l_box_bottom_new_dim - \box_rotate_x:nnN \l_box_right_dim \l_box_bottom_dim - \l_box_left_new_dim - \box_rotate_x:nnN \l_box_left_dim \l_box_top_dim - \l_box_right_new_dim - } -\cs_new_protected:Npn \box_rotate_quadrant_four: - { - \box_rotate_y:nnN \l_box_left_dim \l_box_top_dim - \l_box_top_new_dim - \box_rotate_y:nnN \l_box_right_dim \l_box_bottom_dim - \l_box_bottom_new_dim - \box_rotate_x:nnN \l_box_left_dim \l_box_bottom_dim - \l_box_left_new_dim - \box_rotate_x:nnN \l_box_right_dim \l_box_top_dim - \l_box_right_new_dim - } -\fp_new:N \l_box_scale_x_fp -\fp_new:N \l_box_scale_y_fp -\cs_new_protected:Npn \box_resize:Nnn #1#2#3 - { - \hbox_set:Nn #1 - { - \group_begin: - \dim_set:Nn \l_box_top_dim { \box_ht:N #1 } - \dim_set:Nn \l_box_bottom_dim { -\box_dp:N #1 } - \dim_set:Nn \l_box_right_dim { \box_wd:N #1 } - \dim_zero:N \l_box_left_dim - \fp_set_from_dim:Nn \l_box_scale_x_fp {#2} - \fp_set_from_dim:Nn \l_box_internal_fp { \l_box_right_dim } - \fp_div:Nn \l_box_scale_x_fp { \l_box_internal_fp } - \fp_set_from_dim:Nn \l_box_scale_y_fp {#3} - \fp_set_from_dim:Nn \l_box_internal_fp - { \l_box_top_dim - \l_box_bottom_dim } - \fp_div:Nn \l_box_scale_y_fp { \l_box_internal_fp } - \fp_compare:NNNTF \l_box_scale_x_fp = \c_one_fp - { - \fp_compare:NNNTF \l_box_scale_y_fp = \c_one_fp - { \box_use:N #1 } - { \box_resize_aux:Nnn #1 {#2} {#3} } - } - { \box_resize_aux:Nnn #1 {#2} {#3} } - \group_end: - } - } -\cs_generate_variant:Nn \box_resize:Nnn { c } -\cs_new_protected:Npn \box_resize_aux:Nnn #1#2#3 - { - \dim_compare:nNnTF {#2} > \c_zero_dim - { \dim_set:Nn \l_box_right_new_dim {#2} } - { \dim_set:Nn \l_box_right_new_dim { \c_zero_dim - ( #2 ) } } - \dim_compare:nNnTF {#3} > \c_zero_dim - { - \dim_set:Nn \l_box_top_new_dim - { \fp_use:N \l_box_scale_y_fp \l_box_top_dim } - \dim_set:Nn \l_box_bottom_new_dim - { \fp_use:N \l_box_scale_y_fp \l_box_bottom_dim } - } - { - \dim_set:Nn \l_box_top_new_dim - { - \fp_use:N \l_box_scale_y_fp \l_box_top_dim } - \dim_set:Nn \l_box_bottom_new_dim - { - \fp_use:N \l_box_scale_y_fp \l_box_bottom_dim } - } - \box_resize_common:N #1 - } -\cs_new_protected:Npn \box_resize_to_ht_plus_dp:Nn #1#2 - { - \hbox_set:Nn #1 - { - \group_begin: - \dim_set:Nn \l_box_top_dim { \box_ht:N #1 } - \dim_set:Nn \l_box_bottom_dim { -\box_dp:N #1 } - \dim_set:Nn \l_box_right_dim { \box_wd:N #1 } - \dim_zero:N \l_box_left_dim - \fp_set_from_dim:Nn \l_box_scale_y_fp {#2} - \fp_set_from_dim:Nn \l_box_internal_fp - { \l_box_top_dim - \l_box_bottom_dim } - \fp_div:Nn \l_box_scale_y_fp { \l_box_internal_fp } - \fp_set_eq:NN \l_box_scale_x_fp \l_box_scale_y_fp - \fp_compare:NNNTF \l_box_scale_y_fp = \c_one_fp - { \box_use:N #1 } - { \box_resize_aux:Nnn #1 {#2} {#2} } - \group_end: - } - } -\cs_generate_variant:Nn \box_resize_to_ht_plus_dp:Nn { c } -\cs_new_protected:Npn \box_resize_to_wd:Nn #1#2 - { - \hbox_set:Nn #1 - { - \group_begin: - \dim_set:Nn \l_box_top_dim { \box_ht:N #1 } - \dim_set:Nn \l_box_bottom_dim { -\box_dp:N #1 } - \dim_set:Nn \l_box_right_dim { \box_wd:N #1 } - \dim_zero:N \l_box_left_dim - \fp_set_from_dim:Nn \l_box_scale_x_fp {#2} - \fp_set_from_dim:Nn \l_box_internal_fp { \l_box_right_dim } - \fp_div:Nn \l_box_scale_x_fp { \l_box_internal_fp } - \fp_set_eq:NN \l_box_scale_y_fp \l_box_scale_x_fp - \fp_compare:NNNTF \l_box_scale_x_fp = \c_one_fp - { \box_use:N #1 } - { \box_resize_aux:Nnn #1 {#2} {#2} } - \group_end: - } - } -\cs_generate_variant:Nn \box_resize_to_wd:Nn { c } -\cs_new_protected:Npn \box_scale:Nnn #1#2#3 - { - \hbox_set:Nn #1 - { - \group_begin: - \fp_set:Nn \l_box_scale_x_fp {#2} - \fp_set:Nn \l_box_scale_y_fp {#3} - \dim_set:Nn \l_box_top_dim { \box_ht:N #1 } - \dim_set:Nn \l_box_bottom_dim { -\box_dp:N #1 } - \dim_set:Nn \l_box_right_dim { \box_wd:N #1 } - \dim_zero:N \l_box_left_dim - \fp_compare:NNNTF \l_box_scale_x_fp = \c_one_fp - { - \fp_compare:NNNTF \l_box_scale_y_fp = \c_one_fp - { \box_use:N #1 } - { \box_scale_aux:Nnn #1 {#2} {#3} } - } - { \box_scale_aux:Nnn #1 {#2} {#3} } - \group_end: - } - } -\cs_generate_variant:Nn \box_scale:Nnn { c } -\cs_new_protected:Npn \box_scale_aux:Nnn #1#2#3 - { - \fp_compare:NNNTF \l_box_scale_y_fp > \c_zero_fp - { - \dim_set:Nn \l_box_top_new_dim { #3 \l_box_top_dim } - \dim_set:Nn \l_box_bottom_new_dim { #3 \l_box_bottom_dim } - } - { - \dim_set:Nn \l_box_top_new_dim { -#3 \l_box_bottom_dim } - \dim_set:Nn \l_box_bottom_new_dim { -#3 \l_box_top_dim } - } - \fp_compare:NNNTF \l_box_scale_x_fp > \c_zero_fp - { \l_box_right_new_dim #2 \l_box_right_dim } - { \l_box_right_new_dim -#2 \l_box_right_dim } - \box_resize_common:N #1 - } -\cs_new_protected:Npn \box_resize_common:N #1 - { - \hbox_set:Nn \l_box_internal_box - { - \driver_box_scale_begin: - \hbox_overlap_right:n { \box_use:N #1 } - \driver_box_scale_end: - } - \box_set_ht:Nn \l_box_internal_box { \l_box_top_new_dim } - \box_set_dp:Nn \l_box_internal_box { \l_box_bottom_new_dim } - \fp_compare:NNNTF \l_box_scale_x_fp < \c_zero_fp - { - \hbox_to_wd:nn { \l_box_right_new_dim } - { - \tex_kern:D \l_box_right_new_dim - \box_use:N \l_box_internal_box - \tex_hss:D - } - } - { - \box_set_wd:Nn \l_box_internal_box { \l_box_right_new_dim } - \box_use:N \l_box_internal_box - } - } -\cs_new_protected:Npn \box_clip:N #1 - { \hbox_set:Nn #1 { \driver_box_use_clip:N #1 } } -\cs_generate_variant:Nn \box_clip:N { c } -\cs_new_protected:Npn \box_trim:Nnnnn #1#2#3#4#5 - { - \box_set_wd:Nn #1 { \box_wd:N #1 - \dim_eval:n {#4} - \dim_eval:n {#2} } - \hbox_set:Nn #1 - { - \skip_horizontal:n { - \dim_eval:n {#2} } - \box_use:N #1 - } - \dim_compare:nNnTF { \box_dp:N #1 } > {#3} - { \box_set_dp:Nn #1 { \box_dp:N #1 - \dim_eval:n {#3} } } - { - \hbox_set:Nn #1 - { - \box_move_down:nn { \dim_eval:n {#3} - \box_dp:N #1 } - { \box_use:N #1 } - } - \box_set_dp:Nn #1 \c_zero_dim - } - \dim_compare:nNnTF { \box_ht:N #1 } > {#5} - { \box_set_ht:Nn #1 { \box_ht:N #1 - \dim_eval:n {#5} } } - { - \hbox_set:Nn #1 - { - \box_move_up:nn { \dim_eval:n {#5} - \box_ht:N #1 } - { \box_use:N #1 } - } - \box_set_ht:Nn #1 \c_zero_dim - } - } -\cs_generate_variant:Nn \box_trim:Nnnnn { c } -\cs_new_protected:Npn \box_viewport:Nnnnn #1#2#3#4#5 - { - \box_set_wd:Nn #1 { \dim_eval:n {#4} - \dim_eval:n {#2} } - \hbox_set:Nn #1 - { - \skip_horizontal:n { - \dim_eval:n {#2} } - \box_use:N #1 - } - \dim_compare:nNnTF {#3} > \c_zero_dim - { - \hbox_set:Nn #1 { \box_move_down:nn {#3} { \box_use:N #1 } } - \box_set_dp:Nn #1 \c_zero_dim - } - { \box_set_dp:Nn #1 { - \dim_eval:n {#3} } } - \dim_compare:nNnTF {#5} > \c_zero_dim - { \box_set_ht:Nn #1 {#5} } - { - \hbox_set:Nn #1 - { \box_move_up:nn { -\dim_eval:n {#5} } { \box_use:N #1 } } - \box_set_ht:Nn #1 \c_zero_dim - } - } -\cs_generate_variant:Nn \box_viewport:Nnnnn { c } -\cs_new_eq:NN \l_last_box \tex_lastbox:D + { \tex_setbox:D #1 \tex_vsplit:D #2 to \__dim_eval:w #3 \__dim_eval_end: } %% %% %% End of file `l3box.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3candidates.sty b/Master/texmf-dist/tex/latex/l3kernel/l3candidates.sty new file mode 100644 index 00000000000..1a867d3501c --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3kernel/l3candidates.sty @@ -0,0 +1,1093 @@ +%% +%% This is file `l3candidates.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3candidates.dtx (with options: `package') +%% +%% EXPERIMENTAL CODE +%% +%% Do not distribute this file without also distributing the +%% source files specified above. +%% +%% Do not distribute a modified version of this file. +%% +%% File: l3candidates.dtx Copyright(C) 2012 The 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 +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% 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. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +\RequirePackage{l3names} +\GetIdInfo$Id: l3candidates.dtx 3633 2012-05-12 20:11:32Z joseph $ + {L3 Experimental additions to l3kernel} +\ProvidesExplPackage + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\__expl_package_check: +\fp_new:N \l__box_angle_fp +\fp_new:N \l__box_cos_fp +\fp_new:N \l__box_sin_fp +\dim_new:N \l__box_top_dim +\dim_new:N \l__box_bottom_dim +\dim_new:N \l__box_left_dim +\dim_new:N \l__box_right_dim +\dim_new:N \l__box_top_new_dim +\dim_new:N \l__box_bottom_new_dim +\dim_new:N \l__box_left_new_dim +\dim_new:N \l__box_right_new_dim +\box_new:N \l__box_internal_box +\cs_new_protected:Npn \box_rotate:Nn #1#2 + { + \hbox_set:Nn #1 + { + \group_begin: + \fp_set:Nn \l__box_angle_fp {#2} + \fp_set:Nn \l__box_sin_fp { sin ( \l__box_angle_fp * deg ) } + \fp_set:Nn \l__box_cos_fp { cos ( \l__box_angle_fp * deg ) } + \__box_rotate:N #1 + \group_end: + } + } +\cs_new_protected:Npn \__box_rotate:N #1 + { + \dim_set:Nn \l__box_top_dim { \box_ht:N #1 } + \dim_set:Nn \l__box_bottom_dim { -\box_dp:N #1 } + \dim_set:Nn \l__box_right_dim { \box_wd:N #1 } + \dim_zero:N \l__box_left_dim + \fp_compare:nNnTF \l__box_sin_fp > \c_zero_fp + { + \fp_compare:nNnTF \l__box_cos_fp > \c_zero_fp + { \__box_rotate_quadrant_one: } + { \__box_rotate_quadrant_two: } + } + { + \fp_compare:nNnTF \l__box_cos_fp < \c_zero_fp + { \__box_rotate_quadrant_three: } + { \__box_rotate_quadrant_four: } + } + \hbox_set:Nn \l__box_internal_box { \box_use:N #1 } + \hbox_set:Nn \l__box_internal_box + { + \tex_kern:D -\l__box_left_new_dim + \hbox:n + { + \__driver_box_rotate_begin: + \box_use:N \l__box_internal_box + \__driver_box_rotate_end: + } + } + \box_set_ht:Nn \l__box_internal_box { \l__box_top_new_dim } + \box_set_dp:Nn \l__box_internal_box { -\l__box_bottom_new_dim } + \box_set_wd:Nn \l__box_internal_box + { \l__box_right_new_dim - \l__box_left_new_dim } + \box_use:N \l__box_internal_box + } +\cs_new_protected:Npn \__box_rotate_x:nnN #1#2#3 + { + \dim_set:Nn #3 + { + \fp_to_dim:n + { + \l__box_cos_fp * \dim_to_fp:n {#1} + - ( \l__box_sin_fp * \dim_to_fp:n {#2} ) + } + } + } +\cs_new_protected:Npn \__box_rotate_y:nnN #1#2#3 + { + \dim_set:Nn #3 + { + \fp_to_dim:n + { + \l__box_sin_fp * \dim_to_fp:n {#1} + + \l__box_cos_fp * \dim_to_fp:n {#2} + } + } + } +\cs_new_protected:Npn \__box_rotate_quadrant_one: + { + \__box_rotate_y:nnN \l__box_right_dim \l__box_top_dim + \l__box_top_new_dim + \__box_rotate_y:nnN \l__box_left_dim \l__box_bottom_dim + \l__box_bottom_new_dim + \__box_rotate_x:nnN \l__box_left_dim \l__box_top_dim + \l__box_left_new_dim + \__box_rotate_x:nnN \l__box_right_dim \l__box_bottom_dim + \l__box_right_new_dim + } +\cs_new_protected:Npn \__box_rotate_quadrant_two: + { + \__box_rotate_y:nnN \l__box_right_dim \l__box_bottom_dim + \l__box_top_new_dim + \__box_rotate_y:nnN \l__box_left_dim \l__box_top_dim + \l__box_bottom_new_dim + \__box_rotate_x:nnN \l__box_right_dim \l__box_top_dim + \l__box_left_new_dim + \__box_rotate_x:nnN \l__box_left_dim \l__box_bottom_dim + \l__box_right_new_dim + } +\cs_new_protected:Npn \__box_rotate_quadrant_three: + { + \__box_rotate_y:nnN \l__box_left_dim \l__box_bottom_dim + \l__box_top_new_dim + \__box_rotate_y:nnN \l__box_right_dim \l__box_top_dim + \l__box_bottom_new_dim + \__box_rotate_x:nnN \l__box_right_dim \l__box_bottom_dim + \l__box_left_new_dim + \__box_rotate_x:nnN \l__box_left_dim \l__box_top_dim + \l__box_right_new_dim + } +\cs_new_protected:Npn \__box_rotate_quadrant_four: + { + \__box_rotate_y:nnN \l__box_left_dim \l__box_top_dim + \l__box_top_new_dim + \__box_rotate_y:nnN \l__box_right_dim \l__box_bottom_dim + \l__box_bottom_new_dim + \__box_rotate_x:nnN \l__box_left_dim \l__box_bottom_dim + \l__box_left_new_dim + \__box_rotate_x:nnN \l__box_right_dim \l__box_top_dim + \l__box_right_new_dim + } +\fp_new:N \l__box_scale_x_fp +\fp_new:N \l__box_scale_y_fp +\cs_new_protected:Npn \box_resize:Nnn #1#2#3 + { + \hbox_set:Nn #1 + { + \group_begin: + \dim_set:Nn \l__box_top_dim { \box_ht:N #1 } + \dim_set:Nn \l__box_bottom_dim { -\box_dp:N #1 } + \dim_set:Nn \l__box_right_dim { \box_wd:N #1 } + \dim_zero:N \l__box_left_dim + \fp_set:Nn \l__box_scale_x_fp + { \dim_to_fp:n {#2} / ( \dim_to_fp:n \l__box_right_dim ) } + \fp_set:Nn \l__box_scale_y_fp + { + \dim_to_fp:n {#3} / + ( \dim_to_fp:n { \l__box_top_dim - \l__box_bottom_dim } ) + } + \__box_resize:Nnn #1 {#2} {#3} + \group_end: + } + } +\cs_generate_variant:Nn \box_resize:Nnn { c } +\cs_new_protected:Npn \__box_resize:Nnn #1#2#3 + { + \dim_compare:nNnTF {#2} > \c_zero_dim + { \dim_set:Nn \l__box_right_new_dim {#2} } + { \dim_set:Nn \l__box_right_new_dim { \c_zero_dim - ( #2 ) } } + \dim_compare:nNnTF {#3} > \c_zero_dim + { + \dim_set:Nn \l__box_top_new_dim + { \fp_use:N \l__box_scale_y_fp \l__box_top_dim } + \dim_set:Nn \l__box_bottom_new_dim + { \fp_use:N \l__box_scale_y_fp \l__box_bottom_dim } + } + { + \dim_set:Nn \l__box_top_new_dim + { - \fp_use:N \l__box_scale_y_fp \l__box_top_dim } + \dim_set:Nn \l__box_bottom_new_dim + { - \fp_use:N \l__box_scale_y_fp \l__box_bottom_dim } + } + \__box_resize_common:N #1 + } +\cs_new_protected:Npn \box_resize_to_ht_plus_dp:Nn #1#2 + { + \hbox_set:Nn #1 + { + \group_begin: + \dim_set:Nn \l__box_top_dim { \box_ht:N #1 } + \dim_set:Nn \l__box_bottom_dim { -\box_dp:N #1 } + \dim_set:Nn \l__box_right_dim { \box_wd:N #1 } + \dim_zero:N \l__box_left_dim + \fp_set:Nn \l__box_scale_y_fp + { + \dim_to_fp:n {#2} / + ( \dim_to_fp:n { \l__box_top_dim - \l__box_bottom_dim } ) + } + \fp_set_eq:NN \l__box_scale_x_fp \l__box_scale_y_fp + \__box_resize:Nnn #1 {#2} {#2} + \group_end: + } + } +\cs_generate_variant:Nn \box_resize_to_ht_plus_dp:Nn { c } +\cs_new_protected:Npn \box_resize_to_wd:Nn #1#2 + { + \hbox_set:Nn #1 + { + \group_begin: + \dim_set:Nn \l__box_top_dim { \box_ht:N #1 } + \dim_set:Nn \l__box_bottom_dim { -\box_dp:N #1 } + \dim_set:Nn \l__box_right_dim { \box_wd:N #1 } + \dim_zero:N \l__box_left_dim + \fp_set:Nn \l__box_scale_x_fp + { \dim_to_fp:n {#2} / ( \dim_to_fp:n \l__box_right_dim ) } + \fp_set_eq:NN \l__box_scale_y_fp \l__box_scale_x_fp + \__box_resize:Nnn #1 {#2} {#2} + \group_end: + } + } +\cs_generate_variant:Nn \box_resize_to_wd:Nn { c } +\cs_new_protected:Npn \box_scale:Nnn #1#2#3 + { + \hbox_set:Nn #1 + { + \group_begin: + \fp_set:Nn \l__box_scale_x_fp {#2} + \fp_set:Nn \l__box_scale_y_fp {#3} + \dim_set:Nn \l__box_top_dim { \box_ht:N #1 } + \dim_set:Nn \l__box_bottom_dim { -\box_dp:N #1 } + \dim_set:Nn \l__box_right_dim { \box_wd:N #1 } + \dim_zero:N \l__box_left_dim + \__box_scale:Nnn #1 {#2} {#3} + \group_end: + } + } +\cs_generate_variant:Nn \box_scale:Nnn { c } +\cs_new_protected:Npn \__box_scale:Nnn #1#2#3 + { + \fp_compare:nNnTF \l__box_scale_y_fp > \c_zero_fp + { + \dim_set:Nn \l__box_top_new_dim { #3 \l__box_top_dim } + \dim_set:Nn \l__box_bottom_new_dim { #3 \l__box_bottom_dim } + } + { + \dim_set:Nn \l__box_top_new_dim { -#3 \l__box_bottom_dim } + \dim_set:Nn \l__box_bottom_new_dim { -#3 \l__box_top_dim } + } + \fp_compare:nNnTF \l__box_scale_x_fp > \c_zero_fp + { \l__box_right_new_dim #2 \l__box_right_dim } + { \l__box_right_new_dim -#2 \l__box_right_dim } + \__box_resize_common:N #1 + } +\cs_new_protected:Npn \__box_resize_common:N #1 + { + \hbox_set:Nn \l__box_internal_box + { + \__driver_box_scale_begin: + \hbox_overlap_right:n { \box_use:N #1 } + \__driver_box_scale_end: + } + \box_set_ht:Nn \l__box_internal_box { \l__box_top_new_dim } + \box_set_dp:Nn \l__box_internal_box { \l__box_bottom_new_dim } + \fp_compare:nNnTF \l__box_scale_x_fp < \c_zero_fp + { + \hbox_to_wd:nn { \l__box_right_new_dim } + { + \tex_kern:D \l__box_right_new_dim + \box_use:N \l__box_internal_box + \tex_hss:D + } + } + { + \box_set_wd:Nn \l__box_internal_box { \l__box_right_new_dim } + \box_use:N \l__box_internal_box + } + } +\cs_new_protected:Npn \box_clip:N #1 + { \hbox_set:Nn #1 { \__driver_box_use_clip:N #1 } } +\cs_generate_variant:Nn \box_clip:N { c } +\cs_new_protected:Npn \box_trim:Nnnnn #1#2#3#4#5 + { + \box_set_wd:Nn #1 { \box_wd:N #1 - (#4) - (#2) } + \hbox_set:Nn #1 + { + \skip_horizontal:n { - \dim_eval:n {#2} } + \box_use:N #1 + } + \dim_compare:nNnTF { \box_dp:N #1 } > {#3} + { \box_set_dp:Nn #1 { \box_dp:N #1 - (#3) } } + { + \hbox_set:Nn #1 + { \box_move_down:nn { #3 - \box_dp:N #1 } { \box_use:N #1 } } + \box_set_dp:Nn #1 \c_zero_dim + } + \dim_compare:nNnTF { \box_ht:N #1 } > {#5} + { \box_set_ht:Nn #1 { \box_ht:N #1 - (#5) } } + { + \hbox_set:Nn #1 + { \box_move_up:nn { #5 - \box_ht:N #1 } { \box_use:N #1 } } + \box_set_ht:Nn #1 \c_zero_dim + } + } +\cs_generate_variant:Nn \box_trim:Nnnnn { c } +\cs_new_protected:Npn \box_viewport:Nnnnn #1#2#3#4#5 + { + \box_set_wd:Nn #1 { (#4) - (#2) } + \hbox_set:Nn #1 + { + \skip_horizontal:n { - \dim_eval:n {#2} } + \box_use:N #1 + } + \dim_compare:nNnTF {#3} > \c_zero_dim + { + \hbox_set:Nn #1 { \box_move_down:nn {#3} { \box_use:N #1 } } + \box_set_dp:Nn #1 \c_zero_dim + } + { \box_set_dp:Nn #1 { - \dim_eval:n {#3} } } + \dim_compare:nNnTF {#5} > \c_zero_dim + { \box_set_ht:Nn #1 {#5} } + { + \hbox_set:Nn #1 + { \box_move_up:nn { -\dim_eval:n {#5} } { \box_use:N #1 } } + \box_set_ht:Nn #1 \c_zero_dim + } + } +\cs_generate_variant:Nn \box_viewport:Nnnnn { c } +\cs_new:Npn \clist_item:Nn #1#2 + { + \exp_args:Nfo \__clist_item:nnNn + { \clist_count:N #1 } + #1 + \__clist_item_N_loop:nw + {#2} + } +\cs_new:Npn \__clist_item:nnNn #1#2#3#4 + { + \int_compare:nNnTF {#4} < \c_zero + { + \int_compare:nNnTF {#4} < { - #1 } + { \use_none_delimit_by_q_stop:w } + { \exp_args:Nf #3 { \int_eval:n { #4 + \c_one + #1 } } } + } + { + \int_compare:nNnTF {#4} > {#1} + { \use_none_delimit_by_q_stop:w } + { #3 {#4} } + } + { } , #2 , \q_stop + } +\cs_new:Npn \__clist_item_N_loop:nw #1 #2, + { + \int_compare:nNnTF {#1} = \c_zero + { \use_i_delimit_by_q_stop:nw { \exp_not:n {#2} } } + { \exp_args:Nf \__clist_item_N_loop:nw { \int_eval:n { #1 - 1 } } } + } +\cs_generate_variant:Nn \clist_item:Nn { c } +\cs_new:Npn \clist_item:nn #1#2 + { + \exp_args:Nf \__clist_item:nnNn + { \clist_count:n {#1} } + {#1} + \__clist_item_n:nw + {#2} + } +\cs_new:Npn \__clist_item_n:nw #1 + { \__clist_item_n_loop:nw {#1} \prg_do_nothing: } +\cs_new:Npn \__clist_item_n_loop:nw #1 #2, + { + \exp_args:No \tl_if_blank:nTF {#2} + { \__clist_item_n_loop:nw {#1} \prg_do_nothing: } + { + \int_compare:nNnTF {#1} = \c_zero + { \exp_args:No \__clist_item_n_end:n {#2} } + { + \exp_args:Nf \__clist_item_n_loop:nw + { \int_eval:n { #1 - 1 } } + \prg_do_nothing: + } + } + } +\cs_new:Npn \__clist_item_n_end:n #1 #2 \q_stop + { + \__tl_trim_spaces:nn { \q_mark #1 } + { \exp_last_unbraced:No \__clist_item_n_strip:w } , + } +\cs_new:Npn \__clist_item_n_strip:w #1 , { \exp_not:n {#1} } +\cs_new_protected:Npn \clist_set_from_seq:NN + { \__clist_set_from_seq:NNNN \clist_clear:N \tl_set:Nx } +\cs_new_protected:Npn \clist_gset_from_seq:NN + { \__clist_set_from_seq:NNNN \clist_gclear:N \tl_gset:Nx } +\cs_new_protected:Npn \__clist_set_from_seq:NNNN #1#2#3#4 + { + \seq_if_empty:NTF #4 + { #1 #3 } + { + #2 #3 + { + \exp_last_unbraced:Nf \use_none:n + { \seq_map_function:NN #4 \__clist_wrap_item:n } + } + } + } +\cs_new:Npn \__clist_wrap_item:n #1 + { + , + \tl_if_empty:oTF { \__clist_set_from_seq:w #1 ~ , #1 ~ } + { \exp_not:n {#1} } + { \exp_not:n { {#1} } } + } +\cs_new:Npn \__clist_set_from_seq:w #1 , #2 ~ { } +\cs_generate_variant:Nn \clist_set_from_seq:NN { Nc } +\cs_generate_variant:Nn \clist_set_from_seq:NN { c , cc } +\cs_generate_variant:Nn \clist_gset_from_seq:NN { Nc } +\cs_generate_variant:Nn \clist_gset_from_seq:NN { c , cc } +\cs_new_protected:Npn \clist_const:Nn #1#2 + { \tl_const:Nx #1 { \__clist_trim_spaces:n {#2} } } +\cs_generate_variant:Nn \clist_const:Nn { c , Nx , cx } +\prg_new_conditional:Npnn \clist_if_empty:n #1 { p , T , F , TF } + { + \__clist_if_empty_n:w ? #1 + , \q_mark \prg_return_false: + , \q_mark \prg_return_true: + \q_stop + } +\cs_new:Npn \__clist_if_empty_n:w #1 , + { + \tl_if_empty:oTF { \use_none:nn #1 ? } + { \__clist_if_empty_n:w ? } + { \__clist_if_empty_n:wNw } + } +\cs_new:Npn \__clist_if_empty_n:wNw #1 \q_mark #2#3 \q_stop {#2} +\cs_new:Npn \clist_use:Nnnn #1#2#3#4 + { + \clist_if_exist:NTF #1 + { + \int_case:nnn { \clist_count:N #1 } + { + { 0 } { } + { 1 } { \exp_after:wN \__clist_use:wwn #1 , , { } } + { 2 } { \exp_after:wN \__clist_use:wwn #1 , {#2} } + } + { + \exp_after:wN \__clist_use_ii:nwwwwnwn + \exp_after:wN { \exp_after:wN } #1 , + \q_mark , { \__clist_use_ii:nwwwwnwn {#3} } + \q_mark , { \__clist_use_iii:nwwn {#4} } + \q_stop { } + } + } + { \__msg_kernel_expandable_error:nnn { kernel } { bad-variable } {#1} } + } +\cs_new:Npn \__clist_use:wwn #1 , #2 , #3 { \exp_not:n { #1 #3 #2 } } +\cs_new:Npn \__clist_use_ii:nwwwwnwn + #1#2 , #3 , #4 , #5 \q_mark , #6#7 \q_stop #8 + { #6 {#3} , {#4} , #5 \q_mark , {#6} #7 \q_stop { #8 #1 #2 } } +\cs_new:Npn \__clist_use_iii:nwwn #1#2 , #3 \q_stop #4 + { \exp_not:n { #4 #1 #2 } } +\fp_new:N \l__coffin_sin_fp +\fp_new:N \l__coffin_cos_fp +\prop_new:N \l__coffin_bounding_prop +\dim_new:N \l__coffin_bounding_shift_dim +\dim_new:N \l__coffin_left_corner_dim +\dim_new:N \l__coffin_right_corner_dim +\dim_new:N \l__coffin_bottom_corner_dim +\dim_new:N \l__coffin_top_corner_dim +\cs_new_protected:Npn \coffin_rotate:Nn #1#2 + { + \fp_set:Nn \l__coffin_sin_fp { sin ( ( #2 ) * deg ) } + \fp_set:Nn \l__coffin_cos_fp { cos ( ( #2 ) * deg ) } + \prop_map_inline:cn { l__coffin_corners_ \__int_value:w #1 _prop } + { \__coffin_rotate_corner:Nnnn #1 {##1} ##2 } + \prop_map_inline:cn { l__coffin_poles_ \__int_value:w #1 _prop } + { \__coffin_rotate_pole:Nnnnnn #1 {##1} ##2 } + \__coffin_set_bounding:N #1 + \prop_map_inline:Nn \l__coffin_bounding_prop + { \__coffin_rotate_bounding:nnn {##1} ##2 } + \__coffin_find_corner_maxima:N #1 + \__coffin_find_bounding_shift: + \box_rotate:Nn #1 {#2} + \hbox_set:Nn #1 + { + \tex_kern:D \l__coffin_bounding_shift_dim + \tex_kern:D -\l__coffin_left_corner_dim + \box_move_down:nn { \l__coffin_bottom_corner_dim } + { \box_use:N #1 } + } + \box_set_ht:Nn #1 + { \l__coffin_top_corner_dim - \l__coffin_bottom_corner_dim } + \box_set_dp:Nn #1 { 0 pt } + \box_set_wd:Nn #1 + { \l__coffin_right_corner_dim - \l__coffin_left_corner_dim } + \prop_map_inline:cn { l__coffin_corners_ \__int_value:w #1 _prop } + { \__coffin_shift_corner:Nnnn #1 {##1} ##2 } + \prop_map_inline:cn { l__coffin_poles_ \__int_value:w #1 _prop } + { \__coffin_shift_pole:Nnnnnn #1 {##1} ##2 } + } +\cs_generate_variant:Nn \coffin_rotate:Nn { c } +\cs_new_protected:Npn \__coffin_set_bounding:N #1 + { + \prop_put:Nnx \l__coffin_bounding_prop { tl } + { { 0 pt } { \dim_use:N \box_ht:N #1 } } + \prop_put:Nnx \l__coffin_bounding_prop { tr } + { { \dim_use:N \box_wd:N #1 } { \dim_use:N \box_ht:N #1 } } + \dim_set:Nn \l__coffin_internal_dim { - \box_dp:N #1 } + \prop_put:Nnx \l__coffin_bounding_prop { bl } + { { 0 pt } { \dim_use:N \l__coffin_internal_dim } } + \prop_put:Nnx \l__coffin_bounding_prop { br } + { { \dim_use:N \box_wd:N #1 } { \dim_use:N \l__coffin_internal_dim } } + } +\cs_new_protected:Npn \__coffin_rotate_bounding:nnn #1#2#3 + { + \__coffin_rotate_vector:nnNN {#2} {#3} \l__coffin_x_dim \l__coffin_y_dim + \prop_put:Nnx \l__coffin_bounding_prop {#1} + { { \dim_use:N \l__coffin_x_dim } { \dim_use:N \l__coffin_y_dim } } + } +\cs_new_protected:Npn \__coffin_rotate_corner:Nnnn #1#2#3#4 + { + \__coffin_rotate_vector:nnNN {#3} {#4} \l__coffin_x_dim \l__coffin_y_dim + \prop_put:cnx { l__coffin_corners_ \__int_value:w #1 _prop } {#2} + { { \dim_use:N \l__coffin_x_dim } { \dim_use:N \l__coffin_y_dim } } + } +\cs_new_protected:Npn \__coffin_rotate_pole:Nnnnnn #1#2#3#4#5#6 + { + \__coffin_rotate_vector:nnNN {#3} {#4} \l__coffin_x_dim \l__coffin_y_dim + \__coffin_rotate_vector:nnNN {#5} {#6} + \l__coffin_x_prime_dim \l__coffin_y_prime_dim + \__coffin_set_pole:Nnx #1 {#2} + { + { \dim_use:N \l__coffin_x_dim } { \dim_use:N \l__coffin_y_dim } + { \dim_use:N \l__coffin_x_prime_dim } + { \dim_use:N \l__coffin_y_prime_dim } + } + } +\cs_new_protected:Npn \__coffin_rotate_vector:nnNN #1#2#3#4 + { + \dim_set:Nn #3 + { + \fp_to_dim:n + { + \dim_to_fp:n {#1} * \l__coffin_cos_fp + - ( \dim_to_fp:n {#2} * \l__coffin_sin_fp ) + } + } + \dim_set:Nn #4 + { + \fp_to_dim:n + { + \dim_to_fp:n {#1} * \l__coffin_sin_fp + + ( \dim_to_fp:n {#2} * \l__coffin_cos_fp ) + } + } + } +\cs_new_protected:Npn \__coffin_find_corner_maxima:N #1 + { + \dim_set:Nn \l__coffin_top_corner_dim { -\c_max_dim } + \dim_set:Nn \l__coffin_right_corner_dim { -\c_max_dim } + \dim_set:Nn \l__coffin_bottom_corner_dim { \c_max_dim } + \dim_set:Nn \l__coffin_left_corner_dim { \c_max_dim } + \prop_map_inline:cn { l__coffin_corners_ \__int_value:w #1 _prop } + { \__coffin_find_corner_maxima_aux:nn ##2 } + } +\cs_new_protected:Npn \__coffin_find_corner_maxima_aux:nn #1#2 + { + \dim_set_min:Nn \l__coffin_left_corner_dim {#1} + \dim_set_max:Nn \l__coffin_right_corner_dim {#1} + \dim_set_min:Nn \l__coffin_bottom_corner_dim {#2} + \dim_set_max:Nn \l__coffin_top_corner_dim {#2} + } +\cs_new_protected_nopar:Npn \__coffin_find_bounding_shift: + { + \dim_set:Nn \l__coffin_bounding_shift_dim { \c_max_dim } + \prop_map_inline:Nn \l__coffin_bounding_prop + { \__coffin_find_bounding_shift_aux:nn ##2 } + } +\cs_new_protected:Npn \__coffin_find_bounding_shift_aux:nn #1#2 + { \dim_set_min:Nn \l__coffin_bounding_shift_dim {#1} } +\cs_new_protected:Npn \__coffin_shift_corner:Nnnn #1#2#3#4 + { + \prop_put:cnx { l__coffin_corners_ \__int_value:w #1 _ prop } {#2} + { + { \dim_eval:n { #3 - \l__coffin_left_corner_dim } } + { \dim_eval:n { #4 - \l__coffin_bottom_corner_dim } } + } + } +\cs_new_protected:Npn \__coffin_shift_pole:Nnnnnn #1#2#3#4#5#6 + { + \prop_put:cnx { l__coffin_poles_ \__int_value:w #1 _ prop } {#2} + { + { \dim_eval:n { #3 - \l__coffin_left_corner_dim } } + { \dim_eval:n { #4 - \l__coffin_bottom_corner_dim } } + {#5} {#6} + } + } +\fp_new:N \l__coffin_scale_x_fp +\fp_new:N \l__coffin_scale_y_fp +\dim_new:N \l__coffin_scaled_total_height_dim +\dim_new:N \l__coffin_scaled_width_dim +\cs_new_protected:Npn \coffin_resize:Nnn #1#2#3 + { + \__coffin_set_user_dimensions:N #1 + \box_resize:Nnn #1 {#2} {#3} + \fp_set:Nn \l__coffin_scale_x_fp + { \dim_to_fp:n {#2} / \dim_to_fp:n \Width } + \fp_set:Nn \l__coffin_scale_y_fp + { \dim_to_fp:n {#3} / \dim_to_fp:n \TotalHeight } + \__coffin_resize_common:Nnn #1 {#2} {#3} + } +\cs_generate_variant:Nn \coffin_resize:Nnn { c } +\cs_new_protected:Npn \__coffin_resize_common:Nnn #1#2#3 + { + \prop_map_inline:cn { l__coffin_corners_ \__int_value:w #1 _prop } + { \__coffin_scale_corner:Nnnn #1 {##1} ##2 } + \prop_map_inline:cn { l__coffin_poles_ \__int_value:w #1 _prop } + { \__coffin_scale_pole:Nnnnnn #1 {##1} ##2 } + \fp_compare:nNnT \l__coffin_scale_x_fp < \c_zero_fp + { + \prop_map_inline:cn { l__coffin_corners_ \__int_value:w #1 _prop } + { \__coffin_x_shift_corner:Nnnn #1 {##1} ##2 } + \prop_map_inline:cn { l__coffin_poles_ \__int_value:w #1 _prop } + { \__coffin_x_shift_pole:Nnnnnn #1 {##1} ##2 } + } + \__coffin_end_user_dimensions: + } +\cs_new_protected:Npn \coffin_scale:Nnn #1#2#3 + { + \box_scale:Nnn #1 {#2} {#3} + \__coffin_set_user_dimensions:N #1 + \fp_set:Nn \l__coffin_scale_x_fp {#2} + \fp_set:Nn \l__coffin_scale_y_fp {#3} + \fp_compare:nNnTF \l__coffin_scale_y_fp > \c_zero_fp + { \l__coffin_scaled_total_height_dim #3 \TotalHeight } + { \l__coffin_scaled_total_height_dim -#3 \TotalHeight } + \fp_compare:nNnTF \l__coffin_scale_x_fp > \c_zero_fp + { \l__coffin_scaled_width_dim -#2 \Width } + { \l__coffin_scaled_width_dim #2 \Width } + \__coffin_resize_common:Nnn #1 + { \l__coffin_scaled_width_dim } { \l__coffin_scaled_total_height_dim } + } +\cs_generate_variant:Nn \coffin_scale:Nnn { c } +\cs_new_protected:Npn \__coffin_scale_vector:nnNN #1#2#3#4 + { + \dim_set:Nn #3 + { \fp_to_dim:n { \dim_to_fp:n {#1} * \l__coffin_scale_x_fp } } + \dim_set:Nn #4 + { \fp_to_dim:n { \dim_to_fp:n {#2} * \l__coffin_scale_y_fp } } + } +\cs_new_protected:Npn \__coffin_scale_corner:Nnnn #1#2#3#4 + { + \__coffin_scale_vector:nnNN {#3} {#4} \l__coffin_x_dim \l__coffin_y_dim + \prop_put:cnx { l__coffin_corners_ \__int_value:w #1 _prop } {#2} + { { \dim_use:N \l__coffin_x_dim } { \dim_use:N \l__coffin_y_dim } } + } +\cs_new_protected:Npn \__coffin_scale_pole:Nnnnnn #1#2#3#4#5#6 + { + \__coffin_scale_vector:nnNN {#3} {#4} \l__coffin_x_dim \l__coffin_y_dim + \__coffin_set_pole:Nnx #1 {#2} + { + { \dim_use:N \l__coffin_x_dim } { \dim_use:N \l__coffin_y_dim } + {#5} {#6} + } + } +\cs_new_protected:Npn \__coffin_x_shift_corner:Nnnn #1#2#3#4 + { + \prop_put:cnx { l__coffin_corners_ \__int_value:w #1 _prop } {#2} + { + { \dim_eval:n { #3 + \box_wd:N #1 } } {#4} + } + } +\cs_new_protected:Npn \__coffin_x_shift_pole:Nnnnnn #1#2#3#4#5#6 + { + \prop_put:cnx { l__coffin_poles_ \__int_value:w #1 _prop } {#2} + { + { \dim_eval:n #3 + \box_wd:N #1 } {#4} + {#5} {#6} + } + } +\cs_new_nopar:Npn \ior_map_break: + { \__prg_map_break:Nn \ior_map_break: { } } +\cs_new_nopar:Npn \ior_map_break:n + { \__prg_map_break:Nn \ior_map_break: } +\cs_new_protected_nopar:Npn \ior_map_inline:Nn + { \__ior_map_inline:NNn \ior_get:NN } +\cs_new_protected_nopar:Npn \ior_str_map_inline:Nn + { \__ior_map_inline:NNn \ior_get_str:NN } +\cs_new_protected_nopar:Npn \__ior_map_inline:NNn + { + \int_gincr:N \g__prg_map_int + \exp_args:Nc \__ior_map_inline:NNNn + { __prg_map_ \int_use:N \g__prg_map_int :n } + } +\cs_new_protected:Npn \__ior_map_inline:NNNn #1#2#3#4 + { + \cs_set:Npn #1 ##1 {#4} + \ior_if_eof:NF #3 { \__ior_map_inline_loop:NNN #1#2#3 } + \__prg_break_point:Nn \ior_map_break: + { \int_gdecr:N \g__prg_map_int } + } +\cs_new_protected:Npn \__ior_map_inline_loop:NNN #1#2#3 + { + #2 #3 \l__ior_internal_tl + \ior_if_eof:NF #3 + { + \exp_args:No #1 \l__ior_internal_tl + \__ior_map_inline_loop:NNN #1#2#3 + } + } +\tl_new:N \l__ior_internal_tl +\cs_new_protected:Npn \fp_set_from_dim:Nn #1#2 + { \tl_set:Nx #1 { \dim_to_fp:n {#2} } } +\cs_new_protected:Npn \fp_gset_from_dim:Nn #1#2 + { \tl_gset:Nx #1 { \dim_to_fp:n {#2} } } +\cs_generate_variant:Nn \fp_set_from_dim:Nn { c } +\cs_generate_variant:Nn \fp_gset_from_dim:Nn { c } +\cs_new:Npn \prop_map_tokens:Nn #1#2 + { + \exp_last_unbraced:Nno \__prop_map_tokens:nwn {#2} #1 + \q_recursion_tail \q__prop { } + \__prg_break_point:Nn \prop_map_break: { } + } +\cs_new:Npn \__prop_map_tokens:nwn #1 \q__prop #2 \q__prop #3 + { + \__quark_if_recursion_tail_break:NN #2 \prop_map_break: + \use:n {#1} {#2} {#3} + \__prop_map_tokens:nwn {#1} + } +\cs_generate_variant:Nn \prop_map_tokens:Nn { c } +\cs_new:Npn \prop_get:Nn #1#2 + { + \exp_last_unbraced:Noo \__prop_get_Nn:nwn + { \tl_to_str:n {#2} } #1 + \tl_to_str:n {#2} \q__prop { } + \__prg_break_point: + } +\cs_new:Npn \__prop_get_Nn:nwn #1 \q__prop #2 \q__prop #3 + { + \str_if_eq_x:nnTF {#1} {#2} + { \__prg_break:n { \exp_not:n {#3} } } + { \__prop_get_Nn:nwn {#1} } + } +\cs_generate_variant:Nn \prop_get:Nn { c } +\cs_new:Npn \seq_item:Nn #1#2 + { + \exp_last_unbraced:Nfo \__seq_item:nnn + { + \int_eval:n + { + \int_compare:nNnT {#2} < \c_zero + { \seq_count:N #1 + \c_one + } + #2 + } + } + #1 + { ? \__prg_break: } + { } + \__prg_break_point: + } +\cs_new:Npn \__seq_item:nnn #1#2#3 + { + \use_none:n #2 + \int_compare:nNnTF {#1} = \c_one + { \__prg_break:n { \exp_not:n {#3} } } + { \exp_args:Nf \__seq_item:nnn { \int_eval:n { #1 - 1 } } } + } +\cs_generate_variant:Nn \seq_item:Nn { c } +\cs_new:Npn \seq_mapthread_function:NNN #1#2#3 + { + \exp_after:wN \__seq_mapthread_function:NN + \exp_after:wN #3 + \exp_after:wN #1 + #2 + { ? \__prg_break: } { } + \__prg_break_point: + } +\cs_new:Npn \__seq_mapthread_function:NN #1#2 + { + \exp_after:wN \__seq_mapthread_function:Nnnwnn + \exp_after:wN #1 + #2 + { ? \__prg_break: } { } + \q_stop + } +\cs_new:Npn \__seq_mapthread_function:Nnnwnn #1#2#3#4 \q_stop #5#6 + { + \use_none:n #2 + \use_none:n #5 + #1 {#3} {#6} + \__seq_mapthread_function:Nnnwnn #1 #4 \q_stop + } +\cs_generate_variant:Nn \seq_mapthread_function:NNN { Nc } +\cs_generate_variant:Nn \seq_mapthread_function:NNN { c , cc } +\cs_new_protected:Npn \seq_set_from_clist:NN #1#2 + { + \tl_set:Nx #1 + { \clist_map_function:NN #2 \__seq_wrap_item:n } + } +\cs_new_protected:Npn \seq_set_from_clist:Nn #1#2 + { + \tl_set:Nx #1 + { \clist_map_function:nN {#2} \__seq_wrap_item:n } + } +\cs_new_protected:Npn \seq_gset_from_clist:NN #1#2 + { + \tl_gset:Nx #1 + { \clist_map_function:NN #2 \__seq_wrap_item:n } + } +\cs_new_protected:Npn \seq_gset_from_clist:Nn #1#2 + { + \tl_gset:Nx #1 + { \clist_map_function:nN {#2} \__seq_wrap_item:n } + } +\cs_generate_variant:Nn \seq_set_from_clist:NN { Nc } +\cs_generate_variant:Nn \seq_set_from_clist:NN { c , cc } +\cs_generate_variant:Nn \seq_set_from_clist:Nn { c } +\cs_generate_variant:Nn \seq_gset_from_clist:NN { Nc } +\cs_generate_variant:Nn \seq_gset_from_clist:NN { c , cc } +\cs_generate_variant:Nn \seq_gset_from_clist:Nn { c } +\cs_new_protected_nopar:Npn \__seq_tmp:w { } +\cs_new_protected_nopar:Npn \seq_reverse:N + { \__seq_reverse:NN \tl_set:Nx } +\cs_new_protected_nopar:Npn \seq_greverse:N + { \__seq_reverse:NN \tl_gset:Nx } +\cs_new_protected:Npn \__seq_reverse:NN #1 #2 + { + \cs_set_eq:NN \__seq_tmp:w \__seq_item:n + \cs_set_eq:NN \__seq_item:n \__seq_reverse_item:nwn + #1 #2 { #2 \exp_not:n { } } + \cs_set_eq:NN \__seq_item:n \__seq_tmp:w + } +\cs_new:Npn \__seq_reverse_item:nwn #1 #2 \exp_not:n #3 + { + #2 + \exp_not:n { \__seq_item:n {#1} #3 } + } +\cs_generate_variant:Nn \seq_reverse:N { c } +\cs_generate_variant:Nn \seq_greverse:N { c } +\cs_new_protected_nopar:Npn \seq_set_filter:NNn + { \__seq_set_filter:NNNn \tl_set:Nx } +\cs_new_protected_nopar:Npn \seq_gset_filter:NNn + { \__seq_set_filter:NNNn \tl_gset:Nx } +\cs_new_protected:Npn \__seq_set_filter:NNNn #1#2#3#4 + { + \__seq_push_item_def:n { \bool_if:nT {#4} { \__seq_wrap_item:n {##1} } } + #1 #2 { #3 } + \__seq_pop_item_def: + } +\cs_new_protected_nopar:Npn \seq_set_map:NNn + { \__seq_set_map:NNNn \tl_set:Nx } +\cs_new_protected_nopar:Npn \seq_gset_map:NNn + { \__seq_set_map:NNNn \tl_gset:Nx } +\cs_new_protected:Npn \__seq_set_map:NNNn #1#2#3#4 + { + \__seq_push_item_def:n { \exp_not:N \__seq_item:n {#4} } + #1 #2 { #3 } + \__seq_pop_item_def: + } +\cs_new:Npn \seq_use:Nnnn #1#2#3#4 + { + \seq_if_exist:NTF #1 + { + \int_case:nnn { \seq_count:N #1 } + { + { 0 } { } + { 1 } { \exp_after:wN \__seq_use:NnNnn #1 \__seq_item:n { } { } } + { 2 } { \exp_after:wN \__seq_use:NnNnn #1 {#2} } + } + { + \exp_after:wN \__seq_use_ii:nwwwwnwn + \exp_after:wN { \exp_after:wN } #1 \__seq_item:n + \q_mark { \__seq_use_ii:nwwwwnwn {#3} } + \q_mark { \__seq_use_iii:nwwn {#4} } + \q_stop { } + } + } + { \__msg_kernel_expandable_error:nnn { kernel } { bad-variable } {#1} } + } +\cs_new:Npn \__seq_use:NnNnn \__seq_item:n #1 \__seq_item:n #2#3 + { \exp_not:n { #1 #3 #2 } } +\cs_new:Npn \__seq_use_ii:nwwwwnwn + #1 \__seq_item:n #2 \__seq_item:n #3 \__seq_item:n #4#5 + \q_mark #6#7 \q_stop #8 + { + #6 \__seq_item:n {#3} \__seq_item:n {#4} #5 + \q_mark {#6} #7 \q_stop { #8 #1 #2 } + } +\cs_new:Npn \__seq_use_iii:nwwn #1 \__seq_item:n #2 #3 \q_stop #4 + { \exp_not:n { #4 #1 #2 } } +\cs_new:Npn \skip_split_finite_else_action:nnNN #1#2#3#4 + { + \skip_if_finite:nTF {#1} + { + #3 = \etex_gluestretch:D #1 \scan_stop: + #4 = \etex_glueshrink:D #1 \scan_stop: + } + { + #3 = \c_zero_skip + #4 = \c_zero_skip + #2 + } + } +\prg_new_conditional:Npnn \tl_if_single_token:n #1 { p , T , F , TF } + { + \tl_if_head_is_N_type:nTF {#1} + { \__str_if_eq_x_return:nn { \exp_not:o { \use_none:n #1 } } { } } + { \__str_if_eq_x_return:nn { \exp_not:n {#1} } { ~ } } + } +\cs_new:Npn \tl_reverse_tokens:n #1 + { + \etex_unexpanded:D \exp_after:wN + { + \tex_romannumeral:D + \__tl_act:NNNnn + \__tl_reverse_normal:nN + \__tl_reverse_group:nn + \__tl_reverse_space:n + { } + {#1} + } + } +\cs_new:Npn \__tl_reverse_group:nn #1 + { + \__tl_act_group_recurse:Nnn + \__tl_act_reverse_output:n + { \tl_reverse_tokens:n } + } +\cs_new:Npn \__tl_act_group_recurse:Nnn #1#2#3 + { + \exp_args:Nf #1 + { \exp_after:wN \exp_after:wN \exp_after:wN { #2 {#3} } } + } +\cs_new:Npn \tl_count_tokens:n #1 + { + \int_eval:n + { + \__tl_act:NNNnn + \__tl_act_count_normal:nN + \__tl_act_count_group:nn + \__tl_act_count_space:n + { } + {#1} + } + } +\cs_new:Npn \__tl_act_count_normal:nN #1 #2 { 1 + } +\cs_new:Npn \__tl_act_count_space:n #1 { 1 + } +\cs_new:Npn \__tl_act_count_group:nn #1 #2 + { 2 + \tl_count_tokens:n {#2} + } +\tl_const:Nn \c__tl_act_uppercase_tl + { + aA bB cC dD eE fF gG hH iI jJ kK lL mM + nN oO pP qQ rR sS tT uU vV wW xX yY zZ + } +\tl_const:Nn \c__tl_act_lowercase_tl + { + Aa Bb Cc Dd Ee Ff Gg Hh Ii Jj Kk Ll Mm + Nn Oo Pp Qq Rr Ss Tt Uu Vv Ww Xx Yy Zz + } +\cs_new:Npn \tl_expandable_uppercase:n #1 + { + \etex_unexpanded:D \exp_after:wN + { + \tex_romannumeral:D + \__tl_act_case_aux:nn { \c__tl_act_uppercase_tl } {#1} + } + } +\cs_new:Npn \tl_expandable_lowercase:n #1 + { + \etex_unexpanded:D \exp_after:wN + { + \tex_romannumeral:D + \__tl_act_case_aux:nn { \c__tl_act_lowercase_tl } {#1} + } + } +\cs_new:Npn \__tl_act_case_aux:nn + { + \__tl_act:NNNnn + \__tl_act_case_normal:nN + \__tl_act_case_group:nn + \__tl_act_case_space:n + } +\cs_new:Npn \__tl_act_case_space:n #1 { \__tl_act_output:n {~} } +\cs_new:Npn \__tl_act_case_normal:nN #1 #2 + { + \exp_args:Nf \__tl_act_output:n + { + \exp_args:NNo \str_case:nnn #2 {#1} + { \exp_stop_f: #2 } + } + } +\cs_new:Npn \__tl_act_case_group:nn #1 #2 + { + \exp_after:wN \__tl_act_output:n \exp_after:wN + { \exp_after:wN { \tex_romannumeral:D \__tl_act_case_aux:nn {#1} {#2} } } + } +\cs_new:Npn \tl_item:nn #1#2 + { + \exp_args:Nf \__tl_item:nn + { + \int_eval:n + { + \int_compare:nNnT {#2} < \c_zero + { \tl_count:n {#1} + \c_one + } + #2 + } + } + #1 + \q_recursion_tail + \__prg_break_point: + } +\cs_new:Npn \__tl_item:nn #1#2 + { + \__quark_if_recursion_tail_break:nN {#2} \__prg_break: + \int_compare:nNnTF {#1} = \c_one + { \__prg_break:n { \exp_not:n {#2} } } + { \exp_args:Nf \__tl_item:nn { \int_eval:n { #1 - 1 } } } + } +\cs_new_nopar:Npn \tl_item:Nn { \exp_args:No \tl_item:nn } +\cs_generate_variant:Nn \tl_item:Nn { c } +\group_begin: + \char_set_catcode_active:N \^^@ + \cs_set:Npn \char_tmp:NN #1#2 + { + \cs_new:Npn #1 ##1 + { + \char_set_catcode_active:n { `##1 } + \group_begin: + \char_set_lccode:nn { `\^^@ } { `##1 } + \tl_to_lowercase:n { \group_end: #2 ^^@ } + } + } + \char_tmp:NN \char_set_active:Npn \cs_set:Npn + \char_tmp:NN \char_set_active:Npx \cs_set:Npx + \char_tmp:NN \char_gset_active:Npn \cs_gset:Npn + \char_tmp:NN \char_gset_active:Npx \cs_gset:Npx + \char_tmp:NN \char_set_active_eq:NN \cs_set_eq:NN + \char_tmp:NN \char_gset_active_eq:NN \cs_gset_eq:NN +\group_end: +\cs_new_protected_nopar:Npn \__peek_execute_branches_N_type: + { + \bool_if:nTF + { + \token_if_eq_catcode_p:NN \l_peek_token \c_group_begin_token || + \token_if_eq_catcode_p:NN \l_peek_token \c_group_end_token || + \token_if_eq_meaning_p:NN \l_peek_token \c_space_token + } + { \__peek_false:w } + { \__peek_true:w } + } +\cs_new_protected_nopar:Npn \peek_N_type:TF + { \__peek_token_generic:NNTF \__peek_execute_branches_N_type: \scan_stop: } +\cs_new_protected_nopar:Npn \peek_N_type:T + { \__peek_token_generic:NNT \__peek_execute_branches_N_type: \scan_stop: } +\cs_new_protected_nopar:Npn \peek_N_type:F + { \__peek_token_generic:NNF \__peek_execute_branches_N_type: \scan_stop: } +%% +%% +%% End of file `l3candidates.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3clist.sty b/Master/texmf-dist/tex/latex/l3kernel/l3clist.sty index 75ef38900cc..1f78b1b4851 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3clist.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3clist.sty @@ -48,13 +48,14 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3clist.dtx 3490 2012-03-04 01:00:53Z bruno $ - {L3 Experimental comma separated lists} +\GetIdInfo$Id: l3clist.dtx 3986 2012-07-15 19:23:51Z joseph $ + {L3 Comma separated lists} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\package_check_loaded_expl: -\tl_new:N \l_clist_internal_clist -\cs_new_protected:Npn \clist_tmp:w { } +\__expl_package_check: +\cs_new_eq:NN \c_empty_clist \c_empty_tl +\tl_new:N \l__clist_internal_clist +\cs_new_protected:Npn \__clist_tmp:w { } \cs_new_eq:NN \clist_new:N \tl_new:N \cs_new_eq:NN \clist_new:c \tl_new:c \cs_new_eq:NN \clist_clear:N \tl_clear:N @@ -74,10 +75,10 @@ \cs_new_eq:NN \clist_gset_eq:cN \tl_gset_eq:cN \cs_new_eq:NN \clist_gset_eq:cc \tl_gset_eq:cc \cs_new_protected_nopar:Npn \clist_concat:NNN - { \clist_concat_aux:NNNN \tl_set:Nx } + { \__clist_concat:NNNN \tl_set:Nx } \cs_new_protected_nopar:Npn \clist_gconcat:NNN - { \clist_concat_aux:NNNN \tl_gset:Nx } -\cs_new_protected:Npn \clist_concat_aux:NNNN #1#2#3#4 + { \__clist_concat:NNNN \tl_gset:Nx } +\cs_new_protected:Npn \__clist_concat:NNNN #1#2#3#4 { #1 #2 { @@ -96,102 +97,133 @@ \cs_new_eq:NN \clist_if_exist:cT \cs_if_exist:cT \cs_new_eq:NN \clist_if_exist:cF \cs_if_exist:cF \cs_new_eq:NN \clist_if_exist_p:c \cs_if_exist_p:c -\cs_set:Npn \clist_tmp:w #1 +\cs_new:Npn \__clist_trim_spaces_generic:nw #1#2 , { - \cs_new:Npn \clist_trim_spaces_generic:nw ##1 ##2 , - { - \tl_trim_spaces_aux_i:w - ##2 - \q_nil - \q_mark #1 { } - \q_mark \tl_trim_spaces_aux_ii:w - \tl_trim_spaces_aux_iii:w - #1 \q_nil - \clist_trim_spaces_generic_aux:w - \q_stop - {##1} - } + \__tl_trim_spaces:nn {#2} + { \exp_args:No \__clist_trim_spaces_generic:nn } {#1} } -\clist_tmp:w {~} -\cs_new:Npn \clist_trim_spaces_generic_aux:w #1 \q_nil #2 \q_stop - { \exp_args:No \clist_trim_spaces_generic_aux_ii:nn { \use_none:n #1 } } -\cs_new:Npn \clist_trim_spaces_generic_aux_ii:nn #1 #2 { #2 {#1} } -\cs_new:Npn \clist_trim_spaces:n #1 +\cs_new:Npn \__clist_trim_spaces_generic:nn #1#2 { #2 {#1} } +\cs_new:Npn \__clist_trim_spaces:n #1 { - \clist_trim_spaces_generic:nw - { \clist_trim_spaces_aux:nn { } } + \__clist_trim_spaces_generic:nw + { \__clist_trim_spaces_ii:nn { } } \q_mark #1 , \q_recursion_tail, \q_recursion_stop } -\cs_new:Npn \clist_trim_spaces_aux:nn #1 #2 +\cs_new:Npn \__clist_trim_spaces_ii:nn #1 #2 { \quark_if_recursion_tail_stop:n {#2} \tl_if_empty:nTF {#2} { - \clist_trim_spaces_generic:nw - { \clist_trim_spaces_aux:nn {#1} } \q_mark + \__clist_trim_spaces_generic:nw + { \__clist_trim_spaces_ii:nn {#1} } \q_mark } { #1 \exp_not:n {#2} - \clist_trim_spaces_generic:nw - { \clist_trim_spaces_aux:nn { , } } \q_mark + \__clist_trim_spaces_generic:nw + { \__clist_trim_spaces_ii:nn { , } } \q_mark } } \cs_new_protected:Npn \clist_set:Nn #1#2 - { \tl_set:Nx #1 { \clist_trim_spaces:n {#2} } } + { \tl_set:Nx #1 { \__clist_trim_spaces:n {#2} } } \cs_new_protected:Npn \clist_gset:Nn #1#2 - { \tl_gset:Nx #1 { \clist_trim_spaces:n {#2} } } + { \tl_gset:Nx #1 { \__clist_trim_spaces:n {#2} } } \cs_generate_variant:Nn \clist_set:Nn { NV , No , Nx , c , cV , co , cx } \cs_generate_variant:Nn \clist_gset:Nn { NV , No , Nx , c , cV , co , cx } \cs_new_protected_nopar:Npn \clist_put_left:Nn - { \clist_put_left_aux:NNNn \clist_concat:NNN \clist_set:Nn } + { \__clist_put_left:NNNn \clist_concat:NNN \clist_set:Nn } \cs_new_protected_nopar:Npn \clist_gput_left:Nn - { \clist_put_left_aux:NNNn \clist_gconcat:NNN \clist_set:Nn } -\cs_new_protected:Npn \clist_put_left_aux:NNNn #1#2#3#4 + { \__clist_put_left:NNNn \clist_gconcat:NNN \clist_set:Nn } +\cs_new_protected:Npn \__clist_put_left:NNNn #1#2#3#4 { - #2 \l_clist_internal_clist {#4} - #1 #3 \l_clist_internal_clist #3 + #2 \l__clist_internal_clist {#4} + #1 #3 \l__clist_internal_clist #3 } \cs_generate_variant:Nn \clist_put_left:Nn { NV , No , Nx } \cs_generate_variant:Nn \clist_put_left:Nn { c , cV , co , cx } \cs_generate_variant:Nn \clist_gput_left:Nn { NV , No , Nx } \cs_generate_variant:Nn \clist_gput_left:Nn { c , cV , co , cx } \cs_new_protected_nopar:Npn \clist_put_right:Nn - { \clist_put_right_aux:NNNn \clist_concat:NNN \clist_set:Nn } + { \__clist_put_right:NNNn \clist_concat:NNN \clist_set:Nn } \cs_new_protected_nopar:Npn \clist_gput_right:Nn - { \clist_put_right_aux:NNNn \clist_gconcat:NNN \clist_gset:Nn } -\cs_new_protected:Npn \clist_put_right_aux:NNNn #1#2#3#4 + { \__clist_put_right:NNNn \clist_gconcat:NNN \clist_gset:Nn } +\cs_new_protected:Npn \__clist_put_right:NNNn #1#2#3#4 { - #2 \l_clist_internal_clist {#4} - #1 #3 #3 \l_clist_internal_clist + #2 \l__clist_internal_clist {#4} + #1 #3 #3 \l__clist_internal_clist } \cs_generate_variant:Nn \clist_put_right:Nn { NV , No , Nx } \cs_generate_variant:Nn \clist_put_right:Nn { c , cV , co , cx } \cs_generate_variant:Nn \clist_gput_right:Nn { NV , No , Nx } \cs_generate_variant:Nn \clist_gput_right:Nn { c , cV , co , cx } \cs_new_protected:Npn \clist_get:NN #1#2 - { \exp_after:wN \clist_get_aux:wN #1 , \q_stop #2 } -\cs_new_protected:Npn \clist_get_aux:wN #1 , #2 \q_stop #3 + { + \if_meaning:w #1 \c_empty_clist + \tl_set:Nn #2 { \q_no_value } + \else: + \exp_after:wN \__clist_get:wN #1 , \q_stop #2 + \fi: + } +\cs_new_protected:Npn \__clist_get:wN #1 , #2 \q_stop #3 { \tl_set:Nn #3 {#1} } \cs_generate_variant:Nn \clist_get:NN { c } \cs_new_protected_nopar:Npn \clist_pop:NN - { \clist_pop_aux:NNN \tl_set:Nf } + { \__clist_pop:NNN \tl_set:Nx } \cs_new_protected_nopar:Npn \clist_gpop:NN - { \clist_pop_aux:NNN \tl_gset:Nf } -\cs_new_protected:Npn \clist_pop_aux:NNN #1#2#3 + { \__clist_pop:NNN \tl_gset:Nx } +\cs_new_protected:Npn \__clist_pop:NNN #1#2#3 { - \exp_after:wN \clist_pop_aux:wNNN #2 , \q_nil \q_stop #1#2#3 + \if_meaning:w #2 \c_empty_clist + \tl_set:Nn #3 { \q_no_value } + \else: + \exp_after:wN \__clist_pop:wwNNN #2 , \q_mark \q_stop #1#2#3 + \fi: } -\cs_new_protected:Npn \clist_pop_aux:wNNN #1 , #2 \q_stop #3#4#5 +\cs_new_protected:Npn \__clist_pop:wwNNN #1 , #2 \q_stop #3#4#5 { \tl_set:Nn #5 {#1} - \quark_if_nil:nTF {#2} - { #3 #4 { } } - { #3 #4 { \clist_pop_aux:w \exp_stop_f: #2 } } + #3 #4 + { + \__clist_pop:wN \prg_do_nothing: + #2 \exp_not:o + , \q_mark \use_none:n + \q_stop + } } -\cs_new_protected:Npn \clist_pop_aux:w #1 , \q_nil {#1} +\cs_new:Npn \__clist_pop:wN #1 , \q_mark #2 #3 \q_stop { #2 {#1} } \cs_generate_variant:Nn \clist_pop:NN { c } \cs_generate_variant:Nn \clist_gpop:NN { c } +\prg_new_protected_conditional:Npnn \clist_get:NN #1#2 { T , F , TF } + { + \if_meaning:w #1 \c_empty_clist + \prg_return_false: + \else: + \exp_after:wN \__clist_get:wN #1 , \q_stop #2 + \prg_return_true: + \fi: + } +\cs_generate_variant:Nn \clist_get:NNT { c } +\cs_generate_variant:Nn \clist_get:NNF { c } +\cs_generate_variant:Nn \clist_get:NNTF { c } +\prg_new_protected_conditional:Npnn \clist_pop:NN #1#2 { T , F , TF } + { \__clist_pop_TF:NNN \tl_set:Nx #1 #2 } +\prg_new_protected_conditional:Npnn \clist_gpop:NN #1#2 { T , F , TF } + { \__clist_pop_TF:NNN \tl_gset:Nx #1 #2 } +\cs_new_protected:Npn \__clist_pop_TF:NNN #1#2#3 + { + \if_meaning:w #2 \c_empty_clist + \prg_return_false: + \else: + \exp_after:wN \__clist_pop:wwNNN #2 , \q_mark \q_stop #1#2#3 + \prg_return_true: + \fi: + } +\cs_generate_variant:Nn \clist_pop:NNT { c } +\cs_generate_variant:Nn \clist_pop:NNF { c } +\cs_generate_variant:Nn \clist_pop:NNTF { c } +\cs_generate_variant:Nn \clist_gpop:NNT { c } +\cs_generate_variant:Nn \clist_gpop:NNF { c } +\cs_generate_variant:Nn \clist_gpop:NNTF { c } \cs_new_eq:NN \clist_push:Nn \clist_put_left:Nn \cs_new_eq:NN \clist_push:NV \clist_put_left:NV \cs_new_eq:NN \clist_push:No \clist_put_left:No @@ -208,40 +240,38 @@ \cs_new_eq:NN \clist_gpush:cV \clist_gput_left:cV \cs_new_eq:NN \clist_gpush:co \clist_gput_left:co \cs_new_eq:NN \clist_gpush:cx \clist_gput_left:cx -\cs_new_eq:NN \clist_use:N \tl_use:N -\cs_new_eq:NN \clist_use:c \tl_use:c -\clist_new:N \l_clist_internal_remove_clist +\clist_new:N \l__clist_internal_remove_clist \cs_new_protected:Npn \clist_remove_duplicates:N - { \clist_remove_duplicates_aux:NN \clist_set_eq:NN } + { \__clist_remove_duplicates:NN \clist_set_eq:NN } \cs_new_protected:Npn \clist_gremove_duplicates:N - { \clist_remove_duplicates_aux:NN \clist_gset_eq:NN } -\cs_new_protected:Npn \clist_remove_duplicates_aux:NN #1#2 + { \__clist_remove_duplicates:NN \clist_gset_eq:NN } +\cs_new_protected:Npn \__clist_remove_duplicates:NN #1#2 { - \clist_clear:N \l_clist_internal_remove_clist + \clist_clear:N \l__clist_internal_remove_clist \clist_map_inline:Nn #2 { - \clist_if_in:NnF \l_clist_internal_remove_clist {##1} - { \clist_put_right:Nn \l_clist_internal_remove_clist {##1} } + \clist_if_in:NnF \l__clist_internal_remove_clist {##1} + { \clist_put_right:Nn \l__clist_internal_remove_clist {##1} } } - #1 #2 \l_clist_internal_remove_clist + #1 #2 \l__clist_internal_remove_clist } \cs_generate_variant:Nn \clist_remove_duplicates:N { c } \cs_generate_variant:Nn \clist_gremove_duplicates:N { c } \cs_new_protected:Npn \clist_remove_all:Nn - { \clist_remove_all_aux:NNn \tl_set:Nx } + { \__clist_remove_all:NNn \tl_set:Nx } \cs_new_protected:Npn \clist_gremove_all:Nn - { \clist_remove_all_aux:NNn \tl_gset:Nx } -\cs_new_protected:Npn \clist_remove_all_aux:NNn #1#2#3 + { \__clist_remove_all:NNn \tl_gset:Nx } +\cs_new_protected:Npn \__clist_remove_all:NNn #1#2#3 { - \cs_set:Npn \clist_tmp:w ##1 , #3 , + \cs_set:Npn \__clist_tmp:w ##1 , #3 , { ##1 , \q_mark , \use_none_delimit_by_q_stop:w , - \clist_remove_all_aux: + \__clist_remove_all: } #1 #2 { - \exp_after:wN \clist_remove_all_aux: + \exp_after:wN \__clist_remove_all: #2 , \q_mark , #3 , \q_stop } \clist_if_empty:NF #2 @@ -253,31 +283,27 @@ } } } -\cs_new:Npn \clist_remove_all_aux: - { \exp_after:wN \clist_remove_all_aux:w \clist_tmp:w , } -\cs_new:Npn \clist_remove_all_aux:w #1 , \q_mark , #2 , { \exp_not:n {#1} } +\cs_new:Npn \__clist_remove_all: + { \exp_after:wN \__clist_remove_all:w \__clist_tmp:w , } +\cs_new:Npn \__clist_remove_all:w #1 , \q_mark , #2 , { \exp_not:n {#1} } \cs_generate_variant:Nn \clist_remove_all:Nn { c } \cs_generate_variant:Nn \clist_gremove_all:Nn { c } \prg_new_eq_conditional:NNn \clist_if_empty:N \tl_if_empty:N { p , T , F , TF } \prg_new_eq_conditional:NNn \clist_if_empty:c \tl_if_empty:c { p , T , F , TF } -\prg_new_eq_conditional:NNn \clist_if_eq:NN \tl_if_eq:NN { p , T , F , TF } -\prg_new_eq_conditional:NNn \clist_if_eq:Nc \tl_if_eq:Nc { p , T , F , TF } -\prg_new_eq_conditional:NNn \clist_if_eq:cN \tl_if_eq:cN { p , T , F , TF } -\prg_new_eq_conditional:NNn \clist_if_eq:cc \tl_if_eq:cc { p , T , F , TF } \prg_new_protected_conditional:Npnn \clist_if_in:Nn #1#2 { T , F , TF } { - \exp_args:No \clist_if_in_return:nn #1 {#2} + \exp_args:No \__clist_if_in_return:nn #1 {#2} } \prg_new_protected_conditional:Npnn \clist_if_in:nn #1#2 { T , F , TF } { - \clist_set:Nn \l_clist_internal_clist {#1} - \exp_args:No \clist_if_in_return:nn \l_clist_internal_clist {#2} + \clist_set:Nn \l__clist_internal_clist {#1} + \exp_args:No \__clist_if_in_return:nn \l__clist_internal_clist {#2} } -\cs_new_protected:Npn \clist_if_in_return:nn #1#2 +\cs_new_protected:Npn \__clist_if_in_return:nn #1#2 { - \cs_set:Npn \clist_tmp:w ##1 ,#2, { } + \cs_set:Npn \__clist_tmp:w ##1 ,#2, { } \tl_if_empty:oTF - { \clist_tmp:w ,#1, {} {} ,#2, } + { \__clist_tmp:w ,#1, {} {} ,#2, } { \prg_return_false: } { \prg_return_true: } } \cs_generate_variant:Nn \clist_if_in:NnT { NV , No } @@ -293,48 +319,49 @@ { \clist_if_empty:NF #1 { - \exp_last_unbraced:NNo \clist_map_function_aux:Nw #2 #1 + \exp_last_unbraced:NNo \__clist_map_function:Nw #2 #1 , \q_recursion_tail , - \prg_break_point:n { } + \__prg_break_point:Nn \clist_map_break: { } } } -\cs_new:Npn \clist_map_function_aux:Nw #1#2 , +\cs_new:Npn \__clist_map_function:Nw #1#2 , { - \quark_if_recursion_tail_break:n {#2} + \__quark_if_recursion_tail_break:nN {#2} \clist_map_break: #1 {#2} - \clist_map_function_aux:Nw #1 + \__clist_map_function:Nw #1 } \cs_generate_variant:Nn \clist_map_function:NN { c } \cs_new:Npn \clist_map_function:nN #1#2 { - \clist_trim_spaces_generic:nw { \clist_map_function_n_aux:Nn #2 } + \__clist_trim_spaces_generic:nw { \__clist_map_function_n:Nn #2 } \q_mark #1, \q_recursion_tail, - \prg_break_point:n { } + \__prg_break_point:Nn \clist_map_break: { } } -\cs_new:Npn \clist_map_function_n_aux:Nn #1 #2 +\cs_new:Npn \__clist_map_function_n:Nn #1 #2 { - \quark_if_recursion_tail_break:n {#2} - \tl_if_empty:nF {#2} { \clist_map_aux_unbrace:Nw #1 #2, } - \clist_trim_spaces_generic:nw { \clist_map_function_n_aux:Nn #1 } + \__quark_if_recursion_tail_break:nN {#2} \clist_map_break: + \tl_if_empty:nF {#2} { \__clist_map_unbrace:Nw #1 #2, } + \__clist_trim_spaces_generic:nw { \__clist_map_function_n:Nn #1 } \q_mark } -\cs_new:Npn \clist_map_aux_unbrace:Nw #1 #2, { #1 {#2} } +\cs_new:Npn \__clist_map_unbrace:Nw #1 #2, { #1 {#2} } \cs_new_protected:Npn \clist_map_inline:Nn #1#2 { \clist_if_empty:NF #1 { - \int_gincr:N \g_prg_map_int - \cs_gset:cpn { clist_map_ \int_use:N \g_prg_map_int :n } ##1 {#2} - \exp_last_unbraced:Nco \clist_map_function_aux:Nw - { clist_map_ \int_use:N \g_prg_map_int :n } + \int_gincr:N \g__prg_map_int + \cs_gset:cpn { __prg_map_ \int_use:N \g__prg_map_int :w } ##1 {#2} + \exp_last_unbraced:Nco \__clist_map_function:Nw + { __prg_map_ \int_use:N \g__prg_map_int :w } #1 , \q_recursion_tail , - \prg_break_point:n { \int_gdecr:N \g_prg_map_int } + \__prg_break_point:Nn \clist_map_break: + { \int_gdecr:N \g__prg_map_int } } } \cs_new_protected:Npn \clist_map_inline:nn #1 { - \clist_set:Nn \l_clist_internal_clist {#1} - \clist_map_inline:Nn \l_clist_internal_clist + \clist_set:Nn \l__clist_internal_clist {#1} + \clist_map_inline:Nn \l__clist_internal_clist } \cs_generate_variant:Nn \clist_map_inline:Nn { c } \cs_new_protected:Npn \clist_map_variable:NNn #1#2#3 @@ -342,177 +369,83 @@ \clist_if_empty:NF #1 { \exp_args:Nno \use:nn - { \clist_map_variable_aux:Nnw #2 {#3} } + { \__clist_map_variable:Nnw #2 {#3} } #1 , \q_recursion_tail , \q_recursion_stop - \prg_break_point:n { } + \__prg_break_point:Nn \clist_map_break: { } } } \cs_new_protected:Npn \clist_map_variable:nNn #1 { - \clist_set:Nn \l_clist_internal_clist {#1} - \clist_map_variable:NNn \l_clist_internal_clist + \clist_set:Nn \l__clist_internal_clist {#1} + \clist_map_variable:NNn \l__clist_internal_clist } -\cs_new_protected:Npn \clist_map_variable_aux:Nnw #1#2#3, +\cs_new_protected:Npn \__clist_map_variable:Nnw #1#2#3, { \tl_set:Nn #1 {#3} \quark_if_recursion_tail_stop:N #1 \use:n {#2} - \clist_map_variable_aux:Nnw #1 {#2} + \__clist_map_variable:Nnw #1 {#2} } \cs_generate_variant:Nn \clist_map_variable:NNn { c } -\cs_new_eq:NN \clist_map_break: \prg_map_break: -\cs_new_eq:NN \clist_map_break:n \prg_map_break:n -\cs_new_protected:Npn \clist_show:N #1 - { - \msg_aux_show:Nnx - #1 - { clist } - { \clist_map_function:NN #1 \msg_aux_show:n } - } -\cs_new_protected:Npn \clist_show:n #1 - { - \clist_set:Nn \l_clist_internal_clist {#1} - \msg_aux_show:Nnx - \l_clist_internal_clist - { clist } - { \clist_map_function:NN \l_clist_internal_clist \msg_aux_show:n } - } -\cs_generate_variant:Nn \clist_show:N { c } -\clist_new:N \l_tmpa_clist -\clist_new:N \l_tmpb_clist -\clist_new:N \g_tmpa_clist -\clist_new:N \g_tmpb_clist -\cs_new:Npn \clist_length:N #1 +\cs_new_nopar:Npn \clist_map_break: + { \__prg_map_break:Nn \clist_map_break: { } } +\cs_new_nopar:Npn \clist_map_break:n + { \__prg_map_break:Nn \clist_map_break: } +\cs_new:Npn \clist_count:N #1 { \int_eval:n { 0 - \clist_map_function:NN #1 \clist_length_aux:n + \clist_map_function:NN #1 \__clist_count:n } } -\cs_new:Npn \clist_length_aux:n #1 { +1 } -\cs_new:Npx \clist_length:n #1 +\cs_generate_variant:Nn \clist_count:N { c } +\cs_new:Npx \clist_count:n #1 { \exp_not:N \int_eval:n { 0 - \exp_not:N \clist_length_n_aux:w \c_space_tl + \exp_not:N \__clist_count:w \c_space_tl #1 \exp_not:n { , \q_recursion_tail , \q_recursion_stop } } } -\cs_new:Npx \clist_length_n_aux:w #1 , +\cs_new:Npn \__clist_count:n #1 { + \c_one } +\cs_new:Npx \__clist_count:w #1 , { \exp_not:n { \exp_args:Nf \quark_if_recursion_tail_stop:n } {#1} \exp_not:N \tl_if_blank:nF {#1} { + \c_one } - \exp_not:N \clist_length_n_aux:w \c_space_tl + \exp_not:N \__clist_count:w \c_space_tl } -\cs_generate_variant:Nn \clist_length:N { c } -\cs_new:Npn \clist_item:Nn #1#2 +\cs_new_protected:Npn \clist_show:N #1 { - \exp_args:Nfo \clist_item_aux:nnNn - { \clist_length:N #1 } + \__msg_show_variable:Nnn #1 - \clist_item_N_loop:nw - {#2} - } -\cs_new:Npn \clist_item_aux:nnNn #1#2#3#4 - { - \int_compare:nNnTF {#4} < \c_zero - { - \int_compare:nNnTF {#4} < { - #1 } - { \use_none_delimit_by_q_stop:w } - { \exp_args:Nf #3 { \int_eval:n { #4 + #1 } } } - } - { - \int_compare:nNnTF {#4} < {#1} - { #3 {#4} } - { \use_none_delimit_by_q_stop:w } - } - #2, \q_stop - } -\cs_new:Npn \clist_item_N_loop:nw #1 #2, - { - \int_compare:nNnTF {#1} = \c_zero - { \use_i_delimit_by_q_stop:nw { \exp_not:n {#2} } } - { \exp_args:Nf \clist_item_N_loop:nw { \int_eval:n { #1 - 1 } } } - } -\cs_generate_variant:Nn \clist_item:Nn { c } -\cs_new:Npn \clist_item:nn #1#2 - { - \exp_args:Nf \clist_item_aux:nnNn - { \clist_length:n {#1} } - {#1} - \clist_item_n_aux:nw - {#2} - } -\cs_new:Npn \clist_item_n_aux:nw #1 - { \clist_item_n_loop:nw {#1} \prg_do_nothing: } -\cs_new:Npn \clist_item_n_loop:nw #1 #2, - { - \exp_args:No \tl_if_blank:nTF {#2} - { \clist_item_n_loop:nw {#1} \prg_do_nothing: } - { - \int_compare:nNnTF {#1} = \c_zero - { \exp_args:No \clist_item_n_end:n {#2} } - { - \exp_args:Nf \clist_item_n_loop:nw - { \int_eval:n { #1 - 1 } } - \prg_do_nothing: - } - } - } -\cs_new:Npn \clist_item_n_end:n #1 #2 \q_stop - { - \exp_after:wN \exp_after:wN \exp_after:wN \clist_item_n_strip:w - \tl_trim_spaces:n {#1} , - } -\cs_new:Npn \clist_item_n_strip:w #1 , { \exp_not:n {#1} } -\cs_new_protected:Npn \clist_set_from_seq:NN - { \clist_set_from_seq_aux:NNNN \clist_clear:N \tl_set:Nx } -\cs_new_protected:Npn \clist_gset_from_seq:NN - { \clist_set_from_seq_aux:NNNN \clist_gclear:N \tl_gset:Nx } -\cs_new_protected:Npn \clist_set_from_seq_aux:NNNN #1#2#3#4 - { - \seq_if_empty:NTF #4 - { #1 #3 } - { - #2 #3 - { - \exp_last_unbraced:Nf \use_none:n - { \seq_map_function:NN #4 \clist_wrap_item:n } - } - } - } -\cs_new:Npn \clist_wrap_item:n #1 - { - , - \tl_if_empty:oTF { \clist_set_from_seq_aux:w #1 ~ , #1 ~ } - { \exp_not:n {#1} } - { \exp_not:n { {#1} } } - } -\cs_new:Npn \clist_set_from_seq_aux:w #1 , #2 ~ { } -\cs_generate_variant:Nn \clist_set_from_seq:NN { Nc } -\cs_generate_variant:Nn \clist_set_from_seq:NN { c , cc } -\cs_generate_variant:Nn \clist_gset_from_seq:NN { Nc } -\cs_generate_variant:Nn \clist_gset_from_seq:NN { c , cc } -\cs_new_protected:Npn \clist_const:Nn #1#2 - { \tl_const:Nx #1 { \clist_trim_spaces:n {#2} } } -\cs_generate_variant:Nn \clist_const:Nn { c , Nx , cx } -\prg_new_conditional:Npnn \clist_if_empty:n #1 { p , T , F , TF } - { - \clist_if_empty_n_aux:w ? #1 - , \q_mark \prg_return_false: - , \q_mark \prg_return_true: - \q_stop + { clist } + { \clist_map_function:NN #1 \__msg_show_item:n } } -\cs_new:Npn \clist_if_empty_n_aux:w #1 , +\cs_new_protected:Npn \clist_show:n #1 { - \tl_if_empty:oTF { \use_none:nn #1 ? } - { \clist_if_empty_n_aux:w ? } - { \clist_if_empty_n_aux:wNw } + \clist_set:Nn \l__clist_internal_clist {#1} + \__msg_show_variable:Nnn + \l__clist_internal_clist + { clist } + { \clist_map_function:NN \l__clist_internal_clist \__msg_show_item:n } } -\cs_new:Npn \clist_if_empty_n_aux:wNw #1 \q_mark #2#3 \q_stop {#2} +\cs_generate_variant:Nn \clist_show:N { c } +\clist_new:N \l_tmpa_clist +\clist_new:N \l_tmpb_clist +\clist_new:N \g_tmpa_clist +\clist_new:N \g_tmpb_clist +\prg_new_eq_conditional:NNn \clist__if_eq:NN \tl_if_eq:NN { p , T , F , TF } +\prg_new_eq_conditional:NNn \clist_if_eq:Nc \tl_if_eq:Nc { p , T , F , TF } +\prg_new_eq_conditional:NNn \clist_if_eq:cN \tl_if_eq:cN { p , T , F , TF } +\prg_new_eq_conditional:NNn \clist_if_eq:cc \tl_if_eq:cc { p , T , F , TF } +\cs_new_eq:NN \clist_length:N \clist_count:N +\cs_new_eq:NN \clist_length:n \clist_count:c +\cs_new_eq:NN \clist_length:c \clist_count:n +\cs_new_eq:NN \clist_use:N \tl_use:N +\cs_new_eq:NN \clist_use:c \tl_use:c %% %% %% End of file `l3clist.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3coffins.sty b/Master/texmf-dist/tex/latex/l3kernel/l3coffins.sty index cd84ef63e8e..75927ce708b 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3coffins.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3coffins.sty @@ -47,99 +47,96 @@ %% ----------------------------------------------------------------------- %% \RequirePackage{l3names} -\GetIdInfo$Id: l3coffins.dtx 3482 2012-03-03 18:48:06Z bruno $ - {L3 Experimental coffin code layer} +\GetIdInfo$Id: l3coffins.dtx 3986 2012-07-15 19:23:51Z joseph $ + {L3 Coffin code layer} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\package_check_loaded_expl: -\box_new:N \l_coffin_internal_box -\dim_new:N \l_coffin_internal_dim -\fp_new:N \l_coffin_internal_fp -\tl_new:N \l_coffin_internal_tl -\prop_new:N \c_coffin_corners_prop -\prop_put:Nnn \c_coffin_corners_prop { tl } { { 0 pt } { 0 pt } } -\prop_put:Nnn \c_coffin_corners_prop { tr } { { 0 pt } { 0 pt } } -\prop_put:Nnn \c_coffin_corners_prop { bl } { { 0 pt } { 0 pt } } -\prop_put:Nnn \c_coffin_corners_prop { br } { { 0 pt } { 0 pt } } -\prop_new:N \c_coffin_poles_prop -\tl_set:Nn \l_coffin_internal_tl { { 0 pt } { 0 pt } { 0 pt } { 1000 pt } } -\prop_put:Nno \c_coffin_poles_prop { l } { \l_coffin_internal_tl } -\prop_put:Nno \c_coffin_poles_prop { hc } { \l_coffin_internal_tl } -\prop_put:Nno \c_coffin_poles_prop { r } { \l_coffin_internal_tl } -\tl_set:Nn \l_coffin_internal_tl { { 0 pt } { 0 pt } { 1000 pt } { 0 pt } } -\prop_put:Nno \c_coffin_poles_prop { b } { \l_coffin_internal_tl } -\prop_put:Nno \c_coffin_poles_prop { vc } { \l_coffin_internal_tl } -\prop_put:Nno \c_coffin_poles_prop { t } { \l_coffin_internal_tl } -\prop_put:Nno \c_coffin_poles_prop { B } { \l_coffin_internal_tl } -\prop_put:Nno \c_coffin_poles_prop { H } { \l_coffin_internal_tl } -\prop_put:Nno \c_coffin_poles_prop { T } { \l_coffin_internal_tl } -\fp_new:N \l_coffin_calc_a_fp -\fp_new:N \l_coffin_calc_b_fp -\fp_new:N \l_coffin_calc_c_fp -\fp_new:N \l_coffin_calc_d_fp -\fp_new:N \l_coffin_calc_result_fp -\bool_new:N \l_coffin_error_bool -\dim_new:N \l_coffin_offset_x_dim -\dim_new:N \l_coffin_offset_y_dim -\tl_new:N \l_coffin_pole_a_tl -\tl_new:N \l_coffin_pole_b_tl -\fp_new:N \l_coffin_sin_fp -\fp_new:N \l_coffin_cos_fp -\dim_new:N \l_coffin_x_dim -\dim_new:N \l_coffin_y_dim -\dim_new:N \l_coffin_x_prime_dim -\dim_new:N \l_coffin_y_prime_dim -\fp_new:N \l_coffin_x_fp -\fp_new:N \l_coffin_y_fp -\fp_new:N \l_coffin_x_prime_fp -\fp_new:N \l_coffin_y_prime_fp -\dim_new:N \l_coffin_Depth_dim -\dim_new:N \l_coffin_Height_dim -\dim_new:N \l_coffin_TotalHeight_dim -\dim_new:N \l_coffin_Width_dim -\cs_new_nopar:Npn \coffin_saved_Depth: { } -\cs_new_nopar:Npn \coffin_saved_Height: { } -\cs_new_nopar:Npn \coffin_saved_TotalHeight: { } -\cs_new_nopar:Npn \coffin_saved_Width: { } -\cs_new_protected:Npn \coffin_if_exist:NT #1#2 +\__expl_package_check: +\box_new:N \l__coffin_internal_box +\dim_new:N \l__coffin_internal_dim +\tl_new:N \l__coffin_internal_tl +\prop_new:N \c__coffin_corners_prop +\prop_put:Nnn \c__coffin_corners_prop { tl } { { 0 pt } { 0 pt } } +\prop_put:Nnn \c__coffin_corners_prop { tr } { { 0 pt } { 0 pt } } +\prop_put:Nnn \c__coffin_corners_prop { bl } { { 0 pt } { 0 pt } } +\prop_put:Nnn \c__coffin_corners_prop { br } { { 0 pt } { 0 pt } } +\prop_new:N \c__coffin_poles_prop +\tl_set:Nn \l__coffin_internal_tl { { 0 pt } { 0 pt } { 0 pt } { 1000 pt } } +\prop_put:Nno \c__coffin_poles_prop { l } { \l__coffin_internal_tl } +\prop_put:Nno \c__coffin_poles_prop { hc } { \l__coffin_internal_tl } +\prop_put:Nno \c__coffin_poles_prop { r } { \l__coffin_internal_tl } +\tl_set:Nn \l__coffin_internal_tl { { 0 pt } { 0 pt } { 1000 pt } { 0 pt } } +\prop_put:Nno \c__coffin_poles_prop { b } { \l__coffin_internal_tl } +\prop_put:Nno \c__coffin_poles_prop { vc } { \l__coffin_internal_tl } +\prop_put:Nno \c__coffin_poles_prop { t } { \l__coffin_internal_tl } +\prop_put:Nno \c__coffin_poles_prop { B } { \l__coffin_internal_tl } +\prop_put:Nno \c__coffin_poles_prop { H } { \l__coffin_internal_tl } +\prop_put:Nno \c__coffin_poles_prop { T } { \l__coffin_internal_tl } +\fp_new:N \l__coffin_slope_x_fp +\fp_new:N \l__coffin_slope_y_fp +\bool_new:N \l__coffin_error_bool +\dim_new:N \l__coffin_offset_x_dim +\dim_new:N \l__coffin_offset_y_dim +\tl_new:N \l__coffin_pole_a_tl +\tl_new:N \l__coffin_pole_b_tl +\dim_new:N \l__coffin_x_dim +\dim_new:N \l__coffin_y_dim +\dim_new:N \l__coffin_x_prime_dim +\dim_new:N \l__coffin_y_prime_dim +\dim_new:N \l__coffin_Depth_dim +\dim_new:N \l__coffin_Height_dim +\dim_new:N \l__coffin_TotalHeight_dim +\dim_new:N \l__coffin_Width_dim +\cs_new_nopar:Npn \__coffin_saved_Depth: { } +\cs_new_nopar:Npn \__coffin_saved_Height: { } +\cs_new_nopar:Npn \__coffin_saved_TotalHeight: { } +\cs_new_nopar:Npn \__coffin_saved_Width: { } +\prg_new_conditional:Npnn \coffin_if_exist:N #1 { p , T , F , TF } { \cs_if_exist:NTF #1 { - \cs_if_exist:cTF { l_coffin_poles_ \int_value:w #1 _prop } - { #2 } - { - \msg_kernel_error:nnx { coffins } { unknown-coffin } - { \token_to_str:N #1 } - } + \cs_if_exist:cTF { l__coffin_poles_ \__int_value:w #1 _prop } + { \prg_return_true: } + { \prg_return_false: } } + { \prg_return_false: } + } +\cs_generate_variant:Nn \coffin_if_exist_p:N { c } +\cs_generate_variant:Nn \coffin_if_exist:NT { c } +\cs_generate_variant:Nn \coffin_if_exist:NF { c } +\cs_generate_variant:Nn \coffin_if_exist:NTF { c } +\cs_new_protected:Npn \__coffin_if_exist:NT #1#2 + { + \coffin_if_exist:NTF #1 + { #2 } { - \msg_kernel_error:nnx { coffins } { unknown-coffin } + \__msg_kernel_error:nnx { kernel } { unknown-coffin } { \token_to_str:N #1 } } } \cs_new_protected:Npn \coffin_clear:N #1 { - \coffin_if_exist:NT #1 + \__coffin_if_exist:NT #1 { \box_clear:N #1 - \coffin_reset_structure:N #1 + \__coffin_reset_structure:N #1 } } \cs_generate_variant:Nn \coffin_clear:N { c } \cs_new_protected:Npn \coffin_new:N #1 { \box_new:N #1 - \prop_clear_new:c { l_coffin_corners_ \int_value:w #1 _prop } - \prop_clear_new:c { l_coffin_poles_ \int_value:w #1 _prop } - \prop_gset_eq:cN { l_coffin_corners_ \int_value:w #1 _prop } - \c_coffin_corners_prop - \prop_gset_eq:cN { l_coffin_poles_ \int_value:w #1 _prop } - \c_coffin_poles_prop + \prop_clear_new:c { l__coffin_corners_ \__int_value:w #1 _prop } + \prop_clear_new:c { l__coffin_poles_ \__int_value:w #1 _prop } + \prop_gset_eq:cN { l__coffin_corners_ \__int_value:w #1 _prop } + \c__coffin_corners_prop + \prop_gset_eq:cN { l__coffin_poles_ \__int_value:w #1 _prop } + \c__coffin_poles_prop } \cs_generate_variant:Nn \coffin_new:N { c } \cs_new_protected:Npn \hcoffin_set:Nn #1#2 { - \coffin_if_exist:NT #1 + \__coffin_if_exist:NT #1 { \hbox_set:Nn #1 { @@ -148,51 +145,52 @@ #2 \color_group_end: } - \coffin_reset_structure:N #1 - \coffin_update_poles:N #1 - \coffin_update_corners:N #1 + \__coffin_reset_structure:N #1 + \__coffin_update_poles:N #1 + \__coffin_update_corners:N #1 } } \cs_generate_variant:Nn \hcoffin_set:Nn { c } \cs_new_protected:Npn \vcoffin_set:Nnn #1#2#3 { - \coffin_if_exist:NT #1 + \__coffin_if_exist:NT #1 { \vbox_set:Nn #1 { \dim_set:Nn \tex_hsize:D {#2} + \dim_set_eq:NN \linewidth \tex_hsize:D + \dim_set_eq:NN \columnwidth \tex_hsize:D \color_group_begin: - \color_ensure_current: #3 \color_group_end: } - \coffin_reset_structure:N #1 - \coffin_update_poles:N #1 - \coffin_update_corners:N #1 - \vbox_set_top:Nn \l_coffin_internal_box { \vbox_unpack:N #1 } - \coffin_set_pole:Nnx #1 { T } + \__coffin_reset_structure:N #1 + \__coffin_update_poles:N #1 + \__coffin_update_corners:N #1 + \vbox_set_top:Nn \l__coffin_internal_box { \vbox_unpack:N #1 } + \__coffin_set_pole:Nnx #1 { T } { { 0 pt } - { \dim_eval:n { \box_ht:N #1 - \box_ht:N \l_coffin_internal_box } } + { \dim_eval:n { \box_ht:N #1 - \box_ht:N \l__coffin_internal_box } } { 1000 pt } { 0 pt } } - \box_clear:N \l_coffin_internal_box + \box_clear:N \l__coffin_internal_box } } \cs_generate_variant:Nn \vcoffin_set:Nnn { c } \cs_new_protected:Npn \hcoffin_set:Nw #1 { - \coffin_if_exist:NT #1 + \__coffin_if_exist:NT #1 { \hbox_set:Nw #1 \color_group_begin: \color_ensure_current: \cs_set_protected_nopar:Npn \hcoffin_set_end: { \color_group_end: \hbox_set_end: - \coffin_reset_structure:N #1 - \coffin_update_poles:N #1 - \coffin_update_corners:N #1 + \__coffin_reset_structure:N #1 + \__coffin_update_poles:N #1 + \__coffin_update_corners:N #1 } } } @@ -200,29 +198,31 @@ \cs_generate_variant:Nn \hcoffin_set:Nw { c } \cs_new_protected:Npn \vcoffin_set:Nnw #1#2 { - \coffin_if_exist:NT #1 + \__coffin_if_exist:NT #1 { \vbox_set:Nw #1 \dim_set:Nn \tex_hsize:D {#2} + \dim_set_eq:NN \linewidth \tex_hsize:D + \dim_set_eq:NN \columnwidth \tex_hsize:D \color_group_begin: \color_ensure_current: \cs_set_protected:Npn \vcoffin_set_end: { \color_group_end: \vbox_set_end: - \coffin_reset_structure:N #1 - \coffin_update_poles:N #1 - \coffin_update_corners:N #1 - \vbox_set_top:Nn \l_coffin_internal_box { \vbox_unpack:N #1 } - \coffin_set_pole:Nnx #1 { T } + \__coffin_reset_structure:N #1 + \__coffin_update_poles:N #1 + \__coffin_update_corners:N #1 + \vbox_set_top:Nn \l__coffin_internal_box { \vbox_unpack:N #1 } + \__coffin_set_pole:Nnx #1 { T } { { 0 pt } { - \dim_eval:n { \box_ht:N #1 - \box_ht:N \l_coffin_internal_box } + \dim_eval:n { \box_ht:N #1 - \box_ht:N \l__coffin_internal_box } } { 1000 pt } { 0 pt } } - \box_clear:N \l_coffin_internal_box + \box_clear:N \l__coffin_internal_box } } } @@ -230,145 +230,147 @@ \cs_generate_variant:Nn \vcoffin_set:Nnw { c } \cs_new_protected:Npn \coffin_set_eq:NN #1#2 { - \coffin_if_exist:NT #1 + \__coffin_if_exist:NT #1 { \box_set_eq:NN #1 #2 - \coffin_set_eq_structure:NN #1 #2 + \__coffin_set_eq_structure:NN #1 #2 } } \cs_generate_variant:Nn \coffin_set_eq:NN { c , Nc , cc } \coffin_new:N \c_empty_coffin \hbox_set:Nn \c_empty_coffin { } -\coffin_new:N \l_coffin_aligned_coffin -\coffin_new:N \l_coffin_aligned_internal_coffin +\coffin_new:N \l__coffin_aligned_coffin +\coffin_new:N \l__coffin_aligned_internal_coffin +\coffin_new:N \l_tmpa_coffin +\coffin_new:N \l_tmpb_coffin \cs_new_eq:NN \coffin_dp:N \box_dp:N \cs_new_eq:NN \coffin_dp:c \box_dp:c \cs_new_eq:NN \coffin_ht:N \box_ht:N \cs_new_eq:NN \coffin_ht:c \box_ht:c \cs_new_eq:NN \coffin_wd:N \box_wd:N \cs_new_eq:NN \coffin_wd:c \box_wd:c -\cs_new_protected:Npn \coffin_get_pole:NnN #1#2#3 +\cs_new_protected:Npn \__coffin_get_pole:NnN #1#2#3 { \prop_get:cnNF - { l_coffin_poles_ \int_value:w #1 _prop } {#2} #3 + { l__coffin_poles_ \__int_value:w #1 _prop } {#2} #3 { - \msg_kernel_error:nnxx { coffins } { unknown-coffin-pole } + \__msg_kernel_error:nnxx { kernel } { unknown-coffin-pole } {#2} { \token_to_str:N #1 } \tl_set:Nn #3 { { 0 pt } { 0 pt } { 0 pt } { 0 pt } } } } -\cs_new_protected:Npn \coffin_reset_structure:N #1 +\cs_new_protected:Npn \__coffin_reset_structure:N #1 { - \prop_set_eq:cN { l_coffin_corners_ \int_value:w #1 _prop } - \c_coffin_corners_prop - \prop_set_eq:cN { l_coffin_poles_ \int_value:w #1 _prop } - \c_coffin_poles_prop + \prop_set_eq:cN { l__coffin_corners_ \__int_value:w #1 _prop } + \c__coffin_corners_prop + \prop_set_eq:cN { l__coffin_poles_ \__int_value:w #1 _prop } + \c__coffin_poles_prop } -\cs_new_protected:Npn \coffin_set_eq_structure:NN #1#2 +\cs_new_protected:Npn \__coffin_set_eq_structure:NN #1#2 { - \prop_set_eq:cc { l_coffin_corners_ \int_value:w #1 _prop } - { l_coffin_corners_ \int_value:w #2 _prop } - \prop_set_eq:cc { l_coffin_poles_ \int_value:w #1 _prop } - { l_coffin_poles_ \int_value:w #2 _prop } + \prop_set_eq:cc { l__coffin_corners_ \__int_value:w #1 _prop } + { l__coffin_corners_ \__int_value:w #2 _prop } + \prop_set_eq:cc { l__coffin_poles_ \__int_value:w #1 _prop } + { l__coffin_poles_ \__int_value:w #2 _prop } } -\cs_new_protected:Npn \coffin_gset_eq_structure:NN #1#2 +\cs_new_protected:Npn \__coffin_gset_eq_structure:NN #1#2 { - \prop_gset_eq:cc { l_coffin_corners_ \int_value:w #1 _prop } - { l_coffin_corners_ \int_value:w #2 _prop } - \prop_gset_eq:cc { l_coffin_poles_ \int_value:w #1 _prop } - { l_coffin_poles_ \int_value:w #2 _prop } + \prop_gset_eq:cc { l__coffin_corners_ \__int_value:w #1 _prop } + { l__coffin_corners_ \__int_value:w #2 _prop } + \prop_gset_eq:cc { l__coffin_poles_ \__int_value:w #1 _prop } + { l__coffin_poles_ \__int_value:w #2 _prop } } -\cs_new_protected:Npn \coffin_set_user_dimensions:N #1 +\cs_new_protected:Npn \__coffin_set_user_dimensions:N #1 { - \cs_set_eq:NN \coffin_saved_Height: \Height - \cs_set_eq:NN \coffin_saved_Depth: \Depth - \cs_set_eq:NN \coffin_saved_TotalHeight: \TotalHeight - \cs_set_eq:NN \coffin_saved_Width: \Width - \cs_set_eq:NN \Height \l_coffin_Height_dim - \cs_set_eq:NN \Depth \l_coffin_Depth_dim - \cs_set_eq:NN \TotalHeight \l_coffin_TotalHeight_dim - \cs_set_eq:NN \Width \l_coffin_Width_dim + \cs_set_eq:NN \__coffin_saved_Height: \Height + \cs_set_eq:NN \__coffin_saved_Depth: \Depth + \cs_set_eq:NN \__coffin_saved_TotalHeight: \TotalHeight + \cs_set_eq:NN \__coffin_saved_Width: \Width + \cs_set_eq:NN \Height \l__coffin_Height_dim + \cs_set_eq:NN \Depth \l__coffin_Depth_dim + \cs_set_eq:NN \TotalHeight \l__coffin_TotalHeight_dim + \cs_set_eq:NN \Width \l__coffin_Width_dim \dim_set:Nn \Height { \box_ht:N #1 } \dim_set:Nn \Depth { \box_dp:N #1 } \dim_set:Nn \TotalHeight { \box_ht:N #1 + \box_dp:N #1 } \dim_set:Nn \Width { \box_wd:N #1 } } -\cs_new_protected_nopar:Npn \coffin_end_user_dimensions: +\cs_new_protected_nopar:Npn \__coffin_end_user_dimensions: { - \cs_set_eq:NN \Height \coffin_saved_Height: - \cs_set_eq:NN \Depth \coffin_saved_Depth: - \cs_set_eq:NN \TotalHeight \coffin_saved_TotalHeight: - \cs_set_eq:NN \Width \coffin_saved_Width: + \cs_set_eq:NN \Height \__coffin_saved_Height: + \cs_set_eq:NN \Depth \__coffin_saved_Depth: + \cs_set_eq:NN \TotalHeight \__coffin_saved_TotalHeight: + \cs_set_eq:NN \Width \__coffin_saved_Width: } \cs_new_protected:Npn \coffin_set_horizontal_pole:Nnn #1#2#3 { - \coffin_if_exist:NT #1 + \__coffin_if_exist:NT #1 { - \coffin_set_user_dimensions:N #1 - \coffin_set_pole:Nnx #1 {#2} + \__coffin_set_user_dimensions:N #1 + \__coffin_set_pole:Nnx #1 {#2} { { 0 pt } { \dim_eval:n {#3} } { 1000 pt } { 0 pt } } - \coffin_end_user_dimensions: + \__coffin_end_user_dimensions: } } \cs_new_protected:Npn \coffin_set_vertical_pole:Nnn #1#2#3 { - \coffin_if_exist:NT #1 + \__coffin_if_exist:NT #1 { - \coffin_set_user_dimensions:N #1 - \coffin_set_pole:Nnx #1 {#2} + \__coffin_set_user_dimensions:N #1 + \__coffin_set_pole:Nnx #1 {#2} { { \dim_eval:n {#3} } { 0 pt } { 0 pt } { 1000 pt } } - \coffin_end_user_dimensions: + \__coffin_end_user_dimensions: } } -\cs_new_protected:Npn \coffin_set_pole:Nnn #1#2#3 - { \prop_put:cnn { l_coffin_poles_ \int_value:w #1 _prop } {#2} {#3} } +\cs_new_protected:Npn \__coffin_set_pole:Nnn #1#2#3 + { \prop_put:cnn { l__coffin_poles_ \__int_value:w #1 _prop } {#2} {#3} } \cs_generate_variant:Nn \coffin_set_horizontal_pole:Nnn { c } \cs_generate_variant:Nn \coffin_set_vertical_pole:Nnn { c } -\cs_generate_variant:Nn \coffin_set_pole:Nnn { Nnx } -\cs_new_protected:Npn \coffin_update_corners:N #1 +\cs_generate_variant:Nn \__coffin_set_pole:Nnn { Nnx } +\cs_new_protected:Npn \__coffin_update_corners:N #1 { - \prop_put:cnx { l_coffin_corners_ \int_value:w #1 _prop } { tl } + \prop_put:cnx { l__coffin_corners_ \__int_value:w #1 _prop } { tl } { { 0 pt } { \dim_use:N \box_ht:N #1 } } - \prop_put:cnx { l_coffin_corners_ \int_value:w #1 _prop } { tr } + \prop_put:cnx { l__coffin_corners_ \__int_value:w #1 _prop } { tr } { { \dim_use:N \box_wd:N #1 } { \dim_use:N \box_ht:N #1 } } - \prop_put:cnx { l_coffin_corners_ \int_value:w #1 _prop } { bl } + \prop_put:cnx { l__coffin_corners_ \__int_value:w #1 _prop } { bl } { { 0 pt } { \dim_eval:n { - \box_dp:N #1 } } } - \prop_put:cnx { l_coffin_corners_ \int_value:w #1 _prop } { br } + \prop_put:cnx { l__coffin_corners_ \__int_value:w #1 _prop } { br } { { \dim_use:N \box_wd:N #1 } { \dim_eval:n { - \box_dp:N #1 } } } } -\cs_new_protected:Npn \coffin_update_poles:N #1 +\cs_new_protected:Npn \__coffin_update_poles:N #1 { - \prop_put:cnx { l_coffin_poles_ \int_value:w #1 _prop } { hc } + \prop_put:cnx { l__coffin_poles_ \__int_value:w #1 _prop } { hc } { { \dim_eval:n { 0.5 \box_wd:N #1 } } { 0 pt } { 0 pt } { 1000 pt } } - \prop_put:cnx { l_coffin_poles_ \int_value:w #1 _prop } { r } + \prop_put:cnx { l__coffin_poles_ \__int_value:w #1 _prop } { r } { { \dim_use:N \box_wd:N #1 } { 0 pt } { 0 pt } { 1000 pt } } - \prop_put:cnx { l_coffin_poles_ \int_value:w #1 _prop } { vc } + \prop_put:cnx { l__coffin_poles_ \__int_value:w #1 _prop } { vc } { { 0 pt } { \dim_eval:n { ( \box_ht:N #1 - \box_dp:N #1 ) / 2 } } { 1000 pt } { 0 pt } } - \prop_put:cnx { l_coffin_poles_ \int_value:w #1 _prop } { t } + \prop_put:cnx { l__coffin_poles_ \__int_value:w #1 _prop } { t } { { 0 pt } { \dim_use:N \box_ht:N #1 } { 1000 pt } { 0 pt } } - \prop_put:cnx { l_coffin_poles_ \int_value:w #1 _prop } { b } + \prop_put:cnx { l__coffin_poles_ \__int_value:w #1 _prop } { b } { { 0 pt } { \dim_eval:n { - \box_dp:N #1 } } @@ -376,710 +378,479 @@ { 0 pt } } } -\cs_new_protected:Npn \coffin_calculate_intersection:Nnn #1#2#3 +\cs_new_protected:Npn \__coffin_calculate_intersection:Nnn #1#2#3 { - \coffin_get_pole:NnN #1 {#2} \l_coffin_pole_a_tl - \coffin_get_pole:NnN #1 {#3} \l_coffin_pole_b_tl - \bool_set_false:N \l_coffin_error_bool + \__coffin_get_pole:NnN #1 {#2} \l__coffin_pole_a_tl + \__coffin_get_pole:NnN #1 {#3} \l__coffin_pole_b_tl + \bool_set_false:N \l__coffin_error_bool \exp_last_two_unbraced:Noo - \coffin_calculate_intersection:nnnnnnnn - \l_coffin_pole_a_tl \l_coffin_pole_b_tl - \bool_if:NT \l_coffin_error_bool + \__coffin_calculate_intersection:nnnnnnnn + \l__coffin_pole_a_tl \l__coffin_pole_b_tl + \bool_if:NT \l__coffin_error_bool { - \msg_kernel_error:nn { coffins } { no-pole-intersection } - \dim_zero:N \l_coffin_x_dim - \dim_zero:N \l_coffin_y_dim + \__msg_kernel_error:nn { kernel } { no-pole-intersection } + \dim_zero:N \l__coffin_x_dim + \dim_zero:N \l__coffin_y_dim } } -\cs_new_protected:Npn \coffin_calculate_intersection:nnnnnnnn +\cs_new_protected:Npn \__coffin_calculate_intersection:nnnnnnnn #1#2#3#4#5#6#7#8 { \dim_compare:nNnTF {#3} = { \c_zero_dim } { - \dim_set:Nn \l_coffin_x_dim {#1} + \dim_set:Nn \l__coffin_x_dim {#1} \dim_compare:nNnTF {#7} = \c_zero_dim - { \bool_set_true:N \l_coffin_error_bool } + { \bool_set_true:N \l__coffin_error_bool } { \dim_compare:nNnTF {#8} = \c_zero_dim - { \dim_set:Nn \l_coffin_y_dim {#6} } + { \dim_set:Nn \l__coffin_y_dim {#6} } { - \coffin_calculate_intersection_aux:nnnnnN - {#1} {#5} {#6} {#7} {#8} \l_coffin_y_dim + \__coffin_calculate_intersection_aux:nnnnnN + {#1} {#5} {#6} {#7} {#8} \l__coffin_y_dim } } } { \dim_compare:nNnTF {#4} = \c_zero_dim { - \dim_set:Nn \l_coffin_y_dim {#2} + \dim_set:Nn \l__coffin_y_dim {#2} \dim_compare:nNnTF {#8} = { \c_zero_dim } - { \bool_set_true:N \l_coffin_error_bool } + { \bool_set_true:N \l__coffin_error_bool } { \dim_compare:nNnTF {#7} = \c_zero_dim - { \dim_set:Nn \l_coffin_x_dim {#5} } + { \dim_set:Nn \l__coffin_x_dim {#5} } { - \coffin_calculate_intersection_aux:nnnnnN - {#2} {#6} {#5} {#8} {#7} \l_coffin_x_dim + \__coffin_calculate_intersection_aux:nnnnnN + {#2} {#6} {#5} {#8} {#7} \l__coffin_x_dim } } } { \dim_compare:nNnTF {#7} = \c_zero_dim { - \dim_set:Nn \l_coffin_x_dim {#5} - \coffin_calculate_intersection_aux:nnnnnN - {#5} {#1} {#2} {#3} {#4} \l_coffin_y_dim + \dim_set:Nn \l__coffin_x_dim {#5} + \__coffin_calculate_intersection_aux:nnnnnN + {#5} {#1} {#2} {#3} {#4} \l__coffin_y_dim } { \dim_compare:nNnTF {#8} = \c_zero_dim { - \dim_set:Nn \l_coffin_x_dim {#6} - \coffin_calculate_intersection_aux:nnnnnN - {#6} {#2} {#1} {#4} {#3} \l_coffin_x_dim + \dim_set:Nn \l__coffin_x_dim {#6} + \__coffin_calculate_intersection_aux:nnnnnN + {#6} {#2} {#1} {#4} {#3} \l__coffin_x_dim } - { - \fp_set_from_dim:Nn \l_coffin_calc_a_fp {#3} - \fp_set_from_dim:Nn \l_coffin_calc_b_fp {#4} - \fp_set_from_dim:Nn \l_coffin_calc_c_fp {#7} - \fp_set_from_dim:Nn \l_coffin_calc_d_fp {#8} - \fp_div:Nn \l_coffin_calc_b_fp \l_coffin_calc_a_fp - \fp_div:Nn \l_coffin_calc_d_fp \l_coffin_calc_c_fp + { + \fp_set:Nn \l__coffin_slope_x_fp + { \dim_to_fp:n {#4} / \dim_to_fp:n {#3} } + \fp_set:Nn \l__coffin_slope_y_fp + { \dim_to_fp:n {#8} / \dim_to_fp:n {#7} } \fp_compare:nNnTF - \l_coffin_calc_b_fp = \l_coffin_calc_d_fp - { \bool_set_true:N \l_coffin_error_bool } + \l__coffin_slope_x_fp = \l__coffin_slope_y_fp + { \bool_set_true:N \l__coffin_error_bool } { - \fp_set_from_dim:Nn \l_coffin_calc_result_fp {#6} - \fp_set_from_dim:Nn \l_coffin_calc_a_fp {#2} - \fp_sub:Nn \l_coffin_calc_result_fp - { \l_coffin_calc_a_fp } - \fp_set_from_dim:Nn \l_coffin_calc_a_fp {#1} - \fp_mul:Nn \l_coffin_calc_a_fp - { \l_coffin_calc_b_fp } - \fp_add:Nn \l_coffin_calc_result_fp - { \l_coffin_calc_a_fp } - \fp_set_from_dim:Nn \l_coffin_calc_a_fp {#5} - \fp_mul:Nn \l_coffin_calc_a_fp - { \l_coffin_calc_d_fp } - \fp_sub:Nn \l_coffin_calc_result_fp - { \l_coffin_calc_a_fp } - \fp_sub:Nn \l_coffin_calc_b_fp - { \l_coffin_calc_d_fp } - \fp_div:Nn \l_coffin_calc_result_fp - { \l_coffin_calc_b_fp } - \dim_set:Nn \l_coffin_x_dim - { \fp_to_dim:N \l_coffin_calc_result_fp } - \coffin_calculate_intersection_aux:nnnnnN - { \l_coffin_x_dim } - {#5} {#6} {#8} {#7} \l_coffin_y_dim + \dim_set:Nn \l__coffin_x_dim + { + \fp_to_dim:n + { + ( + \dim_to_fp:n {#1} * \l__coffin_slope_x_fp + - ( \dim_to_fp:n {#5} * \l__coffin_slope_y_fp ) + - \dim_to_fp:n {#2} + + \dim_to_fp:n {#6} + ) + / + ( \l__coffin_slope_x_fp - \l__coffin_slope_y_fp ) + } + } + \__coffin_calculate_intersection_aux:nnnnnN + { \l__coffin_x_dim } + {#5} {#6} {#8} {#7} \l__coffin_y_dim } } } } } } -\cs_new_protected:Npn \coffin_calculate_intersection_aux:nnnnnN - #1#2#3#4#5#6 +\cs_new_protected:Npn \__coffin_calculate_intersection_aux:nnnnnN #1#2#3#4#5#6 { - \fp_set_from_dim:Nn \l_coffin_calc_result_fp {#1} - \fp_set_from_dim:Nn \l_coffin_calc_a_fp {#2} - \fp_set_from_dim:Nn \l_coffin_calc_b_fp {#3} - \fp_set_from_dim:Nn \l_coffin_calc_c_fp {#4} - \fp_set_from_dim:Nn \l_coffin_calc_d_fp {#5} - \fp_sub:Nn \l_coffin_calc_result_fp { \l_coffin_calc_a_fp } - \fp_div:Nn \l_coffin_calc_result_fp { \l_coffin_calc_d_fp } - \fp_mul:Nn \l_coffin_calc_result_fp { \l_coffin_calc_c_fp } - \fp_add:Nn \l_coffin_calc_result_fp { \l_coffin_calc_b_fp } - \dim_set:Nn #6 { \fp_to_dim:N \l_coffin_calc_result_fp } + \dim_set:Nn #6 + { + \fp_to_dim:n + { + \dim_to_fp:n {#4} * + ( \dim_to_fp:n {#1} - \dim_to_fp:n {#2} ) / + \dim_to_fp:n {#5} + + \dim_to_fp:n {#3} + } + } } \cs_new_protected:Npn \coffin_join:NnnNnnnn #1#2#3#4#5#6#7#8 { - \coffin_align:NnnNnnnnN - #1 {#2} {#3} #4 {#5} {#6} {#7} {#8} \l_coffin_aligned_coffin - \hbox_set:Nn \l_coffin_aligned_coffin + \__coffin_align:NnnNnnnnN + #1 {#2} {#3} #4 {#5} {#6} {#7} {#8} \l__coffin_aligned_coffin + \hbox_set:Nn \l__coffin_aligned_coffin { - \dim_compare:nNnT { \l_coffin_offset_x_dim } < \c_zero_dim - { \tex_kern:D -\l_coffin_offset_x_dim } - \hbox_unpack:N \l_coffin_aligned_coffin - \dim_set:Nn \l_coffin_internal_dim - { \l_coffin_offset_x_dim - \box_wd:N #1 + \box_wd:N #4 } - \dim_compare:nNnT \l_coffin_internal_dim < \c_zero_dim - { \tex_kern:D -\l_coffin_internal_dim } + \dim_compare:nNnT { \l__coffin_offset_x_dim } < \c_zero_dim + { \tex_kern:D -\l__coffin_offset_x_dim } + \hbox_unpack:N \l__coffin_aligned_coffin + \dim_set:Nn \l__coffin_internal_dim + { \l__coffin_offset_x_dim - \box_wd:N #1 + \box_wd:N #4 } + \dim_compare:nNnT \l__coffin_internal_dim < \c_zero_dim + { \tex_kern:D -\l__coffin_internal_dim } } - \coffin_reset_structure:N \l_coffin_aligned_coffin + \__coffin_reset_structure:N \l__coffin_aligned_coffin \prop_clear:c - { l_coffin_corners_ \int_value:w \l_coffin_aligned_coffin _ prop } - \coffin_update_poles:N \l_coffin_aligned_coffin - \dim_compare:nNnTF \l_coffin_offset_x_dim < \c_zero_dim + { l__coffin_corners_ \__int_value:w \l__coffin_aligned_coffin _ prop } + \__coffin_update_poles:N \l__coffin_aligned_coffin + \dim_compare:nNnTF \l__coffin_offset_x_dim < \c_zero_dim { - \coffin_offset_poles:Nnn #1 { -\l_coffin_offset_x_dim } { 0 pt } - \coffin_offset_poles:Nnn #4 { 0 pt } { \l_coffin_offset_y_dim } - \coffin_offset_corners:Nnn #1 { -\l_coffin_offset_x_dim } { 0 pt } - \coffin_offset_corners:Nnn #4 { 0 pt } { \l_coffin_offset_y_dim } + \__coffin_offset_poles:Nnn #1 { -\l__coffin_offset_x_dim } { 0 pt } + \__coffin_offset_poles:Nnn #4 { 0 pt } { \l__coffin_offset_y_dim } + \__coffin_offset_corners:Nnn #1 { -\l__coffin_offset_x_dim } { 0 pt } + \__coffin_offset_corners:Nnn #4 { 0 pt } { \l__coffin_offset_y_dim } } { - \coffin_offset_poles:Nnn #1 { 0 pt } { 0 pt } - \coffin_offset_poles:Nnn #4 - { \l_coffin_offset_x_dim } { \l_coffin_offset_y_dim } - \coffin_offset_corners:Nnn #1 { 0 pt } { 0 pt } - \coffin_offset_corners:Nnn #4 - { \l_coffin_offset_x_dim } { \l_coffin_offset_y_dim } + \__coffin_offset_poles:Nnn #1 { 0 pt } { 0 pt } + \__coffin_offset_poles:Nnn #4 + { \l__coffin_offset_x_dim } { \l__coffin_offset_y_dim } + \__coffin_offset_corners:Nnn #1 { 0 pt } { 0 pt } + \__coffin_offset_corners:Nnn #4 + { \l__coffin_offset_x_dim } { \l__coffin_offset_y_dim } } - \coffin_update_vertical_poles:NNN #1 #4 \l_coffin_aligned_coffin - \coffin_set_eq:NN #1 \l_coffin_aligned_coffin + \__coffin_update_vertical_poles:NNN #1 #4 \l__coffin_aligned_coffin + \coffin_set_eq:NN #1 \l__coffin_aligned_coffin } \cs_generate_variant:Nn \coffin_join:NnnNnnnn { c , Nnnc , cnnc } \cs_new_protected:Npn \coffin_attach:NnnNnnnn #1#2#3#4#5#6#7#8 { - \coffin_align:NnnNnnnnN - #1 {#2} {#3} #4 {#5} {#6} {#7} {#8} \l_coffin_aligned_coffin - \box_set_ht:Nn \l_coffin_aligned_coffin { \box_ht:N #1 } - \box_set_dp:Nn \l_coffin_aligned_coffin { \box_dp:N #1 } - \box_set_wd:Nn \l_coffin_aligned_coffin { \box_wd:N #1 } - \coffin_reset_structure:N \l_coffin_aligned_coffin + \__coffin_align:NnnNnnnnN + #1 {#2} {#3} #4 {#5} {#6} {#7} {#8} \l__coffin_aligned_coffin + \box_set_ht:Nn \l__coffin_aligned_coffin { \box_ht:N #1 } + \box_set_dp:Nn \l__coffin_aligned_coffin { \box_dp:N #1 } + \box_set_wd:Nn \l__coffin_aligned_coffin { \box_wd:N #1 } + \__coffin_reset_structure:N \l__coffin_aligned_coffin \prop_set_eq:cc - { l_coffin_corners_ \int_value:w \l_coffin_aligned_coffin _prop } - { l_coffin_corners_ \int_value:w #1 _prop } - \coffin_update_poles:N \l_coffin_aligned_coffin - \coffin_offset_poles:Nnn #1 { 0 pt } { 0 pt } - \coffin_offset_poles:Nnn #4 - { \l_coffin_offset_x_dim } { \l_coffin_offset_y_dim } - \coffin_update_vertical_poles:NNN #1 #4 \l_coffin_aligned_coffin - \coffin_set_eq:NN #1 \l_coffin_aligned_coffin + { l__coffin_corners_ \__int_value:w \l__coffin_aligned_coffin _prop } + { l__coffin_corners_ \__int_value:w #1 _prop } + \__coffin_update_poles:N \l__coffin_aligned_coffin + \__coffin_offset_poles:Nnn #1 { 0 pt } { 0 pt } + \__coffin_offset_poles:Nnn #4 + { \l__coffin_offset_x_dim } { \l__coffin_offset_y_dim } + \__coffin_update_vertical_poles:NNN #1 #4 \l__coffin_aligned_coffin + \coffin_set_eq:NN #1 \l__coffin_aligned_coffin } \cs_new_protected:Npn \coffin_attach_mark:NnnNnnnn #1#2#3#4#5#6#7#8 { - \coffin_align:NnnNnnnnN - #1 {#2} {#3} #4 {#5} {#6} {#7} {#8} \l_coffin_aligned_coffin - \box_set_ht:Nn \l_coffin_aligned_coffin { \box_ht:N #1 } - \box_set_dp:Nn \l_coffin_aligned_coffin { \box_dp:N #1 } - \box_set_wd:Nn \l_coffin_aligned_coffin { \box_wd:N #1 } - \box_set_eq:NN #1 \l_coffin_aligned_coffin + \__coffin_align:NnnNnnnnN + #1 {#2} {#3} #4 {#5} {#6} {#7} {#8} \l__coffin_aligned_coffin + \box_set_ht:Nn \l__coffin_aligned_coffin { \box_ht:N #1 } + \box_set_dp:Nn \l__coffin_aligned_coffin { \box_dp:N #1 } + \box_set_wd:Nn \l__coffin_aligned_coffin { \box_wd:N #1 } + \box_set_eq:NN #1 \l__coffin_aligned_coffin } \cs_generate_variant:Nn \coffin_attach:NnnNnnnn { c , Nnnc , cnnc } -\cs_new_protected:Npn \coffin_align:NnnNnnnnN #1#2#3#4#5#6#7#8#9 - { - \coffin_calculate_intersection:Nnn #4 {#5} {#6} - \dim_set:Nn \l_coffin_x_prime_dim { \l_coffin_x_dim } - \dim_set:Nn \l_coffin_y_prime_dim { \l_coffin_y_dim } - \coffin_calculate_intersection:Nnn #1 {#2} {#3} - \dim_set:Nn \l_coffin_offset_x_dim - { \l_coffin_x_dim - \l_coffin_x_prime_dim + #7 } - \dim_set:Nn \l_coffin_offset_y_dim - { \l_coffin_y_dim - \l_coffin_y_prime_dim + #8 } - \hbox_set:Nn \l_coffin_aligned_internal_coffin +\cs_new_protected:Npn \__coffin_align:NnnNnnnnN #1#2#3#4#5#6#7#8#9 + { + \__coffin_calculate_intersection:Nnn #4 {#5} {#6} + \dim_set:Nn \l__coffin_x_prime_dim { \l__coffin_x_dim } + \dim_set:Nn \l__coffin_y_prime_dim { \l__coffin_y_dim } + \__coffin_calculate_intersection:Nnn #1 {#2} {#3} + \dim_set:Nn \l__coffin_offset_x_dim + { \l__coffin_x_dim - \l__coffin_x_prime_dim + #7 } + \dim_set:Nn \l__coffin_offset_y_dim + { \l__coffin_y_dim - \l__coffin_y_prime_dim + #8 } + \hbox_set:Nn \l__coffin_aligned_internal_coffin { \box_use:N #1 \tex_kern:D -\box_wd:N #1 - \tex_kern:D \l_coffin_offset_x_dim - \box_move_up:nn { \l_coffin_offset_y_dim } { \box_use:N #4 } + \tex_kern:D \l__coffin_offset_x_dim + \box_move_up:nn { \l__coffin_offset_y_dim } { \box_use:N #4 } } - \coffin_set_eq:NN #9 \l_coffin_aligned_internal_coffin + \coffin_set_eq:NN #9 \l__coffin_aligned_internal_coffin } -\cs_new_protected:Npn \coffin_offset_poles:Nnn #1#2#3 +\cs_new_protected:Npn \__coffin_offset_poles:Nnn #1#2#3 { - \prop_map_inline:cn { l_coffin_poles_ \int_value:w #1 _prop } - { \coffin_offset_pole:Nnnnnnn #1 {##1} ##2 {#2} {#3} } + \prop_map_inline:cn { l__coffin_poles_ \__int_value:w #1 _prop } + { \__coffin_offset_pole:Nnnnnnn #1 {##1} ##2 {#2} {#3} } } -\cs_new_protected:Npn \coffin_offset_pole:Nnnnnnn #1#2#3#4#5#6#7#8 +\cs_new_protected:Npn \__coffin_offset_pole:Nnnnnnn #1#2#3#4#5#6#7#8 { - \dim_set:Nn \l_coffin_x_dim { #3 + #7 } - \dim_set:Nn \l_coffin_y_dim { #4 + #8 } + \dim_set:Nn \l__coffin_x_dim { #3 + #7 } + \dim_set:Nn \l__coffin_y_dim { #4 + #8 } \tl_if_in:nnTF {#2} { - } - { \tl_set:Nn \l_coffin_internal_tl { {#2} } } - { \tl_set:Nn \l_coffin_internal_tl { { #1 - #2 } } } - \exp_last_unbraced:NNo \coffin_set_pole:Nnx \l_coffin_aligned_coffin - { \l_coffin_internal_tl } + { \tl_set:Nn \l__coffin_internal_tl { {#2} } } + { \tl_set:Nn \l__coffin_internal_tl { { #1 - #2 } } } + \exp_last_unbraced:NNo \__coffin_set_pole:Nnx \l__coffin_aligned_coffin + { \l__coffin_internal_tl } { - { \dim_use:N \l_coffin_x_dim } { \dim_use:N \l_coffin_y_dim } + { \dim_use:N \l__coffin_x_dim } { \dim_use:N \l__coffin_y_dim } {#5} {#6} } } -\cs_new_protected:Npn \coffin_offset_corners:Nnn #1#2#3 +\cs_new_protected:Npn \__coffin_offset_corners:Nnn #1#2#3 { - \prop_map_inline:cn { l_coffin_corners_ \int_value:w #1 _prop } - { \coffin_offset_corner:Nnnnn #1 {##1} ##2 {#2} {#3} } + \prop_map_inline:cn { l__coffin_corners_ \__int_value:w #1 _prop } + { \__coffin_offset_corner:Nnnnn #1 {##1} ##2 {#2} {#3} } } -\cs_new_protected:Npn \coffin_offset_corner:Nnnnn #1#2#3#4#5#6 +\cs_new_protected:Npn \__coffin_offset_corner:Nnnnn #1#2#3#4#5#6 { \prop_put:cnx - { l_coffin_corners_ \int_value:w \l_coffin_aligned_coffin _prop } + { l__coffin_corners_ \__int_value:w \l__coffin_aligned_coffin _prop } { #1 - #2 } { { \dim_eval:n { #3 + #5 } } { \dim_eval:n { #4 + #6 } } } } -\cs_new_protected:Npn \coffin_update_vertical_poles:NNN #1#2#3 +\cs_new_protected:Npn \__coffin_update_vertical_poles:NNN #1#2#3 { - \coffin_get_pole:NnN #3 { #1 -T } \l_coffin_pole_a_tl - \coffin_get_pole:NnN #3 { #2 -T } \l_coffin_pole_b_tl - \exp_last_two_unbraced:Noo \coffin_update_T:nnnnnnnnN - \l_coffin_pole_a_tl \l_coffin_pole_b_tl #3 - \coffin_get_pole:NnN #3 { #1 -B } \l_coffin_pole_a_tl - \coffin_get_pole:NnN #3 { #2 -B } \l_coffin_pole_b_tl - \exp_last_two_unbraced:Noo \coffin_update_B:nnnnnnnnN - \l_coffin_pole_a_tl \l_coffin_pole_b_tl #3 + \__coffin_get_pole:NnN #3 { #1 -T } \l__coffin_pole_a_tl + \__coffin_get_pole:NnN #3 { #2 -T } \l__coffin_pole_b_tl + \exp_last_two_unbraced:Noo \__coffin_update_T:nnnnnnnnN + \l__coffin_pole_a_tl \l__coffin_pole_b_tl #3 + \__coffin_get_pole:NnN #3 { #1 -B } \l__coffin_pole_a_tl + \__coffin_get_pole:NnN #3 { #2 -B } \l__coffin_pole_b_tl + \exp_last_two_unbraced:Noo \__coffin_update_B:nnnnnnnnN + \l__coffin_pole_a_tl \l__coffin_pole_b_tl #3 } -\cs_new_protected:Npn \coffin_update_T:nnnnnnnnN #1#2#3#4#5#6#7#8#9 +\cs_new_protected:Npn \__coffin_update_T:nnnnnnnnN #1#2#3#4#5#6#7#8#9 { \dim_compare:nNnTF {#2} < {#6} { - \coffin_set_pole:Nnx #9 { T } + \__coffin_set_pole:Nnx #9 { T } { { 0 pt } {#6} { 1000 pt } { 0 pt } } } { - \coffin_set_pole:Nnx #9 { T } + \__coffin_set_pole:Nnx #9 { T } { { 0 pt } {#2} { 1000 pt } { 0 pt } } } } -\cs_new_protected:Npn \coffin_update_B:nnnnnnnnN #1#2#3#4#5#6#7#8#9 +\cs_new_protected:Npn \__coffin_update_B:nnnnnnnnN #1#2#3#4#5#6#7#8#9 { \dim_compare:nNnTF {#2} < {#6} { - \coffin_set_pole:Nnx #9 { B } + \__coffin_set_pole:Nnx #9 { B } { { 0 pt } {#2} { 1000 pt } { 0 pt } } } { - \coffin_set_pole:Nnx #9 { B } + \__coffin_set_pole:Nnx #9 { B } { { 0 pt } {#6} { 1000 pt } { 0 pt } } } } \cs_new_protected:Npn \coffin_typeset:Nnnnn #1#2#3#4#5 { - \coffin_align:NnnNnnnnN \c_empty_coffin { H } { l } - #1 {#2} {#3} {#4} {#5} \l_coffin_aligned_coffin + \__coffin_align:NnnNnnnnN \c_empty_coffin { H } { l } + #1 {#2} {#3} {#4} {#5} \l__coffin_aligned_coffin \hbox_unpack:N \c_empty_box - \box_use:N \l_coffin_aligned_coffin + \box_use:N \l__coffin_aligned_coffin } \cs_generate_variant:Nn \coffin_typeset:Nnnnn { c } -\prop_new:N \l_coffin_bounding_prop -\dim_new:N \l_coffin_bounding_shift_dim -\dim_new:N \l_coffin_left_corner_dim -\dim_new:N \l_coffin_right_corner_dim -\dim_new:N \l_coffin_bottom_corner_dim -\dim_new:N \l_coffin_top_corner_dim -\cs_new_protected:Npn \coffin_rotate:Nn #1#2 - { - \fp_set:Nn \l_coffin_internal_fp {#2} - \fp_div:Nn \l_coffin_internal_fp { 180 } - \fp_mul:Nn \l_coffin_internal_fp { \c_pi_fp } - \fp_sin:Nn \l_coffin_sin_fp { \l_coffin_internal_fp } - \fp_cos:Nn \l_coffin_cos_fp { \l_coffin_internal_fp } - \prop_map_inline:cn { l_coffin_corners_ \int_value:w #1 _prop } - { \coffin_rotate_corner:Nnnn #1 {##1} ##2 } - \prop_map_inline:cn { l_coffin_poles_ \int_value:w #1 _prop } - { \coffin_rotate_pole:Nnnnnn #1 {##1} ##2 } - \coffin_set_bounding:N #1 - \prop_map_inline:Nn \l_coffin_bounding_prop - { \coffin_rotate_bounding:nnn {##1} ##2 } - \coffin_find_corner_maxima:N #1 - \coffin_find_bounding_shift: - \box_rotate:Nn #1 {#2} - \hbox_set:Nn #1 - { - \tex_kern:D \l_coffin_bounding_shift_dim - \tex_kern:D -\l_coffin_left_corner_dim - \box_move_down:nn { \l_coffin_bottom_corner_dim } - { \box_use:N #1 } - } - \box_set_ht:Nn #1 - { \l_coffin_top_corner_dim - \l_coffin_bottom_corner_dim } - \box_set_dp:Nn #1 { 0 pt } - \box_set_wd:Nn #1 - { \l_coffin_right_corner_dim - \l_coffin_left_corner_dim } - \prop_map_inline:cn { l_coffin_corners_ \int_value:w #1 _prop } - { \coffin_shift_corner:Nnnn #1 {##1} ##2 } - \prop_map_inline:cn { l_coffin_poles_ \int_value:w #1 _prop } - { \coffin_shift_pole:Nnnnnn #1 {##1} ##2 } - } -\cs_generate_variant:Nn \coffin_rotate:Nn { c } -\cs_new_protected:Npn \coffin_set_bounding:N #1 - { - \prop_put:Nnx \l_coffin_bounding_prop { tl } - { { 0 pt } { \dim_use:N \box_ht:N #1 } } - \prop_put:Nnx \l_coffin_bounding_prop { tr } - { { \dim_use:N \box_wd:N #1 } { \dim_use:N \box_ht:N #1 } } - \dim_set:Nn \l_coffin_internal_dim { - \box_dp:N #1 } - \prop_put:Nnx \l_coffin_bounding_prop { bl } - { { 0 pt } { \dim_use:N \l_coffin_internal_dim } } - \prop_put:Nnx \l_coffin_bounding_prop { br } - { { \dim_use:N \box_wd:N #1 } { \dim_use:N \l_coffin_internal_dim } } - } -\cs_new_protected:Npn \coffin_rotate_bounding:nnn #1#2#3 - { - \coffin_rotate_vector:nnNN {#2} {#3} \l_coffin_x_dim \l_coffin_y_dim - \prop_put:Nnx \l_coffin_bounding_prop {#1} - { { \dim_use:N \l_coffin_x_dim } { \dim_use:N \l_coffin_y_dim } } - } -\cs_new_protected:Npn \coffin_rotate_corner:Nnnn #1#2#3#4 - { - \coffin_rotate_vector:nnNN {#3} {#4} \l_coffin_x_dim \l_coffin_y_dim - \prop_put:cnx { l_coffin_corners_ \int_value:w #1 _prop } {#2} - { { \dim_use:N \l_coffin_x_dim } { \dim_use:N \l_coffin_y_dim } } - } -\cs_new_protected:Npn \coffin_rotate_pole:Nnnnnn #1#2#3#4#5#6 - { - \coffin_rotate_vector:nnNN {#3} {#4} \l_coffin_x_dim \l_coffin_y_dim - \coffin_rotate_vector:nnNN {#5} {#6} - \l_coffin_x_prime_dim \l_coffin_y_prime_dim - \coffin_set_pole:Nnx #1 {#2} - { - { \dim_use:N \l_coffin_x_dim } { \dim_use:N \l_coffin_y_dim } - { \dim_use:N \l_coffin_x_prime_dim } - { \dim_use:N \l_coffin_y_prime_dim } - } - } -\cs_new_protected:Npn \coffin_rotate_vector:nnNN #1#2#3#4 - { - \fp_set_from_dim:Nn \l_coffin_x_fp {#1} - \fp_set_from_dim:Nn \l_coffin_y_fp {#2} - \fp_set_eq:NN \l_coffin_x_prime_fp \l_coffin_x_fp - \fp_set_eq:NN \l_coffin_internal_fp \l_coffin_y_fp - \fp_mul:Nn \l_coffin_x_prime_fp { \l_coffin_cos_fp } - \fp_mul:Nn \l_coffin_internal_fp { \l_coffin_sin_fp } - \fp_sub:Nn \l_coffin_x_prime_fp { \l_coffin_internal_fp } - \fp_set_eq:NN \l_coffin_y_prime_fp \l_coffin_y_fp - \fp_set_eq:NN \l_coffin_internal_fp \l_coffin_x_fp - \fp_mul:Nn \l_coffin_y_prime_fp { \l_coffin_cos_fp } - \fp_mul:Nn \l_coffin_internal_fp { \l_coffin_sin_fp } - \fp_add:Nn \l_coffin_y_prime_fp { \l_coffin_internal_fp } - \dim_set:Nn #3 { \fp_to_dim:N \l_coffin_x_prime_fp } - \dim_set:Nn #4 { \fp_to_dim:N \l_coffin_y_prime_fp } - } -\cs_new_protected:Npn \coffin_find_corner_maxima:N #1 - { - \dim_set:Nn \l_coffin_top_corner_dim { -\c_max_dim } - \dim_set:Nn \l_coffin_right_corner_dim { -\c_max_dim } - \dim_set:Nn \l_coffin_bottom_corner_dim { \c_max_dim } - \dim_set:Nn \l_coffin_left_corner_dim { \c_max_dim } - \prop_map_inline:cn { l_coffin_corners_ \int_value:w #1 _prop } - { \coffin_find_corner_maxima_aux:nn ##2 } - } -\cs_new_protected:Npn \coffin_find_corner_maxima_aux:nn #1#2 - { - \dim_set_min:Nn \l_coffin_left_corner_dim {#1} - \dim_set_max:Nn \l_coffin_right_corner_dim {#1} - \dim_set_min:Nn \l_coffin_bottom_corner_dim {#2} - \dim_set_max:Nn \l_coffin_top_corner_dim {#2} - } -\cs_new_protected_nopar:Npn \coffin_find_bounding_shift: - { - \dim_set:Nn \l_coffin_bounding_shift_dim { \c_max_dim } - \prop_map_inline:Nn \l_coffin_bounding_prop - { \coffin_find_bounding_shift_aux:nn ##2 } - } -\cs_new_protected:Npn \coffin_find_bounding_shift_aux:nn #1#2 - { \dim_set_min:Nn \l_coffin_bounding_shift_dim {#1} } -\cs_new_protected:Npn \coffin_shift_corner:Nnnn #1#2#3#4 - { - \prop_put:cnx { l_coffin_corners_ \int_value:w #1 _ prop } {#2} - { - { \dim_eval:n { #3 - \l_coffin_left_corner_dim } } - { \dim_eval:n { #4 - \l_coffin_bottom_corner_dim } } - } - } -\cs_new_protected:Npn \coffin_shift_pole:Nnnnnn #1#2#3#4#5#6 - { - \prop_put:cnx { l_coffin_poles_ \int_value:w #1 _ prop } {#2} - { - { \dim_eval:n { #3 - \l_coffin_left_corner_dim } } - { \dim_eval:n { #4 - \l_coffin_bottom_corner_dim } } - {#5} {#6} - } - } -\fp_new:N \l_coffin_scale_x_fp -\fp_new:N \l_coffin_scale_y_fp -\dim_new:N \l_coffin_scaled_total_height_dim -\dim_new:N \l_coffin_scaled_width_dim -\cs_new_protected:Npn \coffin_resize:Nnn #1#2#3 - { - \coffin_set_user_dimensions:N #1 - \box_resize:Nnn #1 {#2} {#3} - \fp_set_from_dim:Nn \l_coffin_scale_x_fp {#2} - \fp_set_from_dim:Nn \l_coffin_internal_fp { \Width } - \fp_div:Nn \l_coffin_scale_x_fp { \l_coffin_internal_fp } - \fp_set_from_dim:Nn \l_coffin_scale_y_fp {#3} - \fp_set_from_dim:Nn \l_coffin_internal_fp { \TotalHeight } - \fp_div:Nn \l_coffin_scale_y_fp { \l_coffin_internal_fp } - \coffin_resize_common:Nnn #1 {#2} {#3} - } -\cs_generate_variant:Nn \coffin_resize:Nnn { c } -\cs_new_protected:Npn \coffin_resize_common:Nnn #1#2#3 - { - \prop_map_inline:cn { l_coffin_corners_ \int_value:w #1 _prop } - { \coffin_scale_corner:Nnnn #1 {##1} ##2 } - \prop_map_inline:cn { l_coffin_poles_ \int_value:w #1 _prop } - { \coffin_scale_pole:Nnnnnn #1 {##1} ##2 } - \fp_compare:NNNT \l_coffin_scale_x_fp < \c_zero_fp - { - \prop_map_inline:cn { l_coffin_corners_ \int_value:w #1 _prop } - { \coffin_x_shift_corner:Nnnn #1 {##1} ##2 } - \prop_map_inline:cn { l_coffin_poles_ \int_value:w #1 _prop } - { \coffin_x_shift_pole:Nnnnnn #1 {##1} ##2 } - } - \coffin_end_user_dimensions: - } -\cs_new_protected:Npn \coffin_scale:Nnn #1#2#3 - { - \box_scale:Nnn #1 {#2} {#3} - \coffin_set_user_dimensions:N #1 - \fp_set:Nn \l_coffin_scale_x_fp {#2} - \fp_set:Nn \l_coffin_scale_y_fp {#3} - \fp_compare:NNNTF \l_coffin_scale_y_fp > \c_zero_fp - { \l_coffin_scaled_total_height_dim #3 \TotalHeight } - { \l_coffin_scaled_total_height_dim -#3 \TotalHeight } - \fp_compare:NNNTF \l_coffin_scale_x_fp > \c_zero_fp - { \l_coffin_scaled_width_dim -#2 \Width } - { \l_coffin_scaled_width_dim #2 \Width } - \coffin_resize_common:Nnn #1 - { \l_coffin_scaled_width_dim } { \l_coffin_scaled_total_height_dim } - } -\cs_generate_variant:Nn \coffin_scale:Nnn { c } -\cs_new_protected:Npn \coffin_scale_vector:nnNN #1#2#3#4 - { - \fp_set_from_dim:Nn \l_coffin_internal_fp {#1} - \fp_mul:Nn \l_coffin_internal_fp { \l_coffin_scale_x_fp } - \dim_set:Nn #3 { \fp_to_dim:N \l_coffin_internal_fp } - \fp_set_from_dim:Nn \l_coffin_internal_fp {#2} - \fp_mul:Nn \l_coffin_internal_fp { \l_coffin_scale_y_fp } - \dim_set:Nn #4 { \fp_to_dim:N \l_coffin_internal_fp } - } -\cs_new_protected:Npn \coffin_scale_corner:Nnnn #1#2#3#4 - { - \coffin_scale_vector:nnNN {#3} {#4} \l_coffin_x_dim \l_coffin_y_dim - \prop_put:cnx { l_coffin_corners_ \int_value:w #1 _prop } {#2} - { { \dim_use:N \l_coffin_x_dim } { \dim_use:N \l_coffin_y_dim } } - } -\cs_new_protected:Npn \coffin_scale_pole:Nnnnnn #1#2#3#4#5#6 - { - \coffin_scale_vector:nnNN {#3} {#4} \l_coffin_x_dim \l_coffin_y_dim - \coffin_set_pole:Nnx #1 {#2} - { - { \dim_use:N \l_coffin_x_dim } { \dim_use:N \l_coffin_y_dim } - {#5} {#6} - } - } -\cs_new_protected:Npn \coffin_x_shift_corner:Nnnn #1#2#3#4 - { - \prop_put:cnx { l_coffin_corners_ \int_value:w #1 _prop } {#2} - { - { \dim_eval:n { #3 + \box_wd:N #1 } } {#4} - } - } -\cs_new_protected:Npn \coffin_x_shift_pole:Nnnnnn #1#2#3#4#5#6 - { - \prop_put:cnx { l_coffin_poles_ \int_value:w #1 _prop } {#2} - { - { \dim_eval:n #3 + \box_wd:N #1 } {#4} - {#5} {#6} - } - } -\coffin_new:N \l_coffin_display_coffin -\coffin_new:N \l_coffin_display_coord_coffin -\coffin_new:N \l_coffin_display_pole_coffin -\prop_new:N \l_coffin_display_handles_prop -\prop_put:Nnn \l_coffin_display_handles_prop { tl } +\coffin_new:N \l__coffin_display_coffin +\coffin_new:N \l__coffin_display_coord_coffin +\coffin_new:N \l__coffin_display_pole_coffin +\prop_new:N \l__coffin_display_handles_prop +\prop_put:Nnn \l__coffin_display_handles_prop { tl } { { b } { r } { -1 } { 1 } } -\prop_put:Nnn \l_coffin_display_handles_prop { thc } +\prop_put:Nnn \l__coffin_display_handles_prop { thc } { { b } { hc } { 0 } { 1 } } -\prop_put:Nnn \l_coffin_display_handles_prop { tr } +\prop_put:Nnn \l__coffin_display_handles_prop { tr } { { b } { l } { 1 } { 1 } } -\prop_put:Nnn \l_coffin_display_handles_prop { vcl } +\prop_put:Nnn \l__coffin_display_handles_prop { vcl } { { vc } { r } { -1 } { 0 } } -\prop_put:Nnn \l_coffin_display_handles_prop { vchc } +\prop_put:Nnn \l__coffin_display_handles_prop { vchc } { { vc } { hc } { 0 } { 0 } } -\prop_put:Nnn \l_coffin_display_handles_prop { vcr } +\prop_put:Nnn \l__coffin_display_handles_prop { vcr } { { vc } { l } { 1 } { 0 } } -\prop_put:Nnn \l_coffin_display_handles_prop { bl } +\prop_put:Nnn \l__coffin_display_handles_prop { bl } { { t } { r } { -1 } { -1 } } -\prop_put:Nnn \l_coffin_display_handles_prop { bhc } +\prop_put:Nnn \l__coffin_display_handles_prop { bhc } { { t } { hc } { 0 } { -1 } } -\prop_put:Nnn \l_coffin_display_handles_prop { br } +\prop_put:Nnn \l__coffin_display_handles_prop { br } { { t } { l } { 1 } { -1 } } -\prop_put:Nnn \l_coffin_display_handles_prop { Tl } +\prop_put:Nnn \l__coffin_display_handles_prop { Tl } { { t } { r } { -1 } { -1 } } -\prop_put:Nnn \l_coffin_display_handles_prop { Thc } +\prop_put:Nnn \l__coffin_display_handles_prop { Thc } { { t } { hc } { 0 } { -1 } } -\prop_put:Nnn \l_coffin_display_handles_prop { Tr } +\prop_put:Nnn \l__coffin_display_handles_prop { Tr } { { t } { l } { 1 } { -1 } } -\prop_put:Nnn \l_coffin_display_handles_prop { Hl } +\prop_put:Nnn \l__coffin_display_handles_prop { Hl } { { vc } { r } { -1 } { 1 } } -\prop_put:Nnn \l_coffin_display_handles_prop { Hhc } +\prop_put:Nnn \l__coffin_display_handles_prop { Hhc } { { vc } { hc } { 0 } { 1 } } -\prop_put:Nnn \l_coffin_display_handles_prop { Hr } +\prop_put:Nnn \l__coffin_display_handles_prop { Hr } { { vc } { l } { 1 } { 1 } } -\prop_put:Nnn \l_coffin_display_handles_prop { Bl } +\prop_put:Nnn \l__coffin_display_handles_prop { Bl } { { b } { r } { -1 } { -1 } } -\prop_put:Nnn \l_coffin_display_handles_prop { Bhc } +\prop_put:Nnn \l__coffin_display_handles_prop { Bhc } { { b } { hc } { 0 } { -1 } } -\prop_put:Nnn \l_coffin_display_handles_prop { Br } +\prop_put:Nnn \l__coffin_display_handles_prop { Br } { { b } { l } { 1 } { -1 } } -\dim_new:N \l_coffin_display_offset_dim -\dim_set:Nn \l_coffin_display_offset_dim { 2 pt } -\dim_new:N \l_coffin_display_x_dim -\dim_new:N \l_coffin_display_y_dim -\prop_new:N \l_coffin_display_poles_prop -\tl_new:N \l_coffin_display_font_tl -\tl_set:Nn \l_coffin_display_font_tl { \sffamily \tiny } +\dim_new:N \l__coffin_display_offset_dim +\dim_set:Nn \l__coffin_display_offset_dim { 2 pt } +\dim_new:N \l__coffin_display_x_dim +\dim_new:N \l__coffin_display_y_dim +\prop_new:N \l__coffin_display_poles_prop +\tl_new:N \l__coffin_display_font_tl +\tl_set:Nn \l__coffin_display_font_tl { \sffamily \tiny } \cs_new_protected:Npn \coffin_mark_handle:Nnnn #1#2#3#4 { - \hcoffin_set:Nn \l_coffin_display_pole_coffin + \hcoffin_set:Nn \l__coffin_display_pole_coffin { \color {#4} \rule { 1 pt } { 1 pt } } \coffin_attach_mark:NnnNnnnn #1 {#2} {#3} - \l_coffin_display_pole_coffin { hc } { vc } { 0 pt } { 0 pt } - \hcoffin_set:Nn \l_coffin_display_coord_coffin + \l__coffin_display_pole_coffin { hc } { vc } { 0 pt } { 0 pt } + \hcoffin_set:Nn \l__coffin_display_coord_coffin { \color {#4} - \l_coffin_display_font_tl + \l__coffin_display_font_tl ( \tl_to_str:n { #2 , #3 } ) } - \prop_get:NnN \l_coffin_display_handles_prop - { #2 #3 } \l_coffin_internal_tl - \quark_if_no_value:NTF \l_coffin_internal_tl + \prop_get:NnN \l__coffin_display_handles_prop + { #2 #3 } \l__coffin_internal_tl + \quark_if_no_value:NTF \l__coffin_internal_tl { - \prop_get:NnN \l_coffin_display_handles_prop - { #3 #2 } \l_coffin_internal_tl - \quark_if_no_value:NTF \l_coffin_internal_tl + \prop_get:NnN \l__coffin_display_handles_prop + { #3 #2 } \l__coffin_internal_tl + \quark_if_no_value:NTF \l__coffin_internal_tl { \coffin_attach_mark:NnnNnnnn #1 {#2} {#3} - \l_coffin_display_coord_coffin { l } { vc } + \l__coffin_display_coord_coffin { l } { vc } { 1 pt } { 0 pt } } { - \exp_last_unbraced:No \coffin_mark_handle_aux:nnnnNnn - \l_coffin_internal_tl #1 {#2} {#3} + \exp_last_unbraced:No \__coffin_mark_handle_aux:nnnnNnn + \l__coffin_internal_tl #1 {#2} {#3} } } { - \exp_last_unbraced:No \coffin_mark_handle_aux:nnnnNnn - \l_coffin_internal_tl #1 {#2} {#3} + \exp_last_unbraced:No \__coffin_mark_handle_aux:nnnnNnn + \l__coffin_internal_tl #1 {#2} {#3} } } -\cs_new_protected:Npn \coffin_mark_handle_aux:nnnnNnn #1#2#3#4#5#6#7 +\cs_new_protected:Npn \__coffin_mark_handle_aux:nnnnNnn #1#2#3#4#5#6#7 { \coffin_attach_mark:NnnNnnnn #5 {#6} {#7} - \l_coffin_display_coord_coffin {#1} {#2} - { #3 \l_coffin_display_offset_dim } - { #4 \l_coffin_display_offset_dim } + \l__coffin_display_coord_coffin {#1} {#2} + { #3 \l__coffin_display_offset_dim } + { #4 \l__coffin_display_offset_dim } } \cs_generate_variant:Nn \coffin_mark_handle:Nnnn { c } \cs_new_protected:Npn \coffin_display_handles:Nn #1#2 { - \hcoffin_set:Nn \l_coffin_display_pole_coffin + \hcoffin_set:Nn \l__coffin_display_pole_coffin { \color {#2} \rule { 1 pt } { 1 pt } } - \prop_set_eq:Nc \l_coffin_display_poles_prop - { l_coffin_poles_ \int_value:w #1 _prop } - \coffin_get_pole:NnN #1 { H } \l_coffin_pole_a_tl - \coffin_get_pole:NnN #1 { T } \l_coffin_pole_b_tl - \tl_if_eq:NNT \l_coffin_pole_a_tl \l_coffin_pole_b_tl - { \prop_del:Nn \l_coffin_display_poles_prop { T } } - \coffin_get_pole:NnN #1 { B } \l_coffin_pole_b_tl - \tl_if_eq:NNT \l_coffin_pole_a_tl \l_coffin_pole_b_tl - { \prop_del:Nn \l_coffin_display_poles_prop { B } } - \coffin_set_eq:NN \l_coffin_display_coffin #1 - \prop_map_inline:Nn \l_coffin_display_poles_prop + \prop_set_eq:Nc \l__coffin_display_poles_prop + { l__coffin_poles_ \__int_value:w #1 _prop } + \__coffin_get_pole:NnN #1 { H } \l__coffin_pole_a_tl + \__coffin_get_pole:NnN #1 { T } \l__coffin_pole_b_tl + \tl_if_eq:NNT \l__coffin_pole_a_tl \l__coffin_pole_b_tl + { \prop_remove:Nn \l__coffin_display_poles_prop { T } } + \__coffin_get_pole:NnN #1 { B } \l__coffin_pole_b_tl + \tl_if_eq:NNT \l__coffin_pole_a_tl \l__coffin_pole_b_tl + { \prop_remove:Nn \l__coffin_display_poles_prop { B } } + \coffin_set_eq:NN \l__coffin_display_coffin #1 + \prop_map_inline:Nn \l__coffin_display_poles_prop { - \prop_del:Nn \l_coffin_display_poles_prop {##1} - \coffin_display_handles_aux:nnnnnn {##1} ##2 {#2} + \prop_remove:Nn \l__coffin_display_poles_prop {##1} + \__coffin_display_handles_aux:nnnnnn {##1} ##2 {#2} } - \box_use:N \l_coffin_display_coffin + \box_use:N \l__coffin_display_coffin } -\cs_new_protected:Npn \coffin_display_handles_aux:nnnnnn #1#2#3#4#5#6 +\cs_new_protected:Npn \__coffin_display_handles_aux:nnnnnn #1#2#3#4#5#6 { - \prop_map_inline:Nn \l_coffin_display_poles_prop + \prop_map_inline:Nn \l__coffin_display_poles_prop { - \bool_set_false:N \l_coffin_error_bool - \coffin_calculate_intersection:nnnnnnnn {#2} {#3} {#4} {#5} ##2 - \bool_if:NF \l_coffin_error_bool + \bool_set_false:N \l__coffin_error_bool + \__coffin_calculate_intersection:nnnnnnnn {#2} {#3} {#4} {#5} ##2 + \bool_if:NF \l__coffin_error_bool { - \dim_set:Nn \l_coffin_display_x_dim { \l_coffin_x_dim } - \dim_set:Nn \l_coffin_display_y_dim { \l_coffin_y_dim } - \coffin_display_attach:Nnnnn - \l_coffin_display_pole_coffin { hc } { vc } + \dim_set:Nn \l__coffin_display_x_dim { \l__coffin_x_dim } + \dim_set:Nn \l__coffin_display_y_dim { \l__coffin_y_dim } + \__coffin_display_attach:Nnnnn + \l__coffin_display_pole_coffin { hc } { vc } { 0 pt } { 0 pt } - \hcoffin_set:Nn \l_coffin_display_coord_coffin + \hcoffin_set:Nn \l__coffin_display_coord_coffin { \color {#6} - \l_coffin_display_font_tl + \l__coffin_display_font_tl ( \tl_to_str:n { #1 , ##1 } ) } - \prop_get:NnN \l_coffin_display_handles_prop - { #1 ##1 } \l_coffin_internal_tl - \quark_if_no_value:NTF \l_coffin_internal_tl + \prop_get:NnN \l__coffin_display_handles_prop + { #1 ##1 } \l__coffin_internal_tl + \quark_if_no_value:NTF \l__coffin_internal_tl { - \prop_get:NnN \l_coffin_display_handles_prop - { ##1 #1 } \l_coffin_internal_tl - \quark_if_no_value:NTF \l_coffin_internal_tl + \prop_get:NnN \l__coffin_display_handles_prop + { ##1 #1 } \l__coffin_internal_tl + \quark_if_no_value:NTF \l__coffin_internal_tl { - \coffin_display_attach:Nnnnn - \l_coffin_display_coord_coffin { l } { vc } + \__coffin_display_attach:Nnnnn + \l__coffin_display_coord_coffin { l } { vc } { 1 pt } { 0 pt } } { \exp_last_unbraced:No - \coffin_display_handles_aux:nnnn - \l_coffin_internal_tl + \__coffin_display_handles_aux:nnnn + \l__coffin_internal_tl } } { - \exp_last_unbraced:No \coffin_display_handles_aux:nnnn - \l_coffin_internal_tl + \exp_last_unbraced:No \__coffin_display_handles_aux:nnnn + \l__coffin_internal_tl } } } } -\cs_new_protected:Npn \coffin_display_handles_aux:nnnn #1#2#3#4 +\cs_new_protected:Npn \__coffin_display_handles_aux:nnnn #1#2#3#4 { - \coffin_display_attach:Nnnnn - \l_coffin_display_coord_coffin {#1} {#2} - { #3 \l_coffin_display_offset_dim } - { #4 \l_coffin_display_offset_dim } + \__coffin_display_attach:Nnnnn + \l__coffin_display_coord_coffin {#1} {#2} + { #3 \l__coffin_display_offset_dim } + { #4 \l__coffin_display_offset_dim } } \cs_generate_variant:Nn \coffin_display_handles:Nn { c } -\cs_new_protected:Npn \coffin_display_attach:Nnnnn #1#2#3#4#5 - { - \coffin_calculate_intersection:Nnn #1 {#2} {#3} - \dim_set:Nn \l_coffin_x_prime_dim { \l_coffin_x_dim } - \dim_set:Nn \l_coffin_y_prime_dim { \l_coffin_y_dim } - \dim_set:Nn \l_coffin_offset_x_dim - { \l_coffin_display_x_dim - \l_coffin_x_prime_dim + #4 } - \dim_set:Nn \l_coffin_offset_y_dim - { \l_coffin_display_y_dim - \l_coffin_y_prime_dim + #5 } - \hbox_set:Nn \l_coffin_aligned_coffin - { - \box_use:N \l_coffin_display_coffin - \tex_kern:D -\box_wd:N \l_coffin_display_coffin - \tex_kern:D \l_coffin_offset_x_dim - \box_move_up:nn { \l_coffin_offset_y_dim } { \box_use:N #1 } - } - \box_set_ht:Nn \l_coffin_aligned_coffin - { \box_ht:N \l_coffin_display_coffin } - \box_set_dp:Nn \l_coffin_aligned_coffin - { \box_dp:N \l_coffin_display_coffin } - \box_set_wd:Nn \l_coffin_aligned_coffin - { \box_wd:N \l_coffin_display_coffin } - \box_set_eq:NN \l_coffin_display_coffin \l_coffin_aligned_coffin +\cs_new_protected:Npn \__coffin_display_attach:Nnnnn #1#2#3#4#5 + { + \__coffin_calculate_intersection:Nnn #1 {#2} {#3} + \dim_set:Nn \l__coffin_x_prime_dim { \l__coffin_x_dim } + \dim_set:Nn \l__coffin_y_prime_dim { \l__coffin_y_dim } + \dim_set:Nn \l__coffin_offset_x_dim + { \l__coffin_display_x_dim - \l__coffin_x_prime_dim + #4 } + \dim_set:Nn \l__coffin_offset_y_dim + { \l__coffin_display_y_dim - \l__coffin_y_prime_dim + #5 } + \hbox_set:Nn \l__coffin_aligned_coffin + { + \box_use:N \l__coffin_display_coffin + \tex_kern:D -\box_wd:N \l__coffin_display_coffin + \tex_kern:D \l__coffin_offset_x_dim + \box_move_up:nn { \l__coffin_offset_y_dim } { \box_use:N #1 } + } + \box_set_ht:Nn \l__coffin_aligned_coffin + { \box_ht:N \l__coffin_display_coffin } + \box_set_dp:Nn \l__coffin_aligned_coffin + { \box_dp:N \l__coffin_display_coffin } + \box_set_wd:Nn \l__coffin_aligned_coffin + { \box_wd:N \l__coffin_display_coffin } + \box_set_eq:NN \l__coffin_display_coffin \l__coffin_aligned_coffin } \cs_new_protected:Npn \coffin_show_structure:N #1 { - \coffin_if_exist:NT #1 + \__coffin_if_exist:NT #1 { - \msg_aux_show:Nnx #1 { coffins } + \__msg_show_variable:Nnn #1 { coffins } { \prop_map_function:cN - { l_coffin_poles_ \int_value:w #1 _prop } - \msg_aux_show_unbraced:nn + { l__coffin_poles_ \__int_value:w #1 _prop } + \__msg_show_item_unbraced:nn } } } \cs_generate_variant:Nn \coffin_show_structure:N { c } -\msg_kernel_new:nnnn { coffins } { no-pole-intersection } +\__msg_kernel_new:nnnn { kernel } { no-pole-intersection } { No~intersection~between~coffin~poles. } { \c_msg_coding_error_text_tl @@ -1087,17 +858,17 @@ but~they~do~not~have~a~unique~meeting~point:~ the~value~(0~pt,~0~pt)~will~be~used. } -\msg_kernel_new:nnnn { coffins } { unknown-coffin } +\__msg_kernel_new:nnnn { kernel } { unknown-coffin } { Unknown~coffin~'#1'. } { The~coffin~'#1'~was~never~defined. } -\msg_kernel_new:nnnn { coffins } { unknown-coffin-pole } +\__msg_kernel_new:nnnn { kernel } { unknown-coffin-pole } { Pole~'#1'~unknown~for~coffin~'#2'. } { \c_msg_coding_error_text_tl LaTeX~was~asked~to~find~a~typesetting~pole~for~a~coffin,~ but~either~the~coffin~does~not~exist~or~the~pole~name~is~wrong. } -\msg_kernel_new:nnn { coffins } { show } +\__msg_kernel_new:nnn { kernel } { show-coffins } { Size~of~coffin~\token_to_str:N #1 : \\ > ~ ht~=~\dim_use:N \box_ht:N #1 \\ diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3color.sty b/Master/texmf-dist/tex/latex/l3kernel/l3color.sty index 989061981f4..5ea45852215 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3color.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3color.sty @@ -13,7 +13,7 @@ %% %% Do not distribute a modified version of this file. %% -%% File: l3color.dtx Copyright(C) 2011 The LaTeX3 Project +%% File: l3color.dtx Copyright(C) 2011,2012 The 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 @@ -47,18 +47,30 @@ %% ----------------------------------------------------------------------- %% \RequirePackage{l3names} -\GetIdInfo$Id: l3color.dtx 2776 2011-09-07 18:33:19Z joseph $ +\GetIdInfo$Id: l3color.dtx 3986 2012-07-15 19:23:51Z joseph $ {L3 Experimental colour support} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\package_check_loaded_expl: +\__expl_package_check: \cs_new_eq:NN \color_group_begin: \group_begin: \cs_new_protected_nopar:Npn \color_group_end: { \tex_par:D \group_end: } -\cs_new_protected_nopar:Npn \color_ensure_current: { \set@color } +\cs_new_protected_nopar:Npn \color_ensure_current: { } +\AtBeginDocument + { + \cs_if_exist:NTF \__driver_color_ensure_current: + { + \cs_set_protected_nopar:Npn \color_ensure_current: + { \__driver_color_ensure_current: } + } + { + \cs_if_exist:NT \set@color + { \cs_set_protected_nopar:Npn \color_ensure_current: { \set@color } } + } + } %% %% %% End of file `l3color.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls b/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls index b79ca0bb135..c1adee8c71f 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls +++ b/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls @@ -4,7 +4,7 @@ %% %% The original source files were: %% -%% l3doc.dtx (with options: `class') +%% l3doc.dtx (with options: `class,cfg') %% %% %% EXPERIMENTAL CODE @@ -15,7 +15,7 @@ %% Do not distribute a modified version of this file. %% %% -%% File: l3doc.dtx Copyright (C) 1990-2011 The LaTeX3 project +%% File: l3doc.dtx Copyright (C) 1990-2012 The 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 @@ -47,12 +47,12 @@ %% prior consultation with the LaTeX3 Project. %% %% ----------------------------------------------------------------------- -\RequirePackage{expl3,xparse,calc} \let \filenameOld \ExplFileName \let \filedateOld \ExplFileDate \let \fileversionOld \ExplFileVersion \let \filedescriptionOld \ExplFileDescription -\GetIdInfo$Id: l3doc.dtx 3491 2012-03-04 06:13:18Z bruno $ +\RequirePackage{expl3,xparse,calc} +\GetIdInfo$Id: l3doc.dtx 3989 2012-07-16 01:15:43Z bruno $ {L3 Experimental documentation class} \ProvidesExplClass {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -60,12 +60,6 @@ \let \ExplFileDate \filedateOld \let \ExplFileVersion \fileversionOld \let \ExplFileDescription \filedescriptionOld -\cs_new_nopar:Npn\Team{% - The~\LaTeX3~Project\thanks{% - Frank~Mittelbach,~Denys~Duchier,~Chris~Rowley,~ - Rainer~Sch\"opf,~Johannes~Braams,~Michael~Downes,~ - David~Carlisle,~Alan~Jeffrey,~Morten~H\o{}gholm,~Thomas~Lotze,~ - Javier~Bezos,~Will~Robertson,~Joseph~Wright,~Bruno~Le~Floch}} \coffin_new:N \l_doc_output_box \coffin_new:N \l_doc_names_coffin \coffin_new:N \l_doc_descr_coffin @@ -95,12 +89,17 @@ \bool_new:N \g_doc_lmodern_bool \bool_new:N \g_doc_checkfunc_bool \bool_new:N \g_doc_checktest_bool +\seq_new:N \g_doc_tmpa_seq +\tl_new:N \l_doc_tmpa_tl +\tl_new:N \l_doc_tmpb_tl +\int_new:N \l_doc_tmpa_int +\bool_new:N \l_doc_tested_bool \cs_set_protected_nopar:Npn \coffin_gset_eq:NN #1#2 { \coffin_if_exist:NT #1 { \box_gset_eq:NN #1 #2 - \coffin_gset_eq_structure:NN #1 #2 + \__coffin_gset_eq_structure:NN #1 #2 } } \cs_generate_variant:Nn \coffin_gset_eq:NN { c , Nc , cc } @@ -115,13 +114,15 @@ \DeclareOption{lm-default}{ \bool_set_true:N \g_doc_lmodern_bool } \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} \ExecuteOptions{full,a4paper,nocheck,nochecktest,lm-default} -\InputIfFileExists{l3doc.cfg} +\msg_new:nnn {l3doc} {input-cfg} { - \typeout{*************************************^^J - *~Local~config~file~l3doc.cfg~used ^^J - *************************************} + Local~config~file~l3doc.cfg~loaded. + } +\file_if_exist:nT {l3doc.cfg} + { + \file_input:n {l3doc.cfg} + \msg_info:nn {l3doc} {input-cfg} } - { \@input{l3doc.ltx} } \ProcessOptions \LoadClass{article} \RequirePackage{doc} @@ -129,6 +130,7 @@ { array, alphalph, + amsmath, booktabs, color, colortbl, @@ -182,9 +184,9 @@ } \setcounter{StandardModuleDepth}{1} \@addtoreset{CodelineNo}{part} -\cs_set_nopar:Npn \theCodelineNo { - \textcolor[gray]{0.5}{ \sffamily\tiny\arabic{CodelineNo} } -} +\tl_replace_once:Nnn \theCodelineNo + { \HDorg@theCodelineNo } + { \textcolor[gray]{0.5} { \sffamily\tiny\arabic{CodelineNo} } } \setlength \textwidth { 385pt } \addtolength \marginparwidth { 30pt } \addtolength \oddsidemargin { 20pt } @@ -226,9 +228,18 @@ \cs_new_protected_nopar:Npn \XeTeX {X\kern-.125em\lower.5ex\hbox{\reflectbox{E}}\kern-.1667em\TeX} } -\cs_set_nopar:Npn \cmd #1 { \cs{\expandafter\cmd@to@cs\string#1} } -\cs_set_nopar:Npn \cmd@to@cs #1#2 { \char\number`#2\relax } -\DeclareRobustCommand \cs [1] { \texttt { \char`\\ #1 } } +\cs_set_nopar:Npn \cmd #1 { \cs{\expandafter \doc_cmd_to_cs:w \string#1} } +\cs_set_nopar:Npn \doc_cmd_to_cs:w #1#2 { \char\number`#2\relax } +\DeclareRobustCommand \cs [1] + { + \tl_set_rescan:Nnn \l_doc_tmpb_tl { } { _ } + \tl_set:Nn \l_doc_tmpa_tl {#1} + \tl_replace_all:NVn \l_doc_tmpa_tl \l_doc_tmpb_tl { _ } + \doc_replace_at_at:N \l_doc_tmpa_tl + \tl_replace_all:NnV \l_doc_tmpa_tl { _ } \l_doc_tmpb_tl + \texttt { \char`\\ \tl_use:N \l_doc_tmpa_tl} + } +\cs_generate_variant:Nn \tl_replace_all:Nnn { NV , NnV } \providecommand\marg[1]{ \texttt{\char`\{} \meta{#1} \texttt{\char`\}} } \providecommand\oarg[1]{ \texttt[ \meta{#1} \texttt] } \providecommand\parg[1]{ \texttt( \meta{#1} \texttt) } @@ -249,7 +260,7 @@ \string\TeX{}~and~\string\LaTeXe{}~commands:\levelchar #1\actualchar{\string\ttfamily\string\bslash{}#1}}} \cs_new:Npn \doc_implementation: { - \cs_set:Npn \variable {\macro[var]} + \DeclareDocumentCommand {\variable} { O{} } { \doc_macro:n { var , ##1 } } \cs_set_eq:NN \endvariable \endmacro } \cs_new:Npn \doc_docu: { @@ -333,8 +344,9 @@ \char_set_catcode_ignore:N \ % space \char_set_catcode_ignore:N \^^M \char_set_catcode_ignore:N \^^I - - \function_aux:n + \exp_after:wN + \group_end: + \function_aux:n } { \vcoffin_set_end: @@ -381,8 +393,6 @@ \cs_set_eq:NN \endvariabledoc \endfunction \cs_set_nopar:Npn \function_aux:n #1 { - \group_end: - \tl_set:Nn \l_doc_function_input_tl {#1} \dim_zero:N \l_doc_trial_width_dim @@ -428,22 +438,22 @@ % finally, for regular old csnames: \exp_args:NNf \prop_get:NnNTF \l_doc_functions_block_prop - { \cs_get_function_name:N #1 } \l_doc_tmp_tl + { \__cs_get_function_name:N #1 } \l_doc_tmpb_tl { \prop_put:Nxx \l_doc_functions_block_prop -{ \cs_get_function_name:N #1 } +{ \__cs_get_function_name:N #1 } { - \l_doc_tmp_tl , - {\cs_get_arg_count_from_signature:N #1} - {\cs_get_function_signature:N #1} + \l_doc_tmpb_tl , + {\__cs_count_signature:N #1} + {\__cs_get_function_signature:N #1} } } { \prop_put:Nxx \l_doc_functions_block_prop -{ \cs_get_function_name:N #1 } +{ \__cs_get_function_name:N #1 } { - {\cs_get_arg_count_from_signature:N #1} - {\cs_get_function_signature:N #1} + {\__cs_count_signature:N #1} + {\__cs_get_function_signature:N #1} } } } @@ -452,20 +462,20 @@ { % for now don't bother splitting into variants: \tl_gclear:N \l_doc_function_name_prefix_tl -\prop_put:Nxx \l_doc_functions_block_prop { #1 } { {-1} {} } +\prop_put:Nxx \l_doc_functions_block_prop { \tl_to_str:n {#1} } { {-1} {} } } } \cs_new:Nn \doc_typeset_functions:nn { \clist_gset:Nn \l_doc_variants_clist {#2} - \clist_gpop:NN \l_doc_variants_clist \l_doc_tmp_tl + \clist_gpop:NN \l_doc_variants_clist \l_doc_tmpb_tl \exp_args:Nc \doc_typeset_functions_aux:N { #1 - \int_compare:nT { \exp_after:wN \use_i:nn \l_doc_tmp_tl > -1 } {:} - \int_compare:nT { \exp_after:wN \use_i:nn \l_doc_tmp_tl > 0 } - { \exp_after:wN \use_ii:nn \l_doc_tmp_tl } + \int_compare:nT { \exp_after:wN \use_i:nn \l_doc_tmpb_tl > -1 } {:} + \int_compare:nT { \exp_after:wN \use_i:nn \l_doc_tmpb_tl > 0 } + { \exp_after:wN \use_ii:nn \l_doc_tmpb_tl } } \\ } @@ -473,18 +483,22 @@ \cs_new_nopar:Nn \doc_typeset_functions_aux:N { \bool_if:NT \l_doc_meta_pTF_bool { + \tl_set:Nx \l_doc_pTF_name_tl + { \l_doc_function_name_prefix_tl \doc_predicate_from_base:N #1 } + \doc_special_main_index:o { \l_doc_pTF_name_tl } + \seq_gput_right:Nx \g_doc_functions_seq + { \tl_to_str:N \l_doc_pTF_name_tl } \tl_set:Nx \l_doc_pTF_name_tl { \doc_predicate_from_base:N #1 } - \doc_special_main_index:o { \tl_to_str:N \l_doc_pTF_name_tl } - \seq_gput_right:Nx \g_doc_functions_seq { \l_doc_function_name_prefix_tl \l_doc_pTF_name_tl } } - \bool_if:NTF \l_doc_meta_TF_bool { - \doc_special_main_index:o { \token_to_str:N #1 TF } - \seq_gput_right:Nx \g_doc_functions_seq { \token_to_str:N #1 TF } - }{ - \doc_special_main_index:o { \token_to_str:N #1 } - \seq_gput_right:Nx \g_doc_functions_seq { \tl_to_str:n {#1} } - } + \tl_set:Nx \l_doc_tmpa_tl + { + \l_doc_function_name_prefix_tl + \cs_to_str:N #1 + \bool_if:NT \l_doc_meta_TF_bool { \tl_to_str:n {TF} } + } + \doc_special_main_index:o { \l_doc_tmpa_tl } + \seq_gput_right:No \g_doc_functions_seq { \l_doc_tmpa_tl } \bool_if:NTF \l_doc_meta_pTF_bool { @@ -502,24 +516,19 @@ } } \cs_set_nopar:Nn \doc_typeset_function_block:N { - \tl_gset:Nx \l_doc_function_name_tl { \cs_get_function_name:N #1 } - \tl_gset:Nx \l_doc_function_sig_tl { \cs_get_function_signature:N #1 } + \tl_gset:Nx \l_doc_function_name_tl { \__cs_get_function_name:N #1 } + \tl_gset:Nx \l_doc_function_sig_tl { \__cs_get_function_signature:N #1 } \tl_gset:Nx \g_doc_macro_tl { \l_doc_function_name_prefix_tl \l_doc_function_name_tl } \doc_typeset_function_basename:N #1 \bool_if:NT \l_doc_meta_TF_bool { \doc_typeset_TF: } \doc_typeset_expandability: \clist_if_empty:NF \l_doc_variants_clist { \doc_typeset_variants: } - \bool_if:NT \g_doc_full_bool { \doc_label_function: } + \bool_if:NT \g_doc_full_bool { \doc_label_function:N #1 } } \cs_set:Nn \doc_typeset_function_basename:N - { - \g_doc_macro_tl - \int_compare:nT { \cs_get_arg_count_from_signature:N #1 > -1 } { : } - \int_compare:nT { \cs_get_arg_count_from_signature:N #1 > 0 } - { \l_doc_function_sig_tl } - } + { \l_doc_function_name_prefix_tl \cs_to_str:N #1 } \cs_set:Nn \doc_typeset_expandability: { & @@ -536,12 +545,12 @@ { \\ \doc_typeset_aux:n \g_doc_macro_tl : - \int_compare:nTF { \clist_length:N \l_doc_variants_clist == 1 } + \int_compare:nTF { \clist_count:N \l_doc_variants_clist == 1 } { \exp_after:wN \use_ii:nn \l_doc_variants_clist } { \textrm( - \clist_pop:NN \l_doc_variants_clist \l_doc_tmp_tl - \exp_after:wN \use_ii:nn \l_doc_tmp_tl + \clist_pop:NN \l_doc_variants_clist \l_doc_tmpb_tl + \exp_after:wN \use_ii:nn \l_doc_tmpb_tl \clist_map_inline:Nn \l_doc_variants_clist {\textrm| \use_ii:nn ##1} \textrm) } @@ -556,15 +565,12 @@ \hyperlink{rexpstar} {\ding{73}} % hollow star } } -\cs_set:Nn \doc_label_function: +\cs_set:Nn \doc_label_function:N { - \exp_args:NNf \tl_replace_all:Nnn \g_doc_macro_tl {\token_to_str:N _} {/} - \exp_args:NNf \tl_replace_all:Nnn \g_doc_macro_tl {\@backslashchar} {} - \exp_args:Nx \label - { - doc/function//\g_doc_macro_tl - \tl_if_empty:NF \l_doc_function_sig_tl { : \l_doc_function_sig_tl } - } + \tl_set:Nx \l_doc_tmpa_tl { \l_doc_function_name_prefix_tl \cs_to_str:N #1 } + \exp_args:NNf \tl_replace_all:Nnn \l_doc_tmpa_tl {\token_to_str:N _} {/} + \exp_args:NNf \tl_remove_all:Nn \l_doc_tmpa_tl {\@backslashchar} + \exp_args:Nx \label {doc/function//\l_doc_tmpa_tl} } \cs_set_nopar:Nn \doc_show_macro_unusual:N { \tl_gset:Nx \g_doc_macro_tl { \token_to_str:N #1} @@ -665,8 +671,11 @@ { \bool_set_true:N \l_doc_macro_TF_bool } , pTF .code:n = { \bool_set_true:N \l_doc_macro_pTF_bool } , + tested .code:n = + { } , } -\renewcommand \macro [1][] { +\RenewDocumentCommand { \macro } { O{} } { \doc_macro:n {#1} } +\cs_new_protected:Npn \doc_macro:n #1 { \int_compare:nNnTF \currentgrouplevel=2 { \int_gzero:N \g_doc_nested_macro_int } @@ -727,15 +736,18 @@ } \cs_set:Nn \doc_predicate_from_base:N { - \cs_get_function_name:N #1 _p: \cs_get_function_signature:N #1 + \__cs_get_function_name:N #1 _p: \__cs_get_function_signature:N #1 } \cs_set:Npn \doc_predicate_from_base:w #1 : #2 \q_nil { #1 _p: #2 } +\tl_new:N \l_doc_at_replaced_macro_tl \cs_set_nopar:Npn \doc_macro_single:n #1 { \int_incr:N \l_doc_macro_int - \tl_set:Nx \saved@macroname { \token_to_str:N #1 } + \tl_set:Nx \l_doc_at_replaced_macro_tl { \token_to_str:N #1 } + \doc_replace_at_at:N \l_doc_at_replaced_macro_tl + \tl_set_eq:NN \saved@macroname \l_doc_at_replaced_macro_tl \topsep\MacroTopsep \trivlist \cs_set_nopar:Npn \makelabel ##1 { \llap{##1} } @@ -762,33 +774,33 @@ } \bool_if:NF \l_doc_macro_aux_bool { - \tl_gset:Nx \l_doc_macro_tl { \tl_to_str:n {#1} } + \tl_gset:Nx \l_doc_macro_tl { \tl_to_str:N \l_doc_at_replaced_macro_tl } \exp_args:NNf \tl_greplace_all:Nnn \l_doc_macro_tl {\token_to_str:N _} {/} \exp_args:NNf \tl_greplace_all:Nnn \l_doc_macro_tl {\@backslashchar} {} } \use:x { \exp_not:N \item [ \exp_not:N \doc_print_macroname:n { - \tl_to_str:n {#1} + \tl_to_str:N \l_doc_at_replaced_macro_tl }] } \global\advance \c@CodelineNo \@ne \bool_if:NF \l_doc_macro_aux_bool { \bool_if:NTF \l_doc_macro_TF_bool { - \seq_gput_right:Nx \g_doc_macros_seq { \tl_to_str:n { #1 TF } } - \seq_gput_right:Nx \g_doc_macros_seq { \tl_to_str:n { #1 T } } - \seq_gput_right:Nx \g_doc_macros_seq { \tl_to_str:n { #1 F } } + \seq_gput_right:Nx \g_doc_macros_seq { \tl_to_str:N \l_doc_at_replaced_macro_tl \tl_to_str:n {TF} } + \seq_gput_right:Nx \g_doc_macros_seq { \tl_to_str:N \l_doc_at_replaced_macro_tl \tl_to_str:n {T } } + \seq_gput_right:Nx \g_doc_macros_seq { \tl_to_str:N \l_doc_at_replaced_macro_tl \tl_to_str:n { F} } }{ - \seq_gput_right:Nx \g_doc_macros_seq { \tl_to_str:n {#1} } + \seq_gput_right:Nx \g_doc_macros_seq { \tl_to_str:N \l_doc_at_replaced_macro_tl } } } \bool_if:NTF \l_doc_macro_TF_bool { - \SpecialMainIndex{#1 TF}\nobreak - \DoNotIndex{#1 TF} + \exp_args:Nx \SpecialMainIndex{ \tl_to_str:N \l_doc_at_replaced_macro_tl TF}\nobreak + \exp_args:Nx \DoNotIndex{ \tl_to_str:N \l_doc_at_replaced_macro_tl TF} }{ - \SpecialMainIndex{#1}\nobreak - \DoNotIndex{#1} + \exp_args:Nx \SpecialMainIndex{ \tl_to_str:N \l_doc_at_replaced_macro_tl }\nobreak + \exp_args:Nx \DoNotIndex{ \tl_to_str:N \l_doc_at_replaced_macro_tl } } \global\advance \c@CodelineNo \m@ne @@ -797,7 +809,8 @@ \tl_clear:N \l_doc_macro_tl \cs_set_nopar:Npn \doc_print_macroname:n #1 { \strut - \int_compare:nTF { \tl_length:n {#1} <= 28 } + \HD@target + \int_compare:nTF { \tl_count:n {#1} <= 28 } { \MacroFont } { \MacroLongFont } % INEFFICIENT: (!) @@ -853,19 +866,42 @@ \DeclareDocumentCommand \TestMissing {m} { \prop_if_in:NVTF \g_doc_missing_tests_prop \l_doc_macro_input_clist { - \prop_get:NVN \g_doc_missing_tests_prop \l_doc_macro_input_clist \l_tmpa_tl + \prop_get:NVN \g_doc_missing_tests_prop \l_doc_macro_input_clist \l_doc_tmpa_tl \prop_gput:NVx \g_doc_missing_tests_prop \l_doc_macro_input_clist { - *~ \l_tmpa_tl + *~ \l_doc_tmpa_tl ^^J \exp_not:n {\space\space\space\space\space\space} *~ #1 } } { \prop_gput:NVn \g_doc_missing_tests_prop \l_doc_macro_input_clist {#1} } } -\cs_set:Nn \doc_macro_wrap:n +\tl_new:N \g_doc_module_name_tl +\cs_new_protected:Npn \doc_replace_at_at:N #1 { + \tl_if_empty:NF \g_doc_module_name_tl + { + \tl_replace_all:Non #1 { \token_to_str:N @ } { @ } + \tl_replace_all:Non #1 { \token_to_str:N _ } { _ } + \tl_replace_all:Nox #1 { _@@ } { __ \g_doc_module_name_tl } + \tl_replace_all:Nox #1 { @@ } { __ \g_doc_module_name_tl } + } +} +\cs_generate_variant:Nn \tl_replace_all:Nnn { Non, Nox } +\cs_new_protected:Nn \doc_endmacro_build_seq:N + { + \seq_gclear:N #1 + \clist_map_inline:Nn \l_doc_macro_input_clist + { + \tl_set:Nn \l_doc_tmpa_tl {##1} + \doc_replace_at_at:N \l_doc_tmpa_tl + \seq_gput_right:No #1 { \l_doc_tmpa_tl } + } + } +\cs_set_protected:Nn \doc_endmacro_wrap_each:N { - #1 \bool_if:NT \l_doc_macro_TF_bool {TF} + \bool_if:NTF \l_doc_macro_TF_bool + { \seq_gset_map:NNn #1 #1 { \exp_not:N \texttt { ##1 TF } } } + { \seq_gset_map:NNn #1 #1 { \exp_not:N \texttt { ##1 } } } } \cs_set:Nn \doc_texttt_comma:n {\,,~\texttt{#1}} \cs_set:Npn \endmacro { @@ -873,29 +909,14 @@ { \par\nobreak\noindent{\footnotesize(\emph{ End~ definition~ for~ - \prg_case_int:nnn { \clist_length:N \l_doc_macro_input_clist } - { - {1} { \texttt{ \doc_macro_wrap:n { \clist_use:N \l_doc_macro_input_clist } }. } - {2} + \doc_endmacro_build_seq:N \g_doc_tmpa_seq + \doc_endmacro_wrap_each:N \g_doc_tmpa_seq + \int_compare:nTF { \seq_count:N \g_doc_tmpa_seq <= 3 } { - \tl_set:Nx \l_clist_first_tl { \clist_item:Nn \l_doc_macro_input_clist {0} } - \tl_set:Nx \l_clist_last_tl { \clist_item:Nn \l_doc_macro_input_clist {1} } - \texttt{\doc_macro_wrap:n\l_clist_first_tl}\,~ and~ \texttt{\doc_macro_wrap:n\l_clist_last_tl}\,. + \seq_use:Nnnn \g_doc_tmpa_seq + { \,~and~ } { \,,~ } { \,,~and~ } } - {3} - { - \tl_set:Nx \l_clist_first_tl { \clist_item:Nn \l_doc_macro_input_clist {0} } - \tl_set:Nx \l_clist_mid_tl { \clist_item:Nn \l_doc_macro_input_clist {1} } - \tl_set:Nx \l_clist_last_tl { \clist_item:Nn \l_doc_macro_input_clist {2} } - \texttt{\doc_macro_wrap:n\l_clist_first_tl}\,,~ - \texttt{\doc_macro_wrap:n\l_clist_mid_tl}\,,~ - and~ \texttt{\doc_macro_wrap:n\l_clist_last_tl}\,. - } - } - { - \tl_set:Nx \l_clist_first_tl { \clist_item:Nn \l_doc_macro_input_clist {0} } - \texttt{\doc_macro_wrap:n\l_clist_first_tl}\,~and~others. - } + { \seq_item:Nn \g_doc_tmpa_seq {1}\,~and~others. } \bool_if:nT { !\l_doc_macro_aux_bool && !\l_doc_macro_internal_bool && @@ -918,12 +939,59 @@ { \seq_gput_right:Nx \g_doc_not_tested_seq { - \l_doc_macro_input_clist + \seq_use:Nnnn \g_doc_tmpa_seq { , } { , } { , } \bool_if:NT \l_doc_macro_pTF_bool {~(pTF)} \bool_if:NT \l_doc_macro_TF_bool {~(TF)} } } } +\group_begin: + \char_set_catcode_escape:N \/ + \char_set_catcode_other:N \^^A + \char_set_catcode_active:N \^^S + \char_set_catcode_active:N \^^B + \char_set_catcode_other:N \^^L + \char_set_catcode_other:N \^^R + \char_set_lccode:nn { `\^^A } { `\% } + \char_set_lccode:nn { `\^^S } { `\ } + \char_set_lccode:nn { `\^^B } { `\\ } + \char_set_lccode:nn { `\^^L } { `\{ } + \char_set_lccode:nn { `\^^R } { `\} } + \tl_to_lowercase:n + { + \group_end: + \cs_set_protected:Npn \xmacro@code + #1 ^^A ^^S^^S^^S^^S ^^Bend ^^Lmacrocode^^R + { \doc_xmacro_code:n {#1} /end{macrocode} } + } +\group_begin: + \char_set_catcode_active:N \< + \char_set_catcode_active:N \> + \cs_new_protected:Npn \doc_xmacro_code:n #1 + { + \tl_if_in:nnTF {#1} { < @ @ = } + { \doc_xmacro_code:w #1 \q_stop } + { + \tl_set:Nn \l_doc_tmpa_tl {#1} + \doc_replace_at_at:N \l_doc_tmpa_tl + \tl_use:N \l_doc_tmpa_tl + } + } + \cs_new_protected:Npn \doc_xmacro_code:w #1 < @ @ = #2 > #3 \q_stop + { + \tl_set:Nn \l_doc_tmpa_tl {#1} + \doc_replace_at_at:N \l_doc_tmpa_tl + + \tl_gset:Nn \g_doc_module_name_tl {#2} + \tl_put_right:Nn \l_doc_tmpa_tl { < @ @ = #2 > } + + \tl_set:Nn \l_doc_tmpb_tl {#3} + \doc_replace_at_at:N \l_doc_tmpb_tl + \tl_put_right:No \l_doc_tmpa_tl { \l_doc_tmpb_tl } + + \tl_use:N \l_doc_tmpa_tl + } +\group_end: \newcommand*{\DescribeOption}{ \leavevmode \@bsphack @@ -1138,48 +1206,52 @@ } \cs_set_eq:NN \@evenfoot \@oddfoot } -\iow_open:Nn \g_write_func_stream { \jobname.cmds } +\iow_new:N \g_doc_func_iow \cs_new_nopar:Npn \doc_show_functions_defined: { \bool_if:nT { \g_doc_implementation_bool && \g_doc_checkfunc_bool } { \typeout{ ======================================== ^^J } + \iow_open:Nn \g_doc_func_iow { \c_job_name_tl .cmds } - \tl_clear:N \l_tmpa_tl + \tl_clear:N \l_doc_tmpa_tl \seq_map_inline:Nn \g_doc_functions_seq { \seq_if_in:NnT \g_doc_macros_seq {##1} { - \tl_put_right:Nn \l_tmpa_tl { ##1 ^^J } - \iow_now:Nn \g_write_func_stream { ##1 } + \tl_put_right:Nn \l_doc_tmpa_tl { ##1 ^^J } + \iow_now:Nn \g_doc_func_iow { > ~ ##1 } } } - \iow_close:N \g_write_func_stream + \doc_functions_typeout:n { Functions~both~documented~and~defined:^^J (In~order~of~being~documented) } \seq_map_inline:Nn \g_doc_functions_seq { \seq_if_in:NnF \g_doc_macros_seq {##1} { - \tl_put_right:Nn \l_tmpa_tl { ##1 ^^J } + \tl_put_right:Nn \l_doc_tmpa_tl { ##1 ^^J } + \iow_now:Nn \g_doc_func_iow { ! ~ ##1} } } \doc_functions_typeout:n { Functions~documented~but~not~defined: } \seq_map_inline:Nn \g_doc_macros_seq { \seq_if_in:NnF \g_doc_functions_seq {##1} { - \tl_put_right:Nn \l_tmpa_tl { ##1 ^^J } + \tl_put_right:Nn \l_doc_tmpa_tl { ##1 ^^J } + \iow_now:Nn \g_doc_func_iow { ? ~ ##1} } } \doc_functions_typeout:n { Functions~defined~but~not~documented: } + \iow_close:N \g_doc_func_iow \typeout{ ======================================== } } } \AtEndDocument{ \doc_show_functions_defined: } \cs_set_nopar:Npn \doc_functions_typeout:n #1 { - \tl_if_empty:NF \l_tmpa_tl { + \tl_if_empty:NF \l_doc_tmpa_tl { \typeout{ -------------------------------------- ^^J #1 ^^J - -------------------------------------- ^^J \l_tmpa_tl + -------------------------------------- ^^J \l_doc_tmpa_tl } - \tl_clear:N \l_tmpa_tl + \tl_clear:N \l_doc_tmpa_tl } } \cs_new:Npn \doc_show_not_tested: { @@ -1188,23 +1260,23 @@ \bool_if:nT { !(\seq_if_empty_p:N \g_doc_not_tested_seq) || !(\prop_if_empty_p:N \g_doc_missing_tests_prop) } { - \tl_clear:N \l_tmpa_tl + \tl_clear:N \l_doc_tmpa_tl \prop_if_empty:NF \g_doc_missing_tests_prop { - \tl_put_right:Nn \l_tmpa_tl + \tl_put_right:Nn \l_doc_tmpa_tl { ^^J^^JThe~ following~ macro(s)~ have~ incomplete~ tests:^^J } \prop_map_inline:Nn \g_doc_missing_tests_prop { - \tl_put_right:Nn \l_tmpa_tl + \tl_put_right:Nn \l_doc_tmpa_tl {^^J\space\space\space\space ##1 ^^J\space\space\space\space\space\space ##2} } } \seq_if_empty:NF \g_doc_not_tested_seq { - \tl_put_right:Nn \l_tmpa_tl + \tl_put_right:Nn \l_doc_tmpa_tl { ^^J^^J The~ following~ macro(s)~ do~ not~ have~ any~ tests:^^J @@ -1213,12 +1285,12 @@ { \clist_map_inline:nn {##1} { - \tl_put_right:Nn \l_tmpa_tl {^^J\space\space\space\space ####1} + \tl_put_right:Nn \l_doc_tmpa_tl {^^J\space\space\space\space ####1} } } \int_set:Nn \l_tmpa_int {\etex_interactionmode:D} \errorstopmode - \ClassError{l3doc}{\l_tmpa_tl}{} + \ClassError{l3doc}{\l_doc_tmpa_tl}{} \int_set:Nn \etex_interactionmode:D {\l_tmpa_int} } } @@ -1239,42 +1311,34 @@ } \cs_set_nopar:Npn \doc_special_main_index:n #1 { + \HD@target \index{ \@gobble#1 \actualchar \string\verb\quotechar*\verbatimchar#1\verbatimchar \encapchar - hdpgindex{\thepage}{usage} + hdclindex{\the\c@HD@hypercount}{usage} } } -\cs_set_nopar:Npn \doc_special_main_index:o { \exp_args:No \doc_special_main_index:n } -\cs_set_nopar:Npn \hdpgindex #1#2#3 { - \csname\ifx\\#2\\relax\else#2\fi\endcsname{ - \hyperlink{page.#1}{#3} +\cs_generate_variant:Nn \doc_special_main_index:n { o , x } +\msg_new:nnn {l3doc} {print-index-howto} + { + Generate~the~index~by~executing\\ + \iow_indent:n { makeindex~-s~l3doc.ist~-o~\c_job_name_tl .ind~\c_job_name_tl .idx } } -} -\g@addto@macro \PrintIndex { \AtEndDocument{ \typeout{^^J - ========================================^^J - Generate~the~index~by~executing^^J - \c_space_tl \c_space_tl \c_space_tl \c_space_tl - makeindex~-s~l3doc.ist~-o~\jobname.ind~\jobname.idx^^J - ========================================^^J - }} -} +\tl_gput_right:Nn \PrintIndex { \AtEndDocument{ \msg_info:nn {l3doc} {print-index-howto} } } \GlossaryPrologue{ \part*{Change~History} {\GlossaryParms\ttfamily\hyphenchar\font=`\-} \markboth{Change~History}{Change~History} \addcontentsline{toc}{part}{Change~History} } -\g@addto@macro \PrintChanges { \AtEndDocument{ \typeout{^^J - ========================================^^J - Generate~the~change~list~by~executing^^J - \c_space_tl \c_space_tl \c_space_tl \c_space_tl - makeindex~-s~gglo.ist~~-o~\jobname.gls~\jobname.glo^^J - ========================================^^J - }} -} +\msg_new:nnn {l3doc} {print-changes-howto} + { + Generate~the~change~list~by~executing\\ + \iow_indent:n { makeindex~-s~gglo.ist~-o~\c_job_name_tl .gls~\c_job_name_tl .glo } + } +\tl_gput_right:Nn \PrintChanges { \AtEndDocument{ \msg_info:nn {l3doc} {print-changes-howto} } } \bool_if:NTF \g_doc_full_bool { \RecordChanges \CodelineIndex @@ -1285,6 +1349,40 @@ \DisableCrossrefs \OnlyDescription } +\cs_new_nopar:Npn\Team{% + The~\LaTeX3~Project\thanks{% + Frank~Mittelbach,~Denys~Duchier,~Chris~Rowley,~ + Rainer~Sch\"opf,~Johannes~Braams,~Michael~Downes,~ + David~Carlisle,~Alan~Jeffrey,~Morten~H\o{}gholm,~Thomas~Lotze,~ + Javier~Bezos,~Will~Robertson,~Joseph~Wright,~Bruno~Le~Floch}} +\NewDocumentCommand{\ExplMakeTitle}{mm} + { + \title + { + The~\pkg{#1}~package \\ #2 + \thanks{This~file~describes~v\ExplFileVersion,~ + last~revised~\ExplFileDate.} + } + \author{The~\LaTeX3~Project\thanks{E-mail:~ + \href{mailto:latex-l@listserv.uni-heidelberg.de} + {latex-l@listserv.uni-heidelberg.de}}} + \date{Released~\ExplFileDate} + \maketitle + } +\DeclareDocumentCommand\ie{}{\emph{i.e.}} +\DeclareDocumentCommand\eg{}{\emph{e.g.}} +\DeclareDocumentCommand\Ie{}{\emph{I.e.}} +\DeclareDocumentCommand\Eg{}{\emph{E.g.}} +\AtBeginDocument + { + \clist_map_inline:nn + { + asin, acos, atan, acot, + asinh, acosh, atanh, acoth, round, floor, ceil + } + { \exp_args:Nc \DeclareMathOperator{#1}{#1} } + } +\NewDocumentCommand { \nan } { } { \text { \texttt { nan } } } %% %% %% End of file `l3doc.cls'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3docstrip.tex b/Master/texmf-dist/tex/latex/l3kernel/l3docstrip.tex new file mode 100644 index 00000000000..a8d05a96841 --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3kernel/l3docstrip.tex @@ -0,0 +1,106 @@ +%% +%% This is file `l3docstrip.tex', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3docstrip.dtx (with options: `program') +%% +%% EXPERIMENTAL CODE +%% +%% Do not distribute this file without also distributing the +%% source files specified above. +%% +%% Do not distribute a modified version of this file. +%% +%% File l3dosctrip.dtx Copyright (C) 2012 The 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 +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% 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. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +\def\ExplFileDate{2012/06/08} +\def\ExplFileName{l3docstrip} +\def\ExplFileVersion{3787} +\input docstrip % +\def\checkOption<#1{% + \ifcase + \ifx*#10\else \ifx/#11\else + \ifx+#12\else \ifx-#13\else + \ifx<#14\else \ifx @#15\else 6\fi\fi\fi\fi\fi\fi\relax + \expandafter\starOption\or + \expandafter\slashOption\or + \expandafter\plusOption\or + \expandafter\minusOption\or + \expandafter\verbOption\or + \expandafter\moduleOption\or + \expandafter\doOption\fi + #1% +} +\def\moduleOption @@=#1>#2\endLine{% + \maybeMsg{<@@=#1>}% + \prepareActiveModule{#1}% +} +\begingroup + \catcode`\_ = 12 % + \long\gdef\prepareActiveModule#1{% + \ifx\relax#1\relax + \let\replaceModuleInLine\empty + \else + \def\replaceModuleInLine{% + \replaceAllIn\inLine{__@@}{__#1}% + \replaceAllIn\inLine{_@@}{__#1}% + \replaceAllIn\inLine{@@}{__#1}% + }% + \fi + } +\endgroup +\let\replaceModuleInLine\empty +\long\def\replaceAllIn#1#2#3{% + \long\def\tempa##1##2#2{% + ##2\qMark\replaceAllInAuxIII#3##1% + }% + \edef#1{\expandafter\replaceAllInAuxI#1\qMark#2\qStop}% +} +\def\replaceAllInAuxI{% + \expandafter\replaceAllInAuxII\tempa\replaceAllInAuxI\empty +} +\long\def\replaceAllInAuxII#1\qMark#2{#1} +\long\def\replaceAllInAuxIII#1\qStop{} +\def\normalLine#1\endLine{% + \maybeMsg{.}% + \def\inLine{#1}% + \replaceModuleInLine + \let\do\putline@do + \activefiles +} +%% +%% +%% End of file `l3docstrip.tex'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3expan.sty b/Master/texmf-dist/tex/latex/l3kernel/l3expan.sty index d6463b70fac..234f1e45a27 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3expan.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3expan.sty @@ -46,63 +46,63 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3expan.dtx 3460 2012-02-26 12:16:41Z will $ - {L3 Experimental argument expansion} +\GetIdInfo$Id: l3expan.dtx 3986 2012-07-15 19:23:51Z joseph $ + {L3 Argument expansion} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\package_check_loaded_expl: -\cs_new_nopar:Npn \l_exp_internal_tl { } -\cs_new:Npn \exp_arg_next:nnn #1#2#3 { #2 \::: { #3 {#1} } } -\cs_new:Npn \exp_arg_next:Nnn #1#2#3 { #2 \::: { #3 #1 } } +\__expl_package_check: +\cs_new_nopar:Npn \l__exp_internal_tl { } +\cs_new:Npn \__exp_arg_next:nnn #1#2#3 { #2 \::: { #3 {#1} } } +\cs_new:Npn \__exp_arg_next:Nnn #1#2#3 { #2 \::: { #3 #1 } } \cs_new:Npn \::: #1 {#1} \cs_new:Npn \::n #1 \::: #2#3 { #1 \::: { #2 {#3} } } \cs_new:Npn \::N #1 \::: #2#3 { #1 \::: {#2#3} } \cs_new:Npn \::c #1 \::: #2#3 - { \exp_after:wN \exp_arg_next:Nnn \cs:w #3 \cs_end: {#1} {#2} } + { \exp_after:wN \__exp_arg_next:Nnn \cs:w #3 \cs_end: {#1} {#2} } \cs_new:Npn \::o #1 \::: #2#3 - { \exp_after:wN \exp_arg_next:nnn \exp_after:wN {#3} {#1} {#2} } + { \exp_after:wN \__exp_arg_next:nnn \exp_after:wN {#3} {#1} {#2} } \cs_new:Npn \::f #1 \::: #2#3 { - \exp_after:wN \exp_arg_next:nnn + \exp_after:wN \__exp_arg_next:nnn \exp_after:wN { \tex_romannumeral:D -`0 #3 } {#1} {#2} } \use:nn { \cs_new_eq:NN \exp_stop_f: } { ~ } \cs_new_protected:Npn \::x #1 \::: #2#3 { - \cs_set_nopar:Npx \l_exp_internal_tl { {#3} } - \exp_after:wN \exp_arg_next:nnn \l_exp_internal_tl {#1} {#2} + \cs_set_nopar:Npx \l__exp_internal_tl { {#3} } + \exp_after:wN \__exp_arg_next:nnn \l__exp_internal_tl {#1} {#2} } \cs_new:Npn \::V #1 \::: #2#3 { - \exp_after:wN \exp_arg_next:nnn - \exp_after:wN { \tex_romannumeral:D \exp_eval_register:N #3 } + \exp_after:wN \__exp_arg_next:nnn + \exp_after:wN { \tex_romannumeral:D \__exp_eval_register:N #3 } {#1} {#2} } \cs_new:Npn \::v # 1\::: #2#3 { - \exp_after:wN \exp_arg_next:nnn - \exp_after:wN { \tex_romannumeral:D \exp_eval_register:c {#3} } + \exp_after:wN \__exp_arg_next:nnn + \exp_after:wN { \tex_romannumeral:D \__exp_eval_register:c {#3} } {#1} {#2} } -\cs_new:Npn \exp_eval_register:N #1 +\cs_new:Npn \__exp_eval_register:N #1 { \exp_after:wN \if_meaning:w \exp_not:N #1 #1 \if_meaning:w \scan_stop: #1 - \exp_eval_error_msg:w + \__exp_eval_error_msg:w \fi: \else: \exp_after:wN \use_i_ii:nnn \fi: \exp_after:wN \c_zero \tex_the:D #1 } -\cs_new:Npn \exp_eval_register:c #1 - { \exp_after:wN \exp_eval_register:N \cs:w #1 \cs_end: } -\cs_new:Npn \exp_eval_error_msg:w #1 \tex_the:D #2 +\cs_new:Npn \__exp_eval_register:c #1 + { \exp_after:wN \__exp_eval_register:N \cs:w #1 \cs_end: } +\cs_new:Npn \__exp_eval_error_msg:w #1 \tex_the:D #2 { \fi: \fi: - \msg_expandable_kernel_error:nnn { kernel } { bad-var } {#2} + \__msg_kernel_expandable_error:nnn { kernel } { bad-variable } {#2} \c_zero } \cs_new:Npn \exp_args:No #1#2 { \exp_after:wN #1 \exp_after:wN {#2} } @@ -128,12 +128,12 @@ \cs_new:Npn \exp_args:Nv #1#2 { \exp_after:wN #1 \exp_after:wN - { \tex_romannumeral:D \exp_eval_register:c {#2} } + { \tex_romannumeral:D \__exp_eval_register:c {#2} } } \cs_new:Npn \exp_args:NV #1#2 { \exp_after:wN #1 \exp_after:wN - { \tex_romannumeral:D \exp_eval_register:N #2 } + { \tex_romannumeral:D \__exp_eval_register:N #2 } } \cs_new:Npn \exp_args:NNf #1#2#3 { @@ -145,13 +145,13 @@ { \exp_after:wN #1 \exp_after:wN #2 - \exp_after:wN { \tex_romannumeral:D \exp_eval_register:c {#3} } + \exp_after:wN { \tex_romannumeral:D \__exp_eval_register:c {#3} } } \cs_new:Npn \exp_args:NNV #1#2#3 { \exp_after:wN #1 \exp_after:wN #2 - \exp_after:wN { \tex_romannumeral:D \exp_eval_register:N #3 } + \exp_after:wN { \tex_romannumeral:D \__exp_eval_register:N #3 } } \cs_new:Npn \exp_args:Nco #1#2#3 { @@ -169,15 +169,15 @@ { \exp_after:wN #1 \exp_after:wN { \tex_romannumeral:D \exp_after:wN - \exp_eval_register:N \exp_after:wN #2 \exp_after:wN } - \exp_after:wN { \tex_romannumeral:D \exp_eval_register:N #3 } + \__exp_eval_register:N \exp_after:wN #2 \exp_after:wN } + \exp_after:wN { \tex_romannumeral:D \__exp_eval_register:N #3 } } \cs_new:Npn \exp_args:NNNV #1#2#3#4 { \exp_after:wN #1 \exp_after:wN #2 \exp_after:wN #3 - \exp_after:wN { \tex_romannumeral:D \exp_eval_register:N #4 } + \exp_after:wN { \tex_romannumeral:D \__exp_eval_register:N #4 } } \cs_new:Npn \exp_args:NcNc #1#2#3#4 { @@ -228,33 +228,33 @@ \cs_new_protected_nopar:Npn \exp_args:Nccx { \::c \::c \::x \::: } \cs_new_protected_nopar:Npn \exp_args:Ncnx { \::c \::n \::x \::: } \cs_new_protected_nopar:Npn \exp_args:Noox { \::o \::o \::x \::: } -\cs_new:Npn \exp_arg_last_unbraced:nn #1#2 { #2#1 } +\cs_new:Npn \__exp_arg_last_unbraced:nn #1#2 { #2#1 } \cs_new:Npn \::f_unbraced \::: #1#2 { - \exp_after:wN \exp_arg_last_unbraced:nn + \exp_after:wN \__exp_arg_last_unbraced:nn \exp_after:wN { \tex_romannumeral:D -`0 #2 } {#1} } \cs_new:Npn \::o_unbraced \::: #1#2 - { \exp_after:wN \exp_arg_last_unbraced:nn \exp_after:wN {#2} {#1} } + { \exp_after:wN \__exp_arg_last_unbraced:nn \exp_after:wN {#2} {#1} } \cs_new:Npn \::V_unbraced \::: #1#2 { - \exp_after:wN \exp_arg_last_unbraced:nn - \exp_after:wN { \tex_romannumeral:D \exp_eval_register:N #2 } {#1} + \exp_after:wN \__exp_arg_last_unbraced:nn + \exp_after:wN { \tex_romannumeral:D \__exp_eval_register:N #2 } {#1} } \cs_new:Npn \::v_unbraced \::: #1#2 { - \exp_after:wN \exp_arg_last_unbraced:nn - \exp_after:wN { \tex_romannumeral:D \exp_eval_register:c {#2} } {#1} + \exp_after:wN \__exp_arg_last_unbraced:nn + \exp_after:wN { \tex_romannumeral:D \__exp_eval_register:c {#2} } {#1} } \cs_new_protected:Npn \::x_unbraced \::: #1#2 { - \cs_set_nopar:Npx \l_exp_internal_tl { \exp_not:n {#1} #2 } - \l_exp_internal_tl + \cs_set_nopar:Npx \l__exp_internal_tl { \exp_not:n {#1} #2 } + \l__exp_internal_tl } \cs_new:Npn \exp_last_unbraced:NV #1#2 - { \exp_after:wN #1 \tex_romannumeral:D \exp_eval_register:N #2 } + { \exp_after:wN #1 \tex_romannumeral:D \__exp_eval_register:N #2 } \cs_new:Npn \exp_last_unbraced:Nv #1#2 - { \exp_after:wN #1 \tex_romannumeral:D \exp_eval_register:c {#2} } + { \exp_after:wN #1 \tex_romannumeral:D \__exp_eval_register:c {#2} } \cs_new:Npn \exp_last_unbraced:No #1#2 { \exp_after:wN #1 #2 } \cs_new:Npn \exp_last_unbraced:Nf #1#2 { \exp_after:wN #1 \tex_romannumeral:D -`0 #2 } @@ -264,13 +264,13 @@ { \exp_after:wN #1 \cs:w #2 \exp_after:wN \cs_end: - \tex_romannumeral:D \exp_eval_register:N #3 + \tex_romannumeral:D \__exp_eval_register:N #3 } \cs_new:Npn \exp_last_unbraced:NNV #1#2#3 { \exp_after:wN #1 \exp_after:wN #2 - \tex_romannumeral:D \exp_eval_register:N #3 + \tex_romannumeral:D \__exp_eval_register:N #3 } \cs_new:Npn \exp_last_unbraced:NNo #1#2#3 { \exp_after:wN #1 \exp_after:wN #2 #3 } @@ -279,7 +279,7 @@ \exp_after:wN #1 \exp_after:wN #2 \exp_after:wN #3 - \tex_romannumeral:D \exp_eval_register:N #4 + \tex_romannumeral:D \__exp_eval_register:N #4 } \cs_new:Npn \exp_last_unbraced:NNNo #1#2#3#4 { \exp_after:wN #1 \exp_after:wN #2 \exp_after:wN #3 #4 } @@ -289,8 +289,8 @@ \cs_new_nopar:Npn \exp_last_unbraced:NnNo { \::n \::N \::o_unbraced \::: } \cs_new_protected_nopar:Npn \exp_last_unbraced:Nx { \::x_unbraced \::: } \cs_new:Npn \exp_last_two_unbraced:Noo #1#2#3 - { \exp_after:wN \exp_last_two_unbraced_aux:noN \exp_after:wN {#3} {#2} #1 } -\cs_new:Npn \exp_last_two_unbraced_aux:noN #1#2#3 + { \exp_after:wN \__exp_last_two_unbraced:noN \exp_after:wN {#3} {#2} #1 } +\cs_new:Npn \__exp_last_two_unbraced:noN #1#2#3 { \exp_after:wN #3 #2 #1 } \cs_new:Npn \exp_not:o #1 { \etex_unexpanded:D \exp_after:wN {#1} } \cs_new:Npn \exp_not:c #1 { \exp_after:wN \exp_not:N \cs:w #1 \cs_end: } @@ -299,55 +299,90 @@ \cs_new:Npn \exp_not:V #1 { \etex_unexpanded:D \exp_after:wN - { \tex_romannumeral:D \exp_eval_register:N #1 } + { \tex_romannumeral:D \__exp_eval_register:N #1 } } \cs_new:Npn \exp_not:v #1 { \etex_unexpanded:D \exp_after:wN - { \tex_romannumeral:D \exp_eval_register:c {#1} } + { \tex_romannumeral:D \__exp_eval_register:c {#1} } } -\cs_new_protected:Npn \cs_generate_variant:Nn #1 +\cs_new_protected:Npn \cs_generate_variant:Nn #1#2 { - \chk_if_exist_cs:N #1 - \cs_generate_variant_aux:N #1 - \cs_split_function:NN #1 \cs_generate_variant_aux:nnNNn - #1 + \__chk_if_exist_cs:N #1 + \__cs_generate_variant:N #1 + \exp_after:wN \__cs_split_function:NN + \exp_after:wN #1 + \exp_after:wN \__cs_generate_variant:nnNN + \exp_after:wN #1 + \etex_detokenize:D {#2} , ? , \q_recursion_stop } -\cs_new_protected:Npn \cs_generate_variant_aux:nnNNn #1#2#3#4#5 - { \cs_generate_variant_aux:Nnnw #4 {#1}{#2} #5 , ? , \q_recursion_stop } -\cs_new_protected:Npn \cs_generate_variant_aux:Nnnw #1#2#3#4 , +\group_begin: + \tex_lccode:D `\Z = `\d \scan_stop: + \tex_lccode:D `\? =`\\ \scan_stop: + \tex_catcode:D `\P = 12 \scan_stop: + \tex_catcode:D `\R = 12 \scan_stop: + \tex_catcode:D `\O = 12 \scan_stop: + \tex_catcode:D `\T = 12 \scan_stop: + \tex_catcode:D `\E = 12 \scan_stop: + \tex_catcode:D `\C = 12 \scan_stop: + \tex_catcode:D `\Z = 12 \scan_stop: +\tex_lowercase:D + { + \group_end: + \cs_new_protected:Npn \__cs_generate_variant:N #1 + { + \exp_after:wN \__cs_generate_variant:w + \token_to_meaning:N #1 + \q_mark \cs_new_protected_nopar:Npx + ? PROTECTEZ + \q_mark \cs_new_nopar:Npx + \q_stop + } + \cs_new_protected:Npn \__cs_generate_variant:w + #1 ? PROTECTEZ #2 \q_mark #3 #4 \q_stop + { + \cs_set_eq:NN \__cs_tmp:w #3 + } + } +\cs_new_protected:Npn \__cs_generate_variant:nnNN #1#2#3#4 + { \__cs_generate_variant:Nnnw #4 {#1}{#2} } +\cs_new_protected:Npn \__cs_generate_variant:Nnnw #1#2#3#4 , { \if:w ? #4 \exp_after:wN \use_none_delimit_by_q_recursion_stop:w \fi: - \exp_args:NNc \cs_generate_variant_aux:NNn - #1 - { - #2 : #4 - \exp_after:wN \use_i_delimit_by_q_stop:nw - \use_none:nnnnnnnnn #4 - \use_none:nnnnnnnnn - \use_none:nnnnnnnn - \use_none:nnnnnnn - \use_none:nnnnnn - \use_none:nnnnn - \use_none:nnnn - \use_none:nnn - \use_none:nn - \use_none:n - { } + \exp_after:wN \__cs_generate_variant:NNn + \exp_after:wN #1 + \cs:w + #2 : + \__cs_generate_variant_loop:NwN + ? #3 + \q_mark #4 \__cs_generate_variant_loop_end:w + \q_mark \__cs_generate_variant_loop_error:wnNNnn \q_stop - #3 - } + \cs_end: {#4} - \cs_generate_variant_aux:Nnnw #1 {#2} {#3} + \__cs_generate_variant:Nnnw #1 {#2} {#3} } -\cs_new_protected:Npn \cs_generate_variant_aux:NNn #1 #2 #3 +\cs_new:Npn \__cs_generate_variant_loop:NwN #1 #2 \q_mark #3 + { #3 \__cs_generate_variant_loop:NwN #2 \q_mark } +\cs_new:Npn \__cs_generate_variant_loop_end:w #1#2 \q_mark #3 \q_stop {#2} +\cs_new:Npn \__cs_generate_variant_loop_error:wnNNnn + #1 \q_stop \cs_end: #2 #3#4#5#6 + { + \cs_end: {#2} + \__msg_kernel_error:nnxx { kernel } { variant-too-long } + { \tl_to_str:n {#2} } { \token_to_str:N #4 } + #3 #4 {#5} {#6} + } +\cs_new_protected:Npn \__cs_generate_variant:NNn #1 #2 #3 { \cs_if_free:NTF #2 { - \cs_tmp:w #2 { \exp_not:c { exp_args:N #3 } \exp_not:N #1 } - \cs_generate_internal_variant:n {#3} + \group_begin: + \__cs_generate_internal_variant:n {#3} + \__cs_tmp:w #2 { \exp_not:c { exp_args:N #3 } \exp_not:N #1 } + \group_end: } { \iow_log:x @@ -359,48 +394,35 @@ } } \group_begin: - \tex_lccode:D `\Z = `\d \scan_stop: - \tex_lccode:D `\? =`\\ \scan_stop: - \tex_catcode:D `\P = 12 \scan_stop: - \tex_catcode:D `\R = 12 \scan_stop: - \tex_catcode:D `\O = 12 \scan_stop: - \tex_catcode:D `\T = 12 \scan_stop: - \tex_catcode:D `\E = 12 \scan_stop: - \tex_catcode:D `\C = 12 \scan_stop: - \tex_catcode:D `\Z = 12 \scan_stop: + \tex_catcode:D `\X = 12 \scan_stop: + \tex_lccode:D `\N = `\N \scan_stop: \tex_lowercase:D { \group_end: - \cs_new_protected:Npn \cs_generate_variant_aux:N #1 + \cs_new_protected:Npn \__cs_generate_internal_variant:n #1 { - \exp_after:wN \cs_generate_variant_aux:w - \token_to_meaning:N #1 - \q_mark \cs_new_protected_nopar:Npx - ? PROTECTEZ - \q_mark \cs_new_nopar:Npx - \q_stop - } - \cs_new_protected:Npn \cs_generate_variant_aux:w - #1 ? PROTECTEZ #2 \q_mark #3 #4 \q_stop - { - \cs_set_eq:NN \cs_tmp:w #3 + \__cs_generate_internal_variant:wwnNwnn + #1 \q_mark + { \cs_set_eq:NN \__cs_tmp:w \cs_new_protected_nopar:Npx } + \cs_new_protected_nopar:cpx + X \q_mark + { } + \cs_new_nopar:cpx + \q_stop + { exp_args:N #1 } + { \__cs_generate_internal_variant_loop:n #1 { : \use_i:nn } } } - } -\cs_new_protected:Npn \cs_generate_internal_variant:n #1 - { - \cs_if_free:cT { exp_args:N #1 } + \cs_new_protected:Npn \__cs_generate_internal_variant:wwnNwnn + #1 X #2 \q_mark #3 #4 #5 \q_stop #6 #7 { - \cs_new:cpx { exp_args:N #1 } - { \cs_generate_internal_variant_aux:N #1 : } + #3 + \cs_if_free:cT {#6} { #4 {#6} {#7} } } } -\cs_new:Npn \cs_generate_internal_variant_aux:N #1 +\cs_new:Npn \__cs_generate_internal_variant_loop:n #1 { - \exp_not:c { :: #1 } - \if_meaning:w : #1 - \exp_after:wN \use_none:n - \fi: - \cs_generate_internal_variant_aux:N + \exp_after:wN \exp_not:N \cs:w :: #1 \cs_end: + \__cs_generate_internal_variant_loop:n } \cs_generate_variant:Nn \str_if_eq_p:nn { V , o } \cs_generate_variant:Nn \str_if_eq_p:nn { nV , no , VV } @@ -410,6 +432,7 @@ \cs_generate_variant:Nn \str_if_eq:nnF { nV , no , VV } \cs_generate_variant:Nn \str_if_eq:nnTF { V , o } \cs_generate_variant:Nn \str_if_eq:nnTF { nV , no , VV } +\cs_generate_variant:Nn \str_case:nnn { o } %% %% %% End of file `l3expan.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3file.sty b/Master/texmf-dist/tex/latex/l3kernel/l3file.sty index a86de65f88f..e0642b967a3 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3file.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3file.sty @@ -46,121 +46,142 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3file.dtx 3520 2012-03-09 19:34:07Z joseph $ - {L3 Experimental file and I/O operations} +\GetIdInfo$Id: l3file.dtx 3986 2012-07-15 19:23:51Z joseph $ + {L3 File and I/O operations} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\package_check_loaded_expl: +\__expl_package_check: \tl_new:N \g_file_current_name_tl \tl_gset_eq:NN \g_file_current_name_tl \@currname -\seq_new:N \g_file_stack_seq -\seq_new:N \g_file_record_seq -\tl_new:N \l_file_internal_name_tl -\seq_new:N \l_file_search_path_seq -\seq_new:N \l_file_internal_saved_path_seq -\seq_new:N \l_file_internal_seq -\cs_new_protected:Npn \file_name_sanitize:nn #1#2 +\seq_new:N \g__file_stack_seq +\seq_new:N \g__file_record_seq +\tl_new:N \l__file_internal_name_tl +\seq_new:N \l__file_search_path_seq +\seq_new:N \l__file_saved_search_path_seq +\seq_new:N \l__file_internal_seq +\cs_new_protected:Npn \__file_name_sanitize:nn #1#2 { \group_begin: \seq_map_inline:Nn \l_char_active_seq { \cs_set_nopar:Npx ##1 { \token_to_str:N ##1 } } - \tl_set:Nx \l_file_internal_name_tl {#1} - \tl_set:Nx \l_file_internal_name_tl - { \tl_to_str:N \l_file_internal_name_tl } - \tl_if_in:NnTF \l_file_internal_name_tl { ~ } + \tl_set:Nx \l__file_internal_name_tl {#1} + \tl_set:Nx \l__file_internal_name_tl + { \tl_to_str:N \l__file_internal_name_tl } + \tl_if_in:NnT \l__file_internal_name_tl { ~ } { - \msg_kernel_error:nnx { file } { space-in-file-name } - { \l_file_internal_name_tl } + \__msg_kernel_error:nnx { kernel } { space-in-file-name } + { \l__file_internal_name_tl } + \tl_remove_all:Nn \l__file_internal_name_tl { ~ } } \use:x { \group_end: - \exp_not:n {#2} { \l_file_internal_name_tl } + \exp_not:n {#2} { \l__file_internal_name_tl } } } \cs_new_protected:Npn \file_add_path:nN #1 - { \file_name_sanitize:nn {#1} { \file_add_path_aux:nN } } -\cs_new_protected:Npn \file_add_path_aux:nN #1#2 + { \__file_name_sanitize:nn {#1} { \__file_add_path:nN } } +\cs_new_protected:Npn \__file_add_path:nN #1#2 { - \ior_open_unsafe:Nn \g_file_internal_ior {#1} - \ior_if_eof:NTF \g_file_internal_ior - { \file_add_path_search:nN {#1} #2 } - { - \ior_close:N \g_file_internal_ior - \tl_set:Nn #2 {#1} - } + \__ior_open:Nn \g__file_internal_ior {#1} + \ior_if_eof:NTF \g__file_internal_ior + { \__file_add_path_search:nN {#1} #2 } + { \tl_set:Nn #2 {#1} } + \ior_close:N \g__file_internal_ior } -\cs_new_protected:Npn \file_add_path_search:nN #1#2 +\cs_new_protected:Npn \__file_add_path_search:nN #1#2 { - \tl_set:Nn #2 { \q_no_value } + \tl_set:Nn #2 { \q_no_value } \cs_if_exist:NT \input@path { - \seq_set_eq:NN \l_file_internal_saved_path_seq \l_file_search_path_seq - \seq_set_from_clist:NN \l_file_internal_seq \input@path - \seq_concat:NNN \l_file_search_path_seq - \l_file_search_path_seq \l_file_internal_seq + \seq_set_eq:NN \l__file_saved_search_path_seq \l__file_search_path_seq + \seq_set_split:NnV \l__file_internal_seq { , } \input@path + \seq_concat:NNN \l__file_search_path_seq + \l__file_search_path_seq \l__file_internal_seq } - \seq_map_inline:Nn \l_file_search_path_seq + \seq_map_inline:Nn \l__file_search_path_seq { - \ior_open_unsafe:Nn \g_file_internal_ior { ##1 #1 } - \ior_if_eof:NF \g_file_internal_ior + \__ior_open:Nn \g__file_internal_ior { ##1 #1 } + \ior_if_eof:NF \g__file_internal_ior { \tl_set:Nx #2 { ##1 #1 } \seq_map_break: } } \cs_if_exist:NT \input@path - { \seq_set_eq:NN \l_file_search_path_seq \l_file_internal_saved_path_seq } - \ior_close:N \g_file_internal_ior + { \seq_set_eq:NN \l__file_search_path_seq \l__file_saved_search_path_seq } } \prg_new_protected_conditional:Npnn \file_if_exist:n #1 { T , F , TF } { - \file_add_path:nN {#1} \l_file_internal_name_tl - \quark_if_no_value:NTF \l_file_internal_name_tl + \file_add_path:nN {#1} \l__file_internal_name_tl + \quark_if_no_value:NTF \l__file_internal_name_tl { \prg_return_false: } { \prg_return_true: } } \cs_new_protected:Npn \file_input:n #1 { - \file_add_path:nN {#1} \l_file_internal_name_tl - \quark_if_no_value:NTF \l_file_internal_name_tl - { \file_name_sanitize:nn {#1} { \file_input_error:n } } - { \file_input_aux:V \l_file_internal_name_tl } + \file_add_path:nN {#1} \l__file_internal_name_tl + \quark_if_no_value:NTF \l__file_internal_name_tl + { + \__file_name_sanitize:nn {#1} + { \__msg_kernel_error:nnx { kernel } { file-not-found } } + } + { \__file_input:V \l__file_internal_name_tl } } -\cs_new_protected:Npn \file_input_aux:n #1 +\cs_new_protected:Npn \__file_input:n #1 { - \@addtofilelist {#1} - \seq_gpush:Nn \g_file_stack_seq \g_file_current_name_tl + \quark_if_nil:oTF { \__file_input_aux:w #1 . \q_nil . \q_stop } + { \__file_input_aux:o { \tl_to_str:n { #1 .tex } } } + { \__file_input_aux:n {#1} } + } +\cs_generate_variant:Nn \__file_input:n { V } +\cs_new:Npn \__file_input_aux:w #1 . #2 . #3 \q_stop { #2 } +\cs_new_protected:Npn \__file_input_aux:n #1 + { + \clist_if_exist:NTF \@filelist + { \@addtofilelist {#1} } + { \seq_gput_right:Nn \g__file_record_seq {#1} } + \seq_gpush:Nn \g__file_stack_seq \g_file_current_name_tl \tl_gset:Nn \g_file_current_name_tl {#1} \tex_input:D #1 \c_space_tl - \seq_gpop:NN \g_file_stack_seq \g_file_current_name_tl + \seq_gpop:NN \g__file_stack_seq \g_file_current_name_tl } -\cs_generate_variant:Nn \file_input_aux:n { V } -\cs_new_protected:Npn \file_input_error:n #1 - { \msg_kernel_error:nnx { file } { file-not-found } {#1} } +\cs_generate_variant:Nn \__file_input_aux:n { o } \cs_new_protected:Npn \file_path_include:n #1 + { \__file_name_sanitize:nn {#1} { \__file_path_include:n } } +\cs_new_protected:Npn \__file_path_include:n #1 { - \seq_if_in:NnF \l_file_search_path_seq {#1} - { \seq_put_right:Nn \l_file_search_path_seq {#1} } + \seq_if_in:NnF \l__file_search_path_seq {#1} + { \seq_put_right:Nn \l__file_search_path_seq {#1} } } \cs_new_protected:Npn \file_path_remove:n #1 - { \seq_remove_all:Nn \l_file_search_path_seq {#1} } + { + \__file_name_sanitize:nn {#1} + { \seq_remove_all:Nn \l__file_search_path_seq } + } \cs_new_protected_nopar:Npn \file_list: { - \seq_remove_duplicates:N \g_file_record_seq + \seq_set_eq:NN \l__file_internal_seq \g__file_record_seq + \clist_if_exist:NT \@filelist + { + \clist_map_inline:Nn \@filelist + { + \seq_put_right:No \l__file_internal_seq + { \tl_to_str:n {##1} } + } + } + \seq_remove_duplicates:N \l__file_internal_seq \iow_log:n { *~File~List~* } - \seq_map_inline:Nn \g_file_record_seq { \iow_log:n {##1} } + \seq_map_inline:Nn \l__file_internal_seq { \iow_log:n {##1} } \iow_log:n { ************* } } \AtBeginDocument { - \seq_set_from_clist:NN \l_file_internal_seq \@filelist - \seq_gconcat:NNN \g_file_record_seq \g_file_record_seq \l_file_internal_seq + \clist_map_inline:Nn \@filelist + { \seq_gput_right:No \g__file_record_seq { \tl_to_str:n {#1} } } } \cs_new_eq:NN \c_term_ior \c_sixteen -\cs_new_eq:NN \c_log_iow \c_minus_one -\cs_new_eq:NN \c_term_iow \c_sixteen -\tl_const:Nn \c_iow_streams_tl +\tl_const:Nn \c__ior_streams_tl { \c_zero \c_one @@ -179,232 +200,243 @@ \c_fourteen \c_fifteen } -\cs_new_eq:NN \c_ior_streams_tl \c_iow_streams_tl -\prop_new:N \g_iow_streams_prop -\prop_new:N \g_ior_streams_prop -\prop_put:Nnn \g_iow_streams_prop { 0 } { LaTeX2e~reserved } -\prop_put:Nnn \g_iow_streams_prop { 1 } { LaTeX2e~reserved } -\prop_put:Nnn \g_iow_streams_prop { 2 } { LaTeX2e~reserved } -\prop_put:Nnn \g_ior_streams_prop { 0 } { LaTeX2e~reserved } -\int_new:N \l_iow_stream_int -\cs_new_eq:NN \l_ior_stream_int \l_iow_stream_int -\cs_set_eq:NN \iow_raw_new:N \newwrite -\cs_set_eq:NN \ior_raw_new:N \newread -\cs_generate_variant:Nn \ior_raw_new:N { c } -\cs_generate_variant:Nn \iow_raw_new:N { c } +\prop_new:N \g__ior_streams_prop +\prop_put:Nnn \g__ior_streams_prop { 0 } { LaTeX2e~reserved } +\int_new:N \l__ior_stream_int +\cs_set_eq:NN \__ior_new:N \newread +\cs_generate_variant:Nn \__ior_new:N { c } \cs_new_protected:Npn \ior_new:N #1 { \cs_new_eq:NN #1 \c_term_ior } \cs_generate_variant:Nn \ior_new:N { c } -\cs_new_protected:Npn \iow_new:N #1 { \cs_new_eq:NN #1 \c_term_iow } -\cs_generate_variant:Nn \iow_new:N { c } -\ior_new:N \g_file_internal_ior +\ior_new:N \g__file_internal_ior \cs_new_protected:Npn \ior_open:Nn #1#2 - { \file_name_sanitize:nn {#2} { \ior_open_aux:Nn #1 } } + { \__file_name_sanitize:nn {#2} { \__ior_open_aux:Nn #1 } } \cs_generate_variant:Nn \ior_open:Nn { c } -\cs_new_protected:Npn \iow_open:Nn #1#2 - { \file_name_sanitize:nn {#2} { \iow_open_unsafe:Nn #1 } } -\cs_generate_variant:Nn \iow_open:Nn { c } -\cs_new_protected:Npn \ior_open_aux:Nn #1#2 +\cs_new_protected:Npn \__ior_open_aux:Nn #1#2 { - \file_add_path:nN {#2} \l_file_internal_name_tl - \quark_if_no_value:NTF \l_file_internal_name_tl - { \file_input_error:n {#2} } - { \ior_open_unsafe:No #1 \l_file_internal_name_tl } + \file_add_path:nN {#2} \l__file_internal_name_tl + \quark_if_no_value:NTF \l__file_internal_name_tl + { \__msg_kernel_error:nnx { kernel } { file-not-found } {#2} } + { \__ior_open:No #1 \l__file_internal_name_tl } } \prg_new_protected_conditional:Npnn \ior_open:Nn #1#2 { T , F , TF } - { \file_name_sanitize:nn {#2} { \ior_open_aux:NnTF #1 } } -\cs_new_protected:Npn \ior_open_aux:NnTF #1#2 + { \__file_name_sanitize:nn {#2} { \__ior_open_aux:NnTF #1 } } +\cs_new_protected:Npn \__ior_open_aux:NnTF #1#2 { - \file_add_path:nN {#2} \l_file_internal_name_tl - \quark_if_no_value:NTF \l_file_internal_name_tl + \file_add_path:nN {#2} \l__file_internal_name_tl + \quark_if_no_value:NTF \l__file_internal_name_tl { \prg_return_false: } { - \ior_open_unsafe:No #1 \l_file_internal_name_tl + \__ior_open:No #1 \l__file_internal_name_tl \prg_return_true: } } \cs_generate_variant:Nn \ior_open:NnT { c } \cs_generate_variant:Nn \ior_open:NnF { c } \cs_generate_variant:Nn \ior_open:NnTF { c } -\cs_new_protected:Npn \ior_open_unsafe:Nn #1#2 +\cs_new_protected:Npn \__ior_open:Nn #1#2 { \ior_close:N #1 - \int_set:Nn \l_ior_stream_int \c_sixteen - \tl_map_function:NN \c_ior_streams_tl \ior_alloc_read:n - \int_compare:nNnTF \l_ior_stream_int = \c_sixteen - { \msg_kernel_fatal:nn { ior } { streams-exhausted } } + \int_set_eq:NN \l__ior_stream_int \c_sixteen + \tl_map_function:NN \c__ior_streams_tl \__ior_alloc:n + \int_compare:nNnTF \l__ior_stream_int = \c_sixteen + { \__msg_kernel_fatal:nn { kernel } { input-streams-exhausted } } { - \ior_stream_alloc:N #1 - \prop_gput:NVn \g_ior_streams_prop \l_ior_stream_int {#2} + \__ior_alloc:N #1 + \prop_gput:NVn \g__ior_streams_prop \l__ior_stream_int {#2} \tex_openin:D #1#2 \scan_stop: } } -\cs_generate_variant:Nn \ior_open_unsafe:Nn { No } -\cs_new_protected:Npn \iow_open_unsafe:Nn #1#2 +\cs_generate_variant:Nn \__ior_open:Nn { No } +\cs_new_protected:Npn \__ior_alloc:n #1 { - \iow_close:N #1 - \int_set:Nn \l_iow_stream_int \c_sixteen - \tl_map_function:NN \c_iow_streams_tl \iow_alloc_write:n - \int_compare:nNnTF \l_iow_stream_int = \c_sixteen - { \msg_kernel_fatal:nn { iow } { streams-exhausted } } + \prop_if_in:NnF \g__ior_streams_prop {#1} { - \iow_stream_alloc:N #1 - \prop_gput:NVn \g_iow_streams_prop \l_iow_stream_int {#2} - \tex_immediate:D \tex_openout:D #1#2 \scan_stop: + \int_set:Nn \l__ior_stream_int {#1} + \tl_map_break: } } -\cs_new_protected:Npn \iow_alloc_write:n #1 +\ior_new:N \g__ior_internal_ior +\cs_new_protected:Npn \__ior_alloc:N #1 { - \prop_if_in:NnF \g_iow_streams_prop {#1} + \cs_if_exist:cF { g_ior_ \int_use:N \l__ior_stream_int _ior } { - \int_set:Nn \l_iow_stream_int {#1} - \tl_map_break: + \__ior_alloc: + \int_compare:nNnT \l__ior_stream_int = \c_sixteen + { + \__ior_new:N \g__ior_internal_ior + \int_set:Nn \l__ior_stream_int { \g__ior_internal_ior } + \cs_gset_eq:cN + { g_ior_ \int_use:N \l__ior_stream_int _ior } \g__ior_internal_ior + } } + \cs_gset_eq:Nc #1 { g_ior_ \int_use:N \l__ior_stream_int _ior } } -\cs_new_protected:Npn \ior_alloc_read:n #1 +\cs_new_protected_nopar:Npn \__ior_alloc: { - \prop_if_in:NnF \g_iow_streams_prop {#1} + \int_incr:N \l__ior_stream_int + \int_compare:nNnT \l__ior_stream_int < \c_sixteen { - \int_set:Nn \l_ior_stream_int {#1} - \tl_map_break: + \cs_if_exist:cTF { g_ior_ \int_use:N \l__ior_stream_int _ior } + { + \prop_if_in:NVT \g__ior_streams_prop \l__ior_stream_int + { \__ior_alloc: } + } + { \__ior_alloc: } } } -\iow_new:N \g_iow_internal_iow -\ior_new:N \g_ior_internal_ior -\cs_new_protected:Npn \iow_stream_alloc:N #1 +\cs_new_protected:Npn \ior_close:N #1 { - \cs_if_exist:cF { g_iow_ \int_use:N \l_iow_stream_int _iow } + \__chk_if_exist_cs:N #1 + \int_compare:nNnF #1 < \c_zero { - \iow_stream_alloc_aux: - \int_compare:nNnT \l_iow_stream_int = \c_sixteen + \int_compare:nNnF #1 > \c_fifteen { - \iow_raw_new:N \g_iow_internal_iow - \int_set:Nn \l_iow_stream_int { \g_iow_internal_iow } - \cs_gset_eq:cN - { g_iow_ \int_use:N \l_iow_stream_int _iow } \g_iow_internal_iow + \tex_closein:D #1 + \prop_gremove:NV \g__ior_streams_prop #1 + \cs_gset_eq:NN #1 \c_term_ior } } - \cs_gset_eq:Nc #1 { g_iow_ \int_use:N \l_iow_stream_int _iow } } -\cs_new_protected_nopar:Npn \iow_stream_alloc_aux: +\cs_generate_variant:Nn \ior_close:N { c } +\cs_new_protected_nopar:Npn \ior_list_streams: + { \__ior_list_streams:Nn \g__ior_streams_prop { input } } +\cs_new_protected:Npn \__ior_list_streams:Nn #1#2 { - \int_incr:N \l_iow_stream_int - \int_compare:nNnT \l_iow_stream_int < \c_sixteen + \__msg_term:nnn { LaTeX / kernel } + { \prop_if_empty:NTF #1 { show-no-stream } { show-open-streams } } + {#2} + \__msg_show_variable:x + { \prop_map_function:NN #1 \__msg_show_item_unbraced:nn } + } +\cs_new_eq:NN \if_eof:w \tex_ifeof:D +\prg_new_conditional:Nnn \ior_if_eof:N { p , T , F , TF } + { + \cs_if_exist:NTF #1 { - \cs_if_exist:cTF { g_iow_ \int_use:N \l_iow_stream_int _iow } - { - \prop_if_in:NVT \g_iow_streams_prop \l_iow_stream_int - { \iow_stream_alloc_aux: } - } - { \iow_stream_alloc_aux: } + \if_int_compare:w #1 = \c_sixteen + \prg_return_true: + \else: + \if_eof:w #1 + \prg_return_true: + \else: + \prg_return_false: + \fi: + \fi: } + { \prg_return_true: } } -\cs_new_protected:Npn \ior_stream_alloc:N #1 +\cs_new_protected:Npn \ior_get:NN #1#2 + { \tex_read:D #1 to #2 } +\cs_new_protected:Npn \ior_get_str:NN #1#2 + { \etex_readline:D #1 to #2 } +\cs_new_eq:NN \c_log_iow \c_minus_one +\cs_new_eq:NN \c_term_iow \c_sixteen +\cs_new_eq:NN \c__iow_streams_tl \c__ior_streams_tl +\prop_new:N \g__iow_streams_prop +\prop_put:Nnn \g__iow_streams_prop { 0 } { LaTeX2e~reserved } +\prop_put:Nnn \g__iow_streams_prop { 1 } { LaTeX2e~reserved } +\prop_put:Nnn \g__iow_streams_prop { 2 } { LaTeX2e~reserved } +\cs_new_eq:NN \l__iow_stream_int \l__ior_stream_int +\cs_set_eq:NN \__iow_new:N \newwrite +\cs_generate_variant:Nn \__iow_new:N { c } +\cs_new_protected:Npn \iow_new:N #1 { \cs_new_eq:NN #1 \c_term_iow } +\cs_generate_variant:Nn \iow_new:N { c } +\cs_new_protected:Npn \iow_open:Nn #1#2 + { \__file_name_sanitize:nn {#2} { \__iow_open:Nn #1 } } +\cs_generate_variant:Nn \iow_open:Nn { c } +\cs_new_protected:Npn \__iow_open:Nn #1#2 { - \cs_if_exist:cF { g_ior_ \int_use:N \l_ior_stream_int _ior } + \iow_close:N #1 + \int_set_eq:NN \l__iow_stream_int \c_sixteen + \tl_map_function:NN \c__iow_streams_tl \__iow_alloc:n + \int_compare:nNnTF \l__iow_stream_int = \c_sixteen + { \__msg_kernel_fatal:nn { kernel } { output-streams-exhausted } } { - \ior_stream_alloc_aux: - \int_compare:nNnT \l_ior_stream_int = \c_sixteen - { - \ior_raw_new:N \g_ior_internal_ior - \int_set:Nn \l_ior_stream_int { \g_ior_internal_ior } - \cs_gset_eq:cN - { g_ior_ \int_use:N \l_iow_stream_int _ior } \g_ior_internal_ior - } + \__iow_alloc:N #1 + \prop_gput:NVn \g__iow_streams_prop \l__iow_stream_int {#2} + \tex_immediate:D \tex_openout:D #1#2 \scan_stop: + } + } +\cs_new_protected:Npn \__iow_alloc:n #1 + { + \prop_if_in:NnF \g__iow_streams_prop {#1} + { + \int_set:Nn \l__iow_stream_int {#1} + \tl_map_break: } - \cs_gset_eq:Nc #1 { g_ior_ \int_use:N \l_ior_stream_int _ior } } -\cs_new_protected_nopar:Npn \ior_stream_alloc_aux: +\iow_new:N \g__iow_internal_iow +\cs_new_protected:Npn \__iow_alloc:N #1 { - \int_incr:N \l_ior_stream_int - \int_compare:nNnT \l_ior_stream_int < \c_sixteen + \cs_if_exist:cF { g_iow_ \int_use:N \l__iow_stream_int _iow } { - \cs_if_exist:cTF { g_ior_ \int_use:N \l_ior_stream_int _ior } + \__iow_alloc: + \int_compare:nNnT \l__iow_stream_int = \c_sixteen { - \prop_if_in:NVT \g_ior_streams_prop \l_ior_stream_int - { \ior_stream_alloc_aux: } + \__iow_new:N \g__iow_internal_iow + \int_set:Nn \l__iow_stream_int { \g__iow_internal_iow } + \cs_gset_eq:cN + { g_iow_ \int_use:N \l__iow_stream_int _iow } \g__iow_internal_iow } - { \ior_stream_alloc_aux: } } + \cs_gset_eq:Nc #1 { g_iow_ \int_use:N \l__iow_stream_int _iow } } -\cs_new_protected:Npn \ior_close:N #1 +\cs_new_protected_nopar:Npn \__iow_alloc: { - \cs_if_exist:NT #1 + \int_incr:N \l__iow_stream_int + \int_compare:nNnT \l__iow_stream_int < \c_sixteen { - \int_compare:nNnF #1 = \c_minus_one + \cs_if_exist:cTF { g_iow_ \int_use:N \l__iow_stream_int _iow } { - \int_compare:nNnF #1 = \c_sixteen - { \tex_closein:D #1 } - \prop_gdel:NV \g_ior_streams_prop #1 - \cs_gset_eq:NN #1 \c_term_ior + \prop_if_in:NVT \g__iow_streams_prop \l__iow_stream_int + { \__iow_alloc: } } + { \__iow_alloc: } } } \cs_new_protected:Npn \iow_close:N #1 { - \cs_if_exist:NT #1 + \__chk_if_exist_cs:N #1 + \int_compare:nNnF #1 < \c_zero { - \int_compare:nNnF #1 = \c_minus_one + \int_compare:nNnF #1 > \c_fifteen { - \int_compare:nNnF #1 = \c_sixteen - { \tex_closein:D #1 } - \prop_gdel:NV \g_iow_streams_prop #1 + \tex_closeout:D #1 + \prop_gremove:NV \g__iow_streams_prop #1 \cs_gset_eq:NN #1 \c_term_iow } } } -\cs_generate_variant:Nn \ior_close:N { c } \cs_generate_variant:Nn \iow_close:N { c } -\cs_new_protected_nopar:Npn \ior_list_streams: - { \ior_list_streams_aux:Nn \g_ior_streams_prop { ior } } \cs_new_protected_nopar:Npn \iow_list_streams: - { \ior_list_streams_aux:Nn \g_iow_streams_prop { iow } } -\cs_new_protected:Npn \ior_list_streams_aux:Nn #1#2 - { - \msg_aux_use:nn { LaTeX / #2 } - { \prop_if_empty:NTF #1 { show-no-stream } { show-open-streams } } - \msg_aux_show:x - { \prop_map_function:NN #1 \msg_aux_show_unbraced:nn } - } -\msg_kernel_new:nnnn { iow } { streams-exhausted } - { Output~streams~exhausted } - { - TeX~can~only~open~up~to~16~output~streams~at~one~time.\\ - All~16 are currently~in~use,~and~something~wanted~to~open - another~one. - } -\msg_kernel_new:nnnn { ior } { streams-exhausted } - { Input~streams~exhausted } - { - TeX~can~only~open~up~to~16~input~streams~at~one~time.\\ - All~16 are currently~in~use,~and~something~wanted~to~open - another~one. - } + { \__iow_list_streams:Nn \g__iow_streams_prop { output } } +\cs_new_eq:NN \__iow_list_streams:Nn \__ior_list_streams:Nn \cs_new_eq:NN \iow_shipout_x:Nn \tex_write:D \cs_generate_variant:Nn \iow_shipout_x:Nn { Nx } \cs_new_protected:Npn \iow_shipout:Nn #1#2 { \iow_shipout_x:Nn #1 { \exp_not:n {#2} } } \cs_generate_variant:Nn \iow_shipout:Nn { Nx } -\cs_new_protected_nopar:Npn \iow_now:Nx { \tex_immediate:D \iow_shipout_x:Nn } \cs_new_protected:Npn \iow_now:Nn #1#2 - { \iow_now:Nx #1 { \exp_not:n {#2} } } + { \tex_immediate:D \iow_shipout_x:Nn #1 { \exp_not:n {#2} } } +\cs_generate_variant:Nn \iow_now:Nn { Nx } \cs_set_protected_nopar:Npn \iow_log:x { \iow_now:Nx \c_log_iow } \cs_new_protected_nopar:Npn \iow_log:n { \iow_now:Nn \c_log_iow } \cs_set_protected_nopar:Npn \iow_term:x { \iow_now:Nx \c_term_iow } \cs_new_protected_nopar:Npn \iow_term:n { \iow_now:Nn \c_term_iow } \cs_new_nopar:Npn \iow_newline: { ^^J } \cs_new_eq:NN \iow_char:N \cs_to_str:N -\int_new:N \l_iow_line_length_int -\int_set:Nn \l_iow_line_length_int { 78 } -\int_new:N \l_iow_target_length_int -\int_new:N \l_iow_current_line_int -\int_new:N \l_iow_current_word_int -\int_new:N \l_iow_current_indentation_int -\tl_new:N \l_iow_current_line_tl -\tl_new:N \l_iow_current_word_tl -\tl_new:N \l_iow_current_indentation_tl -\tl_new:N \l_iow_wrap_tl -\tl_new:N \l_iow_wrapped_tl -\bool_new:N \l_iow_line_start_bool +\int_new:N \l_iow_line_count_int +\int_set:Nn \l_iow_line_count_int { 78 } +\int_new:N \l__iow_target_count_int +\int_new:N \l__iow_current_line_int +\int_new:N \l__iow_current_word_int +\int_new:N \l__iow_current_indentation_int +\tl_new:N \l__iow_current_line_tl +\tl_new:N \l__iow_current_word_tl +\tl_new:N \l__iow_current_indentation_tl +\tl_new:N \l__iow_wrap_tl +\tl_new:N \l__iow_newline_tl +\bool_new:N \l__iow_line_start_bool \group_begin: \char_set_catcode_other:N \* \char_set_lccode:nn {`\*} {`\ } @@ -412,41 +444,31 @@ \group_end: \group_begin: \int_set_eq:NN \tex_escapechar:D \c_minus_one - \tl_const:Nx \c_iow_wrap_marker_tl + \tl_const:Nx \c__iow_wrap_marker_tl { \tl_to_str:n { \^^I \^^O \^^W \^^_ \^^W \^^R \^^A \^^P } } - \cs_set:Npn \iow_wrap_new_marker:n #1 - { - \tl_const:cx { c_iow_wrap_ #1 _marker_tl } - { - \c_catcode_other_space_tl - \c_iow_wrap_marker_tl - \c_catcode_other_space_tl - #1 - \c_catcode_other_space_tl - } - } - \iow_wrap_new_marker:n { end } - \iow_wrap_new_marker:n { newline } - \iow_wrap_new_marker:n { indent } - \iow_wrap_new_marker:n { unindent } \group_end: +\tl_map_inline:nn + { { end } { newline } { indent } { unindent } } + { + \tl_const:cx { c__iow_wrap_ #1 _marker_tl } + { + \c_catcode_other_space_tl + \c__iow_wrap_marker_tl + \c_catcode_other_space_tl + #1 + \c_catcode_other_space_tl + } + } \cs_new_protected:Npn \iow_indent:n #1 { } -\cs_new:Npx \iow_indent_expandable:n #1 +\cs_new:Npx \__iow_indent:n #1 { - \c_iow_wrap_indent_marker_tl + \c__iow_wrap_indent_marker_tl #1 - \c_iow_wrap_unindent_marker_tl + \c__iow_wrap_unindent_marker_tl } -\cs_new_protected:Npn \iow_wrap:xnnnN #1#2#3#4#5 +\cs_new_protected:Npn \iow_wrap:nnnN #1#2#3#4 { \group_begin: - \int_set:Nn \l_iow_target_length_int { \l_iow_line_length_int - ( #3 ) } - \int_zero:N \l_iow_current_indentation_int - \tl_clear:N \l_iow_current_indentation_tl - \int_zero:N \l_iow_current_line_int - \tl_clear:N \l_iow_current_line_tl - \tl_clear:N \l_iow_wrap_tl - \bool_set_true:N \l_iow_line_start_bool \int_set_eq:NN \tex_escapechar:D \c_minus_one \cs_set_nopar:Npx \{ { \token_to_str:N \{ } \cs_set_nopar:Npx \# { \token_to_str:N \# } @@ -454,186 +476,162 @@ \cs_set_nopar:Npx \% { \token_to_str:N \% } \cs_set_nopar:Npx \~ { \token_to_str:N \~ } \int_set:Nn \tex_escapechar:D { 92 } - \cs_set_eq:NN \\ \c_iow_wrap_newline_marker_tl + \cs_set_eq:NN \\ \c__iow_wrap_newline_marker_tl \cs_set_eq:NN \ \c_catcode_other_space_tl - \cs_set_eq:NN \iow_indent:n \iow_indent_expandable:n - #4 - \protected@edef \l_iow_wrap_tl {#1} - \cs_set:Npn \\ { \iow_newline: #2 } + \cs_set_eq:NN \iow_indent:n \__iow_indent:n + #3 + \protected@edef \l__iow_wrap_tl {#1} + \tl_set:Nx \l__iow_newline_tl { \iow_newline: #2 } + \tl_set:Nx \l__iow_newline_tl { \tl_to_str:N \l__iow_newline_tl } + \tl_replace_all:Nnn \l__iow_newline_tl { ~ } { \c_space_tl } + \int_set:Nn \l__iow_target_count_int + { \l_iow_line_count_int - \tl_count:N \l__iow_newline_tl + \c_one } + \int_zero:N \l__iow_current_indentation_int + \tl_clear:N \l__iow_current_indentation_tl + \int_zero:N \l__iow_current_line_int + \tl_clear:N \l__iow_current_line_tl + \bool_set_true:N \l__iow_line_start_bool \use:x { - \iow_wrap_loop:w - \tl_to_str:N \l_iow_wrap_tl - \tl_to_str:N \c_iow_wrap_end_marker_tl + \exp_not:n { \tl_clear:N \l__iow_wrap_tl } + \__iow_wrap_loop:w + \tl_to_str:N \l__iow_wrap_tl + \tl_to_str:N \c__iow_wrap_end_marker_tl \c_space_tl \c_space_tl \exp_not:N \q_stop } \exp_args:NNo \group_end: - #5 \l_iow_wrapped_tl + #4 \l__iow_wrap_tl } -\cs_new_protected:Npn \iow_wrap_loop:w #1 ~ % +\cs_new_protected:Npn \__iow_wrap_loop:w #1 ~ % { - \tl_set:Nn \l_iow_current_word_tl {#1} - \tl_if_eq:NNTF \l_iow_current_word_tl \c_iow_wrap_marker_tl - { \iow_wrap_special:w } - { \iow_wrap_word: } + \tl_set:Nn \l__iow_current_word_tl {#1} + \tl_if_eq:NNTF \l__iow_current_word_tl \c__iow_wrap_marker_tl + { \__iow_wrap_special:w } + { \__iow_wrap_word: } } -\cs_new_protected_nopar:Npn \iow_wrap_word: +\cs_new_protected_nopar:Npn \__iow_wrap_word: { - \int_set:Nn \l_iow_current_word_int - { \str_length_skip_spaces:N \l_iow_current_word_tl } - \int_add:Nn \l_iow_current_line_int { \l_iow_current_word_int } - \int_compare:nNnTF \l_iow_current_line_int < \l_iow_target_length_int - { \iow_wrap_word_fits: } - { \iow_wrap_word_newline: } - \iow_wrap_loop:w + \int_set:Nn \l__iow_current_word_int + { \__str_count_ignore_spaces:N \l__iow_current_word_tl } + \int_add:Nn \l__iow_current_line_int { \l__iow_current_word_int } + \int_compare:nNnTF \l__iow_current_line_int < \l__iow_target_count_int + { \__iow_wrap_word_fits: } + { \__iow_wrap_word_newline: } + \__iow_wrap_loop:w } -\cs_new_protected_nopar:Npn \iow_wrap_word_fits: +\cs_new_protected_nopar:Npn \__iow_wrap_word_fits: { - \bool_if:NTF \l_iow_line_start_bool + \bool_if:NTF \l__iow_line_start_bool { - \bool_set_false:N \l_iow_line_start_bool - \tl_put_right:Nx \l_iow_current_line_tl - { \l_iow_current_indentation_tl \l_iow_current_word_tl } - \int_add:Nn \l_iow_current_line_int - { \l_iow_current_indentation_int } + \bool_set_false:N \l__iow_line_start_bool + \tl_put_right:Nx \l__iow_current_line_tl + { \l__iow_current_indentation_tl \l__iow_current_word_tl } + \int_add:Nn \l__iow_current_line_int + { \l__iow_current_indentation_int } } { - \tl_put_right:Nx \l_iow_current_line_tl - { ~ \l_iow_current_word_tl } - \int_incr:N \l_iow_current_line_int + \tl_put_right:Nx \l__iow_current_line_tl + { ~ \l__iow_current_word_tl } + \int_incr:N \l__iow_current_line_int } } -\cs_new_protected_nopar:Npn \iow_wrap_word_newline: +\cs_new_protected_nopar:Npn \__iow_wrap_word_newline: { - \tl_put_right:Nx \l_iow_wrapped_tl - { \l_iow_current_line_tl \\ } - \int_set:Nn \l_iow_current_line_int + \tl_put_right:Nx \l__iow_wrap_tl + { \l__iow_current_line_tl \l__iow_newline_tl } + \int_set:Nn \l__iow_current_line_int { - \l_iow_current_word_int - + \l_iow_current_indentation_int + \l__iow_current_word_int + + \l__iow_current_indentation_int } - \tl_set:Nx \l_iow_current_line_tl - { \l_iow_current_indentation_tl \l_iow_current_word_tl } + \tl_set:Nx \l__iow_current_line_tl + { \l__iow_current_indentation_tl \l__iow_current_word_tl } } -\cs_new_protected:Npn \iow_wrap_special:w #1 ~ #2 ~ #3 ~ % +\cs_new_protected:Npn \__iow_wrap_special:w #1 ~ #2 ~ #3 ~ % { - \use:c { iow_wrap_#1: } - \str_if_eq:xxTF { #2~#3 } { ~ \c_iow_wrap_marker_tl } - { \iow_wrap_special:w } - { \iow_wrap_loop:w #2 ~ #3 ~ } + \use:c { __iow_wrap_#1: } + \str_if_eq_x:nnTF { #2~#3 } { ~ \c__iow_wrap_marker_tl } + { \__iow_wrap_special:w } + { \__iow_wrap_loop:w #2 ~ #3 ~ } } -\cs_new_protected_nopar:Npn \iow_wrap_newline: +\cs_new_protected_nopar:Npn \__iow_wrap_newline: { - \tl_put_right:Nx \l_iow_wrapped_tl - { \l_iow_current_line_tl \\ } - \int_zero:N \l_iow_current_line_int - \tl_clear:N \l_iow_current_line_tl - \bool_set_true:N \l_iow_line_start_bool + \tl_put_right:Nx \l__iow_wrap_tl + { \l__iow_current_line_tl \l__iow_newline_tl } + \int_zero:N \l__iow_current_line_int + \tl_clear:N \l__iow_current_line_tl + \bool_set_true:N \l__iow_line_start_bool } -\cs_new_protected_nopar:Npx \iow_wrap_indent: +\cs_new_protected_nopar:Npx \__iow_wrap_indent: { - \int_add:Nn \l_iow_current_indentation_int \c_four - \tl_put_right:Nx \exp_not:N \l_iow_current_indentation_tl + \int_add:Nn \l__iow_current_indentation_int \c_four + \tl_put_right:Nx \exp_not:N \l__iow_current_indentation_tl { \c_space_tl \c_space_tl \c_space_tl \c_space_tl } } -\cs_new_protected_nopar:Npn \iow_wrap_unindent: +\cs_new_protected_nopar:Npn \__iow_wrap_unindent: { - \int_sub:Nn \l_iow_current_indentation_int \c_four - \tl_set:Nx \l_iow_current_indentation_tl - { \prg_replicate:nn \l_iow_current_indentation_int { ~ } } + \int_sub:Nn \l__iow_current_indentation_int \c_four + \tl_set:Nx \l__iow_current_indentation_tl + { \prg_replicate:nn \l__iow_current_indentation_int { ~ } } } -\cs_new_protected_nopar:Npn \iow_wrap_end: +\cs_new_protected_nopar:Npn \__iow_wrap_end: { - \tl_put_right:Nx \l_iow_wrapped_tl - { \l_iow_current_line_tl } + \tl_put_right:Nx \l__iow_wrap_tl + { \l__iow_current_line_tl } \use_none_delimit_by_q_stop:w } -\cs_new_nopar:Npn \str_length_skip_spaces:N - { \exp_args:No \str_length_skip_spaces:n } -\cs_new:Npn \str_length_skip_spaces:n #1 +\cs_new_nopar:Npn \__str_count_ignore_spaces:N + { \exp_args:No \__str_count_ignore_spaces:n } +\cs_new:Npn \__str_count_ignore_spaces:n #1 { - \int_value:w \int_eval:w - \exp_after:wN \str_length_loop:NNNNNNNNN \tl_to_str:n {#1} + \__int_value:w \__int_eval:w + \exp_after:wN \__str_count_loop:NNNNNNNNN \tl_to_str:n {#1} { X8 } { X7 } { X6 } { X5 } { X4 } { X3 } { X2 } { X1 } { X0 } \q_stop - \int_eval_end: + \__int_eval_end: } -\cs_new:Npn \str_length_loop:NNNNNNNNN #1#2#3#4#5#6#7#8#9 +\cs_new:Npn \__str_count_loop:NNNNNNNNN #1#2#3#4#5#6#7#8#9 { \if_catcode:w X #9 \exp_after:wN \use_none_delimit_by_q_stop:w \else: 9 + - \exp_after:wN \str_length_loop:NNNNNNNNN + \exp_after:wN \__str_count_loop:NNNNNNNNN \fi: } -\cs_new_eq:NN \if_eof:w \tex_ifeof:D -\prg_new_conditional:Nnn \ior_if_eof:N { p , T , F , TF } - { - \cs_if_exist:NTF #1 - { - \if_int_compare:w #1 = \c_sixteen - \prg_return_true: - \else: - \if_eof:w #1 - \prg_return_true: - \else: - \prg_return_false: - \fi: - \fi: - } - { \prg_return_true: } - } -\cs_new_protected:Npn \ior_to:NN #1#2 - { \tex_read:D #1 to #2 } -\cs_new_protected:Npn \ior_gto:NN #1#2 - { \tex_global:D \tex_read:D #1 to #2 } -\cs_new_protected:Npn \ior_str_to:NN #1#2 - { \etex_readline:D #1 to #2 } -\cs_new_protected:Npn \ior_str_gto:NN #1#2 - { \tex_global:D \etex_readline:D #1 to #2 } -\cs_new_protected_nopar:Npn \ior_map_inline:Nn - { \ior_map_inline_aux:NNn \ior_to:NN } -\cs_new_protected_nopar:Npn \ior_str_map_inline:Nn - { \ior_map_inline_aux:NNn \ior_str_to:NN } -\cs_new_protected_nopar:Npn \ior_map_inline_aux:NNn - { - \exp_args:Nc \ior_map_inline_aux:NNNn - { ior_map_ \int_use:N \g_prg_map_int :n } - } -\cs_new_protected:Npn \ior_map_inline_aux:NNNn #1#2#3#4 +\__msg_kernel_new:nnnn { kernel } { file-not-found } + { File~'#1'~not~found. } { - \cs_set:Npn #1 ##1 {#4} - \int_gincr:N \g_prg_map_int - \ior_if_eof:NF #3 { \ior_map_inline_loop:NNN #1#2#3 } - \prg_break_point:n { \int_gdecr:N \g_prg_map_int } + The~requested~file~could~not~be~found~in~the~current~directory,~ + in~the~TeX~search~path~or~in~the~LaTeX~search~path. } -\cs_new_protected:Npn \ior_map_inline_loop:NNN #1#2#3 +\__msg_kernel_new:nnnn { kernel } { input-streams-exhausted } + { Input~streams~exhausted } { - #2 #3 \l_ior_internal_tl - \ior_if_eof:NF #3 - { - \exp_args:No #1 \l_ior_internal_tl - \ior_map_inline_loop:NNN #1#2#3 - } + TeX~can~only~open~up~to~16~input~streams~at~one~time.\\ + All~16~are~currently~in~use,~and~something~wanted~to~open~ + another~one. } -\tl_new:N \l_ior_internal_tl -\msg_kernel_new:nnnn { file } { file-not-found } - { File~'#1'~not~found. } +\__msg_kernel_new:nnnn { kernel } { output-streams-exhausted } + { Output~streams~exhausted } { - The~requested~file~could~not~be~found~in~the~current~directory,~ - in~the~TeX~search~path~or~in~the~LaTeX~search~path. + TeX~can~only~open~up~to~16~output~streams~at~one~time.\\ + All~16~are~currently~in~use,~and~something~wanted~to~open~ + another~one. } -\msg_kernel_new:nnnn { file } { space-in-file-name } +\__msg_kernel_new:nnnn { kernel } { space-in-file-name } { Space~in~file~name~'#1'. } { Spaces~are~not~permitted~in~files~loaded~by~LaTeX: \\ Further~errors~may~follow! } -\cs_new_protected:Npn \iow_now_when_avail:Nn #1 - { \cs_if_free:NTF #1 { \use_none:n } { \iow_now:Nn #1 } } -\cs_new_protected:Npn \iow_now_when_avail:Nx #1 - { \cs_if_free:NTF #1 { \use_none:n } { \iow_now:Nx #1 } } +\cs_new_protected:Npn \iow_wrap:xnnnN #1#2#3#4#5 + { \iow_wrap:nnnN {#1} {#2} {#4} #5 } +\cs_new_eq:NN \l_iow_line_length_int \l_iow_line_count_int +\cs_new_eq:NN \ior_to:NN \ior_get:NN +\cs_new_protected_nopar:Npn \ior_gto:NN { \tex_global:D \ior_to:NN } +\cs_new_eq:NN \ior_str_to:NN \ior_get_str:NN +\cs_new_protected_nopar:Npn \ior_str_gto:NN { \tex_global:D \ior_str_to:NN } %% %% %% End of file `l3file.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3fp.sty b/Master/texmf-dist/tex/latex/l3kernel/l3fp.sty index bb38caa64f6..a7680dc7803 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3fp.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3fp.sty @@ -5,6 +5,18 @@ %% The original source files were: %% %% l3fp.dtx (with options: `package') +%% l3fp-aux.dtx (with options: `package') +%% l3fp-traps.dtx (with options: `package') +%% l3fp-round.dtx (with options: `package') +%% l3fp-parse.dtx (with options: `package') +%% l3fp-logic.dtx (with options: `package') +%% l3fp-basics.dtx (with options: `package') +%% l3fp-extended.dtx (with options: `package') +%% l3fp-expo.dtx (with options: `package') +%% l3fp-trig.dtx (with options: `package') +%% l3fp-convert.dtx (with options: `package') +%% l3fp-assign.dtx (with options: `package') +%% l3fp-old.dtx (with options: `package') %% %% EXPERIMENTAL CODE %% @@ -13,7 +25,7 @@ %% %% Do not distribute a modified version of this file. %% -%% File: l3fp.dtx Copyright (C) 2010-2012 The LaTeX3 Project +%% File: l3fp.dtx Copyright (C) 2011-2012 The 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 @@ -42,3386 +54,4527 @@ %% Snapshots taken from the repository represent work in progress and may %% not work or may contain conflicting material! We therefore ask %% people _not_ to put them into distributions, archives, etc. without -%% prior consultation with the LaTeX3 Project. +%% prior consultation with the LaTeX3 Project Team. %% %% ----------------------------------------------------------------------- +%% \RequirePackage{l3names} -\GetIdInfo$Id: l3fp.dtx 3490 2012-03-04 01:00:53Z bruno $ - {L3 Experimental floating-point operations} +\GetIdInfo$Id: l3fp.dtx 3986 2012-07-15 19:23:51Z joseph $ + {L3 Floating points} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\package_check_loaded_expl: -\int_const:Nn \c_forty_four { 44 } -\int_const:Nn \c_one_million { 1 000 000 } -\int_const:Nn \c_one_hundred_million { 100 000 000 } -\int_const:Nn \c_five_hundred_million { 500 000 000 } -\int_const:Nn \c_one_thousand_million { 1 000 000 000 } -\int_new:N \c_fp_pi_by_four_decimal_int -\int_set:Nn \c_fp_pi_by_four_decimal_int { 785 398 158 } -\int_new:N \c_fp_pi_by_four_extended_int -\int_set:Nn \c_fp_pi_by_four_extended_int { 897 448 310 } -\int_new:N \c_fp_pi_decimal_int -\int_set:Nn \c_fp_pi_decimal_int { 141 592 653 } -\int_new:N \c_fp_pi_extended_int -\int_set:Nn \c_fp_pi_extended_int { 589 793 238 } -\int_new:N \c_fp_two_pi_decimal_int -\int_set:Nn \c_fp_two_pi_decimal_int { 283 185 307 } -\int_new:N \c_fp_two_pi_extended_int -\int_set:Nn \c_fp_two_pi_extended_int { 179 586 477 } -\tl_const:Nn \c_e_fp { + 2.718281828 e 0 } -\tl_const:Nn \c_one_fp { + 1.000000000 e 0 } -\tl_const:Nn \c_pi_fp { + 3.141592654 e 0 } -\tl_const:Nn \c_undefined_fp { X 0.000000000 e 0 } -\tl_const:Nn \c_zero_fp { + 0.000000000 e 0 } -\tl_new:N \l_fp_arg_tl -\int_new:N \l_fp_count_int -\int_new:N \l_fp_div_offset_int -\int_new:N \l_fp_exp_integer_int -\int_new:N \l_fp_exp_decimal_int -\int_new:N \l_fp_exp_extended_int -\int_new:N \l_fp_exp_exponent_int -\int_new:N \l_fp_input_a_sign_int -\int_new:N \l_fp_input_a_integer_int -\int_new:N \l_fp_input_a_decimal_int -\int_new:N \l_fp_input_a_exponent_int -\int_new:N \l_fp_input_b_sign_int -\int_new:N \l_fp_input_b_integer_int -\int_new:N \l_fp_input_b_decimal_int -\int_new:N \l_fp_input_b_exponent_int -\int_new:N \l_fp_input_a_extended_int -\int_new:N \l_fp_input_b_extended_int -\int_new:N \l_fp_mul_a_i_int -\int_new:N \l_fp_mul_a_ii_int -\int_new:N \l_fp_mul_a_iii_int -\int_new:N \l_fp_mul_a_iv_int -\int_new:N \l_fp_mul_a_v_int -\int_new:N \l_fp_mul_a_vi_int -\int_new:N \l_fp_mul_b_i_int -\int_new:N \l_fp_mul_b_ii_int -\int_new:N \l_fp_mul_b_iii_int -\int_new:N \l_fp_mul_b_iv_int -\int_new:N \l_fp_mul_b_v_int -\int_new:N \l_fp_mul_b_vi_int -\int_new:N \l_fp_mul_output_int -\tl_new:N \l_fp_mul_output_tl -\int_new:N \l_fp_output_sign_int -\int_new:N \l_fp_output_integer_int -\int_new:N \l_fp_output_decimal_int -\int_new:N \l_fp_output_exponent_int -\int_new:N \l_fp_output_extended_int -\bool_new:N \l_fp_round_carry_bool -\tl_new:N \l_fp_round_decimal_tl -\int_new:N \l_fp_round_position_int -\int_new:N \l_fp_round_target_int -\tl_new:N \l_fp_sign_tl -\int_new:N \l_fp_split_sign_int -\int_new:N \l_fp_internal_int -\tl_new:N \l_fp_internal_tl -\int_new:N \l_fp_trig_octant_int -\int_new:N \l_fp_trig_sign_int -\int_new:N \l_fp_trig_decimal_int -\int_new:N \l_fp_trig_extended_int -\cs_new_protected:Npn \fp_read:N #1 - { \exp_after:wN \fp_read_aux:w #1 \q_stop } -\cs_new_protected:Npn \fp_read_aux:w #1#2 . #3 e #4 \q_stop - { - \if:w #1 - - \l_fp_input_a_sign_int \c_minus_one - \else: - \l_fp_input_a_sign_int \c_one - \fi: - \l_fp_input_a_integer_int #2 \scan_stop: - \l_fp_input_a_decimal_int #3 \scan_stop: - \l_fp_input_a_exponent_int #4 \scan_stop: - } -\cs_new_protected:Npn \fp_split:Nn #1#2 - { - \tl_set:Nx \l_fp_internal_tl {#2} - \tl_set_rescan:Nno \l_fp_internal_tl { \char_set_catcode_ignore:n { 32 } } - { \l_fp_internal_tl } - \l_fp_split_sign_int \c_one - \fp_split_sign: - \use:c { l_fp_input_ #1 _sign_int } \l_fp_split_sign_int - \exp_after:wN \fp_split_exponent:w \l_fp_internal_tl e e \q_stop #1 - } -\cs_new_protected_nopar:Npn \fp_split_sign: - { - \if_int_compare:w \pdftex_strcmp:D - { \exp_after:wN \tl_head:w \l_fp_internal_tl ? \q_stop } { - } - = \c_zero - \tl_set:Nx \l_fp_internal_tl - { - \exp_after:wN - \tl_tail:w \l_fp_internal_tl \prg_do_nothing: \q_stop - } - \l_fp_split_sign_int -\l_fp_split_sign_int - \exp_after:wN \fp_split_sign: +\__expl_package_check: +%% File: l3fp-aux.dtx Copyright(C) 2011-2012 The 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 +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% 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. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +\cs_new:Npn \__fp_use_none_stop_f:n #1 { \exp_stop_f: } +\cs_new:Npn \__fp_use_s:n #1 { #1; } +\cs_new:Npn \__fp_use_s:nn #1#2 { #1#2; } +\cs_new:Npn \__fp_use_none_until_s:w #1; { } +\cs_new:Npn \__fp_use_i_until_s:nw #1#2; {#1} +\cs_new:Npn \__fp_use_ii_until_s:nnw #1#2#3; {#2} +\cs_new:Npn \__fp_reverse_args:Nww #1 #2; #3; { #1 #3; #2; } +\__scan_new:N \s__fp +\cs_new_protected:Npn \__fp_chk:w #1 ; + { + \__msg_kernel_error:nnx { kernel } { misused-fp } + { \__fp_to_tl:w \s__fp \__fp_chk:w #1 ; } + } +\__scan_new:N \s__fp_mark +\__scan_new:N \s__fp_stop +\__scan_new:N \s__fp_invalid +\__scan_new:N \s__fp_underflow +\__scan_new:N \s__fp_overflow +\__scan_new:N \s__fp_division +\__scan_new:N \s__fp_exact +\tl_const:Nn \c_zero_fp { \s__fp \__fp_chk:w 0 0 \s__fp_exact ; } +\tl_const:Nn \c_minus_zero_fp { \s__fp \__fp_chk:w 0 2 \s__fp_exact ; } +\tl_const:Nn \c_inf_fp { \s__fp \__fp_chk:w 2 0 \s__fp_exact ; } +\tl_const:Nn \c_minus_inf_fp { \s__fp \__fp_chk:w 2 2 \s__fp_exact ; } +\tl_const:Nn \c_nan_fp { \s__fp \__fp_chk:w 3 1 \s__fp_exact ; } +\int_const:Nn \c__fp_max_exponent_int { 10000 } +\cs_new:Npn \__fp_zero_fp:N #1 { \s__fp \__fp_chk:w 0 #1 \s__fp_underflow ; } +\cs_new:Npn \__fp_inf_fp:N #1 { \s__fp \__fp_chk:w 2 #1 \s__fp_overflow ; } +\cs_new:Npn \__fp_min_fp:N #1 + { + \s__fp \__fp_chk:w 1 #1 + { \int_eval:n { - \c__fp_max_exponent_int } } + {1000} {0000} {0000} {0000} ; + } +\cs_new:Npn \__fp_max_fp:N #1 + { + \s__fp \__fp_chk:w 1 #1 + { \int_use:N \c__fp_max_exponent_int } + {9999} {9999} {9999} {9999} ; + } +\cs_new:Npn \__fp_exponent:w \s__fp \__fp_chk:w #1 + { + \if_meaning:w 1 #1 + \exp_after:wN \__fp_use_ii_until_s:nnw \else: - \if_int_compare:w \pdftex_strcmp:D - { \exp_after:wN \tl_head:w \l_fp_internal_tl ? \q_stop } { + } - = \c_zero - \tl_set:Nx \l_fp_internal_tl - { - \exp_after:wN - \tl_tail:w \l_fp_internal_tl \prg_do_nothing: \q_stop - } - \exp_after:wN \exp_after:wN \exp_after:wN \fp_split_sign: - \fi: + \exp_after:wN \__fp_use_i_until_s:nw + \exp_after:wN 0 \fi: } -\cs_new_protected:Npn \fp_split_exponent:w #1 e #2 e #3 \q_stop #4 +\cs_new:Npn \__fp_sanitize:Nw #1 #2; { - \use:c { l_fp_input_ #4 _exponent_int } - \int_eval:w 0 #2 \scan_stop: - \tex_afterassignment:D \fp_split_aux_i:w - \use:c { l_fp_input_ #4 _integer_int } - \int_eval:w 0 #1 . . \q_stop #4 + \if_case:w \if_int_compare:w #2 > \c__fp_max_exponent_int \c_one \else: + \if_int_compare:w #2 < - \c__fp_max_exponent_int \c_two \else: + \if_meaning:w 1 #1 \c_three \else: \c_zero \fi: \fi: \fi: + \or: \exp_after:wN \__fp_overflow:w + \or: \exp_after:wN \__fp_underflow:w + \or: \exp_after:wN \__fp_sanitize_zero:w + \fi: + \s__fp \__fp_chk:w 1 #1 {#2} } -\cs_new_protected:Npn \fp_split_aux_i:w #1 . #2 . #3 \q_stop - { \fp_split_aux_ii:w #2 000000000 \q_stop } -\cs_new_protected:Npn \fp_split_aux_ii:w #1#2#3#4#5#6#7#8#9 - { \fp_split_aux_iii:w {#1#2#3#4#5#6#7#8#9} } -\cs_new_protected:Npn \fp_split_aux_iii:w #1#2 \q_stop +\cs_new:Npn \__fp_sanitize:wN #1; #2 { \__fp_sanitize:Nw #2 #1; } +\cs_new:Npn \__fp_sanitize_zero:w \s__fp \__fp_chk:w #1 #2 #3; { \c_zero_fp } +\cs_new:Npn \__fp_exp_after_o:w \s__fp \__fp_chk:w #1 { - \l_fp_internal_int 1 #1 \scan_stop: - \exp_after:wN \fp_split_decimal:w - \int_use:N \l_fp_internal_int 000000000 \q_stop + \if_meaning:w 1 #1 + \exp_after:wN \__fp_exp_after_normal:nNNw + \else: + \exp_after:wN \__fp_exp_after_special:nNNw + \fi: + { } + #1 } -\cs_new_protected:Npn \fp_split_decimal:w #1#2#3#4#5#6#7#8#9 - { \fp_split_decimal_aux:w {#2#3#4#5#6#7#8#9} } -\cs_new_protected:Npn \fp_split_decimal_aux:w #1#2#3 \q_stop #4 +\cs_new:Npn \__fp_exp_after_o:nw #1 \s__fp \__fp_chk:w #2 { - \use:c { l_fp_input_ #4 _decimal_int } #1#2 \scan_stop: - \if_int_compare:w - \int_eval:w - \use:c { l_fp_input_ #4 _integer_int } + - \use:c { l_fp_input_ #4 _decimal_int } - \scan_stop: - = \c_zero - \use:c { l_fp_input_ #4 _sign_int } \c_one + \if_meaning:w 1 #2 + \exp_after:wN \__fp_exp_after_normal:nNNw + \else: + \exp_after:wN \__fp_exp_after_special:nNNw \fi: - \if_int_compare:w - \use:c { l_fp_input_ #4 _integer_int } < \c_one_thousand_million + { #1 } + #2 + } +\cs_new:Npn \__fp_exp_after_f:nw #1 \s__fp \__fp_chk:w #2 + { + \if_meaning:w 1 #2 + \exp_after:wN \__fp_exp_after_normal:nNNw \else: - \exp_after:wN \fp_overflow_msg: + \exp_after:wN \__fp_exp_after_special:nNNw \fi: + { \tex_romannumeral:D -`0 #1 } + #2 } -\cs_new_protected:Npn \fp_standardise:NNNN #1#2#3#4 +\cs_new:Npn \__fp_exp_after_special:nNNw #1#2#3#4; { - \if_int_compare:w - \int_eval:w #2 + #3 = \c_zero - #1 \c_one - #4 \c_zero - \exp_after:wN \use_none:nnnn + \exp_after:wN \s__fp + \exp_after:wN \__fp_chk:w + \exp_after:wN #2 + \exp_after:wN #3 + \exp_after:wN #4 + \exp_after:wN ; + #1 + } +\cs_new:Npn \__fp_exp_after_normal:nNNw #1 1 #2 #3 #4#5#6#7; + { + \exp_after:wN \__fp_exp_after_normal:Nwwwww + \exp_after:wN #2 + \__int_value:w #3 \exp_after:wN ; + \__int_value:w 1 #4 \exp_after:wN ; + \__int_value:w 1 #5 \exp_after:wN ; + \__int_value:w 1 #6 \exp_after:wN ; + \__int_value:w 1 #7 \exp_after:wN ; #1 + } +\cs_new:Npn \__fp_exp_after_normal:Nwwwww + #1 #2; 1 #3 ; 1 #4 ; 1 #5 ; 1 #6 ; + { \s__fp \__fp_chk:w 1 #1 {#2} {#3} {#4} {#5} {#6} ; } +\int_const:Nn \c__fp_leading_shift_int { - 5 0000 } +\int_const:Nn \c__fp_middle_shift_int { 5 0000 * 9999 } +\int_const:Nn \c__fp_trailing_shift_int { 5 0000 * 10000 } +\cs_new:Npn \__fp_pack:NNNNNw #1 #2#3#4#5 #6; { + #1#2#3#4#5 ; {#6} } +\int_const:Nn \c__fp_big_leading_shift_int { - 15 2374 } +\int_const:Nn \c__fp_big_middle_shift_int { 15 2374 * 9999 } +\int_const:Nn \c__fp_big_trailing_shift_int { 15 2374 * 10000 } +\cs_new:Npn \__fp_pack_big:NNNNNNw #1#2 #3#4#5#6 #7; + { + #1#2#3#4#5#6 ; {#7} } +\cs_new:Npn \__fp_pack_twice_four:wNNNNNNNN #1; #2#3#4#5 #6#7#8#9 + { #1 {#2#3#4#5} {#6#7#8#9} ; } +\cs_new:Npn \__fp_decimate:nNnnnn #1 + { + \cs:w + __fp_decimate_ + \if_int_compare:w \__int_eval:w #1 > \c_sixteen + tiny + \else: + \tex_romannumeral:D \__int_eval:w #1 + \fi: + :Nnnnn + \cs_end: + } +\cs_new:Npn \__fp_decimate_:Nnnnn #1 #2#3#4#5 + { #1 0 {#2#3} {#4#5} ; } +\cs_new:Npn \__fp_decimate_tiny:Nnnnn #1 #2#3#4#5 + { #1 1 { 0000 0000 } { 0000 0000 } 0 #2#3#4#5 ; } +\cs_new:Npn \__fp_tmp:w #1 #2 #3 + { + \cs_new:cpn { __fp_decimate_ #1 :Nnnnn } ##1 ##2##3##4##5 + { + \exp_after:wN ##1 + \__int_value:w + \exp_after:wN \__fp_decimate_round:Nw #2 ; + \__fp_decimate_pack:nnnnnnnnnnw #3 ; + } + } +\__fp_tmp:w {i} {\use_none:nnn #50} { 0{#2}#3{#4}#5 } +\__fp_tmp:w {ii} {\use_none:nn #5 } { 00{#2}#3{#4}#5 } +\__fp_tmp:w {iii} {\use_none:n #5 } { 000{#2}#3{#4}#5 } +\__fp_tmp:w {iv} { #5 } { {0000}#2{#3}#4 #5 } +\__fp_tmp:w {v} {\use_none:nnn #4#5 } { 0{0000}#2{#3}#4 #5 } +\__fp_tmp:w {vi} {\use_none:nn #4#5 } { 00{0000}#2{#3}#4 #5 } +\__fp_tmp:w {vii} {\use_none:n #4#5 } { 000{0000}#2{#3}#4 #5 } +\__fp_tmp:w {viii}{ #4#5 } { {0000}0000{#2}#3 #4 #5 } +\__fp_tmp:w {ix} {\use_none:nnn #3#4+#5} { 0{0000}0000{#2}#3 #4 #5 } +\__fp_tmp:w {x} {\use_none:nn #3#4+#5} { 00{0000}0000{#2}#3 #4 #5 } +\__fp_tmp:w {xi} {\use_none:n #3#4+#5} { 000{0000}0000{#2}#3 #4 #5 } +\__fp_tmp:w {xii} { #3#4+#5} { {0000}0000{0000}#2 #3 #4 #5 } +\__fp_tmp:w {xiii}{\use_none:nnn#2#3+#4#5} { 0{0000}0000{0000}#2 #3 #4 #5 } +\__fp_tmp:w {xiv} {\use_none:nn #2#3+#4#5} { 00{0000}0000{0000}#2 #3 #4 #5 } +\__fp_tmp:w {xv} {\use_none:n #2#3+#4#5} { 000{0000}0000{0000}#2 #3 #4 #5 } +\__fp_tmp:w {xvi} { #2#3+#4#5} {{0000}0000{0000}0000 #2 #3 #4 #5 } +\cs_new:Npn \__fp_decimate_round:Nw #1 #2; + { + \if_int_odd:w \if_meaning:w 0 #1 \c_one \else: + \if_meaning:w 5 #1 \c_one \else: + \c_zero \fi: \fi: + \if_int_compare:w \__int_eval:w #2 > \c_zero + \__int_eval:w 1 + + \fi: + \fi: + #1 + } +\cs_new:Npn \__fp_decimate_pack:nnnnnnnnnnw #1#2#3#4#5 + { \__fp_decimate_pack_ii:nnnnnnw { #1#2#3#4#5 } } +\cs_new:Npn \__fp_decimate_pack_ii:nnnnnnw #1 #2#3#4#5#6 + { {#1} {#2#3#4#5#6} } +\cs_new:Npn \__fp_case_use:nw #1#2 \fi: #3 \s__fp { \fi: #1 \s__fp } +\cs_new:Npn \__fp_case_return:nw #1#2 \fi: #3 ; { \fi: #1 } +\cs_new:Npn \__fp_case_return_o:Nw #1#2 \fi: #3 \s__fp #4 ; + { \fi: \exp_after:wN #1 } +\cs_new:Npn \__fp_case_return_same_o:w #1 \fi: #2 \s__fp + { \fi: \__fp_exp_after_o:w \s__fp } +\cs_new:Npn \__fp_case_return_o:Nww #1#2 \fi: #3 \s__fp #4 ; #5 ; + { \fi: \exp_after:wN #1 } +\cs_new:Npn \__fp_case_return_ii_o:ww #1 \fi: #2 \s__fp #3 ; + { \fi: \__fp_exp_after_o:w } +\cs_new:Npn \__fp_small_int:wTF \s__fp \__fp_chk:w #1 + { + \if_case:w #1 \exp_stop_f: + \__fp_case_return:nw { \__fp_small_int_true:wTF 0 ; } + \or: \exp_after:wN \__fp_small_int_normal:NnwTF + \else: \__fp_case_return:nw \use_ii:nn + \fi: + } +\cs_new:Npn \__fp_small_int_true:wTF #1; #2#3 { #2 {#1} } +\cs_new:Npn \__fp_small_int_normal:NnwTF #1#2#3; + { + \if_int_compare:w #2 > \c_zero + \if_int_compare:w #2 > \c_eight + \exp_after:wN \exp_after:wN + \exp_after:wN \use_iii:nnn + \else: + \__fp_decimate:nNnnnn { \c_sixteen - #2 } + \__fp_small_int_test:NnnwNTF + #3 #1 + \fi: + \else: + \exp_after:wN \use_iii:nnn + \fi: + ; + } +\cs_new:Npn \__fp_small_int_test:NnnwNTF #1#2#3#4; #5 + { + \if_meaning:w 0 #1 + \exp_after:wN \__fp_small_int_true:wTF + \__int_value:w \if_meaning:w 2 #5 - \fi: #3 \else: - \exp_after:wN \fp_standardise_aux:NNNN + \exp_after:wN \use_iii:nnn \fi: - #1#2#3#4 } -\cs_new_protected:Npn \fp_standardise_aux:NNNN #1#2#3#4 +\cs_new:Npn \__fp_array_count:w #1 @ { - \cs_set_protected_nopar:Npn \fp_standardise_aux: + \int_use:N \__int_eval:w \c_zero + \__fp_array_count_loop:Nw #1 { ? \__prg_break: } ; + \__prg_break_point: + \__int_eval_end: + } +\cs_new:Npn \__fp_array_count_loop:Nw #1#2; + { \use_none:n #1 + \c_one \__fp_array_count_loop:Nw } +\__msg_kernel_new:nnnn { kernel } { misused-fp } + { A~floating~point~with~value~'#1'~was~misused. } + { + To~obtain~the~value~of~a~floating~point~variable,~use~ + '\token_to_str:N \fp_to_decimal:N',~ + '\token_to_str:N \fp_to_scientific:N',~or~other~ + conversion~functions. + } +%% +%% File: l3fp-traps.dtx Copyright (C) 2011-2012 The 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 +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% 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. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +\cs_new_protected:Npn \__fp_flag_off:n #1 + { \cs_set_eq:cN { l__fp_ #1 _flag_token } \c_undefined:D } +\cs_new:Npn \__fp_flag_on:n #1 + { \exp_args:Nc \use_none:n { l__fp_ #1 _flag_token } } +\prg_new_conditional:Npnn \__fp_if_flag_on:n #1 { p , T , F , TF } + { + \if_cs_exist:w l__fp_ #1 _flag_token \cs_end: + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\cs_new_eq:NN \l__fp_invalid_operation_flag_token \c_undefined:D +\cs_new_eq:NN \l__fp_division_by_zero_flag_token \c_undefined:D +\cs_new_eq:NN \l__fp_overflow_flag_token \c_undefined:D +\cs_new_eq:NN \l__fp_underflow_flag_token \c_undefined:D +\cs_new_protected:Npn \__fp_trap:nn #1#2 + { + \cs_if_exist_use:cF { __fp_trap_#1_set_#2: } { - \if_int_compare:w #2 = \c_zero - \tex_advance:D #3 \c_one_thousand_million - \exp_after:wN \fp_standardise_aux:w - \int_use:N #3 \q_stop - \exp_after:wN \fp_standardise_aux: - \fi: + \clist_if_in:nnTF + { invalid_operation , division_by_zero , overflow , underflow } + {#1} + { + \__msg_kernel_error:nnxx { kernel } + { unknown-fpu-trap-type } {#1} {#2} + } + { \__msg_kernel_error:nnx { kernel } { unknown-fpu-exception } {#1} } } - \cs_set_protected:Npn - \fp_standardise_aux:w ##1##2##3##4##5##6##7##8##9 \q_stop + } +\cs_new_protected_nopar:Npn \__fp_trap_invalid_operation_set_error: + { \__fp_trap_invalid_operation_set:N \prg_do_nothing: } +\cs_new_protected_nopar:Npn \__fp_trap_invalid_operation_set_flag: + { \__fp_trap_invalid_operation_set:N \use_none:nn } +\cs_new_protected_nopar:Npn \__fp_trap_invalid_operation_set_none: + { \__fp_trap_invalid_operation_set:N \use_none:nnnn } +\cs_new_protected:Npn \__fp_trap_invalid_operation_set:N #1 + { + \__fp_trap_invalid_operation_set:Nnn #1 + { invalid_operation } { Invalid~operation~ } + } +\cs_new_protected_nopar:Npn \__fp_trap_division_by_zero_set_error: + { \__fp_trap_division_by_zero_set:N \prg_do_nothing: } +\cs_new_protected_nopar:Npn \__fp_trap_division_by_zero_set_flag: + { \__fp_trap_division_by_zero_set:N \use_none:nn } +\cs_new_protected_nopar:Npn \__fp_trap_division_by_zero_set_none: + { \__fp_trap_division_by_zero_set:N \use_none:nnnn } +\cs_new_protected:Npn \__fp_trap_division_by_zero_set:N #1 + { + \__fp_trap_invalid_operation_set:Nnn #1 + { division_by_zero } { Division~by~zero~in~ } + } +\cs_new_protected:Npn \__fp_trap_invalid_operation_set:Nnn #1#2#3 + { + \exp_args:Nno \use:n + { \cs_set:cpn { __fp_ #2 :Nnw } ##1##2##3; } { - #2 ##2 \scan_stop: - #3 ##3##4##5##6##7##8##9 0 \scan_stop: - \tex_advance:D #4 \c_minus_one + #1 + \__fp_error:x { { #3 ##2 } ( \__fp_to_tl:w ##3; ) } + \__fp_flag_on:n {#2} + \exp_after:wN ##1 } - \fp_standardise_aux: - \cs_set_protected_nopar:Npn \fp_standardise_aux: + \exp_args:Nno \use:n + { \cs_set:cpn { __fp_ #2 :Nnww } ##1##2##3; ##4; } { - \if_int_compare:w #2 > \c_nine - \tex_advance:D #2 \c_one_thousand_million - \exp_after:wN \use_i:nn \exp_after:wN - \fp_standardise_aux:w \int_use:N #2 - \exp_after:wN \fp_standardise_aux: - \fi: + #1 + \__fp_error:x + { + {#3} + \tl_if_single:nTF {##2} + { ( \__fp_to_tl:w ##3; ) ##2 ( \__fp_to_tl:w ##4; ) } + { { ##2 ( } \__fp_to_tl:w ##3; { , ~ } \__fp_to_tl:w ##4; ) } + } + \__fp_flag_on:n {#2} + \exp_after:wN ##1 } - \cs_set_protected:Npn - \fp_standardise_aux:w ##1##2##3##4##5##6##7##8##9 + } +\cs_new_protected_nopar:Npn \__fp_trap_overflow_set_error: + { \__fp_trap_overflow_set:N \prg_do_nothing: } +\cs_new_protected_nopar:Npn \__fp_trap_overflow_set_flag: + { \__fp_trap_overflow_set:N \use_none:nn } +\cs_new_protected_nopar:Npn \__fp_trap_overflow_set_none: + { \__fp_trap_overflow_set:N \use_none:nnnn } +\cs_new_protected:Npn \__fp_trap_overflow_set:N #1 + { \__fp_trap_overflow_set:NnNn #1 { overflow } \__fp_inf_fp:N { inf } } +\cs_new_protected_nopar:Npn \__fp_trap_underflow_set_error: + { \__fp_trap_underflow_set:N \prg_do_nothing: } +\cs_new_protected_nopar:Npn \__fp_trap_underflow_set_flag: + { \__fp_trap_underflow_set:N \use_none:nn } +\cs_new_protected_nopar:Npn \__fp_trap_underflow_set_none: + { \__fp_trap_underflow_set:N \use_none:nnnn } +\cs_new_protected:Npn \__fp_trap_underflow_set:N #1 + { \__fp_trap_overflow_set:NnNn #1 { underflow } \__fp_zero_fp:N { 0 } } +\cs_new_protected:Npn \__fp_trap_overflow_set:NnNn #1#2#3#4 + { + \exp_args:Nno \use:n + { \cs_set:cpn { __fp_ #2 :w } \s__fp \__fp_chk:w ##1##2##3; } { - #2 ##1##2##3##4##5##6##7##8 \scan_stop: - \tex_advance:D #3 \c_one_thousand_million - \tex_divide:D #3 \c_ten - \tl_set:Nx \l_fp_internal_tl + #1 + \__fp_error:x { - ##9 - \exp_after:wN \use_none:n \int_use:N #3 + \token_if_eq_meaning:NNTF 1 ##1 + { + \__fp_to_tl:w \s__fp \__fp_chk:w ##1##2##3; ~ #2 ed ~ to ~ + \token_if_eq_meaning:NNF 0 ##2 { - } #4 . + } + { An~#2~occurred. } } - #3 \l_fp_internal_tl \scan_stop: - \tex_advance:D #4 \c_one + \__fp_flag_on:n {#2} + #3 ##2 } - \fp_standardise_aux: - \if_int_compare:w #4 < \c_one_hundred - \if_int_compare:w #4 > -\c_one_hundred - \else: - #1 \c_one - #2 \c_zero - #3 \c_zero - #4 \c_zero + } +\cs_new_protected_nopar:Npn \__fp_invalid_operation:Nnw { } +\cs_new_protected_nopar:Npn \__fp_invalid_operation:Nnww { } +\cs_new_protected_nopar:Npn \__fp_division_by_zero:Nnw { } +\cs_new_protected_nopar:Npn \__fp_division_by_zero:Nnww { } +\cs_new_protected_nopar:Npn \__fp_overflow:w { } +\cs_new_protected_nopar:Npn \__fp_underflow:w { } +\__fp_trap:nn { invalid_operation } { error } +\__fp_trap:nn { division_by_zero } { flag } +\__fp_trap:nn { overflow } { flag } +\__fp_trap:nn { underflow } { flag } +\cs_new_eq:NN \__fp_error:n \__msg_expandable_error:n +\cs_new:Npn \__fp_error:x #1 + { + \exp_args:Nf \__msg_expandable_error:n + { + \__fp_error_loop:nwnN { \exp_stop_f: } #1 \prg_do_nothing: + \s__fp_mark { } \__fp_error_loop:nwnN \s__fp_mark { } \__fp_error_end:nw + } + } +\cs_new:Npn \__fp_error_end:nw #1#2 \__fp_error_end:nw { #1 } +\cs_new:Npn \__fp_error_loop:nwnN #1#2 \s__fp_mark #3 #4 + { + \exp_after:wN #4 \tex_romannumeral:D -`0 + #2 + \s__fp_mark { #3 #1 } #4 + } +\msg_new:nnnn { kernel } { unknown-fpu-exception } + { The~FPU~exception~'#1'~is~not~known:~that~trap~will~never~be~triggered. } + { + The~only~exceptions~to~which~traps~can~be~attached~are \\ + \iow_indent:n + { + * ~ invalid_operation \\ + * ~ division_by_zero \\ + * ~ overflow \\ + * ~ underflow + } + } +\msg_new:nnnn { kernel } { unknown-fpu-trap-type } + { The~FPU~trap~type~'#2'~is~not~known. } + { + The~trap~type~must~be~one~of \\ + \iow_indent:n + { + * ~ error \\ + * ~ flag \\ + * ~ none + } + } +%% File: l3fp-round.dtx Copyright(C) 2011-2012 The 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 +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% 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. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +\cs_new:Npn \__fp_round_return_one: + { \exp_after:wN \c_one \tex_romannumeral:D } +\cs_new:Npn \__fp_round_to_ninf:NNN #1 #2 #3 + { + \if_meaning:w 2 #1 + \if_int_compare:w #3 > \c_zero + \__fp_round_return_one: \fi: - \else: - \exp_after:wN \fp_overflow_msg: \fi: + \c_zero } -\cs_new_protected_nopar:Npn \fp_standardise_aux: { } -\cs_new_protected_nopar:Npn \fp_standardise_aux:w { } -\cs_new_protected_nopar:Npn \fp_level_input_exponents: +\cs_new:Npn \__fp_round_to_zero:NNN #1 #2 #3 { \c_zero } +\cs_new:Npn \__fp_round_to_pinf:NNN #1 #2 #3 { - \if_int_compare:w \l_fp_input_a_exponent_int > \l_fp_input_b_exponent_int - \exp_after:wN \fp_level_input_exponents_a: + \if_meaning:w 0 #1 + \if_int_compare:w #3 > \c_zero + \__fp_round_return_one: + \fi: + \fi: + \c_zero + } +\cs_new:Npn \__fp_round_to_nearest:NNN #1 #2 #3 + { + \if_int_compare:w #3 > \c_five + \__fp_round_return_one: \else: - \exp_after:wN \fp_level_input_exponents_b: + \if_meaning:w 5 #3 + \if_int_odd:w #2 \exp_stop_f: + \__fp_round_return_one: + \fi: + \fi: \fi: + \c_zero + } +\cs_new_eq:NN \__fp_round:NNN \__fp_round_to_nearest:NNN +\cs_new:Npn \__fp_round_s:NNNw #1 #2 #3 #4; + { + \exp_after:wN \__fp_round:NNN + \exp_after:wN #1 + \exp_after:wN #2 + \int_use:N \__int_eval:w + \if_int_odd:w 0 \if_meaning:w 0 #3 1 \fi: + \if_meaning:w 5 #3 1 \fi: + \exp_stop_f: + \if_int_compare:w \__int_eval:w #4 > \c_zero + 1 + + \fi: + \fi: + #3 + ; + } +\cs_new:Npn \__fp_round:NNNN #1 #2 #3 #4 + { + \exp_after:wN \__fp_round:NNN + \exp_after:wN #1 + \exp_after:wN #2 + \int_use:N \__int_eval:w + \if_int_odd:w 0 \if_meaning:w 0 #3 1 \fi: + \if_meaning:w 5 #3 1 \fi: + \exp_stop_f: + \if_int_compare:w #4 > \c_zero + 1 + + \fi: + \fi: + #3 + \__int_eval_end: } -\cs_new_protected_nopar:Npn \fp_level_input_exponents_a: +\cs_new:Npn \__fp_round_to_ninf_neg:NNN #1 #2 #3 { - \if_int_compare:w \l_fp_input_a_exponent_int > \l_fp_input_b_exponent_int - \tex_advance:D \l_fp_input_b_integer_int \c_one_thousand_million - \exp_after:wN \use_i:nn \exp_after:wN - \fp_level_input_exponents_a:NNNNNNNNN - \int_use:N \l_fp_input_b_integer_int - \exp_after:wN \fp_level_input_exponents_a: + \if_meaning:w 0 #1 + \if_int_compare:w #3 > \c_zero + \__fp_round_return_one: + \fi: \fi: + \c_zero } -\cs_new_protected:Npn \fp_level_input_exponents_a:NNNNNNNNN - #1#2#3#4#5#6#7#8#9 +\cs_new:Npn \__fp_round_to_zero_neg:NNN #1 #2 #3 { - \l_fp_input_b_integer_int #1#2#3#4#5#6#7#8 \scan_stop: - \tex_advance:D \l_fp_input_b_decimal_int \c_one_thousand_million - \tex_divide:D \l_fp_input_b_decimal_int \c_ten - \tl_set:Nx \l_fp_internal_tl - { - #9 - \exp_after:wN \use_none:n - \int_use:N \l_fp_input_b_decimal_int - } - \l_fp_input_b_decimal_int \l_fp_internal_tl \scan_stop: - \tex_advance:D \l_fp_input_b_exponent_int \c_one + \if_int_compare:w #3 > \c_zero + \__fp_round_return_one: + \fi: + \c_zero } -\cs_new_protected_nopar:Npn \fp_level_input_exponents_b: +\cs_new:Npn \__fp_round_to_pinf_neg:NNN #1 #2 #3 { - \if_int_compare:w \l_fp_input_b_exponent_int > \l_fp_input_a_exponent_int - \tex_advance:D \l_fp_input_a_integer_int \c_one_thousand_million - \exp_after:wN \use_i:nn \exp_after:wN - \fp_level_input_exponents_b:NNNNNNNNN - \int_use:N \l_fp_input_a_integer_int - \exp_after:wN \fp_level_input_exponents_b: + \if_meaning:w 2 #1 + \if_int_compare:w #3 > \c_zero + \__fp_round_return_one: + \fi: \fi: + \c_zero } -\cs_new_protected:Npn \fp_level_input_exponents_b:NNNNNNNNN - #1#2#3#4#5#6#7#8#9 +\cs_new_eq:NN \__fp_round_to_nearest_neg:NNN \__fp_round_to_nearest:NNN +\cs_new_eq:NN \__fp_round_neg:NNN \__fp_round_to_nearest_neg:NNN +\cs_new:Npn \__fp_round:Nww #1#2 ; #3 ; { - \l_fp_input_a_integer_int #1#2#3#4#5#6#7#8 \scan_stop: - \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million - \tex_divide:D \l_fp_input_a_decimal_int \c_ten - \tl_set:Nx \l_fp_internal_tl + \__fp_small_int:wTF #3; { \__fp_round:Nwn #1#2; } { - #9 - \exp_after:wN \use_none:n - \int_use:N \l_fp_input_a_decimal_int + \__fp_error:x { {round(x,n)~with~n=} \__fp_to_tl:w #3; } + \exp_after:wN \c_nan_fp } - \l_fp_input_a_decimal_int \l_fp_internal_tl \scan_stop: - \tex_advance:D \l_fp_input_a_exponent_int \c_one } -\cs_new_protected:Npn \fp_tmp:w #1#2 { } -\cs_new_protected:Npn \fp_new:N #1 +\cs_new:Npn \__fp_round:Nwn #1 \s__fp \__fp_chk:w #2#3#4; #5 { - \tl_new:N #1 - \tl_gset_eq:NN #1 \c_zero_fp + \if_meaning:w 1 #2 + \exp_after:wN \__fp_round_normal:NwNNnw + \exp_after:wN #1 + \__int_value:w #5 + \else: + \exp_after:wN \__fp_exp_after_o:w + \fi: + \s__fp \__fp_chk:w #2#3#4; } -\cs_generate_variant:Nn \fp_new:N { c } -\cs_new_protected:Npn \fp_const:Nn #1#2 +\cs_new:Npn \__fp_round_normal:NwNNnw #1#2 \s__fp \__fp_chk:w 1#3#4#5; { - \fp_new:N #1 - \fp_gset:Nn #1 {#2} + \__fp_decimate:nNnnnn { \c_sixteen - #4 - #2 } + \__fp_round_normal_ii:NnnwNNnn #5 #1 #3 {#4} {#2} } -\cs_generate_variant:Nn \fp_const:Nn { c } -\cs_new_protected:Npn \fp_zero:N #1 - { \tl_set_eq:NN #1 \c_zero_fp } -\cs_new_protected:Npn \fp_gzero:N #1 - { \tl_gset_eq:NN #1 \c_zero_fp } -\cs_generate_variant:Nn \fp_zero:N { c } -\cs_generate_variant:Nn \fp_gzero:N { c } -\cs_new_protected:Npn \fp_zero_new:N #1 - { \fp_if_exist:NTF #1 { \fp_zero:N #1 } { \fp_new:N #1 } } -\cs_new_protected:Npn \fp_gzero_new:N #1 - { \fp_if_exist:NTF #1 { \fp_gzero:N #1 } { \fp_new:N #1 } } -\cs_generate_variant:Nn \fp_zero_new:N { c } -\cs_generate_variant:Nn \fp_gzero_new:N { c } -\cs_new_protected_nopar:Npn \fp_set:Nn { \fp_set_aux:NNn \tl_set:Nn } -\cs_new_protected_nopar:Npn \fp_gset:Nn { \fp_set_aux:NNn \tl_gset:Nn } -\cs_new_protected:Npn \fp_set_aux:NNn #1#2#3 - { - \group_begin: - \fp_split:Nn a {#3} - \fp_standardise:NNNN - \l_fp_input_a_sign_int - \l_fp_input_a_integer_int - \l_fp_input_a_decimal_int - \l_fp_input_a_exponent_int - \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million - \cs_set_protected_nopar:Npx \fp_tmp:w - { - \group_end: - #1 \exp_not:N #2 - { - \if_int_compare:w \l_fp_input_a_sign_int < \c_zero - - - \else: - + - \fi: - \int_use:N \l_fp_input_a_integer_int - . - \exp_after:wN \use_none:n - \int_use:N \l_fp_input_a_decimal_int - e - \int_use:N \l_fp_input_a_exponent_int - } - } - \fp_tmp:w - } -\cs_generate_variant:Nn \fp_set:Nn { c } -\cs_generate_variant:Nn \fp_gset:Nn { c } -\cs_new_protected_nopar:Npn \fp_set_from_dim:Nn - { \fp_set_from_dim_aux:NNn \tl_set:Nx } -\cs_new_protected_nopar:Npn \fp_gset_from_dim:Nn - { \fp_set_from_dim_aux:NNn \tl_gset:Nx } -\cs_new_protected:Npn \fp_set_from_dim_aux:NNn #1#2#3 - { - \group_begin: - \l_fp_internal_skip \etex_glueexpr:D #3 \scan_stop: - \l_fp_internal_dim \l_fp_internal_skip - \fp_split:Nn a - { - \exp_after:wN \fp_set_from_dim_aux:w - \dim_use:N \l_fp_internal_dim - } - \fp_standardise:NNNN - \l_fp_input_a_sign_int - \l_fp_input_a_integer_int - \l_fp_input_a_decimal_int - \l_fp_input_a_exponent_int - \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million - \cs_set_protected_nopar:Npx \fp_tmp:w - { - \group_end: - #1 \exp_not:N #2 - { - \if_int_compare:w \l_fp_input_a_sign_int < \c_zero - - - \else: - + - \fi: - \int_use:N \l_fp_input_a_integer_int - . - \exp_after:wN \use_none:n - \int_use:N \l_fp_input_a_decimal_int - e - \int_use:N \l_fp_input_a_exponent_int - } - } - \fp_tmp:w +\cs_new:Npn \__fp_round_normal_ii:NnnwNNnn #1#2#3#4; #5#6 + { + \exp_after:wN \__fp_round_normal_iii:NNwNnn + \int_use:N \__int_eval:w + \if_int_compare:w #2 > \c_zero + 1 \__int_value:w #2 + \exp_after:wN \__fp_round_pack:Nw + \int_use:N \__int_eval:w 1#3 + + \else: + \if_int_compare:w #3 > \c_zero + 1 \__int_value:w #3 + + \fi: + \fi: + \exp_after:wN #5 + \exp_after:wN #6 + \use_none:nnnnnnn #3 + #1 + \__int_eval_end: + 0000 0000 0000 0000 ; #6 } -\cs_set_protected_nopar:Npx \fp_set_from_dim_aux:w +\cs_new:Npn \__fp_round_pack:Nw #1 + { \if_meaning:w 2 #1 + \c_one \fi: \__int_eval_end: } +\cs_new:Npn \__fp_round_normal_iii:NNwNnn #1 #2 { - \cs_set:Npn \exp_not:N \fp_set_from_dim_aux:w - ##1 \tl_to_str:n { pt } {##1} + \if_meaning:w 0 #2 + \exp_after:wN \__fp_round_special:NwwNnn + \exp_after:wN #1 + \fi: + \__fp_pack_twice_four:wNNNNNNNN + \__fp_pack_twice_four:wNNNNNNNN + \__fp_round_normal_end:wwNnn + ; #2 } -\fp_set_from_dim_aux:w -\cs_generate_variant:Nn \fp_set_from_dim:Nn { c } -\cs_generate_variant:Nn \fp_gset_from_dim:Nn { c } -\dim_new:N \l_fp_internal_dim -\skip_new:N \l_fp_internal_skip -\cs_new_eq:NN \fp_set_eq:NN \tl_set_eq:NN -\cs_new_eq:NN \fp_set_eq:cN \tl_set_eq:cN -\cs_new_eq:NN \fp_set_eq:Nc \tl_set_eq:Nc -\cs_new_eq:NN \fp_set_eq:cc \tl_set_eq:cc -\cs_new_eq:NN \fp_gset_eq:NN \tl_gset_eq:NN -\cs_new_eq:NN \fp_gset_eq:cN \tl_gset_eq:cN -\cs_new_eq:NN \fp_gset_eq:Nc \tl_gset_eq:Nc -\cs_new_eq:NN \fp_gset_eq:cc \tl_gset_eq:cc -\cs_new_eq:NN \fp_show:N \tl_show:N -\cs_new_eq:NN \fp_show:c \tl_show:c -\cs_new:Npn \fp_use:N #1 - { \exp_after:wN \fp_use_aux:w #1 \q_stop } -\cs_generate_variant:Nn \fp_use:N { c } -\cs_new:Npn \fp_use_aux:w #1#2 e #3 \q_stop +\cs_new:Npn \__fp_round_normal_end:wwNnn #1;#2;#3#4#5 { - \if:w #1 - - - + \exp_after:wN \__fp_exp_after_o:w \tex_romannumeral:D -`0 + \__fp_sanitize:Nw #3 #4 ; #1 ; + } +\cs_new:Npn \__fp_round_special:NwwNnn #1#2;#3;#4#5#6 + { + \if_meaning:w 0 #1 + \__fp_case_return:nw + { \exp_after:wN \__fp_zero_fp:N \exp_after:wN #4 } + \else: + \exp_after:wN \__fp_round_special_aux:Nw + \exp_after:wN #4 + \int_use:N \__int_eval:w \c_one + \if_meaning:w 1 #1 -#6 \else: +#5 \fi: \fi: - \if_int_compare:w #3 > \c_zero - \exp_after:wN \fp_use_large:w + ; + } +\cs_new:Npn \__fp_round_special_aux:Nw #1#2; + { + \exp_after:wN \__fp_exp_after_o:w \tex_romannumeral:D -`0 + \__fp_sanitize:Nw #1#2; {1000}{0000}{0000}{0000}; + } +%% File: l3fp-parse.dtx Copyright (C) 2011-2012 The 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 +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% 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. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +\cs_new:Npn \__fp_parse_expand:w #1 { -`0 #1 } +\cs_new:Npn \__fp_parse_return_semicolon:w + #1 \fi: \__fp_parse_expand:w { \fi: ; #1 } +\group_begin: +\char_set_catcode_other:N \S +\char_set_catcode_other:N \F +\char_set_catcode_other:N \P +\char_set_lccode:nn { `\- } { `\_ } +\tl_to_lowercase:n + { + \group_end: + \cs_new:Npn \__fp_type_from_scan:N #1 + { + \exp_after:wN \__fp_type_from_scan:w + \token_to_str:N #1 \q_mark S--FP \q_mark \q_stop + } + \cs_new:Npn \__fp_type_from_scan:w #1 S--FP #2 \q_mark #3 \q_stop {#2} + } +\cs_set_protected:Npn \__fp_tmp:w #1 #2 #3 + { + \cs_new:cpn { __fp_parse_digits_ #1 :N } ##1 + { + \if_int_compare:w \c_nine < 1 \token_to_str:N ##1 \exp_stop_f: + \token_to_str:N ##1 \exp_after:wN #2 \tex_romannumeral:D + \else: + \__fp_parse_return_semicolon:w #3 ##1 + \fi: + \__fp_parse_expand:w + } + } +\__fp_tmp:w {vii} \__fp_parse_digits_vi:N { 0000000 ; 7 } +\__fp_tmp:w {vi} \__fp_parse_digits_v:N { 000000 ; 6 } +\__fp_tmp:w {v} \__fp_parse_digits_iv:N { 00000 ; 5 } +\__fp_tmp:w {iv} \__fp_parse_digits_iii:N { 0000 ; 4 } +\__fp_tmp:w {iii} \__fp_parse_digits_ii:N { 000 ; 3 } +\__fp_tmp:w {ii} \__fp_parse_digits_i:N { 00 ; 2 } +\__fp_tmp:w {i} \__fp_parse_digits_:N { 0 ; 1 } +\cs_new_nopar:Npn \__fp_parse_digits_:N { ; ; 0 } +\cs_new:Npn \__fp_parse_operand:Nw #1 #2 + { + \if_catcode:w \tex_relax:D #2 + \if_meaning:w \tex_relax:D #2 + \exp_after:wN \exp_after:wN + \exp_after:wN \__fp_parse_operand_relax:NN + \else: + \exp_after:wN \exp_after:wN + \exp_after:wN \__fp_parse_operand_register:NN + \fi: \else: - \if_int_compare:w #3 < \c_zero - \exp_after:wN \exp_after:wN \exp_after:wN - \fp_use_small:w + \if_int_compare:w \c_nine < 1 \token_to_str:N #2 \exp_stop_f: + \exp_after:wN \exp_after:wN + \exp_after:wN \__fp_parse_operand_digit:NN \else: - \exp_after:wN \exp_after:wN \exp_after:wN \fp_use_none:w + \exp_after:wN \exp_after:wN + \exp_after:wN \__fp_parse_operand_other:NN \fi: \fi: - #2 e #3 \q_stop + #1 #2 } -\cs_new:Npn \fp_use_none:w #1 e #2 \q_stop {#1} -\cs_new:Npn \fp_use_small:w #1 . #2 e #3 \q_stop +\group_begin: +\char_set_catcode_other:N \P +\char_set_catcode_other:N \T +\tl_to_lowercase:n { - 0 . - \prg_replicate:nn { -#3 - 1 } { 0 } - #1#2 + \group_end: + \cs_new:Npn \__fp_parse_operand_register:NN #1#2 + { + \exp_after:wN \__fp_parse_infix_after_operand:NwN + \exp_after:wN #1 + \tex_romannumeral:D -`0 + \exp_after:wN \__fp_parse_operand_register_aux:www + \tex_the:D + \exp_after:wN #2 + \exp_after:wN P + \exp_after:wN T + \exp_after:wN \q_stop + \__int_value:w \__fp_parse_exponent:N + } + \cs_new:Npn \__fp_parse_operand_register_aux:www #1 PT #2 \q_stop #3 ; + { \__fp_parse:n { #1 e #3 } } + } +\cs_new:Npn \__fp_parse_operand_relax:NN #1#2 + { + \__fp_parse_operand_relax_aux:wwnw + #2 \s__fp_mark + { + \__fp_exp_after_o:nw + { + \tex_romannumeral:D -`0 + \exp_after:wN \__fp_parse_infix:NN + \exp_after:wN #1 \tex_romannumeral:D \__fp_parse_expand:w + } + \s__fp + } + \s__fp #2 + { + \__fp_error:n { Premature~end~in~fp~expression. } + \exp_after:wN \c_nan_fp + \tex_romannumeral:D -`0 + \__fp_parse_infix:NN #1 + \s__fp_mark + } + \s__fp_mark + { + \__fp_error:n { Erroneous~variable~#2 used! } + \exp_after:wN \c_nan_fp + \tex_romannumeral:D -`0 + \exp_after:wN \__fp_parse_infix:NN + \exp_after:wN #1 + \tex_romannumeral:D \__fp_parse_expand:w + } + \s__fp_mark \s__fp_stop } -\cs_new:Npn \fp_use_large:w #1 . #2 e #3 \q_stop +\cs_new:Npn \__fp_parse_operand_relax_aux:wwnw + #1 \s__fp #2 \s__fp_mark #3 #4 \s__fp_mark \s__fp_stop { #3 } +\cs_new:Npn \__fp_parse_operand_other:NN #1 #2 { - \if_int_compare:w #3 < \c_ten - \exp_after:wN \fp_use_large_aux_i:w + \if_int_compare:w + \__int_eval:w \tex_uccode:D `#2 / 26 = \c_three + \exp_after:wN \__fp_parse_operand_other_word_aux:Nw + \exp_after:wN #1 + \tex_romannumeral:D + \exp_after:wN \__fp_parse_letters:NN + \exp_after:wN #2 + \tex_romannumeral:D \else: - \exp_after:wN \fp_use_large_aux_ii:w + \exp_after:wN \__fp_parse_operand_other_prefix_aux:NNN + \exp_after:wN #1 + \exp_after:wN #2 + \cs:w __fp_parse_prefix_#2:Nw \exp_after:wN \cs_end: + \tex_romannumeral:D \fi: - #1#2 e #3 \q_stop + \__fp_parse_expand:w } -\cs_new:Npn \fp_use_large_aux_i:w #1#2 e #3 \q_stop + +\cs_new:Npn \__fp_parse_letters:NN #1#2 { - #1 - \use:c { fp_use_large_aux_ #3 :w } #2 \q_stop - } -\cs_new:cpn { fp_use_large_aux_1:w } #1#2 \q_stop { #1 . #2 } -\cs_new:cpn { fp_use_large_aux_2:w } #1#2#3 \q_stop - { #1#2 . #3 } -\cs_new:cpn { fp_use_large_aux_3:w } #1#2#3#4 \q_stop - { #1#2#3 . #4 } -\cs_new:cpn { fp_use_large_aux_4:w } #1#2#3#4#5 \q_stop - { #1#2#3#4 . #5 } -\cs_new:cpn { fp_use_large_aux_5:w } #1#2#3#4#5#6 \q_stop - { #1#2#3#4#5 . #6 } -\cs_new:cpn { fp_use_large_aux_6:w } #1#2#3#4#5#6#7 \q_stop - { #1#2#3#4#5#6 . #7 } -\cs_new:cpn { fp_use_large_aux_7:w } #1#2#3#4#5#6#7#8 \q_stop - { #1#2#3#4#6#7 . #8 } -\cs_new:cpn { fp_use_large_aux_8:w } #1#2#3#4#5#6#7#8#9 \q_stop - { #1#2#3#4#5#6#7#8 . #9 } -\cs_new:cpn { fp_use_large_aux_9:w } #1 \q_stop { #1 . } -\cs_new:Npn \fp_use_large_aux_ii:w #1 e #2 \q_stop + \exp_after:wN \c_zero + \exp_after:wN #1 + \tex_romannumeral:D + \if_int_compare:w + \if_catcode:w \tex_relax:D #2 + \c_zero + \else: + \__int_eval:w \tex_uccode:D `#2 / 26 + \fi: + = \c_three + \exp_after:wN \__fp_parse_letters:NN + \exp_after:wN #2 + \tex_romannumeral:D + \exp_after:wN \__fp_parse_expand:w + \else: + \exp_after:wN \c_zero + \exp_after:wN ; + \exp_after:wN #2 + \fi: + } +\cs_new:Npn \__fp_parse_operand_other_word_aux:Nw #1 #2; { - #1 - \prg_replicate:nn { #2 - 9 } { 0 } - . + \cs_if_exist_use:cF { __fp_parse_word_#2:N } + { + \__msg_expandable_error:n { Unknown~word~#2. } + \exp_after:wN \c_nan_fp + \tex_romannumeral:D -`0 + \__fp_parse_infix:NN + } + #1 } -\cs_new_eq:NN \fp_if_exist:NTF \cs_if_exist:NTF -\cs_new_eq:NN \fp_if_exist:NT \cs_if_exist:NT -\cs_new_eq:NN \fp_if_exist:NF \cs_if_exist:NF -\cs_new_eq:NN \fp_if_exist_p:N \cs_if_exist_p:N -\cs_new_eq:NN \fp_if_exist:cTF \cs_if_exist:cTF -\cs_new_eq:NN \fp_if_exist:cT \cs_if_exist:cT -\cs_new_eq:NN \fp_if_exist:cF \cs_if_exist:cF -\cs_new_eq:NN \fp_if_exist_p:c \cs_if_exist_p:c -\cs_new:Npn \fp_to_dim:N #1 { \fp_use:N #1 pt } -\cs_generate_variant:Nn \fp_to_dim:N { c } -\cs_new:Npn \fp_to_int:N #1 - { \exp_after:wN \fp_to_int_aux:w #1 \q_stop } -\cs_generate_variant:Nn \fp_to_int:N { c } -\cs_new:Npn \fp_to_int_aux:w #1#2 e #3 \q_stop +\cs_new_eq:NN \s__fp_unknown \tex_relax:D +\cs_new:Npn \__fp_parse_operand_other_prefix_aux:NNN #1#2#3 { - \if:w #1 - - - + \if_meaning:w \tex_relax:D #3 + \exp_after:wN \__fp_parse_operand_other_prefix_unknown:NNN + \exp_after:wN #2 \fi: - \if_int_compare:w #3 < \c_zero - \exp_after:wN \fp_to_int_small:w - \else: - \exp_after:wN \fp_to_int_large:w - \fi: - #2 e #3 \q_stop + #3 #1 + } +\cs_new:Npn \__fp_parse_operand_other_prefix_unknown:NNN #1#2#3 + { + \cs_if_exist:cTF { __fp_parse_infix_#1:N } + { + \__fp_error:n { Missing~number~before~'#1'. } + \exp_after:wN \c_nan_fp + \tex_romannumeral:D -`0 + \__fp_parse_infix:NN #3 #1 + } + { + \__fp_error:n { Unknown~symbol~#1~ignored. } + \__fp_parse_operand:Nw #3 + } } -\cs_new:Npn \fp_to_int_small:w #1 . #2 e #3 \q_stop +\cs_new:Npn \__fp_parse_operand_digit:NN #1 { - \if_int_compare:w #3 > \c_one + \exp_after:wN \__fp_parse_infix_after_operand:NwN + \exp_after:wN #1 + \tex_romannumeral:D -`0 + \exp_after:wN \__fp_sanitize:wN + \int_use:N \__int_eval:w \c_zero \__fp_parse_trim_zeros:N + } +\cs_new:Npn \__fp_parse_trim_zeros:N #1 + { + \if:w 0 #1 + \exp_after:wN \__fp_parse_trim_zeros:N + \tex_romannumeral:D \else: - \if_int_compare:w #1 < \c_five - 0 + \if:w . #1 + \exp_after:wN \__fp_parse_strim_zeros:N + \tex_romannumeral:D \else: - 1 + \__fp_parse_trim_end:w #1 \fi: \fi: + \__fp_parse_expand:w } -\cs_new:Npn \fp_to_int_large:w #1 . #2 e #3 \q_stop +\cs_new:Npn \__fp_parse_trim_end:w #1 \fi: \fi: \__fp_parse_expand:w { - \if_int_compare:w #3 < \c_ten - \exp_after:wN \fp_to_int_large_aux_i:w + \fi: + \fi: + \if_int_compare:w \c_nine < 1 \token_to_str:N #1 \exp_stop_f: + \exp_after:wN \__fp_parse_large:N \else: - \exp_after:wN \fp_to_int_large_aux_ii:w + \exp_after:wN \__fp_parse_zero: \fi: - #1#2 e #3 \q_stop + #1 } -\cs_new:Npn \fp_to_int_large_aux_i:w #1#2 e #3 \q_stop - { \use:c { fp_to_int_large_aux_ #3 :w } #2 \q_stop {#1} } -\cs_new:cpn { fp_to_int_large_aux_1:w } #1#2 \q_stop - { \fp_to_int_large_aux:nnn { #2 0 } {#1} } -\cs_new:cpn { fp_to_int_large_aux_2:w } #1#2#3 \q_stop - { \fp_to_int_large_aux:nnn { #3 00 } {#1#2} } -\cs_new:cpn { fp_to_int_large_aux_3:w } #1#2#3#4 \q_stop - { \fp_to_int_large_aux:nnn { #4 000 } {#1#2#3} } -\cs_new:cpn { fp_to_int_large_aux_4:w } #1#2#3#4#5 \q_stop - { \fp_to_int_large_aux:nnn { #5 0000 } {#1#2#3#4} } -\cs_new:cpn { fp_to_int_large_aux_5:w } #1#2#3#4#5#6 \q_stop - { \fp_to_int_large_aux:nnn { #6 00000 } {#1#2#3#4#5} } -\cs_new:cpn { fp_to_int_large_aux_6:w } #1#2#3#4#5#6#7 \q_stop - { \fp_to_int_large_aux:nnn { #7 000000 } {#1#2#3#4#5#6} } -\cs_new:cpn { fp_to_int_large_aux_7:w } #1#2#3#4#5#6#7#8 \q_stop - { \fp_to_int_large_aux:nnn { #8 0000000 } {#1#2#3#4#5#6#7} } -\cs_new:cpn { fp_to_int_large_aux_8:w } #1#2#3#4#5#6#7#8#9 \q_stop - { \fp_to_int_large_aux:nnn { #9 00000000 } {#1#2#3#4#5#6#7#8} } -\cs_new:cpn { fp_to_int_large_aux_9:w } #1 \q_stop {#1} -\cs_new:Npn \fp_to_int_large_aux:nnn #1#2#3 +\cs_new:Npn \__fp_parse_strim_zeros:N #1 { - \if_int_compare:w #1 < \c_five_hundred_million - #3#2 + \if:w 0 #1 + - \c_one + \exp_after:wN \__fp_parse_strim_zeros:N + \tex_romannumeral:D \else: - \int_value:w \int_eval:w #3#2 + 1 \int_eval_end: + \__fp_parse_strim_end:w #1 \fi: + \__fp_parse_expand:w } -\cs_new:Npn \fp_to_int_large_aux_ii:w #1 e #2 \q_stop +\cs_new:Npn \__fp_parse_strim_end:w #1 \fi: \__fp_parse_expand:w { - #1 - \prg_replicate:nn { #2 - 9 } { 0 } - } -\cs_new:Npn \fp_to_tl:N #1 - { \exp_after:wN \fp_to_tl_aux:w #1 \q_stop } -\cs_generate_variant:Nn \fp_to_tl:N { c } -\cs_new:Npn \fp_to_tl_aux:w #1#2 e #3 \q_stop - { - \if:w #1 - - - \fi: - \if_int_compare:w #3 < \c_zero - \exp_after:wN \fp_to_tl_small:w + \if_int_compare:w \c_nine < 1 \token_to_str:N #1 \exp_stop_f: + \exp_after:wN \__fp_parse_small:N \else: - \exp_after:wN \fp_to_tl_large:w + \exp_after:wN \__fp_parse_zero: \fi: - #2 e #3 \q_stop + #1 } -\cs_new:Npn \fp_to_tl_large:w #1 e #2 \q_stop +\cs_new:Npn \__fp_parse_zero: { - \if_int_compare:w #2 < \c_ten - \exp_after:wN \fp_to_tl_large_aux_i:w - \else: - \exp_after:wN \fp_to_tl_large_aux_ii:w - \fi: - #1 e #2 \q_stop + \exp_after:wN ; \exp_after:wN 1 + \__int_value:w \__fp_parse_exponent:N } -\cs_new:Npn \fp_to_tl_large_aux_i:w #1 e #2 \q_stop - { \use:c { fp_to_tl_large_ #2 :w } #1 \q_stop } -\cs_new:Npn \fp_to_tl_large_aux_ii:w #1 . #2 e #3 \q_stop +\cs_new:Npn \__fp_parse_small:N #1 { - #1 - \fp_to_tl_large_zeros:NNNNNNNNN #2 - e #3 + \exp_after:wN \__fp_parse_pack_leading:NNNNNww + \int_use:N \__int_eval:w 1 \token_to_str:N #1 + \exp_after:wN \__fp_parse_small_leading:wwNN + \__int_value:w 1 + \exp_after:wN \__fp_parse_digits_vii:N + \tex_romannumeral:D \__fp_parse_expand:w } -\cs_new:cpn { fp_to_tl_large_0:w } #1 . #2 \q_stop +\cs_new:Npn \__fp_parse_small_leading:wwNN 1 #1 ; #2; #3 #4 { - #1 - \fp_to_tl_large_zeros:NNNNNNNNN #2 + #1 #2 + \exp_after:wN \__fp_parse_pack_trailing:NNNNNNww + \exp_after:wN \c_zero + \int_use:N \__int_eval:w 1 + \if_int_compare:w \c_nine < 1 \token_to_str:N #4 \exp_stop_f: + \token_to_str:N #4 + \exp_after:wN \__fp_parse_small_trailing:wwNN + \__int_value:w 1 + \exp_after:wN \__fp_parse_digits_vi:N + \tex_romannumeral:D + \else: + 0000 0000 \__fp_parse_exponent:Nw #4 + \fi: + \__fp_parse_expand:w } -\cs_new:cpn { fp_to_tl_large_1:w } #1 . #2#3 \q_stop +\cs_new:Npn \__fp_parse_small_trailing:wwNN 1 #1 ; #2; #3 #4 { - #1#2 - \fp_to_tl_large_zeros:NNNNNNNNN #3 0 + #1 #2 + \if_int_compare:w \c_nine < 1 \token_to_str:N #4 \exp_stop_f: + \token_to_str:N #4 + \exp_after:wN \__fp_parse_small_round:NN + \exp_after:wN #4 + \tex_romannumeral:D + \else: + 0 \__fp_parse_exponent:Nw #4 + \fi: + \__fp_parse_expand:w } -\cs_new:cpn { fp_to_tl_large_2:w } #1 . #2#3#4 \q_stop +\cs_new:Npn \__fp_parse_pack_trailing:NNNNNNww #1 #2 #3#4#5#6 #7; #8 ; { - #1#2#3 - \fp_to_tl_large_zeros:NNNNNNNNN #4 00 + \if_meaning:w 2 #2 + \c_one \fi: + ; #8 + #1 ; {#3#4#5#6} {#7}; } -\cs_new:cpn { fp_to_tl_large_3:w } #1 . #2#3#4#5 \q_stop +\cs_new:Npn \__fp_parse_pack_leading:NNNNNww #1 #2#3#4#5 #6; #7; { - #1#2#3#4 - \fp_to_tl_large_zeros:NNNNNNNNN #5 000 + + #7 + \if_meaning:w 2 #1 \__fp_parse_pack_carry:w \fi: + ; 0 {#2#3#4#5} {#6} } -\cs_new:cpn { fp_to_tl_large_4:w } #1 . #2#3#4#5#6 \q_stop +\cs_new:Npn \__fp_parse_pack_carry:w \fi: ; 0 #1 + { \fi: + \c_one ; 0 {1000} } +\cs_new:Npn \__fp_parse_large:N #1 { - #1#2#3#4#5 - \fp_to_tl_large_zeros:NNNNNNNNN #6 0000 + \exp_after:wN \__fp_parse_large_leading:wwNN + \__int_value:w 1 \token_to_str:N #1 + \exp_after:wN \__fp_parse_digits_vii:N + \tex_romannumeral:D \__fp_parse_expand:w } -\cs_new:cpn { fp_to_tl_large_5:w } #1 . #2#3#4#5#6#7 \q_stop +\cs_new:Npn \__fp_parse_large_leading:wwNN 1 #1 ; #2; #3 #4 { - #1#2#3#4#5#6 - \fp_to_tl_large_zeros:NNNNNNNNN #7 00000 + + \c_eight - #3 + \exp_after:wN \__fp_parse_pack_leading:NNNNNww + \int_use:N \__int_eval:w 1 #1 + \if_int_compare:w \c_nine < 1 \token_to_str:N #4 \exp_stop_f: + \exp_after:wN \__fp_parse_large_trailing:wwNN + \__int_value:w 1 \token_to_str:N #4 + \exp_after:wN \__fp_parse_digits_vi:N + \tex_romannumeral:D + \else: + \if:w . #4 + \exp_after:wN \__fp_parse_small_leading:wwNN + \__int_value:w 1 + \cs:w + __fp_parse_digits_ + \tex_romannumeral:D #3 + :N \exp_after:wN + \cs_end: + \tex_romannumeral:D + \else: + #2 + \exp_after:wN \__fp_parse_pack_trailing:NNNNNNww + \exp_after:wN \c_zero + \__int_value:w 1 0000 0000 + \__fp_parse_exponent:Nw #4 + \fi: + \fi: + \__fp_parse_expand:w } -\cs_new:cpn { fp_to_tl_large_6:w } #1 . #2#3#4#5#6#7#8 \q_stop +\cs_new:Npn \__fp_parse_large_trailing:wwNN 1 #1 ; #2; #3 #4 { - #1#2#3#4#5#6#7 - \fp_to_tl_large_zeros:NNNNNNNNN #8 000000 + \if_int_compare:w \c_nine < 1 \token_to_str:N #4 \exp_stop_f: + \exp_after:wN \__fp_parse_pack_trailing:NNNNNNww + \exp_after:wN \c_eight + \int_use:N \__int_eval:w 1 #1 \token_to_str:N #4 + \exp_after:wN \__fp_parse_large_round:NN + \exp_after:wN #4 + \tex_romannumeral:D + \else: + \exp_after:wN \__fp_parse_pack_trailing:NNNNNNww + \int_use:N \__int_eval:w \c_seven - #3 \exp_stop_f: + \int_use:N \__int_eval:w 1 #1 + \if:w . #4 + \exp_after:wN \__fp_parse_small_trailing:wwNN + \__int_value:w 1 + \cs:w + __fp_parse_digits_ + \tex_romannumeral:D #3 + :N \exp_after:wN + \cs_end: + \tex_romannumeral:D + \else: + #2 0 \__fp_parse_exponent:Nw #4 + \fi: + \fi: + \__fp_parse_expand:w } -\cs_new:cpn { fp_to_tl_large_7:w } #1 . #2#3#4#5#6#7#8#9 \q_stop +\cs_new:Npn \__fp_parse_exponent:Nw #1 #2 \__fp_parse_expand:w { - #1#2#3#4#5#6#7#8 - \fp_to_tl_large_zeros:NNNNNNNNN #9 0000000 + \exp_after:wN ; + \__int_value:w #2 \__fp_parse_exponent:N #1 } -\cs_new:cpn { fp_to_tl_large_8:w } #1 . +\cs_new:Npn \__fp_parse_exponent:N #1 { - #1 - \use:c { fp_to_tl_large_8_aux:w } + \if:w e #1 + \exp_after:wN \__fp_parse_exponent_ii:N + \tex_romannumeral:D + \else: + 0 \__fp_parse_return_semicolon:w #1 + \fi: + \__fp_parse_expand:w } -\cs_new:cpn { fp_to_tl_large_8_aux:w } #1#2#3#4#5#6#7#8#9 \q_stop +\cs_new:Npn \__fp_parse_exponent_ii:N #1 { - #1#2#3#4#5#6#7#8 - \fp_to_tl_large_zeros:NNNNNNNNN #9 00000000 + \if_int_compare:w \if_catcode:w \tex_relax:D #1 + \c_zero \else: `#1 \fi: > `9 \exp_stop_f: + 0 \exp_after:wN ; \exp_after:wN e + \else: + \exp_after:wN \__fp_parse_exponent_sign:N + \fi: + #1 } -\cs_new:cpn { fp_to_tl_large_9:w } #1 . #2 \q_stop {#1#2} -\cs_new:Npn \fp_to_tl_small:w #1 e #2 \q_stop +\cs_new:Npn \__fp_parse_exponent_sign:N #1 { - \if_int_compare:w #2 = \c_minus_one - \exp_after:wN \fp_to_tl_small_one:w + \if:w + \if:w - #1 + \fi: \token_to_str:N #1 + \exp_after:wN \__fp_parse_exponent_sign:N + \tex_romannumeral:D \exp_after:wN \__fp_parse_expand:w \else: - \if_int_compare:w #2 = -\c_two - \exp_after:wN \exp_after:wN \exp_after:wN \fp_to_tl_small_two:w - \else: - \exp_after:wN \exp_after:wN \exp_after:wN \fp_to_tl_small_aux:w - \fi: + \exp_after:wN \__fp_parse_exponent_body:N + \exp_after:wN #1 \fi: - #1 e #2 \q_stop } -\cs_new:Npn \fp_to_tl_small_one:w #1 . #2 e #3 \q_stop +\cs_new:Npn \__fp_parse_exponent_body:N #1 { - \if_int_compare:w \fp_use_ix:NNNNNNNNN #2 > \c_four - \if_int_compare:w - \int_eval:w #1 \fp_use_i_to_iix:NNNNNNNNN #2 + 1 - < \c_one_thousand_million - 0. - \exp_after:wN \fp_to_tl_small_zeros:NNNNNNNNN - \int_value:w \int_eval:w - #1 \fp_use_i_to_iix:NNNNNNNNN #2 + 1 - \int_eval_end: - \else: - 1 - \fi: + \if_int_compare:w \c_nine < 1 \token_to_str:N #1 \exp_stop_f: + \token_to_str:N #1 + \exp_after:wN \__fp_parse_exponent_digits:N + \tex_romannumeral:D \else: - 0. #1 - \fp_to_tl_small_zeros:NNNNNNNNN #2 + \__fp_parse_exponent_keep:NTF #1 + { \__fp_parse_return_semicolon:w #1 } + { + \exp_after:wN ; + \tex_romannumeral:D + } \fi: + \__fp_parse_expand:w } -\cs_new:Npn \fp_to_tl_small_two:w #1 . #2 e #3 \q_stop +\cs_new:Npn \__fp_parse_exponent_digits:N #1 { - \if_int_compare:w \fp_use_iix_ix:NNNNNNNNN #2 > \c_forty_four - \if_int_compare:w - \int_eval:w #1 \fp_use_i_to_vii:NNNNNNNNN #2 0 + \c_ten - < \c_one_thousand_million - 0.0 - \exp_after:wN \fp_to_tl_small_zeros:NNNNNNNNN - \int_value:w \int_eval:w - #1 \fp_use_i_to_vii:NNNNNNNNN #2 0 + \c_ten - \int_eval_end: - \else: - 0.1 - \fi: + \if_int_compare:w \c_nine < 1 \token_to_str:N #1 \exp_stop_f: + \token_to_str:N #1 + \exp_after:wN \__fp_parse_exponent_digits:N + \tex_romannumeral:D \else: - 0.0 - #1 - \fp_to_tl_small_zeros:NNNNNNNNN #2 + \__fp_parse_return_semicolon:w #1 \fi: + \__fp_parse_expand:w } -\cs_new:Npn \fp_to_tl_small_aux:w #1 . #2 e #3 \q_stop +\prg_new_conditional:Npnn \__fp_parse_exponent_keep:N #1 { TF } { - #1 - \fp_to_tl_large_zeros:NNNNNNNNN #2 - e #3 - } -\cs_new:Npn \fp_to_tl_large_zeros:NNNNNNNNN #1#2#3#4#5#6#7#8#9 - { - \if_int_compare:w #9 = \c_zero - \if_int_compare:w #8 = \c_zero - \if_int_compare:w #7 = \c_zero - \if_int_compare:w #6 = \c_zero - \if_int_compare:w #5 = \c_zero - \if_int_compare:w #4 = \c_zero - \if_int_compare:w #3 = \c_zero - \if_int_compare:w #2 = \c_zero - \if_int_compare:w #1 = \c_zero - \else: - . #1 - \fi: - \else: - . #1#2 - \fi: - \else: - . #1#2#3 - \fi: - \else: - . #1#2#3#4 - \fi: - \else: - . #1#2#3#4#5 - \fi: - \else: - . #1#2#3#4#5#6 - \fi: + \if_catcode:w \tex_relax:D #1 + \if_meaning:w \tex_relax:D #1 + \if_int_compare:w \pdftex_strcmp:D { \s__fp } { #1 } = \c_zero + 0 \__fp_error:n { Cannot~use~floating~point~after~'e'. } + \prg_return_true: \else: - . #1#2#3#4#5#6#7 + 0 \__fp_error:n { Erroneous~variable~#1 used. } + \prg_return_false: \fi: \else: - . #1#2#3#4#5#6#7#8 - \fi: - \else: - . #1#2#3#4#5#6#7#8#9 - \fi: - } -\cs_new:Npn \fp_to_tl_small_zeros:NNNNNNNNN #1#2#3#4#5#6#7#8#9 - { - \if_int_compare:w #9 = \c_zero - \if_int_compare:w #8 = \c_zero - \if_int_compare:w #7 = \c_zero - \if_int_compare:w #6 = \c_zero - \if_int_compare:w #5 = \c_zero - \if_int_compare:w #4 = \c_zero - \if_int_compare:w #3 = \c_zero - \if_int_compare:w #2 = \c_zero - \if_int_compare:w #1 = \c_zero - \else: - #1 - \fi: - \else: - #1#2 - \fi: - \else: - #1#2#3 - \fi: - \else: - #1#2#3#4 - \fi: - \else: - #1#2#3#4#5 - \fi: - \else: - #1#2#3#4#5#6 - \fi: + \if_int_compare:w + \pdftex_strcmp:D { \__int_value:w #1 } { \tex_the:D #1 } + = \c_zero + \__int_value:w #1 \else: - #1#2#3#4#5#6#7 + 0 \__fp_error:n { Cannot~use~a~dimension~(#1)~after~'e'. } \fi: - \else: - #1#2#3#4#5#6#7#8 + \prg_return_false: \fi: \else: - #1#2#3#4#5#6#7#8#9 + 0 \__fp_error:n { Missing~exponent~after~'e'. } + \prg_return_true: \fi: } -\cs_new:Npn \fp_use_iix_ix:NNNNNNNNN #1#2#3#4#5#6#7#8#9 {#8#9} -\cs_new:Npn \fp_use_ix:NNNNNNNNN #1#2#3#4#5#6#7#8#9 {#9} -\cs_new:Npn \fp_use_i_to_vii:NNNNNNNNN #1#2#3#4#5#6#7#8#9 - {#1#2#3#4#5#6#7} -\cs_new:Npn \fp_use_i_to_iix:NNNNNNNNN #1#2#3#4#5#6#7#8#9 - {#1#2#3#4#5#6#7#8} -\cs_new_protected_nopar:Npn \fp_round_figures:Nn - { \fp_round_figures_aux:NNn \tl_set:Nn } -\cs_generate_variant:Nn \fp_round_figures:Nn { c } -\cs_new_protected_nopar:Npn \fp_ground_figures:Nn - { \fp_round_figures_aux:NNn \tl_gset:Nn } -\cs_generate_variant:Nn \fp_ground_figures:Nn { c } -\cs_new_protected:Npn \fp_round_figures_aux:NNn #1#2#3 +\cs_new:Npn \__fp_cfs_round_loop:N #1 { - \group_begin: - \fp_read:N #2 - \int_set:Nn \l_fp_round_target_int { #3 - 1 } - \if_int_compare:w \l_fp_round_target_int < \c_ten - \exp_after:wN \fp_round: + \if_int_compare:w \c_nine < 1 \token_to_str:N #1 \exp_stop_f: + + \c_one + \if:w 0 #1 + \exp_after:wN \__fp_cfs_round_loop:N + \tex_romannumeral:D + \else: + \exp_after:wN \__fp_cfs_round_up:N + \tex_romannumeral:D \fi: - \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million - \cs_set_protected_nopar:Npx \fp_tmp:w - { - \group_end: - #1 \exp_not:N #2 - { - \if_int_compare:w \l_fp_input_a_sign_int < \c_zero - - - \else: - + - \fi: - \int_use:N \l_fp_input_a_integer_int - . - \exp_after:wN \use_none:n - \int_use:N \l_fp_input_a_decimal_int - e - \int_use:N \l_fp_input_a_exponent_int - } - } - \fp_tmp:w + \else: + \__fp_parse_return_semicolon:w \c_zero #1 + \fi: + \__fp_parse_expand:w } -\cs_new_protected_nopar:Npn \fp_round_places:Nn - { \fp_round_places_aux:NNn \tl_set:Nn } -\cs_generate_variant:Nn \fp_round_places:Nn { c } -\cs_new_protected_nopar:Npn \fp_ground_places:Nn - { \fp_round_places_aux:NNn \tl_gset:Nn } -\cs_generate_variant:Nn \fp_ground_places:Nn { c } -\cs_new_protected:Npn \fp_round_places_aux:NNn #1#2#3 +\cs_new:Npn \__fp_cfs_round_up:N #1 { - \group_begin: - \fp_read:N #2 - \int_set:Nn \l_fp_round_target_int - { #3 + \l_fp_input_a_exponent_int } - \if_int_compare:w \l_fp_round_target_int < \c_ten - \exp_after:wN \fp_round: - \fi: - \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million - \cs_set_protected_nopar:Npx \fp_tmp:w - { - \group_end: - #1 \exp_not:N #2 - { - \if_int_compare:w \l_fp_input_a_sign_int < \c_zero - - - \else: - + - \fi: - \int_use:N \l_fp_input_a_integer_int - . - \exp_after:wN \use_none:n - \int_use:N \l_fp_input_a_decimal_int - e - \int_use:N \l_fp_input_a_exponent_int - } - } - \fp_tmp:w + \if_int_compare:w \c_nine < 1 \token_to_str:N #1 \exp_stop_f: + + 1 + \exp_after:wN \__fp_cfs_round_up:N + \tex_romannumeral:D + \else: + \__fp_parse_return_semicolon:w \c_one #1 + \fi: + \__fp_parse_expand:w + } +\cs_new:Npn \__fp_parse_large_round:NN #1#2 + { + \if_int_compare:w \c_nine < 1 \token_to_str:N #2 \exp_stop_f: + + + \exp_after:wN \__fp_round_s:NNNw + \exp_after:wN 0 + \exp_after:wN #1 + \exp_after:wN #2 + \int_use:N \__int_eval:w + \exp_after:wN \__fp_parse_large_round_after:wNN + \int_use:N \__int_eval:w \c_one + \exp_after:wN \__fp_cfs_round_loop:N + \else: %^^A could be dot, or e, or other + \exp_after:wN \__fp_parse_large_round_dot_test:NNw + \exp_after:wN #1 + \exp_after:wN #2 + \fi: } -\cs_new_protected_nopar:Npn \fp_round: +\cs_new:Npn \__fp_parse_large_round_dot_test:NNw #1#2 { - \bool_set_false:N \l_fp_round_carry_bool - \l_fp_round_position_int \c_eight - \tl_clear:N \l_fp_round_decimal_tl - \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million - \exp_after:wN \use_i:nn \exp_after:wN - \fp_round_aux:NNNNNNNNN \int_use:N \l_fp_input_a_decimal_int + \if:w . #2 + \exp_after:wN \__fp_parse_small_round:NN + \exp_after:wN #1 + \tex_romannumeral:D + \else: + \__fp_parse_exponent:Nw #2 + \fi: + \__fp_parse_expand:w } -\cs_new_protected:Npn \fp_round_aux:NNNNNNNNN #1#2#3#4#5#6#7#8#9 +\cs_new:Npn \__fp_parse_large_round_after:wNN #1 ; #2 #3 { - \fp_round_loop:N #9#8#7#6#5#4#3#2#1 - \bool_if:NT \l_fp_round_carry_bool - { \tex_advance:D \l_fp_input_a_integer_int \c_one } - \l_fp_input_a_decimal_int \l_fp_round_decimal_tl \scan_stop: - \if_int_compare:w \l_fp_input_a_integer_int < \c_ten + \if:w . #3 + \exp_after:wN \__fp_parse_large_round_after_ii:wN + \int_use:N \__int_eval:w #1 + + \c_zero * \__int_eval:w \c_zero + \exp_after:wN \__fp_cfs_round_loop:N + \tex_romannumeral:D \exp_after:wN \__fp_parse_expand:w + \else: + + #2 + \exp_after:wN ; + \int_use:N \__int_eval:w #1 + + \exp_after:wN \__fp_parse_exponent:N + \exp_after:wN #3 + \fi: + } +\cs_new:Npn \__fp_parse_large_round_after_ii:wN #1 ; #2 + { + + #2 + \exp_after:wN ; + \int_use:N \__int_eval:w #1 + + \__fp_parse_exponent:N + } +\cs_new:Npn \__fp_parse_small_round:NN #1#2 + { + \if_int_compare:w \c_nine < 1 \token_to_str:N #2 \exp_stop_f: + + + \exp_after:wN \__fp_round_s:NNNw + \exp_after:wN 0 + \exp_after:wN #1 + \exp_after:wN #2 + \int_use:N \__int_eval:w + \exp_after:wN \__fp_parse_small_round_after:wN + \int_use:N \__int_eval:w \c_zero + \exp_after:wN \__fp_cfs_round_loop:N + \tex_romannumeral:D \else: - \l_fp_input_a_integer_int \c_one - \tex_divide:D \l_fp_input_a_decimal_int \c_ten - \tex_advance:D \l_fp_input_a_exponent_int \c_one + \__fp_parse_exponent:Nw #2 \fi: + \__fp_parse_expand:w } -\cs_new_protected:Npn \fp_round_loop:N #1 +\cs_new:Npn \__fp_parse_small_round_after:wN #1; #2 { - \if_int_compare:w \l_fp_round_position_int < \l_fp_round_target_int - \bool_if:NTF \l_fp_round_carry_bool - { \l_fp_internal_int \int_eval:w #1 + \c_one \scan_stop: } - { \l_fp_internal_int \int_eval:w #1 \scan_stop: } - \if_int_compare:w \l_fp_internal_int = \c_ten - \l_fp_internal_int \c_zero + + #2 \exp_after:wN ; + \__int_value:w \__fp_parse_exponent:N + } +\cs_new:Npn \__fp_parse:n #1 + { + \tex_romannumeral:D + \exp_after:wN \__fp_parse_after:ww + \tex_romannumeral:D + \__fp_parse_until:Nw \c_minus_one + \__fp_parse_expand:w #1 \s__fp_mark + \s__fp_stop + } +\cs_new:Npn \__fp_parse_after:ww #1@ #2 \s__fp_stop + { + \c_zero #1 + } +\cs_new:Npn \__fp_parse_until:Nw #1 + { + -`0 + \exp_after:wN \__fp_parse_until_test:NwN + \exp_after:wN #1 + \tex_romannumeral:D -`0 + \exp_after:wN \__fp_parse_operand:Nw + \exp_after:wN #1 + \tex_romannumeral:D + } +\cs_new:Npn \__fp_parse_until_test:NwN #1 #2 @ #3 { #3 #1 #2 @ } +\cs_new:Npn \__fp_parse_stop_until:N #1 { } +\cs_new:Npn \__fp_parse_infix_after_operand:NwN #1 #2; + { + \__fp_exp_after_f:nw { \__fp_parse_infix:NN #1 } + #2; + } +\group_begin: + \char_set_catcode_letter:N \* + \cs_new:Npn \__fp_parse_infix:NN #1 #2 + { + \if_catcode:w \tex_relax:D #2 + \if_int_compare:w + \pdftex_strcmp:D { \s__fp_mark } { #2 } + = \c_zero + \exp_after:wN \exp_after:wN + \exp_after:wN \__fp_parse_infix_end:N + \else: + \exp_after:wN \exp_after:wN + \exp_after:wN \__fp_parse_infix_juxtapose:N + \fi: + \else: + \if_int_compare:w + \__int_eval:w \tex_uccode:D `#2 / 26 + = \c_three + \exp_after:wN \exp_after:wN + \exp_after:wN \__fp_parse_infix_juxtapose:N + \else: + \exp_after:wN \__fp_parse_infix_check:NNN + \cs:w + __fp_parse_infix_#2:N + \exp_after:wN \exp_after:wN \exp_after:wN + \cs_end: + \fi: + \fi: + #1 + #2 + } + \cs_new:Npn \__fp_parse_infix_check:NNN #1#2#3 + { + \if_meaning:w \tex_relax:D #1 + \__msg_expandable_error:n { Missing~*~inserted. } + \exp_after:wN \__fp_parse_infix_*:N + \exp_after:wN #2 + \exp_after:wN #3 \else: - \bool_set_false:N \l_fp_round_carry_bool + \exp_after:wN #1 + \exp_after:wN #2 + \tex_romannumeral:D \exp_after:wN \__fp_parse_expand:w \fi: - \tl_set:Nx \l_fp_round_decimal_tl - { \int_use:N \l_fp_internal_int \l_fp_round_decimal_tl } + } +\group_end: +\cs_new:Npn \__fp_parse_apply_binary:NwNwN #1 #2#3@ #4 #5#6@ #7 + { + \exp_after:wN \__fp_parse_until_test:NwN + \exp_after:wN #1 + \tex_romannumeral:D -`0 + \cs:w + __fp + \__fp_type_from_scan:N #2 + \__fp_type_from_scan:N #5 + _ #4 _o:ww + \cs_end: + #2#3 #5#6 + \tex_romannumeral:D -`0 #7 #1 + } +\cs_new:Npn \__fp_parse_apply_unary_array:NNwN #1#2#3@#4 + { + #2 #3 @ + \tex_romannumeral:D -`0 #4 #1 + } +\cs_new:Npn \__fp_parse_apply_unary:NNwN #1#2#3@#4 + { + #2 #3 + \tex_romannumeral:D -`0 #4 #1 + } +\cs_new:Npn \__fp_parse_unary_type:N #1 + { \__fp_type_from_scan:N #1 :w \cs_end: #1 } +\cs_set_protected:Npn \__fp_tmp:w #1 #2 + { + \cs_new_nopar:cpn { __fp_parse_word_#1:N } + { \exp_after:wN #2 \tex_romannumeral:D -`0 \__fp_parse_infix:NN } + } +\__fp_tmp:w { inf } \c_inf_fp +\__fp_tmp:w { nan } \c_nan_fp +\__fp_tmp:w { pi } \c_pi_fp +\__fp_tmp:w { deg } \c_one_degree_fp +\__fp_tmp:w { true } \c_one_fp +\__fp_tmp:w { false } \c_zero_fp +\__fp_tmp:w { pt } \c_one_fp +\cs_set_protected:Npn \__fp_tmp:w #1 #2 + { + \cs_new_nopar:cpn { __fp_parse_word_#1:N } + { + \__fp_exp_after_f:nw { \__fp_parse_infix:NN } + \s__fp \__fp_chk:w 10 #2 ; + } + } +\__fp_tmp:w {in} { {2} {7227} {0000} {0000} {0000} } +\__fp_tmp:w {pc} { {2} {1200} {0000} {0000} {0000} } +\__fp_tmp:w {cm} { {2} {2845} {2755} {9055} {1181} } +\__fp_tmp:w {mm} { {1} {2845} {2755} {9055} {1181} } +\__fp_tmp:w {dd} { {1} {1070} {0085} {6496} {0630} } +\__fp_tmp:w {cc} { {2} {1284} {0102} {7795} {2756} } +\__fp_tmp:w {nd} { {1} {1066} {9783} {4645} {6693} } +\__fp_tmp:w {nc} { {2} {1280} {3740} {1574} {8031} } +\__fp_tmp:w {bp} { {1} {1003} {7500} {0000} {0000} } +\__fp_tmp:w {sp} { {-4} {1525} {8789} {0625} {0000} } +\tl_map_inline:nn { {em} {ex} } + { + \cs_new_nopar:cpn { __fp_parse_word_#1:N } + { + \exp_after:wN \dim_to_fp:n \exp_after:wN + { \dim_use:N \__dim_eval:w 1 #1 \exp_after:wN } + \tex_romannumeral:D -`0 \__fp_parse_infix:NN + } + } +\tl_map_inline:nn { {abs} {cos} {cot} {exp} {ln} {sin} {tan} } + { + \cs_new:cpn { __fp_parse_word_#1:N } ##1 + { + \exp_after:wN \__fp_parse_apply_unary:NNwN + \exp_after:wN ##1 + \cs:w __fp_ #1 \exp_after:wN \__fp_parse_unary_type:N + \tex_romannumeral:D + \__fp_parse_until:Nw \c_fifteen + \__fp_parse_expand:w + } + } +\cs_set_protected:Npn \__fp_tmp:w #1#2 + { + \cs_new:Npn #1 ##1 + { + \exp_after:wN \__fp_parse_apply_unary_array:NNwN + \exp_after:wN ##1 + \exp_after:wN #2 + \tex_romannumeral:D + \__fp_parse_until:Nw \c_sixteen \__fp_parse_expand:w + } + } +\__fp_tmp:w \__fp_parse_word_max:N \__fp_max:w +\__fp_tmp:w \__fp_parse_word_min:N \__fp_min:w + % \__fp_tmp:w \__fp_parse_word_mod:N \__fp_mod:w %^^A todo: not implemented! +\cs_new:Npn \__fp_parse_word_round:N #1#2 + { + \if_meaning:w + #2 + \__fp_parse_round:Nw \__fp_round_to_pinf:NNN \else: - \tl_set:Nx \l_fp_round_decimal_tl { 0 \l_fp_round_decimal_tl } - \if_int_compare:w \l_fp_round_position_int = \l_fp_round_target_int - \if_int_compare:w #1 > \c_four - \bool_set_true:N \l_fp_round_carry_bool + \if_meaning:w 0 #2 + \__fp_parse_round:Nw \__fp_round_to_zero:NNN + \else: + \if_meaning:w - #2 + \__fp_parse_round:Nw \__fp_round_to_ninf:NNN \fi: \fi: \fi: - \tex_advance:D \l_fp_round_position_int \c_minus_one - \if_int_compare:w \l_fp_round_position_int > \c_minus_one - \exp_after:wN \fp_round_loop:N + \exp_after:wN \__fp_parse_apply_round:NNwN + \exp_after:wN #1 + \exp_after:wN \__fp_round_to_nearest:NNN + \tex_romannumeral:D + \__fp_parse_until:Nw \c_sixteen \__fp_parse_expand:w #2 + } +\cs_new:Npn \__fp_parse_round:Nw + #1 #2 \__fp_round_to_nearest:NNN #3 \__fp_parse_expand:w #4 + { #2 #1 #3 \__fp_parse_expand:w } +\cs_new:Npn \__fp_parse_apply_round:NNwN #1#2#3@#4 + { + \if_case:w \__int_eval:w \__fp_array_count:w #3@ - \c_one \__int_eval_end: + \__fp_round:Nwn #2 #3 {0} \tex_romannumeral:D + \or: \__fp_round:Nww #2 #3 \tex_romannumeral:D + \else: + \__fp_error:n { round()~expects~1~or~2~arguments. } + \exp_after:wN \c_nan_fp \tex_romannumeral:D \fi: + -`0 #4 #1 } -\cs_new_protected_nopar:Npn \fp_abs:N { \fp_abs_aux:NN \tl_set:Nn } -\cs_new_protected_nopar:Npn \fp_gabs:N { \fp_abs_aux:NN \tl_gset:Nn } -\cs_generate_variant:Nn \fp_abs:N { c } -\cs_generate_variant:Nn \fp_gabs:N { c } -\cs_new_protected:Npn \fp_abs_aux:NN #1#2 +\cs_new_eq:cN { __fp_parse_prefix_+:Nw } \__fp_parse_operand:Nw +\cs_set_protected:Npn \__fp_tmp:w #1#2 { - \group_begin: - \fp_read:N #2 - \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million - \cs_set_protected_nopar:Npx \fp_tmp:w + \cs_new:cpn { __fp_parse_prefix_#1:Nw } ##1 + { + \exp_after:wN \__fp_parse_apply_unary:NNwN + \exp_after:wN ##1 + \cs:w __fp_ #2 \exp_after:wN \__fp_parse_unary_type:N + \tex_romannumeral:D + \if_int_compare:w \c_twelve < ##1 + \__fp_parse_until:Nw ##1 + \else: + \__fp_parse_until:Nw \c_twelve + \fi: + \__fp_parse_expand:w + } + } +\__fp_tmp:w - { neg } +\__fp_tmp:w ! { not } +\group_begin: + \char_set_catcode_letter:N \) + \cs_new:cpn { __fp_parse_prefix_(:Nw } #1 + { + \exp_after:wN \__fp_parse_lparen_after:NwN + \exp_after:wN #1 + \tex_romannumeral:D + \if_int_compare:w #1 = \c_sixteen + \__fp_parse_until:Nw \c_one + \else: + \__fp_parse_until:Nw \c_zero + \fi: + \__fp_parse_expand:w + } + \cs_new:Npn \__fp_parse_lparen_after:NwN #1#2@#3 + { + \token_if_eq_meaning:NNTF #3 \__fp_parse_infix_):N { - \group_end: - #1 \exp_not:N #2 - { - + - \int_use:N \l_fp_input_a_integer_int - . - \exp_after:wN \use_none:n - \int_use:N \l_fp_input_a_decimal_int - e - \int_use:N \l_fp_input_a_exponent_int - } + \__fp_parse_exp_after_array:wf #2 \s__fp_stop + \exp_after:wN \__fp_parse_infix:NN + \exp_after:wN #1 + \tex_romannumeral:D \__fp_parse_expand:w } - \fp_tmp:w - } -\cs_new_protected_nopar:Npn \fp_neg:N { \fp_neg_aux:NN \tl_set:Nn } -\cs_new_protected_nopar:Npn \fp_gneg:N { \fp_neg_aux:NN \tl_gset:Nn } -\cs_generate_variant:Nn \fp_neg:N { c } -\cs_generate_variant:Nn \fp_gneg:N { c } -\cs_new_protected:Npn \fp_neg_aux:NN #1#2 - { - \group_begin: - \fp_read:N #2 - \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million - \tl_set:Nx \l_fp_internal_tl { - \if_int_compare:w \l_fp_input_a_sign_int < \c_zero - + - \else: - - - \fi: - \int_use:N \l_fp_input_a_integer_int - . - \exp_after:wN \use_none:n - \int_use:N \l_fp_input_a_decimal_int - e - \int_use:N \l_fp_input_a_exponent_int + \__fp_error:n { Missing~')'~inserted. } + #2 @ \__fp_parse_stop_until:N #3 } - \exp_after:wN \group_end: \exp_after:wN - #1 \exp_after:wN #2 \exp_after:wN { \l_fp_internal_tl } - } -\cs_new_protected_nopar:Npn \fp_add:Nn { \fp_add_aux:NNn \tl_set:Nn } -\cs_new_protected_nopar:Npn \fp_gadd:Nn { \fp_add_aux:NNn \tl_gset:Nn } -\cs_generate_variant:Nn \fp_add:Nn { c } -\cs_generate_variant:Nn \fp_gadd:Nn { c } -\cs_new_protected:Npn \fp_add_aux:NNn #1#2#3 - { - \group_begin: - \fp_read:N #2 - \fp_split:Nn b {#3} - \fp_standardise:NNNN - \l_fp_input_b_sign_int - \l_fp_input_b_integer_int - \l_fp_input_b_decimal_int - \l_fp_input_b_exponent_int - \fp_add_core: - \fp_tmp:w #1#2 - } -\cs_new_protected_nopar:Npn \fp_add_core: - { - \fp_level_input_exponents: - \if_int_compare:w - \int_eval:w - \l_fp_input_a_sign_int * \l_fp_input_b_sign_int - > \c_zero - \exp_after:wN \fp_add_sum: - \else: - \exp_after:wN \fp_add_difference: - \fi: - \l_fp_output_exponent_int \l_fp_input_a_exponent_int - \fp_standardise:NNNN - \l_fp_output_sign_int - \l_fp_output_integer_int - \l_fp_output_decimal_int - \l_fp_output_exponent_int - \cs_set_protected:Npx \fp_tmp:w ##1##2 + } +\group_end: +\cs_new:Npn \__fp_parse_exp_after_array:wf #1 + { + \cs:w __fp \__fp_type_from_scan:N #1 _exp_after_f:nw \cs_end: + { \__fp_parse_exp_after_array:wf } + #1 + } +\cs_new:Npn \__fp_stop_exp_after_f:nw #1#2 { } +\cs_new:cpn {__fp_parse_prefix_.:Nw} #1 + { + \exp_after:wN \__fp_parse_infix_after_operand:NwN + \exp_after:wN #1 + \tex_romannumeral:D -`0 + \exp_after:wN \__fp_sanitize:wN + \int_use:N \__int_eval:w \c_zero \__fp_parse_strim_zeros:N + } +\cs_set_protected:Npn \__fp_tmp:w #1#2#3#4 + { + \cs_new:Npn #1 ##1 { - \group_end: - ##1 ##2 - { - \if_int_compare:w \l_fp_output_sign_int < \c_zero - - - \else: - + - \fi: - \int_use:N \l_fp_output_integer_int - . - \exp_after:wN \use_none:n - \int_value:w \int_eval:w - \l_fp_output_decimal_int + \c_one_thousand_million - e - \int_use:N \l_fp_output_exponent_int - } + \if_int_compare:w ##1 < #3 + \exp_after:wN @ + \exp_after:wN \__fp_parse_apply_binary:NwNwN + \exp_after:wN #2 + \tex_romannumeral:D + \__fp_parse_until:Nw #4 + \exp_after:wN \__fp_parse_expand:w + \else: + \exp_after:wN @ + \exp_after:wN \__fp_parse_stop_until:N + \exp_after:wN #1 + \fi: } } -\cs_new_protected_nopar:Npn \fp_add_sum: - { - \l_fp_output_sign_int \l_fp_input_a_sign_int - \l_fp_output_integer_int - \int_eval:w - \l_fp_input_a_integer_int + \l_fp_input_b_integer_int - \scan_stop: - \l_fp_output_decimal_int - \int_eval:w - \l_fp_input_a_decimal_int + \l_fp_input_b_decimal_int - \scan_stop: - \if_int_compare:w \l_fp_output_decimal_int < \c_one_thousand_million - \else: - \tex_advance:D \l_fp_output_integer_int \c_one - \tex_advance:D \l_fp_output_decimal_int -\c_one_thousand_million - \fi: - } -\cs_new_protected_nopar:Npn \fp_add_difference: - { - \l_fp_output_integer_int - \int_eval:w - \l_fp_input_a_integer_int - \l_fp_input_b_integer_int - \scan_stop: - \l_fp_output_decimal_int - \int_eval:w - \l_fp_input_a_decimal_int - \l_fp_input_b_decimal_int - \scan_stop: - \if_int_compare:w \l_fp_output_decimal_int < \c_zero - \tex_advance:D \l_fp_output_integer_int \c_minus_one - \tex_advance:D \l_fp_output_decimal_int \c_one_thousand_million - \fi: - \if_int_compare:w \l_fp_output_integer_int < \c_zero - \l_fp_output_sign_int \l_fp_input_b_sign_int - \if_int_compare:w \l_fp_output_decimal_int = \c_zero - \l_fp_output_integer_int -\l_fp_output_integer_int +\group_begin: + \char_set_catcode_other:N \& + \__fp_tmp:w \__fp_parse_infix_juxtapose:N * \c_thirty_two \c_thirty_two + \exp_args:Nc \__fp_tmp:w { __fp_parse_infix_ / :N } / \c_ten \c_ten + \exp_args:Nc \__fp_tmp:w { __fp_parse_infix_mul:N } * \c_ten \c_ten + \exp_args:Nc \__fp_tmp:w { __fp_parse_infix_ - :N } - \c_nine \c_nine + \exp_args:Nc \__fp_tmp:w { __fp_parse_infix_ + :N } + \c_nine \c_nine + \exp_args:Nc \__fp_tmp:w { __fp_parse_infix_and:N } & \c_five \c_five + \exp_args:Nc \__fp_tmp:w { __fp_parse_infix_ or:N } | \c_four \c_four +\group_end: +\group_begin: + \char_set_catcode_letter:N ^ + \__fp_tmp:w \__fp_parse_infix_^:N ^ \c_fifteen \c_fourteen + \cs_new:cpn { __fp_parse_infix_*:N } #1#2 + { + \if:w * #2 + \exp_after:wN \__fp_parse_infix_^:N + \exp_after:wN #1 \else: - \l_fp_output_decimal_int - \int_eval:w - \c_one_thousand_million - \l_fp_output_decimal_int - \scan_stop: - \l_fp_output_integer_int - \int_eval:w - - \l_fp_output_integer_int - \c_one - \scan_stop: - \fi: - \else: - \l_fp_output_sign_int \l_fp_input_a_sign_int - \fi: - } -\cs_new_protected_nopar:Npn \fp_sub:Nn { \fp_sub_aux:NNn \tl_set:Nn } -\cs_new_protected_nopar:Npn \fp_gsub:Nn { \fp_sub_aux:NNn \tl_gset:Nn } -\cs_generate_variant:Nn \fp_sub:Nn { c } -\cs_generate_variant:Nn \fp_gsub:Nn { c } -\cs_new_protected:Npn \fp_sub_aux:NNn #1#2#3 - { - \group_begin: - \fp_read:N #2 - \fp_split:Nn b {#3} - \fp_standardise:NNNN - \l_fp_input_b_sign_int - \l_fp_input_b_integer_int - \l_fp_input_b_decimal_int - \l_fp_input_b_exponent_int - \tex_multiply:D \l_fp_input_b_sign_int \c_minus_one - \fp_add_core: - \fp_tmp:w #1#2 - } -\cs_new_protected_nopar:Npn \fp_mul:Nn { \fp_mul_aux:NNn \tl_set:Nn } -\cs_new_protected_nopar:Npn \fp_gmul:Nn { \fp_mul_aux:NNn \tl_gset:Nn } -\cs_generate_variant:Nn \fp_mul:Nn { c } -\cs_generate_variant:Nn \fp_gmul:Nn { c } -\cs_new_protected:Npn \fp_mul_aux:NNn #1#2#3 - { - \group_begin: - \fp_read:N #2 - \fp_split:Nn b {#3} - \fp_standardise:NNNN - \l_fp_input_b_sign_int - \l_fp_input_b_integer_int - \l_fp_input_b_decimal_int - \l_fp_input_b_exponent_int - \fp_mul_internal: - \l_fp_output_exponent_int - \int_eval:w - \l_fp_input_a_exponent_int + \l_fp_input_b_exponent_int - \scan_stop: - \fp_standardise:NNNN - \l_fp_output_sign_int - \l_fp_output_integer_int - \l_fp_output_decimal_int - \l_fp_output_exponent_int - \cs_set_protected_nopar:Npx \fp_tmp:w - { - \group_end: - #1 \exp_not:N #2 - { - \if_int_compare:w - \int_eval:w - \l_fp_input_a_sign_int * \l_fp_input_b_sign_int - < \c_zero - \if_int_compare:w - \int_eval:w - \l_fp_output_integer_int + \l_fp_output_decimal_int - = \c_zero - + - \else: - - - \fi: - \else: - + - \fi: - \int_use:N \l_fp_output_integer_int - . - \exp_after:wN \use_none:n - \int_value:w \int_eval:w - \l_fp_output_decimal_int + \c_one_thousand_million - e - \int_use:N \l_fp_output_exponent_int - } - } - \fp_tmp:w - } -\cs_new_protected_nopar:Npn \fp_mul_internal: - { - \fp_mul_split:NNNN \l_fp_input_a_decimal_int - \l_fp_mul_a_i_int \l_fp_mul_a_ii_int \l_fp_mul_a_iii_int - \fp_mul_split:NNNN \l_fp_input_b_decimal_int - \l_fp_mul_b_i_int \l_fp_mul_b_ii_int \l_fp_mul_b_iii_int - \l_fp_mul_output_int \c_zero - \tl_clear:N \l_fp_mul_output_tl - \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_iii_int - \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_ii_int - \fp_mul_product:NN \l_fp_mul_a_iii_int \l_fp_mul_b_i_int - \tex_divide:D \l_fp_mul_output_int \c_one_thousand - \fp_mul_product:NN \l_fp_input_a_integer_int \l_fp_mul_b_iii_int - \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_ii_int - \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_i_int - \fp_mul_product:NN \l_fp_mul_a_iii_int \l_fp_input_b_integer_int - \fp_mul_end_level: - \fp_mul_product:NN \l_fp_input_a_integer_int \l_fp_mul_b_ii_int - \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_i_int - \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_input_b_integer_int - \fp_mul_end_level: - \fp_mul_product:NN \l_fp_input_a_integer_int \l_fp_mul_b_i_int - \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_input_b_integer_int - \fp_mul_end_level: - \l_fp_output_decimal_int 0 \l_fp_mul_output_tl \scan_stop: - \tl_clear:N \l_fp_mul_output_tl - \fp_mul_product:NN \l_fp_input_a_integer_int \l_fp_input_b_integer_int - \fp_mul_end_level: - \l_fp_output_integer_int 0 \l_fp_mul_output_tl \scan_stop: - } -\cs_new_protected:Npn \fp_mul_split:NNNN #1#2#3#4 - { - \tex_advance:D #1 \c_one_thousand_million - \cs_set_protected:Npn \fp_mul_split_aux:w - ##1##2##3##4##5##6##7##8##9 \q_stop { - #2 ##2##3##4 \scan_stop: - #3 ##5##6##7 \scan_stop: - #4 ##8##9 \scan_stop: - } - \exp_after:wN \fp_mul_split_aux:w \int_use:N #1 \q_stop - \tex_advance:D #1 -\c_one_thousand_million + \exp_after:wN \__fp_parse_infix_mul:N + \exp_after:wN #1 + \exp_after:wN #2 + \fi: + } +\group_end: +\group_begin: + \char_set_catcode_letter:N \| + \char_set_catcode_letter:N \& + \cs_new:Npn \__fp_parse_infix_|:N #1#2 + { + \if:w | #2 + \exp_after:wN \__fp_parse_infix_|:N + \exp_after:wN #1 + \tex_romannumeral:D \exp_after:wN \__fp_parse_expand:w + \else: + \exp_after:wN \__fp_parse_infix_or:N + \exp_after:wN #1 + \exp_after:wN #2 + \fi: + } + \cs_new:Npn \__fp_parse_infix_&:N #1#2 + { + \if:w & #2 + \exp_after:wN \__fp_parse_infix_&:N + \exp_after:wN #1 + \tex_romannumeral:D \exp_after:wN \__fp_parse_expand:w + \else: + \exp_after:wN \__fp_parse_infix_and:N + \exp_after:wN #1 + \exp_after:wN #2 + \fi: + } +\group_end: +\cs_new:cpn { __fp_parse_infix_<:N } #1 + { + \__fp_infix_compare:N #1 \c_one_fp + \c_zero_fp \c_zero_fp \c_zero_fp \c_zero_fp < } -\cs_new_protected:Npn \fp_mul_product:NN #1#2 +\cs_new:cpn { __fp_parse_infix_=:N } #1 { - \l_fp_mul_output_int - \int_eval:w \l_fp_mul_output_int + #1 * #2 \scan_stop: + \__fp_infix_compare:N #1 \c_one_fp + \c_zero_fp \c_zero_fp \c_zero_fp \c_zero_fp = } -\cs_new_protected_nopar:Npn \fp_mul_end_level: +\cs_new:cpn { __fp_parse_infix_>:N } #1 { - \tex_advance:D \l_fp_mul_output_int \c_one_thousand_million - \exp_after:wN \use_i:nn \exp_after:wN - \fp_mul_end_level:NNNNNNNNN \int_use:N \l_fp_mul_output_int + \__fp_infix_compare:N #1 \c_one_fp + \c_zero_fp \c_zero_fp \c_zero_fp \c_zero_fp > } -\cs_new_protected:Npn \fp_mul_end_level:NNNNNNNNN #1#2#3#4#5#6#7#8#9 +\cs_new:cpn { __fp_parse_infix_!:N } #1 { - \tl_set:Nx \l_fp_mul_output_tl { #7#8#9 \l_fp_mul_output_tl } - \l_fp_mul_output_int #1#2#3#4#5#6 \scan_stop: + \exp_after:wN \__fp_parse_infix_excl_aux:NN + \exp_after:wN #1 \tex_romannumeral:D \__fp_parse_expand:w } -\cs_new_protected_nopar:Npn \fp_div:Nn { \fp_div_aux:NNn \tl_set:Nn } -\cs_new_protected_nopar:Npn \fp_gdiv:Nn { \fp_div_aux:NNn \tl_gset:Nn } -\cs_generate_variant:Nn \fp_div:Nn { c } -\cs_generate_variant:Nn \fp_gdiv:Nn { c } -\cs_new_protected:Npn \fp_div_aux:NNn #1#2#3 - { - \group_begin: - \fp_read:N #2 - \fp_split:Nn b {#3} - \fp_standardise:NNNN - \l_fp_input_b_sign_int - \l_fp_input_b_integer_int - \l_fp_input_b_decimal_int - \l_fp_input_b_exponent_int - \if_int_compare:w - \int_eval:w - \l_fp_input_b_integer_int + \l_fp_input_b_decimal_int - = \c_zero - \cs_set_protected:Npx \fp_tmp:w ##1##2 - { - \group_end: - #1 \exp_not:N #2 { \c_undefined_fp } - } +\cs_new:Npn \__fp_parse_infix_excl_aux:NN #1#2 + { + \if_catcode:w \tex_relax:D #2 + \__fp_parse_infix_excl_error: + \else: + \if_int_compare:w `#2 > `? \exp_stop_f: + \__fp_parse_infix_excl_error: \else: - \if_int_compare:w - \int_eval:w - \l_fp_input_a_integer_int + \l_fp_input_a_decimal_int - = \c_zero - \cs_set_protected:Npx \fp_tmp:w ##1##2 - { - \group_end: - #1 \exp_not:N #2 { \c_zero_fp } - } + \if_int_compare:w `#2 < `< \exp_stop_f: + \__fp_parse_infix_excl_error: + \fi: + \fi: + \fi: + \__fp_infix_compare:N #1 \c_zero_fp + \c_one_fp \c_one_fp \c_one_fp \c_one_fp #2 + } +\cs_new:Npn \__fp_parse_infix_excl_error: + { \__msg_expandable_error:n { Missing~relation~symbol~after~'!'. } } +\cs_new:Npn \__fp_infix_compare:N #1 + { + \if_int_compare:w #1 < \c_seven + \exp_after:wN \__fp_parse_compare:NNNNNw + \else: + \exp_after:wN @ + \exp_after:wN \__fp_parse_stop_until:N + \exp_after:wN \__fp_infix_compare:N + \fi: + } +\cs_new:Npn \__fp_parse_compare:NNNNNw #1#2#3#4#5#6 + { + \if_case:w + \if_catcode:w \tex_relax:D #6 + \c_minus_one + \else: + \__int_eval:w `#6 - `< \__int_eval_end: + \fi: + \__fp_parse_compare_expand:NNNNNw #1#1#3#4#5 + \or: \__fp_parse_compare_expand:NNNNNw #1#2#1#4#5 + \or: \__fp_parse_compare_expand:NNNNNw #1#2#3#1#5 + \or: \__fp_parse_compare_expand:NNNNNw #1#2#3#4#1 + \else: \__fp_parse_compare_end:NNNN #2#3#4#5#6 + \fi: + } +\cs_new:Npn \__fp_parse_compare_expand:NNNNNw #1#2#3#4#5 + { + \exp_after:wN \__fp_parse_compare:NNNNNw + \exp_after:wN #1 + \exp_after:wN #2 + \exp_after:wN #3 + \exp_after:wN #4 + \exp_after:wN #5 + \tex_romannumeral:D \exp_after:wN \__fp_parse_expand:w + } +\cs_new:Npn \__fp_parse_compare_end:NNNN #1#2#3#4#5 \fi: + { + \fi: + \exp_after:wN @ + \exp_after:wN \__fp_parse_apply_compare:NwNNNNwN + \exp_after:wN #1 + \exp_after:wN #2 + \exp_after:wN #3 + \exp_after:wN #4 + \tex_romannumeral:D + \__fp_parse_until:Nw \c_seven \__fp_parse_expand:w #5 + } +\cs_new:Npn \__fp_parse_apply_compare:NwNNNNwN #1 #2@ #3#4#5#6 #7@ #8 + { + \exp_after:wN \__fp_parse_until_test:NwN + \exp_after:wN #1 + \tex_romannumeral:D -`0 + \exp_after:wN \exp_after:wN + \exp_after:wN \exp_after:wN + \exp_after:wN \exp_after:wN + \if_case:w \__fp_compare:ww #2 #7 \exp_stop_f: + #4 + \or: #5 + \or: #6 + \else: #3 + \fi: + \tex_romannumeral:D -`0 #8 #1 + } +\group_begin: + \char_set_catcode_letter:N \? + \cs_new:Npn \__fp_parse_infix_?:N #1 + { + \if_int_compare:w #1 < \c_three + \exp_after:wN @ + \exp_after:wN \__fp_ternary:NwwN + \tex_romannumeral:D + \__fp_parse_until:Nw \c_three + \exp_after:wN \__fp_parse_expand:w + \else: + \exp_after:wN @ + \exp_after:wN \__fp_parse_stop_until:N + \exp_after:wN \__fp_parse_infix_?:N + \fi: + } + \cs_new:Npn \__fp_parse_infix_::N #1 + { + \if_int_compare:w #1 < \c_three + \__msg_expandable_error:n { Missing~'?'~inserted~for~'?:'. } + \exp_after:wN @ + \exp_after:wN \__fp_ternary_ii:NwwN + \tex_romannumeral:D + \__fp_parse_until:Nw \c_two + \exp_after:wN \__fp_parse_expand:w + \else: + \exp_after:wN @ + \exp_after:wN \__fp_parse_stop_until:N + \exp_after:wN \__fp_parse_infix_::N + \fi: + } +\group_end: +\group_begin: + \char_set_catcode_letter:N \) + \cs_new:Npn \__fp_parse_infix_):N #1 + { + \if_int_compare:w #1 < \c_zero + \__fp_error:n { Extra~')'~ignored. } + \exp_after:wN \__fp_parse_infix:NN + \exp_after:wN #1 + \tex_romannumeral:D \exp_after:wN \__fp_parse_expand:w + \else: + \exp_after:wN @ + \exp_after:wN \__fp_parse_stop_until:N + \exp_after:wN \__fp_parse_infix_):N + \fi: + } +\group_end: +\cs_new:Npn \__fp_parse_infix_end:N #1 + { @ \__fp_parse_stop_until:N \__fp_parse_infix_end:N } +\group_begin: + \char_set_catcode_letter:N \, + \cs_new:Npn \__fp_parse_infix_,:N #1 + { + \if_int_compare:w #1 > \c_one + \exp_after:wN @ + \exp_after:wN \__fp_parse_stop_until:N + \exp_after:wN \__fp_parse_infix_,:N + \else: + \if_int_compare:w #1 = \c_one + \exp_after:wN \__fp_parse_infix_comma:w + \tex_romannumeral:D \else: - \exp_after:wN \exp_after:wN \exp_after:wN \fp_div_internal: + \exp_after:wN \__fp_parse_infix_comma_gobble:w + \tex_romannumeral:D \fi: + \__fp_parse_until:Nw \c_one + \exp_after:wN \__fp_parse_expand:w \fi: - \fp_tmp:w #1#2 - } -\cs_new_protected_nopar:Npn \fp_div_internal: { - \l_fp_output_integer_int \c_zero - \l_fp_output_decimal_int \c_zero - \cs_set_eq:NN \fp_div_store: \fp_div_store_integer: - \l_fp_div_offset_int \c_one_hundred_million - \fp_div_loop: - \l_fp_output_exponent_int - \int_eval:w - \l_fp_input_a_exponent_int - \l_fp_input_b_exponent_int - \scan_stop: - \fp_standardise:NNNN - \l_fp_output_sign_int - \l_fp_output_integer_int - \l_fp_output_decimal_int - \l_fp_output_exponent_int - \cs_set_protected:Npx \fp_tmp:w ##1##2 + } + \cs_new:Npn \__fp_parse_infix_comma:w #1 @ + { #1 @ \__fp_parse_stop_until:N } + \cs_new:Npn \__fp_parse_infix_comma_gobble:w #1 @ { - \group_end: - ##1 ##2 - { - \if_int_compare:w - \int_eval:w - \l_fp_input_a_sign_int * \l_fp_input_b_sign_int - < \c_zero - \if_int_compare:w - \int_eval:w - \l_fp_output_integer_int + \l_fp_output_decimal_int - = \c_zero - + - \else: - - - \fi: + \__fp_error:n { Unexpected~comma:~extra~arguments~ignored. } + @ \__fp_parse_stop_until:N + } +\group_end: +%% File: l3fp-logic.dtx Copyright (C) 2011-2012 The 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 +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% 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. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +\cs_new_eq:NN \fp_if_exist:NTF \cs_if_exist:NTF +\cs_new_eq:NN \fp_if_exist:NT \cs_if_exist:NT +\cs_new_eq:NN \fp_if_exist:NF \cs_if_exist:NF +\cs_new_eq:NN \fp_if_exist_p:N \cs_if_exist_p:N +\cs_new_eq:NN \fp_if_exist:cTF \cs_if_exist:cTF +\cs_new_eq:NN \fp_if_exist:cT \cs_if_exist:cT +\cs_new_eq:NN \fp_if_exist:cF \cs_if_exist:cF +\cs_new_eq:NN \fp_if_exist_p:c \cs_if_exist_p:c +\cs_new:Npn \__fp_compare:ww \s__fp \__fp_chk:w #1#2#3; \s__fp \__fp_chk:w #4#5#6; + { + \__int_value:w + \if_meaning:w 3 #1 \exp_after:wN \__fp_compare_nan:w \fi: + \if_meaning:w 3 #4 \exp_after:wN \__fp_compare_nan:w \fi: + \if_meaning:w 2 #2 - \fi: + \if_meaning:w #2 #5 + \if_meaning:w #1 #4 + \if_meaning:w 1 #1 + \__fp_compare_mantissa:ww #3; #6; \else: - + + 0 \fi: - \int_use:N \l_fp_output_integer_int - . - \exp_after:wN \use_none:n - \int_value:w \int_eval:w - \l_fp_output_decimal_int + \c_one_thousand_million - \int_eval_end: - e - \int_use:N \l_fp_output_exponent_int - } - } -} -\cs_new_protected_nopar:Npn \fp_div_loop: - { - \l_fp_count_int \c_zero - \fp_div_divide: - \fp_div_store: - \tex_multiply:D \l_fp_input_a_integer_int \c_ten - \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million - \exp_after:wN \fp_div_loop_step:w - \int_use:N \l_fp_input_a_decimal_int \q_stop - \if_int_compare:w - \int_eval:w \l_fp_input_a_integer_int + \l_fp_input_a_decimal_int - > \c_zero - \if_int_compare:w \l_fp_div_offset_int > \c_zero - \exp_after:wN \exp_after:wN \exp_after:wN - \fp_div_loop: + \else: + \if_int_compare:w #1 < #4 - \fi: 1 \fi: - \fi: + \else: + \if_meaning:w 0 #1 + \if_meaning:w 0 #4 + 0 + \else: + 1 + \fi: + \else: + 1 + \fi: + \fi: + \exp_stop_f: } -\cs_new_protected_nopar:Npn \fp_div_divide: +\cs_new:Npn \__fp_compare_nan:w #1 \exp_stop_f: { \c_two } +\cs_new:Npn \__fp_compare_mantissa:ww #1#2; #3#4; { - \if_int_compare:w \l_fp_input_a_integer_int > \l_fp_input_b_integer_int - \exp_after:wN \fp_div_divide_aux: + \if_int_compare:w #1 = #3 \exp_stop_f: + \__fp_compare_mantissa:nnnnnnnn #2 #4 \else: - \if_int_compare:w \l_fp_input_a_integer_int < \l_fp_input_b_integer_int - \else: - \if_int_compare:w - \l_fp_input_a_decimal_int < \l_fp_input_b_decimal_int + \if_int_compare:w #1 < #3 - \fi: 1 + \fi: + } +\cs_new:Npn \__fp_compare_mantissa:nnnnnnnn #1#2#3#4#5#6#7#8 + { + \if_int_compare:w #1 = #5 \exp_stop_f: + \if_int_compare:w #2 = #6 \exp_stop_f: + \if_int_compare:w #3 = #7 \exp_stop_f: + \if_int_compare:w #4 = #8 \exp_stop_f: + 0 + \else: + \if_int_compare:w #4 < #8 - \fi: 1 + \fi: \else: - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_after:wN \fp_div_divide_aux: + \if_int_compare:w #3 < #7 - \fi: 1 \fi: + \else: + \if_int_compare:w #2 < #6 - \fi: 1 \fi: + \else: + \if_int_compare:w #1 < #5 - \fi: 1 \fi: } -\cs_new_protected_nopar:Npn \fp_div_divide_aux: +\prg_new_conditional:Npnn \fp_compare:nNn #1#2#3 { p , T , F , TF } { - \tex_advance:D \l_fp_count_int \c_one - \tex_advance:D \l_fp_input_a_integer_int -\l_fp_input_b_integer_int - \tex_advance:D \l_fp_input_a_decimal_int -\l_fp_input_b_decimal_int - \if_int_compare:w \l_fp_input_a_decimal_int < \c_zero - \tex_advance:D \l_fp_input_a_integer_int \c_minus_one - \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million + \if_int_compare:w + \exp_after:wN \__fp_compare_aux:wn + \tex_romannumeral:D -`0 \__fp_parse:n {#3} {#1} + = \__int_eval:w `#2 - `= \__int_eval_end: + \prg_return_true: + \else: + \prg_return_false: \fi: - \fp_div_divide: } -\cs_new_protected_nopar:Npn \fp_div_store: { } -\cs_new_protected_nopar:Npn \fp_div_store_integer: +\cs_new:Npn \__fp_compare_aux:wn #1; #2 { - \l_fp_output_integer_int \l_fp_count_int - \cs_set_eq:NN \fp_div_store: \fp_div_store_decimal: + \exp_after:wN \__fp_compare:ww + \tex_romannumeral:D -`0 \__fp_parse:n {#2} #1; } -\cs_new_protected_nopar:Npn \fp_div_store_decimal: +\prg_new_conditional:Npnn \fp_compare:n #1 { p , T , F , TF } { - \l_fp_output_decimal_int - \int_eval:w - \l_fp_output_decimal_int + - \l_fp_count_int * \l_fp_div_offset_int - \int_eval_end: - \tex_divide:D \l_fp_div_offset_int \c_ten + \exp_after:wN \__fp_compare_aux:w + \tex_romannumeral:D -`0 \__fp_parse:n {#1} } -\cs_new_protected:Npn \fp_div_loop_step:w #1#2#3#4#5#6#7#8#9 \q_stop +\cs_new:Npn \__fp_compare_aux:w \s__fp \__fp_chk:w #1#2; { - \l_fp_input_a_integer_int - \int_eval:w #2 + \l_fp_input_a_integer_int \int_eval_end: - \l_fp_input_a_decimal_int #3#4#5#6#7#8#9 0 \scan_stop: + \if_meaning:w 0 #1 + \prg_return_false: + \else: + \prg_return_true: + \fi: } -\cs_new_protected:Npn \fp_add:NNNNNNNNN #1#2#3#4#5#6#7#8#9 +\cs_new:Npn \__fp_not:w \s__fp \__fp_chk:w #1#2; { - #7 \int_eval:w #1 + #4 \int_eval_end: - #8 \int_eval:w #2 + #5 \int_eval_end: - #9 \int_eval:w #3 + #6 \int_eval_end: - \if_int_compare:w #9 < \c_one_thousand_million + \if_meaning:w 0 #1 + \exp_after:wN \exp_after:wN \exp_after:wN \c_one_fp \else: - \tex_advance:D #8 \c_one - \tex_advance:D #9 -\c_one_thousand_million + \exp_after:wN \exp_after:wN \exp_after:wN \c_zero_fp \fi: - \if_int_compare:w #8 < \c_one_thousand_million + } +\cs_new:cpn { __fp_ \iow_char:N \& _o:ww } #1 \s__fp \__fp_chk:w #2#3; + { + \if_meaning:w 0 #2 #1 + \__fp_and_return:wNw \s__fp \__fp_chk:w #2#3; + \fi: + \__fp_exp_after_o:w + } +\cs_new_nopar:cpx { __fp_ \iow_char:N \| _o:ww } + { \exp_not:c { __fp_ \iow_char:N \& _o:ww } \exp_not:N \else: } +\cs_new:Npn \__fp_and_return:wNw #1; \fi: #2#3; { \fi: #2 #1; } +\cs_new:Npn \__fp_ternary:NwwN #1 #2@ #3@ #4 + { + \if_meaning:w \__fp_parse_infix_::N #4 + \__fp_ternary_loop:Nw + #2 + \s__fp \__fp_chk:w { \__fp_ternary_loop_break:w } ; + \__fp_ternary_break_point:n { \exp_after:wN \__fp_ternary_i:NwwN } + \exp_after:wN #1 + \tex_romannumeral:D -`0 + \__fp_parse_exp_after_array:wf #3 \s__fp_stop + \exp_after:wN @ + \tex_romannumeral:D + \__fp_parse_until:Nw \c_two + \__fp_parse_expand:w \else: - \tex_advance:D #7 \c_one - \tex_advance:D #8 -\c_one_thousand_million + \__fp_error:n { Missing~':'~clause~for~'?:'. } + \exp_after:wN \__fp_parse_until_test:NwN + \exp_after:wN #1 + \tex_romannumeral:D -`0 + \__fp_parse_exp_after_array:wf #3 \s__fp_stop + \exp_after:wN #4 + \exp_after:wN #1 \fi: } -\cs_new_protected:Npn \fp_sub:NNNNNNNNN #1#2#3#4#5#6#7#8#9 +\cs_new:Npn \__fp_ternary_loop_break:w #1 \fi: #2 \__fp_ternary_break_point:n #3 { - #7 \int_eval:w #1 - #4 \int_eval_end: - #8 \int_eval:w #2 - #5 \int_eval_end: - #9 \int_eval:w #3 - #6 \int_eval_end: - \if_int_compare:w #9 < \c_zero - \tex_advance:D #8 \c_minus_one - \tex_advance:D #9 \c_one_thousand_million - \fi: - \if_int_compare:w #8 < \c_zero - \tex_advance:D #7 \c_minus_one - \tex_advance:D #8 \c_one_thousand_million + \c_zero = \c_zero \fi: + \exp_after:wN \__fp_ternary_ii:NwwN + } +\cs_new:Npn \__fp_ternary_loop:Nw \s__fp \__fp_chk:w #1#2; + { + \if_int_compare:w #1 > \c_zero + \exp_after:wN \__fp_ternary_map_break: \fi: - \if_int_compare:w #7 < \c_zero - \if_int_compare:w \int_eval:w #8 + #9 = \c_zero - #7 -#7 - \else: - \tex_advance:D #7 \c_one - #8 \int_eval:w \c_one_thousand_million - #8 \int_eval_end: - #9 \int_eval:w \c_one_thousand_million - #9 \int_eval_end: - \fi: - \fi: - } -\cs_new_protected:Npn \fp_mul:NNNNNN #1#2#3#4#5#6 - { - \fp_mul_split:NNNN #1 - \l_fp_mul_a_i_int \l_fp_mul_a_ii_int \l_fp_mul_a_iii_int - \fp_mul_split:NNNN #2 - \l_fp_mul_a_iv_int \l_fp_mul_a_v_int \l_fp_mul_a_vi_int - \fp_mul_split:NNNN #3 - \l_fp_mul_b_i_int \l_fp_mul_b_ii_int \l_fp_mul_b_iii_int - \fp_mul_split:NNNN #4 - \l_fp_mul_b_iv_int \l_fp_mul_b_v_int \l_fp_mul_b_vi_int - \l_fp_mul_output_int \c_zero - \tl_clear:N \l_fp_mul_output_tl - \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_vi_int - \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_v_int - \fp_mul_product:NN \l_fp_mul_a_iii_int \l_fp_mul_b_iv_int - \fp_mul_product:NN \l_fp_mul_a_iv_int \l_fp_mul_b_iii_int - \fp_mul_product:NN \l_fp_mul_a_v_int \l_fp_mul_b_ii_int - \fp_mul_product:NN \l_fp_mul_a_vi_int \l_fp_mul_b_i_int - \tex_divide:D \l_fp_mul_output_int \c_one_thousand - \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_v_int - \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_iv_int - \fp_mul_product:NN \l_fp_mul_a_iii_int \l_fp_mul_b_iii_int - \fp_mul_product:NN \l_fp_mul_a_iv_int \l_fp_mul_b_ii_int - \fp_mul_product:NN \l_fp_mul_a_v_int \l_fp_mul_b_i_int - \fp_mul_end_level: - \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_iv_int - \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_iii_int - \fp_mul_product:NN \l_fp_mul_a_iii_int \l_fp_mul_b_ii_int - \fp_mul_product:NN \l_fp_mul_a_iv_int \l_fp_mul_b_i_int - \fp_mul_end_level: - \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_iii_int - \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_ii_int - \fp_mul_product:NN \l_fp_mul_a_iii_int \l_fp_mul_b_i_int - \fp_mul_end_level: - #6 0 \l_fp_mul_output_tl \scan_stop: - \tl_clear:N \l_fp_mul_output_tl - \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_ii_int - \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_i_int - \fp_mul_end_level: - \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_i_int - \fp_mul_end_level: - \fp_mul_end_level: - #5 0 \l_fp_mul_output_tl \scan_stop: - } -\cs_new_protected:Npn \fp_mul:NNNNNNNNN #1#2#3#4#5#6#7#8#9 - { - \fp_mul_split:NNNN #2 - \l_fp_mul_a_i_int \l_fp_mul_a_ii_int \l_fp_mul_a_iii_int - \fp_mul_split:NNNN #3 - \l_fp_mul_a_iv_int \l_fp_mul_a_v_int \l_fp_mul_a_vi_int - \fp_mul_split:NNNN #5 - \l_fp_mul_b_i_int \l_fp_mul_b_ii_int \l_fp_mul_b_iii_int - \fp_mul_split:NNNN #6 - \l_fp_mul_b_iv_int \l_fp_mul_b_v_int \l_fp_mul_b_vi_int - \l_fp_mul_output_int \c_zero - \tl_clear:N \l_fp_mul_output_tl - \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_vi_int - \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_v_int - \fp_mul_product:NN \l_fp_mul_a_iii_int \l_fp_mul_b_iv_int - \fp_mul_product:NN \l_fp_mul_a_iv_int \l_fp_mul_b_iii_int - \fp_mul_product:NN \l_fp_mul_a_v_int \l_fp_mul_b_ii_int - \fp_mul_product:NN \l_fp_mul_a_vi_int \l_fp_mul_b_i_int - \tex_divide:D \l_fp_mul_output_int \c_one_thousand - \fp_mul_product:NN #1 \l_fp_mul_b_vi_int - \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_v_int - \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_iv_int - \fp_mul_product:NN \l_fp_mul_a_iii_int \l_fp_mul_b_iii_int - \fp_mul_product:NN \l_fp_mul_a_iv_int \l_fp_mul_b_ii_int - \fp_mul_product:NN \l_fp_mul_a_v_int \l_fp_mul_b_i_int - \fp_mul_product:NN \l_fp_mul_a_vi_int #4 - \fp_mul_end_level: - \fp_mul_product:NN #1 \l_fp_mul_b_v_int - \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_iv_int - \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_iii_int - \fp_mul_product:NN \l_fp_mul_a_iii_int \l_fp_mul_b_ii_int - \fp_mul_product:NN \l_fp_mul_a_iv_int \l_fp_mul_b_i_int - \fp_mul_product:NN \l_fp_mul_a_v_int #4 - \fp_mul_end_level: - \fp_mul_product:NN #1 \l_fp_mul_b_iv_int - \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_iii_int - \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_ii_int - \fp_mul_product:NN \l_fp_mul_a_iii_int \l_fp_mul_b_i_int - \fp_mul_product:NN \l_fp_mul_a_iv_int #4 - \fp_mul_end_level: - #9 0 \l_fp_mul_output_tl \scan_stop: - \tl_clear:N \l_fp_mul_output_tl - \fp_mul_product:NN #1 \l_fp_mul_b_iii_int - \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_ii_int - \fp_mul_product:NN \l_fp_mul_a_ii_int \l_fp_mul_b_i_int - \fp_mul_product:NN \l_fp_mul_a_iii_int #4 - \fp_mul_end_level: - \fp_mul_product:NN #1 \l_fp_mul_b_ii_int - \fp_mul_product:NN \l_fp_mul_a_i_int \l_fp_mul_b_i_int - \fp_mul_product:NN \l_fp_mul_a_ii_int #4 - \fp_mul_end_level: - \fp_mul_product:NN #1 \l_fp_mul_b_i_int - \fp_mul_product:NN \l_fp_mul_a_i_int #4 - \fp_mul_end_level: - #8 0 \l_fp_mul_output_tl \scan_stop: - \tl_clear:N \l_fp_mul_output_tl - \fp_mul_product:NN #1 #4 - \fp_mul_end_level: - #7 0 \l_fp_mul_output_tl \scan_stop: - } -\cs_new_protected:Npn \fp_div_integer:NNNNN #1#2#3#4#5 - { - \l_fp_internal_int #1 - \tex_divide:D \l_fp_internal_int #3 - \l_fp_internal_int \int_eval:w #1 - \l_fp_internal_int * #3 \int_eval_end: + \__fp_ternary_loop:Nw + } +\cs_new:Npn \__fp_ternary_map_break: #1 \__fp_ternary_break_point:n #2 {#2} +\cs_new:Npn \__fp_ternary_i:NwwN #1#2@#3@#4 + { + \exp_after:wN \__fp_parse_until_test:NwN + \exp_after:wN #1 + \tex_romannumeral:D -`0 + \__fp_parse_exp_after_array:wf #2 \s__fp_stop #4 #1 - \tex_divide:D #4 #3 - #5 #2 - \tex_divide:D #5 #3 - \tex_multiply:D \l_fp_internal_int \c_one_thousand - \tex_divide:D \l_fp_internal_int #3 - #5 \int_eval:w #5 + \l_fp_internal_int * \c_one_million \int_eval_end: - \if_int_compare:w #5 > \c_one_thousand_million - \tex_advance:D #4 \c_one - \tex_advance:D #5 -\c_one_thousand_million - \fi: - } -\cs_new_protected_nopar:Npn \fp_extended_normalise: - { - \fp_extended_normalise_aux_i: - \fp_extended_normalise_aux_ii: - } -\cs_new_protected_nopar:Npn \fp_extended_normalise_aux_i: - { - \if_int_compare:w \l_fp_input_a_exponent_int > \c_zero - \tex_multiply:D \l_fp_input_a_integer_int \c_ten - \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million - \exp_after:wN \fp_extended_normalise_aux_i:w - \int_use:N \l_fp_input_a_decimal_int \q_stop - \exp_after:wN \fp_extended_normalise_aux_i: - \fi: - } -\cs_new_protected:Npn \fp_extended_normalise_aux_i:w - #1#2#3#4#5#6#7#8#9 \q_stop - { - \l_fp_input_a_integer_int - \int_eval:w \l_fp_input_a_integer_int + #2 \scan_stop: - \l_fp_input_a_decimal_int #3#4#5#6#7#8#9 0 \scan_stop: - \tex_advance:D \l_fp_input_a_extended_int \c_one_thousand_million - \exp_after:wN \fp_extended_normalise_aux_ii:w - \int_use:N \l_fp_input_a_extended_int \q_stop - } -\cs_new_protected:Npn \fp_extended_normalise_aux_ii:w - #1#2#3#4#5#6#7#8#9 \q_stop - { - \l_fp_input_a_decimal_int - \int_eval:w \l_fp_input_a_decimal_int + #2 \scan_stop: - \l_fp_input_a_extended_int #3#4#5#6#7#8#9 0 \scan_stop: - \tex_advance:D \l_fp_input_a_exponent_int \c_minus_one - } -\cs_new_protected_nopar:Npn \fp_extended_normalise_aux_ii: - { - \if_int_compare:w \l_fp_input_a_exponent_int < \c_zero - \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million - \exp_after:wN \use_i:nn \exp_after:wN - \fp_extended_normalise_ii_aux:NNNNNNNNN - \int_use:N \l_fp_input_a_decimal_int - \exp_after:wN \fp_extended_normalise_aux_ii: - \fi: - } -\cs_new_protected:Npn \fp_extended_normalise_ii_aux:NNNNNNNNN - #1#2#3#4#5#6#7#8#9 - { - \if_int_compare:w \l_fp_input_a_integer_int = \c_zero - \l_fp_input_a_decimal_int #1#2#3#4#5#6#7#8 \scan_stop: - \else: - \tl_set:Nx \l_fp_internal_tl - { - \int_use:N \l_fp_input_a_integer_int - #1#2#3#4#5#6#7#8 - } - \l_fp_input_a_integer_int \c_zero - \l_fp_input_a_decimal_int \l_fp_internal_tl \scan_stop: - \fi: - \tex_divide:D \l_fp_input_a_extended_int \c_ten - \tl_set:Nx \l_fp_internal_tl - { - #9 - \int_use:N \l_fp_input_a_extended_int - } - \l_fp_input_a_extended_int \l_fp_internal_tl \scan_stop: - \tex_advance:D \l_fp_input_a_exponent_int \c_one } -\cs_new_protected_nopar:Npn \fp_extended_normalise_output: +\cs_new:Npn \__fp_ternary_ii:NwwN #1#2@#3@#4 { - \if_int_compare:w \l_fp_output_integer_int > \c_nine - \tex_advance:D \l_fp_output_integer_int \c_one_thousand_million - \exp_after:wN \use_i:nn \exp_after:wN - \fp_extended_normalise_output_aux_i:NNNNNNNNN - \int_use:N \l_fp_output_integer_int - \exp_after:wN \fp_extended_normalise_output: - \fi: + \exp_after:wN \__fp_parse_until_test:NwN + \exp_after:wN #1 + \tex_romannumeral:D -`0 + \__fp_parse_exp_after_array:wf #3 \s__fp_stop + #4 #1 } -\cs_new_protected:Npn \fp_extended_normalise_output_aux_i:NNNNNNNNN - #1#2#3#4#5#6#7#8#9 +\cs_new:Npn \__fp_max:w #1@ { - \l_fp_output_integer_int #1#2#3#4#5#6#7#8 \scan_stop: - \tex_advance:D \l_fp_output_decimal_int \c_one_thousand_million - \tl_set:Nx \l_fp_internal_tl - { - #9 - \exp_after:wN \use_none:n - \int_use:N \l_fp_output_decimal_int - } - \exp_after:wN \fp_extended_normalise_output_aux_ii:NNNNNNNNN - \l_fp_internal_tl + \exp_after:wN \__fp_minmax_loop:Nww + \exp_after:wN \c_minus_one + \c_minus_inf_fp + #1 + \s__fp \__fp_chk:w { 3 \__fp_minmax_break:w } ; } -\cs_new_protected:Npn \fp_extended_normalise_output_aux_ii:NNNNNNNNN - #1#2#3#4#5#6#7#8#9 +\cs_new:Npn \__fp_min:w #1@ { - \l_fp_output_decimal_int #1#2#3#4#5#6#7#8#9 \scan_stop: - \fp_extended_normalise_output_aux:N + \exp_after:wN \__fp_minmax_loop:Nww + \exp_after:wN \c_one + \c_inf_fp + #1 + \s__fp \__fp_chk:w { 3 \__fp_minmax_break:w } ; } -\cs_new_protected:Npn \fp_extended_normalise_output_aux:N #1 +\cs_new:Npn \__fp_minmax_loop:Nww + #1 \s__fp \__fp_chk:w #2#3; \s__fp \__fp_chk:w #4#5; { - \tex_advance:D \l_fp_output_extended_int \c_one_thousand_million - \tex_divide:D \l_fp_output_extended_int \c_ten - \tl_set:Nx \l_fp_internal_tl - { - #1 - \exp_after:wN \use_none:n - \int_use:N \l_fp_output_extended_int - } - \l_fp_output_extended_int \l_fp_internal_tl \scan_stop: - \tex_advance:D \l_fp_output_exponent_int \c_one - } -\cs_new_protected_nopar:Npn \fp_trig_normalise: - { - \if_int_compare:w \l_fp_input_a_exponent_int < \c_ten - \l_fp_input_a_extended_int \c_zero - \fp_extended_normalise: - \fp_trig_normalise_aux: - \if_int_compare:w \l_fp_input_a_integer_int < \c_zero - \l_fp_input_a_sign_int -\l_fp_input_a_sign_int - \l_fp_input_a_integer_int -\l_fp_input_a_integer_int - \fi: - \exp_after:wN \fp_trig_octant: - \else: - \l_fp_input_a_sign_int \c_one - \l_fp_output_integer_int \c_zero - \l_fp_output_decimal_int \c_zero - \l_fp_output_exponent_int \c_zero - \exp_after:wN \fp_trig_overflow_msg: - \fi: - } -\cs_new_protected_nopar:Npn \fp_trig_normalise_aux: - { - \if_int_compare:w \l_fp_input_a_integer_int > \c_three - \fp_trig_sub:NNN - \c_six \c_fp_two_pi_decimal_int \c_fp_two_pi_extended_int - \exp_after:wN \fp_trig_normalise_aux: - \else: - \if_int_compare:w \l_fp_input_a_integer_int > \c_two - \if_int_compare:w \l_fp_input_a_decimal_int > \c_fp_pi_decimal_int - \fp_trig_sub:NNN - \c_six \c_fp_two_pi_decimal_int \c_fp_two_pi_extended_int - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_after:wN \fp_trig_normalise_aux: - \fi: + \if_meaning:w 3 #4 + \if_meaning:w 3 #2 + \__fp_minmax_i:ww + \else: + \__fp_minmax_ii:ww + \fi: + \else: + \if_int_compare:w \__fp_compare:ww \s__fp \__fp_chk:w #2#3; + \s__fp \__fp_chk:w #4#5; = #1 + \__fp_minmax_ii:ww + \else: + \__fp_minmax_i:ww \fi: \fi: - } -\cs_new_protected:Npn \fp_trig_sub:NNN #1#2#3 + \__fp_minmax_loop:Nww #1 + \s__fp \__fp_chk:w #2#3; + \s__fp \__fp_chk:w #4#5; + } +\cs_new:Npn \__fp_minmax_i:ww + #1 \__fp_minmax_loop:Nww #2 \s__fp #3; \s__fp #4; + { #1 \__fp_minmax_loop:Nww #2 \s__fp #3; } +\cs_new:Npn \__fp_minmax_ii:ww + #1 \__fp_minmax_loop:Nww #2 \s__fp #3; \s__fp #4; + { #1 \__fp_minmax_loop:Nww #2 \s__fp #4; } +\cs_new:Npn \__fp_minmax_break:w #1 \__fp_minmax_loop:Nww #2 #3; #4; { - \l_fp_input_a_integer_int - \int_eval:w \l_fp_input_a_integer_int - #1 \int_eval_end: - \l_fp_input_a_decimal_int - \int_eval:w \l_fp_input_a_decimal_int - #2 \int_eval_end: - \l_fp_input_a_extended_int - \int_eval:w \l_fp_input_a_extended_int - #3 \int_eval_end: - \if_int_compare:w \l_fp_input_a_extended_int < \c_zero - \tex_advance:D \l_fp_input_a_decimal_int \c_minus_one - \tex_advance:D \l_fp_input_a_extended_int \c_one_thousand_million \fi: - \if_int_compare:w \l_fp_input_a_decimal_int < \c_zero - \tex_advance:D \l_fp_input_a_integer_int \c_minus_one - \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million + \__fp_exp_after_o:w #3; + } +%% File: l3fp-basics.dtx Copyright (C) 2011-2012 The 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 +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% 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. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +\cs_new:Npn \__fp_basics_pack_low:NNNNNw #1 #2#3#4#5 #6; + { + \if_meaning:w 2 #1 + + \c_one \fi: - \if_int_compare:w \l_fp_input_a_integer_int < \c_zero - \l_fp_input_a_sign_int -\l_fp_input_a_sign_int - \if_int_compare:w - \int_eval:w - \l_fp_input_a_decimal_int + \l_fp_input_a_extended_int - = \c_zero - \l_fp_input_a_integer_int -\l_fp_input_a_integer_int - \else: - \l_fp_input_a_integer_int - \int_eval:w - - \l_fp_input_a_integer_int - \c_one - \int_eval_end: - \l_fp_input_a_decimal_int - \int_eval:w - \c_one_thousand_million - \l_fp_input_a_decimal_int - \int_eval_end: - \l_fp_input_a_extended_int - \int_eval:w - \c_one_thousand_million - \l_fp_input_a_extended_int - \int_eval_end: - \fi: + ; {#2#3#4#5} {#6} ; + } +\cs_new:Npn \__fp_basics_pack_high:NNNNNw #1 #2#3#4#5 #6; + { + \if_meaning:w 2 #1 + \__fp_basics_pack_high_carry:w \fi: + ; {#2#3#4#5} {#6} } -\cs_new_protected_nopar:Npn \fp_trig_octant: +\cs_new:Npn \__fp_basics_pack_high_carry:w \fi: ; #1 + { \fi: + \c_one ; {1000} } +\cs_new:Npn \__fp_basics_return_nan_nan:NNww #1#2 #3; #4; + { \__fp_exp_after_o:w \s__fp \__fp_chk:w 3 1 #3 ; } +\cs_new:Npn \__fp_basics_return_zero:NNww #1#2 #3; #4; { - \l_fp_trig_octant_int \c_one - \fp_trig_octant_aux_i: - \if_int_compare:w \l_fp_input_a_decimal_int < \c_ten - \l_fp_input_a_decimal_int \c_zero - \l_fp_input_a_extended_int \c_zero + \if_meaning:w #1 #2 + \exp_after:wN \exp_after:wN \exp_after:wN \c_zero_fp + \else: + \exp_after:wN \exp_after:wN \exp_after:wN \c_minus_zero_fp \fi: - \if_int_odd:w \l_fp_trig_octant_int + } +\cs_new:Npn \__fp_basics_return_inf:NNww #1#2 #3; #4; + { + \if_meaning:w #1 #2 + \exp_after:wN \exp_after:wN \exp_after:wN \c_inf_fp \else: - \fp_sub:NNNNNNNNN - \c_zero \c_fp_pi_by_four_decimal_int \c_fp_pi_by_four_extended_int - \l_fp_input_a_integer_int \l_fp_input_a_decimal_int - \l_fp_input_a_extended_int - \l_fp_input_a_integer_int \l_fp_input_a_decimal_int - \l_fp_input_a_extended_int + \exp_after:wN \exp_after:wN \exp_after:wN \c_minus_inf_fp \fi: } -\cs_new_protected_nopar:Npn \fp_trig_octant_aux_i: +\cs_new:Npn \__fp_basics_return_i:NNNNww #1#2 #3#4 #5; #6; + { \__fp_exp_after_o:w \s__fp \__fp_chk:w #1 #3 #5; } +\cs_new:Npn \__fp_basics_return_ii:NNNNww #1#2 #3#4 #5; #6; + { \__fp_exp_after_o:w \s__fp \__fp_chk:w #2 #4 #6; } +\cs_new:Npn \__fp_basics_return_nan:NNww #1#2 { - \if_int_compare:w \l_fp_trig_octant_int > \c_four - \l_fp_trig_octant_int \c_four - \l_fp_input_a_decimal_int \c_fp_pi_by_four_decimal_int - \l_fp_input_a_extended_int \c_fp_pi_by_four_extended_int + \if_meaning:w 1 #1 + \exp_after:wN \__fp_basics_return_i:NNNNww \else: - \exp_after:wN \fp_trig_octant_aux_ii: + \exp_after:wN \__fp_basics_return_ii:NNNNww \fi: + 3 3 #1 #2 } -\cs_new_protected_nopar:Npn \fp_trig_octant_aux_ii: +\cs_new:cpn { __fp_+_o:ww } + \s__fp \__fp_chk:w #1 #2 #3 ; \s__fp \__fp_chk:w #4 #5 + { \__fp_add_cases:NN #1 #4 #2 #5 #3 ; } +\cs_new:cpn { __fp_-_o:ww } + \s__fp \__fp_chk:w #1 #2 #3 ; \s__fp \__fp_chk:w #4 #5 { - \if_int_compare:w \l_fp_input_a_integer_int > \c_zero - \fp_sub:NNNNNNNNN - \l_fp_input_a_integer_int \l_fp_input_a_decimal_int - \l_fp_input_a_extended_int - \c_zero \c_fp_pi_by_four_decimal_int \c_fp_pi_by_four_extended_int - \l_fp_input_a_integer_int \l_fp_input_a_decimal_int - \l_fp_input_a_extended_int - \tex_advance:D \l_fp_trig_octant_int \c_one - \exp_after:wN \fp_trig_octant_aux_i: + \exp_after:wN \__fp_add_cases:NN + \exp_after:wN #1 + \exp_after:wN #4 + \exp_after:wN #2 + \int_use:N \__int_eval:w \c_two - #5 \__int_eval_end: + #3 ; + } +\cs_new:Npn \__fp_add_cases:NN #1 #2 + { + \if_int_compare:w #1 = #2 \exp_stop_f: + \exp_after:wN \__fp_add_cases_eq:N \else: - \if_int_compare:w - \l_fp_input_a_decimal_int > \c_fp_pi_by_four_decimal_int - \fp_sub:NNNNNNNNN - \l_fp_input_a_integer_int \l_fp_input_a_decimal_int - \l_fp_input_a_extended_int - \c_zero \c_fp_pi_by_four_decimal_int - \c_fp_pi_by_four_extended_int - \l_fp_input_a_integer_int \l_fp_input_a_decimal_int - \l_fp_input_a_extended_int - \tex_advance:D \l_fp_trig_octant_int \c_one - \exp_after:wN \exp_after:wN \exp_after:wN - \fp_trig_octant_aux_i: - \fi: - \fi: - } -\cs_new_protected_nopar:Npn \fp_sin:Nn { \fp_sin_aux:NNn \tl_set:Nn } -\cs_new_protected_nopar:Npn \fp_gsin:Nn { \fp_sin_aux:NNn \tl_gset:Nn } -\cs_generate_variant:Nn \fp_sin:Nn { c } -\cs_generate_variant:Nn \fp_gsin:Nn { c } -\cs_new_protected:Npn \fp_sin_aux:NNn #1#2#3 - { - \group_begin: - \fp_split:Nn a {#3} - \fp_standardise:NNNN - \l_fp_input_a_sign_int - \l_fp_input_a_integer_int - \l_fp_input_a_decimal_int - \l_fp_input_a_exponent_int - \tl_set:Nx \l_fp_arg_tl - { - \if_int_compare:w \l_fp_input_a_sign_int < \c_zero - - - \else: - + - \fi: - \int_use:N \l_fp_input_a_integer_int - . - \exp_after:wN \use_none:n - \int_value:w \int_eval:w - \l_fp_input_a_decimal_int + \c_one_thousand_million - e - \int_use:N \l_fp_input_a_exponent_int - } - \if_int_compare:w \l_fp_input_a_exponent_int < -\c_five - \cs_set_protected_nopar:Npx \fp_tmp:w - { - \group_end: - #1 \exp_not:N #2 { \l_fp_arg_tl } - } + \if_int_compare:w #1 < #2 \exp_stop_f: + \exp_after:wN \exp_after:wN + \exp_after:wN \__fp_basics_return_ii:NNNNww \else: - \if_cs_exist:w - c_fp_sin ( \l_fp_arg_tl ) _fp - \cs_end: - \else: - \exp_after:wN \exp_after:wN \exp_after:wN - \fp_sin_aux_i: - \fi: - \cs_set_protected_nopar:Npx \fp_tmp:w - { - \group_end: - #1 \exp_not:N #2 - { \use:c { c_fp_sin ( \l_fp_arg_tl ) _fp } } - } + \exp_after:wN \exp_after:wN + \exp_after:wN \__fp_basics_return_i:NNNNww \fi: - \fp_tmp:w + \exp_after:wN #1 + \fi: + #2 } -\cs_new_protected_nopar:Npn \fp_sin_aux_i: +\cs_new:Npn \__fp_add_cases_eq:N #1 { - \fp_trig_normalise: - \fp_sin_aux_ii: - \if_int_compare:w \l_fp_output_integer_int = \c_one - \l_fp_output_exponent_int \c_zero + \if_case:w #1 \exp_stop_f: + \exp_after:wN \__fp_add_zeros:NNww + \or: \exp_after:wN \__fp_add_normal:NNww + \or: \exp_after:wN \__fp_add_inf:NNww + \or: \exp_after:wN \__fp_basics_return_nan_nan:NNww + \fi: + } +\cs_new:Npn \__fp_add_zeros:NNww #1#2 #3; + { + \if_int_compare:w #1 #2 = 02 \exp_stop_f: + \__fp_case_return_o:Nw \c_zero_fp \else: - \l_fp_output_integer_int \l_fp_output_decimal_int - \l_fp_output_decimal_int \l_fp_output_extended_int - \l_fp_output_exponent_int -\c_nine + \__fp_case_return_same_o:w \fi: - \fp_standardise:NNNN - \l_fp_input_a_sign_int - \l_fp_output_integer_int - \l_fp_output_decimal_int - \l_fp_output_exponent_int - \tl_new:c { c_fp_sin ( \l_fp_arg_tl ) _fp } - \tl_gset:cx { c_fp_sin ( \l_fp_arg_tl ) _fp } - { - \if_int_compare:w \l_fp_input_a_sign_int > \c_zero - + - \else: - - - \fi: - \int_use:N \l_fp_output_integer_int - . - \exp_after:wN \use_none:n - \int_value:w \int_eval:w - \l_fp_output_decimal_int + \c_one_thousand_million - e - \int_use:N \l_fp_output_exponent_int - } + \s__fp \__fp_chk:w 0 #2 } -\cs_new_protected_nopar:Npn \fp_sin_aux_ii: +\cs_new:Npn \__fp_add_inf:NNww #1#2 #3; { - \if_case:w \l_fp_trig_octant_int - \or: - \exp_after:wN \fp_trig_calc_sin: - \or: - \exp_after:wN \fp_trig_calc_cos: - \or: - \exp_after:wN \fp_trig_calc_cos: - \or: - \exp_after:wN \fp_trig_calc_sin: - \fi: - } -\cs_new_protected_nopar:Npn \fp_cos:Nn { \fp_cos_aux:NNn \tl_set:Nn } -\cs_new_protected_nopar:Npn \fp_gcos:Nn { \fp_cos_aux:NNn \tl_gset:Nn } -\cs_generate_variant:Nn \fp_cos:Nn { c } -\cs_generate_variant:Nn \fp_gcos:Nn { c } -\cs_new_protected:Npn \fp_cos_aux:NNn #1#2#3 - { - \group_begin: - \fp_split:Nn a {#3} - \fp_standardise:NNNN - \l_fp_input_a_sign_int - \l_fp_input_a_integer_int - \l_fp_input_a_decimal_int - \l_fp_input_a_exponent_int - \tl_set:Nx \l_fp_arg_tl + \if_meaning:w #1 #2 + \__fp_case_return_same_o:w + \else: + \__fp_case_use:nw { - \if_int_compare:w \l_fp_input_a_sign_int < \c_zero - - - \else: - + - \fi: - \int_use:N \l_fp_input_a_integer_int - . - \exp_after:wN \use_none:n - \int_value:w \int_eval:w - \l_fp_input_a_decimal_int + \c_one_thousand_million - e - \int_use:N \l_fp_input_a_exponent_int + \__fp_invalid_operation:Nnww \c_nan_fp { + } + \s__fp \__fp_chk:w 2 #1 #3 ; } - \if_cs_exist:w c_fp_cos ( \l_fp_arg_tl ) _fp \cs_end: + \fi: + \s__fp \__fp_chk:w 2 #2 + } +\cs_new:Npn \__fp_add_normal:NNww #1#2 + { + \if_meaning:w #1#2 + \exp_after:wN \__fp_add_npos:Nnwnw + \else: + \exp_after:wN \__fp_sub_npos:Nnwnw + \fi: + #1 + } +\cs_new:Npn \__fp_add_npos:Nnwnw #1 #2#3; #4 + { + \exp_after:wN \__fp_sanitize:Nw + \exp_after:wN #1 + \int_use:N \__int_eval:w + \if_int_compare:w #2 > #4 \exp_stop_f: + #2 + \exp_after:wN \__fp_add_big_i:wNww \__int_value:w - \else: - \exp_after:wN \fp_cos_aux_i: + #4 + \exp_after:wN \__fp_add_big_ii:wNww \__int_value:w \fi: - \cs_set_protected_nopar:Npx \fp_tmp:w - { - \group_end: - #1 \exp_not:N #2 - { \use:c { c_fp_cos ( \l_fp_arg_tl ) _fp } } - } - \fp_tmp:w - } -\cs_new_protected_nopar:Npn \fp_cos_aux_i: - { - \fp_trig_normalise: - \fp_cos_aux_ii: - \if_int_compare:w \l_fp_output_integer_int = \c_one - \l_fp_output_exponent_int \c_zero - \else: - \l_fp_output_integer_int \l_fp_output_decimal_int - \l_fp_output_decimal_int \l_fp_output_extended_int - \l_fp_output_exponent_int -\c_nine - \fi: - \fp_standardise:NNNN - \l_fp_input_a_sign_int - \l_fp_output_integer_int - \l_fp_output_decimal_int - \l_fp_output_exponent_int - \tl_new:c { c_fp_cos ( \l_fp_arg_tl ) _fp } - \tl_gset:cx { c_fp_cos ( \l_fp_arg_tl ) _fp } - { - \if_int_compare:w \l_fp_input_a_sign_int > \c_zero - + - \else: - - - \fi: - \int_use:N \l_fp_output_integer_int - . - \exp_after:wN \use_none:n - \int_value:w \int_eval:w - \l_fp_output_decimal_int + \c_one_thousand_million - e - \int_use:N \l_fp_output_exponent_int - } + \__int_eval:w #4 - #2 ; #1 #3; } -\cs_new_protected_nopar:Npn \fp_cos_aux_ii: +\cs_new:Npn \__fp_add_big_i:wNww #1; #2 #3; #4; { - \if_case:w \l_fp_trig_octant_int - \or: - \exp_after:wN \fp_trig_calc_cos: - \or: - \exp_after:wN \fp_trig_calc_sin: - \or: - \exp_after:wN \fp_trig_calc_sin: - \or: - \exp_after:wN \fp_trig_calc_cos: + \__fp_decimate:nNnnnn {#1} + \__fp_add_mantissa:NnnwnnnnN + #4 + #3 + #2 + } +\cs_new:Npn \__fp_add_big_ii:wNww #1; #2 #3; #4; + { + \__fp_decimate:nNnnnn {#1} + \__fp_add_mantissa:NnnwnnnnN + #3 + #4 + #2 + } +\cs_new:Npn \__fp_add_mantissa:NnnwnnnnN #1 #2#3 #4; #5#6#7#8 + { + \exp_after:wN \__fp_add_mantissa_test:N + \int_use:N \__int_eval:w 1#5#6 + #2 + \exp_after:wN \__fp_add_mantissa_pack:NNNNNNN + \int_use:N \__int_eval:w 1#7#8 + #3 ; #1 + } +\cs_new:Npn \__fp_add_mantissa_pack:NNNNNNN #1 #2#3#4#5#6#7 + { + \if:w 2 #1 + + \c_one \fi: - \if_int_compare:w \l_fp_input_a_sign_int > \c_zero - \if_int_compare:w \l_fp_trig_octant_int > \c_two - \l_fp_input_a_sign_int \c_minus_one - \fi: + ; #2 #3 #4 #5 #6 #7 ; + } +\cs_new:Npn \__fp_add_mantissa_test:N #1 + { + \if:w 2 #1 + \exp_after:wN \__fp_add_mantissa_carry:wwNNNN \else: - \if_int_compare:w \l_fp_trig_octant_int > \c_two - \else: - \l_fp_input_a_sign_int \c_one - \fi: - \fi: - } -\cs_new_protected_nopar:Npn \fp_trig_calc_cos: - { - \if_int_compare:w \l_fp_input_a_decimal_int = \c_zero - \l_fp_output_integer_int \c_one - \l_fp_output_decimal_int \c_zero - \else: - \l_fp_trig_sign_int \c_minus_one - \fp_mul:NNNNNN - \l_fp_input_a_decimal_int \l_fp_input_a_extended_int - \l_fp_input_a_decimal_int \l_fp_input_a_extended_int - \l_fp_trig_decimal_int \l_fp_trig_extended_int - \fp_div_integer:NNNNN - \l_fp_trig_decimal_int \l_fp_trig_extended_int - \c_two - \l_fp_trig_decimal_int \l_fp_trig_extended_int - \l_fp_count_int \c_three - \if_int_compare:w \l_fp_trig_extended_int = \c_zero - \if_int_compare:w \l_fp_trig_decimal_int = \c_zero - \l_fp_output_integer_int \c_one - \l_fp_output_decimal_int \c_zero - \l_fp_output_extended_int \c_zero - \else: - \l_fp_output_integer_int \c_zero - \l_fp_output_decimal_int \c_one_thousand_million - \l_fp_output_extended_int \c_zero - \fi: + \exp_after:wN \__fp_add_mantissa_no_carry:wwNNNN + \fi: + } +\cs_new:Npn \__fp_add_mantissa_no_carry:wwNNNN + #1; #2; #3#4 ; #5#6 + { + \exp_after:wN \__fp_basics_pack_high:NNNNNw + \int_use:N \__int_eval:w 1 #1 + \exp_after:wN \__fp_basics_pack_low:NNNNNw + \int_use:N \__int_eval:w 1 #2 #3#4 + + \__fp_round:NNN #6 #4 #5 + \exp_after:wN ; + } +\cs_new:Npn \__fp_add_mantissa_carry:wwNNNN + #1; #2; #3#4; #5#6 + { + + \c_one + \exp_after:wN \__fp_add_mantissa_carry_pack:NNNNNNNNw + \int_use:N \__int_eval:w 1 #1 + \exp_after:wN \__fp_add_mantissa_carry_pack_ii:NNNNw + \int_use:N \__int_eval:w 1 #2#3 + + \__fp_round:NNNN #6 #3 #4 #5 + \exp_after:wN ; + } +\cs_new:Npn \__fp_add_mantissa_carry_pack_ii:NNNNw #1 #2#3#4 #5; + { + \if:w 2 #1 + + \c_one + \fi: + \__int_eval_end: + #2#3#4; {#5} ; + } +\cs_new:Npn \__fp_add_mantissa_carry_pack:NNNNNNNNw + #1#2#3#4 #5#6#7#8 #9; { ; {#1#2#3#4} {#5#6#7#8} {#9} } +\cs_new:Npn \__fp_sub_npos:Nnwnw #1 #2#3; #4 #5; + { + \exp_after:wN \__fp_sanitize:wN + \int_use:N \__int_eval:w + \if_int_compare:w #2 > #4 \exp_stop_f: + #2 + \exp_after:wN \__fp_sub_big_i:wNww \__int_value:w - \else: - \l_fp_output_integer_int \c_zero - \l_fp_output_decimal_int 999999999 \scan_stop: - \l_fp_output_extended_int \c_one_thousand_million - \fi: - \tex_advance:D \l_fp_output_extended_int -\l_fp_trig_extended_int - \tex_advance:D \l_fp_output_decimal_int -\l_fp_trig_decimal_int - \exp_after:wN \fp_trig_calc_Taylor: - \fi: - } -\cs_new_protected_nopar:Npn \fp_trig_calc_sin: - { - \l_fp_output_integer_int \c_zero - \if_int_compare:w \l_fp_input_a_decimal_int = \c_zero - \l_fp_output_decimal_int \c_zero - \else: - \l_fp_output_decimal_int \l_fp_input_a_decimal_int - \l_fp_output_extended_int \l_fp_input_a_extended_int - \l_fp_trig_sign_int \c_one - \l_fp_trig_decimal_int \l_fp_input_a_decimal_int - \l_fp_trig_extended_int \l_fp_input_a_extended_int - \l_fp_count_int \c_two - \exp_after:wN \fp_trig_calc_Taylor: - \fi: - } -\cs_new_protected_nopar:Npn \fp_trig_calc_Taylor: - { - \l_fp_trig_sign_int -\l_fp_trig_sign_int - \fp_mul:NNNNNN - \l_fp_trig_decimal_int \l_fp_trig_extended_int - \l_fp_input_a_decimal_int \l_fp_input_a_extended_int - \l_fp_trig_decimal_int \l_fp_trig_extended_int - \fp_mul:NNNNNN - \l_fp_trig_decimal_int \l_fp_trig_extended_int - \l_fp_input_a_decimal_int \l_fp_input_a_extended_int - \l_fp_trig_decimal_int \l_fp_trig_extended_int - \fp_div_integer:NNNNN - \l_fp_trig_decimal_int \l_fp_trig_extended_int - \l_fp_count_int - \l_fp_trig_decimal_int \l_fp_trig_extended_int - \tex_advance:D \l_fp_count_int \c_one - \fp_div_integer:NNNNN - \l_fp_trig_decimal_int \l_fp_trig_extended_int - \l_fp_count_int - \l_fp_trig_decimal_int \l_fp_trig_extended_int - \tex_advance:D \l_fp_count_int \c_one - \if_int_compare:w \l_fp_trig_decimal_int > \c_zero - \if_int_compare:w \l_fp_trig_sign_int > \c_zero - \tex_advance:D \l_fp_output_decimal_int \l_fp_trig_decimal_int - \tex_advance:D \l_fp_output_extended_int - \l_fp_trig_extended_int - \if_int_compare:w \l_fp_output_extended_int < \c_one_thousand_million - \else: - \tex_advance:D \l_fp_output_decimal_int \c_one - \tex_advance:D \l_fp_output_extended_int - -\c_one_thousand_million - \fi: - \if_int_compare:w \l_fp_output_decimal_int < \c_one_thousand_million + #4 + \if_int_compare:w #2 = #4 \exp_stop_f: + \__fp_sub_exponent_eq:nnnnnnnn #3 #5 \else: - \tex_advance:D \l_fp_output_integer_int \c_one - \tex_advance:D \l_fp_output_decimal_int - -\c_one_thousand_million - \fi: - \else: - \tex_advance:D \l_fp_output_decimal_int -\l_fp_trig_decimal_int - \tex_advance:D \l_fp_output_extended_int - -\l_fp_input_a_extended_int - \if_int_compare:w \l_fp_output_extended_int < \c_zero - \tex_advance:D \l_fp_output_decimal_int \c_minus_one - \tex_advance:D \l_fp_output_extended_int \c_one_thousand_million - \fi: - \if_int_compare:w \l_fp_output_decimal_int < \c_zero - \tex_advance:D \l_fp_output_integer_int \c_minus_one - \tex_advance:D \l_fp_output_decimal_int \c_one_thousand_million + \exp_after:wN \__fp_sub_big_ii:wNww \__int_value:w \fi: \fi: - \exp_after:wN \fp_trig_calc_Taylor: - \fi: + \__int_eval:w #4 - #2 ; #1 #3; #5; } -\cs_new_protected_nopar:Npn \fp_tan:Nn { \fp_tan_aux:NNn \tl_set:Nn } -\cs_new_protected_nopar:Npn \fp_gtan:Nn { \fp_tan_aux:NNn \tl_gset:Nn } -\cs_generate_variant:Nn \fp_tan:Nn { c } -\cs_generate_variant:Nn \fp_gtan:Nn { c } -\cs_new_protected:Npn \fp_tan_aux:NNn #1#2#3 +\cs_new:Npn \__fp_sub_exponent_eq:nnnnnnnn #1#2#3#4 #5#6#7#8 { - \group_begin: - \fp_split:Nn a {#3} - \fp_standardise:NNNN - \l_fp_input_a_sign_int - \l_fp_input_a_integer_int - \l_fp_input_a_decimal_int - \l_fp_input_a_exponent_int - \tl_set:Nx \l_fp_arg_tl - { - \if_int_compare:w \l_fp_input_a_sign_int < \c_zero - - - \else: - + - \fi: - \int_use:N \l_fp_input_a_integer_int - . - \exp_after:wN \use_none:n - \int_value:w \int_eval:w - \l_fp_input_a_decimal_int + \c_one_thousand_million - e - \int_use:N \l_fp_input_a_exponent_int - } - \if_int_compare:w \l_fp_input_a_exponent_int < -\c_five - \cs_set_protected_nopar:Npx \fp_tmp:w - { - \group_end: - #1 \exp_not:N #2 { \l_fp_arg_tl } - } + \if_int_compare:w #1#2 > #5#6 \exp_stop_f: + \exp_after:wN \__fp_sub_big_i:wNww \__int_value:w + \else: + \if_int_compare:w #1#2 < #5#6 \exp_stop_f: + \exp_after:wN \__fp_sub_big_ii:wNww \__int_value:w \else: - \if_cs_exist:w - c_fp_tan ( \l_fp_arg_tl ) _fp - \cs_end: + \if_int_compare:w #3#4 > #7#8 \exp_stop_f: + \exp_after:wN \__fp_sub_big_i:wNww \__int_value:w \else: - \exp_after:wN \exp_after:wN \exp_after:wN - \fp_tan_aux_i: + \if_int_compare:w #3#4 < #7#8 \exp_stop_f: + \exp_after:wN \__fp_sub_big_ii:wNww \__int_value:w + \else: + \exp_after:wN \__fp_sub_eq:wNww \__int_value:w + \fi: \fi: - \cs_set_protected_nopar:Npx \fp_tmp:w - { - \group_end: - #1 \exp_not:N #2 - { \use:c { c_fp_tan ( \l_fp_arg_tl ) _fp } } - } \fi: - \fp_tmp:w + \fi: } -\cs_new_protected_nopar:Npn \fp_tan_aux_i: +\cs_new:Npn \__fp_sub_eq:wNww #1; #2 #3; #4; + { \exp_after:wN ; \exp_after:wN 1 \exp_after:wN ; } +\cs_new:Npn \__fp_sub_big_i:wNww #1; #2 #3; #4; + { + \__fp_decimate:nNnnnn {#1} + \__fp_sub_back_mantissa:NnnwNnnnn + #4 + #2 + #3 + } +\cs_new:Npn \__fp_sub_big_ii:wNww #1; #2 #3; #4; + { + \exp_after:wN \__fp_sub_big_i:wNww + \__int_value:w #1 \exp_after:wN ; + \int_use:N \__int_eval:w 2 - #2 \__int_eval_end: + #4; #3; + } +\cs_new:Npn \__fp_sub_back_mantissa:NnnwNnnnn #1 #2#3 #4; #5 #6#7#8#9 + { + \exp_after:wN \__fp_sub_back_mantissa_i:NNwNNNNwN + \exp_after:wN #1 + \exp_after:wN #5 + \int_use:N \__int_eval:w 2#6#7 - #2 - \c_two + + \exp_after:wN \__fp_sub_back_mantissa_round:wNN + \int_use:N \__int_eval:w 2#8#9 - #3 ; #1 #5 + } +\cs_new:Npn \__fp_sub_back_mantissa_round:wNN #1; #2 #3 + { + \exp_after:wN \__fp_sub_back_mantissa_iii:N + \__int_value:w + \exp_after:wN \__fp_round_neg:NNN + \exp_after:wN #3 + \use_none:nnnnnnnn #1 #2 + + #1 + \exp_after:wN ; + } +\cs_new:Npn \__fp_sub_back_mantissa_iii:N #1 + { + \exp_after:wN \__fp_sub_back_mantissa_ii:NNNNNNw + \exp_after:wN #1 + \int_use:N \__int_eval:w + - #1 + } +\cs_new:Npn \__fp_sub_back_mantissa_ii:NNNNNNw #1 #2 #3#4#5#6 #7; + { #2 ; #1 {#3#4#5#6} {#7} ; } +\cs_new:Npn \__fp_sub_back_mantissa_i:NNwNNNNwN #1#2 #3 #4#5#6#7 #8; #9 + { + \if:w 0 #4 + \exp_after:wN \__fp_sub_back_carry:NNwNnnnn + \exp_after:wN #1 + \exp_after:wN #9 + \fi: + ; #2 + {#4#5#6#7} {#8} + } +\cs_new:Npn \__fp_sub_back_carry:NNwNnnnn #1#2 ; #3 #4#5#6#7 ; + { + \exp_after:wN \__fp_sub_back_carry_i:wwN + \int_use:N \__int_eval:w #4 #5 - 1 + \exp_after:wN \__fp_use_s:n + \int_use:N \__int_eval:w 1 #6 #7 0 + #2 0 - #1 ; #3 + } +\cs_new:Npn \__fp_sub_back_carry_i:wwN #1 ; { - \if_int_compare:w \l_fp_input_a_exponent_int < \c_ten - \exp_after:wN \fp_tan_aux_ii: + \if:w 0 #1 + - 8 + \exp_after:wN \__fp_sub_back_carry_small:wN \__int_value:w \else: - \cs_new_eq:cN { c_fp_tan ( \l_fp_arg_tl ) _fp } - \c_zero_fp - \exp_after:wN \fp_trig_overflow_msg: + - \__fp_sub_back_carry_ii:NNNNNNNNw #1 1234567; + \exp_after:wN \__fp_sub_back_carry_large:NNNNNNNNw + \fi: + #1 + } +\cs_new:Npn \__fp_sub_back_carry_ii:NNNNNNNNw #1#2#3#4#5#6#7#8#9; {#8} +\cs_new:Npn \__fp_sub_back_carry_large:NNNNNNNNw #1#2#3#4 #5#6#7#8 #9; + { + \__fp_sub_back_carry_large_ii:NNNNNNNNw + #9 000000 ; {#1#2#3#4} {#5#6#7#8} + } +\cs_new:Npn \__fp_sub_back_carry_large_ii:NNNNNNNNw #1#2#3#4 #5#6#7#8 #9; + { \__fp_sub_back_carry_large_iii:nnnnN {#1#2#3#4} {#5#6#7#8} } +\cs_new:Npn \__fp_sub_back_carry_large_iii:nnnnN #1#2 #3#4 #5 + { ; #5 {#3}{#4} {#1}{#2} ; } +\cs_new:Npn \__fp_sub_back_carry_small:wN #1; + { + - \exp_after:wN \__fp_use_i_until_s:nw + \use_none:nnnnnnnnn #1 012345678; + \__fp_sub_back_carry_small_ii:NNNNNNNN #1 00000000 ; + } +\cs_new:Npn \__fp_sub_back_carry_small_ii:NNNNNNNN #1#2#3#4 #5#6#7#8 + { \__fp_sub_back_carry_small_iii:nnNwN {#1#2#3#4} {#5#6#7#8} } +\cs_new:Npn \__fp_sub_back_carry_small_iii:nnNwN #1 #2 #3 #4; #5 + { ; #5 {#1} {#2} {#3000} {0000} ; } +\cs_new:cpn { __fp_*_o:ww } + \s__fp \__fp_chk:w #1 #2 #3 ; \s__fp \__fp_chk:w #4 #5 + { \__fp_mul_cases:NN #1 #4 #2 #5 #3 ; } +\cs_new:Npn \__fp_mul_cases:NN #1 #2 + { + \if_case:w \if_meaning:w 1 #1 #2 \else: + \if_meaning:w 1 #2 #1 \else: + \if_meaning:w #1#2 #1 \else: + \if_int_compare:w \__int_eval:w #1 + #2 > \c_two + 3 \else: 4 \fi: \fi: \fi: \fi: + \exp_stop_f: + \exp_after:wN \__fp_basics_return_zero:NNww + \or: \exp_after:wN \__fp_mul_normal:NNww + \or: \exp_after:wN \__fp_basics_return_inf:NNww + \or: \exp_after:wN \__fp_basics_return_nan:NNww + \or: + \exp_after:wN \__fp_mul_invalid:NNNNww + \exp_after:wN #1 + \exp_after:wN #2 \fi: } -\cs_new_protected_nopar:Npn \fp_tan_aux_ii: +\cs_new:Npn \__fp_mul_invalid:NNNNww #1#2#3#4#5; #6; { - \fp_trig_normalise: - \if_int_compare:w \l_fp_input_a_sign_int > \c_zero - \if_int_compare:w \l_fp_trig_octant_int > \c_two - \l_fp_output_sign_int \c_minus_one - \else: - \l_fp_output_sign_int \c_one - \fi: + \__fp_invalid_operation:Nnww \c_nan_fp { * } + \s__fp \__fp_chk:w #1 #3 #5 ; + \s__fp \__fp_chk:w #2 #4 #6 ; + } +\cs_new:Npn \__fp_mul_normal:NNww #1#2 + { + \if:w #1#2 + \exp_after:wN \__fp_mul_npos:Nnwnw + \exp_after:wN 0 \else: - \if_int_compare:w \l_fp_trig_octant_int > \c_two - \l_fp_output_sign_int \c_one - \else: - \l_fp_output_sign_int \c_minus_one - \fi: + \exp_after:wN \__fp_mul_npos:Nnwnw + \exp_after:wN 2 \fi: - \fp_cos_aux_ii: - \if_int_compare:w \l_fp_input_a_decimal_int = \c_zero - \if_int_compare:w \l_fp_input_a_integer_int = \c_zero - \cs_new_eq:cN { c_fp_tan ( \l_fp_arg_tl ) _fp } - \c_undefined_fp - \else: - \exp_after:wN \exp_after:wN \exp_after:wN - \fp_tan_aux_iii: - \fi: - \else: - \exp_after:wN \fp_tan_aux_iii: - \fi: - } -\cs_new_protected_nopar:Npn \fp_tan_aux_iii: - { - \l_fp_input_b_integer_int \l_fp_output_decimal_int - \l_fp_input_b_decimal_int \l_fp_output_extended_int - \l_fp_input_b_exponent_int -\c_nine - \fp_standardise:NNNN - \l_fp_input_b_sign_int - \l_fp_input_b_integer_int - \l_fp_input_b_decimal_int - \l_fp_input_b_exponent_int - \fp_sin_aux_ii: - \l_fp_input_a_integer_int \l_fp_output_decimal_int - \l_fp_input_a_decimal_int \l_fp_output_extended_int - \l_fp_input_a_exponent_int -\c_nine - \fp_standardise:NNNN - \l_fp_input_a_sign_int - \l_fp_input_a_integer_int - \l_fp_input_a_decimal_int - \l_fp_input_a_exponent_int - \if_int_compare:w \l_fp_input_a_decimal_int = \c_zero - \if_int_compare:w \l_fp_input_a_integer_int = \c_zero - \cs_new_eq:cN { c_fp_tan ( \l_fp_arg_tl ) _fp } - \c_zero_fp - \else: - \exp_after:wN \exp_after:wN \exp_after:wN \fp_tan_aux_iv: - \fi: - \else: - \exp_after:wN \fp_tan_aux_iv: - \fi: - } -\cs_new_protected_nopar:Npn \fp_tan_aux_iv: - { - \l_fp_output_integer_int \c_zero - \l_fp_output_decimal_int \c_zero - \cs_set_eq:NN \fp_div_store: \fp_div_store_integer: - \l_fp_div_offset_int \c_one_hundred_million - \fp_div_loop: - \l_fp_output_exponent_int - \int_eval:w - \l_fp_input_a_exponent_int - \l_fp_input_b_exponent_int - \int_eval_end: - \fp_standardise:NNNN - \l_fp_output_sign_int - \l_fp_output_integer_int - \l_fp_output_decimal_int - \l_fp_output_exponent_int - \tl_new:c { c_fp_tan ( \l_fp_arg_tl ) _fp } - \tl_gset:cx { c_fp_tan ( \l_fp_arg_tl ) _fp } - { - \if_int_compare:w \l_fp_output_sign_int > \c_zero - + - \else: - - - \fi: - \int_use:N \l_fp_output_integer_int - . - \exp_after:wN \use_none:n - \int_value:w \int_eval:w - \l_fp_output_decimal_int + \c_one_thousand_million - e - \int_use:N \l_fp_output_exponent_int - } } -\tl_const:cn { c_fp_exp_1_tl } { { 2 } { 718281828 } { 459045235 } { 0 } } -\tl_const:cn { c_fp_exp_2_tl } { { 7 } { 389056098 } { 930650227 } { 0 } } -\tl_const:cn { c_fp_exp_3_tl } { { 2 } { 008553692 } { 318766774 } { 1 } } -\tl_const:cn { c_fp_exp_4_tl } { { 5 } { 459815003 } { 314423908 } { 1 } } -\tl_const:cn { c_fp_exp_5_tl } { { 1 } { 484131591 } { 025766034 } { 2 } } -\tl_const:cn { c_fp_exp_6_tl } { { 4 } { 034287934 } { 927351226 } { 2 } } -\tl_const:cn { c_fp_exp_7_tl } { { 1 } { 096633158 } { 428458599 } { 3 } } -\tl_const:cn { c_fp_exp_8_tl } { { 2 } { 980957987 } { 041728275 } { 3 } } -\tl_const:cn { c_fp_exp_9_tl } { { 8 } { 103083927 } { 575384008 } { 3 } } -\tl_const:cn { c_fp_exp_10_tl } { { 2 } { 202646579 } { 480671652 } { 4 } } -\tl_const:cn { c_fp_exp_20_tl } { { 4 } { 851651954 } { 097902280 } { 8 } } -\tl_const:cn { c_fp_exp_30_tl } { { 1 } { 068647458 } { 152446215 } { 13 } } -\tl_const:cn { c_fp_exp_40_tl } { { 2 } { 353852668 } { 370199854 } { 17 } } -\tl_const:cn { c_fp_exp_50_tl } { { 5 } { 184705528 } { 587072464 } { 21 } } -\tl_const:cn { c_fp_exp_60_tl } { { 1 } { 142007389 } { 815684284 } { 26 } } -\tl_const:cn { c_fp_exp_70_tl } { { 2 } { 515438670 } { 919167006 } { 30 } } -\tl_const:cn { c_fp_exp_80_tl } { { 5 } { 540622384 } { 393510053 } { 34 } } -\tl_const:cn { c_fp_exp_90_tl } { { 1 } { 220403294 } { 317840802 } { 39 } } -\tl_const:cn { c_fp_exp_100_tl } { { 2 } { 688117141 } { 816135448 } { 43 } } -\tl_const:cn { c_fp_exp_200_tl } { { 7 } { 225973768 } { 125749258 } { 86 } } -\tl_const:cn { c_fp_exp_-1_tl } { { 3 } { 678794411 } { 71442322 } { -1 } } -\tl_const:cn { c_fp_exp_-2_tl } { { 1 } { 353352832 } { 366132692 } { -1 } } -\tl_const:cn { c_fp_exp_-3_tl } { { 4 } { 978706836 } { 786394298 } { -2 } } -\tl_const:cn { c_fp_exp_-4_tl } { { 1 } { 831563888 } { 873418029 } { -2 } } -\tl_const:cn { c_fp_exp_-5_tl } { { 6 } { 737946999 } { 085467097 } { -3 } } -\tl_const:cn { c_fp_exp_-6_tl } { { 2 } { 478752176 } { 666358423 } { -3 } } -\tl_const:cn { c_fp_exp_-7_tl } { { 9 } { 118819655 } { 545162080 } { -4 } } -\tl_const:cn { c_fp_exp_-8_tl } { { 3 } { 354626279 } { 025118388 } { -4 } } -\tl_const:cn { c_fp_exp_-9_tl } { { 1 } { 234098040 } { 866795495 } { -4 } } -\tl_const:cn { c_fp_exp_-10_tl } { { 4 } { 539992976 } { 248451536 } { -5 } } -\tl_const:cn { c_fp_exp_-20_tl } { { 2 } { 061153622 } { 438557828 } { -9 } } -\tl_const:cn { c_fp_exp_-30_tl } { { 9 } { 357622968 } { 840174605 } { -14 } } -\tl_const:cn { c_fp_exp_-40_tl } { { 4 } { 248354255 } { 291588995 } { -18 } } -\tl_const:cn { c_fp_exp_-50_tl } { { 1 } { 928749847 } { 963917783 } { -22 } } -\tl_const:cn { c_fp_exp_-60_tl } { { 8 } { 756510762 } { 696520338 } { -27 } } -\tl_const:cn { c_fp_exp_-70_tl } { { 3 } { 975449735 } { 908646808 } { -31 } } -\tl_const:cn { c_fp_exp_-80_tl } { { 1 } { 804851387 } { 845415172 } { -35 } } -\tl_const:cn { c_fp_exp_-90_tl } { { 8 } { 194012623 } { 990515430 } { -40 } } -\tl_const:cn { c_fp_exp_-100_tl } { { 3 } { 720075976 } { 020835963 } { -44 } } -\tl_const:cn { c_fp_exp_-200_tl } { { 1 } { 383896526 } { 736737530 } { -87 } } -\cs_new_protected_nopar:Npn \fp_exp:Nn { \fp_exp_aux:NNn \tl_set:Nn } -\cs_new_protected_nopar:Npn \fp_gexp:Nn { \fp_exp_aux:NNn \tl_gset:Nn } -\cs_generate_variant:Nn \fp_exp:Nn { c } -\cs_generate_variant:Nn \fp_gexp:Nn { c } -\cs_new_protected:Npn \fp_exp_aux:NNn #1#2#3 - { - \group_begin: - \fp_split:Nn a {#3} - \fp_standardise:NNNN - \l_fp_input_a_sign_int - \l_fp_input_a_integer_int - \l_fp_input_a_decimal_int - \l_fp_input_a_exponent_int - \l_fp_input_a_extended_int \c_zero - \tl_set:Nx \l_fp_arg_tl - { - \if_int_compare:w \l_fp_input_a_sign_int < \c_zero - - - \else: - + - \fi: - \int_use:N \l_fp_input_a_integer_int - . - \exp_after:wN \use_none:n - \int_value:w \int_eval:w - \l_fp_input_a_decimal_int + \c_one_thousand_million - e - \int_use:N \l_fp_input_a_exponent_int - } - \if_cs_exist:w c_fp_exp ( \l_fp_arg_tl ) _fp \cs_end: - \else: - \exp_after:wN \fp_exp_internal: - \fi: - \cs_set_protected_nopar:Npx \fp_tmp:w - { - \group_end: - #1 \exp_not:N #2 - { - \if_cs_exist:w c_fp_exp ( \l_fp_arg_tl ) _fp - \cs_end: - \use:c { c_fp_exp ( \l_fp_arg_tl ) _fp } - \else: - \c_zero_fp - \fi: - } - } - \fp_tmp:w +\cs_new:Npn \__fp_mul_npos:Nnwnw #1 #2#3; #4 #5; + { + \exp_after:wN \__fp_sanitize:Nw + \exp_after:wN #1 + \int_use:N \__int_eval:w + #2 + #4 + \__fp_mul_mantissa:nnnnNnnnn #3 #1 #5 + \exp_after:wN ; + } +\cs_new:Npn \__fp_mul_mantissa:nnnnNnnnn #1#2#3#4 #5 #6#7#8#9 + { + \exp_after:wN \__fp_mul_mantissa_after:NNN + \exp_after:wN #5 + \int_use:N \__int_eval:w 99990000 + #1*#6 + + \exp_after:wN \__fp_mul_mantissa_keep:NNNNNw + \int_use:N \__int_eval:w 99990000 + #1*#7 + #2*#6 + + \exp_after:wN \__fp_mul_mantissa_keep:NNNNNw + \int_use:N \__int_eval:w 99990000 + #1*#8 + #2*#7 + #3*#6 + + \exp_after:wN \__fp_mul_mantissa_drop:NNNNNw + \int_use:N \__int_eval:w 99990000 + #1*#9 + #2*#8 + #3*#7 + #4*#6 + + \exp_after:wN \__fp_mul_mantissa_drop:NNNNNw + \int_use:N \__int_eval:w 99990000 + #2*#9 + #3*#8 + #4*#7 + + \exp_after:wN \__fp_mul_mantissa_drop:NNNNNw + \int_use:N \__int_eval:w 99990000 + #3*#9 + #4*#8 + + \exp_after:wN \__fp_mul_mantissa_drop:NNNNNw + \int_use:N \__int_eval:w 100000000 + #4*#9 \exp_after:wN ; + } +\cs_new:Npn \__fp_mul_mantissa_drop:NNNNNw #1#2#3#4#5 #6; + { #1#2#3#4#5 ; + #6 } +\cs_new:Npn \__fp_mul_mantissa_keep:NNNNNw #1#2#3#4#5 #6; + { #1#2#3#4#5 ; #6 ; } +\cs_new:Npn \__fp_mul_mantissa_after:NNN #1 #2 #3 + { + \if:w 0 #3 + \exp_after:wN \__fp_mul_mantissa_small:NNwwwN + \else: + \exp_after:wN \__fp_mul_mantissa_large:NwwNNNN + \fi: + #1 #3 } -\cs_new_protected_nopar:Npn \fp_exp_internal: +\cs_new:Npn \__fp_mul_mantissa_large:NwwNNNN #1 #2; #3; #4#5#6#7; + { - \if_int_compare:w \l_fp_input_a_exponent_int < \c_three - \fp_extended_normalise: - \if_int_compare:w \l_fp_input_a_sign_int > \c_zero - \if_int_compare:w \l_fp_input_a_integer_int < 230 \scan_stop: - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_after:wN \fp_exp_aux: - \else: - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_after:wN \fp_exp_overflow_msg: + \exp_after:wN \__fp_basics_pack_high:NNNNNw + \int_use:N \__int_eval:w 1#2 + \exp_after:wN \__fp_basics_pack_low:NNNNNw + \int_use:N \__int_eval:w 1#3#4#5#6#7 + \__fp_round_s:NNNw #1 #7 + } +\cs_new:Npn \__fp_mul_mantissa_small:NNwwwN #1 #2#3; #4; #5; + #6 + { + - \c_one + \exp_after:wN \__fp_basics_pack_high:NNNNNw + \int_use:N \__int_eval:w 1#3 + \exp_after:wN \__fp_mul_mantissa_small_pack:NNNNNNw + \int_use:N \__int_eval:w 1#4#5#6 + \__fp_round_s:NNNw #1 #6 + } +\cs_new:Npn \__fp_mul_mantissa_small_pack:NNNNNNw #1#2 #3#4#5#6 #7; + { + #2 + \if:w 2 #1 + + \c_ten + \fi: + ; {#3#4#5#6} {#7} ; + } +\cs_new:cpn { __fp_/_o:ww } + \s__fp \__fp_chk:w #1 #2 #3 ; \s__fp \__fp_chk:w #4 #5 #6 ; + { \__fp_div_back_cases:NN #4 #1 #5 #2 #6 ; #3 ; } +\cs_new:Npn \__fp_div_back_cases:NN #1 #2 + { + \if_case:w \if_int_compare:w #1 = #2 \exp_stop_f: + #1 \exp_stop_f: + \else: + \if_int_compare:w #1 < #2 \exp_stop_f: + \if:w 3 #2 \c_four \else: \c_five \fi: + \else: + \if:w 3 #1 \c_six \else: \c_seven \fi: + \fi: + \fi: + \exp_after:wN \__fp_div_back_invalid:NNNww \exp_after:wN 0 + \or: \exp_after:wN \__fp_div_back_normal:NNww + \or: \exp_after:wN \__fp_div_back_invalid:NNNww \exp_after:wN 2 + \or: \exp_after:wN \__fp_basics_return_nan_nan:NNww + \or: + \exp_after:wN \__fp_basics_return_ii:NNNNww + \exp_after:wN #1 + \exp_after:wN #2 + \or: \exp_after:wN \__fp_basics_return_inf:NNww + \or: + \exp_after:wN \__fp_basics_return_i:NNNNww + \exp_after:wN #1 + \exp_after:wN #2 + \or: \exp_after:wN \__fp_basics_return_zero:NNww + \fi: + } +\cs_new:Npn \__fp_div_back_invalid:NNNww #1#2#3 #4; #5; + { + \__fp_invalid_operation:Nnww \c_nan_fp { / } + \s__fp \__fp_chk:w #1 #3 #5 ; + \s__fp \__fp_chk:w #1 #2 #4 ; + } +\cs_new:Npn \__fp_div_back_normal:NNww #1#2 + { + \if:w #1#2 + \exp_after:wN \__fp_div_back_npos:Nnwnw + \exp_after:wN 0 + \else: + \exp_after:wN \__fp_div_back_npos:Nnwnw + \exp_after:wN 2 + \fi: + } +\cs_new:Npn \__fp_div_back_npos:Nnwnw #1 #2 #3#4#5#6; #7 #8; + { + \exp_after:wN \__fp_sanitize:Nw + \exp_after:wN #1 + \int_use:N \__int_eval:w + #7 - #2 + \__fp_div_mantissa_i:wNwnn #3; #4; + #8 {#3}{#4}{#5}{#6} #1 + } +\cs_new:Npn \__fp_div_mantissa_i:wNwnn #1; #2 #3; #4 #5 + { + \exp_after:wN \__fp_div_mantissa_ii:ww + \int_use:N \__int_eval:w #1#2 + \c_one ; + #4 #5 ; + } +\cs_new:Npn \__fp_div_mantissa_ii:ww #1; #2; + { + \exp_after:wN \__fp_div_mantissa_iii:www + \__int_value:w #1 \exp_after:wN ; + \__int_value:w + \exp_after:wN \__fp_div_mantissa_calc:Nwwnnnnnn + \int_use:N \__int_eval:w #20/#1 + 999999 ; #2 ; + } +\cs_new:Npn \__fp_div_mantissa_calc:Nwwnnnnnn 1#1#2; #3;#4#5 #6#7#8#9 + { + 1 #1 #2 \exp_after:wN ; + \int_use:N \__int_eval:w + - 200000 + #3 - #2 * #6 + \if_meaning:w 1 #1 + - #6#70 + \fi: + + + \exp_after:wN \__fp_div_mantissa_calc_last:NNNNNN + \int_use:N \__int_eval:w + 1999800000 + #4 - #2*#7 + \if_meaning:w 1 #1 + - #80 + \fi: + + + \exp_after:wN \__fp_div_mantissa_calc_pack:NNNNNNw + \int_use:N \__int_eval:w + 1999800000 + #5 - #2*#8 + \if_meaning:w 1 #1 + - #90 \fi: + + + \exp_after:wN \__fp_div_mantissa_calc_pack:NNNNNNw + \int_use:N \__int_eval:w 2000000000 - #2*#9 ; + {#6}{#7}{#8}{#9} + } +\cs_new:Npn \__fp_div_mantissa_calc_pack:NNNNNNw #1#2#3#4#5#6 #7; + { #1#2#3#4#5#6 ; {#7} } +\cs_new:Npn \__fp_div_mantissa_calc_last:NNNNNN #1#2#3#4#5#6 + { #1#2#3#4#5#6 \__int_eval_end: } +\cs_new:Npn \__fp_div_mantissa_iii:www #1; #2; #3; + { + \exp_after:wN \__fp_div_mantissa_iii_after:w + \int_use:N \__int_eval:w #2 + \exp_after:wN \__fp_div_mantissa_iv:www + \__int_value:w #1 \exp_after:wN ; + \__int_value:w + \exp_after:wN \__fp_div_mantissa_calc:Nwwnnnnnn + \int_use:N \__int_eval:w #30/#1 + 999999 ; + #3 ; + } +\cs_new:Npn \__fp_div_mantissa_iv:www #1; #2; #3; + { + \exp_after:wN \__fp_div_mantissa_pack:NNN + \int_use:N \__int_eval:w #2 + \exp_after:wN \__fp_div_mantissa_v:www + \__int_value:w #1 \exp_after:wN ; + \__int_value:w + \exp_after:wN \__fp_div_mantissa_calc:Nwwnnnnnn + \int_use:N \__int_eval:w #30/#1 + 999999 ; + #3 ; + } +\cs_new:Npn \__fp_div_mantissa_v:www #1; #2; #3; + { + \exp_after:wN \__fp_div_mantissa_pack:NNN + \int_use:N \__int_eval:w #2 + \exp_after:wN \__fp_div_mantissa_vi:wwnnnn + \__int_value:w + \exp_after:wN \__fp_div_mantissa_calc:Nwwnnnnnn + \int_use:N \__int_eval:w #30/#1 + 999999 ; + #3 ; + } +\cs_new:Npn \__fp_div_mantissa_vi:wwnnnn #1; #2;#3#4 #5#6 + { + \exp_after:wN \__fp_div_mantissa_pack:NNN + \int_use:N \__int_eval:w #10 + \exp_after:wN \__fp_div_mantissa_vii:wwnnnnnn + \int_use:N \__int_eval:w (\c_two*#2)/#5#6 ; % <- P + #2;{#3}{#4} + {#5}{#6} + } +\cs_new:Npn \__fp_div_mantissa_vii:wwnnnnnn #1; #2;#3#4 #5#6#7#8 + { + + \c_five * #1 + \exp_after:wN \__fp_div_mantissa_ix:Nww + \int_use:N \__int_eval:w -20 + 2*#2 - #1*#5#6 + + \exp_after:wN \__fp_div_mantissa_viii:NNw + \int_use:N \__int_eval:w 199980 + 2*#3 - #1*#7 + + \exp_after:wN \__fp_div_mantissa_viii:NNw + \int_use:N \__int_eval:w 200000 + 2*#4 - #1*#8 ; ; + } +\cs_new:Npn \__fp_div_mantissa_viii:NNw #1#2#3; { #1#2 ; + #3 } +\cs_new:Npn \__fp_div_mantissa_ix:Nww #1#2;#3; + { + \if_meaning:w 0 #1 + \exp_after:wN \__fp_div_mantissa_x:w + \int_use:N \__int_eval:w #3 + \else: + \if_meaning:w - #1 + - \else: - \if_int_compare:w \l_fp_input_a_integer_int < 230 \scan_stop: - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_after:wN \fp_exp_aux: - \else: - \fp_exp_const:cx { c_fp_exp ( \l_fp_arg_tl ) _fp } - { \c_zero_fp } - \fi: + + \fi: - \else: - \exp_after:wN \fp_exp_overflow_msg: + \c_one \fi: + ; } -\cs_new_protected_nopar:Npn \fp_exp_aux: +\cs_new:Npn \__fp_div_mantissa_x:w #1; { - \if_int_compare:w \l_fp_input_a_integer_int > \c_zero - \exp_after:wN \fp_exp_integer: + \if_int_compare:w #1 > \c_zero + + \c_one + \fi: + ; + } +\cs_new:Npn \__fp_div_mantissa_pack:NNN 1 #1 #2 { + #1 #2 ; } +\cs_new:Npn \__fp_div_mantissa_iii_after:w 10 #1 + { + \if_meaning:w 0 #1 + \exp_after:wN \__fp_div_mantissa_small:wwwNNNNwN \else: - \l_fp_output_integer_int \c_one - \l_fp_output_decimal_int \c_zero - \l_fp_output_extended_int \c_zero - \l_fp_output_exponent_int \c_zero - \exp_after:wN \fp_exp_decimal: + \exp_after:wN \__fp_div_mantissa_large:wwwNNNNwN \fi: + #1 } -\cs_new_protected_nopar:Npn \fp_exp_integer: +\cs_new:Npn \__fp_div_mantissa_small:wwwNNNNwN + 0 #1; #2; #3; #4#5#6#7#8; #9 + { + \exp_after:wN \__fp_basics_pack_high:NNNNNw + \int_use:N \__int_eval:w 1 #1#2 + \exp_after:wN \__fp_basics_pack_low:NNNNNw + \int_use:N \__int_eval:w 1 #3#4#5#6#7 + + \__fp_round:NNN #9 #7 #8 + \exp_after:wN ; + } +\cs_new:Npn \__fp_div_mantissa_large:wwwNNNNwN + #1; #2; #3; #4#5#6#7#8; #9 + { + + \c_one + \exp_after:wN \__fp_div_mantissa_large_pack:NNNNNNNNw + \int_use:N \__int_eval:w 1 #1 #2 %<- 1+9d + \exp_after:wN \__fp_add_mantissa_carry_pack_ii:NNNNw + \int_use:N \__int_eval:w 1 #3 #4 #5 #6 + + \__fp_round:NNNN #9 #6 #7 #8 + \exp_after:wN ; + } +\cs_new:Npn \__fp_div_mantissa_large_pack:NNNNNNNNw + 1 #1#2#3#4 #5#6#7#8 #9; { ; {#1#2#3#4} {#5#6#7#8} {#9} } +\cs_new:Npn \__fp_neg:w \s__fp \__fp_chk:w #1 #2 + { + \exp_after:wN \__fp_exp_after_o:w + \exp_after:wN \s__fp + \exp_after:wN \__fp_chk:w + \exp_after:wN #1 + \int_use:N \__int_eval:w \c_two - #2 \__int_eval_end: + } +\cs_new:Npn \__fp_abs:w \s__fp \__fp_chk:w #1 #2 + { \__fp_exp_after_o:w \s__fp \__fp_chk:w #1 0 } +%% File: l3fp-extended.dtx Copyright (C) 2011-2012 The 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 +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% 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. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +\tl_const:Nn \c__fp_one_fixed_tl + { {10000} {0000} {0000} {0000} {0000} {0000} } +\cs_new:Npn \__fp_fixed_continue:wn #1; #2 { #2 #1; } +\cs_new:Npn \__fp_fixed_div_int:wwN #1#2#3#4#5#6 ; #7 ; #8 + { + \exp_after:wN \__fp_fixed_div_int_after:Nw + \exp_after:wN #8 + \int_use:N \__int_eval:w \c_minus_one + \__fp_fixed_div_int_i:wnN + #1; {#7} \__fp_fixed_div_int_ii:wnn + #2; {#7} \__fp_fixed_div_int_ii:wnn + #3; {#7} \__fp_fixed_div_int_ii:wnn + #4; {#7} \__fp_fixed_div_int_ii:wnn + #5; {#7} \__fp_fixed_div_int_ii:wnn + #6; {#7} \__fp_fixed_div_int_end:wnn ; + } +\cs_new:Npn \__fp_fixed_div_int_i:wnN #1; #2 #3 + { + \exp_after:wN #3 + \int_use:N \__int_eval:w #1 / #2 - \c_one ; + {#2} + {#1} + } +\cs_new:Npn \__fp_fixed_div_int_ii:wnn #1; #2 #3 + { + + #1 + \exp_after:wN \__fp_fixed_div_int_pack:Nw + \int_use:N \__int_eval:w 9999 + \exp_after:wN \__fp_fixed_div_int_i:wnN + \int_use:N \__int_eval:w #3 - #1*#2 \__int_eval_end: + } +\cs_new:Npn \__fp_fixed_div_int_end:wnn #1; #2 #3 { + #1 + \c_two ; } +\cs_new:Npn \__fp_fixed_div_int_pack:Nw #1 #2; { + #1; {#2} } +\cs_new:Npn \__fp_fixed_div_int_after:Nw #1 #2; { #1 {#2} } +\cs_new:Npn \__fp_fixed_add_one:wN #1#2; #3 + { + \exp_after:wN #3 \exp_after:wN + { \int_use:N \__int_eval:w 10000 + #1 } #2 ; + } +\cs_new_nopar:Npn \__fp_fixed_add:wwN { \__fp_fixed_add_i:NNnnnnwnn + + } +\cs_new_nopar:Npn \__fp_fixed_sub:wwN { \__fp_fixed_add_i:NNnnnnwnn + - } +\cs_new_nopar:Npn \__fp_fixed_sub_back:wwN { \__fp_fixed_add_i:NNnnnnwnn - + } +\cs_new:Npn \__fp_fixed_add_i:NNnnnnwnn #1#2 #3#4#5#6 #7; #8#9 + { + \exp_after:wN \__fp_fixed_add_after:NNNNNwN + \int_use:N \__int_eval:w 1 9999 9998 #1 #3#4 #2 #8#9 + \exp_after:wN \__fp_fixed_add_pack:NNNNNwN + \int_use:N \__int_eval:w 1 9999 9998 #1 #5#6 + \__fp_fixed_add_ii:NnnNnnnnw #1 #7 #2 + } +\cs_new:Npn \__fp_fixed_add_ii:NnnNnnnnw #1 #2#3 #4 #5#6 #7#8 ; #9 + { + #4 #5#6 + \exp_after:wN \__fp_fixed_add_pack:NNNNNwN + \int_use:N \__int_eval:w 2 0000 0000 #4 #7#8 #1 #2#3 ; #9 ; + } +\cs_new:Npn \__fp_fixed_add_pack:NNNNNwN #1 #2#3#4#5 #6; #7 + { + #1 ; #7 {#2#3#4#5} {#6} } +\cs_new:Npn \__fp_fixed_add_after:NNNNNwN #1 #2#3#4#5 #6; #7 + { + \exp_after:wN #7 + \exp_after:wN { \int_use:N \__int_eval:w - 2 0000 + #1#2#3#4#5 } + {#6} + } +\cs_new:Npn \__fp_fixed_mul:wwn #1#2#3#4 #5; #6#7#8#9 + { + \exp_after:wN \__fp_fixed_mul_after:wwn + \int_use:N \__int_eval:w \c__fp_leading_shift_int + \exp_after:wN \__fp_pack:NNNNNw + \int_use:N \__int_eval:w \c__fp_middle_shift_int + + #1*#6 + \exp_after:wN \__fp_pack:NNNNNw + \int_use:N \__int_eval:w \c__fp_middle_shift_int + + #1*#7 + #2*#6 + \exp_after:wN \__fp_pack:NNNNNw + \int_use:N \__int_eval:w \c__fp_middle_shift_int + + #1*#8 + #2*#7 + #3*#6 + \exp_after:wN \__fp_pack:NNNNNw + \int_use:N \__int_eval:w \c__fp_middle_shift_int + + #1*#9 + #2*#8 + #3*#7 + #4*#6 + \exp_after:wN \__fp_pack:NNNNNw + \int_use:N \__int_eval:w \c__fp_trailing_shift_int + + #2*#9 + #3*#8 + #4*#7 + + ( #3*#9 + #4*#8 + + \__fp_fixed_mul_i:nnnnnnnn #5 {#6}{#7} {#1}{#2} + } +\cs_new:Npn \__fp_fixed_mul_i:nnnnnnnn #1#2 #3#4 #5#6 #7#8 + { #1*#4 + #2*#3 + #5*#8 + #6*#7 )/10000 + #1*#3 + #5*#7 ; } +\cs_new:Npn \__fp_fixed_mul_pack:NNNNNw + #1 #2#3#4#5 #6; { + #1#2#3#4#5 ; {#6} } +\cs_new:Npn \__fp_fixed_mul_after:wwn #1; #2; #3 { #3 {#1} #2 ; } +\cs_new:Npn \__fp_fixed_one_minus_mul:wwn #1; #2#3#4#5; + { + \exp_after:wN \__fp_fixed_mul_after:wwn + \int_use:N \__int_eval:w \c__fp_big_leading_shift_int + \c_ten_thousand + \exp_after:wN \__fp_pack_big:NNNNNNw + \int_use:N \__int_eval:w \c__fp_big_middle_shift_int + \__fp_fixed_mul_add_i:Nnwnnwnnn + - 00; {#2}{#3}{#4}; #1; {#2}{#3}{#4}#5; - 00 ; + } +\cs_new:Npn \__fp_fixed_mul_add:wwwn #1; #2#3#4#5; #6#7#8#9 + { + \exp_after:wN \__fp_fixed_mul_after:wwn + \int_use:N \__int_eval:w \c__fp_big_leading_shift_int + #6 + \exp_after:wN \__fp_pack_big:NNNNNNw + \int_use:N \__int_eval:w \c__fp_big_middle_shift_int + #7 + \__fp_fixed_mul_add_i:Nnwnnwnnn + + {#8}{#9}; {#2}{#3}{#4}; #1; {#2}{#3}{#4}#5; + + } +\cs_new:Npn \__fp_fixed_mul_sub_back:wwwn #1; #2#3#4#5; #6#7#8#9 + { + \exp_after:wN \__fp_fixed_mul_after:wwn + \int_use:N \__int_eval:w \c__fp_big_leading_shift_int + #6 + \exp_after:wN \__fp_pack_big:NNNNNNw + \int_use:N \__int_eval:w \c__fp_big_middle_shift_int + #7 + \__fp_fixed_mul_add_i:Nnwnnwnnn + - {#8}{#9}; {#2}{#3}{#4}; #1; {#2}{#3}{#4}#5; - + } +\cs_new:Npn \__fp_fixed_mul_add_i:Nnwnnwnnn #1 #2#3; #4#5#6; #7#8#9 + { % sg z3z4; y1y2y3; x1x2x3 x4x5x6; y1y2y3y4y5y6; sg z5z6; + #1 #7*#4 + \exp_after:wN \__fp_pack_big:NNNNNNw + \int_use:N \__int_eval:w \c__fp_big_middle_shift_int + #2 + #1 #7*#5 #1 #8*#4 + \exp_after:wN \__fp_pack_big:NNNNNNw + \int_use:N \__int_eval:w \c__fp_big_middle_shift_int + #3 + #1 #7*#6 #1 #8*#5 #1 #9*#4 + \exp_after:wN \__fp_pack_big:NNNNNNw + \int_use:N \__int_eval:w \c__fp_big_middle_shift_int + #1 \__fp_fixed_mul_add_ii:nnnnwnnnn {#7}{#8}{#9} + } +\cs_new:Npn \__fp_fixed_mul_add_ii:nnnnwnnnn #1#2#3#4#5; #6#7#8#9 + { % x1x2x3x4 x5x6; y1y2y3y4 y5y6; sg z5z6; + ( #1*#9 + #2*#8 + #3*#7 + #4*#6 ) + \exp_after:wN \__fp_pack_big:NNNNNNw + \int_use:N \__int_eval:w \c__fp_big_trailing_shift_int + \__fp_fixed_mul_add_iii:nnnnwnnwN + { #6 + #4*#7 + #3*#8 + #2*#9 + #1 } + { #7 + #4*#8 + #3*#9 + #2 } + {#1} #5; + {#6} + } +\cs_new:Npn \__fp_fixed_mul_add_iii:nnnnwnnwN #1#2 #3#4#5; #6#7#8; #9 + { % {y1+x4*y2+x3*y3+x2*y4+x1} {y2+x4*y3+x3*y4+x2} + % x1x5x6; y1y5y6; sg z5z6; + % => + % sg (x5*y1+x4*y2+x3*y3+x2*y4+x1*y5) + % sg (x6*y1+x5*y2+x4*y3+x3*y4+x2*y5+x1*y6)/10000 + % + z5z6; + #9 (#4* #1 *#7) + #9 (#5*#6+#4* #2 *#7+#3*#8) / \c_ten_thousand + + \__fp_use_s:nn + } +\cs_new:Npn \__fp_fixed_to_float:Nw #1#2; { \__fp_fixed_to_float:wN #2; #1 } +\cs_new:Npn \__fp_fixed_to_float:wN #1#2#3#4#5#6; #7 + { + + \c_four % for the 8-digit-at-the-start thing. + \exp_after:wN \exp_after:wN + \exp_after:wN \__fp_fixed_to_loop:N + \exp_after:wN \use_none:n + \int_use:N \__int_eval:w + 1 0000 0000 + #1 \exp_after:wN \__fp_use_none_stop_f:n + \__int_value:w 1#2 \exp_after:wN \__fp_use_none_stop_f:n + \__int_value:w 1#3#4 \exp_after:wN \__fp_use_none_stop_f:n + \__int_value:w 1#5#6 + \exp_after:wN ; + \exp_after:wN ; + } +\cs_new:Npn \__fp_fixed_to_loop:N #1 + { + \if_meaning:w 0 #1 + - \c_one + \exp_after:wN \__fp_fixed_to_loop:N + \else: + \exp_after:wN \__fp_fixed_to_loop_end:w + \exp_after:wN #1 + \fi: + } +\cs_new:Npn \__fp_fixed_to_loop_end:w #1 #2 ; { - \if_int_compare:w \l_fp_input_a_integer_int < \c_one_hundred - \l_fp_exp_integer_int \c_one - \l_fp_exp_decimal_int \c_zero - \l_fp_exp_extended_int \c_zero - \l_fp_exp_exponent_int \c_zero - \exp_after:wN \fp_exp_integer_tens: + \if_meaning:w ; #1 + \exp_after:wN \__fp_fixed_to_float_zero:w \else: - \tl_set:Nx \l_fp_internal_tl - { - \exp_after:wN \use_i:nnn - \int_use:N \l_fp_input_a_integer_int - } - \l_fp_input_a_integer_int - \int_eval:w - \l_fp_input_a_integer_int - \l_fp_internal_tl 00 - \int_eval_end: - \if_int_compare:w \l_fp_input_a_sign_int < \c_zero - \if_int_compare:w \l_fp_output_integer_int > 200 \scan_stop: - \fp_exp_const:cx { c_fp_exp ( \l_fp_arg_tl ) _fp } - { \c_zero_fp } - \else: - \fp_exp_integer_const:n { - \l_fp_internal_tl 00 } - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_after:wN \fp_exp_integer_tens: + \exp_after:wN \__fp_pack_twice_four:wNNNNNNNN + \exp_after:wN \__fp_pack_twice_four:wNNNNNNNN + \exp_after:wN \__fp_fixed_to_float_pack:ww + \exp_after:wN ; + \fi: + #1 #2 0000 0000 0000 0000 ; + } +\cs_new:Npn \__fp_fixed_to_float_zero:w ; 0000 0000 0000 0000 ; + { + - \c_two * \c__fp_max_exponent_int ; + {0000} {0000} {0000} {0000} ; + } +\cs_new:Npn \__fp_fixed_to_float_pack:ww #1 ; #2#3 ; ; + { + \if_int_compare:w #2 > \c_four + \exp_after:wN \__fp_fixed_to_float_round_up:wnnnnw + \fi: + ; #1 ; + } +\cs_new:Npn \__fp_fixed_to_float_round_up:wnnnnw ; #1#2#3#4 ; + { + \exp_after:wN \__fp_basics_pack_high:NNNNNw + \int_use:N \__int_eval:w 1 #1#2 + \exp_after:wN \__fp_basics_pack_low:NNNNNw + \int_use:N \__int_eval:w 1 #3#4 + \c_one ; + } +\cs_new:Npn \__fp_fixed_inv_to_float:wN #1#2; #3 + { + - \__int_eval:w + \if_int_compare:w #1 < \c_one_thousand + \__fp_fixed_dtf_zeros:wNnnnnnn \fi: - \else: - \fp_exp_integer_const:n { \l_fp_internal_tl 00 } - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_after:wN \fp_exp_integer_tens: + \__fp_fixed_dtf_no_zero:Nwn + {#1} #2 \s__fp + \__fp_fixed_dtf_approx:n + {10000} {0000} {0000} {0000} {0000} {0000} ; + } +\cs_new:Npn \__fp_fixed_div_to_float:ww #1#2; #3#4; + { + \if_int_compare:w #1 < \c_one_thousand + \__fp_fixed_dtf_zeros:wNnnnnnn + \fi: + \__fp_fixed_dtf_no_zero:Nwn - {#1} #2 \s__fp + { + \if_int_compare:w #3 < \c_one_thousand + \__fp_fixed_dtf_zeros:wNnnnnnn \fi: + \__fp_fixed_dtf_no_zero:Nwn + {#3} #4 \s__fp + \__fp_fixed_dtf_approx:n + } + } +\cs_new:Npn \__fp_fixed_dtf_no_zero:Nwn #1#2 \s__fp #3 { #3 #2; } +\cs_new:Npn \__fp_fixed_dtf_zeros:wNnnnnnn + \fi: \__fp_fixed_dtf_no_zero:Nwn #1#2#3#4#5#6#7 + { \fi: + #1 \c_minus_one + \exp_after:wN \use_i_ii:nnn + \exp_after:wN \__fp_fixed_dtf_zeros:NN + \exp_after:wN #1 + \int_use:N \__int_eval:w 10 0000 + #2 \__int_eval_end: #3#4#5#6#7 + ; 1 ; } -\cs_new_protected_nopar:Npn \fp_exp_integer_tens: +\cs_new:Npn \__fp_fixed_dtf_zeros:NN #1#2 { - \l_fp_output_integer_int \l_fp_exp_integer_int - \l_fp_output_decimal_int \l_fp_exp_decimal_int - \l_fp_output_extended_int \l_fp_exp_extended_int - \l_fp_output_exponent_int \l_fp_exp_exponent_int - \if_int_compare:w \l_fp_input_a_integer_int > \c_nine - \tl_set:Nx \l_fp_internal_tl - { - \exp_after:wN \use_i:nn - \int_use:N \l_fp_input_a_integer_int - } - \l_fp_input_a_integer_int - \int_eval:w - \l_fp_input_a_integer_int - \l_fp_internal_tl 0 - \int_eval_end: - \if_int_compare:w \l_fp_input_a_sign_int > \c_zero - \fp_exp_integer_const:n { \l_fp_internal_tl 0 } - \else: - \fp_exp_integer_const:n { - \l_fp_internal_tl 0 } - \fi: - \fp_mul:NNNNNNNNN - \l_fp_exp_integer_int \l_fp_exp_decimal_int \l_fp_exp_extended_int - \l_fp_output_integer_int \l_fp_output_decimal_int - \l_fp_output_extended_int - \l_fp_output_integer_int \l_fp_output_decimal_int - \l_fp_output_extended_int - \tex_advance:D \l_fp_output_exponent_int \l_fp_exp_exponent_int - \fp_extended_normalise_output: + \if_meaning:w 0 #2 + #1 \c_one + \else: + \__fp_fixed_dtf_zeros_end:wNww #2 \fi: - \fp_exp_integer_units: + \__fp_fixed_dtf_zeros:NN #1 } -\cs_new_protected_nopar:Npn \fp_exp_integer_units: +\cs_new:Npn \__fp_fixed_dtf_zeros_end:wNww + #1 \fi: \__fp_fixed_dtf_zeros:NN #2 #3; #4 \s__fp { - \if_int_compare:w \l_fp_input_a_integer_int > \c_zero - \if_int_compare:w \l_fp_input_a_sign_int > \c_zero - \fp_exp_integer_const:n { \int_use:N \l_fp_input_a_integer_int } - \else: - \fp_exp_integer_const:n - { - \int_use:N \l_fp_input_a_integer_int } - \fi: - \fp_mul:NNNNNNNNN - \l_fp_exp_integer_int \l_fp_exp_decimal_int \l_fp_exp_extended_int - \l_fp_output_integer_int \l_fp_output_decimal_int - \l_fp_output_extended_int - \l_fp_output_integer_int \l_fp_output_decimal_int - \l_fp_output_extended_int - \tex_advance:D \l_fp_output_exponent_int \l_fp_exp_exponent_int - \fp_extended_normalise_output: \fi: - \fp_exp_decimal: + \if_meaning:w ; #1 + #2 \c_two * \c__fp_max_exponent_int + \use_i_ii:nnn + \fi: + \__fp_fixed_dtf_zeros_ii:ww + #1#3 0000 0000 0000 0000 0000 0000 ; + } +\cs_new:Npn \__fp_fixed_dtf_zeros_ii:ww + { + \__fp_pack_twice_four:wNNNNNNNN + \__fp_pack_twice_four:wNNNNNNNN + \__fp_pack_twice_four:wNNNNNNNN + \__fp_fixed_dtf_zeros_iii:ww + ; + } +\cs_new:Npn \__fp_fixed_dtf_zeros_iii:ww #1; #2; #3 { #3 #1; } +\cs_new:Npn \__fp_fixed_dtf_approx:n #1 + { + \exp_after:wN \__fp_fixed_dtf_approx_ii:wnn + \int_use:N \__int_eval:w 10 0000 0000 / ( #1 + \c_one ) ; + {#1} + } +\cs_new:Npn \__fp_fixed_dtf_approx_ii:wnn #1; #2#3 + { + \exp_after:wN \__fp_fixed_dtf_approx_iii:NNNNNw + \int_use:N \__int_eval:w 10 0000 0000 - 1750 + + #1000 + (10 0000 0000/#2-#1) * (1000-#3/10) ; + {#2}{#3} } -\cs_new_protected:Npn \fp_exp_integer_const:n #1 +\cs_new:Npn \__fp_fixed_dtf_approx_iii:NNNNNw 1#1#2#3#4#5#6; #7; #8; { - \exp_after:wN \exp_after:wN \exp_after:wN - \fp_exp_integer_const:nnnn - \cs:w c_fp_exp_ #1 _tl \cs_end: + + \c_four % because of the line below "dtf_epsilon" here. + \__fp_fixed_mul:wwn {000#1}{#2#3#4#5}{#6}{0000}{0000}{0000} ; #7; + \__fp_fixed_dtf_epsilon:wN + \__fp_fixed_mul:wwn {000#1}{#2#3#4#5}{#6}{0000}{0000}{0000} ; + \__fp_fixed_mul:wwn #8; + \__fp_fixed_to_float:wN ? } -\cs_new_protected:Npn \fp_exp_integer_const:nnnn #1#2#3#4 +\cs_new:Npn \__fp_fixed_dtf_epsilon:wN #1#2#3#4#5#6; { - \l_fp_exp_integer_int #1 \scan_stop: - \l_fp_exp_decimal_int #2 \scan_stop: - \l_fp_exp_extended_int #3 \scan_stop: - \l_fp_exp_exponent_int #4 \scan_stop: + \exp_after:wN \__fp_fixed_dtf_epsilon_ii:NNNNNww + \int_use:N \__int_eval:w 1 9999 9998 - #3#4 + + \exp_after:wN \__fp_fixed_dtf_epsilon_pack:NNNNNw + \int_use:N \__int_eval:w 2 0000 0000 - #5#6 ; {0000} ; } -\cs_new_protected_nopar:Npn \fp_exp_decimal: +\cs_new:Npn \__fp_fixed_dtf_epsilon_pack:NNNNNw #1#2#3#4#5#6; + { #1 ; {#2#3#4#5} {#6} } +\cs_new:Npn \__fp_fixed_dtf_epsilon_ii:NNNNNww #1#2#3#4#5#6; #7; { - \if_int_compare:w \l_fp_input_a_decimal_int > \c_zero - \if_int_compare:w \l_fp_input_a_sign_int > \c_zero - \l_fp_exp_integer_int \c_one - \l_fp_exp_decimal_int \l_fp_input_a_decimal_int - \l_fp_exp_extended_int \l_fp_input_a_extended_int + \__fp_fixed_mul:wwn %^^A todo: optimize to use \__fp_mul_mantissa. + {0000} {#2#3#4#5} {#6} #7 ; + {0000} {#2#3#4#5} {#6} #7 ; + \__fp_fixed_add_one:wN + \__fp_fixed_mul:wwn {10000} {#2#3#4#5} {#6} #7 ; + } +%% File: l3fp-expo.dtx Copyright (C) 2011-2012 The 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 +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% 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. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +\tl_const:Nn \c__fp_ln_i_fixed_tl { {0000}{0000}{0000}{0000}{0000}{0000} } +\tl_const:Nn \c__fp_ln_ii_fixed_tl { {6931}{4718}{0559}{9453}{0941}{7232} } +\tl_const:Nn \c__fp_ln_iii_fixed_tl {{10986}{1228}{8668}{1096}{9139}{5245} } +\tl_const:Nn \c__fp_ln_iv_fixed_tl {{13862}{9436}{1119}{8906}{1883}{4464} } + % \tl_const:Nn \c__fp_ln_v_fixed_tl {{16094}{3791}{2434}{1003}{7460}{0759} } +\tl_const:Nn \c__fp_ln_vi_fixed_tl {{17917}{5946}{9228}{0550}{0081}{2477} } +\tl_const:Nn \c__fp_ln_vii_fixed_tl {{19459}{1014}{9055}{3133}{0510}{5353} } +\tl_const:Nn \c__fp_ln_viii_fixed_tl{{20794}{4154}{1679}{8359}{2825}{1696} } +\tl_const:Nn \c__fp_ln_ix_fixed_tl {{21972}{2457}{7336}{2193}{8279}{0490} } +\tl_const:Nn \c__fp_ln_x_fixed_tl {{23025}{8509}{2994}{0456}{8401}{7991} } + %\tl_const:Nn \c__fp_ln_ten_fixed_tl {{23025}{8509}{2994}{0456}{8401}{7991} } +\cs_new:Npn \__fp_ln:w \s__fp \__fp_chk:w #1 #2 + { + \if_meaning:w 0 #1 + \__fp_case_use:nw + { \__fp_division_by_zero:Nnw \c_minus_inf_fp { ln } } + \fi: + \if_meaning:w 2 #2 + \__fp_case_use:nw + { \__fp_invalid_operation:Nnw \c_nan_fp { ln } } + \fi: + \if_meaning:w 1 #1 \else: + \__fp_case_return_same_o:w + \fi: + \__fp_ln_npos:w \s__fp \__fp_chk:w #1#2 + } +\cs_new:Npn \__fp_ln_npos:w \s__fp \__fp_chk:w 10#1#2#3; + { %^^A todo: ln(1) should be "exact zero", not "underflow" + \exp_after:wN \__fp_sanitize:Nw + \__int_value:w % for the overall sign + \if_int_compare:w #1 < \c_one + 2 \else: - \l_fp_exp_integer_int \c_zero - \if_int_compare:w \l_fp_exp_extended_int = \c_zero - \l_fp_exp_decimal_int - \int_eval:w - \c_one_thousand_million - \l_fp_input_a_decimal_int - \int_eval_end: - \l_fp_exp_extended_int \c_zero + 0 + \fi: + \exp_after:wN \exp_stop_f: + \int_use:N \__int_eval:w % for the exponent + \__fp_ln_significand:NNNNnnnN #2#3 + \__fp_ln_exponent:wn {#1} + } +\cs_new:Npn \__fp_ln_significand:NNNNnnnN #1#2#3#4 + { + \exp_after:wN \__fp_ln_x_ii:wnnnn + \__int_value:w + \if_case:w #1 \exp_stop_f: + \or: + \if_int_compare:w #2 < \c_four + \__int_eval:w \c_ten - #2 \else: - \l_fp_exp_decimal_int - \int_eval:w - 999999999 - \l_fp_input_a_decimal_int - \scan_stop: - \l_fp_exp_extended_int - \int_eval:w - \c_one_thousand_million - \l_fp_input_a_extended_int - \int_eval_end: + 6 \fi: + \or: 4 + \or: 3 + \or: 2 + \or: 2 + \or: 2 + \else: 1 \fi: - \l_fp_input_b_sign_int \l_fp_input_a_sign_int - \l_fp_input_b_decimal_int \l_fp_input_a_decimal_int - \l_fp_input_b_extended_int \l_fp_input_a_extended_int - \l_fp_count_int \c_one - \fp_exp_Taylor: - \fp_mul:NNNNNNNNN - \l_fp_exp_integer_int \l_fp_exp_decimal_int \l_fp_exp_extended_int - \l_fp_output_integer_int \l_fp_output_decimal_int - \l_fp_output_extended_int - \l_fp_output_integer_int \l_fp_output_decimal_int - \l_fp_output_extended_int - \fi: - \if_int_compare:w \l_fp_output_extended_int < \c_five_hundred_million - \else: - \tex_advance:D \l_fp_output_decimal_int \c_one - \if_int_compare:w \l_fp_output_decimal_int < \c_one_thousand_million - \else: - \l_fp_output_decimal_int \c_zero - \tex_advance:D \l_fp_output_integer_int \c_one - \fi: - \fi: - \fp_standardise:NNNN - \l_fp_output_sign_int - \l_fp_output_integer_int - \l_fp_output_decimal_int - \l_fp_output_exponent_int - \fp_exp_const:cx { c_fp_exp ( \l_fp_arg_tl ) _fp } + ; { #1 #2 #3 #4 } + } +\cs_new:Npn \__fp_ln_x_ii:wnnnn #1; #2#3#4#5 + { + \exp_after:wN \__fp_ln_div_after:Nw + \cs:w c__fp_ln_ \tex_romannumeral:D #1 _fixed_tl \exp_after:wN \cs_end: + \__int_value:w + \exp_after:wN \__fp_ln_x_iv:nnnnnnnn + \tex_romannumeral:D -`0 + \exp_after:wN \__fp_ln_x_iii_var:NNNNNw + \int_use:N \__int_eval:w 9999 9999 + #1*#2#3 + + \exp_after:wN \__fp_ln_x_iii:NNNNNw + \int_use:N \__int_eval:w 1 0000 0000 + #1*#4#5 ; + {20000} {0000} {0000} {0000} + } %^^A todo: reoptimize (a generalization attempt failed). +\cs_new:Npn \__fp_ln_x_iii:NNNNNw #1 #2#3#4#5 #6; { #1; {#2#3#4#5} {#6} } +\cs_new:Npn \__fp_ln_x_iii_var:NNNNNw #1 #2#3#4#5 #6; { {#1#2#3#4#5} {#6} } +\cs_new:Npn \__fp_ln_x_iv:nnnnnnnn #1#2#3#4 #5#6#7#8 + { + \exp_after:wN \__fp_ln_div_i:w + \int_use:N \__int_eval:w #1 + \c_one ; + #5 #6 ; {#7} {#8} + {#1} {#2} {#3} {#4} + } +\cs_new:Npn \__fp_ln_div_i:w #1; + { + \exp_after:wN \__fp_ln_div_ii:www + \__int_value:w #1 \exp_after:wN ; + \__int_value:w + \exp_after:wN \__fp_div_mantissa_calc:Nwwnnnnnn + \int_use:N \__int_eval:w 999999 + 2 0000 0000 / #1 ; % Q1 + } +\cs_set_protected:Npn \__fp_tmp:w #1#2 + { + \cs_new:Npn #1 ##1; ##2; ##3; % y; Q1; B1B2; <- for k=1 { - + - \int_use:N \l_fp_output_integer_int - . - \exp_after:wN \use_none:n - \int_value:w \int_eval:w - \l_fp_output_decimal_int + \c_one_thousand_million - e - \int_use:N \l_fp_output_exponent_int + \exp_after:wN \__fp_div_mantissa_pack:NNN + \int_use:N \__int_eval:w ##2 + \exp_after:wN #2 + \__int_value:w ##1 \exp_after:wN ; + \__int_value:w + \exp_after:wN \__fp_div_mantissa_calc:Nwwnnnnnn + \int_use:N \__int_eval:w 999999 + ##3 / ##1 ; % Q2 + ##3 ; } } -\cs_new_protected_nopar:Npn \fp_exp_Taylor: - { - \tex_advance:D \l_fp_count_int \c_one - \tex_multiply:D \l_fp_input_b_sign_int \l_fp_input_a_sign_int - \fp_mul:NNNNNN - \l_fp_input_a_decimal_int \l_fp_input_a_extended_int - \l_fp_input_b_decimal_int \l_fp_input_b_extended_int - \l_fp_input_b_decimal_int \l_fp_input_b_extended_int - \fp_div_integer:NNNNN - \l_fp_input_b_decimal_int \l_fp_input_b_extended_int - \l_fp_count_int - \l_fp_input_b_decimal_int \l_fp_input_b_extended_int - \if_int_compare:w - \int_eval:w - \l_fp_input_b_decimal_int + \l_fp_input_b_extended_int - > \c_zero - \if_int_compare:w \l_fp_input_b_sign_int > \c_zero - \tex_advance:D \l_fp_exp_decimal_int \l_fp_input_b_decimal_int - \tex_advance:D \l_fp_exp_extended_int - \l_fp_input_b_extended_int - \if_int_compare:w \l_fp_exp_extended_int < \c_one_thousand_million +\__fp_tmp:w \__fp_ln_div_ii:www \__fp_ln_div_iii:www +\__fp_tmp:w \__fp_ln_div_iii:www \__fp_ln_div_iv:www +\__fp_tmp:w \__fp_ln_div_iv:www \__fp_ln_div_v:www +\__fp_tmp:w \__fp_ln_div_v:www \__fp_ln_div_vi:www +\cs_new:Npn \__fp_ln_div_vi:www #1; #2; #3;#4#5 #6#7#8#9 %y;Q5;F1F2;F3F4x1x2x3x4 + { + \exp_after:wN \__fp_div_mantissa_pack:NNN + \int_use:N \__int_eval:w #2 + \exp_after:wN \__fp_div_mantissa_pack:NNN + \int_use:N \__int_eval:w 1000000 + #3 / #1 ; % Q6 + } +\cs_new:Npn \__fp_ln_div_after:Nw #1#2; + { + \if_meaning:w 0 #2 + \exp_after:wN \__fp_ln_t_small:Nw + \else: + \exp_after:wN \__fp_ln_t_large:NNw + \exp_after:wN - + \fi: + #1 + } +\cs_new:Npn \__fp_ln_t_small:Nw #1 #2; #3; #4; #5; #6; #7; + { + \exp_after:wN \__fp_ln_t_large:NNw + \exp_after:wN + % <sign> + \exp_after:wN #1 + \int_use:N \__int_eval:w 9999 - #2 \exp_after:wN ; + \int_use:N \__int_eval:w 9999 - #3 \exp_after:wN ; + \int_use:N \__int_eval:w 9999 - #4 \exp_after:wN ; + \int_use:N \__int_eval:w 9999 - #5 \exp_after:wN ; + \int_use:N \__int_eval:w 9999 - #6 \exp_after:wN ; + \int_use:N \__int_eval:w 1 0000 - #7 ; + } +\cs_new:Npn \__fp_ln_t_large:NNw #1 #2 #3; #4; #5; #6; #7; #8; + { + \exp_after:wN \__fp_ln_square_t_after:w + \int_use:N \__int_eval:w 9999 0000 + #3*#3 + \exp_after:wN \__fp_ln_square_t_pack:NNNNNw + \int_use:N \__int_eval:w 9999 0000 + 2*#3*#4 + \exp_after:wN \__fp_ln_square_t_pack:NNNNNw + \int_use:N \__int_eval:w 9999 0000 + 2*#3*#5 + #4*#4 + \exp_after:wN \__fp_ln_square_t_pack:NNNNNw + \int_use:N \__int_eval:w 9999 0000 + 2*#3*#6 + 2*#4*#5 + \exp_after:wN \__fp_ln_square_t_pack:NNNNNw + \int_use:N \__int_eval:w 1 0000 0000 + 2*#3*#7 + 2*#4*#6 + #5*#5 + + (2*#3*#8 + 2*#4*#7 + 2*#5*#6) / 1 0000 + % ; ; ; + \exp_after:wN \__fp_ln_twice_t_after:w + \int_use:N \__int_eval:w -1 + 2*#3 + \exp_after:wN \__fp_ln_twice_t_pack:Nw + \int_use:N \__int_eval:w 9999 + 2*#4 + \exp_after:wN \__fp_ln_twice_t_pack:Nw + \int_use:N \__int_eval:w 9999 + 2*#5 + \exp_after:wN \__fp_ln_twice_t_pack:Nw + \int_use:N \__int_eval:w 9999 + 2*#6 + \exp_after:wN \__fp_ln_twice_t_pack:Nw + \int_use:N \__int_eval:w 9999 + 2*#7 + \exp_after:wN \__fp_ln_twice_t_pack:Nw + \int_use:N \__int_eval:w 10000 + 2*#8 ; ; + { \__fp_ln_c:NwNw #1 } + #2 + } +\cs_new:Npn \__fp_ln_twice_t_pack:Nw #1 #2; { + #1 ; {#2} } +\cs_new:Npn \__fp_ln_twice_t_after:w #1; { ;;; {#1} } +\cs_new:Npn \__fp_ln_square_t_pack:NNNNNw #1 #2#3#4#5 #6; + { + #1#2#3#4#5 ; {#6} } +\cs_new:Npn \__fp_ln_square_t_after:w 1 0 #1#2#3 #4; + { \__fp_ln_Taylor:wwNw {0#1#2#3} {#4} } +\cs_new:Npn \__fp_ln_Taylor:wwNw + { \__fp_ln_Taylor_loop:www 21 ; {0000}{0000}{0000}{0000}{0000}{0000} ; } +\cs_new:Npn \__fp_ln_Taylor_loop:www #1; #2; #3; + { + \if_int_compare:w #1 = \c_one + \__fp_ln_Taylor_break:w + \fi: + \exp_after:wN \__fp_fixed_div_int:wwN \c__fp_one_fixed_tl ; #1; + \__fp_fixed_add:wwN #2; + \__fp_fixed_mul:wwn #3; + { + \exp_after:wN \__fp_ln_Taylor_loop:www + \int_use:N \__int_eval:w #1 - \c_two ; + } + #3; + } +\cs_new:Npn \__fp_ln_Taylor_break:w \fi: #1 \__fp_fixed_add:wwN #2#3; #4 ;; + { + \fi: + \exp_after:wN \__fp_fixed_mul:wwn + \exp_after:wN { \int_use:N \__int_eval:w 10000 + #2 } #3; + } +\cs_new:Npn \__fp_ln_c:NwNw #1 #2; #3 + { + \if_meaning:w + #1 + \exp_after:wN \exp_after:wN \exp_after:wN \__fp_fixed_sub:wwN + \else: + \exp_after:wN \exp_after:wN \exp_after:wN \__fp_fixed_add:wwN + \fi: + #3 ; #2 ; + } +\cs_new:Npn \__fp_ln_exponent:wn #1; #2 + { + \if_case:w #2 \exp_stop_f: + \c_zero \__fp_case_return:nw { \__fp_fixed_to_float:Nw 2 } + \or: + \exp_after:wN \__fp_ln_exponent_one:ww \__int_value:w + \else: + \if_int_compare:w #2 > \c_zero + \exp_after:wN \__fp_ln_exponent_small:NNww + \exp_after:wN 0 + \exp_after:wN \__fp_fixed_sub:wwN \__int_value:w \else: - \tex_advance:D \l_fp_exp_decimal_int \c_one - \tex_advance:D \l_fp_exp_extended_int - -\c_one_thousand_million - \fi: - \if_int_compare:w \l_fp_exp_decimal_int < \c_one_thousand_million - \else: - \tex_advance:D \l_fp_exp_integer_int \c_one - \tex_advance:D \l_fp_exp_decimal_int - -\c_one_thousand_million - \fi: + \exp_after:wN \__fp_ln_exponent_small:NNww + \exp_after:wN 2 + \exp_after:wN \__fp_fixed_add:wwN \__int_value:w - + \fi: + \fi: + #2; #1; + } +\cs_new:Npn \__fp_ln_exponent_one:ww 1; #1; + { + \c_zero + \exp_after:wN \__fp_fixed_sub:wwN \c__fp_ln_x_fixed_tl ; #1; + \__fp_fixed_to_float:wN 0 + } +\cs_new:Npn \__fp_ln_exponent_small:NNww #1#2#3; #4#5#6#7#8#9; + { + \c_four + \exp_after:wN \__fp_fixed_mul:wwn + \c__fp_ln_x_fixed_tl ; + {#3}{0000}{0000}{0000}{0000}{0000} ; + #2 + {0000}{#4}{#5}{#6}{#7}{#8}; + \__fp_fixed_to_float:wN #1 + } +\cs_new:Npn \__fp_exp:w \s__fp \__fp_chk:w #1#2 + { + \if_case:w #1 \exp_stop_f: + \__fp_case_return_o:Nw \c_one_fp + \or: + \exp_after:wN \__fp_exp_normal:w + \or: + \if_meaning:w 0 #2 + \exp_after:wN \__fp_case_return_o:Nw + \exp_after:wN \c_inf_fp \else: - \tex_advance:D \l_fp_exp_decimal_int -\l_fp_input_b_decimal_int - \tex_advance:D \l_fp_exp_extended_int - -\l_fp_input_a_extended_int - \if_int_compare:w \l_fp_exp_extended_int < \c_zero - \tex_advance:D \l_fp_exp_decimal_int \c_minus_one - \tex_advance:D \l_fp_exp_extended_int \c_one_thousand_million - \fi: - \if_int_compare:w \l_fp_exp_decimal_int < \c_zero - \tex_advance:D \l_fp_exp_integer_int \c_minus_one - \tex_advance:D \l_fp_exp_decimal_int \c_one_thousand_million - \fi: + \exp_after:wN \__fp_case_return_o:Nw + \exp_after:wN \c_zero_fp \fi: - \exp_after:wN \fp_exp_Taylor: - \fi: - } -\cs_new_protected:Npn \fp_exp_const:Nx #1#2 - { - \tl_new:N #1 - \tl_gset:Nx #1 {#2} - } -\cs_generate_variant:Nn \fp_exp_const:Nx { c } -\tl_const:cn { c_fp_ln_10_1_tl } { { 2 } { 302585092 } { 994045684 } { 0 } } -\tl_const:cn { c_fp_ln_10_2_tl } { { 4 } { 605170185 } { 988091368 } { 0 } } -\tl_const:cn { c_fp_ln_10_3_tl } { { 6 } { 907755278 } { 982137052 } { 0 } } -\tl_const:cn { c_fp_ln_10_4_tl } { { 9 } { 210340371 } { 976182736 } { 0 } } -\tl_const:cn { c_fp_ln_10_5_tl } { { 1 } { 151292546 } { 497022842 } { 1 } } -\tl_const:cn { c_fp_ln_10_6_tl } { { 1 } { 381551055 } { 796427410 } { 1 } } -\tl_const:cn { c_fp_ln_10_7_tl } { { 1 } { 611809565 } { 095831979 } { 1 } } -\tl_const:cn { c_fp_ln_10_8_tl } { { 1 } { 842068074 } { 395226547 } { 1 } } -\tl_const:cn { c_fp_ln_10_9_tl } { { 2 } { 072326583 } { 694641116 } { 1 } } -\tl_const:cn { c_fp_ln_2_1_tl } { { 0 } { 693147180 } { 559945309 } { 0 } } -\tl_const:cn { c_fp_ln_2_2_tl } { { 1 } { 386294361 } { 119890618 } { 0 } } -\tl_const:cn { c_fp_ln_2_3_tl } { { 2 } { 079441541 } { 679835928 } { 0 } } -\cs_new_protected_nopar:Npn \fp_ln:Nn { \fp_ln_aux:NNn \tl_set:Nn } -\cs_new_protected_nopar:Npn \fp_gln:Nn { \fp_ln_aux:NNn \tl_gset:Nn } -\cs_generate_variant:Nn \fp_ln:Nn { c } -\cs_generate_variant:Nn \fp_gln:Nn { c } -\cs_new_protected:Npn \fp_ln_aux:NNn #1#2#3 - { - \group_begin: - \fp_split:Nn a {#3} - \fp_standardise:NNNN - \l_fp_input_a_sign_int - \l_fp_input_a_integer_int - \l_fp_input_a_decimal_int - \l_fp_input_a_exponent_int - \if_int_compare:w \l_fp_input_a_sign_int > \c_zero - \if_int_compare:w - \int_eval:w - \l_fp_input_a_integer_int + \l_fp_input_a_decimal_int - > \c_zero - \exp_after:wN \exp_after:wN \exp_after:wN \fp_ln_aux: - \else: - \cs_set_protected:Npx \fp_tmp:w ##1##2 - { - \group_end: - ##1 \exp_not:N ##2 { \c_zero_fp } - } - \exp_after:wN \exp_after:wN \exp_after:wN \fp_ln_error_msg: - \fi: + \or: + \__fp_case_return_same_o:w + \fi: + \s__fp \__fp_chk:w #1#2 + } +\cs_new:Npn \__fp_exp_normal:w \s__fp \__fp_chk:w 1#1 + { + \if_meaning:w 0 #1 + \__fp_exp_pos:NNwnw + \__fp_fixed_to_float:wN + \else: + \__fp_exp_pos:NNwnw - \__fp_fixed_inv_to_float:wN + \fi: + } +\cs_new:Npn \__fp_exp_pos:NNwnw #1#2#3 \fi: #4#5; + { + \fi: + \exp_after:wN \__fp_sanitize:Nw + \exp_after:wN 0 + \__int_value:w #1 \__int_eval:w + \if_int_compare:w #4 < - \c_eight + \c_one + \exp_after:wN \__fp_add_big_i:wNww + \int_use:N \__int_eval:w \c_one - #4 ; + 0 {1000}{0000}{0000}{0000} ; #5; + \tex_romannumeral:D \else: - \cs_set_protected:Npx \fp_tmp:w ##1##2 + \if_int_compare:w #4 > \c_five % cf \c__fp_max_exponent_int + \exp_after:wN \__fp_exp_overflow: + \tex_romannumeral:D + \else: + \if_int_compare:w #4 < \c_zero + \exp_after:wN \use_i:nn + \else: + \exp_after:wN \use_ii:nn + \fi: + { + \c_zero + \__fp_decimate:nNnnnn { - #4 } + \__fp_exp_Taylor:Nnnwn + } { - \group_end: - ##1 \exp_not:N ##2 { \c_zero_fp } + \__fp_decimate:nNnnnn { \c_sixteen - #4 } + \__fp_exp_pos_large:NnnNwn } - \exp_after:wN \fp_ln_error_msg: + #5 + {#4} + #2 0 + \tex_romannumeral:D + \fi: \fi: - \fp_tmp:w #1 #2 + \exp_after:wN \c_zero } -\cs_new_protected_nopar:Npn \fp_ln_aux: +\cs_new:Npn \__fp_exp_overflow: + { + \c_two * \c__fp_max_exponent_int ; {1000} {0000} {0000} {0000} ; } +\cs_new:Npn \__fp_exp_Taylor:Nnnwn #1#2#3 #4; #5 { - \tl_set:Nx \l_fp_arg_tl - { - + - \int_use:N \l_fp_input_a_integer_int - . - \exp_after:wN \use_none:n - \int_value:w \int_eval:w - \l_fp_input_a_decimal_int + \c_one_thousand_million - e - \int_use:N \l_fp_input_a_exponent_int - } - \if_cs_exist:w c_fp_ln ( \l_fp_arg_tl ) _fp \cs_end: + \__fp_pack_twice_four:wNNNNNNNN + \__fp_pack_twice_four:wNNNNNNNN + \__fp_pack_twice_four:wNNNNNNNN + \__fp_exp_Taylor_ii:ww + ; #2#3#4 0000 0000 ; + } +\cs_new:Npn \__fp_exp_Taylor_ii:ww #1; #2; + { \__fp_exp_Taylor_loop:www 10 ; #1 ; #1 ; \s__stop } +\cs_new:Npn \__fp_exp_Taylor_loop:www #1; #2; #3; + { + \if_int_compare:w #1 = \c_one + \exp_after:wN \__fp_exp_Taylor_break:Nww + \fi: + \__fp_fixed_div_int:wwN #3 ; #1 ; + \__fp_fixed_add_one:wN + \__fp_fixed_mul:wwn #2 ; + { + \exp_after:wN \__fp_exp_Taylor_loop:www + \int_use:N \__int_eval:w #1 - 1 ; + #2 ; + } + } +\cs_new:Npn \__fp_exp_Taylor_break:Nww #1 #2; #3 \s__stop + { \__fp_fixed_add_one:wN #2 ; } +\cs_new:Npn \__fp_exp_pos_large:NnnNwn #1#2#3 #4#5; #6 + { + \exp_after:wN \exp_after:wN + \cs:w __fp_exp_large_\tex_romannumeral:D #6:wN \exp_after:wN \cs_end: + \exp_after:wN \c__fp_one_fixed_tl + \exp_after:wN ; + \__int_value:w #3 #4 \exp_stop_f: + #5 00000 ; + } +\cs_new:Npn \__fp_exp_large:w #1 \or: #2 \fi: + { \fi: \__fp_fixed_mul:wwn #1; } +\cs_new:Npn \__fp_exp_large_v:wN #1; #2 + { + \if_case:w #2 ~ \exp_after:wN \__fp_fixed_continue:wn \or: + + 4343 \__fp_exp_large:w {8806}{8182}{2566}{2921}{5872}{6150} \or: + + 8686 \__fp_exp_large:w {7756}{0047}{2598}{6861}{0458}{3204} \or: + + 13029 \__fp_exp_large:w {6830}{5723}{7791}{4884}{1932}{7351} \or: + + 17372 \__fp_exp_large:w {6015}{5609}{3095}{3052}{3494}{7574} \or: + + 21715 \__fp_exp_large:w {5297}{7951}{6443}{0315}{3251}{3576} \or: + + 26058 \__fp_exp_large:w {4665}{6719}{0099}{3379}{5527}{2929} \or: + + 30401 \__fp_exp_large:w {4108}{9724}{3326}{3186}{5271}{5665} \or: + + 34744 \__fp_exp_large:w {3618}{6973}{3140}{0875}{3856}{4102} \or: + + 39087 \__fp_exp_large:w {3186}{9209}{6113}{3900}{6705}{9685} \or: + \fi: + #1; + \__fp_exp_large_iv:wN + } +\cs_new:Npn \__fp_exp_large_iv:wN #1; #2 + { + \if_case:w #2 ~ \exp_after:wN \__fp_fixed_continue:wn \or: + + 435 \__fp_exp_large:w {1970}{0711}{1401}{7046}{9938}{8888} \or: + + 869 \__fp_exp_large:w {3881}{1801}{9428}{4368}{5764}{8232} \or: + + 1303 \__fp_exp_large:w {7646}{2009}{8905}{4704}{8893}{1073} \or: + + 1738 \__fp_exp_large:w {1506}{3559}{7005}{0524}{9009}{7592} \or: + + 2172 \__fp_exp_large:w {2967}{6283}{8402}{3667}{0689}{6630} \or: + + 2606 \__fp_exp_large:w {5846}{4389}{5650}{2114}{7278}{5046} \or: + + 3041 \__fp_exp_large:w {1151}{7900}{5080}{6878}{2914}{4154} \or: + + 3475 \__fp_exp_large:w {2269}{1083}{0850}{6857}{8724}{4002} \or: + + 3909 \__fp_exp_large:w {4470}{3047}{3316}{5442}{6408}{6591} \or: + \fi: + #1; + \__fp_exp_large_iii:wN + } +\cs_new:Npn \__fp_exp_large_iii:wN #1; #2 + { + \if_case:w #2 ~ \exp_after:wN \__fp_fixed_continue:wn \or: + + 44 \__fp_exp_large:w {2688}{1171}{4181}{6135}{4484}{1263} \or: + + 87 \__fp_exp_large:w {7225}{9737}{6812}{5749}{2581}{7748} \or: + + 131 \__fp_exp_large:w {1942}{4263}{9524}{1255}{9365}{8421} \or: + + 174 \__fp_exp_large:w {5221}{4696}{8976}{4143}{9505}{8876} \or: + + 218 \__fp_exp_large:w {1403}{5922}{1785}{2837}{4107}{3977} \or: + + 261 \__fp_exp_large:w {3773}{0203}{0092}{9939}{8234}{0143} \or: + + 305 \__fp_exp_large:w {1014}{2320}{5473}{5004}{5094}{5533} \or: + + 348 \__fp_exp_large:w {2726}{3745}{7211}{2566}{5673}{6478} \or: + + 391 \__fp_exp_large:w {7328}{8142}{2230}{7421}{7051}{8866} \or: + \fi: + #1; + \__fp_exp_large_ii:wN + } +\cs_new:Npn \__fp_exp_large_ii:wN #1; #2 + { + \if_case:w #2 ~ \exp_after:wN \__fp_fixed_continue:wn \or: + + 5 \__fp_exp_large:w {2202}{6465}{7948}{0671}{6516}{9579} \or: + + 9 \__fp_exp_large:w {4851}{6519}{5409}{7902}{7796}{9107} \or: + + 14 \__fp_exp_large:w {1068}{6474}{5815}{2446}{2146}{9905} \or: + + 18 \__fp_exp_large:w {2353}{8526}{6837}{0199}{8540}{7900} \or: + + 22 \__fp_exp_large:w {5184}{7055}{2858}{7072}{4640}{8745} \or: + + 27 \__fp_exp_large:w {1142}{0073}{8981}{5684}{2836}{6296} \or: + + 31 \__fp_exp_large:w {2515}{4386}{7091}{9167}{0062}{6578} \or: + + 35 \__fp_exp_large:w {5540}{6223}{8439}{3510}{0525}{7117} \or: + + 40 \__fp_exp_large:w {1220}{4032}{9431}{7840}{8020}{0271} \or: + \fi: + #1; + \__fp_exp_large_i:wN + } +\cs_new:Npn \__fp_exp_large_i:wN #1; #2 + { + \if_case:w #2 ~ \exp_after:wN \__fp_fixed_continue:wn \or: + + 1 \__fp_exp_large:w {2718}{2818}{2845}{9045}{2353}{6029} \or: + + 1 \__fp_exp_large:w {7389}{0560}{9893}{0650}{2272}{3043} \or: + + 2 \__fp_exp_large:w {2008}{5536}{9231}{8766}{7740}{9285} \or: + + 2 \__fp_exp_large:w {5459}{8150}{0331}{4423}{9078}{1103} \or: + + 3 \__fp_exp_large:w {1484}{1315}{9102}{5766}{0342}{1116} \or: + + 3 \__fp_exp_large:w {4034}{2879}{3492}{7351}{2260}{8387} \or: + + 4 \__fp_exp_large:w {1096}{6331}{5842}{8458}{5992}{6372} \or: + + 4 \__fp_exp_large:w {2980}{9579}{8704}{1728}{2747}{4359} \or: + + 4 \__fp_exp_large:w {8103}{0839}{2757}{5384}{0077}{1000} \or: + \fi: + #1; + \__fp_exp_large_:wN + } +\cs_new:Npn \__fp_exp_large_:wN #1; #2 + { + \if_case:w #2 ~ \exp_after:wN \__fp_fixed_continue:wn \or: + + 1 \__fp_exp_large:w {1105}{1709}{1807}{5647}{6248}{1171} \or: + + 1 \__fp_exp_large:w {1221}{4027}{5816}{0169}{8339}{2107} \or: + + 1 \__fp_exp_large:w {1349}{8588}{0757}{6003}{1039}{8374} \or: + + 1 \__fp_exp_large:w {1491}{8246}{9764}{1270}{3178}{2485} \or: + + 1 \__fp_exp_large:w {1648}{7212}{7070}{0128}{1468}{4865} \or: + + 1 \__fp_exp_large:w {1822}{1188}{0039}{0508}{9748}{7537} \or: + + 1 \__fp_exp_large:w {2013}{7527}{0747}{0476}{5216}{2455} \or: + + 1 \__fp_exp_large:w {2225}{5409}{2849}{2467}{6045}{7954} \or: + + 1 \__fp_exp_large:w {2459}{6031}{1115}{6949}{6638}{0013} \or: + \fi: + #1; + \__fp_exp_large_after:wwn + } +\cs_new:Npn \__fp_exp_large_after:wwn #1; #2; + { + \__fp_exp_Taylor:Nnnwn ? { } { } 0 #2; {} + \__fp_fixed_mul:wwn #1; + } +\cs_new:cpn { __fp_ \iow_char:N \^ _o:ww } + \s__fp \__fp_chk:w #1#2#3; \s__fp \__fp_chk:w #4#5#6; + { + \if_meaning:w 0 #4 + \__fp_case_return_o:Nw \c_one_fp + \fi: + \if_case:w #2 \exp_stop_f: + \exp_after:wN \use_i:nn + \or: + \__fp_case_return_o:Nw \c_nan_fp \else: - \exp_after:wN \fp_ln_exponent: + \exp_after:wN \__fp_pow_neg:www + \tex_romannumeral:D -`0 \exp_after:wN \use:nn \fi: - \cs_set_protected:Npx \fp_tmp:w ##1##2 - { - \group_end: - ##1 \exp_not:N ##2 - { \use:c { c_fp_ln ( \l_fp_arg_tl ) _fp } } - } + { + \if_meaning:w 1 #1 + \exp_after:wN \__fp_pow_normal:ww + \else: + \exp_after:wN \__fp_pow_zero_or_inf:ww + \fi: + \s__fp \__fp_chk:w #1#2#3; + } + { \s__fp \__fp_chk:w #4#5#6; \s__fp \__fp_chk:w #1#2#3; } + \s__fp \__fp_chk:w #4#5#6; } -\cs_new_protected_nopar:Npn \fp_ln_exponent: +\cs_new:Npn \__fp_pow_zero_or_inf:ww \s__fp \__fp_chk:w #1#2; \s__fp \__fp_chk:w #3#4 { - \fp_ln_internal: - \if_int_compare:w \l_fp_output_extended_int < \c_five_hundred_million + \if_meaning:w 1 #4 + \__fp_case_return_same_o:w + \fi: + \if_meaning:w #1 #4 + \__fp_case_return_o:Nw \c_zero_fp \else: - \tex_advance:D \l_fp_output_decimal_int \c_one - \if_int_compare:w \l_fp_output_decimal_int < \c_one_thousand_million + \__fp_case_return_o:Nw \c_inf_fp + \fi: + \s__fp \__fp_chk:w #3#4 + } +\cs_new:Npn \__fp_pow_normal:ww \s__fp \__fp_chk:w 1 #1#2#3; \s__fp \__fp_chk:w #4#5 + { + \if_int_compare:w \pdftex_strcmp:D { #2 #3 } + { 1 {1000} {0000} {0000} {0000} } = \c_zero + \if_int_compare:w #4 #1 = 32 \exp_stop_f: + \exp_after:wN \__fp_case_return_ii_o:ww + \fi: + \__fp_case_return_o:Nww \c_one_fp + \fi: + \if_case:w #4 ~ + \or: + \exp_after:wN \__fp_pow_npos:Nww + \exp_after:wN #5 + \or: + \if_meaning:w 2 #5 \exp_after:wN \reverse_if:N \fi: + \if_int_compare:w #2 > \c_zero + \exp_after:wN \__fp_case_return_o:Nww + \exp_after:wN \c_inf_fp \else: - \l_fp_output_decimal_int \c_zero - \tex_advance:D \l_fp_output_integer_int \c_one + \exp_after:wN \__fp_case_return_o:Nww + \exp_after:wN \c_zero_fp \fi: + \or: + \__fp_case_return_ii_o:ww \fi: - \fp_standardise:NNNN - \l_fp_output_sign_int - \l_fp_output_integer_int - \l_fp_output_decimal_int - \l_fp_output_exponent_int - \tl_const:cx { c_fp_ln ( \l_fp_arg_tl ) _fp } - { - \if_int_compare:w \l_fp_output_sign_int > \c_zero - + - \else: - - - \fi: - \int_use:N \l_fp_output_integer_int - . - \exp_after:wN \use_none:n - \int_value:w \int_eval:w - \l_fp_output_decimal_int + \c_one_thousand_million - \scan_stop: - e - \int_use:N \l_fp_output_exponent_int - } + \s__fp \__fp_chk:w 1 #1 {#2} #3 ; + \s__fp \__fp_chk:w #4 #5 } -\cs_new_protected_nopar:Npn \fp_ln_internal: +\cs_new:Npn \__fp_pow_npos:Nww #1 \s__fp \__fp_chk:w 1#2#3 { - \if_int_compare:w \l_fp_input_a_exponent_int < \c_zero - \l_fp_input_a_exponent_int -\l_fp_input_a_exponent_int - \l_fp_output_sign_int \c_minus_one + \exp_after:wN \__fp_sanitize:Nw + \exp_after:wN 0 + \__int_value:w + \if:w #1 \if_int_compare:w #3 > \c_zero 0 \else: 2 \fi: + \exp_after:wN \__fp_pow_npos_aux:Nnww + \exp_after:wN \__fp_fixed_to_float:wN + \else: + - + \exp_after:wN \__fp_pow_npos_aux:Nnww + \exp_after:wN \__fp_fixed_inv_to_float:wN + \fi: + {#3} + } +\cs_new:Npn \__fp_pow_npos_aux:Nnww #1#2#3#4; \s__fp \__fp_chk:w 1#5#6#7; + { + \__int_eval:w + \__fp_ln_significand:NNNNnnnN #3#4 + \__fp_pow_exponent:wnN {#2} + \__fp_fixed_mul:wwn #7 {0000}{0000} ; + \__fp_pow_B:wwN #6; + #1 0 % fixed_to_float:wN + } +\cs_new:Npn \__fp_pow_exponent:wnN #1; #2 + { + \if_int_compare:w #2 > \c_zero + \exp_after:wN \__fp_pow_exponent:Nwnnnnnn % n\log 10 - (-\log x) + \exp_after:wN + \else: - \l_fp_output_sign_int \c_one + \exp_after:wN \__fp_pow_exponent:Nwnnnnnn % -( |n|\log 10 + (-\log x) ) + \exp_after:wN - \fi: - \if_int_compare:w \l_fp_input_a_exponent_int > \c_nine - \exp_after:wN \fp_ln_exponent_tens:NN - \int_use:N \l_fp_input_a_exponent_int + #2; #1; + } +\cs_new:Npn \__fp_pow_exponent:Nwnnnnnn #1#2; #3#4#5#6#7#8; + { %^^A todo: use that in ln. %^^A todo: log(1.00...) too inaccurate? + \exp_after:wN \__fp_fixed_mul_after:wwn + \int_use:N \__int_eval:w -5 0000 + \exp_after:wN \__fp_fixed_mul_pack:NNNNNw + \int_use:N \__int_eval:w 4 9995 0000 #1#2*23025 - #1 #3 + \exp_after:wN \__fp_fixed_mul_pack:NNNNNw + \int_use:N \__int_eval:w 4 9995 0000 #1 #2*8509 - #1 #4 + \exp_after:wN \__fp_fixed_mul_pack:NNNNNw + \int_use:N \__int_eval:w 4 9995 0000 #1 #2*2994 - #1 #5 + \exp_after:wN \__fp_fixed_mul_pack:NNNNNw + \int_use:N \__int_eval:w 4 9995 0000 #1 #2*0456 - #1 #6 + \exp_after:wN \__fp_fixed_mul_pack:NNNNNw + \int_use:N \__int_eval:w 5 0000 0000 #1 #2*8401 - #1 #7 + #1 ( #2*7991 - #8 ) / 1 0000 ; ; + } +\cs_new:Npn \__fp_pow_B:wwN #1#2#3#4#5#6; #7; + { + \if_int_compare:w #7 < \c_zero + \exp_after:wN \__fp_pow_C_neg:w \__int_value:w - \else: - \l_fp_output_integer_int \c_zero - \l_fp_output_decimal_int \c_zero - \l_fp_output_extended_int \c_zero - \l_fp_output_exponent_int \c_zero + \if_int_compare:w #7 < 22 \exp_stop_f: + \exp_after:wN \__fp_pow_C_pos:w \__int_value:w + \else: + \exp_after:wN \__fp_pow_C_overflow:w \__int_value:w + \fi: \fi: - \fp_ln_exponent_units: + #7 \exp_after:wN ; + \int_use:N \__int_eval:w 10 0000 + #1 \__int_eval_end: + #2#3#4#5#6 0000 0000 0000 0000 0000 0000 ; %^^A todo: how many 0? } -\cs_new_protected:Npn \fp_ln_exponent_tens:NN #1 #2 +\cs_new:Npn \__fp_pow_C_overflow:w #1; #2; { - \l_fp_input_a_exponent_int #2 \scan_stop: - \fp_ln_const:nn { 10 } { #1 } - \tex_advance:D \l_fp_exp_exponent_int \c_one - \l_fp_output_integer_int \l_fp_exp_integer_int - \l_fp_output_decimal_int \l_fp_exp_decimal_int - \l_fp_output_extended_int \l_fp_exp_extended_int - \l_fp_output_exponent_int \l_fp_exp_exponent_int + + \c_two * \c__fp_max_exponent_int + \exp_after:wN \__fp_fixed_continue:wn \c__fp_one_fixed_tl ; } -\cs_new_protected_nopar:Npn \fp_ln_exponent_units: +\cs_new:Npn \__fp_pow_C_neg:w #1 ; 1 { - \if_int_compare:w \l_fp_input_a_exponent_int > \c_zero - \fp_ln_const:nn { 10 } { \int_use:N \l_fp_input_a_exponent_int } - \fp_ln_normalise: - \fp_add:NNNNNNNNN - \l_fp_exp_integer_int \l_fp_exp_decimal_int \l_fp_exp_extended_int - \l_fp_output_integer_int \l_fp_output_decimal_int - \l_fp_output_extended_int - \l_fp_output_integer_int \l_fp_output_decimal_int - \l_fp_output_extended_int - \fi: - \fp_ln_mantissa: + \exp_after:wN \exp_after:wN \exp_after:wN \__fp_pow_C_pack:w + \prg_replicate:nn {#1} {0} } -\cs_new_protected_nopar:Npn \fp_ln_normalise: +\cs_new:Npn \__fp_pow_C_pos:w #1; 1 + { \__fp_pow_C_pos_loop:wN #1; } +\cs_new:Npn \__fp_pow_C_pos_loop:wN #1; #2 { - \if_int_compare:w \l_fp_exp_exponent_int < \l_fp_output_exponent_int - \tex_advance:D \l_fp_exp_decimal_int \c_one_thousand_million - \exp_after:wN \use_i:nn \exp_after:wN - \fp_ln_normalise_aux:NNNNNNNNN - \int_use:N \l_fp_exp_decimal_int - \exp_after:wN \fp_ln_normalise: + \if_meaning:w 0 #1 + \exp_after:wN \__fp_pow_C_pack:w + \exp_after:wN #2 \else: - \l_fp_output_exponent_int \l_fp_exp_exponent_int + \if_meaning:w 0 #2 + \exp_after:wN \__fp_pow_C_pos_loop:wN \__int_value:w + \else: + \exp_after:wN \__fp_pow_C_overflow:w \__int_value:w + \fi: + \__int_eval:w #1 - \c_one \exp_after:wN ; \fi: } -\cs_new_protected:Npn \fp_ln_normalise_aux:NNNNNNNNN #1#2#3#4#5#6#7#8#9 +\cs_new:Npn \__fp_pow_C_pack:w + { \exp_after:wN \__fp_exp_large_v:wN \c__fp_one_fixed_tl ; } +\cs_new:Npn \__fp_pow_neg:www \s__fp \__fp_chk:w #1#2; #3; #4; { - \if_int_compare:w \l_fp_exp_integer_int = \c_zero - \l_fp_exp_decimal_int #1#2#3#4#5#6#7#8 \scan_stop: - \else: - \tl_set:Nx \l_fp_internal_tl - { - \int_use:N \l_fp_exp_integer_int - #1#2#3#4#5#6#7#8 - } - \l_fp_exp_integer_int \c_zero - \l_fp_exp_decimal_int \l_fp_internal_tl \scan_stop: + \if_case:w \__fp_pow_neg_case:w #4 ; + \exp_after:wN \__fp_pow_neg_neg:w + \or: + \if_int_compare:w \__int_eval:w #1 / \c_two = \c_one + \__fp_invalid_operation:Nnww \c_nan_fp { ^ } #3; #4; + \tex_romannumeral:D -`0 + \exp_after:wN \exp_after:wN + \exp_after:wN \__fp_use_none_until_s:w + \fi: \fi: - \tex_divide:D \l_fp_exp_extended_int \c_ten - \tl_set:Nx \l_fp_internal_tl - { - #9 - \int_use:N \l_fp_exp_extended_int - } - \l_fp_exp_extended_int \l_fp_internal_tl \scan_stop: - \tex_advance:D \l_fp_exp_exponent_int \c_one - } -\cs_new_protected_nopar:Npn \fp_ln_mantissa: - { - \l_fp_count_int \c_zero - \l_fp_input_a_extended_int \c_zero - \fp_ln_mantissa_aux: - \if_int_compare:w \l_fp_count_int > \c_zero - \fp_ln_const:nn { 2 } { \int_use:N \l_fp_count_int } - \fp_ln_normalise: - \if_int_compare:w \l_fp_output_sign_int > \c_zero - \exp_after:wN \fp_add:NNNNNNNNN + \__fp_exp_after_o:w + \s__fp \__fp_chk:w #1#2; + } +\cs_new:Npn \__fp_pow_neg_neg:w \__fp_exp_after_o:w \s__fp \__fp_chk:w #1#2 + { + \exp_after:wN \__fp_exp_after_o:w + \exp_after:wN \s__fp + \exp_after:wN \__fp_chk:w + \exp_after:wN #1 + \int_use:N \__int_eval:w \c_two - #2 \__int_eval_end: + } +\cs_new:Npn \__fp_pow_neg_case:w \s__fp \__fp_chk:w #1#2#3; + { + \if_case:w #1 \exp_stop_f: + \c_minus_one + \or: \__fp_pow_neg_case_aux:nnnnn #3 + \else: \c_one + \fi: + } +\cs_new:Npn \__fp_pow_neg_case_aux:nnnnn #1#2#3#4#5 + { + \if_int_compare:w #1 > \c_eight + \if_int_compare:w #1 > \c_sixteen + \c_minus_one \else: - \exp_after:wN \fp_sub:NNNNNNNNN + \exp_after:wN \exp_after:wN + \exp_after:wN \__fp_pow_neg_case_aux:NNNNNNNNw + \prg_replicate:nn { \c_sixteen - #1 } { 0 } #4#5 ; \fi: - \l_fp_output_integer_int \l_fp_output_decimal_int - \l_fp_output_extended_int - \l_fp_exp_integer_int \l_fp_exp_decimal_int \l_fp_exp_extended_int - \l_fp_output_integer_int \l_fp_output_decimal_int - \l_fp_output_extended_int - \fi: - \if_int_compare:w - \int_eval:w - \l_fp_input_a_integer_int + \l_fp_input_a_decimal_int > \c_one - \exp_after:wN \fp_ln_Taylor: - \fi: - } -\cs_new_protected_nopar:Npn \fp_ln_mantissa_aux: - { - \if_int_compare:w \l_fp_input_a_integer_int > \c_one - \tex_advance:D \l_fp_count_int \c_one - \fp_ln_mantissa_divide_two: - \exp_after:wN \fp_ln_mantissa_aux: - \fi: - } -\cs_new_protected_nopar:Npn \fp_ln_mantissa_divide_two: - { - \if_int_odd:w \l_fp_input_a_decimal_int - \tex_advance:D \l_fp_input_a_extended_int \c_one_thousand_million - \fi: - \if_int_odd:w \l_fp_input_a_integer_int - \tex_advance:D \l_fp_input_a_decimal_int \c_one_thousand_million - \fi: - \tex_divide:D \l_fp_input_a_integer_int \c_two - \tex_divide:D \l_fp_input_a_decimal_int \c_two - \tex_divide:D \l_fp_input_a_extended_int \c_two - } -\cs_new_protected:Npn \fp_ln_const:nn #1#2 - { - \exp_after:wN \exp_after:wN \exp_after:wN - \fp_exp_integer_const:nnnn - \cs:w c_fp_ln_ #1 _ #2 _tl \cs_end: - } -\cs_new_protected_nopar:Npn \fp_ln_Taylor: - { - \group_begin: - \l_fp_input_a_integer_int \c_zero - \l_fp_input_a_exponent_int \c_zero - \l_fp_input_b_integer_int \c_two - \l_fp_input_b_decimal_int \l_fp_input_a_decimal_int - \l_fp_input_b_exponent_int \c_zero - \fp_div_internal: - \fp_ln_fixed: - \l_fp_input_a_integer_int \l_fp_output_integer_int - \l_fp_input_a_decimal_int \l_fp_output_decimal_int - \l_fp_input_a_extended_int \c_zero - \l_fp_input_a_exponent_int \l_fp_output_exponent_int - \l_fp_output_decimal_int \c_zero %^^A Bug? - \l_fp_output_decimal_int \l_fp_input_a_decimal_int - \l_fp_output_extended_int \l_fp_input_a_extended_int - \fp_mul:NNNNNN - \l_fp_input_a_decimal_int \l_fp_input_a_extended_int - \l_fp_input_a_decimal_int \l_fp_input_a_extended_int - \l_fp_input_b_decimal_int \l_fp_input_b_extended_int - \l_fp_count_int \c_one - \fp_ln_Taylor_aux: - \cs_set_protected_nopar:Npx \fp_tmp:w - { - \group_end: - \l_fp_exp_integer_int \c_zero - \exp_not:N \l_fp_exp_decimal_int - \int_use:N \l_fp_output_decimal_int \scan_stop: - \exp_not:N \l_fp_exp_extended_int - \int_use:N \l_fp_output_extended_int \scan_stop: - \exp_not:N \l_fp_exp_exponent_int - \int_use:N \l_fp_output_exponent_int \scan_stop: - } - \fp_tmp:w - \tex_advance:D \l_fp_exp_decimal_int \l_fp_exp_decimal_int - \if_int_compare:w \l_fp_exp_extended_int < \c_five_hundred_million \else: - \tex_advance:D \l_fp_exp_extended_int -\c_five_hundred_million - \tex_advance:D \l_fp_exp_decimal_int \c_one + \if_int_compare:w #1 > \c_zero + \if_int_compare:w #4#5 = \c_zero + \exp_after:wN \exp_after:wN + \exp_after:wN \__fp_pow_neg_case_aux:NNNNNNNNw + \prg_replicate:nn { \c_eight - #1 } { 0 } #2#3 ; + \else: + \c_one + \fi: + \else: + \c_one + \fi: \fi: - \tex_advance:D \l_fp_exp_extended_int \l_fp_exp_extended_int - \fp_ln_normalise: - \if_int_compare:w \l_fp_output_sign_int > \c_zero - \exp_after:wN \fp_add:NNNNNNNNN + } +\cs_new:Npn \__fp_pow_neg_case_aux:NNNNNNNNw #1#2#3#4#5#6#7#8#9; + { + \if_int_compare:w 0 #9 = \c_zero + \if_int_odd:w #8 \exp_stop_f: + \c_zero + \else: + \c_minus_one + \fi: \else: - \exp_after:wN \fp_sub:NNNNNNNNN + \c_one \fi: - \l_fp_output_integer_int \l_fp_output_decimal_int - \l_fp_output_extended_int - \c_zero \l_fp_exp_decimal_int \l_fp_exp_extended_int - \l_fp_output_integer_int \l_fp_output_decimal_int - \l_fp_output_extended_int } -\cs_new_protected_nopar:Npn \fp_ln_fixed: +%% File: l3fp-trig.dtx Copyright (C) 2011-2012 The 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 +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% 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. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +\cs_new_nopar:Npx \__fp_one_over:w { - \if_int_compare:w \l_fp_output_exponent_int < \c_zero - \tex_advance:D \l_fp_output_decimal_int \c_one_thousand_million - \exp_after:wN \use_i:nn \exp_after:wN - \fp_ln_fixed_aux:NNNNNNNNN - \int_use:N \l_fp_output_decimal_int - \exp_after:wN \fp_ln_fixed: - \fi: + \exp_not:N \exp_after:wN + \exp_not:c { __fp_/_o:ww } + \exp_not:N \c_one_fp } -\cs_new_protected:Npn \fp_ln_fixed_aux:NNNNNNNNN #1#2#3#4#5#6#7#8#9 +\cs_new:Npn \__fp_sin:w \s__fp \__fp_chk:w #1#2 { - \if_int_compare:w \l_fp_output_integer_int = \c_zero - \l_fp_output_decimal_int #1#2#3#4#5#6#7#8 \scan_stop: - \else: - \tl_set:Nx \l_fp_internal_tl + \if_case:w #1 \exp_stop_f: + \__fp_case_return_same_o:w + \or: + \exp_after:wN \__fp_trig_exponent:NNNNwn + \exp_after:wN \__fp_sin_series:NNwww + \exp_after:wN ? + \exp_after:wN #2 + \exp_after:wN \c_zero + \or: + \__fp_case_use:nw + { \__fp_invalid_operation:Nnw \c_nan_fp { sin } } + \else: \__fp_case_return_same_o:w + \fi: + \s__fp \__fp_chk:w #1#2 + } +\cs_new:Npn \__fp_cos:w \s__fp \__fp_chk:w #1#2 + { + \if_case:w #1 \exp_stop_f: + \__fp_case_return_o:Nw \c_one_fp + \or: + \__fp_case_use:nw %^^A todo: is that faster than the exp_after route? { - \int_use:N \l_fp_output_integer_int - #1#2#3#4#5#6#7#8 + \__fp_trig_exponent:NNNNwn + \__fp_sin_series:NNwww + ? + 0 + \c_two } - \l_fp_output_integer_int \c_zero - \l_fp_output_decimal_int \l_fp_internal_tl \scan_stop: + \or: + \__fp_case_use:nw + { \__fp_invalid_operation:Nnw \c_nan_fp { cos } } + \else: \__fp_case_return_same_o:w \fi: - \tex_advance:D \l_fp_output_exponent_int \c_one + \s__fp \__fp_chk:w #1#2 } -\cs_new_protected_nopar:Npn \fp_ln_Taylor_aux: +\cs_new:Npn \__fp_tan:w \s__fp \__fp_chk:w #1#2 { - \tex_advance:D \l_fp_count_int \c_two - \fp_mul:NNNNNN - \l_fp_input_a_decimal_int \l_fp_input_a_extended_int - \l_fp_input_b_decimal_int \l_fp_input_b_extended_int - \l_fp_input_a_decimal_int \l_fp_input_a_extended_int - \if_int_compare:w - \int_eval:w - \l_fp_input_a_decimal_int + \l_fp_input_a_extended_int - > \c_zero - \fp_div_integer:NNNNN - \l_fp_input_a_decimal_int \l_fp_input_a_extended_int - \l_fp_count_int - \l_fp_exp_decimal_int \l_fp_exp_extended_int - \tex_advance:D \l_fp_output_decimal_int \l_fp_exp_decimal_int - \tex_advance:D \l_fp_output_extended_int \l_fp_exp_extended_int - \if_int_compare:w \l_fp_output_extended_int < \c_one_thousand_million - \else: - \tex_advance:D \l_fp_output_decimal_int \c_one - \tex_advance:D \l_fp_output_extended_int - -\c_one_thousand_million - \fi: - \if_int_compare:w \l_fp_output_decimal_int < \c_one_thousand_million - \else: - \tex_advance:D \l_fp_output_integer_int \c_one - \tex_advance:D \l_fp_output_decimal_int - -\c_one_thousand_million - \fi: - \exp_after:wN \fp_ln_Taylor_aux: + \if_case:w #1 \exp_stop_f: + \__fp_case_return_same_o:w + \or: + \exp_after:wN \__fp_trig_exponent:NNNNwn + \exp_after:wN \__fp_tan_series:NNwww + \exp_after:wN 0 + \exp_after:wN #2 + \exp_after:wN \c_one + \or: + \__fp_case_use:nw + { \__fp_invalid_operation:Nnw \c_nan_fp { tan } } + \else: \__fp_case_return_same_o:w \fi: + \s__fp \__fp_chk:w #1#2 } -\cs_new_protected_nopar:Npn \fp_pow:Nn { \fp_pow_aux:NNn \tl_set:Nn } -\cs_new_protected_nopar:Npn \fp_gpow:Nn { \fp_pow_aux:NNn \tl_gset:Nn } -\cs_generate_variant:Nn \fp_pow:Nn { c } -\cs_generate_variant:Nn \fp_gpow:Nn { c } -\cs_new_protected:Npn \fp_pow_aux:NNn #1#2#3 - { - \group_begin: - \fp_read:N #2 - \l_fp_input_b_sign_int \l_fp_input_a_sign_int - \l_fp_input_b_integer_int \l_fp_input_a_integer_int - \l_fp_input_b_decimal_int \l_fp_input_a_decimal_int - \l_fp_input_b_exponent_int \l_fp_input_a_exponent_int - \fp_split:Nn a {#3} - \fp_standardise:NNNN - \l_fp_input_a_sign_int - \l_fp_input_a_integer_int - \l_fp_input_a_decimal_int - \l_fp_input_a_exponent_int - \if_int_compare:w - \int_eval:w - \l_fp_input_b_integer_int + \l_fp_input_b_decimal_int - = \c_zero - \if_int_compare:w - \int_eval:w - \l_fp_input_a_integer_int + \l_fp_input_a_decimal_int - = \c_zero - \cs_set_protected:Npx \fp_tmp:w ##1##2 - { - \group_end: - ##1 ##2 { \c_undefined_fp } - } - \else: - \cs_set_protected:Npx \fp_tmp:w ##1##2 - { - \group_end: - ##1 ##2 { \c_zero_fp } - } - \fi: - \else: - \if_int_compare:w - \int_eval:w - \l_fp_input_a_integer_int + \l_fp_input_a_decimal_int - = \c_zero - \cs_set_protected:Npx \fp_tmp:w ##1##2 - { - \group_end: - ##1 ##2 { \c_one_fp } - } - \else: - \exp_after:wN \exp_after:wN \exp_after:wN - \fp_pow_aux_i: - \fi: - \fi: - \fp_tmp:w #1 #2 -} -\cs_new_protected_nopar:Npn \fp_pow_aux_i: - { - \if_int_compare:w \l_fp_input_b_sign_int > \c_zero - \tl_set:Nn \l_fp_sign_tl { + } - \exp_after:wN \fp_pow_aux_ii: - \else: - \l_fp_input_a_extended_int \c_zero - \if_int_compare:w \l_fp_input_a_exponent_int < \c_ten - \group_begin: - \fp_extended_normalise: - \if_int_compare:w - \int_eval:w - \l_fp_input_a_decimal_int + \l_fp_input_a_extended_int - = \c_zero - \group_end: - \tl_set:Nn \l_fp_sign_tl { - } - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_after:wN \fp_pow_aux_ii: +\cs_new:Npn \__fp_cot:w \s__fp \__fp_chk:w #1#2 + { + \if_case:w #1 \exp_stop_f: + \exp_after:wN \__fp_one_over:w + \or: + \exp_after:wN \__fp_trig_exponent:NNNNwn + \exp_after:wN \__fp_tan_series:NNwww + \exp_after:wN 2 + \exp_after:wN #2 + \exp_after:wN \c_three + \or: + \__fp_case_use:nw + { \__fp_invalid_operation:Nnw \c_nan_fp { cot } } + \else: \__fp_case_return_same_o:w + \fi: + \s__fp \__fp_chk:w #1#2 + } +\cs_new:Npn \__fp_trig_exponent:NNNNwn #1#2#3#4 \s__fp \__fp_chk:w 1#5#6 + { + \if_int_compare:w #6 > - \c_eight + \exp_after:wN #1 + \exp_after:wN #2 + \exp_after:wN #3 + \int_use:N \__int_eval:w #4 + \if_int_compare:w #6 > \c_zero + \exp_after:wN \__fp_trig_large:w \__int_value:w \else: - \group_end: - \cs_set_protected:Npx \fp_tmp:w ##1##2 - { - \group_end: - ##1 ##2 { \c_undefined_fp } - } + \exp_after:wN \__fp_trig_small:w \__int_value:w \fi: - \else: - \cs_set_protected:Npx \fp_tmp:w ##1##2 - { - \group_end: - ##1 ##2 { \c_undefined_fp } - } + \else: + \if_case:w #4 + \__fp_sin_epsilon:w + \or: \__fp_sin_epsilon:w + \or: \__fp_cos_epsilon:w + \else: \__fp_cot_epsilon:w \fi: + #5 \fi: + #6 ; } -\cs_new_protected_nopar:Npn \fp_pow_aux_ii: +\cs_new:Npn \__fp_sin_epsilon:w #1 \fi: #2 \fi: #3 ; + { \fi: \fi: \__fp_exp_after_o:w \s__fp \__fp_chk:w 1 #2 {#3} } +\cs_new:Npn \__fp_cos_epsilon:w #1 \fi: #2 \fi: #3 ; #4 ; + { \fi: \fi: \exp_after:wN \c_one_fp } +\cs_new:Npn \__fp_cot_epsilon:w \fi: #1 \fi: #2 ; + { \fi: \fi: \__fp_one_over:w \s__fp \__fp_chk:w 1 #1 {#2} } +\cs_new:Npn \__fp_trig_small:w #1; { - \if_int_compare:w \l_fp_input_a_sign_int > \c_zero - \exp_after:wN \fp_pow_aux_iv: - \else: - \if_int_compare:w \l_fp_input_a_exponent_int < \c_ten - \group_begin: - \l_fp_input_a_extended_int \c_zero - \fp_extended_normalise: - \if_int_compare:w \l_fp_input_a_decimal_int = \c_zero - \if_int_compare:w \l_fp_input_a_integer_int > \c_ten - \group_end: - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_after:wN \exp_after:wN \exp_after:wN - \fp_pow_aux_iv: - \else: - \group_end: - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_after:wN \fp_pow_aux_iii: - \fi: + \exp_after:wN \exp_after:wN \exp_after:wN \__fp_trig_small_aux:wwNN + \prg_replicate:nn { - #1 } { 0 } ; + } +\cs_new:Npn \__fp_trig_small_aux:wwNN #1; #2#3#4#5; + { + \__fp_pack_twice_four:wNNNNNNNN + \__fp_pack_twice_four:wNNNNNNNN + \__fp_pack_twice_four:wNNNNNNNN + . + ; + #1#2#3#4#5 0000 0000; + } +\cs_new:Npn \__fp_trig_large:w #1; #2#3; + { \__fp_trig_large_i:www #2; #3 ; #1; } +\cs_new:Npn \__fp_trig_large_i:www #1; #2; #3; + { + \if_meaning:w 0 #3 \__fp_trig_large_break:w \fi: + \exp_after:wN \__fp_trig_large_ii:wnnnnnn + \int_use:N \__int_eval:w ( #1 - 3141 ) / 6283 ; + {#1} #2; + \int_use:N \__int_eval:w \c_minus_one + #3; + } +\cs_new:Npn \__fp_trig_large_ii:wnnnnnn #1; #2#3#4#5; + { + \exp_after:wN \__fp_trig_large_i:www + \int_use:N \__int_eval:w -5 0000 + #20 - #1*62831 + \exp_after:wN \__fp_fixed_mul_pack:NNNNNw + \int_use:N \__int_eval:w 4 9995 0000 + #30 - #1*8530 + \exp_after:wN \__fp_fixed_mul_pack:NNNNNw + \int_use:N \__int_eval:w 4 9995 0000 + #40 - #1*7179 + \exp_after:wN \__fp_fixed_mul_pack:NNNNNw + \int_use:N \__int_eval:w 5 0000 0000 + #50 - #1*5880 + \exp_after:wN ; + \exp_after:wN ; + } +\cs_new:Npn \__fp_trig_large_break:w \fi: #1; #2; + { \fi: \__fp_trig_octant_loop:nw #2 {0000} {0000} ; } +\cs_new:Npn \__fp_trig_octant_loop:nw #1#2; + { + \if_int_compare:w #1 < 15707 \exp_stop_f: + \__fp_trig_octant_break:w + \fi: + + \c_two + \__fp_fixed_sub_back:wwN + {15707} {9632} {6794} {8970} {0000} {0000} ; + {#1} #2; + \__fp_trig_octant_loop:nw + } +\cs_new:Npn \__fp_trig_octant_break:w #1 \fi: + #2#3 #4; #5#6; #7; + { + \fi: + \if_int_compare:w #5 < 7854 \exp_stop_f: + \if_int_compare:w #5 < \c_zero + \exp_after:wN \__fp_trig_octant_neg:w + \fi: + \exp_after:wN \__fp_use_i_until_s:nw + \exp_after:wN . + \fi: + + \c_one + \__fp_fixed_sub:wwN + {15707} {9632} {6794} {8970} {0000} {0000} ; + {#5} #6 ; . ; + } +\cs_new:Npn \__fp_trig_octant_neg:w #1\fi: #2; #3#4#5#6#7#8; #9 + { + \fi: + + \c_seven + \exp_after:wN \__fp_fixed_add_after:NNNNNwN + \int_use:N \__int_eval:w 1 9999 9998 - #30000 - #4 + \exp_after:wN \__fp_fixed_add_pack:NNNNNwN + \int_use:N \__int_eval:w 1 9999 9998 - #5#6 + \exp_after:wN \__fp_fixed_add_pack:NNNNNwN + \int_use:N \__int_eval:w 2 0000 0000 - #7#8 ; {#9} ; + } +\cs_new:Npn \__fp_sin_series:NNwww #1#2#3 . #4; #5; + { + \__fp_fixed_mul:wwn #4; #4; + { + \exp_after:wN \__fp_sin_series_aux:Nnww + \__int_value:w + \if_int_odd:w \__int_eval:w ( #3 + \c_two ) / \c_four \__int_eval_end: + #2 \else: - \group_end: - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_after:wN \exp_after:wN \exp_after:wN - \exp_after:wN \fp_pow_aux_iv: + \if_meaning:w #2 0 2 \else: 0 \fi: \fi: - \else: - \exp_after:wN \exp_after:wN \exp_after:wN - \fp_pow_aux_iv: - \fi: + {#3} + } + #4 ; + } +\cs_new:Npn \__fp_sin_series_aux:Nnww #1#2 #3; #4; + { + \if_int_odd:w \__int_eval:w #2 / \c_two \__int_eval_end: + \exp_after:wN \use_i:nn + \else: + \exp_after:wN \use_ii:nn \fi: - \cs_set_protected:Npx \fp_tmp:w ##1##2 + { + \__fp_fixed_continue:wn {0000}{0000}{0000}{0001}{5619}{2070}; % 1/18! + \__fp_fixed_mul_sub_back:wwwn #3; {0000}{0000}{0000}{0477}{9477}{3324}; + \__fp_fixed_mul_sub_back:wwwn #3; {0000}{0000}{0011}{4707}{4559}{7730}; + \__fp_fixed_mul_sub_back:wwwn #3; {0000}{0000}{2087}{6756}{9878}{6810}; + \__fp_fixed_mul_sub_back:wwwn #3; {0000}{0027}{5573}{1922}{3985}{8907}; + \__fp_fixed_mul_sub_back:wwwn #3; {0000}{2480}{1587}{3015}{8730}{1587}; + \__fp_fixed_mul_sub_back:wwwn #3; {0013}{8888}{8888}{8888}{8888}{8889}; + \__fp_fixed_mul_sub_back:wwwn #3; {0416}{6666}{6666}{6666}{6666}{6667}; + \__fp_fixed_mul_sub_back:wwwn #3; {5000}{0000}{0000}{0000}{0000}{0000}; + \__fp_fixed_mul_sub_back:wwwn #3;{10000}{0000}{0000}{0000}{0000}{0000}; + } + { + \__fp_fixed_continue:wn {0000}{0000}{0000}{0028}{1145}{7254}; % 1/17! + \__fp_fixed_mul_sub_back:wwwn #3; {0000}{0000}{0000}{7647}{1637}{3182}; + \__fp_fixed_mul_sub_back:wwwn #3; {0000}{0000}{0160}{5904}{3836}{8216}; + \__fp_fixed_mul_sub_back:wwwn #3; {0000}{0002}{5052}{1083}{8544}{1719}; + \__fp_fixed_mul_sub_back:wwwn #3; {0000}{0275}{5731}{9223}{9858}{9065}; + \__fp_fixed_mul_sub_back:wwwn #3; {0001}{9841}{2698}{4126}{9841}{2698}; + \__fp_fixed_mul_sub_back:wwwn #3; {0083}{3333}{3333}{3333}{3333}{3333}; + \__fp_fixed_mul_sub_back:wwwn #3; {1666}{6666}{6666}{6666}{6666}{6667}; + \__fp_fixed_mul_sub_back:wwwn #3;{10000}{0000}{0000}{0000}{0000}{0000}; + \__fp_fixed_mul:wwn #4; + } + { + \exp_after:wN \__fp_sanitize:Nw + \exp_after:wN #1 + \int_use:N \__int_eval:w \__fp_fixed_to_float:wN + } + #1 + } +\cs_new:Npn \__fp_tan_series:NNwww #1#2#3. #4; #5; + { + \__fp_fixed_mul:wwn #4; #4; + { + \exp_after:wN \__fp_tan_series_aux:Nnww + \__int_value:w + \if_int_odd:w \__int_eval:w #3 / \c_two \__int_eval_end: + \exp_after:wN \reverse_if:N + \fi: + \if_meaning:w #1#2 2 \else: 0 \fi: + {#3} + } + #4 ; + } +\cs_new:Npn \__fp_tan_series_aux:Nnww #1 #2 #3; #4; + { + \__fp_fixed_continue:wn {0000}{0000}{1527}{3493}{0856}{7059}; + \__fp_fixed_mul_sub_back:wwwn #3; {0000}{0159}{6080}{0274}{5257}{6472}; + \__fp_fixed_mul_sub_back:wwwn #3; {0002}{4571}{2320}{0157}{2558}{8481}; + \__fp_fixed_mul_sub_back:wwwn #3; {0115}{5830}{7533}{5397}{3168}{2147}; + \__fp_fixed_mul_sub_back:wwwn #3; {1929}{8245}{6140}{3508}{7719}{2982}; + \__fp_fixed_mul_sub_back:wwwn #3;{10000}{0000}{0000}{0000}{0000}{0000}; + \__fp_fixed_mul:wwn #4; { - \group_end: - ##1 ##2 + \__fp_fixed_continue:wn {0000}{0007}{0258}{0681}{9408}{4706}; + \__fp_fixed_mul_sub_back:wwwn #3; {0000}{2343}{7175}{1399}{6151}{7670}; + \__fp_fixed_mul_sub_back:wwwn #3; {0019}{2638}{4588}{9232}{8861}{3691}; + \__fp_fixed_mul_sub_back:wwwn #3; {0536}{6357}{0691}{4344}{6852}{4252}; + \__fp_fixed_mul_sub_back:wwwn #3; {5263}{1578}{9473}{6842}{1052}{6315}; + \__fp_fixed_mul_sub_back:wwwn #3;{10000}{0000}{0000}{0000}{0000}{0000}; { - \l_fp_sign_tl - \int_use:N \l_fp_output_integer_int - . - \exp_after:wN \use_none:n - \int_value:w \int_eval:w - \l_fp_output_decimal_int + \c_one_thousand_million - e - \int_use:N \l_fp_output_exponent_int + \exp_after:wN \__fp_sanitize:Nw + \exp_after:wN #1 + \int_use:N \__int_eval:w + \reverse_if:N \if_int_odd:w + \__int_eval:w (#2 - \c_one) / \c_two \__int_eval_end: + \exp_after:wN \__fp_reverse_args:Nww + \fi: + \__fp_fixed_div_to_float:ww } } } -\cs_new_protected_nopar:Npn \fp_pow_aux_iii: - { - \l_fp_input_a_sign_int \c_one - \fp_pow_aux_iv: - \l_fp_input_a_integer_int \c_one - \l_fp_input_a_decimal_int \c_zero - \l_fp_input_a_exponent_int \c_zero - \l_fp_input_b_integer_int \l_fp_output_integer_int - \l_fp_input_b_decimal_int \l_fp_output_decimal_int - \l_fp_input_b_exponent_int \l_fp_output_exponent_int - \fp_div_internal: - } -\cs_new_protected_nopar:Npn \fp_pow_aux_iv: - { - \group_begin: - \l_fp_input_a_integer_int \l_fp_input_b_integer_int - \l_fp_input_a_decimal_int \l_fp_input_b_decimal_int - \l_fp_input_a_exponent_int \l_fp_input_b_exponent_int - \fp_ln_internal: - \cs_set_protected_nopar:Npx \fp_tmp:w +%% File: l3fp-convert.dtx Copyright(C) 2011-2012 The 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 +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% 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. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +\cs_new:Npn \__fp_trim_zeros:w #1 ; + { + \__fp_trim_zeros_loop:w #1 + ; \__fp_trim_zeros_loop:w 0; \__fp_trim_zeros_dot:w .; \s__stop + } +\cs_new:Npn \__fp_trim_zeros_loop:w #1 0; #2 { #2 #1 ; #2 } +\cs_new:Npn \__fp_trim_zeros_dot:w #1 .; { \__fp_trim_zeros_end:w #1 ; } +\cs_new:Npn \__fp_trim_zeros_end:w #1 ; #2 \s__stop { #1 } +\tl_const:Nx \c__fp_scientific_inf_tl + { 1e \int_use:N \c__fp_max_exponent_int } +\cs_new:Npn \fp_to_scientific:N #1 { \exp_after:wN \__fp_to_scientific:w #1 } +\cs_generate_variant:Nn \fp_to_scientific:N { c } +\cs_new:Npn \fp_to_scientific:n #1 + { + \exp_after:wN \__fp_to_scientific:w + \tex_romannumeral:D -`0 \__fp_parse:n {#1} + } +\cs_new:Npn \__fp_to_scientific:w \s__fp \__fp_chk:w #1#2#3 ; + { + \if_meaning:w 2 #2 \exp_after:wN - \tex_romannumeral:D -`0 \fi: + \if_case:w #1 \exp_stop_f: + \__fp_case_return:nw { \exp_after:wN 0 } + \or: \exp_after:wN \__fp_to_scientific_normal:wnnnnn + \or: + \__fp_case_use:nw { - \group_end: - \exp_not:N \l_fp_input_b_sign_int - \int_use:N \l_fp_output_sign_int \scan_stop: - \exp_not:N \l_fp_input_b_integer_int - \int_use:N \l_fp_output_integer_int \scan_stop: - \exp_not:N \l_fp_input_b_decimal_int - \int_use:N \l_fp_output_decimal_int \scan_stop: - \exp_not:N \l_fp_input_b_extended_int - \int_use:N \l_fp_output_extended_int \scan_stop: - \exp_not:N \l_fp_input_b_exponent_int - \int_use:N \l_fp_output_exponent_int \scan_stop: + \__fp_invalid_operation:Nnw + \c__fp_scientific_inf_tl { fp_to_scientific } } - \fp_tmp:w - \l_fp_input_a_extended_int \c_zero - \fp_mul:NNNNNNNNN - \l_fp_input_a_integer_int \l_fp_input_a_decimal_int - \l_fp_input_a_extended_int - \l_fp_input_b_integer_int \l_fp_input_b_decimal_int - \l_fp_input_b_extended_int - \l_fp_output_integer_int \l_fp_output_decimal_int - \l_fp_output_extended_int - \l_fp_output_exponent_int - \int_eval:w - \l_fp_input_a_exponent_int + \l_fp_input_b_exponent_int - \scan_stop: - \fp_extended_normalise_output: - \tex_multiply:D \l_fp_input_a_sign_int \l_fp_input_b_sign_int - \l_fp_input_a_integer_int \l_fp_output_integer_int - \l_fp_input_a_decimal_int \l_fp_output_decimal_int - \l_fp_input_a_extended_int \l_fp_output_extended_int - \l_fp_input_a_exponent_int \l_fp_output_exponent_int - \l_fp_output_integer_int \c_zero - \l_fp_output_decimal_int \c_zero - \l_fp_output_extended_int \c_zero - \l_fp_output_exponent_int \c_zero - \cs_set_eq:NN \fp_exp_const:Nx \use_none:nn - \fp_exp_internal: + \or: + \__fp_case_use:nw + { \__fp_invalid_operation:Nnw 0 { fp_to_scientific } } + \fi: + \s__fp \__fp_chk:w #1 #2 #3 ; \prg_do_nothing: } -\prg_new_conditional:Npnn \fp_if_undefined:N #1 { p , T , F , TF } +\cs_new:Npn \__fp_to_scientific_normal:wnnnnn + \s__fp \__fp_chk:w 1 #1 #2 #3#4#5#6 ; \prg_do_nothing: { - \if_meaning:w #1 \c_undefined_fp - \prg_return_true: + \if_int_compare:w #2 = \c_one + \exp_after:wN \__fp_to_scientific_normal:wNw \else: - \prg_return_false: + \exp_after:wN \__fp_to_scientific_normal:wNw + \exp_after:wN e + \int_use:N \__int_eval:w #2 - \c_one \fi: + ; #3 #4 #5 #6 ; } -\prg_new_conditional:Npnn \fp_if_zero:N #1 { p , T , F , TF } +\cs_new:Npn \__fp_to_scientific_normal:wNw #1 ; #2#3; + { \__fp_trim_zeros:w #2.#3 ; #1 } +\tl_const:Nn \c__fp_decimal_inf_tl { - \if_meaning:w #1 \c_zero_fp - \prg_return_true: - \else: - \prg_return_false: + \exp_after:wN \exp_after:wN \exp_after:wN 1 + \prg_replicate:nn \c__fp_max_exponent_int 0 + } +\cs_new:Npn \fp_to_decimal:N #1 { \exp_after:wN \__fp_to_decimal:w #1 } +\cs_generate_variant:Nn \fp_to_decimal:N { c } +\cs_new_nopar:Npn \fp_to_decimal:n + { + \exp_after:wN \__fp_to_decimal:w + \tex_romannumeral:D -`0 \__fp_parse:n + } +\cs_new:Npn \__fp_to_decimal:w \s__fp \__fp_chk:w #1#2#3 ; + { + \if_meaning:w 2 #2 \exp_after:wN - \tex_romannumeral:D -`0 \fi: + \if_case:w #1 \exp_stop_f: + \__fp_case_return:nw { \exp_after:wN 0 } + \or: \exp_after:wN \__fp_to_decimal_normal:wnnnnn + \or: + \__fp_case_use:nw + { + \__fp_invalid_operation:Nnw + \c__fp_decimal_inf_tl { fp_to_decimal } + } + \or: + \__fp_case_use:nw + { \__fp_invalid_operation:Nnw 0 { fp_to_decimal } } \fi: + \s__fp \__fp_chk:w #1 #2 #3 ; \prg_do_nothing: } -\prg_new_protected_conditional:Npnn \fp_compare:nNn #1#2#3 { T , F , TF } - { - \group_begin: - \fp_split:Nn a {#1} - \fp_standardise:NNNN - \l_fp_input_a_sign_int - \l_fp_input_a_integer_int - \l_fp_input_a_decimal_int - \l_fp_input_a_exponent_int - \fp_split:Nn b {#3} - \fp_standardise:NNNN - \l_fp_input_b_sign_int - \l_fp_input_b_integer_int - \l_fp_input_b_decimal_int - \l_fp_input_b_exponent_int - \fp_compare_aux:N #2 - } -\prg_new_protected_conditional:Npnn \fp_compare:NNN #1#2#3 { T , F , TF } - { - \group_begin: - \fp_read:N #3 - \l_fp_input_b_sign_int \l_fp_input_a_sign_int - \l_fp_input_b_integer_int \l_fp_input_a_integer_int - \l_fp_input_b_decimal_int \l_fp_input_a_decimal_int - \l_fp_input_b_exponent_int \l_fp_input_a_exponent_int - \fp_read:N #1 - \fp_compare_aux:N #2 - } -\cs_new_protected:Npn \fp_compare_aux:N #1 - { - \cs_if_exist:cTF { fp_compare_#1: } - { \use:c { fp_compare_#1: } } +\cs_new:Npn \__fp_to_decimal_normal:wnnnnn + \s__fp \__fp_chk:w 1 #1 #2 #3#4#5#6 ; \prg_do_nothing: + { + \int_compare:nNnTF {#2} > \c_zero { - \group_end: - \prg_return_false: + \int_compare:nNnTF {#2} < \c_sixteen + { + \__fp_decimate:nNnnnn { \c_sixteen - #2 } + \__fp_to_decimal_large:Nnnw + } + { + \exp_after:wN \exp_after:wN + \exp_after:wN \__fp_to_decimal_huge:wnnnn + \prg_replicate:nn { #2 - \c_sixteen } { 0 } ; + } + {#3} {#4} {#5} {#6} + } + { + \exp_after:wN \__fp_trim_zeros:w + \exp_after:wN 0 + \exp_after:wN . + \tex_romannumeral:D -`0 \prg_replicate:nn { - #2 } { 0 } + #3#4#5#6 ; } } -\cs_new_protected_nopar:cpn { fp_compare_=: } +\cs_new:Npn \__fp_to_decimal_large:Nnnw #1#2#3#4; { - \if_int_compare:w \l_fp_input_a_sign_int = \l_fp_input_b_sign_int - \if_int_compare:w \l_fp_input_a_integer_int = \l_fp_input_b_integer_int - \if_int_compare:w \l_fp_input_a_decimal_int = \l_fp_input_b_decimal_int - \if_int_compare:w - \l_fp_input_a_exponent_int = \l_fp_input_b_exponent_int - \group_end: - \prg_return_true: - \else: - \group_end: - \prg_return_false: - \fi: - \else: - \group_end: - \prg_return_false: - \fi: - \else: - \group_end: - \prg_return_false: + \exp_after:wN \__fp_trim_zeros:w \__int_value:w + \if_int_compare:w #2 > \c_zero + #2 \fi: - \else: - \group_end: - \prg_return_false: - \fi: + \exp_stop_f: + #3.#4 ; } -\cs_new_protected_nopar:cpn { fp_compare_>: } +\cs_new:Npn \__fp_to_decimal_huge:wnnnn #1; #2#3#4#5 { #2#3#4#5 #1 } +\cs_new:Npn \fp_to_tl:N #1 { \exp_after:wN \__fp_to_tl:w #1 } +\cs_generate_variant:Nn \fp_to_tl:N { c } +\cs_new_nopar:Npn \fp_to_tl:n { - \if_int_compare:w \int_eval:w - \l_fp_input_a_integer_int + \l_fp_input_a_decimal_int - = \c_zero - \if_int_compare:w \int_eval:w - \l_fp_input_b_integer_int + \l_fp_input_b_decimal_int - = \c_zero - \group_end: - \prg_return_false: - \else: - \if_int_compare:w \l_fp_input_b_sign_int > \c_zero - \group_end: - \prg_return_false: - \else: - \group_end: - \prg_return_true: - \fi: - \fi: - \else: - \if_int_compare:w \int_eval:w - \l_fp_input_b_integer_int + \l_fp_input_b_decimal_int - = \c_zero - \if_int_compare:w \l_fp_input_a_sign_int > \c_zero - \group_end: - \prg_return_true: - \else: - \group_end: - \prg_return_false: - \fi: - \else: - \use:c { fp_compare_>_aux: } - \fi: - \fi: + \exp_after:wN \__fp_to_tl:w + \tex_romannumeral:D -`0 \__fp_parse:n } -\cs_new_protected_nopar:cpn { fp_compare_>_aux: } +\cs_new:Npn \__fp_to_tl:w \s__fp \__fp_chk:w #1#2 { - \if_int_compare:w \l_fp_input_a_sign_int > \l_fp_input_b_sign_int - \group_end: - \prg_return_true: - \else: - \if_int_compare:w \l_fp_input_a_sign_int < \l_fp_input_b_sign_int - \group_end: - \prg_return_false: - \else: - \if_int_compare:w \l_fp_input_a_sign_int > \c_zero - \use:c { fp_compare_absolute_a>b: } - \else: - \use:c { fp_compare_absolute_a<b: } - \fi: - \fi: + \if_meaning:w 2 #2 \exp_after:wN - \tex_romannumeral:D -`0 \fi: + \if_case:w #1 \exp_stop_f: + \__fp_case_return:nw { 0 } + \or: \exp_after:wN \__fp_to_tl_normal:nnnnn + \or: \__fp_case_return:nw { inf } + \else: \__fp_case_return:nw { nan } \fi: } -\cs_new_protected_nopar:cpn { fp_compare_absolute_a>b: } +\cs_new:Npn \__fp_to_tl_normal:nnnnn #1#2 ; { - \if_int_compare:w \l_fp_input_a_exponent_int > \l_fp_input_b_exponent_int - \group_end: - \prg_return_true: + \if_int_compare:w #1 > \c_sixteen + \exp_after:wN \__fp_to_scientific_normal:wnnnnn \else: - \if_int_compare:w \l_fp_input_a_exponent_int < \l_fp_input_b_exponent_int - \group_end: - \prg_return_false: + \if_int_compare:w #1 < - \c_two + \exp_after:wN \exp_after:wN + \exp_after:wN \__fp_to_scientific_normal:wnnnnn \else: - \if_int_compare:w \l_fp_input_a_integer_int > \l_fp_input_b_integer_int - \group_end: - \prg_return_true: - \else: - \if_int_compare:w - \l_fp_input_a_integer_int < \l_fp_input_b_integer_int - \group_end: - \prg_return_false: - \else: - \if_int_compare:w - \l_fp_input_a_decimal_int > \l_fp_input_b_decimal_int - \group_end: - \prg_return_true: - \else: - \group_end: - \prg_return_false: - \fi: - \fi: - \fi: + \exp_after:wN \exp_after:wN + \exp_after:wN \__fp_to_decimal_normal:wnnnnn \fi: \fi: + \s__fp \__fp_chk:w 1 0 {#1} #2 ; \prg_do_nothing: } -\cs_new_protected_nopar:cpn { fp_compare_absolute_a<b: } +\cs_new:Npn \fp_to_dim:N #1 { \fp_to_decimal:N #1 pt } +\cs_generate_variant:Nn \fp_to_dim:N { c } +\cs_new:Npn \fp_to_dim:n #1 { \fp_to_decimal:n {#1} pt } +\cs_new:Npn \fp_to_int:N #1 { \exp_after:wN \__fp_to_int:w #1 } +\cs_generate_variant:Nn \fp_to_int:N { c } +\cs_new_nopar:Npn \fp_to_int:n { - \if_int_compare:w \l_fp_input_b_exponent_int > \l_fp_input_a_exponent_int - \group_end: - \prg_return_true: - \else: - \if_int_compare:w \l_fp_input_b_exponent_int < \l_fp_input_a_exponent_int - \group_end: - \prg_return_false: - \else: - \if_int_compare:w \l_fp_input_b_integer_int > \l_fp_input_a_integer_int - \group_end: - \prg_return_true: - \else: - \if_int_compare:w - \l_fp_input_b_integer_int < \l_fp_input_a_integer_int - \group_end: - \prg_return_false: - \else: - \if_int_compare:w - \l_fp_input_b_decimal_int > \l_fp_input_a_decimal_int - \group_end: - \prg_return_true: - \else: - \group_end: - \prg_return_false: - \fi: - \fi: - \fi: - \fi: - \fi: + \exp_after:wN \__fp_to_int:w + \tex_romannumeral:D -`0 \__fp_parse:n } -\cs_new_protected_nopar:cpn { fp_compare_<: } +\cs_new:Npn \__fp_to_int:w #1; { - \tl_set:Nx \l_fp_internal_tl - { - \int_set:Nn \exp_not:N \l_fp_input_a_sign_int - { \int_use:N \l_fp_input_b_sign_int } - \int_set:Nn \exp_not:N \l_fp_input_a_integer_int - { \int_use:N \l_fp_input_b_integer_int } - \int_set:Nn \exp_not:N \l_fp_input_a_decimal_int - { \int_use:N \l_fp_input_b_decimal_int } - \int_set:Nn \exp_not:N \l_fp_input_a_exponent_int - { \int_use:N \l_fp_input_b_exponent_int } - \int_set:Nn \exp_not:N \l_fp_input_b_sign_int - { \int_use:N \l_fp_input_a_sign_int } - \int_set:Nn \exp_not:N \l_fp_input_b_integer_int - { \int_use:N \l_fp_input_a_integer_int } - \int_set:Nn \exp_not:N \l_fp_input_b_decimal_int - { \int_use:N \l_fp_input_a_decimal_int } - \int_set:Nn \exp_not:N \l_fp_input_b_exponent_int - { \int_use:N \l_fp_input_a_exponent_int } - } - \l_fp_internal_tl - \use:c { fp_compare_>: } + \exp_after:wN \__fp_to_decimal:w \tex_romannumeral:D -`0 + \__fp_round:Nwn \__fp_round_to_nearest:NNN #1; { 0 } \prg_do_nothing: } -\prg_new_protected_conditional:Npnn \fp_compare:n #1 { T , F , TF } +\cs_new:Npn \dim_to_fp:n #1 { - \group_begin: - \tl_set:Nx \l_fp_internal_tl - { - \group_end: - \fp_compare_aux_i:w #1 \exp_not:n { == \q_nil == \q_stop } - } - \l_fp_internal_tl + \exp_after:wN \__fp_from_dim_test:N + \__int_value:w \etex_glueexpr:D #1 ; } -\cs_new_protected:Npn \fp_compare_aux_i:w #1 == #2 == #3 \q_stop +\cs_new:Npn \__fp_from_dim_test:N #1 { - \quark_if_nil:nTF {#2} - { \fp_compare_aux_ii:w #1 != \q_nil != \q_stop } - { \fp_compare:nNnTF {#1} = {#2} \prg_return_true: \prg_return_false: } + \if_meaning:w 0 #1 + \exp_after:wN \__fp_use_i_until_s:nw + \exp_after:wN \c_zero_fp + \else: + \if_meaning:w - #1 + \exp_after:wN \__fp_from_dim:Nw + \exp_after:wN 2 + \__int_value:w + \else: + \exp_after:wN \__fp_from_dim:Nw + \exp_after:wN 0 + \__int_value:w #1 + \fi: + \fi: + } +\cs_new:Npn \__fp_from_dim:Nw #1 #2; + { + \__fp_pack_twice_four:wNNNNNNNN \__fp_from_dim_ii:wNNnnnnnn ; + #2 000 0000 00 {10}987654321; #1 } -\cs_new_protected:Npn \fp_compare_aux_ii:w #1 != #2 != #3 \q_stop +\cs_new:Npn \__fp_from_dim_ii:wNNnnnnnn #1; #2#3#4#5#6#7#8#9 + { \__fp_from_dim_iii:wnnnnwN #1 {#2#300} {0000} ; } +\cs_new:Npn \__fp_from_dim_iii:wnnnnwN #1; #2#3#4#5#6; #7 { - \quark_if_nil:nTF {#2} - { \fp_compare_aux_iii:w #1 <= \q_nil <= \q_stop } - { \fp_compare:nNnTF {#1} = {#2} \prg_return_false: \prg_return_true: } + \__fp_mul_npos:Nnwnw #7 {#5} #1 ; + {-4} {1525} {8789} {0625} {0000} ; } -\cs_new_protected:Npn \fp_compare_aux_iii:w #1 <= #2 <= #3 \q_stop +\cs_new_eq:NN \fp_use:N \fp_to_decimal:N +\cs_generate_variant:Nn \fp_use:N { c } +\cs_new_eq:NN \fp_eval:n \fp_to_decimal:n +\cs_new:Npn \fp_abs:n #1 { \fp_to_decimal:n { abs ( #1 ) } } +%% +%% File: l3fp-assign.dtx Copyright (C) 2011-2012 The 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 +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% 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. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +\cs_new_protected:Npn \fp_new:N #1 + { \cs_new_eq:NN #1 \c_zero_fp } +\cs_generate_variant:Nn \fp_new:N {c} +\cs_new_protected:Npn \fp_set:Nn #1#2 + { \tl_set:Nx #1 { \__fp_parse:n {#2} } } +\cs_new_protected:Npn \fp_gset:Nn #1#2 + { \tl_gset:Nx #1 { \__fp_parse:n {#2} } } +\cs_new_protected:Npn \fp_const:Nn #1#2 + { \tl_const:Nx #1 { \__fp_parse:n {#2} } } +\cs_generate_variant:Nn \fp_set:Nn {c} +\cs_generate_variant:Nn \fp_gset:Nn {c} +\cs_generate_variant:Nn \fp_const:Nn {c} +\cs_new_eq:NN \fp_set_eq:NN \tl_set_eq:NN +\cs_new_eq:NN \fp_gset_eq:NN \tl_gset_eq:NN +\cs_generate_variant:Nn \fp_set_eq:NN { c , Nc , cc } +\cs_generate_variant:Nn \fp_gset_eq:NN { c , Nc , cc } +\cs_new_protected:Npn \fp_zero:N #1 { \fp_set_eq:NN #1 \c_zero_fp } +\cs_new_protected:Npn \fp_gzero:N #1 { \fp_gset_eq:NN #1 \c_zero_fp } +\cs_generate_variant:Nn \fp_zero:N { c } +\cs_generate_variant:Nn \fp_gzero:N { c } +\cs_new_protected:Npn \fp_zero_new:N #1 + { \fp_if_exist:NTF #1 { \fp_zero:N #1 } { \fp_new:N #1 } } +\cs_new_protected:Npn \fp_gzero_new:N #1 + { \fp_if_exist:NTF #1 { \fp_gzero:N #1 } { \fp_new:N #1 } } +\cs_generate_variant:Nn \fp_zero_new:N { c } +\cs_generate_variant:Nn \fp_gzero_new:N { c } +\cs_new_protected_nopar:Npn \fp_add:Nn { \__fp_add:NNNn \fp_set:Nn + } +\cs_new_protected_nopar:Npn \fp_gadd:Nn { \__fp_add:NNNn \fp_gset:Nn + } +\cs_new_protected_nopar:Npn \fp_sub:Nn { \__fp_add:NNNn \fp_set:Nn - } +\cs_new_protected_nopar:Npn \fp_gsub:Nn { \__fp_add:NNNn \fp_gset:Nn - } +\cs_new_protected:Npn \__fp_add:NNNn #1#2#3#4 { #1 #3 { #3 #2 (#4) } } +\cs_generate_variant:Nn \fp_add:Nn { c } +\cs_generate_variant:Nn \fp_gadd:Nn { c } +\cs_generate_variant:Nn \fp_sub:Nn { c } +\cs_generate_variant:Nn \fp_gsub:Nn { c } +\cs_new_protected:Npn \fp_show:N #1 + { \__msg_show_variable:x { > \fp_to_tl:N #1 } } +\cs_new_protected:Npn \fp_show:n #1 + { \__msg_show_variable:x { > \fp_to_tl:n {#1} } } +\cs_generate_variant:Nn \fp_show:N { c } +\fp_const:Nn \c_e_fp { 2.718 2818 2845 9045 } +\fp_const:Nn \c_one_fp { 1 } +\fp_const:Nn \c_pi_fp { 3.141 5926 5358 9794 } +\fp_const:Nn \c_one_degree_fp { 0.0 1745 3292 5199 4330 } +\fp_new:N \l_tmpa_fp +\fp_new:N \l_tmpb_fp +\fp_new:N \g_tmpa_fp +\fp_new:N \g_tmpb_fp +%% File: l3fp-old.dtx Copyright (C) 2012 The 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 +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% 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. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project Team. +%% +%% ----------------------------------------------------------------------- +%% +\fp_const:Nn \c_undefined_fp { nan } +\prg_new_conditional:Npnn \fp_if_undefined:N #1 { p , T , F , TF } + { \exp_after:wN \__fp_if_undefined:w #1 } +\cs_new:Npn \__fp_if_undefined:w \s__fp \__fp_chk:w #1#2; { - \quark_if_nil:nTF {#2} - { \fp_compare_aux_iv:w #1 >= \q_nil >= \q_stop } - { \fp_compare:nNnTF {#1} > {#2} \prg_return_false: \prg_return_true: } + \if_int_compare:w #1 > \c_one + \prg_return_true: \else: \prg_return_false: \fi: } -\cs_new_protected:Npn \fp_compare_aux_iv:w #1 >= #2 >= #3 \q_stop +\prg_new_conditional:Npnn \fp_if_zero:N #1 { p , T , F , TF } + { \exp_after:wN \__fp_if_zero:w #1 } +\cs_new:Npn \__fp_if_zero:w \s__fp \__fp_chk:w #1#2; + { \if_meaning:w #1 0 \prg_return_true: \else: \prg_return_false: \fi: } +\cs_new_protected_nopar:Npn \fp_abs:N { \__fp_abs:NNN \tl_set:Nx \__fp_abs:w } +\cs_new_protected_nopar:Npn \fp_gabs:N { \__fp_abs:NNN \tl_gset:Nx \__fp_abs:w } +\cs_new_protected_nopar:Npn \fp_neg:N { \__fp_abs:NNN \tl_set:Nx \__fp_neg:w } +\cs_new_protected_nopar:Npn \fp_gneg:N { \__fp_abs:NNN \tl_gset:Nx \__fp_neg:w } +\cs_new_protected:Npn \__fp_abs:NNN #1#2#3 + { #1 #3 { \exp_after:wN #2 #3 \prg_do_nothing: } } +\cs_generate_variant:Nn \fp_abs:N { c } +\cs_generate_variant:Nn \fp_gabs:N { c } +\cs_generate_variant:Nn \fp_neg:N { c } +\cs_generate_variant:Nn \fp_gneg:N { c } +\cs_new_protected_nopar:Npn \fp_mul:Nn { \__fp_mul:NNNn \fp_set:Nn * } +\cs_new_protected_nopar:Npn \fp_gmul:Nn { \__fp_mul:NNNn \fp_gset:Nn * } +\cs_new_protected_nopar:Npn \fp_div:Nn { \__fp_mul:NNNn \fp_set:Nn / } +\cs_new_protected_nopar:Npn \fp_gdiv:Nn { \__fp_mul:NNNn \fp_gset:Nn / } +\cs_new_protected_nopar:Npn \fp_pow:Nn { \__fp_mul:NNNn \fp_set:Nn ^ } +\cs_new_protected_nopar:Npn \fp_gpow:Nn { \__fp_mul:NNNn \fp_gset:Nn ^ } +\cs_new_protected:Npn \__fp_mul:NNNn #1#2#3#4 { #1 #3 { #3 #2 (#4) } } +\cs_generate_variant:Nn \fp_mul:Nn { c } +\cs_generate_variant:Nn \fp_gmul:Nn { c } +\cs_generate_variant:Nn \fp_div:Nn { c } +\cs_generate_variant:Nn \fp_gdiv:Nn { c } +\cs_generate_variant:Nn \fp_pow:Nn { c } +\cs_generate_variant:Nn \fp_gpow:Nn { c } +\cs_set_protected:Npn \__fp_tmp:w #1#2#3#4#5 { - \quark_if_nil:nTF {#2} - { \fp_compare_aux_v:w #1 = \q_nil \q_stop } - { \fp_compare:nNnTF {#1} < {#2} \prg_return_false: \prg_return_true: } + \cs_new_protected_nopar:Npn #1 { #5 {#4} \tl_set_eq:NN #3 } + \cs_new_protected_nopar:Npn #2 { #5 {#4} \tl_gset_eq:NN #3 } + \cs_generate_variant:Nn #1 { c } + \cs_generate_variant:Nn #2 { c } } -\cs_new_protected:Npn \fp_compare_aux_v:w #1 = #2 = #3 \q_stop +\__fp_tmp:w \fp_exp:Nn \fp_gexp:Nn \__fp_exp:w {exp} \__fp_assign_to:nNNNn +\__fp_tmp:w \fp_ln:Nn \fp_gln:Nn \__fp_ln:w {ln } \__fp_assign_to:nNNNn +\__fp_tmp:w \fp_sin:Nn \fp_gsin:Nn \__fp_sin:w {sin} \__fp_assign_to:nNNNn +\__fp_tmp:w \fp_cos:Nn \fp_gcos:Nn \__fp_cos:w {cos} \__fp_assign_to:nNNNn +\__fp_tmp:w \fp_tan:Nn \fp_gtan:Nn \__fp_tan:w {tan} \__fp_assign_to:nNNNn +\cs_new_protected:Npn \__fp_assign_to:nNNNn #1#2#3#4#5 { - \quark_if_nil:nTF {#2} - { \fp_compare_aux_vi:w #1 < \q_nil < \q_stop } - { \fp_compare:nNnTF {#1} = {#2} \prg_return_true: \prg_return_false: } + \exp_after:wN \__fp_assign_to_i:wNNNn + \tex_romannumeral:D -`0 \__fp_parse:n {#5} {#1} #2#3#4 } -\cs_new_protected:Npn \fp_compare_aux_vi:w #1 < #2 < #3 \q_stop +\cs_new_protected:Npn \__fp_assign_to_i:wNNNn \s__fp \__fp_chk:w #1#2#3; #4 { - \quark_if_nil:nTF {#2} - { \fp_compare_aux_vii:w #1 > \q_nil > \q_stop } - { \fp_compare:nNnTF {#1} < {#2} \prg_return_true: \prg_return_false: } + \exp_args:Nc \__fp_assign_to_ii:NnNNN + { c__fp_ #4 ( #2 \if_meaning:w 1 #1 #3 \fi: ) _fp } + { #1#2#3 } } -\cs_new_protected:Npn \fp_compare_aux_vii:w #1 > #2 > #3 \q_stop +\cs_new_protected:Npn \__fp_assign_to_ii:NnNNN #1#2#3#4#5 { - \quark_if_nil:nTF {#2} - { \prg_return_false: } - { \fp_compare:nNnTF {#1} > {#2} \prg_return_true: \prg_return_false: } + \cs_if_exist:NF #1 + { \tl_const:Nx #1 { #4 \s__fp \__fp_chk:w #2; } } + #3 #5 #1 } -\msg_kernel_new:nnnn { fpu } { overflow } - { Number~too~big. } +\cs_new_protected_nopar:Npn \fp_compare:NNNTF { \fp_compare:nNnTF } +\cs_new_protected_nopar:Npn \fp_compare:NNNT { \fp_compare:nNnT } +\cs_new_protected_nopar:Npn \fp_compare:NNNF { \fp_compare:nNnF } +\cs_new_protected_nopar:Npn \fp_compare_p:NNN { \fp_compare_p:nNn } +\cs_new_protected_nopar:Npn \fp_round_places:Nn + { \__fp_round_places:NNn \tl_set:Nx } +\cs_new_protected_nopar:Npn \fp_ground_places:Nn + { \__fp_round_places:NNn \tl_gset:Nx } +\cs_new_protected:Npn \__fp_round_places:NNn #1#2#3 { - The~input~given~is~too~big~for~the~LaTeX~floating~point~unit. \\ - Further~errors~may~well~occur! + #1 #2 + { + \exp_after:wN \exp_after:wN + \exp_after:wN \__fp_round:Nwn + \exp_after:wN \exp_after:wN + \exp_after:wN \__fp_round_to_nearest:NNN + \exp_after:wN #2 + \exp_after:wN { \int_use:N \__int_eval:w #3 } + } } -\cs_new_protected_nopar:Npn \fp_overflow_msg: - { \msg_kernel_error:nn { fpu } { overflow } } -\msg_kernel_new:nnnn { fpu } { exponent-overflow } - { Number~too~big~for~exponent~unit. } +\cs_generate_variant:Nn \fp_round_places:Nn { c } +\cs_generate_variant:Nn \fp_ground_places:Nn { c } +\cs_new_protected:Npn \fp_round_figures:Nn #1#2 { - The~exponent~of~the~input~given~is~too~big~for~the~floating~point~ - unit:~the~maximum~input~value~for~an~exponent~is~230. + \__fp_round_places:NNn \tl_set:Nx #1 + { #2 - \exp_after:wN \__fp_exponent:w #1 } } -\cs_new_protected_nopar:Npn \fp_exp_overflow_msg: - { \msg_kernel_error:nn { fpu } { exponent-overflow } } -\msg_kernel_new:nnnn { fpu } { logarithm-input-error } - { Invalid~input~to~ln~function. } - { Logarithms~can~only~be~calculated~for~positive~numbers. } -\cs_new_protected_nopar:Npn \fp_ln_error_msg: { - \msg_kernel_error:nn { fpu } { logarithm-input-error } -} -\msg_kernel_new:nnnn { fpu } { trigonometric-overflow } - { Number~too~big~for~trigonometry~unit. } +\cs_new_protected:Npn \fp_ground_figures:Nn #1#2 { - The~trigonometry~code~can~only~work~with~numbers~smaller~ - than~1000000000. + \__fp_round_places:NNn \tl_gset:Nx #1 + { #2 - \exp_after:wN \__fp_exponent:w #1 } } -\cs_new_protected_nopar:Npn \fp_trig_overflow_msg: - { \msg_kernel_error:nn { fpu } { trigonometric-overflow } } +\cs_generate_variant:Nn \fp_round_figures:Nn { c } +\cs_generate_variant:Nn \fp_ground_figures:Nn { c } %% %% %% End of file `l3fp.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3int.sty b/Master/texmf-dist/tex/latex/l3kernel/l3int.sty index 76b61a861c6..f33a864bff7 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3int.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3int.sty @@ -46,57 +46,56 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3int.dtx 3490 2012-03-04 01:00:53Z bruno $ - {L3 Experimental integers} +\GetIdInfo$Id: l3int.dtx 3986 2012-07-15 19:23:51Z joseph $ + {L3 Integers} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\package_check_loaded_expl: -\cs_new_eq:NN \int_value:w \tex_number:D -\cs_new_eq:NN \int_eval:w \etex_numexpr:D -\cs_new_eq:NN \int_eval_end: \tex_relax:D -\cs_new_eq:NN \if_num:w \tex_ifnum:D -\cs_new_eq:NN \if_int_odd:w \tex_ifodd:D -\cs_new_eq:NN \if_case:w \tex_ifcase:D -\cs_new:Npn \int_eval:n #1 { \int_value:w \int_eval:w #1 \int_eval_end: } +\__expl_package_check: +\cs_new_eq:NN \__int_value:w \tex_number:D +\cs_new_eq:NN \__int_eval:w \etex_numexpr:D +\cs_new_eq:NN \__int_eval_end: \tex_relax:D +\cs_new_eq:NN \if_int_odd:w \tex_ifodd:D +\cs_new_eq:NN \if_case:w \tex_ifcase:D +\cs_new:Npn \int_eval:n #1 { \__int_value:w \__int_eval:w #1 \__int_eval_end: } \cs_new:Npn \int_abs:n #1 { - \int_value:w - \if_int_compare:w \int_eval:w #1 < \c_zero + \__int_value:w + \if_int_compare:w \__int_eval:w #1 < \c_zero - \fi: - \int_eval:w #1 \int_eval_end: + \__int_eval:w #1 \__int_eval_end: } \cs_new:Npn \int_max:nn #1#2 { - \int_value:w \int_eval:w + \__int_value:w \__int_eval:w \if_int_compare:w - \int_eval:w #1 > \int_eval:w #2 \int_eval_end: + \__int_eval:w #1 > \__int_eval:w #2 \__int_eval_end: #1 \else: #2 \fi: - \int_eval_end: + \__int_eval_end: } \cs_new:Npn \int_min:nn #1#2 { - \int_value:w \int_eval:w + \__int_value:w \__int_eval:w \if_int_compare:w - \int_eval:w #1 < \int_eval:w #2 \int_eval_end: + \__int_eval:w #1 < \__int_eval:w #2 \__int_eval_end: #1 \else: #2 \fi: - \int_eval_end: + \__int_eval_end: } \cs_new:Npn \int_div_truncate:nn #1#2 { - \int_use:N \int_eval:w - \exp_after:wN \int_div_truncate_aux:NwNw - \int_use:N \int_eval:w #1 \exp_after:wN ; - \int_use:N \int_eval:w #2 ; - \int_eval_end: + \int_use:N \__int_eval:w + \exp_after:wN \__int_div_truncate:NwNw + \int_use:N \__int_eval:w #1 \exp_after:wN ; + \int_use:N \__int_eval:w #2 ; + \__int_eval_end: } -\cs_new:Npn \int_div_truncate_aux:NwNw #1#2; #3#4; +\cs_new:Npn \__int_div_truncate:NwNw #1#2; #3#4; { \if_meaning:w 0 #1 \c_zero @@ -112,13 +111,13 @@ \cs_new:Npn \int_div_round:nn #1#2 { \int_eval:n { ( #1 ) / ( #2 ) } } \cs_new:Npn \int_mod:nn #1#2 { - \int_value:w \int_eval:w + \__int_value:w \__int_eval:w #1 - \int_div_truncate:nn {#1} {#2} * ( #2 ) - \int_eval_end: + \__int_eval_end: } \cs_new_protected:Npn \int_new:N #1 { - \chk_if_free_cs:N #1 + \__chk_if_free_cs:N #1 \newcount #1 } \cs_generate_variant:Nn \int_new:N { c } @@ -126,15 +125,15 @@ { \int_compare:nNnTF {#2} > \c_minus_one { - \int_compare:nNnTF {#2} > \c_max_const_int + \int_compare:nNnTF {#2} > \c__max_constdef_int { \int_new:N #1 \int_gset:Nn #1 {#2} } { - \chk_if_free_cs:N #1 - \tex_global:D \int_constdef:Nw #1 = - \int_eval:w #2 \int_eval_end: + \__chk_if_free_cs:N #1 + \tex_global:D \__int_constdef:Nw #1 = + \__int_eval:w #2 \__int_eval_end: } } { @@ -145,12 +144,12 @@ \cs_generate_variant:Nn \int_const:Nn { c } \pdftex_if_engine:TF { - \cs_new_eq:NN \int_constdef:Nw \tex_mathchardef:D - \tex_mathchardef:D \c_max_const_int 32 767 ~ + \cs_new_eq:NN \__int_constdef:Nw \tex_mathchardef:D + \tex_mathchardef:D \c__max_constdef_int 32 767 ~ } { - \cs_new_eq:NN \int_constdef:Nw \tex_chardef:D - \tex_chardef:D \c_max_const_int 1 114 111 ~ + \cs_new_eq:NN \__int_constdef:Nw \tex_chardef:D + \tex_chardef:D \c__max_constdef_int 1 114 111 ~ } \cs_new_protected:Npn \int_zero:N #1 { #1 = \c_zero } \cs_new_protected:Npn \int_gzero:N #1 { \tex_global:D #1 = \c_zero } @@ -177,9 +176,9 @@ \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: } + { \tex_advance:D #1 by \__int_eval:w #2 \__int_eval_end: } \cs_new_protected:Npn \int_sub:Nn #1#2 - { \tex_advance:D #1 by - \int_eval:w #2 \int_eval_end: } + { \tex_advance:D #1 by - \__int_eval:w #2 \__int_eval_end: } \cs_new_protected_nopar:Npn \int_gadd:Nn { \tex_global:D \int_add:Nn } \cs_new_protected_nopar:Npn \int_gsub:Nn @@ -201,70 +200,84 @@ \cs_generate_variant:Nn \int_gincr:N { c } \cs_generate_variant:Nn \int_gdecr:N { c } \cs_new_protected:Npn \int_set:Nn #1#2 - { #1 ~ \int_eval:w #2\int_eval_end: } + { #1 ~ \__int_eval:w #2\__int_eval_end: } \cs_new_protected_nopar:Npn \int_gset:Nn { \tex_global:D \int_set:Nn } \cs_generate_variant:Nn \int_set:Nn { c } \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: } -\cs_new_protected_nopar:Npn \kernel_compare_error: +\cs_new_protected_nopar:Npn \__prg_compare_error: { - \if_num:w \c_zero \c_zero \fi: + \if_int_compare:w \c_zero \c_zero \fi: = - \kernel_compare_error: + \__prg_compare_error: } -\cs_new:Npn \kernel_compare_error:Nw +\cs_new:Npn \__prg_compare_error:Nw #1#2 \prg_return_true: \else: \prg_return_false: \fi: { - \msg_expandable_kernel_error:nnn + \__msg_kernel_expandable_error:nnn { kernel } { unknown-comparison } {#1} \prg_return_false: } \prg_new_conditional:Npnn \int_compare:n #1 { p , T , F , TF } { - \exp_after:wN \int_compare_aux:Nw \int_use:N \int_eval:w #1 - \kernel_compare_error: \int_eval_end: + \exp_after:wN \__int_compare_aux:Nw \int_use:N \__int_eval:w #1 + \__prg_compare_error: \__int_eval_end: \prg_return_true: \else: \prg_return_false: \fi: } -\cs_new:Npn \int_compare_aux:Nw #1#2 \kernel_compare_error: +\cs_new:Npn \__int_compare_aux:Nw #1#2 \__prg_compare_error: { - \exp_after:wN \int_compare_aux:NNw - \int_to_roman:w - 0 #2 ?? \q_mark + \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: +\cs_new:Npn \__int_compare_aux:NNw #1#2#3 \q_mark + { + \use:c { __int_compare_ #1 \if_meaning:w = #2 = \fi: :NNw } + \__prg_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: \prg_return_true: \else: \prg_return_false: \fi: } +\cs_new:Npn \int_case:nnn #1 + { + \tex_romannumeral:D + \exp_args:Nf \__int_case:nnn { \int_eval:n {#1} } + } +\cs_new:Npn \__int_case:nnn #1#2#3 + { \__int_case:nw {#1} #2 {#1} {#3} \q_recursion_stop } +\cs_new:Npn \__int_case:nw #1#2#3 + { + \int_compare:nNnTF {#1} = {#2} + { \__int_case_end:nw {#3} } + { \__int_case:nw {#1} } + } +\cs_new_eq:NN \__int_case_end:nw \__prg_case_end:nw \prg_new_conditional:Npnn \int_if_odd:n #1 { p , T , F , TF} { - \if_int_odd:w \int_eval:w #1 \int_eval_end: + \if_int_odd:w \__int_eval:w #1 \__int_eval_end: \prg_return_true: \else: \prg_return_false: @@ -272,7 +285,7 @@ } \prg_new_conditional:Npnn \int_if_even:n #1 { p , T , F , TF} { - \if_int_odd:w \int_eval:w #1 \int_eval_end: + \if_int_odd:w \__int_eval:w #1 \__int_eval_end: \prg_return_false: \else: \prg_return_true: @@ -334,22 +347,70 @@ \int_compare:nNnF {#1} #2 {#3} { \int_do_until:nNnn {#1} #2 {#3} {#4} } } +\cs_new:Npn \int_step_function:nnnN #1#2#3#4 + { + \int_compare:nNnTF {#2} > \c_zero + { \exp_args:NNf \__int_step:NnnnN > } + { + \int_compare:nNnTF {#2} = \c_zero + { + \__msg_kernel_expandable_error:nnn { kernel } { zero-step } {#4} + \use_none:nnnn + } + { \exp_args:NNf \__int_step:NnnnN < } + } + { \int_eval:n {#1} } {#2} {#3} #4 + } +\cs_new:Npn \__int_step:NnnnN #1#2#3#4#5 + { + \int_compare:nNnF {#2} #1 {#4} + { + #5 {#2} + \exp_args:NNf \__int_step:NnnnN + #1 { \int_eval:n { #2 + #3 } } {#3} {#4} #5 + } + } +\cs_new_protected_nopar:Npn \int_step_inline:nnnn + { + \int_gincr:N \g__prg_map_int + \exp_args:NNc \__int_step:NNnnnn + \cs_gset_nopar:Npn + { __prg_map_ \int_use:N \g__prg_map_int :w } + } +\cs_new_protected:Npn \int_step_variable:nnnNn #1#2#3#4#5 + { + \int_gincr:N \g__prg_map_int + \exp_args:NNc \__int_step:NNnnnn + \cs_gset_nopar:Npx + { __prg_map_ \int_use:N \g__prg_map_int :w } + {#1}{#2}{#3} + { + \tl_set:Nn \exp_not:N #4 {##1} + \exp_not:n {#5} + } + } +\cs_new_protected:Npn \__int_step:NNnnnn #1#2#3#4#5#6 + { + #1 #2 ##1 {#6} + \int_step_function:nnnN {#3} {#4} {#5} #2 + \__prg_break_point:Nn \scan_stop: { \int_gdecr:N \g__prg_map_int } + } \cs_new:Npn \int_to_arabic:n #1 { \int_eval:n {#1} } \cs_new:Npn \int_to_symbols:nnn #1#2#3 { \int_compare:nNnTF {#1} > {#2} { - \exp_args:NNo \exp_args:No \int_to_symbols_aux:nnnn + \exp_args:NNo \exp_args:No \__int_to_symbols:nnnn { - \prg_case_int:nnn + \int_case:nnn { 1 + \int_mod:nn { #1 - 1 } {#2} } {#3} { } } {#1} {#2} {#3} } - { \prg_case_int:nnn {#1} {#3} { } } + { \int_case:nnn {#1} {#3} { } } } -\cs_new:Npn \int_to_symbols_aux:nnnn #1#2#3#4 +\cs_new:Npn \__int_to_symbols:nnnn #1#2#3#4 { \exp_args:Nf \int_to_symbols:nnn { \int_div_truncate:nn { #2 - 1 } {#3} } {#3} {#4} @@ -420,37 +481,37 @@ } } \cs_new:Npn \int_to_base:nn #1 - { \exp_args:Nf \int_to_base_aux_i:nn { \int_eval:n {#1} } } -\cs_new:Npn \int_to_base_aux_i:nn #1#2 + { \exp_args:Nf \__int_to_base:nn { \int_eval:n {#1} } } +\cs_new:Npn \__int_to_base:nn #1#2 { \int_compare:nNnTF {#1} < \c_zero - { \exp_args:No \int_to_base_aux_ii:nnN { \use_none:n #1 } {#2} - } - { \int_to_base_aux_ii:nnN {#1} {#2} \c_empty_tl } + { \exp_args:No \__int_to_base:nnN { \use_none:n #1 } {#2} - } + { \__int_to_base:nnN {#1} {#2} \c_empty_tl } } -\cs_new:Npn \int_to_base_aux_ii:nnN #1#2#3 +\cs_new:Npn \__int_to_base:nnN #1#2#3 { \int_compare:nNnTF {#1} < {#2} - { \exp_last_unbraced:Nf #3 { \int_to_letter:n {#1} } } + { \exp_last_unbraced:Nf #3 { \__int_to_letter:n {#1} } } { - \exp_args:Nf \int_to_base_aux_iii:nnnN - { \int_to_letter:n { \int_mod:nn {#1} {#2} } } + \exp_args:Nf \__int_to_base:nnnN + { \__int_to_letter:n { \int_mod:nn {#1} {#2} } } {#1} {#2} #3 } } -\cs_new:Npn \int_to_base_aux_iii:nnnN #1#2#3#4 +\cs_new:Npn \__int_to_base:nnnN #1#2#3#4 { - \exp_args:Nf \int_to_base_aux_ii:nnN + \exp_args:Nf \__int_to_base:nnN { \int_div_truncate:nn {#2} {#3} } {#3} #4 #1 } -\cs_new:Npn \int_to_letter:n #1 +\cs_new:Npn \__int_to_letter:n #1 { \exp_after:wN \exp_after:wN - \if_case:w \int_eval:w #1 - \c_ten \int_eval_end: + \if_case:w \__int_eval:w #1 - \c_ten \__int_eval_end: A \or: B \or: C @@ -477,7 +538,7 @@ \or: X \or: Y \or: Z - \else: \int_value:w \int_eval:w #1 \exp_after:wN \int_eval_end: + \else: \__int_value:w \__int_eval:w #1 \exp_after:wN \__int_eval_end: \fi: } \cs_new:Npn \int_to_binary:n #1 @@ -488,117 +549,117 @@ { \int_to_base:nn {#1} { 8 } } \cs_new:Npn \int_to_roman:n #1 { - \exp_after:wN \int_to_roman_aux:N - \int_to_roman:w \int_eval:n {#1} Q + \exp_after:wN \__int_to_roman:N + \__int_to_roman:w \int_eval:n {#1} Q } -\cs_new:Npn \int_to_roman_aux:N #1 +\cs_new:Npn \__int_to_roman:N #1 { - \use:c { int_to_roman_ #1 :w } - \int_to_roman_aux:N + \use:c { __int_to_roman_ #1 :w } + \__int_to_roman:N } \cs_new:Npn \int_to_Roman:n #1 { - \exp_after:wN \int_to_Roman_aux:N - \int_to_roman:w \int_eval:n {#1} Q - } -\cs_new:Npn \int_to_Roman_aux:N #1 - { - \use:c { int_to_Roman_ #1 :w } - \int_to_Roman_aux:N - } -\cs_new_nopar:Npn \int_to_roman_i:w { i } -\cs_new_nopar:Npn \int_to_roman_v:w { v } -\cs_new_nopar:Npn \int_to_roman_x:w { x } -\cs_new_nopar:Npn \int_to_roman_l:w { l } -\cs_new_nopar:Npn \int_to_roman_c:w { c } -\cs_new_nopar:Npn \int_to_roman_d:w { d } -\cs_new_nopar:Npn \int_to_roman_m:w { m } -\cs_new_nopar:Npn \int_to_roman_Q:w #1 { } -\cs_new_nopar:Npn \int_to_Roman_i:w { I } -\cs_new_nopar:Npn \int_to_Roman_v:w { V } -\cs_new_nopar:Npn \int_to_Roman_x:w { X } -\cs_new_nopar:Npn \int_to_Roman_l:w { L } -\cs_new_nopar:Npn \int_to_Roman_c:w { C } -\cs_new_nopar:Npn \int_to_Roman_d:w { D } -\cs_new_nopar:Npn \int_to_Roman_m:w { M } -\cs_new:Npn \int_to_Roman_Q:w #1 { } -\cs_new:Npn \int_get_sign:n #1 - { - \int_get_sign_and_digits_aux:nNNN {#1} + \exp_after:wN \__int_to_Roman_aux:N + \__int_to_roman:w \int_eval:n {#1} Q + } +\cs_new:Npn \__int_to_Roman_aux:N #1 + { + \use:c { __int_to_Roman_ #1 :w } + \__int_to_Roman_aux:N + } +\cs_new_nopar:Npn \__int_to_roman_i:w { i } +\cs_new_nopar:Npn \__int_to_roman_v:w { v } +\cs_new_nopar:Npn \__int_to_roman_x:w { x } +\cs_new_nopar:Npn \__int_to_roman_l:w { l } +\cs_new_nopar:Npn \__int_to_roman_c:w { c } +\cs_new_nopar:Npn \__int_to_roman_d:w { d } +\cs_new_nopar:Npn \__int_to_roman_m:w { m } +\cs_new_nopar:Npn \__int_to_roman_Q:w #1 { } +\cs_new_nopar:Npn \__int_to_Roman_i:w { I } +\cs_new_nopar:Npn \__int_to_Roman_v:w { V } +\cs_new_nopar:Npn \__int_to_Roman_x:w { X } +\cs_new_nopar:Npn \__int_to_Roman_l:w { L } +\cs_new_nopar:Npn \__int_to_Roman_c:w { C } +\cs_new_nopar:Npn \__int_to_Roman_d:w { D } +\cs_new_nopar:Npn \__int_to_Roman_m:w { M } +\cs_new:Npn \__int_to_Roman_Q:w #1 { } +\cs_new:Npn \__int_get_sign:n #1 + { + \__int_get_sign_and_digits:nNNN {#1} \c_true_bool \c_true_bool \c_false_bool } -\cs_new:Npn \int_get_digits:n #1 +\cs_new:Npn \__int_get_digits:n #1 { - \int_get_sign_and_digits_aux:nNNN {#1} + \__int_get_sign_and_digits:nNNN {#1} \c_true_bool \c_false_bool \c_true_bool } -\cs_new:Npn \int_get_sign_and_digits_aux:nNNN #1#2#3#4 +\cs_new:Npn \__int_get_sign_and_digits:nNNN #1#2#3#4 { \exp_args:Nf \tl_if_head_eq_charcode:nNTF {#1} - { \bool_if:NTF #2 { - \int_get_sign_and_digits_aux:oNNN + \__int_get_sign_and_digits:oNNN { \use_none:n #1 } \c_false_bool #3#4 } { - \int_get_sign_and_digits_aux:oNNN + \__int_get_sign_and_digits:oNNN { \use_none:n #1 } \c_true_bool #3#4 } } { \exp_args:Nf \tl_if_head_eq_charcode:nNTF {#1} + - { \int_get_sign_and_digits_aux:oNNN { \use_none:n #1 } #2#3#4 } + { \__int_get_sign_and_digits:oNNN { \use_none:n #1 } #2#3#4 } { \bool_if:NT #3 { \bool_if:NF #2 - } \bool_if:NT #4 {#1} } } } -\cs_generate_variant:Nn \int_get_sign_and_digits_aux:nNNN { o } +\cs_generate_variant:Nn \__int_get_sign_and_digits:nNNN { o } \cs_new:Npn \int_from_alph:n #1 { \int_eval:n { - \int_get_sign:n {#1} - \exp_args:Nf \int_from_alph_aux:n { \int_get_digits:n {#1} } + \__int_get_sign:n {#1} + \exp_args:Nf \__int_from_alph:n { \__int_get_digits:n {#1} } } } -\cs_new:Npn \int_from_alph_aux:n #1 - { \int_from_alph_aux:nN { 0 } #1 \q_nil } -\cs_new:Npn \int_from_alph_aux:nN #1#2 +\cs_new:Npn \__int_from_alph:n #1 + { \__int_from_alph:nN { 0 } #1 \q_nil } +\cs_new:Npn \__int_from_alph:nN #1#2 { \quark_if_nil:NTF #2 {#1} { - \exp_args:Nf \int_from_alph_aux:nN - { \int_eval:n { #1 * 26 + \int_from_alph_aux:N #2 } } + \exp_args:Nf \__int_from_alph:nN + { \int_eval:n { #1 * 26 + \__int_from_alph:N #2 } } } } -\cs_new:Npn \int_from_alph_aux:N #1 +\cs_new:Npn \__int_from_alph:N #1 { \int_eval:n { `#1 - \int_compare:nNnTF { `#1 } < { 91 } { 64 } { 96 } } } \cs_new:Npn \int_from_base:nn #1#2 { \int_eval:n { - \int_get_sign:n {#1} - \exp_args:Nf \int_from_base_aux:nn - { \int_get_digits:n {#1} } {#2} + \__int_get_sign:n {#1} + \exp_args:Nf \__int_from_base:nn + { \__int_get_digits:n {#1} } {#2} } } -\cs_new:Npn \int_from_base_aux:nn #1#2 - { \int_from_base_aux:nnN { 0 } { #2 } #1 \q_nil } -\cs_new:Npn \int_from_base_aux:nnN #1#2#3 +\cs_new:Npn \__int_from_base:nn #1#2 + { \__int_from_base:nnN { 0 } { #2 } #1 \q_nil } +\cs_new:Npn \__int_from_base:nnN #1#2#3 { \quark_if_nil:NTF #3 {#1} { - \exp_args:Nf \int_from_base_aux:nnN - { \int_eval:n { #1 * #2 + \int_from_base_aux:N #3 } } + \exp_args:Nf \__int_from_base:nnN + { \int_eval:n { #1 * #2 + \__int_from_base:N #3 } } {#2} } } -\cs_new:Npn \int_from_base_aux:N #1 +\cs_new:Npn \__int_from_base:N #1 { \int_compare:nNnTF { `#1 } < { 58 } {#1} @@ -613,70 +674,70 @@ { \int_from_base:nn {#1} \c_sixteen } \cs_new:Npn \int_from_octal:n #1 { \int_from_base:nn {#1} \c_eight } -\int_const:cn { c_int_from_roman_i_int } { 1 } -\int_const:cn { c_int_from_roman_v_int } { 5 } -\int_const:cn { c_int_from_roman_x_int } { 10 } -\int_const:cn { c_int_from_roman_l_int } { 50 } -\int_const:cn { c_int_from_roman_c_int } { 100 } -\int_const:cn { c_int_from_roman_d_int } { 500 } -\int_const:cn { c_int_from_roman_m_int } { 1000 } -\int_const:cn { c_int_from_roman_I_int } { 1 } -\int_const:cn { c_int_from_roman_V_int } { 5 } -\int_const:cn { c_int_from_roman_X_int } { 10 } -\int_const:cn { c_int_from_roman_L_int } { 50 } -\int_const:cn { c_int_from_roman_C_int } { 100 } -\int_const:cn { c_int_from_roman_D_int } { 500 } -\int_const:cn { c_int_from_roman_M_int } { 1000 } +\int_const:cn { c__int_from_roman_i_int } { 1 } +\int_const:cn { c__int_from_roman_v_int } { 5 } +\int_const:cn { c__int_from_roman_x_int } { 10 } +\int_const:cn { c__int_from_roman_l_int } { 50 } +\int_const:cn { c__int_from_roman_c_int } { 100 } +\int_const:cn { c__int_from_roman_d_int } { 500 } +\int_const:cn { c__int_from_roman_m_int } { 1000 } +\int_const:cn { c__int_from_roman_I_int } { 1 } +\int_const:cn { c__int_from_roman_V_int } { 5 } +\int_const:cn { c__int_from_roman_X_int } { 10 } +\int_const:cn { c__int_from_roman_L_int } { 50 } +\int_const:cn { c__int_from_roman_C_int } { 100 } +\int_const:cn { c__int_from_roman_D_int } { 500 } +\int_const:cn { c__int_from_roman_M_int } { 1000 } \cs_new:Npn \int_from_roman:n #1 { \tl_if_blank:nF {#1} { - \exp_after:wN \int_from_roman_end:w - \int_value:w \int_eval:w - \int_from_roman_aux:NN #1 Q \q_stop + \exp_after:wN \__int_from_roman_end:w + \__int_value:w \__int_eval:w + \__int_from_roman:NN #1 Q \q_stop } } -\cs_new:Npn \int_from_roman_aux:NN #1#2 +\cs_new:Npn \__int_from_roman:NN #1#2 { \str_if_eq:nnTF {#1} { Q } {#1#2} { \str_if_eq:nnTF {#2} { Q } { - \int_if_exist:cF { c_int_from_roman_ #1 _int } - { \int_from_roman_clean_up:w } + \int_if_exist:cF { c__int_from_roman_ #1 _int } + { \__int_from_roman_clean_up:w } + - \use:c { c_int_from_roman_ #1 _int } + \use:c { c__int_from_roman_ #1 _int } #2 } { - \int_if_exist:cF { c_int_from_roman_ #1 _int } - { \int_from_roman_clean_up:w } - \int_if_exist:cF { c_int_from_roman_ #2 _int } - { \int_from_roman_clean_up:w } + \int_if_exist:cF { c__int_from_roman_ #1 _int } + { \__int_from_roman_clean_up:w } + \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 } } + { \use:c { c__int_from_roman_ #1 _int } } < - { \use:c { c_int_from_roman_ #2 _int } } + { \use:c { c__int_from_roman_ #2 _int } } { - + \use:c { c_int_from_roman_ #2 _int } - - \use:c { c_int_from_roman_ #1 _int } - \int_from_roman_aux:NN + + \use:c { c__int_from_roman_ #2 _int } + - \use:c { c__int_from_roman_ #1 _int } + \__int_from_roman:NN } { - + \use:c { c_int_from_roman_ #1 _int } - \int_from_roman_aux:NN #2 + + \use:c { c__int_from_roman_ #1 _int } + \__int_from_roman:NN #2 } } } } -\cs_new:Npn \int_from_roman_end:w #1 Q #2 \q_stop +\cs_new:Npn \__int_from_roman_end:w #1 Q #2 \q_stop { \tl_if_empty:nTF {#2} {#1} {#2} } -\cs_new:Npn \int_from_roman_clean_up:w #1 Q { + 0 Q -1 } -\cs_new_eq:NN \int_show:N \kernel_register_show:N -\cs_new_eq:NN \int_show:c \kernel_register_show:c +\cs_new:Npn \__int_from_roman_clean_up:w #1 Q { + 0 Q -1 } +\cs_new_eq:NN \int_show:N \__kernel_register_show:N +\cs_new_eq:NN \int_show:c \__kernel_register_show:c \cs_new_protected:Npn \int_show:n #1 - { \tex_showthe:D \int_eval:w #1 \int_eval_end: } + { \etex_showtokens:D \exp_after:wN { \int_use:N \__int_eval:w #1 } } \int_const:Nn \c_one { 1 } \int_const:Nn \c_two { 2 } \int_const:Nn \c_three { 3 } @@ -698,9 +759,13 @@ \int_const:Nn \c_max_int { 2 147 483 647 } \int_new:N \l_tmpa_int \int_new:N \l_tmpb_int -\int_new:N \l_tmpc_int \int_new:N \g_tmpa_int \int_new:N \g_tmpb_int +\cs_new_eq:NN \if_num:w \if_int_compare:w +\int_new:N \l_tmpc_int +\cs_new_eq:NN \int_eval:w \__int_eval:w +\cs_new_eq:NN \int_eval_end: \__int_eval_end: +\cs_new_eq:NN \int_value:w \__int_value:w %% %% %% End of file `l3int.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3keys.sty b/Master/texmf-dist/tex/latex/l3kernel/l3keys.sty index a0ae5751eb3..3d1a698da0b 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3keys.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3keys.sty @@ -13,7 +13,7 @@ %% %% Do not distribute a modified version of this file. %% -%% File: l3keys.dtx Copyright (C) 2006-2011 The LaTeX3 Project +%% File: l3keys.dtx Copyright (C) 2006-2012 The 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 @@ -46,16 +46,16 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3keys.dtx 3487 2012-03-03 19:36:51Z bruno $ +\GetIdInfo$Id: l3keys.dtx 3986 2012-07-15 19:23:51Z joseph $ {L3 Experimental key-value interfaces} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\package_check_loaded_expl: -\int_new:N \g_keyval_level_int -\tl_new:N \l_keyval_key_tl -\tl_new:N \l_keyval_value_tl -\tl_new:N \l_keyval_sanitise_tl -\tl_new:N \l_keyval_parse_tl +\__expl_package_check: +\int_new:N \g__keyval_level_int +\tl_new:N \l__keyval_key_tl +\tl_new:N \l__keyval_value_tl +\tl_new:N \l__keyval_sanitise_tl +\tl_new:N \l__keyval_parse_tl \group_begin: \char_set_catcode_active:n { `\= } \char_set_catcode_active:n { `\, } @@ -64,585 +64,599 @@ \tl_to_lowercase:n { \group_end: - \cs_new_protected:Npn \keyval_parse:n #1 + \cs_new_protected:Npn \__keyval_parse:n #1 { \group_begin: - \tl_clear:N \l_keyval_sanitise_tl - \tl_set:Nn \l_keyval_sanitise_tl {#1} - \tl_replace_all:Nnn \l_keyval_sanitise_tl { = } { 8 } - \tl_replace_all:Nnn \l_keyval_sanitise_tl { , } { 9 } - \tl_clear:N \l_keyval_parse_tl - \exp_after:wN \keyval_parse_elt:w \exp_after:wN - \q_no_value \l_keyval_sanitise_tl 9 \q_nil 9 + \tl_clear:N \l__keyval_sanitise_tl + \tl_set:Nn \l__keyval_sanitise_tl {#1} + \tl_replace_all:Nnn \l__keyval_sanitise_tl { = } { 8 } + \tl_replace_all:Nnn \l__keyval_sanitise_tl { , } { 9 } + \tl_clear:N \l__keyval_parse_tl + \exp_after:wN \__keyval_parse_elt:w \exp_after:wN + \q_no_value \l__keyval_sanitise_tl 9 \q_nil 9 \exp_after:wN \group_end: - \l_keyval_parse_tl + \l__keyval_parse_tl } } -\cs_new_protected:Npn \keyval_parse_elt:w #1 , +\cs_new_protected:Npn \__keyval_parse_elt:w #1 , { \tl_if_blank:oTF { \use_none:n #1 } - { \keyval_parse_elt:w \q_no_value } + { \__keyval_parse_elt:w \q_no_value } { \quark_if_nil:oF { \use_ii:nn #1 } { - \keyval_split_key_value:w #1 = = \q_stop - \keyval_parse_elt:w \q_no_value + \__keyval_split_key_value:w #1 = = \q_stop + \__keyval_parse_elt:w \q_no_value } } } -\cs_new_protected:Npn \keyval_split_key_value:w #1 = #2 \q_stop +\cs_new_protected:Npn \__keyval_split_key_value:w #1 = #2 \q_stop { - \keyval_split_key:w #1 \q_stop + \__keyval_split_key:w #1 \q_stop \str_if_eq:nnTF {#2} { = } { - \tl_put_right:Nx \l_keyval_parse_tl + \tl_put_right:Nx \l__keyval_parse_tl { \exp_not:c - { keyval_key_no_value_elt_ \int_use:N \g_keyval_level_int :n } - { \exp_not:o \l_keyval_key_tl } + { __keyval_key_no_value_elt_ \int_use:N \g__keyval_level_int :n } + { \exp_not:o \l__keyval_key_tl } } } { - \keyval_split_key_value_aux:wTF #2 \q_no_value \q_stop - { \keyval_split_value:w \q_nil #2 } - { \msg_kernel_error:nn { keyval } { misplaced-equals-sign } } + \__keyval_split_key_value:wTF #2 \q_no_value \q_stop + { \__keyval_split_value:w \q_nil #2 } + { \__msg_kernel_error:nn { kernel } { misplaced-equals-sign } } } } -\cs_new:Npn \keyval_split_key_value_aux:wTF #1 = #2#3 \q_stop +\cs_new:Npn \__keyval_split_key_value:wTF #1 = #2#3 \q_stop { \tl_if_head_eq_meaning:nNTF {#3} \q_no_value } -\cs_new_protected:Npn \keyval_split_key:w #1 \q_stop +\cs_new_protected:Npn \__keyval_split_key:w #1 \q_stop { - \tl_set:Nx \l_keyval_key_tl + \tl_set:Nx \l__keyval_key_tl { \exp_after:wN \tl_trim_spaces:n \exp_after:wN { \use_none:n #1 } } } -\cs_new_protected:Npn \keyval_split_value:w #1 = = +\cs_new_protected:Npn \__keyval_split_value:w #1 = = { - \tl_put_right:Nx \l_keyval_parse_tl + \tl_put_right:Nx \l__keyval_parse_tl { \exp_not:c - { keyval_key_value_elt_ \int_use:N \g_keyval_level_int :nn } - { \exp_not:o \l_keyval_key_tl } + { __keyval_key_value_elt_ \int_use:N \g__keyval_level_int :nn } + { \exp_not:o \l__keyval_key_tl } } - \tl_set:Nx \l_keyval_value_tl + \tl_set:Nx \l__keyval_value_tl { \exp_not:o { \use_none:nnn #1 \q_nil \q_nil } } - \tl_if_empty:NTF \l_keyval_value_tl - { \tl_put_right:Nn \l_keyval_parse_tl { { } } } + \tl_if_empty:NTF \l__keyval_value_tl + { \tl_put_right:Nn \l__keyval_parse_tl { { } } } { - \quark_if_nil:NTF \l_keyval_value_tl + \quark_if_nil:NTF \l__keyval_value_tl { - \tl_put_right:Nx \l_keyval_parse_tl + \tl_put_right:Nx \l__keyval_parse_tl { { \exp_not:o { \use_ii:nnn #1 \q_nil } } } } - { \keyval_split_value_aux:w #1 \q_stop } + { \__keyval_split_value_aux:w #1 \q_stop } } } -\cs_new_protected:Npn \keyval_split_value_aux:w \q_nil #1 \q_stop +\cs_new_protected:Npn \__keyval_split_value_aux:w \q_nil #1 \q_stop { - \tl_set:Nx \l_keyval_value_tl { \tl_trim_spaces:n {#1} } - \tl_put_right:Nx \l_keyval_parse_tl - { { \exp_not:o \l_keyval_value_tl } } + \tl_set:Nx \l__keyval_value_tl { \tl_trim_spaces:n {#1} } + \tl_put_right:Nx \l__keyval_parse_tl + { { \exp_not:o \l__keyval_value_tl } } } \cs_new_protected:Npn \keyval_parse:NNn #1#2#3 { - \int_gincr:N \g_keyval_level_int + \int_gincr:N \g__keyval_level_int \cs_gset_eq:cN - { keyval_key_no_value_elt_ \int_use:N \g_keyval_level_int :n } #1 + { __keyval_key_no_value_elt_ \int_use:N \g__keyval_level_int :n } #1 \cs_gset_eq:cN - { keyval_key_value_elt_ \int_use:N \g_keyval_level_int :nn } #2 - \keyval_parse:n {#3} - \int_gdecr:N \g_keyval_level_int + { __keyval_key_value_elt_ \int_use:N \g__keyval_level_int :nn } #2 + \__keyval_parse:n {#3} + \int_gdecr:N \g__keyval_level_int } -\msg_kernel_new:nnnn { keyval } { misplaced-equals-sign } +\__msg_kernel_new:nnnn { kernel } { misplaced-equals-sign } { Misplaced~equals~sign~in~key-value~input~\msg_line_number: } { LaTeX~is~attempting~to~parse~some~key-value~input~but~found~ two~equals~signs~not~separated~by~a~comma. } -\tl_const:Nn \c_keys_code_root_tl { key~code~>~ } -\tl_const:Nn \c_keys_vars_root_tl { key~var~>~ } -\tl_const:Nn \c_keys_props_root_tl { key~prop~>~ } -\tl_const:Nn \c_keys_value_forbidden_tl { forbidden } -\tl_const:Nn \c_keys_value_required_tl { required } +\tl_const:Nn \c__keys_code_root_tl { key~code~>~ } +\tl_const:Nn \c__keys_vars_root_tl { key~var~>~ } +\tl_const:Nn \c__keys_props_root_tl { key~prop~>~ } +\tl_const:Nn \c__keys_value_forbidden_tl { forbidden } +\tl_const:Nn \c__keys_value_required_tl { required } \int_new:N \l_keys_choice_int -\tl_new:N \l_keys_choices_tl +\tl_new:N \l_keys_choice_tl \tl_new:N \l_keys_key_tl -\tl_new:N \l_keys_module_tl -\bool_new:N \l_keys_no_value_bool +\tl_new:N \l__keys_module_tl +\bool_new:N \l__keys_no_value_bool \tl_new:N \l_keys_path_tl -\tl_new:N \l_keys_property_tl -\tl_new:N \l_keys_unknown_clist +\tl_new:N \l__keys_property_tl +\tl_new:N \l__keys_unknown_clist \tl_new:N \l_keys_value_tl \cs_new_protected:Npn \keys_define:nn - { \keys_define_aux:onn \l_keys_module_tl } -\cs_new_protected:Npn \keys_define_aux:nnn #1#2#3 + { \__keys_define:onn \l__keys_module_tl } +\cs_new_protected:Npn \__keys_define:nnn #1#2#3 { - \tl_set:Nx \l_keys_module_tl { \tl_to_str:n {#2} } - \keyval_parse:NNn \keys_define_elt:n \keys_define_elt:nn {#3} - \tl_set:Nn \l_keys_module_tl {#1} + \tl_set:Nx \l__keys_module_tl { \tl_to_str:n {#2} } + \keyval_parse:NNn \__keys_define_elt:n \__keys_define_elt:nn {#3} + \tl_set:Nn \l__keys_module_tl {#1} } -\cs_generate_variant:Nn \keys_define_aux:nnn { o } -\cs_new_protected:Npn \keys_define_elt:n #1 +\cs_generate_variant:Nn \__keys_define:nnn { o } +\cs_new_protected:Npn \__keys_define_elt:n #1 { - \bool_set_true:N \l_keys_no_value_bool - \keys_define_elt_aux:nn {#1} { } + \bool_set_true:N \l__keys_no_value_bool + \__keys_define_elt_aux:nn {#1} { } } -\cs_new_protected:Npn \keys_define_elt:nn #1#2 +\cs_new_protected:Npn \__keys_define_elt:nn #1#2 { - \bool_set_false:N \l_keys_no_value_bool - \keys_define_elt_aux:nn {#1} {#2} + \bool_set_false:N \l__keys_no_value_bool + \__keys_define_elt_aux:nn {#1} {#2} } -\cs_new_protected:Npn \keys_define_elt_aux:nn #1#2 +\cs_new_protected:Npn \__keys_define_elt_aux:nn #1#2 { - \keys_property_find:n {#1} - \cs_if_exist:cTF { \c_keys_props_root_tl \l_keys_property_tl } - { \keys_define_key:n {#2} } + \__keys_property_find:n {#1} + \cs_if_exist:cTF { \c__keys_props_root_tl \l__keys_property_tl } + { \__keys_define_key:n {#2} } { - \msg_kernel_error:nnxx { keys } { property-unknown } - { \l_keys_property_tl } { \l_keys_path_tl } + \__msg_kernel_error:nnxx { kernel } { property-unknown } + { \l__keys_property_tl } { \l_keys_path_tl } } } -\cs_new_protected:Npn \keys_property_find:n #1 +\cs_new_protected:Npn \__keys_property_find:n #1 { - \tl_set:Nx \l_keys_path_tl { \l_keys_module_tl / } + \tl_set:Nx \l_keys_path_tl { \l__keys_module_tl / } \tl_if_in:nnTF {#1} { . } - { \keys_property_find_aux:w #1 \q_stop } - { \msg_kernel_error:nnx { keys } { key-no-property } {#1} } + { \__keys_property_find:w #1 \q_stop } + { \__msg_kernel_error:nnx { kernel } { key-no-property } {#1} } } -\cs_new_protected:Npn \keys_property_find_aux:w #1 . #2 \q_stop +\cs_new_protected:Npn \__keys_property_find:w #1 . #2 \q_stop { \tl_set:Nx \l_keys_path_tl { \l_keys_path_tl \tl_to_str:n {#1} } \tl_if_in:nnTF {#2} { . } { \tl_set:Nx \l_keys_path_tl { \l_keys_path_tl . } - \keys_property_find_aux:w #2 \q_stop + \__keys_property_find:w #2 \q_stop } - { \tl_set:Nn \l_keys_property_tl { . #2 } } + { \tl_set:Nn \l__keys_property_tl { . #2 } } } -\cs_new_protected:Npn \keys_define_key:n #1 +\cs_new_protected:Npn \__keys_define_key:n #1 { - \bool_if:NTF \l_keys_no_value_bool + \bool_if:NTF \l__keys_no_value_bool { - \exp_after:wN \keys_define_key_aux:w - \l_keys_property_tl \q_stop - { \use:c { \c_keys_props_root_tl \l_keys_property_tl } } + \exp_after:wN \__keys_define_key:w + \l__keys_property_tl \q_stop + { \use:c { \c__keys_props_root_tl \l__keys_property_tl } } { - \msg_kernel_error:nnxx { keys } - { property-requires-value } { \l_keys_property_tl } + \__msg_kernel_error:nnxx { kernel } + { property-requires-value } { \l__keys_property_tl } { \l_keys_path_tl } } } - { \use:c { \c_keys_props_root_tl \l_keys_property_tl } {#1} } + { \use:c { \c__keys_props_root_tl \l__keys_property_tl } {#1} } } -\cs_new_protected:Npn \keys_define_key_aux:w #1 : #2 \q_stop +\cs_new_protected:Npn \__keys_define_key:w #1 : #2 \q_stop { \tl_if_empty:nTF {#2} } -\cs_new:Npn \keys_bool_set:NN #1#2 +\cs_new:Npn \__keys_bool_set:NN #1#2 { \bool_if_exist:NF #1 { \bool_new:N #1 } - \keys_choice_make: - \keys_cmd_set:nx { \l_keys_path_tl / true } + \__keys_choice_make: + \__keys_cmd_set:nx { \l_keys_path_tl / true } { \exp_not:c { bool_ #2 set_true:N } \exp_not:N #1 } - \keys_cmd_set:nx { \l_keys_path_tl / false } + \__keys_cmd_set:nx { \l_keys_path_tl / false } { \exp_not:c { bool_ #2 set_false:N } \exp_not:N #1 } - \keys_cmd_set:nn { \l_keys_path_tl / unknown } + \__keys_cmd_set:nn { \l_keys_path_tl / unknown } { - \msg_kernel_error:nnx { keys } { boolean-values-only } + \__msg_kernel_error:nnx { kernel } { boolean-values-only } { \l_keys_key_tl } } - \keys_default_set:n { true } + \__keys_default_set:n { true } } -\cs_new:Npn \keys_bool_set_inverse:NN #1#2 +\cs_new:Npn \__keys_bool_set_inverse:NN #1#2 { \bool_if_exist:NF #1 { \bool_new:N #1 } - \keys_choice_make: - \keys_cmd_set:nx { \l_keys_path_tl / true } + \__keys_choice_make: + \__keys_cmd_set:nx { \l_keys_path_tl / true } { \exp_not:c { bool_ #2 set_false:N } \exp_not:N #1 } - \keys_cmd_set:nx { \l_keys_path_tl / false } + \__keys_cmd_set:nx { \l_keys_path_tl / false } { \exp_not:c { bool_ #2 set_true:N } \exp_not:N #1 } - \keys_cmd_set:nn { \l_keys_path_tl / unknown } + \__keys_cmd_set:nn { \l_keys_path_tl / unknown } { - \msg_kernel_error:nnx { keys } { boolean-values-only } + \__msg_kernel_error:nnx { kernel } { boolean-values-only } { \l_keys_key_tl } } - \keys_default_set:n { true } + \__keys_default_set:n { true } } -\cs_new_protected_nopar:Npn \keys_choice_make: +\cs_new_protected_nopar:Npn \__keys_choice_make: { - \keys_cmd_set:nn { \l_keys_path_tl } - { \keys_choice_find:n {##1} } - \keys_cmd_set:nn { \l_keys_path_tl / unknown } + \__keys_cmd_set:nn { \l_keys_path_tl } + { \__keys_choice_find:n {##1} } + \__keys_cmd_set:nn { \l_keys_path_tl / unknown } { - \msg_kernel_error:nnxx { keys } { choice-unknown } + \__msg_kernel_error:nnxx { kernel } { key-choice-unknown } { \l_keys_path_tl } {##1} } } -\cs_new_protected:Npn \keys_choices_make:nn #1#2 +\cs_new_protected:Npn \__keys_choices_make:nn #1#2 { - \keys_choice_make: + \__keys_choice_make: \int_zero:N \l_keys_choice_int \clist_map_inline:nn {#1} { - \keys_cmd_set:nx { \l_keys_path_tl / ##1 } + \int_incr:N \l_keys_choice_int + \__keys_cmd_set:nx { \l_keys_path_tl / ##1 } { \tl_set:Nn \exp_not:N \l_keys_choice_tl {##1} \int_set:Nn \exp_not:N \l_keys_choice_int { \int_use:N \l_keys_choice_int } \exp_not:n {#2} } - \int_incr:N \l_keys_choice_int } } -\cs_new_protected:Npn \keys_choices_generate:n #1 +\cs_new_protected:Npn \__keys_choices_generate:n #1 { \cs_if_exist:cTF - { \c_keys_vars_root_tl \l_keys_path_tl .choice~code } + { \c__keys_vars_root_tl \l_keys_path_tl .choice~code } { - \keys_choice_make: + \__keys_choice_make: \int_zero:N \l_keys_choice_int - \clist_map_function:nN {#1} \keys_choices_generate_aux:n + \clist_map_function:nN {#1} \__keys_choices_generate_aux:n } { - \msg_kernel_error:nnx { keys } + \__msg_kernel_error:nnx { kernel } { generate-choices-before-code } { \l_keys_path_tl } } } -\cs_new_protected:Npn \keys_choices_generate_aux:n #1 +\cs_new_protected:Npn \__keys_choices_generate_aux:n #1 { - \keys_cmd_set:nx { \l_keys_path_tl / #1 } + \int_incr:N \l_keys_choice_int + \__keys_cmd_set:nx { \l_keys_path_tl / #1 } { \tl_set:Nn \exp_not:N \l_keys_choice_tl {#1} \int_set:Nn \exp_not:N \l_keys_choice_int { \int_use:N \l_keys_choice_int } \exp_not:v - { \c_keys_vars_root_tl \l_keys_path_tl .choice~code } + { \c__keys_vars_root_tl \l_keys_path_tl .choice~code } } - \int_incr:N \l_keys_choice_int } -\cs_new_protected:Npn \keys_choice_code_store:x #1 +\cs_new_protected:Npn \__keys_choice_code_store:n #1 { \cs_if_exist:cF - { \c_keys_vars_root_tl \l_keys_path_tl .choice~code } + { \c__keys_vars_root_tl \l_keys_path_tl .choice~code } { \tl_new:c - { \c_keys_vars_root_tl \l_keys_path_tl .choice~code } + { \c__keys_vars_root_tl \l_keys_path_tl .choice~code } } - \tl_set:cx { \c_keys_vars_root_tl \l_keys_path_tl .choice~code } + \tl_set:cn { \c__keys_vars_root_tl \l_keys_path_tl .choice~code } {#1} } -\cs_new_protected:Npn \keys_cmd_set:nn #1#2 +\cs_generate_variant:Nn \__keys_choice_code_store:n { x } +\cs_new_protected:Npn \__keys_cmd_set:nn #1#2 + { + \__keys_cmd_set:n {#1} + \cs_set:cpn { \c__keys_code_root_tl #1 } ##1 {#2} + } +\cs_new_protected:Npn \__keys_cmd_set:nx #1#2 { - \keys_cmd_set_aux:n {#1} - \cs_set:cpn { \c_keys_code_root_tl #1 } ##1 {#2} + \__keys_cmd_set:n {#1} + \cs_set:cpx { \c__keys_code_root_tl #1 } ##1 {#2} } -\cs_new_protected:Npn \keys_cmd_set:nx #1#2 +\cs_generate_variant:Nn \__keys_cmd_set:nn { Vo } +\cs_new_protected:Npn \__keys_cmd_set:n #1 { - \keys_cmd_set_aux:n {#1} - \cs_set:cpx { \c_keys_code_root_tl #1 } ##1 {#2} + \tl_clear_new:c { \c__keys_vars_root_tl #1 .default } + \tl_set:cn { \c__keys_vars_root_tl #1 .default } { \q_no_value } + \tl_clear_new:c { \c__keys_vars_root_tl #1 .req } } -\cs_new_protected:Npn \keys_cmd_set_aux:n #1 +\cs_new_protected:Npn \__keys_default_set:n #1 + { \tl_set:cn { \c__keys_vars_root_tl \l_keys_path_tl .default } {#1} } +\cs_generate_variant:Nn \__keys_default_set:n { V } +\cs_new_protected:Npn \__keys_initialise:n #1 { - \tl_clear_new:c { \c_keys_vars_root_tl #1 .default } - \tl_set:cn { \c_keys_vars_root_tl #1 .default } { \q_no_value } - \tl_clear_new:c { \c_keys_vars_root_tl #1 .req } + \use:x + { \exp_after:wN \__keys_initialise:wn \l_keys_path_tl \q_stop {#1} } } -\cs_new_protected:Npn \keys_default_set:n #1 - { \tl_set:cn { \c_keys_vars_root_tl \l_keys_path_tl .default } {#1} } -\cs_generate_variant:Nn \keys_default_set:n { V } -\cs_new_protected:Npn \keys_meta_make:n #1 +\cs_generate_variant:Nn \__keys_initialise:n { V } +\cs_new:Npn \__keys_initialise:wn #1 / #2 \q_stop #3 + { \keys_set:nn {#1} { #2 = \exp_not:n { {#3} } } } +\cs_new_protected:Npn \__keys_meta_make:n #1 { - \exp_args:NNo \keys_cmd_set:nn \l_keys_path_tl - { \exp_after:wN \keys_set:nn \exp_after:wN { \l_keys_module_tl } {#1} } + \__keys_cmd_set:Vo \l_keys_path_tl + { \exp_after:wN \keys_set:nn \exp_after:wN { \l__keys_module_tl } {#1} } } -\cs_new_protected:Npn \keys_meta_make:x #1 +\cs_new_protected:Npn \__keys_meta_make:x #1 { - \keys_cmd_set:nx { \l_keys_path_tl } - { \exp_not:N \keys_set:nn { \l_keys_module_tl } {#1} } + \__keys_cmd_set:nx { \l_keys_path_tl } + { \exp_not:N \keys_set:nn { \l__keys_module_tl } {#1} } } -\cs_new:Npn \keys_multichoice_find:n #1 - { \clist_map_function:nN {#1} \keys_choice_find:n } -\cs_new_protected_nopar:Npn \keys_multichoice_make: +\cs_new:Npn \__keys_multichoice_find:n #1 + { \clist_map_function:nN {#1} \__keys_choice_find:n } +\cs_new_protected_nopar:Npn \__keys_multichoice_make: { - \keys_cmd_set:nn { \l_keys_path_tl } - { \keys_multichoice_find:n {##1} } - \keys_cmd_set:nn { \l_keys_path_tl / unknown } + \__keys_cmd_set:nn { \l_keys_path_tl } + { \__keys_multichoice_find:n {##1} } + \__keys_cmd_set:nn { \l_keys_path_tl / unknown } { - \msg_kernel_error:nnxx { keys } { choice-unknown } + \__msg_kernel_error:nnxx { kernel } { key-choice-unknown } { \l_keys_path_tl } {##1} } } -\cs_new_protected:Npn \keys_multichoices_make:nn #1#2 +\cs_new_protected:Npn \__keys_multichoices_make:nn #1#2 { - \keys_multichoice_make: + \__keys_multichoice_make: \int_zero:N \l_keys_choice_int \clist_map_inline:nn {#1} { - \keys_cmd_set:nx { \l_keys_path_tl / ##1 } + \int_incr:N \l_keys_choice_int + \__keys_cmd_set:nx { \l_keys_path_tl / ##1 } { \tl_set:Nn \exp_not:N \l_keys_choice_tl {##1} \int_set:Nn \exp_not:N \l_keys_choice_int { \int_use:N \l_keys_choice_int } \exp_not:n {#2} } - \int_incr:N \l_keys_choice_int } } -\cs_new_protected:Npn \keys_value_requirement:n #1 +\cs_new_protected:Npn \__keys_value_requirement:n #1 { \tl_set_eq:cc - { \c_keys_vars_root_tl \l_keys_path_tl .req } - { c_keys_value_ #1 _tl } + { \c__keys_vars_root_tl \l_keys_path_tl .req } + { c__keys_value_ #1 _tl } } -\cs_new_protected:Npn \keys_variable_set:NnNN #1#2#3#4 +\cs_new_protected:Npn \__keys_variable_set:NnNN #1#2#3#4 { \use:c { #2_if_exist:NF } #1 { \use:c { #2 _new:N } #1 } - \keys_cmd_set:nx { \l_keys_path_tl } + \__keys_cmd_set:nx { \l_keys_path_tl } { \exp_not:c { #2 _ #3 set:N #4 } \exp_not:N #1 {##1} } } -\cs_new_protected:Npn \keys_variable_set:NnN #1#2#3 - { \keys_variable_set:NnNN #1 {#2} { } #3 } -\cs_generate_variant:Nn \keys_variable_set:NnNN { c } -\cs_generate_variant:Nn \keys_variable_set:NnN { c } -\cs_new_protected:cpn { \c_keys_props_root_tl .bool_set:N } #1 - { \keys_bool_set:NN #1 { } } -\cs_new_protected:cpn { \c_keys_props_root_tl .bool_gset:N } #1 - { \keys_bool_set:NN #1 g } -\cs_new_protected:cpn { \c_keys_props_root_tl .bool_set_inverse:N } #1 - { \keys_bool_set_inverse:NN #1 { } } -\cs_new_protected:cpn { \c_keys_props_root_tl .bool_gset_inverse:N } #1 - { \keys_bool_set_inverse:NN #1 g } -\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .choice: } - { \keys_choice_make: } -\cs_new_protected:cpn { \c_keys_props_root_tl .choices:nn } #1 - { \keys_choices_make:nn #1 } -\cs_new_protected:cpn { \c_keys_props_root_tl .code:n } #1 - { \keys_cmd_set:nn { \l_keys_path_tl } {#1} } -\cs_new_protected:cpn { \c_keys_props_root_tl .code:x } #1 - { \keys_cmd_set:nx { \l_keys_path_tl } {#1} } -\cs_new_protected:cpn { \c_keys_props_root_tl .choice_code:n } #1 - { \keys_choice_code_store:x { \exp_not:n {#1} } } -\cs_new_protected:cpn { \c_keys_props_root_tl .choice_code:x } #1 - { \keys_choice_code_store:x {#1} } -\cs_new_protected:cpn { \c_keys_props_root_tl .clist_set:N } #1 - { \keys_variable_set:NnN #1 { clist } n } -\cs_new_protected:cpn { \c_keys_props_root_tl .clist_set:c } #1 - { \keys_variable_set:cnN {#1} { clist } n } -\cs_new_protected:cpn { \c_keys_props_root_tl .clist_gset:N } #1 - { \keys_variable_set:NnNN #1 { clist } g n } -\cs_new_protected:cpn { \c_keys_props_root_tl .clist_gset:c } #1 - { \keys_variable_set:cnNN {#1} { clist } g n } -\cs_new_protected:cpn { \c_keys_props_root_tl .default:n } #1 - { \keys_default_set:n {#1} } -\cs_new_protected:cpn { \c_keys_props_root_tl .default:V } #1 - { \keys_default_set:V #1 } -\cs_new_protected:cpn { \c_keys_props_root_tl .dim_set:N } #1 - { \keys_variable_set:NnN #1 { dim } n } -\cs_new_protected:cpn { \c_keys_props_root_tl .dim_set:c } #1 - { \keys_variable_set:cnN {#1} { dim } n } -\cs_new_protected:cpn { \c_keys_props_root_tl .dim_gset:N } #1 - { \keys_variable_set:NnNN #1 { dim } g n } -\cs_new_protected:cpn { \c_keys_props_root_tl .dim_gset:c } #1 - { \keys_variable_set:cnNN {#1} { dim } g n } -\cs_new_protected:cpn { \c_keys_props_root_tl .fp_set:N } #1 - { \keys_variable_set:NnN #1 { fp } n } -\cs_new_protected:cpn { \c_keys_props_root_tl .fp_set:c } #1 - { \keys_variable_set:cnN {#1} { fp } n } -\cs_new_protected:cpn { \c_keys_props_root_tl .fp_gset:N } #1 - { \keys_variable_set:NnNN #1 { fp } g n } -\cs_new_protected:cpn { \c_keys_props_root_tl .fp_gset:c } #1 - { \keys_variable_set:cnNN {#1} { fp } g n } -\cs_new_protected:cpn { \c_keys_props_root_tl .generate_choices:n } #1 - { \keys_choices_generate:n {#1} } -\cs_new_protected:cpn { \c_keys_props_root_tl .int_set:N } #1 - { \keys_variable_set:NnN #1 { int } n } -\cs_new_protected:cpn { \c_keys_props_root_tl .int_set:c } #1 - { \keys_variable_set:cnN {#1} { int } n } -\cs_new_protected:cpn { \c_keys_props_root_tl .int_gset:N } #1 - { \keys_variable_set:NnNN #1 { int } g n } -\cs_new_protected:cpn { \c_keys_props_root_tl .int_gset:c } #1 - { \keys_variable_set:cnNN {#1} { int } g n } -\cs_new_protected:cpn { \c_keys_props_root_tl .meta:n } #1 - { \keys_meta_make:n {#1} } -\cs_new_protected:cpn { \c_keys_props_root_tl .meta:x } #1 - { \keys_meta_make:x {#1} } -\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .multichoice: } - { \keys_multichoice_make: } -\cs_new_protected:cpn { \c_keys_props_root_tl .multichoices:nn } #1 - { \keys_multichoices_make:nn #1 } -\cs_new_protected:cpn { \c_keys_props_root_tl .skip_set:N } #1 - { \keys_variable_set:NnN #1 { skip } n } -\cs_new_protected:cpn { \c_keys_props_root_tl .skip_set:c } #1 - { \keys_variable_set:cnN {#1} { skip } n } -\cs_new_protected:cpn { \c_keys_props_root_tl .skip_gset:N } #1 - { \keys_variable_set:NnNN #1 { skip } g n } -\cs_new_protected:cpn { \c_keys_props_root_tl .skip_gset:c } #1 - { \keys_variable_set:cnNN {#1} { skip } g n } -\cs_new_protected:cpn { \c_keys_props_root_tl .tl_set:N } #1 - { \keys_variable_set:NnN #1 { tl } n } -\cs_new_protected:cpn { \c_keys_props_root_tl .tl_set:c } #1 - { \keys_variable_set:cnN {#1} { tl } n } -\cs_new_protected:cpn { \c_keys_props_root_tl .tl_set_x:N } #1 - { \keys_variable_set:NnN #1 { tl } x } -\cs_new_protected:cpn { \c_keys_props_root_tl .tl_set_x:c } #1 - { \keys_variable_set:cnN {#1} { tl } x } -\cs_new_protected:cpn { \c_keys_props_root_tl .tl_gset:N } #1 - { \keys_variable_set:NnNN #1 { tl } g n } -\cs_new_protected:cpn { \c_keys_props_root_tl .tl_gset:c } #1 - { \keys_variable_set:cnNN {#1} { tl } g n } -\cs_new_protected:cpn { \c_keys_props_root_tl .tl_gset_x:N } #1 - { \keys_variable_set:NnNN #1 { tl } g x } -\cs_new_protected:cpn { \c_keys_props_root_tl .tl_gset_x:c } #1 - { \keys_variable_set:cnNN {#1} { tl } g x } -\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .value_forbidden: } - { \keys_value_requirement:n { forbidden } } -\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .value_required: } - { \keys_value_requirement:n { required } } +\cs_new_protected:Npn \__keys_variable_set:NnN #1#2#3 + { \__keys_variable_set:NnNN #1 {#2} { } #3 } +\cs_generate_variant:Nn \__keys_variable_set:NnNN { c } +\cs_generate_variant:Nn \__keys_variable_set:NnN { c } +\cs_new_protected:cpn { \c__keys_props_root_tl .bool_set:N } #1 + { \__keys_bool_set:NN #1 { } } +\cs_new_protected:cpn { \c__keys_props_root_tl .bool_gset:N } #1 + { \__keys_bool_set:NN #1 g } +\cs_new_protected:cpn { \c__keys_props_root_tl .bool_set_inverse:N } #1 + { \__keys_bool_set_inverse:NN #1 { } } +\cs_new_protected:cpn { \c__keys_props_root_tl .bool_gset_inverse:N } #1 + { \__keys_bool_set_inverse:NN #1 g } +\cs_new_protected_nopar:cpn { \c__keys_props_root_tl .choice: } + { \__keys_choice_make: } +\cs_new_protected:cpn { \c__keys_props_root_tl .choices:nn } #1 + { \__keys_choices_make:nn #1 } +\cs_new_protected:cpn { \c__keys_props_root_tl .code:n } #1 + { \__keys_cmd_set:nn { \l_keys_path_tl } {#1} } +\cs_new_protected:cpn { \c__keys_props_root_tl .code:x } #1 + { \__keys_cmd_set:nx { \l_keys_path_tl } {#1} } +\cs_new_protected:cpn { \c__keys_props_root_tl .choice_code:n } #1 + { \__keys_choice_code_store:n {#1} } +\cs_new_protected:cpn { \c__keys_props_root_tl .choice_code:x } #1 + { \__keys_choice_code_store:x {#1} } +\cs_new_protected:cpn { \c__keys_props_root_tl .clist_set:N } #1 + { \__keys_variable_set:NnN #1 { clist } n } +\cs_new_protected:cpn { \c__keys_props_root_tl .clist_set:c } #1 + { \__keys_variable_set:cnN {#1} { clist } n } +\cs_new_protected:cpn { \c__keys_props_root_tl .clist_gset:N } #1 + { \__keys_variable_set:NnNN #1 { clist } g n } +\cs_new_protected:cpn { \c__keys_props_root_tl .clist_gset:c } #1 + { \__keys_variable_set:cnNN {#1} { clist } g n } +\cs_new_protected:cpn { \c__keys_props_root_tl .default:n } #1 + { \__keys_default_set:n {#1} } +\cs_new_protected:cpn { \c__keys_props_root_tl .default:V } #1 + { \__keys_default_set:V #1 } +\cs_new_protected:cpn { \c__keys_props_root_tl .dim_set:N } #1 + { \__keys_variable_set:NnN #1 { dim } n } +\cs_new_protected:cpn { \c__keys_props_root_tl .dim_set:c } #1 + { \__keys_variable_set:cnN {#1} { dim } n } +\cs_new_protected:cpn { \c__keys_props_root_tl .dim_gset:N } #1 + { \__keys_variable_set:NnNN #1 { dim } g n } +\cs_new_protected:cpn { \c__keys_props_root_tl .dim_gset:c } #1 + { \__keys_variable_set:cnNN {#1} { dim } g n } +\cs_new_protected:cpn { \c__keys_props_root_tl .fp_set:N } #1 + { \__keys_variable_set:NnN #1 { fp } n } +\cs_new_protected:cpn { \c__keys_props_root_tl .fp_set:c } #1 + { \__keys_variable_set:cnN {#1} { fp } n } +\cs_new_protected:cpn { \c__keys_props_root_tl .fp_gset:N } #1 + { \__keys_variable_set:NnNN #1 { fp } g n } +\cs_new_protected:cpn { \c__keys_props_root_tl .fp_gset:c } #1 + { \__keys_variable_set:cnNN {#1} { fp } g n } +\cs_new_protected:cpn { \c__keys_props_root_tl .generate_choices:n } #1 + { \__keys_choices_generate:n {#1} } +\cs_new_protected:cpn { \c__keys_props_root_tl .initial:n } #1 + { \__keys_initialise:n {#1} } +\cs_new_protected:cpn { \c__keys_props_root_tl .initial:V } #1 + { \__keys_initialise:V #1 } +\cs_new_protected:cpn { \c__keys_props_root_tl .int_set:N } #1 + { \__keys_variable_set:NnN #1 { int } n } +\cs_new_protected:cpn { \c__keys_props_root_tl .int_set:c } #1 + { \__keys_variable_set:cnN {#1} { int } n } +\cs_new_protected:cpn { \c__keys_props_root_tl .int_gset:N } #1 + { \__keys_variable_set:NnNN #1 { int } g n } +\cs_new_protected:cpn { \c__keys_props_root_tl .int_gset:c } #1 + { \__keys_variable_set:cnNN {#1} { int } g n } +\cs_new_protected:cpn { \c__keys_props_root_tl .meta:n } #1 + { \__keys_meta_make:n {#1} } +\cs_new_protected:cpn { \c__keys_props_root_tl .meta:x } #1 + { \__keys_meta_make:x {#1} } +\cs_new_protected_nopar:cpn { \c__keys_props_root_tl .multichoice: } + { \__keys_multichoice_make: } +\cs_new_protected:cpn { \c__keys_props_root_tl .multichoices:nn } #1 + { \__keys_multichoices_make:nn #1 } +\cs_new_protected:cpn { \c__keys_props_root_tl .skip_set:N } #1 + { \__keys_variable_set:NnN #1 { skip } n } +\cs_new_protected:cpn { \c__keys_props_root_tl .skip_set:c } #1 + { \__keys_variable_set:cnN {#1} { skip } n } +\cs_new_protected:cpn { \c__keys_props_root_tl .skip_gset:N } #1 + { \__keys_variable_set:NnNN #1 { skip } g n } +\cs_new_protected:cpn { \c__keys_props_root_tl .skip_gset:c } #1 + { \__keys_variable_set:cnNN {#1} { skip } g n } +\cs_new_protected:cpn { \c__keys_props_root_tl .tl_set:N } #1 + { \__keys_variable_set:NnN #1 { tl } n } +\cs_new_protected:cpn { \c__keys_props_root_tl .tl_set:c } #1 + { \__keys_variable_set:cnN {#1} { tl } n } +\cs_new_protected:cpn { \c__keys_props_root_tl .tl_set_x:N } #1 + { \__keys_variable_set:NnN #1 { tl } x } +\cs_new_protected:cpn { \c__keys_props_root_tl .tl_set_x:c } #1 + { \__keys_variable_set:cnN {#1} { tl } x } +\cs_new_protected:cpn { \c__keys_props_root_tl .tl_gset:N } #1 + { \__keys_variable_set:NnNN #1 { tl } g n } +\cs_new_protected:cpn { \c__keys_props_root_tl .tl_gset:c } #1 + { \__keys_variable_set:cnNN {#1} { tl } g n } +\cs_new_protected:cpn { \c__keys_props_root_tl .tl_gset_x:N } #1 + { \__keys_variable_set:NnNN #1 { tl } g x } +\cs_new_protected:cpn { \c__keys_props_root_tl .tl_gset_x:c } #1 + { \__keys_variable_set:cnNN {#1} { tl } g x } +\cs_new_protected_nopar:cpn { \c__keys_props_root_tl .value_forbidden: } + { \__keys_value_requirement:n { forbidden } } +\cs_new_protected_nopar:cpn { \c__keys_props_root_tl .value_required: } + { \__keys_value_requirement:n { required } } \cs_new_protected:Npn \keys_set:nn - { \keys_set_aux:onn { \l_keys_module_tl } } -\cs_new_protected:Npn \keys_set_aux:nnn #1#2#3 + { \__keys_set:onn { \l__keys_module_tl } } +\cs_new_protected:Npn \__keys_set:nnn #1#2#3 { - \tl_set:Nx \l_keys_module_tl { \tl_to_str:n {#2} } - \keyval_parse:NNn \keys_set_elt:n \keys_set_elt:nn {#3} - \tl_set:Nn \l_keys_module_tl {#1} + \tl_set:Nx \l__keys_module_tl { \tl_to_str:n {#2} } + \keyval_parse:NNn \__keys_set_elt:n \__keys_set_elt:nn {#3} + \tl_set:Nn \l__keys_module_tl {#1} } \cs_generate_variant:Nn \keys_set:nn { nV , nv , no } -\cs_generate_variant:Nn \keys_set_aux:nnn { o } +\cs_generate_variant:Nn \__keys_set:nnn { o } \cs_new_protected:Npn \keys_set_known:nnN - { \keys_set_known_aux:onnN { \l_keys_module_tl } } -\cs_new_protected:Npn \keys_set_known_aux:nnnN #1#2#3#4 + { \__keys_set_known:onnN { \l__keys_module_tl } } +\cs_new_protected:Npn \__keys_set_known:nnnN #1#2#3#4 { - \tl_set:Nx \l_keys_module_tl { \tl_to_str:n {#2} } - \clist_clear:N \l_keys_unknown_clist - \cs_set_eq:NN \keys_execute_unknown: \keys_execute_unknown_alt: - \keyval_parse:NNn \keys_set_elt:n \keys_set_elt:nn {#3} - \cs_set_eq:NN \keys_execute_unknown: \keys_execute_unknown_std: - \tl_set:Nn \l_keys_module_tl {#1} - \clist_set_eq:NN #4 \l_keys_unknown_clist + \tl_set:Nx \l__keys_module_tl { \tl_to_str:n {#2} } + \clist_clear:N \l__keys_unknown_clist + \cs_set_eq:NN \__keys_execute_unknown: \__keys_execute_unknown_alt: + \keyval_parse:NNn \__keys_set_elt:n \__keys_set_elt:nn {#3} + \cs_set_eq:NN \__keys_execute_unknown: \__keys_execute_unknown_std: + \tl_set:Nn \l__keys_module_tl {#1} + \clist_set_eq:NN #4 \l__keys_unknown_clist } \cs_generate_variant:Nn \keys_set_known:nnN { nV , nv , no } -\cs_generate_variant:Nn \keys_set_known_aux:nnnN { o } -\cs_new_protected:Npn \keys_set_elt:n #1 +\cs_generate_variant:Nn \__keys_set_known:nnnN { o } +\cs_new_protected:Npn \__keys_set_elt:n #1 { - \bool_set_true:N \l_keys_no_value_bool - \keys_set_elt_aux:nn {#1} { } + \bool_set_true:N \l__keys_no_value_bool + \__keys_set_elt_aux:nn {#1} { } } -\cs_new_protected:Npn \keys_set_elt:nn #1#2 +\cs_new_protected:Npn \__keys_set_elt:nn #1#2 { - \bool_set_false:N \l_keys_no_value_bool - \keys_set_elt_aux:nn {#1} {#2} + \bool_set_false:N \l__keys_no_value_bool + \__keys_set_elt_aux:nn {#1} {#2} } -\cs_new_protected:Npn \keys_set_elt_aux:nn #1#2 +\cs_new_protected:Npn \__keys_set_elt_aux:nn #1#2 { \tl_set:Nx \l_keys_key_tl { \tl_to_str:n {#1} } - \tl_set:Nx \l_keys_path_tl { \l_keys_module_tl / \l_keys_key_tl } - \keys_value_or_default:n {#2} + \tl_set:Nx \l_keys_path_tl { \l__keys_module_tl / \l_keys_key_tl } + \__keys_value_or_default:n {#2} \bool_if:nTF { - \keys_if_value_p:n { required } && - \l_keys_no_value_bool + \__keys_if_value_p:n { required } && + \l__keys_no_value_bool } { - \msg_kernel_error:nnx { keys } { value-required } + \__msg_kernel_error:nnx { kernel } { value-required } { \l_keys_path_tl } } { \bool_if:nTF { - \keys_if_value_p:n { forbidden } && - ! \l_keys_no_value_bool + \__keys_if_value_p:n { forbidden } && + ! \l__keys_no_value_bool } { - \msg_kernel_error:nnxx { keys } { value-forbidden } + \__msg_kernel_error:nnxx { kernel } { value-forbidden } { \l_keys_path_tl } { \l_keys_value_tl } } - { \keys_execute: } + { \__keys_execute: } } } -\cs_new_protected:Npn \keys_value_or_default:n #1 +\cs_new_protected:Npn \__keys_value_or_default:n #1 { \tl_set:Nn \l_keys_value_tl {#1} - \bool_if:NT \l_keys_no_value_bool + \bool_if:NT \l__keys_no_value_bool { - \quark_if_no_value:cF { \c_keys_vars_root_tl \l_keys_path_tl .default } + \quark_if_no_value:cF { \c__keys_vars_root_tl \l_keys_path_tl .default } { - \cs_if_exist:cT { \c_keys_vars_root_tl \l_keys_path_tl .default } + \cs_if_exist:cT { \c__keys_vars_root_tl \l_keys_path_tl .default } { \tl_set_eq:Nc \l_keys_value_tl - { \c_keys_vars_root_tl \l_keys_path_tl .default } + { \c__keys_vars_root_tl \l_keys_path_tl .default } } } } } -\prg_new_conditional:Npnn \keys_if_value:n #1 { p } +\prg_new_conditional:Npnn \__keys_if_value:n #1 { p } { - \tl_if_eq:ccTF { c_keys_value_ #1 _tl } - { \c_keys_vars_root_tl \l_keys_path_tl .req } + \tl_if_eq:ccTF { c__keys_value_ #1 _tl } + { \c__keys_vars_root_tl \l_keys_path_tl .req } { \prg_return_true: } { \prg_return_false: } } -\cs_new_nopar:Npn \keys_execute: - { \keys_execute:nn { \l_keys_path_tl } { \keys_execute_unknown: } } -\cs_new_nopar:Npn \keys_execute_unknown: +\cs_new_nopar:Npn \__keys_execute: + { \__keys_execute:nn { \l_keys_path_tl } { \__keys_execute_unknown: } } +\cs_new_nopar:Npn \__keys_execute_unknown: { - \keys_execute:nn { \l_keys_module_tl / unknown } + \__keys_execute:nn { \l__keys_module_tl / unknown } { - \msg_kernel_error:nnxx { keys } { key-unknown } - { \l_keys_path_tl } { \l_keys_module_tl } + \__msg_kernel_error:nnxx { kernel } { key-unknown } + { \l_keys_path_tl } { \l__keys_module_tl } } } -\cs_new_eq:NN \keys_execute_unknown_std: \keys_execute_unknown: -\cs_new_nopar:Npn \keys_execute_unknown_alt: +\cs_new_eq:NN \__keys_execute_unknown_std: \__keys_execute_unknown: +\cs_new_nopar:Npn \__keys_execute_unknown_alt: { - \clist_put_right:Nx \l_keys_unknown_clist + \clist_put_right:Nx \l__keys_unknown_clist { \exp_not:o \l_keys_key_tl - \bool_if:NF \l_keys_no_value_bool + \bool_if:NF \l__keys_no_value_bool { = { \exp_not:o \l_keys_value_tl } } } } -\cs_new:Npn \keys_execute:nn #1#2 +\cs_new:Npn \__keys_execute:nn #1#2 { - \cs_if_exist:cTF { \c_keys_code_root_tl #1 } + \cs_if_exist:cTF { \c__keys_code_root_tl #1 } { - \exp_args:Nc \exp_args:No { \c_keys_code_root_tl #1 } + \exp_args:Nc \exp_args:No { \c__keys_code_root_tl #1 } \l_keys_value_tl } {#2} } -\cs_new:Npn \keys_choice_find:n #1 +\cs_new:Npn \__keys_choice_find:n #1 { - \keys_execute:nn { \l_keys_path_tl / \tl_to_str:n {#1} } - { \keys_execute:nn { \l_keys_path_tl / unknown } { } } + \__keys_execute:nn { \l_keys_path_tl / \tl_to_str:n {#1} } + { \__keys_execute:nn { \l_keys_path_tl / unknown } { } } } \prg_new_conditional:Npnn \keys_if_exist:nn #1#2 { p , T , F , TF } { - \cs_if_exist:cTF { \c_keys_code_root_tl #1 / #2 } + \cs_if_exist:cTF { \c__keys_code_root_tl #1 / #2 } { \prg_return_true: } { \prg_return_false: } } \prg_new_conditional:Npnn \keys_if_choice_exist:nnn #1#2#3 { p , T , F , TF } { - \cs_if_exist:cTF { \c_keys_code_root_tl #1 / #2 / #3 } + \cs_if_exist:cTF { \c__keys_code_root_tl #1 / #2 / #3 } { \prg_return_true: } { \prg_return_false: } } \cs_new:Npn \keys_show:nn #1#2 - { \cs_show:c { \c_keys_code_root_tl #1 / \tl_to_str:n {#2} } } -\msg_kernel_new:nnnn { keys } { boolean-values-only } + { \cs_show:c { \c__keys_code_root_tl #1 / \tl_to_str:n {#2} } } +\__msg_kernel_new:nnnn { kernel } { boolean-values-only } { Key~'#1'~accepts~boolean~values~only. } { The~key~'#1'~only~accepts~the~values~'true'~and~'false'. } -\msg_kernel_new:nnnn { keys } { choice-unknown } +\__msg_kernel_new:nnnn { kernel } { choice-unknown } { Choice~'#2'~unknown~for~key~'#1'. } { The~key~'#1'~takes~a~limited~number~of~values.\\ The~input~given,~'#2',~is~not~on~the~list~accepted. } -\msg_kernel_new:nnnn { keys } { generate-choices-before-code } +\__msg_kernel_new:nnnn { kernel } { generate-choices-before-code } { No~code~available~to~generate~choices~for~key~'#1'. } { \c_msg_coding_error_text_tl Before~using~.generate_choices:n~the~code~should~be~defined~ with~'.choice_code:n'~or~'.choice_code:x'. } -\msg_kernel_new:nnnn { keys } { key-no-property } +\__msg_kernel_new:nnnn { kernel } { key-no-property } { No~property~given~in~definition~of~key~'#1'. } { \c_msg_coding_error_text_tl @@ -651,44 +665,39 @@ ~ ~ #1 .<property> \\ LaTeX~did~not~find~a~'.'~to~indicate~the~start~of~a~property. } -\msg_kernel_new:nnnn { keys } { key-unknown } +\__msg_kernel_new:nnnn { kernel } { key-unknown } { The~key~'#1'~is~unknown~and~is~being~ignored. } { The~module~'#2'~does~not~have~a~key~called~#1'.\\ Check~that~you~have~spelled~the~key~name~correctly. } -\msg_kernel_new:nnnn { keys } { option-unknown } - { Unknown~option~'#1'~for~package~#2. } - { - LaTeX~has~been~asked~to~set~an~option~called~'#1'~ - but~the~#2~package~has~not~created~an~option~with~this~name. - } -\msg_kernel_new:nnnn { keys } { property-requires-value } +\__msg_kernel_new:nnnn { kernel } { property-requires-value } { The~property~'#1'~requires~a~value. } { \c_msg_coding_error_text_tl LaTeX~was~asked~to~set~property~'#2'~for~key~'#1'.\\ No~value~was~given~for~the~property,~and~one~is~required. } -\msg_kernel_new:nnnn { keys } { property-unknown } +\__msg_kernel_new:nnnn { kernel } { property-unknown } { The~key~property~'#1'~is~unknown. } { \c_msg_coding_error_text_tl LaTeX~has~been~asked~to~set~the~property~'#1'~for~key~'#2':~ this~property~is~not~defined. } -\msg_kernel_new:nnnn { keys } { value-forbidden } +\__msg_kernel_new:nnnn { kernel } { value-forbidden } { The~key~'#1'~does~not~taken~a~value. } { The~key~'#1'~should~be~given~without~a~value.\\ LaTeX~will~ignore~the~given~value~'#2'. } -\msg_kernel_new:nnnn { keys } { value-required } +\__msg_kernel_new:nnnn { kernel } { value-required } { The~key~'#1'~requires~a~value. } { The~key~'#1'~must~have~a~value.\\ No~value~was~present:~the~key~will~be~ignored. } +\cs_new_eq:NN \c_keys_code_root_tl \c__keys_code_root_tl %% %% %% End of file `l3keys.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3luatex.sty b/Master/texmf-dist/tex/latex/l3kernel/l3luatex.sty index 7655ba4ae08..c6050b44f98 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3luatex.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3luatex.sty @@ -46,17 +46,11 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3luatex.dtx 3355 2012-02-09 07:18:22Z joseph $ +\GetIdInfo$Id: l3luatex.dtx 3986 2012-07-15 19:23:51Z joseph $ {L3 Experimental LuaTeX-specific functions} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\package_check_loaded_expl: -\msg_kernel_new:nnnn { luatex } { bad-engine } - { LuaTeX~engine~not~in~use!~Ignoring~#1. } - { - The~feature~you~are~using~is~only~available~ - with~the~LuaTeX~engine.~LaTeX3~ignored~`#1#2'. - } +\__expl_package_check: \luatex_if_engine:TF { \cs_new_eq:NN \lua_now:x \luatex_directlua:D @@ -65,13 +59,13 @@ { \cs_new:Npn \lua_now:x #1 { - \msg_expandable_kernel_error:nnn - { luatex } { bad-engine } { \lua_now:x } + \__msg_kernel_expandable_error:nnn + { kernel } { bad-engine } { \lua_now:x } } \cs_new_protected:Npn \lua_shipout_x:n #1 { - \msg_expandable_kernel_error:nnn - { luatex } { bad-engine } { \lua_shipout_x:n } + \__msg_kernel_expandable_error:nnn + { kernel } { bad-engine } { \lua_shipout_x:n } } } \cs_new:Npn \lua_now:n #1 @@ -80,27 +74,27 @@ \cs_new_protected:Npn \lua_shipout:n #1 { \lua_shipout_x:n { \exp_not:n {#1} } } \cs_generate_variant:Nn \lua_shipout:n { x } -\int_new:N \g_cctab_allocate_int -\int_set:Nn \g_cctab_allocate_int { \c_minus_one } -\int_new:N \g_cctab_stack_int -\seq_new:N \g_cctab_stack_seq +\int_new:N \g__cctab_allocate_int +\int_set:Nn \g__cctab_allocate_int { \c_minus_one } +\int_new:N \g__cctab_stack_int +\seq_new:N \g__cctab_stack_seq \cs_new_protected:Npn \cctab_new:N #1 { - \chk_if_free_cs:N #1 - \int_gadd:Nn \g_cctab_allocate_int { \c_two } + \__chk_if_free_cs:N #1 + \int_gadd:Nn \g__cctab_allocate_int { \c_two } \int_compare:nNnTF - \g_cctab_allocate_int < { \c_max_register_int + \c_one } + \g__cctab_allocate_int < { \c_max_register_int + \c_one } { - \tex_global:D \tex_chardef:D #1 \g_cctab_allocate_int + \tex_global:D \tex_chardef:D #1 \g__cctab_allocate_int \luatex_initcatcodetable:D #1 } - { \msg_kernel_fatal:nnx { kernel } { out-of-registers } { cctab } } + { \__msg_kernel_fatal:nnx { kernel } { out-of-registers } { cctab } } } \luatex_if_engine:F { \cs_set_protected:Npn \cctab_new:N #1 { - \msg_kernel_error:nnx { luatex } { bad-engine } + \__msg_kernel_error:nnx { kernel } { bad-engine } { \exp_not:N \cctab_new:N } } } @@ -108,39 +102,39 @@ { \cs_set_protected:Npn \cctab_new:N #1 { - \chk_if_free_cs:N #1 + \__chk_if_free_cs:N #1 \newcatcodetable #1 \luatex_initcatcodetable:D #1 } } \cs_new_protected:Npn \cctab_begin:N #1 { - \seq_gpush:Nx \g_cctab_stack_seq { \tex_the:D \luatex_catcodetable:D } + \seq_gpush:Nx \g__cctab_stack_seq { \tex_the:D \luatex_catcodetable:D } \luatex_catcodetable:D #1 - \int_gadd:Nn \g_cctab_stack_int { \c_two } - \int_compare:nNnT \g_cctab_stack_int > \c_max_register_int - { \msg_kernel_fatal:nn { code } { cctab-stack-full } } - \luatex_savecatcodetable:D \g_cctab_stack_int - \luatex_catcodetable:D \g_cctab_stack_int + \int_gadd:Nn \g__cctab_stack_int { \c_two } + \int_compare:nNnT \g__cctab_stack_int > \c_max_register_int + { \__msg_kernel_fatal:nn { kernel } { cctab-stack-full } } + \luatex_savecatcodetable:D \g__cctab_stack_int + \luatex_catcodetable:D \g__cctab_stack_int } \cs_new_protected_nopar:Npn \cctab_end: { - \int_gsub:Nn \g_cctab_stack_int { \c_two } - \seq_if_empty:NTF \g_cctab_stack_seq - { \tl_set:Nn \l_cctab_internal_tl { 0 } } - { \seq_gpop:NN \g_cctab_stack_seq \l_cctab_internal_tl } - \luatex_catcodetable:D \l_cctab_internal_tl \scan_stop: + \int_gsub:Nn \g__cctab_stack_int { \c_two } + \seq_if_empty:NTF \g__cctab_stack_seq + { \tl_set:Nn \l__cctab_internal_tl { 0 } } + { \seq_gpop:NN \g__cctab_stack_seq \l__cctab_internal_tl } + \luatex_catcodetable:D \l__cctab_internal_tl \scan_stop: } \luatex_if_engine:F { \cs_set_protected:Npn \cctab_begin:N #1 { - \msg_kernel_error:nnxx { luatex } { bad-engine } + \__msg_kernel_error:nnxx { kernel } { bad-engine } { \exp_not:N \cctab_begin:N } {#1} } \cs_set_protected_nopar:Npn \cctab_end: { - \msg_kernel_error:nnx { luatex } { bad-engine } + \__msg_kernel_error:nnx { kernel } { bad-engine } { \exp_not:N \cctab_end: } } } @@ -149,7 +143,7 @@ \cs_set_protected:Npn \cctab_begin:N #1 { \BeginCatcodeRegime #1 } \cs_set_protected_nopar:Npn \cctab_end: { \EndCatcodeRegime } } -\tl_new:N \l_cctab_internal_tl +\tl_new:N \l__cctab_internal_tl \cs_new_protected:Npn \cctab_gset:Nn #1#2 { \group_begin: @@ -161,7 +155,7 @@ { \cs_set_protected:Npn \cctab_gset:Nn #1#2 { - \msg_kernel_error:nnxx { luatex } { bad-engine } + \__msg_kernel_error:nnxx { kernel } { bad-engine } { \exp_not:N \cctab_gset:Nn } { #1 {#2} } } } @@ -177,7 +171,18 @@ \cs_new_eq:NN \c_other_cctab \CatcodeTableOther \cs_new_eq:NN \c_str_cctab \CatcodeTableString } -\cs_new_eq:NN \c_string_cctab \c_str_cctab +\__msg_kernel_new:nnnn { kernel } { bad-engine } + { LuaTeX~engine~not~in~use!~Ignoring~#1. } + { + The~feature~you~are~using~is~only~available~ + with~the~LuaTeX~engine.~LaTeX3~ignored~`#1#2'. + } +\__msg_kernel_new:nnnn { kernel } { cctab-stack-full } + { The~category~code~table~stack~is~exhausted. } + { + LaTeX~has~been~asked~to~switch~to~a~new~category~code~table,~ + but~there~is~no~more~space~to~do~this! + } %% %% %% End of file `l3luatex.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3msg.sty b/Master/texmf-dist/tex/latex/l3kernel/l3msg.sty index 2e5ae99d6a4..bfce368f0d0 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3msg.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3msg.sty @@ -46,59 +46,59 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3msg.dtx 3568 2012-04-23 13:23:58Z joseph $ - {L3 Experimental messages} +\GetIdInfo$Id: l3msg.dtx 3986 2012-07-15 19:23:51Z joseph $ + {L3 Messages} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\package_check_loaded_expl: -\tl_new:N \l_msg_internal_tl -\tl_const:Nn \c_msg_text_prefix_tl { msg~text~>~ } -\tl_const:Nn \c_msg_more_text_prefix_tl { msg~extra~text~>~ } +\__expl_package_check: +\tl_new:N \l__msg_internal_tl +\tl_const:Nn \c__msg_text_prefix_tl { msg~text~>~ } +\tl_const:Nn \c__msg_more_text_prefix_tl { msg~extra~text~>~ } \prg_new_conditional:Npnn \msg_if_exist:nn #1#2 { p , T , F , TF } { - \cs_if_exist:cTF { \c_msg_text_prefix_tl #1 / #2 } + \cs_if_exist:cTF { \c__msg_text_prefix_tl #1 / #2 } { \prg_return_true: } { \prg_return_false: } } -\cs_new_protected:Npn \chk_if_free_msg:nn #1#2 +\cs_new_protected:Npn \__chk_if_free_msg:nn #1#2 { \msg_if_exist:nnT {#1} {#2} { - \msg_kernel_error:nnxx { msg } { message-already-defined } + \__msg_kernel_error:nnxx { kernel } { message-already-defined } {#1} {#2} } } \tex_ifodd:D \l@expl@log@functions@bool - \cs_gset_protected:Npn \chk_if_free_msg:nn #1#2 + \cs_gset_protected:Npn \__chk_if_free_msg:nn #1#2 { \msg_if_exist:nnT {#1} {#2} { - \msg_kernel_error:nnxx { msg } { message-already-defined } + \__msg_kernel_error:nnxx { kernel } { message-already-defined } {#1} {#2} } - \iow_log:x { Defining~message~#1/#2~ \msg_line_context: } + \iow_log:x { Defining~message~ #1 / #2 ~\msg_line_context: } } \fi: \cs_new_protected:Npn \msg_new:nnnn #1#2 { - \chk_if_free_msg:nn {#1} {#2} + \__chk_if_free_msg:nn {#1} {#2} \msg_gset:nnnn {#1} {#2} } \cs_new_protected:Npn \msg_new:nnn #1#2#3 { \msg_new:nnnn {#1} {#2} {#3} { } } \cs_new_protected:Npn \msg_set:nnnn #1#2#3#4 { - \cs_set:cpn { \c_msg_text_prefix_tl #1 / #2 } + \cs_set:cpn { \c__msg_text_prefix_tl #1 / #2 } ##1##2##3##4 {#3} - \cs_set:cpn { \c_msg_more_text_prefix_tl #1 / #2 } + \cs_set:cpn { \c__msg_more_text_prefix_tl #1 / #2 } ##1##2##3##4 {#4} } \cs_new_protected:Npn \msg_set:nnn #1#2#3 { \msg_set:nnnn {#1} {#2} {#3} { } } \cs_new_protected:Npn \msg_gset:nnnn #1#2#3#4 { - \cs_gset:cpn { \c_msg_text_prefix_tl #1 / #2 } + \cs_gset:cpn { \c__msg_text_prefix_tl #1 / #2 } ##1##2##3##4 {#3} - \cs_gset:cpn { \c_msg_more_text_prefix_tl #1 / #2 } + \cs_gset:cpn { \c__msg_more_text_prefix_tl #1 / #2 } ##1##2##3##4 {#4} } \cs_new_protected:Npn \msg_gset:nnn #1#2#3 @@ -135,8 +135,6 @@ More~errors~will~almost~certainly~follow: \\ the~LaTeX~run~should~be~aborted. } -\cs_new_nopar:Npn \msg_newline: { ^^J } -\cs_new_nopar:Npn \msg_two_newlines: { ^^J ^^J } \cs_new_nopar:Npn \msg_line_number: { \int_use:N \tex_inputlineno:D } \cs_gset_nopar:Npn \msg_line_context: { @@ -144,24 +142,24 @@ \c_space_tl \msg_line_number: } -\cs_new_protected:Npn \msg_interrupt:xxx #1#2#3 +\cs_new_protected:Npn \msg_interrupt:nnn #1#2#3 { \tl_if_empty:nTF {#3} { - \msg_interrupt_wrap:xx { \\ \c_msg_no_info_text_tl } + \__msg_interrupt_wrap:nn { \\ \c_msg_no_info_text_tl } {#1 \\\\ #2 \\\\ \c_msg_continue_text_tl } } { - \msg_interrupt_wrap:xx { \\ #3 } + \__msg_interrupt_wrap:nn { \\ #3 } {#1 \\\\ #2 \\\\ \c_msg_help_text_tl } } } -\cs_new_protected:Npn \msg_interrupt_wrap:xx #1#2 +\cs_new_protected:Npn \__msg_interrupt_wrap:nn #1#2 { - \iow_wrap:xnnnN {#1} { | ~ } { 2 } { } \msg_interrupt_more_text:n - \iow_wrap:xnnnN {#2} { ! ~ } { 2 } { } \msg_interrupt_text:n + \iow_wrap:nnnN {#1} { | ~ } { } \__msg_interrupt_more_text:n + \iow_wrap:nnnN {#2} { ! ~ } { } \__msg_interrupt_text:n } -\cs_new_protected:Npn \msg_interrupt_more_text:n #1 +\cs_new_protected:Npn \__msg_interrupt_more_text:n #1 { \exp_args:Nx \tex_errhelp:D { @@ -175,13 +173,10 @@ \char_set_lccode:nn {`\}} {`\ } \char_set_lccode:nn {`\&} {`\!} \char_set_catcode_active:N \& - \char_set_catcode_letter:N \. - \tl_new:N - \c_msg_hide_tl............................................ \tl_to_lowercase:n { \group_end: - \cs_new_protected:Npn \msg_interrupt_text:n #1 + \cs_new_protected:Npn \__msg_interrupt_text:n #1 { \iow_term:x { @@ -196,7 +191,8 @@ \tex_errmessage:D { #1 - \c_msg_hide_tl............................................ + \use_none:n + { ............................................ } } } \exp_after:wN @@ -204,347 +200,314 @@ & } } -\cs_new_protected:Npn \msg_log:x #1 +\cs_new_protected:Npn \msg_log:n #1 { - \iow_log:x { ................................................. } - \iow_wrap:xnnnN { . ~ #1} { . ~ } { 2 } { } - \iow_log:x - \iow_log:x { ................................................. } + \iow_log:n { ................................................. } + \iow_wrap:nnnN { . ~ #1} { . ~ } { } \iow_log:n + \iow_log:n { ................................................. } } -\cs_new_protected:Npn \msg_term:x #1 +\cs_new_protected:Npn \msg_term:n #1 { - \iow_term:x { ************************************************* } - \iow_wrap:xnnnN { * ~ #1} { * ~ } { 2 } { } - \iow_term:x - \iow_term:x { ************************************************* } + \iow_term:n { ************************************************* } + \iow_wrap:nnnN { * ~ #1} { * ~ } { } \iow_term:n + \iow_term:n { ************************************************* } } -\int_gset:Nn \tex_errorcontextlines:D { -1 } \cs_new:Npn \msg_fatal_text:n #1 { Fatal~#1~error } \cs_new:Npn \msg_critical_text:n #1 { Critical~#1~error } \cs_new:Npn \msg_error_text:n #1 { #1~error } \cs_new:Npn \msg_warning_text:n #1 { #1~warning } \cs_new:Npn \msg_info_text:n #1 { #1~info } \cs_new:Npn \msg_see_documentation_text:n #1 - { \\ \\ See~the~#1~documentation~for~further~information. } -\cs_new_protected:Npn \msg_class_set:nn #1#2 - { - \prop_clear_new:c { l_msg_redirect_ #1 _prop } - \cs_set_protected:cpn { msg_ #1 :nnxxxx } ##1##2##3##4##5##6 - { \msg_use:nnnnxxxx {#1} {#2} {##1} {##2} {##3} {##4} {##5} {##6} } - \cs_set_protected:cpx { msg_ #1 :nnxxx } ##1##2##3##4##5 - { \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} {##3} {##4} {##5} { } } - \cs_set_protected:cpx { msg_ #1 :nnxx } ##1##2##3##4 - { \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} {##3} {##4} { } { } } - \cs_set_protected:cpx { msg_ #1 :nnx } ##1##2##3 - { \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} {##3} { } { } { } } - \cs_set_protected:cpx { msg_ #1 :nn } ##1##2 - { \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} { } { } { } { } } - } -\prg_new_conditional:Npnn \msg_if_more_text:N #1 { p , T , F , TF } - { - \cs_if_eq:NNTF #1 \msg_no_more_text:xxxx - { \prg_return_false: } - { \prg_return_true: } - } -\cs_new:Npn \msg_no_more_text:xxxx #1#2#3#4 { } -\cs_generate_variant:Nn \msg_if_more_text_p:N { c } -\cs_generate_variant:Nn \msg_if_more_text:NT { c } -\cs_generate_variant:Nn \msg_if_more_text:NF { c } -\cs_generate_variant:Nn \msg_if_more_text:NTF { c } -\msg_class_set:nn { fatal } { - \msg_interrupt:xxx - { \msg_fatal_text:n {#1} : ~ "#2" } - { - \use:c { \c_msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} - \msg_see_documentation_text:n {#1} - } - { \c_msg_fatal_text_tl } - \tex_end:D + \\ \\ See~the~ + \str_if_eq:nnTF {#1} { LaTeX } { LaTeX3 } {#1} ~ + documentation~for~further~information. } -\msg_class_set:nn { critical } +\group_begin: + \cs_set_protected:Npn \__msg_class_new:nn #1#2 + { + \prop_new:c { l__msg_redirect_ #1 _prop } + \cs_new_protected:cpn { __msg_ #1 _code:nnnnnn } ##1##2##3##4##5##6 {#2} + \cs_new_protected:cpn { msg_ #1 :nnnnnn } ##1##2##3##4##5##6 + { + \__msg_use:nnnnnnn {#1} {##1} {##2} + { \tl_to_str:n {##3} } { \tl_to_str:n {##4} } + { \tl_to_str:n {##5} } { \tl_to_str:n {##6} } + } + \cs_new_protected:cpx { msg_ #1 :nnnnn } ##1##2##3##4##5 + { \exp_not:c { msg_ #1 :nnnnnn } {##1} {##2} {##3} {##4} {##5} { } } + \cs_new_protected:cpx { msg_ #1 :nnnn } ##1##2##3##4 + { \exp_not:c { msg_ #1 :nnnnnn } {##1} {##2} {##3} {##4} { } { } } + \cs_new_protected:cpx { msg_ #1 :nnn } ##1##2##3 + { \exp_not:c { msg_ #1 :nnnnnn } {##1} {##2} {##3} { } { } { } } + \cs_new_protected:cpx { msg_ #1 :nn } ##1##2 + { \exp_not:c { msg_ #1 :nnnnnn } {##1} {##2} { } { } { } { } } + \cs_new_protected:cpn { msg_ #1 :nnxxxx } ##1##2##3##4##5##6 + { + \use:x + { + \__msg_use:nnnnnnn + { \exp_not:n {#1} } { \exp_not:n {##1} } { \exp_not:n {##2} } + {##3} {##4} {##5} {##6} + } + } + \cs_new_protected:cpx { msg_ #1 :nnxxx } ##1##2##3##4##5 + { \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} {##3} {##4} {##5} { } } + \cs_new_protected:cpx { msg_ #1 :nnxx } ##1##2##3##4 + { \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} {##3} {##4} { } { } } + \cs_new_protected:cpx { msg_ #1 :nnx } ##1##2##3 + { \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} {##3} { } { } { } } + } + \__msg_class_new:nn { fatal } + { + \msg_interrupt:nnn + { \msg_fatal_text:n {#1} : ~ "#2" } + { + \use:c { \c__msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} + \msg_see_documentation_text:n {#1} + } + { \c_msg_fatal_text_tl } + \tex_end:D + } + \__msg_class_new:nn { critical } + { + \msg_interrupt:nnn + { \msg_critical_text:n {#1} : ~ "#2" } + { + \use:c { \c__msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} + \msg_see_documentation_text:n {#1} + } + { \c_msg_critical_text_tl } + \tex_endinput:D + } + \__msg_class_new:nn { error } + { + \__msg_error:cnnnnn + { \c__msg_more_text_prefix_tl #1 / #2 } + {#3} {#4} {#5} {#6} + { + \msg_interrupt:nnn + { \msg_error_text:n {#1} : ~ "#2" } + { + \use:c { \c__msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} + \msg_see_documentation_text:n {#1} + } + } + } + \cs_new_protected:Npn \__msg_error:cnnnnn #1#2#3#4#5#6 + { + \cs_if_eq:cNTF {#1} \__msg_no_more_text:nnnn + { #6 { } } + { #6 { \use:c {#1} {#2} {#3} {#4} {#5} } } + } + \cs_new:Npn \__msg_no_more_text:nnnn #1#2#3#4 { } + \__msg_class_new:nn { warning } + { + \msg_term:n + { + \msg_warning_text:n {#1} : ~ "#2" \\ \\ + \use:c { \c__msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} + } + } + \__msg_class_new:nn { info } + { + \msg_log:n + { + \msg_info_text:n {#1} : ~ "#2" \\ \\ + \use:c { \c__msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} + } + } + \__msg_class_new:nn { log } + { + \iow_wrap:nnnN + { \use:c { \c__msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} } + { } { } \iow_log:n + } + \__msg_class_new:nn { none } { } +\group_end: +\cs_new:Npn \__msg_class_chk_exist:nT #1 { - \msg_interrupt:xxx - { \msg_critical_text:n {#1} : ~ "#2" } - { - \use:c { \c_msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} - \msg_see_documentation_text:n {#1} - } - { \c_msg_critical_text_tl } - \tex_endinput:D + \cs_if_free:cTF { __msg_ #1 _code:nnnnnn } + { \__msg_kernel_error:nnx { kernel } { message-class-unknown } {#1} } } -\msg_class_set:nn { error } +\tl_new:N \l__msg_class_tl +\tl_new:N \l__msg_current_class_tl +\prop_new:N \l__msg_redirect_prop +\seq_new:N \l__msg_hierarchy_seq +\seq_new:N \l__msg_class_loop_seq +\cs_new_protected:Npn \__msg_use:nnnnnnn #1#2#3#4#5#6#7 { - \msg_if_more_text:cTF { \c_msg_more_text_prefix_tl #1 / #2 } + \msg_if_exist:nnTF {#2} {#3} { - \msg_interrupt:xxx - { \msg_error_text:n {#1} : ~ "#2" } + \__msg_class_chk_exist:nT {#1} { - \use:c { \c_msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} - \msg_see_documentation_text:n {#1} - } - { \use:c { \c_msg_more_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} } - } - { - \msg_interrupt:xxx - { \msg_error_text:n {#1} : ~ "#2" } - { - \use:c { \c_msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} - \msg_see_documentation_text:n {#1} + \tl_set:Nn \l__msg_current_class_tl {#1} + \cs_set_protected_nopar:Npx \__msg_use_code: + { + \exp_not:n + { + \use:c { __msg_ \l__msg_class_tl _code:nnnnnn } + {#2} {#3} {#4} {#5} {#6} {#7} + } + } + \__msg_use_redirect_name:n { #2 / #3 } } - { } - } - } -\msg_class_set:nn { warning } - { - \msg_term:x - { - \msg_warning_text:n {#1} : ~ "#2" \\ \\ - \use:c { \c_msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} } + { \__msg_kernel_error:nnxx { kernel } { message-unknown } {#2} {#3} } } -\msg_class_set:nn { info } +\cs_new_protected_nopar:Npn \__msg_use_code: { } +\cs_new_protected:Npn \__msg_use_redirect_name:n #1 { - \msg_log:x + \prop_get:NnNTF \l__msg_redirect_prop { / #1 } \l__msg_class_tl + { \__msg_use_code: } { - \msg_info_text:n {#1} : ~ "#2" \\ \\ - \use:c { \c_msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} + \seq_clear:N \l__msg_hierarchy_seq + \__msg_use_hierarchy:nwwN { } + #1 \q_mark \__msg_use_hierarchy:nwwN + / \q_mark \use_none_delimit_by_q_stop:w + \q_stop + \__msg_use_redirect_module:n { } } } -\msg_class_set:nn { log } +\cs_new_protected:Npn \__msg_use_hierarchy:nwwN #1#2 / #3 \q_mark #4 { - \msg_log:x - { \use:c { \c_msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} } + \seq_put_left:Nn \l__msg_hierarchy_seq {#1} + #4 { #1 / #2 } #3 \q_mark #4 } -\msg_class_set:nn { none } { } -\tl_new:N \l_msg_class_tl -\tl_new:N \l_msg_current_class_tl -\prop_new:N \l_msg_redirect_classes_prop -\prop_new:N \l_msg_redirect_names_prop -\prop_new:N \l_msg_redirect_prop -\bool_new:N \l_msg_use_direct_bool -\cs_new_protected:Npn \msg_use:nnnnxxxx #1#2#3#4#5#6#7#8 +\cs_new_protected:Npn \__msg_use_redirect_module:n #1 { - \msg_if_exist:nnTF {#3} {#4} + \seq_map_inline:Nn \l__msg_hierarchy_seq { - \cs_if_exist:cTF { msg_ #1 :nnxxxx } + \prop_get:cnNTF { l__msg_redirect_ \l__msg_current_class_tl _prop } + {##1} \l__msg_class_tl { - \tl_set:Nn \l_msg_current_class_tl {#1} - \cs_set_protected_nopar:Npx \msg_use_code: { \exp_not:n {#2} } - \cs_set_protected_nopar:Npn \msg_use_or_change_class: + \seq_map_break:n { - \tl_if_eq:NNTF \l_msg_current_class_tl \l_msg_class_tl - { \msg_use_code: } + \tl_if_eq:NNTF \l__msg_current_class_tl \l__msg_class_tl + { \__msg_use_code: } { - \use:c { msg_ \l_msg_class_tl :nnxxxx } - {#3} {#4} {#5} {#6} {#7} {#8} + \tl_set_eq:NN \l__msg_current_class_tl \l__msg_class_tl + \__msg_use_redirect_module:n {##1} } } - \bool_if:NTF \l_msg_use_direct_bool + } + { + \str_if_eq:nnT {##1} {#1} { - \bool_set_false:N \l_msg_use_direct_bool - \msg_use_code: + \tl_set_eq:NN \l__msg_class_tl \l__msg_current_class_tl + \seq_map_break:n { \__msg_use_code: } } - { \msg_use_aux_i:nn {#3} {#4} } } - { \msg_kernel_error:nnx { msg } { message-class-unknown } {#1} } } - { \msg_kernel_error:nnxx { msg } { message-unknown } {#3} {#4} } } -\cs_new_protected_nopar:Npn \msg_use_code: { } -\cs_new_protected_nopar:Npn \msg_use_or_change_class: { } -\cs_new_protected:Npn \msg_use_aux_i:nn #1#2 +\cs_new_protected:Npn \msg_redirect_name:nnn #1#2#3 { - \prop_get:NnNTF \l_msg_redirect_prop { #1 / #2 } \l_msg_class_tl + \tl_if_empty:nTF {#3} + { \prop_remove:Nn \l__msg_redirect_prop { / #1 / #2 } } { - \bool_set_true:N \l_msg_use_direct_bool - \msg_use_or_change_class: + \__msg_class_chk_exist:nT {#3} + { \prop_put:Nnn \l__msg_redirect_prop { / #1 / #2 } {#3} } } - { \msg_use_aux_ii:nn {#1} {#2} } } -\cs_new_protected:Npn \msg_use_aux_ii:nn #1#2 +\cs_new_protected_nopar:Npn \msg_redirect_class:nn + { \__msg_redirect:nnn { } } +\cs_new_protected:Npn \msg_redirect_module:nnn #1 + { \__msg_redirect:nnn { / #1 } } +\cs_new_protected:Npn \__msg_redirect:nnn #1#2#3 { - \prop_get:coNTF { l_msg_redirect_ \l_msg_current_class_tl _ prop } - { \msg_use_aux_iii:w #1 / #2 / \q_stop } \l_msg_class_tl - { \msg_use_or_change_class: } + \__msg_class_chk_exist:nT {#2} { - \prop_get:coNTF { l_msg_redirect_ \l_msg_current_class_tl _ prop } - { \msg_use_aux_iv:w #1 / #2 \q_stop } \l_msg_class_tl - { \msg_use_or_change_class: } - { \msg_use_aux_v: } - } - } -\cs_new:Npn \msg_use_aux_iii:w #1 / #2 / #3 \q_stop { #1 / #2 } -\cs_new:Npn \msg_use_aux_iv:w #1 / #2 \q_stop { #1 } -\cs_new_protected:Npn \msg_use_aux_v: - { - \prop_get:cnNF { l_msg_redirect_ \l_msg_current_class_tl _ prop } - { * } \l_msg_class_tl - { \tl_set_eq:NN \l_msg_class_tl \l_msg_current_class_tl } - \msg_use_or_change_class: - } -\cs_new_protected:Npn \msg_redirect_class:nn #1#2 - { - \cs_if_exist:cTF { msg_ #1 :nnxxxx } - { - \cs_if_exist:cTF { msg_ #2 :nnxxxx } + \tl_if_empty:nTF {#3} + { \prop_remove:cn { l__msg_redirect_ #2 _prop } {#1} } { - \tl_set:Nn \l_msg_current_class_tl {#1} - \msg_redirect_class_aux:nnn {#1} {#2} {#2} + \__msg_class_chk_exist:nT {#3} + { + \prop_put:cnn { l__msg_redirect_ #2 _prop } {#1} {#3} + \tl_set:Nn \l__msg_current_class_tl {#2} + \seq_clear:N \l__msg_class_loop_seq + \__msg_redirect_loop_chk:nnn {#2} {#3} {#1} + } } - { \msg_kernel_error:nnx { msg } { message-class-unknown } {#2} } } - { \msg_kernel_error:nnx { msg } { message-class-unknown } {#1} } } -\cs_new_protected:Npn \msg_redirect_class_aux:nnn #1#2#3 +\cs_new_protected:Npn \__msg_redirect_loop_chk:nnn #1#2#3 { - \prop_get:cnNTF { l_msg_redirect_ #2 _prop } { * } \l_msg_class_tl + \seq_put_right:Nn \l__msg_class_loop_seq {#1} + \prop_get:cnNT { l__msg_redirect_ #1 _prop } {#3} \l__msg_class_tl { - \tl_if_eq:NNTF \l_msg_class_tl \l_msg_current_class_tl - { \msg_kernel_error:nnxx { msg } { message-loop } {#1} {#3} } - { \msg_redirect_class_aux:nVn {#1} \l_msg_class_tl {#3} } - } - { \prop_put:cnn { l_msg_redirect_ #1 _prop } { * } {#3} } - } -\cs_generate_variant:Nn \msg_redirect_class_aux:nnn { nV } -\cs_new_protected:Npn \msg_redirect_module:nnn #1#2#3 - { - \cs_if_exist:cTF { msg_ #2 :nnxxxx } - { - \cs_if_exist:cTF { msg_ #3 :nnxxxx } + \str_if_eq_x:nnF { \l__msg_class_tl } {#1} { - \tl_set:Nn \l_msg_current_class_tl {#1} - \msg_redirect_module_aux:nnnn {#1} {#2} {#3} {#3} + \tl_if_eq:NNTF \l__msg_class_tl \l__msg_current_class_tl + { + \prop_put:cnn { l__msg_redirect_ #2 _prop } {#3} {#2} + \__msg_kernel_warning:nnxxxx { kernel } { message-redirect-loop } + { \seq_item:Nn \l__msg_class_loop_seq { \c_one } } + { \seq_item:Nn \l__msg_class_loop_seq { \c_two } } + {#3} + { + \seq_map_function:NN \l__msg_class_loop_seq + \__msg_redirect_loop_list:n + { \seq_item:Nn \l__msg_class_loop_seq { \c_one } } + } + } + { \__msg_redirect_loop_chk:onn \l__msg_class_tl {#2} {#3} } } - { \msg_kernel_error:nnx { msg } { message-class-unknown } {#3} } - } - { \msg_kernel_error:nnx { msg } { message-class-unknown } {#2} } - } -\cs_new_protected:Npn \msg_redirect_module_aux:nnnn #1#2#3#4 - { - \prop_get:cnNTF { l_msg_redirect_ #3 _prop } {#1} \l_msg_class_tl - { - \tl_if_eq:NNTF \l_msg_class_tl \l_msg_current_class_tl - { \msg_kernel_error:nnxx { msg } { message-loop } {#2} {#4} } - { \msg_redirect_moduel_aux:nVn {#1} {#2} \l_msg_class_tl {#4} } } - { \prop_put:cnn { l_msg_redirect_ #2 _prop } {#1} {#4} } - } -\cs_generate_variant:Nn \msg_redirect_module_aux:nnnn { nnV } -\cs_new_protected:Npn \msg_redirect_name:nnn #1#2#3 - { - \cs_if_exist:cTF { msg_ #3 :nnxxxx } - { \prop_put:Nnn \l_msg_redirect_prop { #1 / #2 } {#3} } - { \msg_kernel_error:nnx { msg } { message-class-unknown } {#3} } } -\cs_new_protected:Npn \msg_kernel_new:nnnn #1#2 +\cs_generate_variant:Nn \__msg_redirect_loop_chk:nnn { o } +\cs_new:Npn \__msg_redirect_loop_list:n #1 { {#1} ~ => ~ } +\cs_new_protected:Npn \__msg_kernel_new:nnnn #1#2 { \msg_new:nnnn { LaTeX } { #1 / #2 } } -\cs_new_protected:Npn \msg_kernel_new:nnn #1#2 +\cs_new_protected:Npn \__msg_kernel_new:nnn #1#2 { \msg_new:nnn { LaTeX } { #1 / #2 } } -\cs_new_protected:Npn \msg_kernel_set:nnnn #1#2 +\cs_new_protected:Npn \__msg_kernel_set:nnnn #1#2 { \msg_set:nnnn { LaTeX } { #1 / #2 } } -\cs_new_protected:Npn \msg_kernel_set:nnn #1#2 +\cs_new_protected:Npn \__msg_kernel_set:nnn #1#2 { \msg_set:nnn { LaTeX } { #1 / #2 } } -\cs_new_protected:Npn \msg_kernel_fatal:nnxxxx #1#2#3#4#5#6 - { - \msg_interrupt:xxx - { \msg_fatal_text:n { LaTeX } : ~ "#1 / #2" } - { - \use:c { \c_msg_text_prefix_tl LaTeX / #1 / #2 } - {#3} {#4} {#5} {#6} - \msg_see_documentation_text:n { LaTeX3 } - } - { \c_msg_fatal_text_tl } - \tex_end:D - } -\cs_new_protected:Npn \msg_kernel_fatal:nnxxx #1#2#3#4#5 - {\msg_kernel_fatal:nnxxxx {#1} {#2} {#3} {#4} {#5} { } } -\cs_new_protected:Npn \msg_kernel_fatal:nnxx #1#2#3#4 - { \msg_kernel_fatal:nnxxxx {#1} {#2} {#3} {#4} { } { } } -\cs_new_protected:Npn \msg_kernel_fatal:nnx #1#2#3 - { \msg_kernel_fatal:nnxxxx {#1} {#2} {#3} { } { } { } } -\cs_new_protected:Npn \msg_kernel_fatal:nn #1#2 - { \msg_kernel_fatal:nnxxxx {#1} {#2} { } { } { } { } } -\cs_new_protected:Npn \msg_kernel_error:nnxxxx #1#2#3#4#5#6 - { - \msg_if_more_text:cTF { \c_msg_more_text_prefix_tl LaTeX / #1 / #2 } - { - \msg_interrupt:xxx - { \msg_error_text:n { LaTeX } : ~ " #1 / #2 " } - { - \use:c { \c_msg_text_prefix_tl LaTeX / #1 / #2 } - {#3} {#4} {#5} {#6} - \msg_see_documentation_text:n { LaTeX3 } - } - { - \use:c { \c_msg_more_text_prefix_tl LaTeX / #1 / #2 } - {#3} {#4} {#5} {#6} - } - } - { - \msg_interrupt:xxx - { \msg_error_text:n { LaTeX } : ~ " #1 / #2 " } - { - \use:c { \c_msg_text_prefix_tl LaTeX / #1 / #2 } - {#3} {#4} {#5} {#6} - \msg_see_documentation_text:n { LaTeX3 } - } - { } - } - } -\cs_new_protected:Npn \msg_kernel_error:nnxxx #1#2#3#4#5 - {\msg_kernel_error:nnxxxx {#1} {#2} {#3} {#4} {#5} { } } -\cs_gset_protected:Npn \msg_kernel_error:nnxx #1#2#3#4 - { \msg_kernel_error:nnxxxx {#1} {#2} {#3} {#4} { } { } } -\cs_gset_protected:Npn \msg_kernel_error:nnx #1#2#3 - { \msg_kernel_error:nnxxxx {#1} {#2} {#3} { } { } { } } -\cs_gset_protected:Npn \msg_kernel_error:nn #1#2 - { \msg_kernel_error:nnxxxx {#1} {#2} { } { } { } { } } -\prop_new:N \l_msg_redirect_kernel_warning_prop -\cs_new_protected:Npn \msg_kernel_warning:nnxxxx #1#2#3#4#5#6 - { - \msg_use:nnnnxxxx { warning } - { - \msg_term:x - { - \msg_warning_text:n { LaTeX } : ~ " #1 / #2 " \\ \\ - \use:c { \c_msg_text_prefix_tl LaTeX / #1 / #2 } - {#3} {#4} {#5} {#6} - } - } - { LaTeX } { #1 / #2 } {#3} {#4} {#5} {#6} - } -\cs_new_protected:Npn \msg_kernel_warning:nnxxx #1#2#3#4#5 - { \msg_kernel_warning:nnxxxx {#1} {#2} {#3} {#4} {#5} { } } -\cs_new_protected:Npn \msg_kernel_warning:nnxx #1#2#3#4 - { \msg_kernel_warning:nnxxxx {#1} {#2} {#3} {#4} { } { } } -\cs_new_protected:Npn \msg_kernel_warning:nnx #1#2#3 - { \msg_kernel_warning:nnxxxx {#1} {#2} {#3} { } { } { } } -\cs_new_protected:Npn \msg_kernel_warning:nn #1#2 - { \msg_kernel_warning:nnxxxx {#1} {#2} { } { } { } { } } -\prop_new:N \l_msg_redirect_kernel_info_prop -\cs_new_protected:Npn \msg_kernel_info:nnxxxx #1#2#3#4#5#6 - { - \msg_use:nnnnxxxx { info } - { - \msg_log:x - { - \msg_info_text:n { LaTeX } : ~ " #1 / #2 " \\ \\ - \use:c { \c_msg_text_prefix_tl LaTeX / #1 / #2 } - {#3} {#4} {#5} {#6} - } - } - { LaTeX } { #1 / #2 } {#3} {#4} {#5} {#6} - } -\cs_new_protected:Npn \msg_kernel_info:nnxxx #1#2#3#4#5 - { \msg_kernel_info:nnxxxx {#1} {#2} {#3} {#4} {#5} { } } -\cs_new_protected:Npn \msg_kernel_info:nnxx #1#2#3#4 - { \msg_kernel_info:nnxxxx {#1} {#2} {#3} {#4} { } { } } -\cs_new_protected:Npn \msg_kernel_info:nnx #1#2#3 - { \msg_kernel_info:nnxxxx {#1} {#2} {#3} { } { } { } } -\cs_new_protected:Npn \msg_kernel_info:nn #1#2 - { \msg_kernel_info:nnxxxx {#1} {#2} { } { } { } { } } -\msg_kernel_new:nnnn { msg } { message-already-defined } +\group_begin: + \cs_set_protected:Npn \__msg_kernel_class_new:nn #1 + { \__msg_kernel_class_new_aux:nn { kernel_ #1 } } + \cs_set_protected:Npn \__msg_kernel_class_new_aux:nn #1#2 + { + \cs_new_protected:cpn { __msg_ #1 :nnnnnn } ##1##2 {#2} + \cs_new_protected:cpx { __msg_ #1 :nnnnn } ##1##2##3##4##5 + { \exp_not:c { __msg_ #1 :nnnnnn } {##1} {##2} {##3} {##4} {##5} { } } + \cs_new_protected:cpx { __msg_ #1 :nnnn } ##1##2##3##4 + { \exp_not:c { __msg_ #1 :nnnnnn } {##1} {##2} {##3} {##4} { } { } } + \cs_new_protected:cpx { __msg_ #1 :nnn } ##1##2##3 + { \exp_not:c { __msg_ #1 :nnnnnn } {##1} {##2} {##3} { } { } { } } + \cs_new_protected:cpx { __msg_ #1 :nn } ##1##2 + { \exp_not:c { __msg_ #1 :nnnnnn } {##1} {##2} { } { } { } { } } + \cs_new_protected:cpx { __msg_ #1 :nnxxxx } ##1##2##3##4##5##6 + { + \use:x + { + \exp_not:c { __msg_ #1 :nnnnnn } + { \exp_not:N \exp_not:n {##1} } + { \exp_not:N \exp_not:n {##2} } + {##3} {##4} {##5} {##6} + } + } + \cs_new_protected:cpx { __msg_ #1 :nnxxx } ##1##2##3##4##5 + { \exp_not:c { __msg_ #1 :nnxxxx } {##1} {##2} {##3} {##4} {##5} { } } + \cs_new_protected:cpx { __msg_ #1 :nnxx } ##1##2##3##4 + { \exp_not:c { __msg_ #1 :nnxxxx } {##1} {##2} {##3} {##4} { } { } } + \cs_new_protected:cpx { __msg_ #1 :nnx } ##1##2##3 + { \exp_not:c { __msg_ #1 :nnxxxx } {##1} {##2} {##3} { } { } { } } + } + \__msg_kernel_class_new:nn { fatal } + { \__msg_fatal_code:nnnnnn { LaTeX } { #1 / #2 } } + \cs_undefine:N \__msg_kernel_error:nnxx + \cs_undefine:N \__msg_kernel_error:nnx + \cs_undefine:N \__msg_kernel_error:nn + \__msg_kernel_class_new:nn { error } + { \__msg_error_code:nnnnnn { LaTeX } { #1 / #2 } } + \__msg_kernel_class_new:nn { warning } + { \msg_warning:nnxxxx { LaTeX } { #1 / #2 } } + \__msg_kernel_class_new:nn { info } + { \msg_info:nnxxxx { LaTeX } { #1 / #2 } } +\group_end: +\__msg_kernel_new:nnnn { kernel } { message-already-defined } { Message~'#2'~for~module~'#1'~already~defined. } { \c_msg_coding_error_text_tl @@ -552,37 +515,41 @@ by~the~module~'#1':~this~message~already~exists. \c_msg_return_text_tl } -\msg_kernel_new:nnnn { msg } { message-unknown } +\__msg_kernel_new:nnnn { kernel } { message-unknown } { Unknown~message~'#2'~for~module~'#1'. } { \c_msg_coding_error_text_tl LaTeX~was~asked~to~display~a~message~called~'#2'\\ - by~the~module~'#1'~module:~this~message~does~not~exist. + by~the~module~'#1':~this~message~does~not~exist. \c_msg_return_text_tl } -\msg_kernel_new:nnnn { msg } { message-class-unknown } +\__msg_kernel_new:nnnn { kernel } { message-class-unknown } { Unknown~message~class~'#1'. } { LaTeX~has~been~asked~to~redirect~messages~to~a~class~'#1':\\ this~was~never~defined. \c_msg_return_text_tl } -\msg_kernel_new:nnnn { msg } { redirect-loop } - { Message~redirection~loop~for~message~class~'#1'. } +\__msg_kernel_new:nnnn { kernel } { message-redirect-loop } { - LaTeX~has~been~asked~to~redirect~messages~in~an~infinite~loop.\\ - The~original~message~here~has~been~lost. - \c_msg_return_text_tl + Message~redirection~loop~caused~by~ {#1} ~=>~ {#2} + \tl_if_empty:nF {#3} { ~for~module~' \use_none:n #3 ' } . + } + { + Adding~the~message~redirection~ {#1} ~=>~ {#2} + \tl_if_empty:nF {#3} { ~for~the~module~' \use_none:n #3 ' } ~ + created~an~infinite~loop\\\\ + \iow_indent:n { #4 \\\\ } } -\msg_kernel_new:nnnn { kernel } { bad-number-of-arguments } +\__msg_kernel_new:nnnn { kernel } { bad-number-of-arguments } { Function~'#1'~cannot~be~defined~with~#2~arguments. } { \c_msg_coding_error_text_tl LaTeX~has~been~asked~to~define~a~function~'#1'~with~ - #2~arguments. \\ + #2~arguments.~ TeX~allows~between~0~and~9~arguments~for~a~single~function. } -\msg_kernel_new:nnnn { kernel } { command-already-defined } +\__msg_kernel_new:nnnn { kernel } { command-already-defined } { Control~sequence~#1~already~defined. } { \c_msg_coding_error_text_tl @@ -591,192 +558,239 @@ The~current~meaning~is:\\ \ \ #2 } -\msg_kernel_new:nnnn { kernel } { command-not-defined } +\__msg_kernel_new:nnnn { kernel } { command-not-defined } { Control~sequence~#1~undefined. } { \c_msg_coding_error_text_tl LaTeX~has~been~asked~to~use~a~command~#1,~but~this~has~not~ been~defined~yet. } -\msg_kernel_new:nnnn { kernel } { out-of-registers } +\__msg_kernel_new:nnnn { kernel } { empty-search-pattern } + { Empty~search~pattern. } + { + \c_msg_coding_error_text_tl + LaTeX~has~been~asked~to~replace~an~empty~pattern~by~'#1':~that~ + would~lead~to~an~infinite~loop! + } +\__msg_kernel_new:nnnn { kernel } { out-of-registers } { No~room~for~a~new~#1. } { TeX~only~supports~\int_use:N \c_max_register_int \ of~each~type.~All~the~#1~registers~have~been~used.~ This~run~will~be~aborted~now. } -\msg_kernel_new:nnnn { kernel } { variable-not-defined } - { Variable~#1~undefined. } +\__msg_kernel_new:nnnn { kernel } { missing-colon } + { Function~'#1'~contains~no~':'. } { \c_msg_coding_error_text_tl - LaTeX~has~been~asked~to~show~a~variable~#1,~but~this~has~not~ - been~defined~yet. + Code-level~functions~must~contain~':'~to~separate~the~ + argument~specification~from~the~function~name.~This~is~ + needed~when~defining~conditionals~or~when~building~a~ + parameter~text~from~the~number~of~arguments~of~the~function. } -\msg_kernel_new:nnnn { seq } { empty-sequence } - { Empty~sequence~#1. } +\__msg_kernel_new:nnnn { kernel } { protected-predicate } + { Predicate~'#1'~must~be~expandable. } { \c_msg_coding_error_text_tl - LaTeX~has~been~asked~to~recover~an~entry~from~a~sequence~that~ - has~no~content:~that~cannot~happen! + LaTeX~has~been~asked~to~define~'#1'~as~a~protected~predicate.~ + Only~expandable~tests~can~have~a~predicate~version. } -\msg_kernel_new:nnnn { tl } { empty-search-pattern } - { Empty~search~pattern. } +\__msg_kernel_new:nnnn { kernel } { conditional-form-unknown } + { Conditional~form~'#1'~for~function~'#2'~unknown. } { \c_msg_coding_error_text_tl - LaTeX~has~been~asked~to~replace~an~empty~pattern~by~'#1':~that~% - would~lead~to~an~infinite~loop! + LaTeX~has~been~asked~to~define~the~conditional~form~'#1'~of~ + the~function~'#2',~but~only~'TF',~'T',~'F',~and~'p'~forms~exist. } -\msg_kernel_new:nnnn { scan } { already-defined } +\__msg_kernel_new:nnnn { kernel } { scanmark-already-defined } { Scan~mark~#1~already~defined. } { \c_msg_coding_error_text_tl LaTeX~has~been~asked~to~create~a~new~scan~mark~'#1'~ but~this~name~has~already~been~used~for~a~scan~mark. } -\msg_kernel_new:nnn { seq } { misused } - { A~sequence~was~misused. } -\msg_kernel_new:nnn { kernel } { bad-var } +\__msg_kernel_new:nnnn { kernel } { variable-not-defined } + { Variable~#1~undefined. } + { + \c_msg_coding_error_text_tl + LaTeX~has~been~asked~to~show~a~variable~#1,~but~this~has~not~ + been~defined~yet. + } +\__msg_kernel_new:nnnn { kernel } { variant-too-long } + { Variant~form~'#1'~longer~than~base~signature~of~'#2'. } + { + \c_msg_coding_error_text_tl + LaTeX~has~been~asked~to~create~a~variant~of~the~function~'#2'~ + with~a~signature~starting~with~'#1',~but~that~is~longer~than~ + the~signature~(part~after~the~colon)~of~'#2'. + } +\__msg_kernel_new:nnn { kernel } { bad-variable } { Erroneous~variable~#1 used! } -\msg_kernel_new:nnn { prg } { zero-step } - { Zero~step~size~for~stepwise~function~#1. } -\msg_kernel_new:nnn { prg } { replicate-neg } +\__msg_kernel_new:nnn { kernel } { misused-sequence } + { A~sequence~was~misused. } +\__msg_kernel_new:nnn { kernel } { negative-replication } { Negative~argument~for~\prg_replicate:nn. } -\msg_kernel_new:nnn { kernel } { unknown-comparison } +\__msg_kernel_new:nnn { kernel } { unknown-comparison } { Relation~symbol~'#1'~unknown:~use~=,~<,~>,~==,~!=,~<=,~>=. } -\msg_kernel_new:nnn { seq } { show } +\__msg_kernel_new:nnn { kernel } { zero-step } + { Zero~step~size~for~step~function~#1. } +\__msg_kernel_new:nnn { kernel } { show-clist } { - The~sequence~\token_to_str:N #1~ - \seq_if_empty:NTF #1 + The~comma~list~ + \str_if_eq:nnF {#1} { \l__clist_internal_clist } { \token_to_str:N #1~} + \clist_if_empty:NTF #1 { is~empty } { contains~the~items~(without~outer~braces): } } -\msg_kernel_new:nnn { prop } { show } +\__msg_kernel_new:nnn { kernel } { show-prop } { The~property~list~\token_to_str:N #1~ \prop_if_empty:NTF #1 { is~empty } { contains~the~pairs~(without~outer~braces): } } -\msg_kernel_new:nnn { clist } { show } +\__msg_kernel_new:nnn { kernel } { show-seq } { - The~comma~list~ - \str_if_eq:nnF {#1} { \l_clist_internal_clist } { \token_to_str:N #1~} - \clist_if_empty:NTF #1 + The~sequence~\token_to_str:N #1~ + \seq_if_empty:NTF #1 { is~empty } { contains~the~items~(without~outer~braces): } } -\msg_kernel_new:nnn { ior } { show-no-stream } - { No~input~streams~are~open } -\msg_kernel_new:nnn { ior } { show-open-streams } - { The~following~input~streams~are~in~use: } -\msg_kernel_new:nnn { iow } { show-no-stream } - { No~output~streams~are~open } -\msg_kernel_new:nnn { iow } { show-open-streams } - { The~following~output~streams~are~in~use: } +\__msg_kernel_new:nnn { kernel } { show-no-stream } + { No~ #1 ~streams~are~open } +\__msg_kernel_new:nnn { kernel } { show-open-streams } + { The~following~ #1 ~streams~are~in~use: } \group_begin: \char_set_catcode_math_superscript:N \^ -\char_set_lccode:nn {`^} {`\ } -\char_set_lccode:nn {`L} {`L} -\char_set_lccode:nn {`T} {`T} -\char_set_lccode:nn {`X} {`X} +\char_set_lccode:nn { `^ } { `\ } +\char_set_lccode:nn { `L } { `L } +\char_set_lccode:nn { `T } { `T } +\char_set_lccode:nn { `X } { `X } \tl_to_lowercase:n { - \cs_new:Npx \msg_expandable_error:n #1 + \cs_new:Npx \__msg_expandable_error:n #1 { \exp_not:n { \tex_romannumeral:D \exp_after:wN \exp_after:wN - \exp_after:wN \msg_expandable_error_aux:w + \exp_after:wN \__msg_expandable_error:w \exp_after:wN \exp_after:wN \exp_after:wN \c_zero } \exp_not:N \use:n { \exp_not:c { LaTeX3~error: } ^ #1 } ^ } - \cs_new:Npn \msg_expandable_error_aux:w #1 ^ #2 ^ { #1 } + \cs_new:Npn \__msg_expandable_error:w #1 ^ #2 ^ { #1 } } \group_end: -\cs_new:Npn \msg_expandable_kernel_error:nnnnnn #1#2#3#4#5#6 +\cs_new:Npn \__msg_kernel_expandable_error:nnnnnn #1#2#3#4#5#6 { - \exp_args:Nf \msg_expandable_error:n + \exp_args:Nf \__msg_expandable_error:n { \exp_args:NNc \exp_after:wN \exp_stop_f: - { \c_msg_text_prefix_tl LaTeX / #1 / #2 } + { \c__msg_text_prefix_tl LaTeX / #1 / #2 } {#3} {#4} {#5} {#6} } } -\cs_new:Npn \msg_expandable_kernel_error:nnnnn #1#2#3#4#5 +\cs_new:Npn \__msg_kernel_expandable_error:nnnnn #1#2#3#4#5 { - \msg_expandable_kernel_error:nnnnnn + \__msg_kernel_expandable_error:nnnnnn {#1} {#2} {#3} {#4} {#5} { } } -\cs_new:Npn \msg_expandable_kernel_error:nnnn #1#2#3#4 +\cs_new:Npn \__msg_kernel_expandable_error:nnnn #1#2#3#4 { - \msg_expandable_kernel_error:nnnnnn + \__msg_kernel_expandable_error:nnnnnn {#1} {#2} {#3} {#4} { } { } } -\cs_new:Npn \msg_expandable_kernel_error:nnn #1#2#3 +\cs_new:Npn \__msg_kernel_expandable_error:nnn #1#2#3 { - \msg_expandable_kernel_error:nnnnnn + \__msg_kernel_expandable_error:nnnnnn {#1} {#2} {#3} { } { } { } } -\cs_new:Npn \msg_expandable_kernel_error:nn #1#2 +\cs_new:Npn \__msg_kernel_expandable_error:nn #1#2 { - \msg_expandable_kernel_error:nnnnnn + \__msg_kernel_expandable_error:nnnnnn {#1} {#2} { } { } { } { } } -\cs_new_protected:Npn \msg_aux_use:nn #1#2 - { \msg_aux_use:nnxxxx {#1} {#2} { } { } { } { } } -\cs_new_protected:Npn \msg_aux_use:nnxxxx #1#2#3#4#5#6 +\cs_new_protected:Npn \__msg_term:nnnnnn #1#2#3#4#5#6 { - \iow_wrap:xnnnN - { - \use:c { \c_msg_text_prefix_tl #1 / #2 } - {#3} {#4} {#5} {#6} - } - { } \c_zero { } \iow_term:x + \iow_wrap:nnnN + { \use:c { \c__msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} } + { } { } \iow_term:n } -\cs_new_protected:Npn \msg_aux_show:Nnx #1#2#3 +\cs_generate_variant:Nn \__msg_term:nnnnnn { nnnnnV } +\cs_new_protected:Npn \__msg_term:nnnnn #1#2#3#4#5 + { \__msg_term:nnnnnn {#1} {#2} {#3} {#4} {#5} { } } +\cs_new_protected:Npn \__msg_term:nnn #1#2#3 + { \__msg_term:nnnnnn {#1} {#2} {#3} { } { } { } } +\cs_new_protected:Npn \__msg_term:nn #1#2 + { \__msg_term:nnnnnn {#1} {#2} { } { } { } { } } +\cs_new_protected:Npn \__msg_show_variable:Nnn #1#2#3 { \cs_if_exist:NTF #1 { - \msg_aux_use:nnxxxx { LaTeX / #2 } { show } {#1} { } { } { } - \msg_aux_show:x {#3} + \__msg_term:nnn { LaTeX / kernel } { show- #2 } {#1} + \__msg_show_variable:x {#3} } { - \msg_kernel_error:nnx { kernel } { variable-not-defined } + \__msg_kernel_error:nnx { kernel } { variable-not-defined } { \token_to_str:N #1 } } } -\cs_new_protected:Npn \msg_aux_show:x #1 +\cs_generate_variant:Nn \__msg_show_variable:Nnn { Nnx } +\cs_new_protected:Npn \__msg_show_variable:n #1 { - \tl_set:Nx \l_msg_internal_tl {#1} - \tl_if_empty:NT \l_msg_internal_tl - { \tl_set:Nx \l_msg_internal_tl { > } } - \exp_args:Nf \etex_showtokens:D + \tl_set:Nn \l__msg_internal_tl {#1} + \tl_if_empty:NTF \l__msg_internal_tl + { \etex_showtokens:D \exp_after:wN { } } { - \exp_after:wN \exp_after:wN - \exp_after:wN \msg_aux_show:w - \exp_after:wN \l_msg_internal_tl - \exp_after:wN + \exp_args:Nf \etex_showtokens:D + { + \exp_after:wN \exp_after:wN + \exp_after:wN \__msg_show_variable:w + \exp_after:wN \l__msg_internal_tl + } } - \prg_do_nothing: } -\cs_new:Npn \msg_aux_show:w #1 > { } -\cs_new:Npn \msg_aux_show:n #1 +\cs_generate_variant:Nn \__msg_show_variable:n { x } +\cs_new:Npn \__msg_show_variable:w #1 > { } +\cs_new:Npn \__msg_show_item:n #1 { \iow_newline: > \c_space_tl \c_space_tl { \exp_not:n {#1} } } -\cs_new:Npn \msg_aux_show:nn #1#2 +\cs_new:Npn \__msg_show_item:nn #1#2 { \iow_newline: > \c_space_tl \c_space_tl { \exp_not:n {#1} } \c_space_tl \c_space_tl => \c_space_tl \c_space_tl { \exp_not:n {#2} } } -\cs_new:Npn \msg_aux_show_unbraced:nn #1#2 +\cs_new:Npn \__msg_show_item_unbraced:nn #1#2 { \iow_newline: > \c_space_tl \c_space_tl \exp_not:n {#1} \c_space_tl \c_space_tl => \c_space_tl \c_space_tl \exp_not:n {#2} } +\cs_new_nopar:Npn \msg_newline: { ^^J } +\cs_new_nopar:Npn \msg_two_newlines: { ^^J ^^J } +\cs_generate_variant:Nn \msg_log:n { x } +\cs_generate_variant:Nn \msg_term:n { x } +\cs_generate_variant:Nn \msg_interrupt:nnn { xxx } +\cs_new_protected:Npn \msg_class_set:nn #1#2 + { + \cs_if_exist:cTF { __msg_ #1 _code:nnnnnn } + \cs_set_protected:cpn + \cs_new_protected:cpn + { __msg_ #1 _code:nnnnnn } ##1##2##3##4##5##6 {#2} + \prop_clear_new:c { l__msg_redirect_ #1 _prop } + \cs_set_protected_nopar:cpn { msg_ #1 :nnxxxx } + { \__msg_use:nnnnnnn {#1} } + \cs_set_protected:cpx { msg_ #1 :nnxxx } ##1##2##3##4##5 + { \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} {##3} {##4} {##5} { } } + \cs_set_protected:cpx { msg_ #1 :nnxx } ##1##2##3##4 + { \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} {##3} {##4} { } { } } + \cs_set_protected:cpx { msg_ #1 :nnx } ##1##2##3 + { \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} {##3} { } { } { } } + \cs_set_protected:cpx { msg_ #1 :nn } ##1##2 + { \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} { } { } { } { } } + } %% %% %% End of file `l3msg.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3names.sty b/Master/texmf-dist/tex/latex/l3kernel/l3names.sty index fee26c9e876..660aa9e659b 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3names.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3names.sty @@ -13,7 +13,7 @@ %% %% Do not distribute a modified version of this file. %% -%% File: l3names.dtx Copyright (C) 1990-2011 The LaTeX3 project +%% File: l3names.dtx Copyright (C) 1990-2012 The 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 @@ -45,443 +45,443 @@ %% prior consultation with the LaTeX3 Project. %% %% ----------------------------------------------------------------------- -\RequirePackage{l3bootstrap}[2011-12-29] -\GetIdInfo$Id: l3names.dtx 3494 2012-03-04 09:58:29Z joseph $ - {L3 Experimental namespace for primitives} +\RequirePackage{l3bootstrap}[2012/07/15] +\GetIdInfo$Id: l3names.dtx 3990 2012-07-16 07:46:03Z joseph $ + {L3 Namespace for primitives} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \let \tex_global:D \global \let \tex_let:D \let \begingroup - \long \def \name_primitive:NN #1#2 + \long \def \__expl_primitive:NN #1#2 { \tex_global:D \tex_let:D #2 #1 } - \name_primitive:NN \ \tex_space:D - \name_primitive:NN \/ \tex_italiccor:D - \name_primitive:NN \- \tex_hyphen:D - \name_primitive:NN \let \tex_let:D - \name_primitive:NN \def \tex_def:D - \name_primitive:NN \edef \tex_edef:D - \name_primitive:NN \gdef \tex_gdef:D - \name_primitive:NN \xdef \tex_xdef:D - \name_primitive:NN \chardef \tex_chardef:D - \name_primitive:NN \countdef \tex_countdef:D - \name_primitive:NN \dimendef \tex_dimendef:D - \name_primitive:NN \skipdef \tex_skipdef:D - \name_primitive:NN \muskipdef \tex_muskipdef:D - \name_primitive:NN \mathchardef \tex_mathchardef:D - \name_primitive:NN \toksdef \tex_toksdef:D - \name_primitive:NN \futurelet \tex_futurelet:D - \name_primitive:NN \advance \tex_advance:D - \name_primitive:NN \divide \tex_divide:D - \name_primitive:NN \multiply \tex_multiply:D - \name_primitive:NN \font \tex_font:D - \name_primitive:NN \fam \tex_fam:D - \name_primitive:NN \global \tex_global:D - \name_primitive:NN \long \tex_long:D - \name_primitive:NN \outer \tex_outer:D - \name_primitive:NN \setlanguage \tex_setlanguage:D - \name_primitive:NN \globaldefs \tex_globaldefs:D - \name_primitive:NN \afterassignment \tex_afterassignment:D - \name_primitive:NN \aftergroup \tex_aftergroup:D - \name_primitive:NN \expandafter \tex_expandafter:D - \name_primitive:NN \noexpand \tex_noexpand:D - \name_primitive:NN \begingroup \tex_begingroup:D - \name_primitive:NN \endgroup \tex_endgroup:D - \name_primitive:NN \halign \tex_halign:D - \name_primitive:NN \valign \tex_valign:D - \name_primitive:NN \cr \tex_cr:D - \name_primitive:NN \crcr \tex_crcr:D - \name_primitive:NN \noalign \tex_noalign:D - \name_primitive:NN \omit \tex_omit:D - \name_primitive:NN \span \tex_span:D - \name_primitive:NN \tabskip \tex_tabskip:D - \name_primitive:NN \everycr \tex_everycr:D - \name_primitive:NN \if \tex_if:D - \name_primitive:NN \ifcase \tex_ifcase:D - \name_primitive:NN \ifcat \tex_ifcat:D - \name_primitive:NN \ifnum \tex_ifnum:D - \name_primitive:NN \ifodd \tex_ifodd:D - \name_primitive:NN \ifdim \tex_ifdim:D - \name_primitive:NN \ifeof \tex_ifeof:D - \name_primitive:NN \ifhbox \tex_ifhbox:D - \name_primitive:NN \ifvbox \tex_ifvbox:D - \name_primitive:NN \ifvoid \tex_ifvoid:D - \name_primitive:NN \ifx \tex_ifx:D - \name_primitive:NN \iffalse \tex_iffalse:D - \name_primitive:NN \iftrue \tex_iftrue:D - \name_primitive:NN \ifhmode \tex_ifhmode:D - \name_primitive:NN \ifmmode \tex_ifmmode:D - \name_primitive:NN \ifvmode \tex_ifvmode:D - \name_primitive:NN \ifinner \tex_ifinner:D - \name_primitive:NN \else \tex_else:D - \name_primitive:NN \fi \tex_fi:D - \name_primitive:NN \or \tex_or:D - \name_primitive:NN \immediate \tex_immediate:D - \name_primitive:NN \closeout \tex_closeout:D - \name_primitive:NN \openin \tex_openin:D - \name_primitive:NN \openout \tex_openout:D - \name_primitive:NN \read \tex_read:D - \name_primitive:NN \write \tex_write:D - \name_primitive:NN \closein \tex_closein:D - \name_primitive:NN \newlinechar \tex_newlinechar:D - \name_primitive:NN \input \tex_input:D - \name_primitive:NN \endinput \tex_endinput:D - \name_primitive:NN \inputlineno \tex_inputlineno:D - \name_primitive:NN \errmessage \tex_errmessage:D - \name_primitive:NN \message \tex_message:D - \name_primitive:NN \show \tex_show:D - \name_primitive:NN \showthe \tex_showthe:D - \name_primitive:NN \showbox \tex_showbox:D - \name_primitive:NN \showlists \tex_showlists:D - \name_primitive:NN \errhelp \tex_errhelp:D - \name_primitive:NN \errorcontextlines \tex_errorcontextlines:D - \name_primitive:NN \tracingcommands \tex_tracingcommands:D - \name_primitive:NN \tracinglostchars \tex_tracinglostchars:D - \name_primitive:NN \tracingmacros \tex_tracingmacros:D - \name_primitive:NN \tracingonline \tex_tracingonline:D - \name_primitive:NN \tracingoutput \tex_tracingoutput:D - \name_primitive:NN \tracingpages \tex_tracingpages:D - \name_primitive:NN \tracingparagraphs \tex_tracingparagraphs:D - \name_primitive:NN \tracingrestores \tex_tracingrestores:D - \name_primitive:NN \tracingstats \tex_tracingstats:D - \name_primitive:NN \pausing \tex_pausing:D - \name_primitive:NN \showboxbreadth \tex_showboxbreadth:D - \name_primitive:NN \showboxdepth \tex_showboxdepth:D - \name_primitive:NN \batchmode \tex_batchmode:D - \name_primitive:NN \errorstopmode \tex_errorstopmode:D - \name_primitive:NN \nonstopmode \tex_nonstopmode:D - \name_primitive:NN \scrollmode \tex_scrollmode:D - \name_primitive:NN \end \tex_end:D - \name_primitive:NN \csname \tex_csname:D - \name_primitive:NN \endcsname \tex_endcsname:D - \name_primitive:NN \ignorespaces \tex_ignorespaces:D - \name_primitive:NN \relax \tex_relax:D - \name_primitive:NN \the \tex_the:D - \name_primitive:NN \mag \tex_mag:D - \name_primitive:NN \language \tex_language:D - \name_primitive:NN \mark \tex_mark:D - \name_primitive:NN \topmark \tex_topmark:D - \name_primitive:NN \firstmark \tex_firstmark:D - \name_primitive:NN \botmark \tex_botmark:D - \name_primitive:NN \splitfirstmark \tex_splitfirstmark:D - \name_primitive:NN \splitbotmark \tex_splitbotmark:D - \name_primitive:NN \fontname \tex_fontname:D - \name_primitive:NN \escapechar \tex_escapechar:D - \name_primitive:NN \endlinechar \tex_endlinechar:D - \name_primitive:NN \mathchoice \tex_mathchoice:D - \name_primitive:NN \delimiter \tex_delimiter:D - \name_primitive:NN \mathaccent \tex_mathaccent:D - \name_primitive:NN \mathchar \tex_mathchar:D - \name_primitive:NN \mskip \tex_mskip:D - \name_primitive:NN \radical \tex_radical:D - \name_primitive:NN \vcenter \tex_vcenter:D - \name_primitive:NN \mkern \tex_mkern:D - \name_primitive:NN \above \tex_above:D - \name_primitive:NN \abovewithdelims \tex_abovewithdelims:D - \name_primitive:NN \atop \tex_atop:D - \name_primitive:NN \atopwithdelims \tex_atopwithdelims:D - \name_primitive:NN \over \tex_over:D - \name_primitive:NN \overwithdelims \tex_overwithdelims:D - \name_primitive:NN \displaystyle \tex_displaystyle:D - \name_primitive:NN \textstyle \tex_textstyle:D - \name_primitive:NN \scriptstyle \tex_scriptstyle:D - \name_primitive:NN \scriptscriptstyle \tex_scriptscriptstyle:D - \name_primitive:NN \nonscript \tex_nonscript:D - \name_primitive:NN \eqno \tex_eqno:D - \name_primitive:NN \leqno \tex_leqno:D - \name_primitive:NN \abovedisplayshortskip \tex_abovedisplayshortskip:D - \name_primitive:NN \abovedisplayskip \tex_abovedisplayskip:D - \name_primitive:NN \belowdisplayshortskip \tex_belowdisplayshortskip:D - \name_primitive:NN \belowdisplayskip \tex_belowdisplayskip:D - \name_primitive:NN \displaywidowpenalty \tex_displaywidowpenalty:D - \name_primitive:NN \displayindent \tex_displayindent:D - \name_primitive:NN \displaywidth \tex_displaywidth:D - \name_primitive:NN \everydisplay \tex_everydisplay:D - \name_primitive:NN \predisplaysize \tex_predisplaysize:D - \name_primitive:NN \predisplaypenalty \tex_predisplaypenalty:D - \name_primitive:NN \postdisplaypenalty \tex_postdisplaypenalty:D - \name_primitive:NN \mathbin \tex_mathbin:D - \name_primitive:NN \mathclose \tex_mathclose:D - \name_primitive:NN \mathinner \tex_mathinner:D - \name_primitive:NN \mathop \tex_mathop:D - \name_primitive:NN \displaylimits \tex_displaylimits:D - \name_primitive:NN \limits \tex_limits:D - \name_primitive:NN \nolimits \tex_nolimits:D - \name_primitive:NN \mathopen \tex_mathopen:D - \name_primitive:NN \mathord \tex_mathord:D - \name_primitive:NN \mathpunct \tex_mathpunct:D - \name_primitive:NN \mathrel \tex_mathrel:D - \name_primitive:NN \overline \tex_overline:D - \name_primitive:NN \underline \tex_underline:D - \name_primitive:NN \left \tex_left:D - \name_primitive:NN \right \tex_right:D - \name_primitive:NN \binoppenalty \tex_binoppenalty:D - \name_primitive:NN \relpenalty \tex_relpenalty:D - \name_primitive:NN \delimitershortfall \tex_delimitershortfall:D - \name_primitive:NN \delimiterfactor \tex_delimiterfactor:D - \name_primitive:NN \nulldelimiterspace \tex_nulldelimiterspace:D - \name_primitive:NN \everymath \tex_everymath:D - \name_primitive:NN \mathsurround \tex_mathsurround:D - \name_primitive:NN \medmuskip \tex_medmuskip:D - \name_primitive:NN \thinmuskip \tex_thinmuskip:D - \name_primitive:NN \thickmuskip \tex_thickmuskip:D - \name_primitive:NN \scriptspace \tex_scriptspace:D - \name_primitive:NN \noboundary \tex_noboundary:D - \name_primitive:NN \accent \tex_accent:D - \name_primitive:NN \char \tex_char:D - \name_primitive:NN \discretionary \tex_discretionary:D - \name_primitive:NN \hfil \tex_hfil:D - \name_primitive:NN \hfilneg \tex_hfilneg:D - \name_primitive:NN \hfill \tex_hfill:D - \name_primitive:NN \hskip \tex_hskip:D - \name_primitive:NN \hss \tex_hss:D - \name_primitive:NN \vfil \tex_vfil:D - \name_primitive:NN \vfilneg \tex_vfilneg:D - \name_primitive:NN \vfill \tex_vfill:D - \name_primitive:NN \vskip \tex_vskip:D - \name_primitive:NN \vss \tex_vss:D - \name_primitive:NN \unskip \tex_unskip:D - \name_primitive:NN \kern \tex_kern:D - \name_primitive:NN \unkern \tex_unkern:D - \name_primitive:NN \hrule \tex_hrule:D - \name_primitive:NN \vrule \tex_vrule:D - \name_primitive:NN \leaders \tex_leaders:D - \name_primitive:NN \cleaders \tex_cleaders:D - \name_primitive:NN \xleaders \tex_xleaders:D - \name_primitive:NN \lastkern \tex_lastkern:D - \name_primitive:NN \lastskip \tex_lastskip:D - \name_primitive:NN \indent \tex_indent:D - \name_primitive:NN \par \tex_par:D - \name_primitive:NN \noindent \tex_noindent:D - \name_primitive:NN \vadjust \tex_vadjust:D - \name_primitive:NN \baselineskip \tex_baselineskip:D - \name_primitive:NN \lineskip \tex_lineskip:D - \name_primitive:NN \lineskiplimit \tex_lineskiplimit:D - \name_primitive:NN \clubpenalty \tex_clubpenalty:D - \name_primitive:NN \widowpenalty \tex_widowpenalty:D - \name_primitive:NN \exhyphenpenalty \tex_exhyphenpenalty:D - \name_primitive:NN \hyphenpenalty \tex_hyphenpenalty:D - \name_primitive:NN \linepenalty \tex_linepenalty:D - \name_primitive:NN \doublehyphendemerits \tex_doublehyphendemerits:D - \name_primitive:NN \finalhyphendemerits \tex_finalhyphendemerits:D - \name_primitive:NN \adjdemerits \tex_adjdemerits:D - \name_primitive:NN \hangafter \tex_hangafter:D - \name_primitive:NN \hangindent \tex_hangindent:D - \name_primitive:NN \parshape \tex_parshape:D - \name_primitive:NN \hsize \tex_hsize:D - \name_primitive:NN \lefthyphenmin \tex_lefthyphenmin:D - \name_primitive:NN \righthyphenmin \tex_righthyphenmin:D - \name_primitive:NN \leftskip \tex_leftskip:D - \name_primitive:NN \rightskip \tex_rightskip:D - \name_primitive:NN \looseness \tex_looseness:D - \name_primitive:NN \parskip \tex_parskip:D - \name_primitive:NN \parindent \tex_parindent:D - \name_primitive:NN \uchyph \tex_uchyph:D - \name_primitive:NN \emergencystretch \tex_emergencystretch:D - \name_primitive:NN \pretolerance \tex_pretolerance:D - \name_primitive:NN \tolerance \tex_tolerance:D - \name_primitive:NN \spaceskip \tex_spaceskip:D - \name_primitive:NN \xspaceskip \tex_xspaceskip:D - \name_primitive:NN \parfillskip \tex_parfillskip:D - \name_primitive:NN \everypar \tex_everypar:D - \name_primitive:NN \prevgraf \tex_prevgraf:D - \name_primitive:NN \spacefactor \tex_spacefactor:D - \name_primitive:NN \shipout \tex_shipout:D - \name_primitive:NN \vsize \tex_vsize:D - \name_primitive:NN \interlinepenalty \tex_interlinepenalty:D - \name_primitive:NN \brokenpenalty \tex_brokenpenalty:D - \name_primitive:NN \topskip \tex_topskip:D - \name_primitive:NN \maxdeadcycles \tex_maxdeadcycles:D - \name_primitive:NN \maxdepth \tex_maxdepth:D - \name_primitive:NN \output \tex_output:D - \name_primitive:NN \deadcycles \tex_deadcycles:D - \name_primitive:NN \pagedepth \tex_pagedepth:D - \name_primitive:NN \pagestretch \tex_pagestretch:D - \name_primitive:NN \pagefilstretch \tex_pagefilstretch:D - \name_primitive:NN \pagefillstretch \tex_pagefillstretch:D - \name_primitive:NN \pagefilllstretch \tex_pagefilllstretch:D - \name_primitive:NN \pageshrink \tex_pageshrink:D - \name_primitive:NN \pagegoal \tex_pagegoal:D - \name_primitive:NN \pagetotal \tex_pagetotal:D - \name_primitive:NN \outputpenalty \tex_outputpenalty:D - \name_primitive:NN \hoffset \tex_hoffset:D - \name_primitive:NN \voffset \tex_voffset:D - \name_primitive:NN \insert \tex_insert:D - \name_primitive:NN \holdinginserts \tex_holdinginserts:D - \name_primitive:NN \floatingpenalty \tex_floatingpenalty:D - \name_primitive:NN \insertpenalties \tex_insertpenalties:D - \name_primitive:NN \lower \tex_lower:D - \name_primitive:NN \moveleft \tex_moveleft:D - \name_primitive:NN \moveright \tex_moveright:D - \name_primitive:NN \raise \tex_raise:D - \name_primitive:NN \copy \tex_copy:D - \name_primitive:NN \lastbox \tex_lastbox:D - \name_primitive:NN \vsplit \tex_vsplit:D - \name_primitive:NN \unhbox \tex_unhbox:D - \name_primitive:NN \unhcopy \tex_unhcopy:D - \name_primitive:NN \unvbox \tex_unvbox:D - \name_primitive:NN \unvcopy \tex_unvcopy:D - \name_primitive:NN \setbox \tex_setbox:D - \name_primitive:NN \hbox \tex_hbox:D - \name_primitive:NN \vbox \tex_vbox:D - \name_primitive:NN \vtop \tex_vtop:D - \name_primitive:NN \prevdepth \tex_prevdepth:D - \name_primitive:NN \badness \tex_badness:D - \name_primitive:NN \hbadness \tex_hbadness:D - \name_primitive:NN \vbadness \tex_vbadness:D - \name_primitive:NN \hfuzz \tex_hfuzz:D - \name_primitive:NN \vfuzz \tex_vfuzz:D - \name_primitive:NN \overfullrule \tex_overfullrule:D - \name_primitive:NN \boxmaxdepth \tex_boxmaxdepth:D - \name_primitive:NN \splitmaxdepth \tex_splitmaxdepth:D - \name_primitive:NN \splittopskip \tex_splittopskip:D - \name_primitive:NN \everyhbox \tex_everyhbox:D - \name_primitive:NN \everyvbox \tex_everyvbox:D - \name_primitive:NN \nullfont \tex_nullfont:D - \name_primitive:NN \textfont \tex_textfont:D - \name_primitive:NN \scriptfont \tex_scriptfont:D - \name_primitive:NN \scriptscriptfont \tex_scriptscriptfont:D - \name_primitive:NN \fontdimen \tex_fontdimen:D - \name_primitive:NN \hyphenchar \tex_hyphenchar:D - \name_primitive:NN \skewchar \tex_skewchar:D - \name_primitive:NN \defaulthyphenchar \tex_defaulthyphenchar:D - \name_primitive:NN \defaultskewchar \tex_defaultskewchar:D - \name_primitive:NN \number \tex_number:D - \name_primitive:NN \romannumeral \tex_romannumeral:D - \name_primitive:NN \string \tex_string:D - \name_primitive:NN \lowercase \tex_lowercase:D - \name_primitive:NN \uppercase \tex_uppercase:D - \name_primitive:NN \meaning \tex_meaning:D - \name_primitive:NN \penalty \tex_penalty:D - \name_primitive:NN \unpenalty \tex_unpenalty:D - \name_primitive:NN \lastpenalty \tex_lastpenalty:D - \name_primitive:NN \special \tex_special:D - \name_primitive:NN \dump \tex_dump:D - \name_primitive:NN \patterns \tex_patterns:D - \name_primitive:NN \hyphenation \tex_hyphenation:D - \name_primitive:NN \time \tex_time:D - \name_primitive:NN \day \tex_day:D - \name_primitive:NN \month \tex_month:D - \name_primitive:NN \year \tex_year:D - \name_primitive:NN \jobname \tex_jobname:D - \name_primitive:NN \everyjob \tex_everyjob:D - \name_primitive:NN \count \tex_count:D - \name_primitive:NN \dimen \tex_dimen:D - \name_primitive:NN \skip \tex_skip:D - \name_primitive:NN \toks \tex_toks:D - \name_primitive:NN \muskip \tex_muskip:D - \name_primitive:NN \box \tex_box:D - \name_primitive:NN \wd \tex_wd:D - \name_primitive:NN \ht \tex_ht:D - \name_primitive:NN \dp \tex_dp:D - \name_primitive:NN \catcode \tex_catcode:D - \name_primitive:NN \delcode \tex_delcode:D - \name_primitive:NN \sfcode \tex_sfcode:D - \name_primitive:NN \lccode \tex_lccode:D - \name_primitive:NN \uccode \tex_uccode:D - \name_primitive:NN \mathcode \tex_mathcode:D - \name_primitive:NN \ifdefined \etex_ifdefined:D - \name_primitive:NN \ifcsname \etex_ifcsname:D - \name_primitive:NN \unless \etex_unless:D - \name_primitive:NN \eTeXversion \etex_eTeXversion:D - \name_primitive:NN \eTeXrevision \etex_eTeXrevision:D - \name_primitive:NN \marks \etex_marks:D - \name_primitive:NN \topmarks \etex_topmarks:D - \name_primitive:NN \firstmarks \etex_firstmarks:D - \name_primitive:NN \botmarks \etex_botmarks:D - \name_primitive:NN \splitfirstmarks \etex_splitfirstmarks:D - \name_primitive:NN \splitbotmarks \etex_splitbotmarks:D - \name_primitive:NN \unexpanded \etex_unexpanded:D - \name_primitive:NN \detokenize \etex_detokenize:D - \name_primitive:NN \scantokens \etex_scantokens:D - \name_primitive:NN \showtokens \etex_showtokens:D - \name_primitive:NN \readline \etex_readline:D - \name_primitive:NN \tracingassigns \etex_tracingassigns:D - \name_primitive:NN \tracingscantokens \etex_tracingscantokens:D - \name_primitive:NN \tracingnesting \etex_tracingnesting:D - \name_primitive:NN \tracingifs \etex_tracingifs:D - \name_primitive:NN \currentiflevel \etex_currentiflevel:D - \name_primitive:NN \currentifbranch \etex_currentifbranch:D - \name_primitive:NN \currentiftype \etex_currentiftype:D - \name_primitive:NN \tracinggroups \etex_tracinggroups:D - \name_primitive:NN \currentgrouplevel \etex_currentgrouplevel:D - \name_primitive:NN \currentgrouptype \etex_currentgrouptype:D - \name_primitive:NN \showgroups \etex_showgroups:D - \name_primitive:NN \showifs \etex_showifs:D - \name_primitive:NN \interactionmode \etex_interactionmode:D - \name_primitive:NN \lastnodetype \etex_lastnodetype:D - \name_primitive:NN \iffontchar \etex_iffontchar:D - \name_primitive:NN \fontcharht \etex_fontcharht:D - \name_primitive:NN \fontchardp \etex_fontchardp:D - \name_primitive:NN \fontcharwd \etex_fontcharwd:D - \name_primitive:NN \fontcharic \etex_fontcharic:D - \name_primitive:NN \parshapeindent \etex_parshapeindent:D - \name_primitive:NN \parshapelength \etex_parshapelength:D - \name_primitive:NN \parshapedimen \etex_parshapedimen:D - \name_primitive:NN \numexpr \etex_numexpr:D - \name_primitive:NN \dimexpr \etex_dimexpr:D - \name_primitive:NN \glueexpr \etex_glueexpr:D - \name_primitive:NN \muexpr \etex_muexpr:D - \name_primitive:NN \gluestretch \etex_gluestretch:D - \name_primitive:NN \glueshrink \etex_glueshrink:D - \name_primitive:NN \gluestretchorder \etex_gluestretchorder:D - \name_primitive:NN \glueshrinkorder \etex_glueshrinkorder:D - \name_primitive:NN \gluetomu \etex_gluetomu:D - \name_primitive:NN \mutoglue \etex_mutoglue:D - \name_primitive:NN \lastlinefit \etex_lastlinefit:D - \name_primitive:NN \interlinepenalties \etex_interlinepenalties:D - \name_primitive:NN \clubpenalties \etex_clubpenalties:D - \name_primitive:NN \widowpenalties \etex_widowpenalties:D - \name_primitive:NN \displaywidowpenalties \etex_displaywidowpenalties:D - \name_primitive:NN \middle \etex_middle:D - \name_primitive:NN \savinghyphcodes \etex_savinghyphcodes:D - \name_primitive:NN \savingvdiscards \etex_savingvdiscards:D - \name_primitive:NN \pagediscards \etex_pagediscards:D - \name_primitive:NN \splitdiscards \etex_splitdiscards:D - \name_primitive:NN \TeXXeTstate \etex_TeXXeTstate:D - \name_primitive:NN \beginL \etex_beginL:D - \name_primitive:NN \endL \etex_endL:D - \name_primitive:NN \beginR \etex_beginR:D - \name_primitive:NN \endR \etex_endR:D - \name_primitive:NN \predisplaydirection \etex_predisplaydirection:D - \name_primitive:NN \everyeof \etex_everyeof:D - \name_primitive:NN \protected \etex_protected:D - \name_primitive:NN \pdfcreationdate \pdftex_pdfcreationdate:D - \name_primitive:NN \pdfcolorstack \pdftex_pdfcolorstack:D - \name_primitive:NN \pdfcompresslevel \pdftex_pdfcompresslevel:D - \name_primitive:NN \pdfdecimaldigits \pdftex_pdfdecimaldigits:D - \name_primitive:NN \pdfhorigin \pdftex_pdfhorigin:D - \name_primitive:NN \pdfinfo \pdftex_pdfinfo:D - \name_primitive:NN \pdflastxform \pdftex_pdflastxform:D - \name_primitive:NN \pdfliteral \pdftex_pdfliteral:D - \name_primitive:NN \pdfminorversion \pdftex_pdfminorversion:D - \name_primitive:NN \pdfobjcompresslevel \pdftex_pdfobjcompresslevel:D - \name_primitive:NN \pdfoutput \pdftex_pdfoutput:D - \name_primitive:NN \pdfrefxform \pdftex_pdfrefxform:D - \name_primitive:NN \pdfrestore \pdftex_pdfrestore:D - \name_primitive:NN \pdfsave \pdftex_pdfsave:D - \name_primitive:NN \pdfsetmatrix \pdftex_pdfsetmatrix:D - \name_primitive:NN \pdfpkresolution \pdftex_pdfpkresolution:D - \name_primitive:NN \pdftexrevision \pdftex_pdftextrevision:D - \name_primitive:NN \pdfvorigin \pdftex_pdfvorigin:D - \name_primitive:NN \pdfxform \pdftex_pdfxform:D - \name_primitive:NN \pdfstrcmp \pdftex_strcmp:D - \name_primitive:NN \XeTeXversion \xetex_XeTeXversion:D - \name_primitive:NN \catcodetable \luatex_catcodetable:D - \name_primitive:NN \directlua \luatex_directlua:D - \name_primitive:NN \initcatcodetable \luatex_initcatcodetable:D - \name_primitive:NN \latelua \luatex_latelua:D - \name_primitive:NN \luatexversion \luatex_luatexversion:D - \name_primitive:NN \savecatcodetable \luatex_savecatcodetable:D + \__expl_primitive:NN \ \tex_space:D + \__expl_primitive:NN \/ \tex_italiccorrection:D + \__expl_primitive:NN \- \tex_hyphen:D + \__expl_primitive:NN \let \tex_let:D + \__expl_primitive:NN \def \tex_def:D + \__expl_primitive:NN \edef \tex_edef:D + \__expl_primitive:NN \gdef \tex_gdef:D + \__expl_primitive:NN \xdef \tex_xdef:D + \__expl_primitive:NN \chardef \tex_chardef:D + \__expl_primitive:NN \countdef \tex_countdef:D + \__expl_primitive:NN \dimendef \tex_dimendef:D + \__expl_primitive:NN \skipdef \tex_skipdef:D + \__expl_primitive:NN \muskipdef \tex_muskipdef:D + \__expl_primitive:NN \mathchardef \tex_mathchardef:D + \__expl_primitive:NN \toksdef \tex_toksdef:D + \__expl_primitive:NN \futurelet \tex_futurelet:D + \__expl_primitive:NN \advance \tex_advance:D + \__expl_primitive:NN \divide \tex_divide:D + \__expl_primitive:NN \multiply \tex_multiply:D + \__expl_primitive:NN \font \tex_font:D + \__expl_primitive:NN \fam \tex_fam:D + \__expl_primitive:NN \global \tex_global:D + \__expl_primitive:NN \long \tex_long:D + \__expl_primitive:NN \outer \tex_outer:D + \__expl_primitive:NN \setlanguage \tex_setlanguage:D + \__expl_primitive:NN \globaldefs \tex_globaldefs:D + \__expl_primitive:NN \afterassignment \tex_afterassignment:D + \__expl_primitive:NN \aftergroup \tex_aftergroup:D + \__expl_primitive:NN \expandafter \tex_expandafter:D + \__expl_primitive:NN \noexpand \tex_noexpand:D + \__expl_primitive:NN \begingroup \tex_begingroup:D + \__expl_primitive:NN \endgroup \tex_endgroup:D + \__expl_primitive:NN \halign \tex_halign:D + \__expl_primitive:NN \valign \tex_valign:D + \__expl_primitive:NN \cr \tex_cr:D + \__expl_primitive:NN \crcr \tex_crcr:D + \__expl_primitive:NN \noalign \tex_noalign:D + \__expl_primitive:NN \omit \tex_omit:D + \__expl_primitive:NN \span \tex_span:D + \__expl_primitive:NN \tabskip \tex_tabskip:D + \__expl_primitive:NN \everycr \tex_everycr:D + \__expl_primitive:NN \if \tex_if:D + \__expl_primitive:NN \ifcase \tex_ifcase:D + \__expl_primitive:NN \ifcat \tex_ifcat:D + \__expl_primitive:NN \ifnum \tex_ifnum:D + \__expl_primitive:NN \ifodd \tex_ifodd:D + \__expl_primitive:NN \ifdim \tex_ifdim:D + \__expl_primitive:NN \ifeof \tex_ifeof:D + \__expl_primitive:NN \ifhbox \tex_ifhbox:D + \__expl_primitive:NN \ifvbox \tex_ifvbox:D + \__expl_primitive:NN \ifvoid \tex_ifvoid:D + \__expl_primitive:NN \ifx \tex_ifx:D + \__expl_primitive:NN \iffalse \tex_iffalse:D + \__expl_primitive:NN \iftrue \tex_iftrue:D + \__expl_primitive:NN \ifhmode \tex_ifhmode:D + \__expl_primitive:NN \ifmmode \tex_ifmmode:D + \__expl_primitive:NN \ifvmode \tex_ifvmode:D + \__expl_primitive:NN \ifinner \tex_ifinner:D + \__expl_primitive:NN \else \tex_else:D + \__expl_primitive:NN \fi \tex_fi:D + \__expl_primitive:NN \or \tex_or:D + \__expl_primitive:NN \immediate \tex_immediate:D + \__expl_primitive:NN \closeout \tex_closeout:D + \__expl_primitive:NN \openin \tex_openin:D + \__expl_primitive:NN \openout \tex_openout:D + \__expl_primitive:NN \read \tex_read:D + \__expl_primitive:NN \write \tex_write:D + \__expl_primitive:NN \closein \tex_closein:D + \__expl_primitive:NN \newlinechar \tex_newlinechar:D + \__expl_primitive:NN \input \tex_input:D + \__expl_primitive:NN \endinput \tex_endinput:D + \__expl_primitive:NN \inputlineno \tex_inputlineno:D + \__expl_primitive:NN \errmessage \tex_errmessage:D + \__expl_primitive:NN \message \tex_message:D + \__expl_primitive:NN \show \tex_show:D + \__expl_primitive:NN \showthe \tex_showthe:D + \__expl_primitive:NN \showbox \tex_showbox:D + \__expl_primitive:NN \showlists \tex_showlists:D + \__expl_primitive:NN \errhelp \tex_errhelp:D + \__expl_primitive:NN \errorcontextlines \tex_errorcontextlines:D + \__expl_primitive:NN \tracingcommands \tex_tracingcommands:D + \__expl_primitive:NN \tracinglostchars \tex_tracinglostchars:D + \__expl_primitive:NN \tracingmacros \tex_tracingmacros:D + \__expl_primitive:NN \tracingonline \tex_tracingonline:D + \__expl_primitive:NN \tracingoutput \tex_tracingoutput:D + \__expl_primitive:NN \tracingpages \tex_tracingpages:D + \__expl_primitive:NN \tracingparagraphs \tex_tracingparagraphs:D + \__expl_primitive:NN \tracingrestores \tex_tracingrestores:D + \__expl_primitive:NN \tracingstats \tex_tracingstats:D + \__expl_primitive:NN \pausing \tex_pausing:D + \__expl_primitive:NN \showboxbreadth \tex_showboxbreadth:D + \__expl_primitive:NN \showboxdepth \tex_showboxdepth:D + \__expl_primitive:NN \batchmode \tex_batchmode:D + \__expl_primitive:NN \errorstopmode \tex_errorstopmode:D + \__expl_primitive:NN \nonstopmode \tex_nonstopmode:D + \__expl_primitive:NN \scrollmode \tex_scrollmode:D + \__expl_primitive:NN \end \tex_end:D + \__expl_primitive:NN \csname \tex_csname:D + \__expl_primitive:NN \endcsname \tex_endcsname:D + \__expl_primitive:NN \ignorespaces \tex_ignorespaces:D + \__expl_primitive:NN \relax \tex_relax:D + \__expl_primitive:NN \the \tex_the:D + \__expl_primitive:NN \mag \tex_mag:D + \__expl_primitive:NN \language \tex_language:D + \__expl_primitive:NN \mark \tex_mark:D + \__expl_primitive:NN \topmark \tex_topmark:D + \__expl_primitive:NN \firstmark \tex_firstmark:D + \__expl_primitive:NN \botmark \tex_botmark:D + \__expl_primitive:NN \splitfirstmark \tex_splitfirstmark:D + \__expl_primitive:NN \splitbotmark \tex_splitbotmark:D + \__expl_primitive:NN \fontname \tex_fontname:D + \__expl_primitive:NN \escapechar \tex_escapechar:D + \__expl_primitive:NN \endlinechar \tex_endlinechar:D + \__expl_primitive:NN \mathchoice \tex_mathchoice:D + \__expl_primitive:NN \delimiter \tex_delimiter:D + \__expl_primitive:NN \mathaccent \tex_mathaccent:D + \__expl_primitive:NN \mathchar \tex_mathchar:D + \__expl_primitive:NN \mskip \tex_mskip:D + \__expl_primitive:NN \radical \tex_radical:D + \__expl_primitive:NN \vcenter \tex_vcenter:D + \__expl_primitive:NN \mkern \tex_mkern:D + \__expl_primitive:NN \above \tex_above:D + \__expl_primitive:NN \abovewithdelims \tex_abovewithdelims:D + \__expl_primitive:NN \atop \tex_atop:D + \__expl_primitive:NN \atopwithdelims \tex_atopwithdelims:D + \__expl_primitive:NN \over \tex_over:D + \__expl_primitive:NN \overwithdelims \tex_overwithdelims:D + \__expl_primitive:NN \displaystyle \tex_displaystyle:D + \__expl_primitive:NN \textstyle \tex_textstyle:D + \__expl_primitive:NN \scriptstyle \tex_scriptstyle:D + \__expl_primitive:NN \scriptscriptstyle \tex_scriptscriptstyle:D + \__expl_primitive:NN \nonscript \tex_nonscript:D + \__expl_primitive:NN \eqno \tex_eqno:D + \__expl_primitive:NN \leqno \tex_leqno:D + \__expl_primitive:NN \abovedisplayshortskip \tex_abovedisplayshortskip:D + \__expl_primitive:NN \abovedisplayskip \tex_abovedisplayskip:D + \__expl_primitive:NN \belowdisplayshortskip \tex_belowdisplayshortskip:D + \__expl_primitive:NN \belowdisplayskip \tex_belowdisplayskip:D + \__expl_primitive:NN \displaywidowpenalty \tex_displaywidowpenalty:D + \__expl_primitive:NN \displayindent \tex_displayindent:D + \__expl_primitive:NN \displaywidth \tex_displaywidth:D + \__expl_primitive:NN \everydisplay \tex_everydisplay:D + \__expl_primitive:NN \predisplaysize \tex_predisplaysize:D + \__expl_primitive:NN \predisplaypenalty \tex_predisplaypenalty:D + \__expl_primitive:NN \postdisplaypenalty \tex_postdisplaypenalty:D + \__expl_primitive:NN \mathbin \tex_mathbin:D + \__expl_primitive:NN \mathclose \tex_mathclose:D + \__expl_primitive:NN \mathinner \tex_mathinner:D + \__expl_primitive:NN \mathop \tex_mathop:D + \__expl_primitive:NN \displaylimits \tex_displaylimits:D + \__expl_primitive:NN \limits \tex_limits:D + \__expl_primitive:NN \nolimits \tex_nolimits:D + \__expl_primitive:NN \mathopen \tex_mathopen:D + \__expl_primitive:NN \mathord \tex_mathord:D + \__expl_primitive:NN \mathpunct \tex_mathpunct:D + \__expl_primitive:NN \mathrel \tex_mathrel:D + \__expl_primitive:NN \overline \tex_overline:D + \__expl_primitive:NN \underline \tex_underline:D + \__expl_primitive:NN \left \tex_left:D + \__expl_primitive:NN \right \tex_right:D + \__expl_primitive:NN \binoppenalty \tex_binoppenalty:D + \__expl_primitive:NN \relpenalty \tex_relpenalty:D + \__expl_primitive:NN \delimitershortfall \tex_delimitershortfall:D + \__expl_primitive:NN \delimiterfactor \tex_delimiterfactor:D + \__expl_primitive:NN \nulldelimiterspace \tex_nulldelimiterspace:D + \__expl_primitive:NN \everymath \tex_everymath:D + \__expl_primitive:NN \mathsurround \tex_mathsurround:D + \__expl_primitive:NN \medmuskip \tex_medmuskip:D + \__expl_primitive:NN \thinmuskip \tex_thinmuskip:D + \__expl_primitive:NN \thickmuskip \tex_thickmuskip:D + \__expl_primitive:NN \scriptspace \tex_scriptspace:D + \__expl_primitive:NN \noboundary \tex_noboundary:D + \__expl_primitive:NN \accent \tex_accent:D + \__expl_primitive:NN \char \tex_char:D + \__expl_primitive:NN \discretionary \tex_discretionary:D + \__expl_primitive:NN \hfil \tex_hfil:D + \__expl_primitive:NN \hfilneg \tex_hfilneg:D + \__expl_primitive:NN \hfill \tex_hfill:D + \__expl_primitive:NN \hskip \tex_hskip:D + \__expl_primitive:NN \hss \tex_hss:D + \__expl_primitive:NN \vfil \tex_vfil:D + \__expl_primitive:NN \vfilneg \tex_vfilneg:D + \__expl_primitive:NN \vfill \tex_vfill:D + \__expl_primitive:NN \vskip \tex_vskip:D + \__expl_primitive:NN \vss \tex_vss:D + \__expl_primitive:NN \unskip \tex_unskip:D + \__expl_primitive:NN \kern \tex_kern:D + \__expl_primitive:NN \unkern \tex_unkern:D + \__expl_primitive:NN \hrule \tex_hrule:D + \__expl_primitive:NN \vrule \tex_vrule:D + \__expl_primitive:NN \leaders \tex_leaders:D + \__expl_primitive:NN \cleaders \tex_cleaders:D + \__expl_primitive:NN \xleaders \tex_xleaders:D + \__expl_primitive:NN \lastkern \tex_lastkern:D + \__expl_primitive:NN \lastskip \tex_lastskip:D + \__expl_primitive:NN \indent \tex_indent:D + \__expl_primitive:NN \par \tex_par:D + \__expl_primitive:NN \noindent \tex_noindent:D + \__expl_primitive:NN \vadjust \tex_vadjust:D + \__expl_primitive:NN \baselineskip \tex_baselineskip:D + \__expl_primitive:NN \lineskip \tex_lineskip:D + \__expl_primitive:NN \lineskiplimit \tex_lineskiplimit:D + \__expl_primitive:NN \clubpenalty \tex_clubpenalty:D + \__expl_primitive:NN \widowpenalty \tex_widowpenalty:D + \__expl_primitive:NN \exhyphenpenalty \tex_exhyphenpenalty:D + \__expl_primitive:NN \hyphenpenalty \tex_hyphenpenalty:D + \__expl_primitive:NN \linepenalty \tex_linepenalty:D + \__expl_primitive:NN \doublehyphendemerits \tex_doublehyphendemerits:D + \__expl_primitive:NN \finalhyphendemerits \tex_finalhyphendemerits:D + \__expl_primitive:NN \adjdemerits \tex_adjdemerits:D + \__expl_primitive:NN \hangafter \tex_hangafter:D + \__expl_primitive:NN \hangindent \tex_hangindent:D + \__expl_primitive:NN \parshape \tex_parshape:D + \__expl_primitive:NN \hsize \tex_hsize:D + \__expl_primitive:NN \lefthyphenmin \tex_lefthyphenmin:D + \__expl_primitive:NN \righthyphenmin \tex_righthyphenmin:D + \__expl_primitive:NN \leftskip \tex_leftskip:D + \__expl_primitive:NN \rightskip \tex_rightskip:D + \__expl_primitive:NN \looseness \tex_looseness:D + \__expl_primitive:NN \parskip \tex_parskip:D + \__expl_primitive:NN \parindent \tex_parindent:D + \__expl_primitive:NN \uchyph \tex_uchyph:D + \__expl_primitive:NN \emergencystretch \tex_emergencystretch:D + \__expl_primitive:NN \pretolerance \tex_pretolerance:D + \__expl_primitive:NN \tolerance \tex_tolerance:D + \__expl_primitive:NN \spaceskip \tex_spaceskip:D + \__expl_primitive:NN \xspaceskip \tex_xspaceskip:D + \__expl_primitive:NN \parfillskip \tex_parfillskip:D + \__expl_primitive:NN \everypar \tex_everypar:D + \__expl_primitive:NN \prevgraf \tex_prevgraf:D + \__expl_primitive:NN \spacefactor \tex_spacefactor:D + \__expl_primitive:NN \shipout \tex_shipout:D + \__expl_primitive:NN \vsize \tex_vsize:D + \__expl_primitive:NN \interlinepenalty \tex_interlinepenalty:D + \__expl_primitive:NN \brokenpenalty \tex_brokenpenalty:D + \__expl_primitive:NN \topskip \tex_topskip:D + \__expl_primitive:NN \maxdeadcycles \tex_maxdeadcycles:D + \__expl_primitive:NN \maxdepth \tex_maxdepth:D + \__expl_primitive:NN \output \tex_output:D + \__expl_primitive:NN \deadcycles \tex_deadcycles:D + \__expl_primitive:NN \pagedepth \tex_pagedepth:D + \__expl_primitive:NN \pagestretch \tex_pagestretch:D + \__expl_primitive:NN \pagefilstretch \tex_pagefilstretch:D + \__expl_primitive:NN \pagefillstretch \tex_pagefillstretch:D + \__expl_primitive:NN \pagefilllstretch \tex_pagefilllstretch:D + \__expl_primitive:NN \pageshrink \tex_pageshrink:D + \__expl_primitive:NN \pagegoal \tex_pagegoal:D + \__expl_primitive:NN \pagetotal \tex_pagetotal:D + \__expl_primitive:NN \outputpenalty \tex_outputpenalty:D + \__expl_primitive:NN \hoffset \tex_hoffset:D + \__expl_primitive:NN \voffset \tex_voffset:D + \__expl_primitive:NN \insert \tex_insert:D + \__expl_primitive:NN \holdinginserts \tex_holdinginserts:D + \__expl_primitive:NN \floatingpenalty \tex_floatingpenalty:D + \__expl_primitive:NN \insertpenalties \tex_insertpenalties:D + \__expl_primitive:NN \lower \tex_lower:D + \__expl_primitive:NN \moveleft \tex_moveleft:D + \__expl_primitive:NN \moveright \tex_moveright:D + \__expl_primitive:NN \raise \tex_raise:D + \__expl_primitive:NN \copy \tex_copy:D + \__expl_primitive:NN \lastbox \tex_lastbox:D + \__expl_primitive:NN \vsplit \tex_vsplit:D + \__expl_primitive:NN \unhbox \tex_unhbox:D + \__expl_primitive:NN \unhcopy \tex_unhcopy:D + \__expl_primitive:NN \unvbox \tex_unvbox:D + \__expl_primitive:NN \unvcopy \tex_unvcopy:D + \__expl_primitive:NN \setbox \tex_setbox:D + \__expl_primitive:NN \hbox \tex_hbox:D + \__expl_primitive:NN \vbox \tex_vbox:D + \__expl_primitive:NN \vtop \tex_vtop:D + \__expl_primitive:NN \prevdepth \tex_prevdepth:D + \__expl_primitive:NN \badness \tex_badness:D + \__expl_primitive:NN \hbadness \tex_hbadness:D + \__expl_primitive:NN \vbadness \tex_vbadness:D + \__expl_primitive:NN \hfuzz \tex_hfuzz:D + \__expl_primitive:NN \vfuzz \tex_vfuzz:D + \__expl_primitive:NN \overfullrule \tex_overfullrule:D + \__expl_primitive:NN \boxmaxdepth \tex_boxmaxdepth:D + \__expl_primitive:NN \splitmaxdepth \tex_splitmaxdepth:D + \__expl_primitive:NN \splittopskip \tex_splittopskip:D + \__expl_primitive:NN \everyhbox \tex_everyhbox:D + \__expl_primitive:NN \everyvbox \tex_everyvbox:D + \__expl_primitive:NN \nullfont \tex_nullfont:D + \__expl_primitive:NN \textfont \tex_textfont:D + \__expl_primitive:NN \scriptfont \tex_scriptfont:D + \__expl_primitive:NN \scriptscriptfont \tex_scriptscriptfont:D + \__expl_primitive:NN \fontdimen \tex_fontdimen:D + \__expl_primitive:NN \hyphenchar \tex_hyphenchar:D + \__expl_primitive:NN \skewchar \tex_skewchar:D + \__expl_primitive:NN \defaulthyphenchar \tex_defaulthyphenchar:D + \__expl_primitive:NN \defaultskewchar \tex_defaultskewchar:D + \__expl_primitive:NN \number \tex_number:D + \__expl_primitive:NN \romannumeral \tex_romannumeral:D + \__expl_primitive:NN \string \tex_string:D + \__expl_primitive:NN \lowercase \tex_lowercase:D + \__expl_primitive:NN \uppercase \tex_uppercase:D + \__expl_primitive:NN \meaning \tex_meaning:D + \__expl_primitive:NN \penalty \tex_penalty:D + \__expl_primitive:NN \unpenalty \tex_unpenalty:D + \__expl_primitive:NN \lastpenalty \tex_lastpenalty:D + \__expl_primitive:NN \special \tex_special:D + \__expl_primitive:NN \dump \tex_dump:D + \__expl_primitive:NN \patterns \tex_patterns:D + \__expl_primitive:NN \hyphenation \tex_hyphenation:D + \__expl_primitive:NN \time \tex_time:D + \__expl_primitive:NN \day \tex_day:D + \__expl_primitive:NN \month \tex_month:D + \__expl_primitive:NN \year \tex_year:D + \__expl_primitive:NN \jobname \tex_jobname:D + \__expl_primitive:NN \everyjob \tex_everyjob:D + \__expl_primitive:NN \count \tex_count:D + \__expl_primitive:NN \dimen \tex_dimen:D + \__expl_primitive:NN \skip \tex_skip:D + \__expl_primitive:NN \toks \tex_toks:D + \__expl_primitive:NN \muskip \tex_muskip:D + \__expl_primitive:NN \box \tex_box:D + \__expl_primitive:NN \wd \tex_wd:D + \__expl_primitive:NN \ht \tex_ht:D + \__expl_primitive:NN \dp \tex_dp:D + \__expl_primitive:NN \catcode \tex_catcode:D + \__expl_primitive:NN \delcode \tex_delcode:D + \__expl_primitive:NN \sfcode \tex_sfcode:D + \__expl_primitive:NN \lccode \tex_lccode:D + \__expl_primitive:NN \uccode \tex_uccode:D + \__expl_primitive:NN \mathcode \tex_mathcode:D + \__expl_primitive:NN \ifdefined \etex_ifdefined:D + \__expl_primitive:NN \ifcsname \etex_ifcsname:D + \__expl_primitive:NN \unless \etex_unless:D + \__expl_primitive:NN \eTeXversion \etex_eTeXversion:D + \__expl_primitive:NN \eTeXrevision \etex_eTeXrevision:D + \__expl_primitive:NN \marks \etex_marks:D + \__expl_primitive:NN \topmarks \etex_topmarks:D + \__expl_primitive:NN \firstmarks \etex_firstmarks:D + \__expl_primitive:NN \botmarks \etex_botmarks:D + \__expl_primitive:NN \splitfirstmarks \etex_splitfirstmarks:D + \__expl_primitive:NN \splitbotmarks \etex_splitbotmarks:D + \__expl_primitive:NN \unexpanded \etex_unexpanded:D + \__expl_primitive:NN \detokenize \etex_detokenize:D + \__expl_primitive:NN \scantokens \etex_scantokens:D + \__expl_primitive:NN \showtokens \etex_showtokens:D + \__expl_primitive:NN \readline \etex_readline:D + \__expl_primitive:NN \tracingassigns \etex_tracingassigns:D + \__expl_primitive:NN \tracingscantokens \etex_tracingscantokens:D + \__expl_primitive:NN \tracingnesting \etex_tracingnesting:D + \__expl_primitive:NN \tracingifs \etex_tracingifs:D + \__expl_primitive:NN \currentiflevel \etex_currentiflevel:D + \__expl_primitive:NN \currentifbranch \etex_currentifbranch:D + \__expl_primitive:NN \currentiftype \etex_currentiftype:D + \__expl_primitive:NN \tracinggroups \etex_tracinggroups:D + \__expl_primitive:NN \currentgrouplevel \etex_currentgrouplevel:D + \__expl_primitive:NN \currentgrouptype \etex_currentgrouptype:D + \__expl_primitive:NN \showgroups \etex_showgroups:D + \__expl_primitive:NN \showifs \etex_showifs:D + \__expl_primitive:NN \interactionmode \etex_interactionmode:D + \__expl_primitive:NN \lastnodetype \etex_lastnodetype:D + \__expl_primitive:NN \iffontchar \etex_iffontchar:D + \__expl_primitive:NN \fontcharht \etex_fontcharht:D + \__expl_primitive:NN \fontchardp \etex_fontchardp:D + \__expl_primitive:NN \fontcharwd \etex_fontcharwd:D + \__expl_primitive:NN \fontcharic \etex_fontcharic:D + \__expl_primitive:NN \parshapeindent \etex_parshapeindent:D + \__expl_primitive:NN \parshapelength \etex_parshapelength:D + \__expl_primitive:NN \parshapedimen \etex_parshapedimen:D + \__expl_primitive:NN \numexpr \etex_numexpr:D + \__expl_primitive:NN \dimexpr \etex_dimexpr:D + \__expl_primitive:NN \glueexpr \etex_glueexpr:D + \__expl_primitive:NN \muexpr \etex_muexpr:D + \__expl_primitive:NN \gluestretch \etex_gluestretch:D + \__expl_primitive:NN \glueshrink \etex_glueshrink:D + \__expl_primitive:NN \gluestretchorder \etex_gluestretchorder:D + \__expl_primitive:NN \glueshrinkorder \etex_glueshrinkorder:D + \__expl_primitive:NN \gluetomu \etex_gluetomu:D + \__expl_primitive:NN \mutoglue \etex_mutoglue:D + \__expl_primitive:NN \lastlinefit \etex_lastlinefit:D + \__expl_primitive:NN \interlinepenalties \etex_interlinepenalties:D + \__expl_primitive:NN \clubpenalties \etex_clubpenalties:D + \__expl_primitive:NN \widowpenalties \etex_widowpenalties:D + \__expl_primitive:NN \displaywidowpenalties \etex_displaywidowpenalties:D + \__expl_primitive:NN \middle \etex_middle:D + \__expl_primitive:NN \savinghyphcodes \etex_savinghyphcodes:D + \__expl_primitive:NN \savingvdiscards \etex_savingvdiscards:D + \__expl_primitive:NN \pagediscards \etex_pagediscards:D + \__expl_primitive:NN \splitdiscards \etex_splitdiscards:D + \__expl_primitive:NN \TeXXeTstate \etex_TeXXeTstate:D + \__expl_primitive:NN \beginL \etex_beginL:D + \__expl_primitive:NN \endL \etex_endL:D + \__expl_primitive:NN \beginR \etex_beginR:D + \__expl_primitive:NN \endR \etex_endR:D + \__expl_primitive:NN \predisplaydirection \etex_predisplaydirection:D + \__expl_primitive:NN \everyeof \etex_everyeof:D + \__expl_primitive:NN \protected \etex_protected:D + \__expl_primitive:NN \pdfcreationdate \pdftex_pdfcreationdate:D + \__expl_primitive:NN \pdfcolorstack \pdftex_pdfcolorstack:D + \__expl_primitive:NN \pdfcompresslevel \pdftex_pdfcompresslevel:D + \__expl_primitive:NN \pdfdecimaldigits \pdftex_pdfdecimaldigits:D + \__expl_primitive:NN \pdfhorigin \pdftex_pdfhorigin:D + \__expl_primitive:NN \pdfinfo \pdftex_pdfinfo:D + \__expl_primitive:NN \pdflastxform \pdftex_pdflastxform:D + \__expl_primitive:NN \pdfliteral \pdftex_pdfliteral:D + \__expl_primitive:NN \pdfminorversion \pdftex_pdfminorversion:D + \__expl_primitive:NN \pdfobjcompresslevel \pdftex_pdfobjcompresslevel:D + \__expl_primitive:NN \pdfoutput \pdftex_pdfoutput:D + \__expl_primitive:NN \pdfrefxform \pdftex_pdfrefxform:D + \__expl_primitive:NN \pdfrestore \pdftex_pdfrestore:D + \__expl_primitive:NN \pdfsave \pdftex_pdfsave:D + \__expl_primitive:NN \pdfsetmatrix \pdftex_pdfsetmatrix:D + \__expl_primitive:NN \pdfpkresolution \pdftex_pdfpkresolution:D + \__expl_primitive:NN \pdftexrevision \pdftex_pdftextrevision:D + \__expl_primitive:NN \pdfvorigin \pdftex_pdfvorigin:D + \__expl_primitive:NN \pdfxform \pdftex_pdfxform:D + \__expl_primitive:NN \pdfstrcmp \pdftex_strcmp:D + \__expl_primitive:NN \XeTeXversion \xetex_XeTeXversion:D + \__expl_primitive:NN \catcodetable \luatex_catcodetable:D + \__expl_primitive:NN \directlua \luatex_directlua:D + \__expl_primitive:NN \initcatcodetable \luatex_initcatcodetable:D + \__expl_primitive:NN \latelua \luatex_latelua:D + \__expl_primitive:NN \luatexversion \luatex_luatexversion:D + \__expl_primitive:NN \savecatcodetable \luatex_savecatcodetable:D \tex_endgroup:D \tex_let:D \tex_end:D \@@end \tex_let:D \tex_everydisplay:D \frozen@everydisplay \tex_let:D \tex_everymath:D \frozen@everymath \tex_let:D \tex_hyphen:D \@@hyph \tex_let:D \tex_input:D \@@input -\tex_let:D \tex_italic_correction:D \@@italiccorr +\tex_let:D \tex_italiccorrection:D \@@italiccorr \tex_let:D \tex_underline:D \@@underline \tex_let:D \luatex_catcodetable:D \luatexcatcodetable \tex_let:D \luatex_initcatcodetable:D \luatexinitcatcodetable diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty b/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty index 51b98fabb03..6433a8eb325 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty @@ -13,7 +13,7 @@ %% %% Do not distribute a modified version of this file. %% -%% File: l3prg.dtx Copyright (C) 2005-2011 The LaTeX3 Project +%% File: l3prg.dtx Copyright (C) 2005-2012 The 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 @@ -46,12 +46,12 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3prg.dtx 3490 2012-03-04 01:00:53Z bruno $ - {L3 Experimental control structures} +\GetIdInfo$Id: l3prg.dtx 3986 2012-07-15 19:23:51Z joseph $ + {L3 Control structures} %% \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\package_check_loaded_expl: +\__expl_package_check: \tex_let:D \if_bool:N \tex_ifodd:D \tex_let:D \if_predicate:w \tex_ifodd:D \cs_new_protected:Npn \bool_new:N #1 { \cs_new_eq:NN #1 \c_false_bool } @@ -99,19 +99,21 @@ \bool_if_exist:NTF #1 { \bool_show:n {#1} } { - \msg_kernel_error:nnx { kernel } { variable-not-defined } + \__msg_kernel_error:nnx { kernel } { variable-not-defined } { \token_to_str:N #1 } } } \cs_new_protected:Npn \bool_show:n #1 { \bool_if:nTF {#1} - { \msg_aux_show:x { > true } } - { \msg_aux_show:x { > false } } + { \__msg_show_variable:x { > true } } + { \__msg_show_variable:x { > false } } } \cs_generate_variant:Nn \bool_show:N { c } \bool_new:N \l_tmpa_bool +\bool_new:N \l_tmpb_bool \bool_new:N \g_tmpa_bool +\bool_new:N \g_tmpb_bool \cs_new_eq:NN \bool_if_exist:NTF \cs_if_exist:NTF \cs_new_eq:NN \bool_if_exist:NT \cs_if_exist:NT \cs_new_eq:NN \bool_if_exist:NF \cs_if_exist:NF @@ -131,126 +133,75 @@ \cs_new:Npn \bool_if_p:n #1 { \group_align_safe_begin: - \bool_get_next:N ( #1 ) S + \__bool_if_left_parentheses:wwwn \q_nil + #1 \q_mark { } + ( \q_mark { \__bool_if_right_parentheses:wwwn \q_nil } + ) \q_mark { \__bool_if_or:wwwn \q_nil } + || \q_mark \__bool_if_parse:NNNww + \q_stop } -\cs_new:Npn \bool_get_next:N #1 +\cs_new:Npn \__bool_if_left_parentheses:wwwn #1 \q_nil #2 ( #3 \q_mark #4 + { #4 \__bool_if_left_parentheses:wwwn #1 #2 (( \q_nil #3 \q_mark {#4} } +\cs_new:Npn \__bool_if_right_parentheses:wwwn #1 \q_nil #2 ) #3 \q_mark #4 + { #4 \__bool_if_right_parentheses:wwwn #1 #2 )) \q_nil #3 \q_mark {#4} } +\cs_new:Npn \__bool_if_or:wwwn #1 \q_nil #2 || #3 \q_mark #4 + { #4 \__bool_if_or:wwwn #1 #2 )||( \q_nil #3 \q_mark {#4} } +\cs_new:Npn \__bool_if_parse:NNNww #1#2#3#4 \q_mark #5 \q_stop { - \use:c - { - bool_ - \if_meaning:w !#1 ! \else: \if_meaning:w (#1 ( \else: p \fi: \fi: - :w - } - #1 + \__bool_get_next:NN \use_i:nn (( #4 )) S } -\cs_new:Npn \bool_get_not_next:N #1 +\cs_new:Npn \__bool_get_next:NN #1#2 { \use:c { - bool_not_ - \if_meaning:w !#1 ! \else: \if_meaning:w (#1 ( \else: p \fi: \fi: - :w + __bool_ + \if_meaning:w !#2 ! \else: \if_meaning:w (#2 ( \else: p \fi: \fi: + :Nw } - #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 \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 + #1 #2 } -\cs_new:Npn \bool_Not:w { \exp_after:wN \int_value:w \bool_get_not_next:N } -\cs_new:Npn \bool_not_Not:w { \exp_after:wN \int_value:w \bool_get_next:N } -\cs_new:Npn \bool_Not:N #1 +\cs_new:cpn { __bool_!:Nw } #1#2 + { \exp_after:wN \__bool_get_next:NN #1 \use_ii:nn \use_i:nn } +\cs_new:cpn { __bool_(:Nw } #1#2 { - \exp_after:wN \bool_p:w - \if_meaning:w #1 \c_true_bool - \c_false_bool - \else: - \c_true_bool - \fi: + \exp_after:wN \__bool_choose:NNN \exp_after:wN #1 + \__int_value:w \__bool_get_next:NN \use_i:nn } -\cs_new:Npn \bool_not_Not:N #1 +\cs_new:cpn { __bool_p:Nw } #1 + { \exp_after:wN \__bool_choose:NNN \exp_after:wN #1 \__int_value:w } +\cs_new:Npn \__bool_choose:NNN #1#2#3 { - \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 \int_value:w \bool_get_next:N } -\cs_new:cpn { bool_not_(:w } #1 - { \exp_after:wN \bool_not_cleanup:N \int_value:w \bool_get_next:N } -\cs_new:cpn { bool_p:w } { \exp_after:wN \bool_cleanup:N \int_value:w } -\cs_new:cpn { bool_not_p:w } {\exp_after:wN \bool_not_cleanup:N \int_value:w } -\cs_new:Npn \bool_cleanup:N #1 - { - \exp_after:wN \bool_choose:NN \exp_after:wN #1 - \int_to_roman:w - `\q - } -\cs_new:Npn \bool_not_cleanup:N #1 - { - \exp_after:wN \bool_not_choose:NN \exp_after:wN #1 - \int_to_roman:w - `\q + \use:c + { + __bool_ #3 _ + #1 #2 { \if_meaning:w 0 #2 1 \else: 0 \fi: } + :w + } } -\cs_new:Npn \bool_choose:NN #1#2 { \use:c { bool_ #2 _ #1 :w } } -\cs_new: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_new_nopar:cpn { bool_&_0:w } & { \bool_eval_skip_to_end:Nw \c_false_bool } -\cs_new_nopar:cpn { bool_|_1:w } | { \bool_eval_skip_to_end:Nw \c_true_bool } -\cs_new_nopar:cpn { bool_not_&_1:w } & - { \bool_eval_skip_to_end:Nw \c_false_bool } -\cs_new_nopar:cpn { bool_not_|_0:w } | - { \bool_eval_skip_to_end:Nw \c_true_bool } +\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_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_new_nopar:cpn { __bool_&_1:w } & { \__bool_get_next:NN \use_i:nn } +\cs_new_nopar:cpn { __bool_|_0:w } | { \__bool_get_next:NN \use_i:nn } +\cs_new_nopar:cpn { __bool_&_0:w } & { \__bool_eval_skip_to_end:Nw \c_false_bool } +\cs_new_nopar:cpn { __bool_|_1:w } | { \__bool_eval_skip_to_end:Nw \c_true_bool } %% ( -\cs_new:Npn \bool_eval_skip_to_end:Nw #1#2 ) +\cs_new:Npn \__bool_eval_skip_to_end:Nw #1#2 ) { - \bool_eval_skip_to_end_aux:Nw #1#2 ( % ) + \__bool_eval_skip_to_end_ii: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 % ) +\cs_new:Npn \__bool_eval_skip_to_end_ii:Nw #1#2 ( #3#4 \q_stop #5 % ) { \quark_if_no_value:NTF #3 {#1} - { \bool_eval_skip_to_end_aux_ii:Nw #1 #5 } + { \__bool_eval_skip_to_end_iii:Nw #1 #5 } } -\cs_new:Npn \bool_eval_skip_to_end_aux_ii:Nw #1#2 ( #3 ) +\cs_new:Npn \__bool_eval_skip_to_end_iii:Nw #1#2 ( #3 ) { % ( - \bool_eval_skip_to_end:Nw #1#3 ) + \__bool_eval_skip_to_end:Nw #1#3 ) } \cs_new:Npn \bool_not_p:n #1 { \bool_if_p:n { ! ( #1 ) } } \cs_new:Npn \bool_xor_p:nn #1#2 @@ -297,161 +248,50 @@ #2 \bool_if:nF {#1} { \bool_do_until:nn {#1} {#2} } } -\cs_new:Npn \prg_case_end:nw #1 #2 \q_recursion_stop { \c_zero #1 } -\cs_new:Npn \prg_case_int:nnn #1 - { - \tex_romannumeral:D - \exp_args:Nf \prg_case_int_aux:nnn { \int_eval:n {#1} } - } -\cs_new:Npn \prg_case_int_aux:nnn #1 #2 #3 - { \prg_case_int_aux:nw {#1} #2 {#1} {#3} \q_recursion_stop } -\cs_new:Npn \prg_case_int_aux:nw #1#2#3 - { - \int_compare:nNnTF {#1} = {#2} - { \prg_case_end:nw {#3} } - { \prg_case_int_aux:nw {#1} } - } -\cs_new:Npn \prg_case_dim:nnn #1 - { - \tex_romannumeral:D - \exp_args:Nf \prg_case_dim_aux:nnn { \dim_eval:n {#1} } - } -\cs_new:Npn \prg_case_dim_aux:nnn #1 #2 #3 - { \prg_case_dim_aux:nw {#1} #2 {#1} {#3} \q_recursion_stop } -\cs_new:Npn \prg_case_dim_aux:nw #1#2#3 - { - \dim_compare:nNnTF {#1} = {#2} - { \prg_case_end:nw {#3} } - { \prg_case_dim_aux:nw {#1} } - } -\cs_new:Npn \prg_case_str:nnn #1#2#3 - { - \tex_romannumeral:D - \prg_case_str_aux:nw {#1} #2 {#1} {#3} \q_recursion_stop - } -\cs_new:Npn \prg_case_str_aux:nw #1#2#3 - { - \str_if_eq:nnTF {#1} {#2} - { \prg_case_end:nw {#3} } - { \prg_case_str_aux:nw {#1} } - } -\cs_generate_variant:Nn \prg_case_str:nnn { o } -\cs_new:Npn \prg_case_str:xxn #1#2#3 - { - \tex_romannumeral:D - \prg_case_str_x_aux:nw {#1} #2 {#1} {#3} \q_recursion_stop - } -\cs_new:Npn \prg_case_str_x_aux:nw #1#2#3 - { - \str_if_eq:xxTF {#1} {#2} - { \prg_case_end:nw {#3} } - { \prg_case_str_x_aux:nw {#1} } - } -\cs_new:Npn \prg_case_tl:Nnn #1#2#3 - { - \tex_romannumeral:D - \prg_case_tl_aux:Nw #1 #2 #1 {#3} \q_recursion_stop - } -\cs_new:Npn \prg_case_tl_aux:Nw #1#2#3 - { - \tl_if_eq:NNTF #1 #2 - { \prg_case_end:nw {#3} } - { \prg_case_tl_aux:Nw #1 } - } -\cs_generate_variant:Nn \prg_case_tl:Nnn { c } \cs_new:Npn \prg_replicate:nn #1 { - \int_to_roman:w - \exp_after:wN \prg_replicate_first_aux:N - \int_value:w \int_eval:w #1 \int_eval_end: + \__int_to_roman:w + \exp_after:wN \__prg_replicate_first:N + \__int_value:w \__int_eval:w #1 \__int_eval_end: \cs_end: } -\cs_new:Npn \prg_replicate_aux:N #1 - { \cs:w prg_replicate_#1 :n \prg_replicate_aux:N } -\cs_new:Npn \prg_replicate_first_aux:N #1 - { \cs:w prg_replicate_first_ #1 :n \prg_replicate_aux:N } -\cs_new:Npn \prg_replicate_ :n #1 { \cs_end: } -\cs_new:cpn { prg_replicate_0:n } #1 { \cs_end: {#1#1#1#1#1#1#1#1#1#1} } -\cs_new:cpn { prg_replicate_1:n } #1 { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1 } -\cs_new:cpn { prg_replicate_2:n } #1 { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1#1 } -\cs_new:cpn { prg_replicate_3:n } #1 +\cs_new:Npn \__prg_replicate:N #1 + { \cs:w __prg_replicate_#1 :n \__prg_replicate:N } +\cs_new:Npn \__prg_replicate_first:N #1 + { \cs:w __prg_replicate_first_ #1 :n \__prg_replicate:N } +\cs_new:Npn \__prg_replicate_ :n #1 { \cs_end: } +\cs_new:cpn { __prg_replicate_0:n } #1 { \cs_end: {#1#1#1#1#1#1#1#1#1#1} } +\cs_new:cpn { __prg_replicate_1:n } #1 { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1 } +\cs_new:cpn { __prg_replicate_2:n } #1 { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1#1 } +\cs_new:cpn { __prg_replicate_3:n } #1 { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1#1#1 } -\cs_new:cpn { prg_replicate_4:n } #1 +\cs_new:cpn { __prg_replicate_4:n } #1 { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1#1#1#1 } -\cs_new:cpn { prg_replicate_5:n } #1 +\cs_new:cpn { __prg_replicate_5:n } #1 { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1#1#1#1#1 } -\cs_new:cpn { prg_replicate_6:n } #1 +\cs_new:cpn { __prg_replicate_6:n } #1 { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1#1#1#1#1#1 } -\cs_new:cpn { prg_replicate_7:n } #1 +\cs_new:cpn { __prg_replicate_7:n } #1 { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1#1#1#1#1#1#1 } -\cs_new:cpn { prg_replicate_8:n } #1 +\cs_new:cpn { __prg_replicate_8:n } #1 { \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_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 - { \c_zero \msg_expandable_kernel_error:nn { prg } { replicate-neg } } -\cs_new:cpn { prg_replicate_first_0:n } #1 { \c_zero } -\cs_new:cpn { prg_replicate_first_1:n } #1 { \c_zero #1 } -\cs_new:cpn { prg_replicate_first_2:n } #1 { \c_zero #1#1 } -\cs_new:cpn { prg_replicate_first_3:n } #1 { \c_zero #1#1#1 } -\cs_new:cpn { prg_replicate_first_4:n } #1 { \c_zero #1#1#1#1 } -\cs_new:cpn { prg_replicate_first_5:n } #1 { \c_zero #1#1#1#1#1 } -\cs_new:cpn { prg_replicate_first_6:n } #1 { \c_zero #1#1#1#1#1#1 } -\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#3#4 - { - \prg_stepwise_aux:nnnN {#1} {#2} {#3} #4 - \prg_break_point:n { } - } -\cs_new:Npn \prg_stepwise_aux:nnnN #1#2#3#4 - { - \int_compare:nNnTF {#2} > \c_zero - { \exp_args:NNf \prg_stepwise_aux:NnnnN > } - { - \int_compare:nNnTF {#2} = \c_zero - { - \msg_expandable_kernel_error:nnn { prg } { zero-step } {#4} - \prg_map_break: - } - { \exp_args:NNf \prg_stepwise_aux:NnnnN < } - } - { \int_eval:n {#1} } {#2} {#3} #4 - } -\cs_new:Npn \prg_stepwise_aux:NnnnN #1#2#3#4#5 - { - \int_compare:nNnF {#2} #1 {#4} - { - #5 {#2} - \exp_args:NNf \prg_stepwise_aux:NnnnN - #1 { \int_eval:n { #2 + #3 } } {#3} {#4} #5 - } - } -\cs_new_protected:Npn \prg_stepwise_inline:nnnn - { - \exp_args:NNc \prg_stepwise_aux:NNnnnn - \cs_gset_nopar:Npn - { g_prg_stepwise_ \int_use:N \g_prg_map_int :n } - } -\cs_new_protected:Npn \prg_stepwise_variable:nnnNn #1#2#3#4#5 - { - \exp_args:NNc \prg_stepwise_aux:NNnnnn - \cs_gset_nopar:Npx - { g_prg_stepwise_ \int_use:N \g_prg_map_int :n } - {#1}{#2}{#3} - { - \tl_set:Nn \exp_not:N #4 {##1} - \exp_not:n {#5} - } - } -\cs_new_protected:Npn \prg_stepwise_aux:NNnnnn #1#2#3#4#5#6 - { - #1 #2 ##1 {#6} - \int_gincr:N \g_prg_map_int - \prg_stepwise_aux:nnnN {#3} {#4} {#5} #2 - \prg_break_point:n { \int_gdecr:N \g_prg_map_int } - } +\cs_new:cpn { __prg_replicate_first_-:n } #1 + { + \c_zero + \__msg_kernel_expandable_error:nn { kernel } { negative-replication } + } +\cs_new:cpn { __prg_replicate_first_0:n } #1 { \c_zero } +\cs_new:cpn { __prg_replicate_first_1:n } #1 { \c_zero #1 } +\cs_new:cpn { __prg_replicate_first_2:n } #1 { \c_zero #1#1 } +\cs_new:cpn { __prg_replicate_first_3:n } #1 { \c_zero #1#1#1 } +\cs_new:cpn { __prg_replicate_first_4:n } #1 { \c_zero #1#1#1#1 } +\cs_new:cpn { __prg_replicate_first_5:n } #1 { \c_zero #1#1#1#1#1 } +\cs_new:cpn { __prg_replicate_first_6:n } #1 { \c_zero #1#1#1#1#1#1 } +\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 } \prg_new_conditional:Npnn \mode_if_vertical: { p , T , F , TF } { \if_mode_vertical: \prg_return_true: \else: \prg_return_false: \fi: } \prg_new_conditional:Npnn \mode_if_horizontal: { p , T , F , TF } @@ -466,117 +306,51 @@ { \if_int_compare:w `{ = \c_zero } \fi: } \cs_new_protected_nopar:Npn \scan_align_safe_stop: { } \group_begin: - \tex_lccode:D `\& = `\g \scan_stop: - \tex_catcode:D `\& = \c_twelve + \tex_lccode:D `* = `g \scan_stop: + \tex_catcode:D `* = \c_twelve \tl_to_lowercase:n { \group_end: - \cs_new:Npn \prg_variable_get_scope:N #1 + \cs_new:Npn \__prg_variable_get_scope:N #1 { \exp_after:wN \exp_after:wN - \exp_after:wN \prg_variable_get_scope_aux:w + \exp_after:wN \__prg_variable_get_scope:w \cs_to_str:N #1 \exp_stop_f: \q_stop } - \cs_new:Npn \prg_variable_get_scope_aux:w #1#2 \q_stop - { \token_if_eq_meaning:NNT & #1 { g } } + \cs_new:Npn \__prg_variable_get_scope:w #1#2 \q_stop + { \token_if_eq_meaning:NNT * #1 { g } } } \group_begin: - \tex_lccode:D `\& = `\_ \scan_stop: - \tex_catcode:D `\& = \c_twelve + \tex_lccode:D `* = `_ \scan_stop: + \tex_catcode:D `* = \c_twelve \tl_to_lowercase:n { \group_end: - \cs_new:Npn \prg_variable_get_type:N #1 + \cs_new:Npn \__prg_variable_get_type:N #1 { - \exp_after:wN \prg_variable_get_type_aux:w - \token_to_str:N #1 & a \q_stop + \exp_after:wN \__prg_variable_get_type:w + \token_to_str:N #1 * a \q_stop } - \cs_new:Npn \prg_variable_get_type_aux:w #1 & #2#3 \q_stop + \cs_new:Npn \__prg_variable_get_type:w #1 * #2#3 \q_stop { \token_if_eq_meaning:NNTF a #2 {#1} - { \prg_variable_get_type_aux:w #2#3 \q_stop } + { \__prg_variable_get_type:w #2#3 \q_stop } } } -\int_new:N \g_prg_map_int -\cs_new_protected: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} - } - \cs_set:cpx{#1_quicksort_braced:n}##1{ - \exp_not:c{#1_quicksort_start_partition_braced:n} ##1 - \exp_not:N\q_nil\exp_not:N\q_stop - } - \cs_set:cpx {#1_quicksort_start_partition:w} #2 ##1 #3{ - \exp_not:N \quark_if_nil:nT {##1}\exp_not:N \use_none_delimit_by_q_stop:w - \exp_not:c{#1_quicksort_do_partition_i:nnnw} {##1}{}{} - } - \cs_set:cpx {#1_quicksort_start_partition_braced:n} ##1 { - \exp_not:N \quark_if_nil:nT {##1}\exp_not:N \use_none_delimit_by_q_stop:w - \exp_not:c{#1_quicksort_do_partition_i_braced:nnnn} {##1}{}{} - } - \cs_set:cpx {#1_quicksort_do_partition_i:nnnw} ##1##2##3 #2 ##4 #3 { - \exp_not:N \quark_if_nil:nTF {##4} \exp_not:c {#1_do_quicksort_braced:nnnnw} - { - \exp_not:c{#1_quicksort_compare:nnTF}{##1}{##4} - \exp_not:c{#1_quicksort_partition_greater_ii:nnnn} - \exp_not:c{#1_quicksort_partition_less_ii:nnnn} - } - {##1}{##2}{##3}{##4} - } - \cs_set:cpx {#1_quicksort_do_partition_i_braced:nnnn} ##1##2##3##4 { - \exp_not:N \quark_if_nil:nTF {##4} \exp_not:c {#1_do_quicksort_braced:nnnnw} - { - \exp_not:c{#1_quicksort_compare:nnTF}{##1}{##4} - \exp_not:c{#1_quicksort_partition_greater_ii_braced:nnnn} - \exp_not:c{#1_quicksort_partition_less_ii_braced:nnnn} - } - {##1}{##2}{##3}{##4} - } - \cs_set:cpx {#1_quicksort_do_partition_ii:nnnw} ##1##2##3 #2 ##4 #3 { - \exp_not:N \quark_if_nil:nTF {##4} \exp_not:c {#1_do_quicksort_braced:nnnnw} - { - \exp_not:c{#1_quicksort_compare:nnTF}{##4}{##1} - \exp_not:c{#1_quicksort_partition_less_i:nnnn} - \exp_not:c{#1_quicksort_partition_greater_i:nnnn} - } - {##1}{##2}{##3}{##4} - } - \cs_set:cpx {#1_quicksort_do_partition_ii_braced:nnnn} ##1##2##3##4 { - \exp_not:N \quark_if_nil:nTF {##4} \exp_not:c {#1_do_quicksort_braced:nnnnw} - { - \exp_not:c{#1_quicksort_compare:nnTF}{##4}{##1} - \exp_not:c{#1_quicksort_partition_less_i_braced:nnnn} - \exp_not:c{#1_quicksort_partition_greater_i_braced:nnnn} - } - {##1}{##2}{##3}{##4} - } - \cs_set:cpx {#1_quicksort_partition_less_i:nnnn} ##1##2##3##4{ - \exp_not:c{#1_quicksort_do_partition_i:nnnw}{##1}{##2}{{##4}##3}} - \cs_set:cpx {#1_quicksort_partition_less_ii:nnnn} ##1##2##3##4{ - \exp_not:c{#1_quicksort_do_partition_ii:nnnw}{##1}{##2}{##3{##4}}} - \cs_set:cpx {#1_quicksort_partition_greater_i:nnnn} ##1##2##3##4{ - \exp_not:c{#1_quicksort_do_partition_i:nnnw}{##1}{{##4}##2}{##3}} - \cs_set:cpx {#1_quicksort_partition_greater_ii:nnnn} ##1##2##3##4{ - \exp_not:c{#1_quicksort_do_partition_ii:nnnw}{##1}{##2{##4}}{##3}} - \cs_set:cpx {#1_quicksort_partition_less_i_braced:nnnn} ##1##2##3##4{ - \exp_not:c{#1_quicksort_do_partition_i_braced:nnnn}{##1}{##2}{{##4}##3}} - \cs_set:cpx {#1_quicksort_partition_less_ii_braced:nnnn} ##1##2##3##4{ - \exp_not:c{#1_quicksort_do_partition_ii_braced:nnnn}{##1}{##2}{##3{##4}}} - \cs_set:cpx {#1_quicksort_partition_greater_i_braced:nnnn} ##1##2##3##4{ - \exp_not:c{#1_quicksort_do_partition_i_braced:nnnn}{##1}{{##4}##2}{##3}} - \cs_set:cpx {#1_quicksort_partition_greater_ii_braced:nnnn} ##1##2##3##4{ - \exp_not:c{#1_quicksort_do_partition_ii_braced:nnnn}{##1}{##2{##4}}{##3}} - \cs_set:cpx {#1_do_quicksort_braced:nnnnw} ##1##2##3##4\q_stop { - \exp_not:c{#1_quicksort_braced:n}{##2} - \exp_not:c{#1_quicksort_function:n}{##1} - \exp_not:c{#1_quicksort_braced:n}{##3} - } -} -\prg_define_quicksort:nnn {prg}{}{} -\cs_set:Npn \prg_quicksort_function:n {\ERROR} -\cs_set:Npn \prg_quicksort_compare:nnTF {\ERROR} +\int_new:N \g__prg_map_int +\cs_new_eq:NN \__prg_break_point: \prg_do_nothing: +\cs_new:Npn \__prg_break: #1 \__prg_break_point: { } +\cs_new:Npn \__prg_break:n #1#2 \__prg_break_point: {#1} +\cs_new_eq:NN \prg_case_int:nnn \int_case:nnn +\cs_new_eq:NN \prg_case_str:nnn \str_case:nnn +\cs_new_eq:NN \prg_case_str:onn \str_case:onn +\cs_new_eq:NN \prg_case_str:xxn \str_case_x:nnn +\cs_new_eq:NN \prg_case_tl:Nnn \tl_case:Nnn +\cs_new_eq:NN \prg_case_tl:cnn \tl_case:cnn +\cs_new_eq:NN \prg_stepwise_function:nnnN \int_step_function:nnnN +\cs_new_eq:NN \prg_stepwise_inline:nnnn \int_step_inline:nnnn +\cs_new_eq:NN \prg_stepwise_variable:nnnNn \int_step_variable:nnnNn %% %% %% End of file `l3prg.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3prop.sty b/Master/texmf-dist/tex/latex/l3kernel/l3prop.sty index 539f1539352..5699c49cc37 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3prop.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3prop.sty @@ -46,20 +46,19 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3prop.dtx 3490 2012-03-04 01:00:53Z bruno $ - {L3 Experimental property lists} -%% +\GetIdInfo$Id: l3prop.dtx 3986 2012-07-15 19:23:51Z joseph $ + {L3 Property lists} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\package_check_loaded_expl: -\quark_new:N \q_prop -\tl_const:Nn \c_empty_prop { \q_prop } +\__expl_package_check: +\quark_new:N \q__prop +\tl_const:Nn \c_empty_prop { \q__prop } \cs_new_protected:Npn \prop_new:N #1 { \cs_new_eq:NN #1 \c_empty_prop } \cs_new_protected:Npn \prop_new:c #1 { \cs_new_eq:cN {#1} \c_empty_prop } \cs_new_protected:Npn \prop_clear:N #1 { \cs_set_eq:NN #1 \c_empty_prop } -\cs_new_protected:Npn \prop_clear:c #1 { \cs_set_eq:cN {#1} \c_empty_prop } +\cs_generate_variant:Nn \prop_clear:N { c } \cs_new_protected:Npn \prop_gclear:N #1 { \cs_gset_eq:NN #1 \c_empty_prop } -\cs_new_protected:Npn \prop_gclear:c #1 { \cs_gset_eq:cN {#1} \c_empty_prop } +\cs_generate_variant:Nn \prop_gclear:N { c } \cs_new_protected:Npn \prop_clear_new:N #1 { \prop_if_exist:NTF #1 { \prop_clear:N #1 } { \prop_new:N #1 } } \cs_generate_variant:Nn \prop_clear_new:N { c } @@ -74,57 +73,55 @@ \cs_new_eq:NN \prop_gset_eq:Nc \tl_gset_eq:Nc \cs_new_eq:NN \prop_gset_eq:cN \tl_gset_eq:cN \cs_new_eq:NN \prop_gset_eq:cc \tl_gset_eq:cc -\cs_new_protected:Npn \prop_split:NnTF #1#2 - { \exp_args:NNo \prop_split_aux:NnTF #1 { \tl_to_str:n {#2} } } -\cs_new_protected:Npn \prop_split_aux:NnTF #1#2 - { - \cs_set_protected:Npn \prop_split_aux:w - ##1 \q_prop #2 \q_prop ##2 ##3 ##4 \q_mark ##5 \q_stop - { \prop_split_aux:nnnn ##3 { {##1 \q_prop } {##2} {##4} } } - \exp_after:wN \prop_split_aux:w #1 \q_mark - \q_prop #2 \q_prop { } { ? \use_ii:nn { } } \q_mark \q_stop - } -\cs_new:Npn \prop_split_aux:nnnn #1#2#3#4 { #3 #2 } -\cs_new_protected:Npn \prop_split_aux:w { } -\cs_new_protected:Npn \prop_split:Nnn #1#2#3 +\prop_new:N \l_tmpa_prop +\prop_new:N \l_tmpb_prop +\prop_new:N \g_tmpa_prop +\prop_new:N \g_tmpb_prop +\cs_new_protected:Npn \__prop_split:NnTF #1#2 + { \exp_args:NNo \__prop_split_aux:NnTF #1 { \tl_to_str:n {#2} } } +\cs_new_protected:Npn \__prop_split_aux:NnTF #1#2 { - \prop_split:NnTF #1 {#2} - {#3} - { \exp_args:Nno \use:n {#3} {#1} { \q_no_value } { } } + \cs_set_protected:Npn \__prop_split_aux:w + ##1 \q__prop #2 \q__prop ##2 ##3 ##4 \q_mark ##5 \q_stop + { \__prop_split_aux:nnnn ##3 { {##1 \q__prop } {##2} {##4} } } + \exp_after:wN \__prop_split_aux:w #1 \q_mark + \q__prop #2 \q__prop { } { ? \use_ii:nn { } } \q_mark \q_stop } -\cs_new_protected:Npn \prop_del:Nn #1#2 - { \prop_split:NnTF #1 {#2} { \prop_del_aux:NNnnn \tl_set:Nn #1 } { } } -\cs_new_protected:Npn \prop_gdel:Nn #1#2 - { \prop_split:NnTF #1 {#2} { \prop_del_aux:NNnnn \tl_gset:Nn #1 } { } } -\cs_new_protected:Npn \prop_del_aux:NNnnn #1#2#3#4#5 +\cs_new:Npn \__prop_split_aux:nnnn #1#2#3#4 { #3 #2 } +\cs_new_protected:Npn \__prop_split_aux:w { } +\cs_new_protected:Npn \prop_remove:Nn #1#2 + { \__prop_split:NnTF #1 {#2} { \__prop_remove:NNnnn \tl_set:Nn #1 } { } } +\cs_new_protected:Npn \prop_gremove:Nn #1#2 + { \__prop_split:NnTF #1 {#2} { \__prop_remove:NNnnn \tl_gset:Nn #1 } { } } +\cs_new_protected:Npn \__prop_remove:NNnnn #1#2#3#4#5 { #1 #2 { #3 #5 } } -\cs_generate_variant:Nn \prop_del:Nn { NV } -\cs_generate_variant:Nn \prop_del:Nn { c , cV } -\cs_generate_variant:Nn \prop_gdel:Nn { NV } -\cs_generate_variant:Nn \prop_gdel:Nn { c , cV } +\cs_generate_variant:Nn \prop_remove:Nn { NV } +\cs_generate_variant:Nn \prop_remove:Nn { c , cV } +\cs_generate_variant:Nn \prop_gremove:Nn { NV } +\cs_generate_variant:Nn \prop_gremove:Nn { c , cV } \cs_new_protected:Npn \prop_get:NnN #1#2#3 { - \prop_split:NnTF #1 {#2} - { \prop_get_aux:Nnnn #3 } + \__prop_split:NnTF #1 {#2} + { \__prop_get:Nnnn #3 } { \tl_set:Nn #3 { \q_no_value } } } -\cs_new_protected:Npn \prop_get_aux:Nnnn #1#2#3#4 +\cs_new_protected:Npn \__prop_get:Nnnn #1#2#3#4 { \tl_set:Nn #1 {#3} } \cs_generate_variant:Nn \prop_get:NnN { NV , No } \cs_generate_variant:Nn \prop_get:NnN { c , cV , co } \cs_new_protected:Npn \prop_pop:NnN #1#2#3 { - \prop_split:NnTF #1 {#2} - { \prop_pop_aux:NNNnnn \tl_set:Nn #1 #3 } + \__prop_split:NnTF #1 {#2} + { \__prop_pop:NNNnnn \tl_set:Nn #1 #3 } { \tl_set:Nn #3 { \q_no_value } } } \cs_new_protected:Npn \prop_gpop:NnN #1#2#3 { - \prop_split:NnTF #1 {#2} - { \prop_pop_aux:NNNnnn \tl_gset:Nn #1 #3 } + \__prop_split:NnTF #1 {#2} + { \__prop_pop:NNNnnn \tl_gset:Nn #1 #3 } { \tl_set:Nn #3 { \q_no_value } } } -\cs_new_protected:Npn \prop_pop_aux:NNNnnn #1#2#3#4#5#6 +\cs_new_protected:Npn \__prop_pop:NNNnnn #1#2#3#4#5#6 { \tl_set:Nn #3 {#5} #1 #2 { #4 #6 } @@ -133,18 +130,47 @@ \cs_generate_variant:Nn \prop_pop:NnN { c , co } \cs_generate_variant:Nn \prop_gpop:NnN { No } \cs_generate_variant:Nn \prop_gpop:NnN { c , co } -\cs_new_protected:Npn \prop_put:Nnn { \prop_put_aux:NNnn \tl_set:Nx } -\cs_new_protected:Npn \prop_gput:Nnn { \prop_put_aux:NNnn \tl_gset:Nx } -\cs_new_protected:Npn \prop_put_aux:NNnn #1#2#3#4 +\prg_new_protected_conditional:Npnn \prop_pop:NnN #1#2#3 { T , F , TF } + { + \__prop_split:NnTF #1 {#2} + { \__prop_pop_true:NNNnnn \tl_set:Nn #1 #3 } + { \prg_return_false: } + } +\prg_new_protected_conditional:Npnn \prop_gpop:NnN #1#2#3 { T , F , TF } + { + \__prop_split:NnTF #1 {#2} + { \__prop_pop_true:NNNnnn \tl_gset:Nn #1 #3 } + { \prg_return_false: } + } +\cs_new_protected:Npn \__prop_pop_true:NNNnnn #1#2#3#4#5#6 + { + \tl_set:Nn #3 {#5} + #1 #2 { #4 #6 } + \prg_return_true: + } +\cs_generate_variant:Nn \prop_pop:NnNT { c } +\cs_generate_variant:Nn \prop_pop:NnNF { c } +\cs_generate_variant:Nn \prop_pop:NnNTF { c } +\cs_generate_variant:Nn \prop_gpop:NnNT { c } +\cs_generate_variant:Nn \prop_gpop:NnNF { c } +\cs_generate_variant:Nn \prop_gpop:NnNTF { c } +\cs_new_protected:Npn \prop_put:Nnn + { \__prop_put:NNNnn \tl_set:Nx \tl_put_right:Nx } +\cs_new_protected:Npn \prop_gput:Nnn + { \__prop_put:NNNnn \tl_gset:Nx \tl_gput_right:Nx } +\cs_new_protected:Npn \__prop_put:NNNnn #1#2#3#4#5 { - \prop_split:Nnn #2 {#3} { \prop_put_aux:NNnnnnn #1 #2 {#3} {#4} } + \__prop_split:NnTF #3 {#4} + { \__prop_put:NNnnnnn #1 #3 {#4} {#5} } + { #2 #3 { \tl_to_str:n {#4} \exp_not:n { \q__prop {#5} \q__prop } } } } -\cs_new_protected:Npn \prop_put_aux:NNnnnnn #1#2#3#4#5#6#7 +\cs_new_protected:Npn \__prop_put:NNnnnnn #1#2#3#4#5#6#7 { #1 #2 { - \exp_not:n { #5 #7 } - \tl_to_str:n {#3} \exp_not:n { \q_prop {#4} \q_prop } + \exp_not:n {#5} + \tl_to_str:n {#3} \exp_not:n { \q__prop {#4} \q__prop } + \exp_not:n {#7} } } \cs_generate_variant:Nn \prop_put:Nnn @@ -156,16 +182,16 @@ \cs_generate_variant:Nn \prop_gput:Nnn { c , cnV , cno , cnx , cV , cVV , co , coo } \cs_new_protected_nopar:Npn \prop_put_if_new:Nnn - { \prop_put_if_new_aux:NNnn \tl_put_right:Nx } + { \__prop_put_if_new:NNnn \tl_put_right:Nx } \cs_new_protected_nopar:Npn \prop_gput_if_new:Nnn - { \prop_put_if_new_aux:NNnn \tl_gput_right:Nx } -\cs_new_protected:Npn \prop_put_if_new_aux:NNnn #1#2#3#4 + { \__prop_put_if_new:NNnn \tl_gput_right:Nx } +\cs_new_protected:Npn \__prop_put_if_new:NNnn #1#2#3#4 { - \prop_split:NnTF #2 {#3} + \__prop_split:NnTF #2 {#3} { \use_none:nnn } { #1 #2 - { \tl_to_str:n {#3} \exp_not:n { \q_prop {#4} \q_prop } } + { \tl_to_str:n {#3} \exp_not:n { \q__prop {#4} \q__prop } } } } \cs_generate_variant:Nn \prop_put_if_new:Nnn { c } @@ -192,26 +218,26 @@ \cs_generate_variant:Nn \prop_if_empty:NF {c} \prg_new_conditional:Npnn \prop_if_in:Nn #1#2 { p , T , F , TF } { - \exp_last_unbraced:Noo \prop_if_in_aux:nwn + \exp_last_unbraced:Noo \__prop_if_in:nwn { \tl_to_str:n {#2} } #1 - \tl_to_str:n {#2} \q_prop { } - \q_recursion_tail - \prg_break_point:n { } + \tl_to_str:n {#2} \q__prop { } + \q_recursion_tail % could be any cs != \q__prop + \__prg_break_point: } -\cs_new:Npn \prop_if_in_aux:nwn #1 \q_prop #2 \q_prop #3 +\cs_new:Npn \__prop_if_in:nwn #1 \q__prop #2 \q__prop #3 { - \str_if_eq:xxTF {#1} {#2} - { \prop_if_in_aux:N } - { \prop_if_in_aux:nwn {#1} } + \str_if_eq_x:nnTF {#1} {#2} + { \__prop_if_in:N } + { \__prop_if_in:nwn {#1} } } -\cs_new:Npn \prop_if_in_aux:N #1 +\cs_new:Npn \__prop_if_in:N #1 { - \if_meaning:w \q_prop #1 + \if_meaning:w \q__prop #1 \prg_return_true: \else: \prg_return_false: \fi: - \prop_map_break: + \__prg_break: } \cs_generate_variant:Nn \prop_if_in_p:Nn { NV , No } \cs_generate_variant:Nn \prop_if_in_p:Nn { c , cV , co } @@ -223,11 +249,11 @@ \cs_generate_variant:Nn \prop_if_in:NnTF { c , cV , co } \prg_new_protected_conditional:Npnn \prop_get:NnN #1#2#3 { T , F , TF } { - \prop_split:NnTF #1 {#2} - { \prop_get_aux_true:Nnnn #3 } + \__prop_split:NnTF #1 {#2} + { \__prop_get_true:Nnnn #3 } { \prg_return_false: } } -\cs_new_protected:Npn \prop_get_aux_true:Nnnn #1#2#3#4 +\cs_new_protected:Npn \__prop_get_true:Nnnn #1#2#3#4 { \tl_set:Nn #1 {#3} \prg_return_true: @@ -240,95 +266,49 @@ \cs_generate_variant:Nn \prop_get:NnNTF { c , cV , co } \cs_new:Npn \prop_map_function:NN #1#2 { - \exp_last_unbraced:NNo \prop_map_function_aux:Nwn #2 - #1 \q_recursion_tail \q_prop { } - \prg_break_point:n { } + \exp_last_unbraced:NNo \__prop_map_function:Nwn #2 + #1 \q_recursion_tail \q__prop { } + \__prg_break_point:Nn \prop_map_break: { } } -\cs_new:Npn \prop_map_function_aux:Nwn #1 \q_prop #2 \q_prop #3 +\cs_new:Npn \__prop_map_function:Nwn #1 \q__prop #2 \q__prop #3 { - \if_meaning:w \q_recursion_tail #2 - \exp_after:wN \prop_map_break: - \fi: + \__quark_if_recursion_tail_break:nN {#2} \prop_map_break: #1 {#2} {#3} - \prop_map_function_aux:Nwn #1 + \__prop_map_function:Nwn #1 } \cs_generate_variant:Nn \prop_map_function:NN { Nc } \cs_generate_variant:Nn \prop_map_function:NN { c , cc } \cs_new_protected:Npn \prop_map_inline:Nn #1#2 { - \int_gincr:N \g_prg_map_int - \cs_gset:cpn { prop_map_inline_ \int_use:N \g_prg_map_int :nn } - ##1##2 {#2} - \exp_last_unbraced:Nco \prop_map_function_aux:Nwn - { prop_map_inline_ \int_use:N \g_prg_map_int :nn } + \int_gincr:N \g__prg_map_int + \cs_gset:cpn { __prg_map_ \int_use:N \g__prg_map_int :w } ##1##2 {#2} + \exp_last_unbraced:Nco \__prop_map_function:Nwn + { __prg_map_ \int_use:N \g__prg_map_int :w } #1 - \q_recursion_tail \q_prop { } - \prg_break_point:n { \int_gdecr:N \g_prg_map_int } + \q_recursion_tail \q__prop { } + \__prg_break_point:Nn \prop_map_break: { \int_gdecr:N \g__prg_map_int } } \cs_generate_variant:Nn \prop_map_inline:Nn { c } -\cs_new_eq:NN \prop_map_break: \prg_map_break: -\cs_new_eq:NN \prop_map_break:n \prg_map_break:n +\cs_new_nopar:Npn \prop_map_break: + { \__prg_map_break:Nn \prop_map_break: { } } +\cs_new_nopar:Npn \prop_map_break:n + { \__prg_map_break:Nn \prop_map_break: } \cs_new_protected:Npn \prop_show:N #1 { - \msg_aux_show:Nnx + \__msg_show_variable:Nnn #1 { prop } - { \prop_map_function:NN #1 \msg_aux_show:nn } + { \prop_map_function:NN #1 \__msg_show_item:nn } } \cs_generate_variant:Nn \prop_show:N { c } -\prg_new_protected_conditional:Npnn \prop_pop:NnN #1#2#3 { T , F , TF } - { - \prop_split:NnTF #1 {#2} - { \prop_pop_aux_true:NNNnnn \tl_set:Nn #1 #3 } - { \prg_return_false: } - } -\prg_new_protected_conditional:Npnn \prop_gpop:NnN #1#2#3 { T , F , TF } - { - \prop_split:NnTF #1 {#2} - { \prop_pop_aux_true:NNNnnn \tl_gset:Nn #1 #3 } - { \prg_return_false: } - } -\cs_new_protected:Npn \prop_pop_aux_true:NNNnnn #1#2#3#4#5#6 - { - \tl_set:Nn #3 {#5} - #1 #2 { #4 #6 } - \prg_return_true: - } -\cs_generate_variant:Nn \prop_pop:NnNT { c } -\cs_generate_variant:Nn \prop_pop:NnNF { c } -\cs_generate_variant:Nn \prop_pop:NnNTF { c } -\cs_generate_variant:Nn \prop_gpop:NnNT { c } -\cs_generate_variant:Nn \prop_gpop:NnNF { c } -\cs_generate_variant:Nn \prop_gpop:NnNTF { c } -\cs_new:Npn \prop_map_tokens:Nn #1#2 - { - \exp_last_unbraced:Nno \prop_map_tokens_aux:nwn {#2} #1 - \q_recursion_tail \q_prop { } - \prg_break_point:n { } - } -\cs_new:Npn \prop_map_tokens_aux:nwn #1 \q_prop #2 \q_prop #3 - { - \if_meaning:w \q_recursion_tail #2 - \exp_after:wN \prop_map_break: - \fi: - \use:n {#1} {#2} {#3} - \prop_map_tokens_aux:nwn {#1} - } -\cs_generate_variant:Nn \prop_map_tokens:Nn { c } -\cs_new:Npn \prop_get:Nn #1#2 - { - \exp_last_unbraced:Noo \prop_get_Nn_aux:nwn - { \tl_to_str:n {#2} } #1 - \tl_to_str:n {#2} \q_prop { } - \prg_break_point:n { } - } -\cs_new:Npn \prop_get_Nn_aux:nwn #1 \q_prop #2 \q_prop #3 - { - \str_if_eq:xxTF {#1} {#2} - { \prg_map_break:n { \exp_not:n {#3} } } - { \prop_get_Nn_aux:nwn {#1} } - } -\cs_generate_variant:Nn \prop_get:Nn { c } +\cs_new_eq:NN \prop_del:Nn \prop_remove:Nn +\cs_new_eq:NN \prop_del:NV \prop_remove:NV +\cs_new_eq:NN \prop_del:cn \prop_remove:cn +\cs_new_eq:NN \prop_del:cV \prop_remove:cV +\cs_new_eq:NN \prop_gdel:Nn \prop_gremove:Nn +\cs_new_eq:NN \prop_gdel:NV \prop_gremove:NV +\cs_new_eq:NN \prop_gdel:cn \prop_gremove:cn +\cs_new_eq:NN \prop_gdel:cV \prop_gremove:cV %% %% %% End of file `l3prop.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3quark.sty b/Master/texmf-dist/tex/latex/l3kernel/l3quark.sty index e22e215617a..deaf7d4699d 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3quark.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3quark.sty @@ -46,11 +46,11 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3quark.dtx 3384 2012-02-12 13:13:11Z will $ - {L3 Experimental quarks} +\GetIdInfo$Id: l3quark.dtx 3986 2012-07-15 19:23:51Z joseph $ + {L3 Quarks} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\package_check_loaded_expl: +\__expl_package_check: \cs_new_protected:Npn \quark_new:N #1 { \tl_const:Nn #1 {#1} } \quark_new:N \q_nil \quark_new:N \q_mark @@ -90,17 +90,17 @@ } \cs_generate_variant:Nn \quark_if_recursion_tail_stop:n { o } \cs_generate_variant:Nn \quark_if_recursion_tail_stop_do:nn { o } -\cs_new:Npn \quark_if_recursion_tail_break:N #1 +\cs_new:Npn \__quark_if_recursion_tail_break:NN #1#2 { \if_meaning:w \q_recursion_tail #1 - \exp_after:wN \prg_map_break: + \exp_after:wN #2 \fi: } -\cs_new:Npn \quark_if_recursion_tail_break:n #1 +\cs_new:Npn \__quark_if_recursion_tail_break:nN #1#2 { \if_int_compare:w \pdftex_strcmp:D { \exp_not:N \q_recursion_tail } { \exp_not:n {#1} } = \c_zero - \exp_after:wN \prg_map_break: + \exp_after:wN #2 \fi: } \prg_new_conditional:Nnn \quark_if_nil:N { p, T , F , TF } @@ -145,23 +145,27 @@ \cs_generate_variant:Nn \quark_if_nil:nTF { V , o } \cs_generate_variant:Nn \quark_if_nil:nT { V , o } \cs_generate_variant:Nn \quark_if_nil:nF { V , o } -\quark_new:N \q_tl_act_mark -\quark_new:N \q_tl_act_stop -\tl_new:N \g_scan_marks_tl -\cs_new_protected:Npn \scan_new:N #1 +\quark_new:N \q__tl_act_mark +\quark_new:N \q__tl_act_stop +\tl_new:N \g__scan_marks_tl +\cs_new_protected:Npn \__scan_new:N #1 { - \tl_if_in:NnTF \g_scan_marks_tl { #1 } + \tl_if_in:NnTF \g__scan_marks_tl { #1 } { - \msg_kernel_error:nnx { scan } { already-defined } + \__msg_kernel_error:nnx { kernel } { scanmark-already-defined } { \token_to_str:N #1 } } { - \tl_gput_right:Nn \g_scan_marks_tl {#1} + \tl_gput_right:Nn \g__scan_marks_tl {#1} \cs_new_eq:NN #1 \scan_stop: } } -\scan_new:N \s_stop -\cs_new:Npn \use_none_delimit_by_s_stop:w #1 \s_stop { } +\__scan_new:N \s__stop +\cs_new:Npn \__use_none_delimit_by_s__stop:w #1 \s__stop { } +\cs_new:Npn \quark_if_recursion_tail_break:N #1 + { \__quark_if_recursion_tail_break:NN #1 \prg_break: } +\cs_new:Npn \quark_if_recursion_tail_break:n #1 + { \__quark_if_recursion_tail_break:nN {#1} \prg_break: } %% %% %% End of file `l3quark.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3seq.sty b/Master/texmf-dist/tex/latex/l3kernel/l3seq.sty index 6de7e2ea1ed..e5a270b01d7 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3seq.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3seq.sty @@ -46,18 +46,19 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3seq.dtx 3490 2012-03-04 01:00:53Z bruno $ - {L3 Experimental sequences and stacks} +\GetIdInfo$Id: l3seq.dtx 3986 2012-07-15 19:23:51Z joseph $ + {L3 Sequences and stacks} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\package_check_loaded_expl: -\cs_new:Npn \seq_item:n +\__expl_package_check: +\cs_new:Npn \__seq_item:n { - \msg_expandable_kernel_error:nn { seq } { misused } + \__msg_kernel_expandable_error:nn { kernel } { misused-sequence } \use_none:n } -\tl_new:N \l_seq_internal_a_tl -\tl_new:N \l_seq_internal_b_tl +\tl_new:N \l__seq_internal_a_tl +\tl_new:N \l__seq_internal_b_tl +\cs_new_eq:NN \c_empty_seq \c_empty_tl \cs_new_eq:NN \seq_new:N \tl_new:N \cs_new_eq:NN \seq_new:c \tl_new:c \cs_new_eq:NN \seq_clear:N \tl_clear:N @@ -77,37 +78,39 @@ \cs_new_eq:NN \seq_gset_eq:cN \tl_gset_eq:cN \cs_new_eq:NN \seq_gset_eq:cc \tl_gset_eq:cc \cs_new_protected_nopar:Npn \seq_set_split:Nnn - { \seq_set_split_aux:NNnn \tl_set:Nx } + { \__seq_set_split:NNnn \tl_set:Nx } \cs_new_protected_nopar:Npn \seq_gset_split:Nnn - { \seq_set_split_aux:NNnn \tl_gset:Nx } -\cs_new_protected:Npn \seq_set_split_aux:NNnn #1 #2 #3 #4 + { \__seq_set_split:NNnn \tl_gset:Nx } +\cs_new_protected:Npn \__seq_set_split:NNnn #1 #2 #3 #4 { \tl_if_empty:nTF {#3} - { #1 #2 { \tl_map_function:nN {#4} \seq_wrap_item:n } } + { #1 #2 { \tl_map_function:nN {#4} \__seq_wrap_item:n } } { - \tl_set:Nn \l_seq_internal_a_tl + \tl_set:Nn \l__seq_internal_a_tl { - \seq_set_split_aux_i:w \prg_do_nothing: + \__seq_set_split_i:w \prg_do_nothing: #4 - \seq_set_split_aux_end: + \__seq_set_split_end: } - \tl_replace_all:Nnn \l_seq_internal_a_tl { #3 } + \tl_replace_all:Nnn \l__seq_internal_a_tl { #3 } { - \seq_set_split_aux_end: - \seq_set_split_aux_i:w \prg_do_nothing: + \__seq_set_split_end: + \__seq_set_split_i:w \prg_do_nothing: } - \tl_set:Nx \l_seq_internal_a_tl { \l_seq_internal_a_tl } - #1 #2 { \l_seq_internal_a_tl } + \tl_set:Nx \l__seq_internal_a_tl { \l__seq_internal_a_tl } + #1 #2 { \l__seq_internal_a_tl } } } -\cs_new:Npn \seq_set_split_aux_i:w #1 \seq_set_split_aux_end: +\cs_new:Npn \__seq_set_split_i:w #1 \__seq_set_split_end: { - \exp_not:N \seq_set_split_aux_ii:w + \exp_not:N \__seq_set_split_ii:w \exp_args:No \tl_trim_spaces:n {#1} - \exp_not:N \seq_set_split_aux_end: + \exp_not:N \__seq_set_split_end: } -\cs_new:Npn \seq_set_split_aux_ii:w #1 \seq_set_split_aux_end: - { \seq_wrap_item:n {#1} } +\cs_new:Npn \__seq_set_split_ii:w #1 \__seq_set_split_end: + { \__seq_wrap_item:n {#1} } +\cs_generate_variant:Nn \seq_set_split:Nnn { NnV } +\cs_generate_variant:Nn \seq_gset_split:Nnn { NnV } \cs_new_protected:Npn \seq_concat:NNN #1#2#3 { \tl_set:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} } } \cs_new_protected:Npn \seq_gconcat:NNN #1#2#3 @@ -123,62 +126,62 @@ \cs_new_eq:NN \seq_if_exist:cF \cs_if_exist:cF \cs_new_eq:NN \seq_if_exist_p:c \cs_if_exist_p:c \cs_new_protected:Npn \seq_put_left:Nn #1#2 - { \tl_put_left:Nn #1 { \seq_item:n {#2} } } + { \tl_put_left:Nn #1 { \__seq_item:n {#2} } } \cs_new_protected:Npn \seq_put_right:Nn #1#2 - { \tl_put_right:Nn #1 { \seq_item:n {#2} } } + { \tl_put_right:Nn #1 { \__seq_item:n {#2} } } \cs_generate_variant:Nn \seq_put_left:Nn { NV , Nv , No , Nx } \cs_generate_variant:Nn \seq_put_left:Nn { c , cV , cv , co , cx } \cs_generate_variant:Nn \seq_put_right:Nn { NV , Nv , No , Nx } \cs_generate_variant:Nn \seq_put_right:Nn { c , cV , cv , co , cx } \cs_new_protected:Npn \seq_gput_left:Nn #1#2 - { \tl_gput_left:Nn #1 { \seq_item:n {#2} } } + { \tl_gput_left:Nn #1 { \__seq_item:n {#2} } } \cs_new_protected:Npn \seq_gput_right:Nn #1#2 - { \tl_gput_right:Nn #1 { \seq_item:n {#2} } } + { \tl_gput_right:Nn #1 { \__seq_item:n {#2} } } \cs_generate_variant:Nn \seq_gput_left:Nn { NV , Nv , No , Nx } \cs_generate_variant:Nn \seq_gput_left:Nn { c , cV , cv , co , cx } \cs_generate_variant:Nn \seq_gput_right:Nn { NV , Nv , No , Nx } \cs_generate_variant:Nn \seq_gput_right:Nn { c , cV , cv , co , cx } -\cs_new:Npn \seq_wrap_item:n #1 { \exp_not:n { \seq_item:n {#1} } } -\seq_new:N \l_seq_internal_remove_seq +\cs_new:Npn \__seq_wrap_item:n #1 { \exp_not:n { \__seq_item:n {#1} } } +\seq_new:N \l__seq_remove_seq \cs_new_protected:Npn \seq_remove_duplicates:N - { \seq_remove_duplicates_aux:NN \seq_set_eq:NN } + { \__seq_remove_duplicates:NN \seq_set_eq:NN } \cs_new_protected:Npn \seq_gremove_duplicates:N - { \seq_remove_duplicates_aux:NN \seq_gset_eq:NN } -\cs_new_protected:Npn \seq_remove_duplicates_aux:NN #1#2 + { \__seq_remove_duplicates:NN \seq_gset_eq:NN } +\cs_new_protected:Npn \__seq_remove_duplicates:NN #1#2 { - \seq_clear:N \l_seq_internal_remove_seq + \seq_clear:N \l__seq_remove_seq \seq_map_inline:Nn #2 { - \seq_if_in:NnF \l_seq_internal_remove_seq {##1} - { \seq_put_right:Nn \l_seq_internal_remove_seq {##1} } + \seq_if_in:NnF \l__seq_remove_seq {##1} + { \seq_put_right:Nn \l__seq_remove_seq {##1} } } - #1 #2 \l_seq_internal_remove_seq + #1 #2 \l__seq_remove_seq } \cs_generate_variant:Nn \seq_remove_duplicates:N { c } \cs_generate_variant:Nn \seq_gremove_duplicates:N { c } \cs_new_protected:Npn \seq_remove_all:Nn - { \seq_remove_all_aux:NNn \tl_set:Nx } + { \__seq_remove_all_aux:NNn \tl_set:Nx } \cs_new_protected:Npn \seq_gremove_all:Nn - { \seq_remove_all_aux:NNn \tl_gset:Nx } -\cs_new_protected:Npn \seq_remove_all_aux:NNn #1#2#3 + { \__seq_remove_all_aux:NNn \tl_gset:Nx } +\cs_new_protected:Npn \__seq_remove_all_aux:NNn #1#2#3 { - \seq_push_item_def:n + \__seq_push_item_def:n { \str_if_eq:nnT {##1} {#3} { \if_false: { \fi: } - \tl_set:Nn \l_seq_internal_b_tl {##1} + \tl_set:Nn \l__seq_internal_b_tl {##1} #1 #2 { \if_false: } \fi: \exp_not:o {#2} - \tl_if_eq:NNT \l_seq_internal_a_tl \l_seq_internal_b_tl + \tl_if_eq:NNT \l__seq_internal_a_tl \l__seq_internal_b_tl { \use_none:nn } } - \seq_wrap_item:n {##1} + \__seq_wrap_item:n {##1} } - \tl_set:Nn \l_seq_internal_a_tl {#3} + \tl_set:Nn \l__seq_internal_a_tl {#3} #1 #2 {#2} - \seq_pop_item_def: + \__seq_pop_item_def: } \cs_generate_variant:Nn \seq_remove_all:Nn { c } \cs_generate_variant:Nn \seq_gremove_all:Nn { c } @@ -190,45 +193,63 @@ { T , F , TF } { \group_begin: - \tl_set:Nn \l_seq_internal_a_tl {#2} - \cs_set_protected:Npn \seq_item:n ##1 + \tl_set:Nn \l__seq_internal_a_tl {#2} + \cs_set_protected:Npn \__seq_item:n ##1 { - \tl_set:Nn \l_seq_internal_b_tl {##1} - \if_meaning:w \l_seq_internal_a_tl \l_seq_internal_b_tl - \exp_after:wN \seq_if_in_aux: + \tl_set:Nn \l__seq_internal_b_tl {##1} + \if_meaning:w \l__seq_internal_a_tl \l__seq_internal_b_tl + \exp_after:wN \__seq_if_in: \fi: } #1 - \seq_break:n { \prg_return_false: } - \prg_break_point:n { \group_end: } + \group_end: + \prg_return_false: + \__prg_break_point: } -\cs_new_nopar:Npn \seq_if_in_aux: { \seq_break:n { \prg_return_true: } } +\cs_new_nopar:Npn \__seq_if_in: + { \__prg_break:n { \group_end: \prg_return_true: } } \cs_generate_variant:Nn \seq_if_in:NnT { NV , Nv , No , Nx } \cs_generate_variant:Nn \seq_if_in:NnT { c , cV , cv , co , cx } \cs_generate_variant:Nn \seq_if_in:NnF { NV , Nv , No , Nx } \cs_generate_variant:Nn \seq_if_in:NnF { c , cV , cv , co , cx } \cs_generate_variant:Nn \seq_if_in:NnTF { NV , Nv , No , Nx } \cs_generate_variant:Nn \seq_if_in:NnTF { c , cV , cv , co , cx } +\cs_new_protected:Npn \__seq_pop:NNNN #1#2#3#4 + { + \if_meaning:w #3 \c_empty_seq + \tl_set:Nn #4 { \q_no_value } + \else: + #1#2#3#4 + \fi: + } +\cs_new_protected:Npn \__seq_pop_TF:NNNN #1#2#3#4 + { + \if_meaning:w #3 \c_empty_seq + % \tl_set:Nn #4 { \q_no_value } + \prg_return_false: + \else: + #1#2#3#4 + \prg_return_true: + \fi: + } \cs_new_protected:Npn \seq_get_left:NN #1#2 { - \seq_if_empty_err_break:N #1 - \exp_after:wN \seq_get_left_aux:NnwN #1 \q_stop #2 - \prg_break_point:n { } + \tl_set:Nx #2 + { + \exp_after:wN \__seq_get_left:Nnw + #1 \__seq_item:n { \q_no_value } \q_stop + } } -\cs_new_protected:Npn \seq_get_left_aux:NnwN \seq_item:n #1#2 \q_stop #3 - { \tl_set:Nn #3 {#1} } +\cs_new:Npn \__seq_get_left:Nnw \__seq_item:n #1#2 \q_stop + { \exp_not:n {#1} } \cs_generate_variant:Nn \seq_get_left:NN { c } \cs_new_protected_nopar:Npn \seq_pop_left:NN - { \seq_pop_left_aux:NNN \tl_set:Nn } + { \__seq_pop:NNNN \__seq_pop_left:NNN \tl_set:Nn } \cs_new_protected_nopar:Npn \seq_gpop_left:NN - { \seq_pop_left_aux:NNN \tl_gset:Nn } -\cs_new_protected:Npn \seq_pop_left_aux:NNN #1#2#3 - { - \seq_if_empty_err_break:N #2 - \exp_after:wN \seq_pop_left_aux:NnwNNN #2 \q_stop #1#2#3 - \prg_break_point:n { } - } -\cs_new_protected:Npn \seq_pop_left_aux:NnwNNN \seq_item:n #1#2 \q_stop #3#4#5 + { \__seq_pop:NNNN \__seq_pop_left:NNN \tl_gset:Nn } +\cs_new_protected:Npn \__seq_pop_left:NNN #1#2#3 + { \exp_after:wN \__seq_pop_left:NnwNNN #2 \q_stop #1#2#3 } +\cs_new_protected:Npn \__seq_pop_left:NnwNNN \__seq_item:n #1#2 \q_stop #3#4#5 { #3 #4 {#2} \tl_set:Nn #5 {#1} @@ -237,121 +258,147 @@ \cs_generate_variant:Nn \seq_gpop_left:NN { c } \cs_new_protected:Npn \seq_get_right:NN #1#2 { - \seq_if_empty_err_break:N #1 - \seq_get_right_aux:NN #1#2 - \prg_break_point:n { } + \exp_after:wN \__seq_get_right_loop:nn + \exp_after:wN \q_no_value + #1 + { + ?? + \tex_afterassignment:D \use_none:n + \tl_set:Nn #2 + } } -\cs_new_protected:Npn \seq_get_right_aux:NN #1#2 - { - \seq_push_item_def:n { } - \exp_after:wN \exp_after:wN \exp_after:wN \seq_get_right_loop:nn - \exp_after:wN \use_none:n #1 - { \tl_set:Nn #2 } - { } - { - \seq_pop_item_def: - \seq_break: - } -} -\cs_new:Npn \seq_get_right_loop:nn #1#2 +\cs_new_protected:Npn \__seq_get_right_loop:nn #1#2 { - #2 {#1} - \seq_get_right_loop:nn + \use_none:nn #2 {#1} + \__seq_get_right_loop:nn } \cs_generate_variant:Nn \seq_get_right:NN { c } \cs_new_protected_nopar:Npn \seq_pop_right:NN - { \seq_pop_right_aux:NNN \tl_set:Nx } + { \__seq_pop:NNNN \__seq_pop_right_aux:NNN \tl_set:Nx } \cs_new_protected_nopar:Npn \seq_gpop_right:NN - { \seq_pop_right_aux:NNN \tl_gset:Nx } -\cs_new_protected:Npn \seq_pop_right_aux:NNN #1#2#3 - { - \seq_if_empty_err_break:N #2 - \seq_pop_right_aux_ii:NNN #1 #2 #3 - \prg_break_point:n { } - } -\cs_new_protected:Npn \seq_pop_right_aux_ii:NNN #1#2#3 - { - \seq_push_item_def:n { \seq_wrap_item:n {##1} } - #1 #2 { \if_false: } \fi: - \exp_after:wN \exp_after:wN \exp_after:wN \seq_get_right_loop:nn - \exp_after:wN \use_none:n #2 + { \__seq_pop:NNNN \__seq_pop_right_aux:NNN \tl_gset:Nx } +\cs_new_protected:Npn \__seq_pop_right_aux:NNN #1#2#3 + { + \cs_set_eq:NN \seq_tmp:w \__seq_item:n + \cs_set_eq:NN \__seq_item:n \scan_stop: + #1 #2 + { \if_false: } \fi: + \exp_after:wN \exp_after:wN + \exp_after:wN \__seq_pop_right_loop:nn + \exp_after:wN \use_none:n + #2 { \if_false: { \fi: } - \tl_set:Nn #3 - } - { } - { - \seq_pop_item_def: - \seq_break: + \tex_afterassignment:D \use_none:n + \tl_set:Nx #3 } + \cs_set_eq:NN \__seq_item:n \seq_tmp:w } -\cs_generate_variant:Nn \seq_pop_right:NN { c } -\cs_generate_variant:Nn \seq_gpop_right:NN { c } -\cs_new_eq:NN \seq_break: \prg_map_break: -\cs_new_eq:NN \seq_break:n \prg_map_break:n -\cs_new_eq:NN \seq_map_break: \prg_map_break: -\cs_new_eq:NN \seq_map_break:n \prg_map_break:n -\cs_new_protected:Npn \seq_if_empty_err_break:N #1 +\cs_new:Npn \__seq_pop_right_loop:nn #1#2 { - \if_meaning:w #1 \c_empty_tl - \msg_kernel_error:nnx { seq } { empty-sequence } { \token_to_str:N #1 } - \exp_after:wN \seq_break: - \fi: + #2 { \exp_not:n {#1} } + \__seq_pop_right_loop:nn } +\cs_generate_variant:Nn \seq_pop_right:NN { c } +\cs_generate_variant:Nn \seq_gpop_right:NN { c } +\prg_new_protected_conditional:Npnn \seq_get_left:NN #1#2 { T , F , TF } + { \__seq_pop_TF:NNNN \prg_do_nothing: \seq_get_left:NN #1#2 } +\prg_new_protected_conditional:Npnn \seq_get_right:NN #1#2 { T , F , TF } + { \__seq_pop_TF:NNNN \prg_do_nothing: \seq_get_right:NN #1#2 } +\cs_generate_variant:Nn \seq_get_left:NNT { c } +\cs_generate_variant:Nn \seq_get_left:NNF { c } +\cs_generate_variant:Nn \seq_get_left:NNTF { c } +\cs_generate_variant:Nn \seq_get_right:NNT { c } +\cs_generate_variant:Nn \seq_get_right:NNF { c } +\cs_generate_variant:Nn \seq_get_right:NNTF { c } +\prg_new_protected_conditional:Npnn \seq_pop_left:NN #1#2 { T , F , TF } + { \__seq_pop_TF:NNNN \__seq_pop_left:NNN \tl_set:Nn #1 #2 } +\prg_new_protected_conditional:Npnn \seq_gpop_left:NN #1#2 { T , F , TF } + { \__seq_pop_TF:NNNN \__seq_pop_left:NNN \tl_gset:Nn #1 #2 } +\prg_new_protected_conditional:Npnn \seq_pop_right:NN #1#2 { T , F , TF } + { \__seq_pop_TF:NNNN \__seq_pop_right_aux:NNN \tl_set:Nx #1 #2 } +\prg_new_protected_conditional:Npnn \seq_gpop_right:NN #1#2 { T , F , TF } + { \__seq_pop_TF:NNNN \__seq_pop_right_aux:NNN \tl_gset:Nx #1 #2 } +\cs_generate_variant:Nn \seq_pop_left:NNT { c } +\cs_generate_variant:Nn \seq_pop_left:NNF { c } +\cs_generate_variant:Nn \seq_pop_left:NNTF { c } +\cs_generate_variant:Nn \seq_gpop_left:NNT { c } +\cs_generate_variant:Nn \seq_gpop_left:NNF { c } +\cs_generate_variant:Nn \seq_gpop_left:NNTF { c } +\cs_generate_variant:Nn \seq_pop_right:NNT { c } +\cs_generate_variant:Nn \seq_pop_right:NNF { c } +\cs_generate_variant:Nn \seq_pop_right:NNTF { c } +\cs_generate_variant:Nn \seq_gpop_right:NNT { c } +\cs_generate_variant:Nn \seq_gpop_right:NNF { c } +\cs_generate_variant:Nn \seq_gpop_right:NNTF { c } +\cs_new_nopar:Npn \seq_map_break: + { \__prg_map_break:Nn \seq_map_break: { } } +\cs_new_nopar:Npn \seq_map_break:n + { \__prg_map_break:Nn \seq_map_break: } \cs_new:Npn \seq_map_function:NN #1#2 { - \exp_after:wN \seq_map_function_aux:NNn \exp_after:wN #2 #1 + \exp_after:wN \__seq_map_function:NNn \exp_after:wN #2 #1 { ? \seq_map_break: } { } - \prg_break_point:n { } + \__prg_break_point:Nn \seq_map_break: { } } -\cs_new:Npn \seq_map_function_aux:NNn #1#2#3 +\cs_new:Npn \__seq_map_function:NNn #1#2#3 { \use_none:n #2 #1 {#3} - \seq_map_function_aux:NNn #1 + \__seq_map_function:NNn #1 } \cs_generate_variant:Nn \seq_map_function:NN { c } -\cs_new_protected:Npn \seq_push_item_def:n +\cs_new_protected:Npn \__seq_push_item_def:n { - \seq_push_item_def_aux: - \cs_gset:Npn \seq_item:n ##1 + \__seq_push_item_def: + \cs_gset:Npn \__seq_item:n ##1 } -\cs_new_protected:Npn \seq_push_item_def:x +\cs_new_protected:Npn \__seq_push_item_def:x { - \seq_push_item_def_aux: - \cs_gset:Npx \seq_item:n ##1 + \__seq_push_item_def: + \cs_gset:Npx \__seq_item:n ##1 } -\cs_new_protected:Npn \seq_push_item_def_aux: +\cs_new_protected:Npn \__seq_push_item_def: { - \cs_gset_eq:cN { seq_item_ \int_use:N \g_prg_map_int :n } - \seq_item:n - \int_gincr:N \g_prg_map_int + \int_gincr:N \g__prg_map_int + \cs_gset_eq:cN { __prg_map_ \int_use:N \g__prg_map_int :w } + \__seq_item:n } -\cs_new_protected_nopar:Npn \seq_pop_item_def: +\cs_new_protected_nopar:Npn \__seq_pop_item_def: { - \int_gdecr:N \g_prg_map_int - \cs_gset_eq:Nc \seq_item:n - { seq_item_ \int_use:N \g_prg_map_int :n } + \cs_gset_eq:Nc \__seq_item:n + { __prg_map_ \int_use:N \g__prg_map_int :w } + \int_gdecr:N \g__prg_map_int } \cs_new_protected:Npn \seq_map_inline:Nn #1#2 { - \seq_push_item_def:n {#2} + \__seq_push_item_def:n {#2} #1 - \prg_break_point:n { \seq_pop_item_def: } + \__prg_break_point:Nn \seq_map_break: { \__seq_pop_item_def: } } \cs_generate_variant:Nn \seq_map_inline:Nn { c } \cs_new_protected:Npn \seq_map_variable:NNn #1#2#3 { - \seq_push_item_def:x + \__seq_push_item_def:x { \tl_set:Nn \exp_not:N #2 {##1} \exp_not:n {#3} } #1 - \prg_break_point:n { \seq_pop_item_def: } + \__prg_break_point:Nn \seq_map_break: { \__seq_pop_item_def: } } \cs_generate_variant:Nn \seq_map_variable:NNn { Nc } \cs_generate_variant:Nn \seq_map_variable:NNn { c , cc } +\cs_new:Npn \seq_count:N #1 + { + \int_eval:n + { + 0 + \seq_map_function:NN #1 \__seq_count:n + } + } +\cs_new:Npn \__seq_count:n #1 { + \c_one } +\cs_generate_variant:Nn \seq_count:N { c } \cs_new_eq:NN \seq_push:Nn \seq_put_left:Nn \cs_new_eq:NN \seq_push:NV \seq_put_left:NV \cs_new_eq:NN \seq_push:Nv \seq_put_left:Nv @@ -378,209 +425,28 @@ \cs_new_eq:NN \seq_pop:cN \seq_pop_left:cN \cs_new_eq:NN \seq_gpop:NN \seq_gpop_left:NN \cs_new_eq:NN \seq_gpop:cN \seq_gpop_left:cN +\prg_new_eq_conditional:NNn \seq_get:NN \seq_get_left:NN { T , F , TF } +\prg_new_eq_conditional:NNn \seq_get:cN \seq_get_left:cN { T , F , TF } +\prg_new_eq_conditional:NNn \seq_pop:NN \seq_pop_left:NN { T , F , TF } +\prg_new_eq_conditional:NNn \seq_pop:cN \seq_pop_left:cN { T , F , TF } +\prg_new_eq_conditional:NNn \seq_gpop:NN \seq_gpop_left:NN { T , F , TF } +\prg_new_eq_conditional:NNn \seq_gpop:cN \seq_gpop_left:cN { T , F , TF } \cs_new_protected:Npn \seq_show:N #1 { - \msg_aux_show:Nnx + \__msg_show_variable:Nnn #1 { seq } - { \seq_map_function:NN #1 \msg_aux_show:n } + { \seq_map_function:NN #1 \__msg_show_item:n } } \cs_generate_variant:Nn \seq_show:N { c } -\cs_new:Npn \seq_if_empty_break_return_false:N #1 - { - \if_meaning:w #1 \c_empty_tl - \prg_return_false: - \exp_after:wN \seq_break: - \fi: - } -\prg_new_protected_conditional:Npnn \seq_get_left:NN #1 #2 { T , F , TF } - { - \seq_if_empty_break_return_false:N #1 - \exp_after:wN \seq_get_left_aux:Nw #1 \q_stop #2 - \prg_return_true: - \seq_break: - \prg_break_point:n { } - } -\prg_new_protected_conditional:Npnn \seq_get_right:NN #1#2 { T , F , TF } - { - \seq_if_empty_break_return_false:N #1 - \seq_get_right_aux:NN #1#2 - \prg_return_true: \seq_break: - \prg_break_point:n { } - } -\cs_generate_variant:Nn \seq_get_left:NNT { c } -\cs_generate_variant:Nn \seq_get_left:NNF { c } -\cs_generate_variant:Nn \seq_get_left:NNTF { c } -\cs_generate_variant:Nn \seq_get_right:NNT { c } -\cs_generate_variant:Nn \seq_get_right:NNF { c } -\cs_generate_variant:Nn \seq_get_right:NNTF { c } -\prg_new_protected_conditional:Npnn \seq_pop_left:NN #1#2 { T , F , TF } - { - \seq_if_empty_break_return_false:N #1 - \exp_after:wN \seq_pop_left_aux:NnwNNN #1 \q_stop \tl_set:Nn #1#2 - \prg_return_true: \seq_break: - \prg_break_point:n { } - } -\prg_new_protected_conditional:Npnn \seq_gpop_left:NN #1#2 { T , F , TF } - { - \seq_if_empty_break_return_false:N #1 - \exp_after:wN \seq_pop_left_aux:NnwNNN #1 \q_stop \tl_gset:Nn #1#2 - \prg_return_true: \seq_break: - \prg_break_point:n { } - } -\prg_new_protected_conditional:Npnn \seq_pop_right:NN #1#2 { T , F , TF } - { - \seq_if_empty_break_return_false:N #1 - \seq_pop_right_aux_ii:NNN \tl_set:Nx #1 #2 - \prg_return_true: \seq_break: - \prg_break_point:n { } - } -\prg_new_protected_conditional:Npnn \seq_gpop_right:NN #1#2 { T , F , TF } - { - \seq_if_empty_break_return_false:N #1 - \seq_pop_right_aux_ii:NNN \tl_gset:Nx #1 #2 - \prg_return_true: \seq_break: - \prg_break_point:n { } - } -\cs_generate_variant:Nn \seq_pop_left:NNT { c } -\cs_generate_variant:Nn \seq_pop_left:NNF { c } -\cs_generate_variant:Nn \seq_pop_left:NNTF { c } -\cs_generate_variant:Nn \seq_gpop_left:NNT { c } -\cs_generate_variant:Nn \seq_gpop_left:NNF { c } -\cs_generate_variant:Nn \seq_gpop_left:NNTF { c } -\cs_generate_variant:Nn \seq_pop_right:NNT { c } -\cs_generate_variant:Nn \seq_pop_right:NNF { c } -\cs_generate_variant:Nn \seq_pop_right:NNTF { c } -\cs_generate_variant:Nn \seq_gpop_right:NNT { c } -\cs_generate_variant:Nn \seq_gpop_right:NNF { c } -\cs_generate_variant:Nn \seq_gpop_right:NNTF { c } -\cs_new:Npn \seq_length:N #1 - { - \int_eval:n - { - 0 - \seq_map_function:NN #1 \seq_length_aux:n - } - } -\cs_new:Npn \seq_length_aux:n #1 { +1 } -\cs_generate_variant:Nn \seq_length:N { c } -\cs_new:Npn \seq_item:Nn #1#2 - { - \exp_last_unbraced:Nfo \seq_item_aux:nnn - { - \int_eval:n - { - \int_compare:nNnT {#2} < \c_zero - { \seq_length:N #1 + } - #2 - } - } - #1 - { ? \seq_break: } - { } - \prg_break_point:n { } - } -\cs_new:Npn \seq_item_aux:nnn #1#2#3 - { - \use_none:n #2 - \int_compare:nNnTF {#1} = \c_zero - { \seq_break:n { \exp_not:n {#3} } } - { \exp_args:Nf \seq_item_aux:nnn { \int_eval:n { #1 - 1 } } } - } -\cs_generate_variant:Nn \seq_item:Nn { c } +\seq_new:N \l_tmpa_seq +\seq_new:N \l_tmpb_seq +\seq_new:N \g_tmpa_seq +\seq_new:N \g_tmpb_seq +\cs_new_eq:NN \seq_length:N \seq_count:N +\cs_new_eq:NN \seq_length:c \seq_count:c \cs_new:Npn \seq_use:N #1 { \seq_map_function:NN #1 \use:n } \cs_generate_variant:Nn \seq_use:N { c } -\cs_new:Npn \seq_mapthread_function:NNN #1#2#3 - { - \exp_after:wN \seq_mapthread_function_aux:NN - \exp_after:wN #3 - \exp_after:wN #1 - #2 - { ? \seq_break: } { } - \prg_break_point:n { } - } -\cs_new:Npn \seq_mapthread_function_aux:NN #1#2 - { - \exp_after:wN \seq_mapthread_function_aux:Nnnwnn - \exp_after:wN #1 - #2 - { ? \seq_break: } { } - \q_stop - } -\cs_new:Npn \seq_mapthread_function_aux:Nnnwnn #1#2#3#4 \q_stop #5#6 - { - \use_none:n #2 - \use_none:n #5 - #1 {#3} {#6} - \seq_mapthread_function_aux:Nnnwnn #1 #4 \q_stop - } -\cs_generate_variant:Nn \seq_mapthread_function:NNN { Nc } -\cs_generate_variant:Nn \seq_mapthread_function:NNN { c , cc } -\cs_new_protected:Npn \seq_set_from_clist:NN #1#2 - { - \tl_set:Nx #1 - { \clist_map_function:NN #2 \seq_wrap_item:n } - } -\cs_new_protected:Npn \seq_set_from_clist:Nn #1#2 - { - \tl_set:Nx #1 - { \clist_map_function:nN {#2} \seq_wrap_item:n } - } -\cs_new_protected:Npn \seq_gset_from_clist:NN #1#2 - { - \tl_gset:Nx #1 - { \clist_map_function:NN #2 \seq_wrap_item:n } - } -\cs_new_protected:Npn \seq_gset_from_clist:Nn #1#2 - { - \tl_gset:Nx #1 - { \clist_map_function:nN {#2} \seq_wrap_item:n } - } -\cs_generate_variant:Nn \seq_set_from_clist:NN { Nc } -\cs_generate_variant:Nn \seq_set_from_clist:NN { c , cc } -\cs_generate_variant:Nn \seq_set_from_clist:Nn { c } -\cs_generate_variant:Nn \seq_gset_from_clist:NN { Nc } -\cs_generate_variant:Nn \seq_gset_from_clist:NN { c , cc } -\cs_generate_variant:Nn \seq_gset_from_clist:Nn { c } -\cs_new_protected_nopar:Npn \seq_tmp:w { } -\cs_new_protected_nopar:Npn \seq_reverse:N - { \seq_reverse_aux:NN \tl_set:Nx } -\cs_new_protected_nopar:Npn \seq_greverse:N - { \seq_reverse_aux:NN \tl_gset:Nx } -\cs_new_protected:Npn \seq_reverse_aux:NN #1 #2 - { - \cs_set_eq:NN \seq_tmp:w \seq_item:n - \cs_set_eq:NN \seq_item:n \seq_reverse_aux_item:nwn - #1 #2 { #2 \exp_not:n { } } - \cs_set_eq:NN \seq_item:n \seq_tmp:w - } -\cs_new:Npn \seq_reverse_aux_item:nwn #1 #2 \exp_not:n #3 - { - #2 - \exp_not:n { \seq_item:n {#1} #3 } - } -\cs_generate_variant:Nn \seq_reverse:N { c } -\cs_generate_variant:Nn \seq_greverse:N { c } -\cs_new_protected_nopar:Npn \seq_set_filter:NNn - { \seq_set_filter_aux:NNNn \tl_set:Nx } -\cs_new_protected_nopar:Npn \seq_gset_filter:NNn - { \seq_set_filter_aux:NNNn \tl_gset:Nx } -\cs_new_protected:Npn \seq_set_filter_aux:NNNn #1#2#3#4 - { - \seq_push_item_def:n { \bool_if:nT {#4} { \seq_wrap_item:n {##1} } } - #1 #2 { #3 \prg_break_point:n { } } - \seq_pop_item_def: - } -\cs_new_protected_nopar:Npn \seq_set_map:NNn - { \seq_set_map_aux:NNNn \tl_set:Nx } -\cs_new_protected_nopar:Npn \seq_gset_map:NNn - { \seq_set_map_aux:NNNn \tl_gset:Nx } -\cs_new_protected:Npn \seq_set_map_aux:NNNn #1#2#3#4 - { - \seq_push_item_def:n { \exp_not:N \seq_item:n {#4} } - #1 #2 { #3 } - \seq_pop_item_def: - } %% %% %% End of file `l3seq.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3skip.sty b/Master/texmf-dist/tex/latex/l3kernel/l3skip.sty index 671ce242540..b64003dfc27 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3skip.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3skip.sty @@ -47,17 +47,17 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3skip.dtx 3499 2012-03-05 16:08:55Z bruno $ - {L3 Experimental dimensions and skips} +\GetIdInfo$Id: l3skip.dtx 3986 2012-07-15 19:23:51Z joseph $ + {L3 Dimensions and skips} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\package_check_loaded_expl: +\__expl_package_check: \cs_new_eq:NN \if_dim:w \tex_ifdim:D -\cs_new_eq:NN \dim_eval:w \etex_dimexpr:D -\cs_new_eq:NN \dim_eval_end: \tex_relax:D +\cs_new_eq:NN \__dim_eval:w \etex_dimexpr:D +\cs_new_eq:NN \__dim_eval_end: \tex_relax:D \cs_new_protected:Npn \dim_new:N #1 { - \chk_if_free_cs:N #1 + \__chk_if_free_cs:N #1 \newdimen #1 } \cs_generate_variant:Nn \dim_new:N { c } @@ -86,7 +86,7 @@ \cs_new_eq:NN \dim_if_exist:cF \cs_if_exist:cF \cs_new_eq:NN \dim_if_exist_p:c \cs_if_exist_p:c \cs_new_protected:Npn \dim_set:Nn #1#2 - { #1 ~ \dim_eval:w #2 \dim_eval_end: } + { #1 ~ \__dim_eval:w #2 \__dim_eval_end: } \cs_new_protected:Npn \dim_gset:Nn { \tex_global:D \dim_set:Nn } \cs_generate_variant:Nn \dim_set:Nn { c } \cs_generate_variant:Nn \dim_gset:Nn { c } @@ -97,84 +97,98 @@ \cs_generate_variant:Nn \dim_gset_eq:NN { c } \cs_generate_variant:Nn \dim_gset_eq:NN { Nc , cc } \cs_new_protected_nopar:Npn \dim_set_max:Nn - { \dim_set_max_aux:NNNn < \dim_set:Nn } + { \__dim_set_max:NNNn < \dim_set:Nn } \cs_new_protected_nopar:Npn \dim_gset_max:Nn - { \dim_set_max_aux:NNNn < \dim_gset:Nn } + { \__dim_set_max:NNNn < \dim_gset:Nn } \cs_new_protected_nopar:Npn \dim_set_min:Nn - { \dim_set_max_aux:NNNn > \dim_set:Nn } + { \__dim_set_max:NNNn > \dim_set:Nn } \cs_new_protected_nopar:Npn \dim_gset_min:Nn - { \dim_set_max_aux:NNNn > \dim_gset:Nn } -\cs_new_protected:Npn \dim_set_max_aux:NNNn #1#2#3#4 + { \__dim_set_max:NNNn > \dim_gset:Nn } +\cs_new_protected:Npn \__dim_set_max:NNNn #1#2#3#4 { \dim_compare:nNnT {#3} #1 {#4} { #2 #3 {#4} } } \cs_generate_variant:Nn \dim_set_max:Nn { c } \cs_generate_variant:Nn \dim_gset_max:Nn { c } \cs_generate_variant:Nn \dim_set_min:Nn { c } \cs_generate_variant:Nn \dim_gset_min:Nn { c } \cs_new_protected:Npn \dim_add:Nn #1#2 - { \tex_advance:D #1 by \dim_eval:w #2 \dim_eval_end: } + { \tex_advance:D #1 by \__dim_eval:w #2 \__dim_eval_end: } \cs_new_protected:Npn \dim_gadd:Nn { \tex_global:D \dim_add:Nn } \cs_generate_variant:Nn \dim_add:Nn { c } \cs_generate_variant:Nn \dim_gadd:Nn { c } \cs_new_protected:Npn \dim_sub:Nn #1#2 - { \tex_advance:D #1 by - \dim_eval:w #2 \dim_eval_end: } + { \tex_advance:D #1 by - \__dim_eval:w #2 \__dim_eval_end: } \cs_new_protected:Npn \dim_gsub:Nn { \tex_global:D \dim_sub:Nn } \cs_generate_variant:Nn \dim_sub:Nn { c } \cs_generate_variant:Nn \dim_gsub:Nn { c } \cs_new:Npn \dim_abs:n #1 { \dim_use:N - \dim_eval:w - \if_dim:w \dim_eval:w #1 < \c_zero_dim + \__dim_eval:w + \if_dim:w \__dim_eval:w #1 < \c_zero_dim - \fi: - \dim_eval:w #1 \dim_eval_end: - \dim_eval_end: + \__dim_eval:w #1 \__dim_eval_end: + \__dim_eval_end: } \cs_new:Npn \dim_ratio:nn #1#2 - { \dim_ratio_aux:n {#1} / \dim_ratio_aux:n {#2} } -\cs_new:Npn \dim_ratio_aux:n #1 - { \int_value:w \dim_eval:w #1 \dim_eval_end: } + { \__dim_ratio:n {#1} / \__dim_ratio:n {#2} } +\cs_new:Npn \__dim_ratio:n #1 + { \__int_value:w \__dim_eval:w #1 \__dim_eval_end: } \prg_new_conditional:Npnn \dim_compare:nNn #1#2#3 { p , T , F , TF } { - \if_dim:w \dim_eval:w #1 #2 \dim_eval:w #3 \dim_eval_end: + \if_dim:w \__dim_eval:w #1 #2 \__dim_eval:w #3 \__dim_eval_end: \prg_return_true: \else: \prg_return_false: \fi: } \prg_new_conditional:Npnn \dim_compare:n #1 { p , T , F , TF } { - \exp_after:wN \dim_compare_aux:w \dim_use:N \dim_eval:w #1 - \kernel_compare_error: \dim_eval_end: + \exp_after:wN \__dim_compare_aux:w \dim_use:N \__dim_eval:w #1 + \__prg_compare_error: \__dim_eval_end: \prg_return_true: \else: \prg_return_false: \fi: } \exp_args:Nno \use:nn - { \cs_new:Npn \dim_compare_aux:w #1 } + { \cs_new:Npn \__dim_compare_aux:w #1 } { \tl_to_str:n { pt } } - #2 \kernel_compare_error: + #2 \__prg_compare_error: { - \exp_after:wN \dim_compare_aux:NNw #2 ?? \q_mark + \exp_after:wN \__dim_compare_aux:NNw #2 ?? \q_mark #1 pt #2 } -\cs_new:Npn \dim_compare_aux:NNw #1#2#3 \q_mark +\cs_new:Npn \__dim_compare_aux:NNw #1#2#3 \q_mark { - \use:c { dim_compare_ #1 \if_meaning:w = #2 = \fi: :NNw } - \kernel_compare_error:Nw #1 + \use:c { __dim_compare_ #1 \if_meaning:w = #2 = \fi: :NNw } + \__prg_compare_error:Nw #1 } -\cs_new:cpn { dim_compare_=:NNw } #1#2#3 = - { \if_dim:w #3 = \dim_eval:w } -\cs_new:cpn { dim_compare_<:NNw } #1#2#3 < - { \if_dim:w #3 < \dim_eval:w } -\cs_new:cpn { dim_compare_>:NNw } #1#2#3 > - { \if_dim:w #3 > \dim_eval:w } -\cs_new:cpn { dim_compare_==:NNw } #1#2#3 == - { \if_dim:w #3 = \dim_eval:w } -\cs_new:cpn { dim_compare_!=:NNw } #1#2#3 != - { \reverse_if:N \if_dim:w #3 = \dim_eval:w } -\cs_new:cpn { dim_compare_<=:NNw } #1#2#3 <= - { \reverse_if:N \if_dim:w #3 > \dim_eval:w } -\cs_new:cpn { dim_compare_>=:NNw } #1#2#3 >= - { \reverse_if:N \if_dim:w #3 < \dim_eval:w } +\cs_new:cpn { __dim_compare_=:NNw } #1#2#3 = + { \if_dim:w #3 = \__dim_eval:w } +\cs_new:cpn { __dim_compare_<:NNw } #1#2#3 < + { \if_dim:w #3 < \__dim_eval:w } +\cs_new:cpn { __dim_compare_>:NNw } #1#2#3 > + { \if_dim:w #3 > \__dim_eval:w } +\cs_new:cpn { __dim_compare_==:NNw } #1#2#3 == + { \if_dim:w #3 = \__dim_eval:w } +\cs_new:cpn { __dim_compare_!=:NNw } #1#2#3 != + { \reverse_if:N \if_dim:w #3 = \__dim_eval:w } +\cs_new:cpn { __dim_compare_<=:NNw } #1#2#3 <= + { \reverse_if:N \if_dim:w #3 > \__dim_eval:w } +\cs_new:cpn { __dim_compare_>=:NNw } #1#2#3 >= + { \reverse_if:N \if_dim:w #3 < \__dim_eval:w } +\cs_new:Npn \dim_case:nnn #1 + { + \tex_romannumeral:D + \exp_args:Nf \__dim_case_aux:nnn { \dim_eval:n {#1} } + } +\cs_new:Npn \__dim_case_aux:nnn #1#2#3 + { \__dim_case_aux:nw {#1} #2 {#1} {#3} \q_recursion_stop } +\cs_new:Npn \__dim_case_aux:nw #1#2#3 + { + \dim_compare:nNnTF {#1} = {#2} + { \__dim_case_end:nw {#3} } + { \__dim_case_aux:nw {#1} } + } +\cs_new_eq:NN \__dim_case_end:nw \__prg_case_end:nw \cs_set:Npn \dim_while_do:nn #1#2 { \dim_compare:nT {#1} @@ -232,17 +246,17 @@ { \dim_do_until:nNnn {#1} #2 {#3} {#4} } } \cs_new:Npn \dim_eval:n #1 - { \dim_use:N \dim_eval:w #1 \dim_eval_end: } -\cs_new:Npn \dim_strip_bp:n #1 - { \dim_strip_pt:n { 0.996 26 \dim_eval:w #1 \dim_eval_end: } } -\cs_new:Npn \dim_strip_pt:n #1 + { \dim_use:N \__dim_eval:w #1 \__dim_eval_end: } +\cs_new:Npn \__dim_strip_bp:n #1 + { \__dim_strip_pt:n { 0.996 26 \__dim_eval:w #1 \__dim_eval_end: } } +\cs_new:Npn \__dim_strip_pt:n #1 { \exp_after:wN - \dim_strip_pt:w \dim_use:N \dim_eval:w #1 \dim_eval_end: \q_stop + \__dim_strip_pt:w \dim_use:N \__dim_eval:w #1 \__dim_eval_end: \q_stop } \use:x { - \cs_new:Npn \exp_not:N \dim_strip_pt:w + \cs_new:Npn \exp_not:N \__dim_strip_pt:w ##1 . ##2 \tl_to_str:n { pt } ##3 \exp_not:N \q_stop { ##1 @@ -252,20 +266,19 @@ } \cs_new_eq:NN \dim_use:N \tex_the:D \cs_generate_variant:Nn \dim_use:N { c } -\cs_new_eq:NN \dim_show:N \kernel_register_show:N +\cs_new_eq:NN \dim_show:N \__kernel_register_show:N \cs_generate_variant:Nn \dim_show:N { c } \cs_new_protected:Npn \dim_show:n #1 - { \tex_showthe:D \dim_eval:w #1 \dim_eval_end: } + { \etex_showtokens:D \exp_after:wN { \dim_use:N \__dim_eval:w #1 } } \cs_new_eq:NN \c_zero_dim \z@ \cs_new_eq:NN \c_max_dim \maxdimen \dim_new:N \l_tmpa_dim \dim_new:N \l_tmpb_dim -\dim_new:N \l_tmpc_dim \dim_new:N \g_tmpa_dim \dim_new:N \g_tmpb_dim \cs_new_protected:Npn \skip_new:N #1 { - \chk_if_free_cs:N #1 + \__chk_if_free_cs:N #1 \newskip #1 } \cs_generate_variant:Nn \skip_new:N { c } @@ -324,19 +337,17 @@ \prg_return_false: \fi: } -\cs_set_protected:Npn \cs_tmp:w #1 +\cs_set_protected:Npn \__cs_tmp:w #1 { \prg_new_conditional:Npnn \skip_if_finite:n ##1 { p , T , F , TF } { - \exp_after:wN \skip_if_finite_aux:wwNw + \exp_after:wN \__skip_if_finite:wwNw \skip_use:N \etex_glueexpr:D ##1 ; \prg_return_false: #1 ; \prg_return_true: \q_stop } - \cs_new:Npn \skip_if_finite_aux:wwNw ##1 #1 ##2 ; ##3 ##4 \q_stop {##3} + \cs_new:Npn \__skip_if_finite:wwNw ##1 #1 ##2 ; ##3 ##4 \q_stop {##3} } -\exp_args:No \cs_tmp:w { \tl_to_str:n { fil } } -\prg_new_conditional:Npnn \skip_if_infinite_glue:n #1 { p , T , F , TF } - { \skip_if_finite:nTF {#1} \prg_return_false: \prg_return_true: } +\exp_args:No \__cs_tmp:w { \tl_to_str:n { fil } } \cs_new:Npn \skip_eval:n #1 { \skip_use:N \etex_glueexpr:D #1 \scan_stop: } \cs_new_eq:NN \skip_use:N \tex_the:D @@ -349,20 +360,19 @@ { \skip_vertical:N \etex_glueexpr:D #1 \scan_stop: } \cs_generate_variant:Nn \skip_horizontal:N { c } \cs_generate_variant:Nn \skip_vertical:N { c } -\cs_new_eq:NN \skip_show:N \kernel_register_show:N +\cs_new_eq:NN \skip_show:N \__kernel_register_show:N \cs_generate_variant:Nn \skip_show:N { c } \cs_new_protected:Npn \skip_show:n #1 - { \tex_showthe:D \etex_glueexpr:D #1 \scan_stop: } + { \etex_showtokens:D \exp_after:wN { \tex_the:D \etex_glueexpr:D #1 } } \cs_new_eq:NN \c_zero_skip \c_zero_dim \cs_new_eq:NN \c_max_skip \c_max_dim \skip_new:N \l_tmpa_skip \skip_new:N \l_tmpb_skip -\skip_new:N \l_tmpc_skip \skip_new:N \g_tmpa_skip \skip_new:N \g_tmpb_skip \cs_new_protected:Npn \muskip_new:N #1 { - \chk_if_free_cs:N #1 + \__chk_if_free_cs:N #1 \newmuskip #1 } \cs_generate_variant:Nn \muskip_new:N { c } @@ -416,23 +426,21 @@ { \muskip_use:N \etex_muexpr:D #1 \scan_stop: } \cs_new_eq:NN \muskip_use:N \tex_the:D \cs_generate_variant:Nn \muskip_use:N { c } -\cs_new_eq:NN \muskip_show:N \kernel_register_show:N +\cs_new_eq:NN \muskip_show:N \__kernel_register_show:N \cs_generate_variant:Nn \muskip_show:N { c } \cs_new_protected:Npn \muskip_show:n #1 - { \tex_showthe:D \etex_muexpr:D #1 \scan_stop: } -\cs_new:Npn \skip_split_finite_else_action:nnNN #1#2#3#4 - { - \skip_if_finite:nTF {#1} - { - #3 = \etex_gluestretch:D #1 \scan_stop: - #4 = \etex_glueshrink:D #1 \scan_stop: - } - { - #3 = \c_zero_skip - #4 = \c_zero_skip - #2 - } - } + { \etex_showtokens:D \exp_after:wN { \tex_the:D \etex_muexpr:D #1 } } +\muskip_const:Nn \c_zero_muskip { 0 mu } +\muskip_const:Nn \c_max_muskip { 16383.99999 mu } +\muskip_new:N \l_tmpa_muskip +\muskip_new:N \l_tmpb_muskip +\muskip_new:N \g_tmpa_muskip +\muskip_new:N \g_tmpb_muskip +\prg_new_conditional:Npnn \skip_if_infinite_glue:n #1 { p , T , F , TF } + { \skip_if_finite:nTF {#1} \prg_return_false: \prg_return_true: } +\cs_new_eq:NN \prg_case_dim:nnn \dim_case:nnn +\cs_new_eq:NN \dim_eval:w \__dim_eval:w +\cs_new_eq:NN \dim_eval_end: \__dim_eval_end: %% %% %% End of file `l3skip.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3tl.sty b/Master/texmf-dist/tex/latex/l3kernel/l3tl.sty index 763eba4d8a7..166552a8a71 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3tl.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3tl.sty @@ -46,25 +46,25 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3tl.dtx 3490 2012-03-04 01:00:53Z bruno $ - {L3 Experimental token lists} +\GetIdInfo$Id: l3tl.dtx 3986 2012-07-15 19:23:51Z joseph $ + {L3 Token lists} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\package_check_loaded_expl: +\__expl_package_check: \cs_new_protected:Npn \tl_new:N #1 { - \chk_if_free_cs:N #1 + \__chk_if_free_cs:N #1 \cs_gset_eq:NN #1 \c_empty_tl } \cs_generate_variant:Nn \tl_new:N { c } \cs_new_protected:Npn \tl_const:Nn #1#2 { - \chk_if_free_cs:N #1 + \__chk_if_free_cs:N #1 \cs_gset_nopar:Npx #1 { \exp_not:n {#2} } } \cs_new_protected:Npn \tl_const:Nx #1#2 { - \chk_if_free_cs:N #1 + \__chk_if_free_cs:N #1 \cs_gset_nopar:Npx #1 {#2} } \cs_generate_variant:Nn \tl_const:Nn { c } @@ -90,6 +90,12 @@ \cs_new_eq:NN \tl_gset_eq:cN \cs_gset_eq:cN \cs_new_eq:NN \tl_gset_eq:Nc \cs_gset_eq:Nc \cs_new_eq:NN \tl_gset_eq:cc \cs_gset_eq:cc +\cs_new_protected:Npn \tl_concat:NNN #1#2#3 + { \tl_set:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} } } +\cs_new_protected:Npn \tl_gconcat:NNN #1#2#3 + { \tl_gset:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} } } +\cs_generate_variant:Nn \tl_concat:NNN { ccc } +\cs_generate_variant:Nn \tl_gconcat:NNN { ccc } \cs_new_eq:NN \tl_if_exist:NTF \cs_if_exist:NTF \cs_new_eq:NN \tl_if_exist:NT \cs_if_exist:NT \cs_new_eq:NN \tl_if_exist:NF \cs_if_exist:NF @@ -98,6 +104,8 @@ \cs_new_eq:NN \tl_if_exist:cT \cs_if_exist:cT \cs_new_eq:NN \tl_if_exist:cF \cs_if_exist:cF \cs_new_eq:NN \tl_if_exist_p:c \cs_if_exist_p:c +\tl_const:Nx \c_job_name_tl { \tex_jobname:D } +\tl_const:Nn \c_space_tl { ~ } \cs_new_protected:Npn \tl_set:Nn #1#2 { \cs_set_nopar:Npx #1 { \exp_not:n {#2} } } \cs_new_protected:Npn \tl_set:No #1#2 @@ -172,18 +180,18 @@ \tex_lowercase:D { \group_end: - \tl_const:Nn \c_tl_rescan_marker_tl { A B } + \tl_const:Nn \c__tl_rescan_marker_tl { A B } } \cs_new_protected_nopar:Npn \tl_set_rescan:Nnn - { \tl_set_rescan_aux:NNnn \tl_set:Nn } + { \__tl_set_rescan:NNnn \tl_set:Nn } \cs_new_protected_nopar:Npn \tl_gset_rescan:Nnn - { \tl_set_rescan_aux:NNnn \tl_gset:Nn } + { \__tl_set_rescan:NNnn \tl_gset:Nn } \cs_new_protected_nopar:Npn \tl_rescan:nn - { \tl_set_rescan_aux:NNnn \prg_do_nothing: \use:n } -\cs_new_protected:Npn \tl_set_rescan_aux:NNnn #1#2#3#4 + { \__tl_set_rescan:NNnn \prg_do_nothing: \use:n } +\cs_new_protected:Npn \__tl_set_rescan:NNnn #1#2#3#4 { \group_begin: - \exp_args:No \etex_everyeof:D { \c_tl_rescan_marker_tl \exp_not:N } + \exp_args:No \etex_everyeof:D { \c__tl_rescan_marker_tl \exp_not:N } \tex_endlinechar:D \c_minus_one \tex_newlinechar:D \c_minus_one #3 @@ -192,7 +200,7 @@ \group_end: #1 \exp_not:N #2 { - \exp_after:wN \tl_rescan_aux:w + \exp_after:wN \__tl_rescan:w \exp_after:wN \prg_do_nothing: \etex_scantokens:D {#4} } @@ -200,8 +208,8 @@ } \use:x { - \cs_new:Npn \exp_not:N \tl_rescan_aux:w ##1 - \c_tl_rescan_marker_tl + \cs_new:Npn \exp_not:N \__tl_rescan:w ##1 + \c__tl_rescan_marker_tl { \exp_not:N \exp_not:o { ##1 } } } \cs_generate_variant:Nn \tl_set_rescan:Nnn { Nno , Nnx } @@ -211,27 +219,27 @@ \cs_new_eq:NN \tl_to_lowercase:n \tex_lowercase:D \cs_new_eq:NN \tl_to_uppercase:n \tex_uppercase:D \cs_new_protected_nopar:Npn \tl_replace_once:Nnn - { \tl_replace_aux:NNNnn \tl_replace_once_aux: \tl_set:Nx } + { \__tl_replace:NNNnn \__tl_replace_once: \tl_set:Nx } \cs_new_protected_nopar:Npn \tl_greplace_once:Nnn - { \tl_replace_aux:NNNnn \tl_replace_once_aux: \tl_gset:Nx } + { \__tl_replace:NNNnn \__tl_replace_once: \tl_gset:Nx } \cs_new_protected_nopar:Npn \tl_replace_all:Nnn - { \tl_replace_aux:NNNnn \tl_replace_all_aux: \tl_set:Nx } + { \__tl_replace:NNNnn \__tl_replace_all: \tl_set:Nx } \cs_new_protected_nopar:Npn \tl_greplace_all:Nnn - { \tl_replace_aux:NNNnn \tl_replace_all_aux: \tl_gset:Nx } + { \__tl_replace:NNNnn \__tl_replace_all: \tl_gset:Nx } \cs_generate_variant:Nn \tl_replace_once:Nnn { c } \cs_generate_variant:Nn \tl_greplace_once:Nnn { c } \cs_generate_variant:Nn \tl_replace_all:Nnn { c } \cs_generate_variant:Nn \tl_greplace_all:Nnn { c } -\cs_new_protected:Npn \tl_replace_aux:NNNnn #1#2#3#4#5 +\cs_new_protected:Npn \__tl_replace:NNNnn #1#2#3#4#5 { \tl_if_empty:nTF {#4} { - \msg_kernel_error:nnx { tl } { empty-search-pattern } + \__msg_kernel_error:nnx { kernel } { empty-search-pattern } { \tl_to_str:n {#5} } } { \group_align_safe_begin: - \cs_set:Npx \tl_tmp:w ##1##2 #4 + \cs_set:Npx \__tl_tmp:w ##1##2 #4 { ##2 \exp_not:N \q_mark @@ -247,18 +255,18 @@ } } } -\cs_new:Npn \tl_replace_aux_ii:w #1 \q_mark #2 { \exp_not:o {#1} } -\cs_new:Npn \tl_replace_all_aux: +\cs_new:Npn \__tl_replace:w #1 \q_mark #2 { \exp_not:o {#1} } +\cs_new_nopar:Npn \__tl_replace_all: { - \exp_after:wN \tl_replace_aux_ii:w - \tl_tmp:w \tl_replace_all_aux: \prg_do_nothing: + \exp_after:wN \__tl_replace:w + \__tl_tmp:w \__tl_replace_all: \prg_do_nothing: } -\cs_new_nopar:Npn \tl_replace_once_aux: +\cs_new_nopar:Npn \__tl_replace_once: { - \exp_after:wN \tl_replace_aux_ii:w - \tl_tmp:w { \tl_replace_once_aux_end:w \prg_do_nothing: } \prg_do_nothing: + \exp_after:wN \__tl_replace:w + \__tl_tmp:w { \__tl_replace_once_end:w \prg_do_nothing: } \prg_do_nothing: } -\cs_new:Npn \tl_replace_once_aux_end:w #1 \q_mark #2 \q_stop +\cs_new:Npn \__tl_replace_once_end:w #1 \q_mark #2 \q_stop { \exp_not:o {#1} } \cs_new_protected:Npn \tl_remove_once:Nn #1#2 { \tl_replace_once:Nnn #1 {#2} { } } @@ -273,7 +281,7 @@ \cs_generate_variant:Nn \tl_remove_all:Nn { c } \cs_generate_variant:Nn \tl_gremove_all:Nn { c } \prg_new_conditional:Npnn \tl_if_blank:n #1 { p , T , F , TF } - { \tl_if_empty_return:o { \use_none:n #1 ? } } + { \__tl_if_empty_return:o { \use_none:n #1 ? } } \cs_generate_variant:Nn \tl_if_blank_p:n { V } \cs_generate_variant:Nn \tl_if_blank:nT { V } \cs_generate_variant:Nn \tl_if_blank:nF { V } @@ -306,7 +314,7 @@ \cs_generate_variant:Nn \tl_if_empty:nTF { V } \cs_generate_variant:Nn \tl_if_empty:nT { V } \cs_generate_variant:Nn \tl_if_empty:nF { V } -\cs_new:Npn \tl_if_empty_return:o #1 +\cs_new:Npn \__tl_if_empty_return:o #1 { \exp_after:wN \if_meaning:w \exp_after:wN \q_nil \tl_to_str:n \exp_after:wN {#1} \q_nil @@ -316,7 +324,7 @@ \fi: } \prg_new_conditional:Npnn \tl_if_empty:o #1 { p , TF , T , F } - { \tl_if_empty_return:o {#1} } + { \__tl_if_empty_return:o {#1} } \prg_new_conditional:Npnn \tl_if_eq:NN #1#2 { p , T , F , TF } { \if_meaning:w #1 #2 @@ -352,173 +360,269 @@ \cs_generate_variant:Nn \tl_if_in:NnTF { c } \prg_new_protected_conditional:Npnn \tl_if_in:nn #1#2 { T , F , TF } { - \cs_set:Npn \tl_tmp:w ##1 #2 { } - \tl_if_empty:oTF { \tl_tmp:w #1 {} {} #2 } + \cs_set:Npn \__tl_tmp:w ##1 #2 { } + \tl_if_empty:oTF { \__tl_tmp:w #1 {} {} #2 } { \prg_return_false: } { \prg_return_true: } } \cs_generate_variant:Nn \tl_if_in:nnT { V , o , no } \cs_generate_variant:Nn \tl_if_in:nnF { V , o , no } \cs_generate_variant:Nn \tl_if_in:nnTF { V , o , no } +\cs_new:Npn \tl_if_single_p:N { \exp_args:No \tl_if_single_p:n } +\cs_new:Npn \tl_if_single:NT { \exp_args:No \tl_if_single:nT } +\cs_new:Npn \tl_if_single:NF { \exp_args:No \tl_if_single:nF } +\cs_new:Npn \tl_if_single:NTF { \exp_args:No \tl_if_single:nTF } +\prg_new_conditional:Npnn \tl_if_single:n #1 { p , T , F , TF } + { \__str_if_eq_x_return:nn { \exp_not:o { \use_none:nn #1 ?? } } {?} } +\cs_new:Npn \tl_case:Nnn #1#2#3 + { + \tex_romannumeral:D + \__tl_case:Nw #1 #2 #1 {#3} \q_recursion_stop + } +\cs_new:Npn \__tl_case:Nw #1#2#3 + { + \tl_if_eq:NNTF #1 #2 + { \__tl_case_end:nw {#3} } + { \__tl_case:Nw #1 } + } +\cs_generate_variant:Nn \tl_case:Nnn { c } +\cs_new_eq:NN \__tl_case_end:nw \__prg_case_end:nw \cs_new:Npn \tl_map_function:nN #1#2 { - \tl_map_function_aux:Nn #2 #1 + \__tl_map_function:Nn #2 #1 \q_recursion_tail - \prg_break_point:n { } + \__prg_break_point:Nn \tl_map_break: { } } \cs_new_nopar:Npn \tl_map_function:NN { \exp_args:No \tl_map_function:nN } -\cs_new:Npn \tl_map_function_aux:Nn #1#2 +\cs_new:Npn \__tl_map_function:Nn #1#2 { - \quark_if_recursion_tail_break:n {#2} - #1 {#2} \tl_map_function_aux:Nn #1 + \__quark_if_recursion_tail_break:nN {#2} \tl_map_break: + #1 {#2} \__tl_map_function:Nn #1 } \cs_generate_variant:Nn \tl_map_function:NN { c } \cs_new_protected:Npn \tl_map_inline:nn #1#2 { - \int_gincr:N \g_prg_map_int - \cs_gset:cpn { tl_map_inline_ \int_use:N \g_prg_map_int :n } - ##1 {#2} - \exp_args:Nc \tl_map_function_aux:Nn - { tl_map_inline_ \int_use:N \g_prg_map_int :n } + \int_gincr:N \g__prg_map_int + \cs_gset:cpn { __prg_map_ \int_use:N \g__prg_map_int :w } ##1 {#2} + \exp_args:Nc \__tl_map_function:Nn + { __prg_map_ \int_use:N \g__prg_map_int :w } #1 \q_recursion_tail - \prg_break_point:n { \int_gdecr:N \g_prg_map_int } + \__prg_break_point:Nn \tl_map_break: { \int_gdecr:N \g__prg_map_int } } \cs_new_protected:Npn \tl_map_inline:Nn { \exp_args:No \tl_map_inline:nn } \cs_generate_variant:Nn \tl_map_inline:Nn { c } \cs_new_protected:Npn \tl_map_variable:nNn #1#2#3 { - \tl_map_variable_aux:Nnn #2 {#3} #1 + \__tl_map_variable:Nnn #2 {#3} #1 \q_recursion_tail - \prg_break_point:n { } + \__prg_break_point:Nn \tl_map_break: { } } \cs_new_protected_nopar:Npn \tl_map_variable:NNn { \exp_args:No \tl_map_variable:nNn } -\cs_new_protected:Npn \tl_map_variable_aux:Nnn #1#2#3 +\cs_new_protected:Npn \__tl_map_variable:Nnn #1#2#3 { \tl_set:Nn #1 {#3} - \quark_if_recursion_tail_break:N #1 + \__quark_if_recursion_tail_break:NN #1 \tl_map_break: \use:n {#2} - \tl_map_variable_aux:Nnn #1 {#2} + \__tl_map_variable:Nnn #1 {#2} } \cs_generate_variant:Nn \tl_map_variable:NNn { c } -\cs_new_eq:NN \tl_map_break: \prg_map_break: -\cs_new_eq:NN \tl_map_break:n \prg_map_break:n +\cs_new_nopar:Npn \tl_map_break: + { \__prg_map_break:Nn \tl_map_break: { } } +\cs_new_nopar:Npn \tl_map_break:n + { \__prg_map_break:Nn \tl_map_break: } \cs_new_eq:NN \tl_to_str:n \etex_detokenize:D \cs_new:Npn \tl_to_str:N #1 { \etex_detokenize:D \exp_after:wN {#1} } \cs_generate_variant:Nn \tl_to_str:N { c } \cs_new:Npn \tl_use:N #1 { \tl_if_exist:NTF #1 {#1} - { \msg_expandable_kernel_error:nnn { kernel } { bad-var } {#1} } + { \__msg_kernel_expandable_error:nnn { kernel } { bad-variable } {#1} } } \cs_generate_variant:Nn \tl_use:N { c } -\cs_new:Npn \tl_length:n #1 +\cs_new:Npn \tl_count:n #1 { \int_eval:n - { 0 \tl_map_function:nN {#1} \tl_length_aux:n } + { 0 \tl_map_function:nN {#1} \__tl_count:n } } -\cs_new:Npn \tl_length:N #1 +\cs_new:Npn \tl_count:N #1 { \int_eval:n - { 0 \tl_map_function:NN #1 \tl_length_aux:n } + { 0 \tl_map_function:NN #1 \__tl_count:n } } -\cs_new:Npn \tl_length_aux:n #1 { + \c_one } -\cs_generate_variant:Nn \tl_length:n { V , o } -\cs_generate_variant:Nn \tl_length:N { c } +\cs_new:Npn \__tl_count:n #1 { + \c_one } +\cs_generate_variant:Nn \tl_count:n { V , o } +\cs_generate_variant:Nn \tl_count:N { c } \cs_new:Npn \tl_reverse_items:n #1 { - \tl_reverse_items_aux:nwNwn #1 ? - \q_mark \tl_reverse_items_aux:nwNwn - \q_mark \tl_reverse_items_aux:wn + \__tl_reverse_items:nwNwn #1 ? + \q_mark \__tl_reverse_items:nwNwn + \q_mark \__tl_reverse_items:wn \q_stop { } } -\cs_new:Npn \tl_reverse_items_aux:nwNwn #1 #2 \q_mark #3 #4 \q_stop #5 +\cs_new:Npn \__tl_reverse_items:nwNwn #1 #2 \q_mark #3 #4 \q_stop #5 { #3 #2 - \q_mark \tl_reverse_items_aux:nwNwn - \q_mark \tl_reverse_items_aux:wn + \q_mark \__tl_reverse_items:nwNwn + \q_mark \__tl_reverse_items:wn \q_stop { {#1} #5 } } -\cs_new:Npn \tl_reverse_items_aux:wn #1 \q_stop #2 +\cs_new:Npn \__tl_reverse_items:wn #1 \q_stop #2 { \exp_not:o { \use_none:nn #2 } } -\cs_set:Npn \tl_tmp:w #1 +\cs_new:Npn \tl_trim_spaces:n #1 + { \__tl_trim_spaces:nn { \q_mark #1 } \exp_not:o } +\cs_new_protected:Npn \tl_trim_spaces:N #1 + { \tl_set:Nx #1 { \exp_args:No \tl_trim_spaces:n {#1} } } +\cs_new_protected:Npn \tl_gtrim_spaces:N #1 + { \tl_gset:Nx #1 { \exp_args:No \tl_trim_spaces:n {#1} } } +\cs_generate_variant:Nn \tl_trim_spaces:N { c } +\cs_generate_variant:Nn \tl_gtrim_spaces:N { c } +\cs_set:Npn \__tl_tmp:w #1 { - \cs_new:Npn \tl_trim_spaces:n ##1 + \cs_new:Npn \__tl_trim_spaces:nn ##1 { - \etex_unexpanded:D - \tl_trim_spaces_aux_i:w - \q_mark + \__tl_trim_spaces_i:w ##1 \q_nil \q_mark #1 { } - \q_mark \tl_trim_spaces_aux_ii:w - \tl_trim_spaces_aux_iii:w + \q_mark \__tl_trim_spaces_ii:w + \__tl_trim_spaces_iii:w #1 \q_nil - \tl_trim_spaces_aux_iv:w - \q_stop + \__tl_trim_spaces_iv:w + \q_stop } - \cs_new:Npn \tl_trim_spaces_aux_i:w ##1 \q_mark #1 ##2 \q_mark ##3 + \cs_new:Npn \__tl_trim_spaces_i:w ##1 \q_mark #1 ##2 \q_mark ##3 { ##3 - \tl_trim_spaces_aux_i:w + \__tl_trim_spaces_i:w \q_mark ##2 \q_mark #1 {##1} } - \cs_new:Npn \tl_trim_spaces_aux_ii:w ##1 \q_mark \q_mark ##2 + \cs_new:Npn \__tl_trim_spaces_ii:w + \__tl_trim_spaces_i:w \q_mark \q_mark ##1 { - \tl_trim_spaces_aux_iii:w - ##2 + \__tl_trim_spaces_iii:w + ##1 } - \cs_new:Npn \tl_trim_spaces_aux_iii:w ##1 #1 \q_nil ##2 + \cs_new:Npn \__tl_trim_spaces_iii:w ##1 #1 \q_nil ##2 { ##2 ##1 \q_nil - \tl_trim_spaces_aux_iii:w + \__tl_trim_spaces_iii:w } - \cs_new:Npn \tl_trim_spaces_aux_iv:w ##1 \q_nil ##2 \q_stop - { \exp_after:wN { \use_none:n ##1 } } + \cs_new:Npn \__tl_trim_spaces_iv:w ##1 \q_nil ##2 \q_stop ##3 + { ##3 { \use_none:n ##1 } } } -\tl_tmp:w { ~ } -\cs_new_protected:Npn \tl_trim_spaces:N #1 - { \tl_set:Nx #1 { \exp_after:wN \tl_trim_spaces:n \exp_after:wN {#1} } } -\cs_new_protected:Npn \tl_gtrim_spaces:N #1 - { \tl_gset:Nx #1 { \exp_after:wN \tl_trim_spaces:n \exp_after:wN {#1} } } -\cs_generate_variant:Nn \tl_trim_spaces:N { c } -\cs_generate_variant:Nn \tl_gtrim_spaces:N { c } +\__tl_tmp:w { ~ } +\cs_new:Npn \__tl_act:NNNnn #1#2#3#4#5 + { + \group_align_safe_begin: + \__tl_act_loop:w #5 \q__tl_act_mark \q__tl_act_stop + {#4} #1 #2 #3 + \__tl_act_result:n { } + } +\cs_new:Npn \__tl_act_loop:w #1 \q__tl_act_stop + { + \tl_if_head_is_N_type:nTF {#1} + { \__tl_act_normal:NwnNNN } + { + \tl_if_head_is_group:nTF {#1} + { \__tl_act_group:nwnNNN } + { \__tl_act_space:wwnNNN } + } + #1 \q__tl_act_stop + } +\cs_new:Npn \__tl_act_normal:NwnNNN #1 #2 \q__tl_act_stop #3#4 + { + \if_meaning:w \q__tl_act_mark #1 + \exp_after:wN \__tl_act_end:wn + \fi: + #4 {#3} #1 + \__tl_act_loop:w #2 \q__tl_act_stop + {#3} #4 + } +\cs_new:Npn \__tl_act_end:wn #1 \__tl_act_result:n #2 + { \group_align_safe_end: \c_zero #2 } +\cs_new:Npn \__tl_act_group:nwnNNN #1 #2 \q__tl_act_stop #3#4#5 + { + #5 {#3} {#1} + \__tl_act_loop:w #2 \q__tl_act_stop + {#3} #4 #5 + } +\exp_last_unbraced:NNo + \cs_new:Npn \__tl_act_space:wwnNNN \c_space_tl #1 \q__tl_act_stop #2#3#4#5 + { + #5 {#2} + \__tl_act_loop:w #1 \q__tl_act_stop + {#2} #3 #4 #5 + } +\cs_new:Npn \__tl_act_output:n #1 #2 \__tl_act_result:n #3 + { #2 \__tl_act_result:n { #3 #1 } } +\cs_new:Npn \__tl_act_reverse_output:n #1 #2 \__tl_act_result:n #3 + { #2 \__tl_act_result:n { #1 #3 } } +\cs_new:Npn \tl_reverse:n #1 + { + \etex_unexpanded:D \exp_after:wN + { + \tex_romannumeral:D + \__tl_act:NNNnn + \__tl_reverse_normal:nN + \__tl_reverse_group_preserve:nn + \__tl_reverse_space:n + { } + {#1} + } + } +\cs_generate_variant:Nn \tl_reverse:n { o , V } +\cs_new:Npn \__tl_reverse_normal:nN #1#2 + { \__tl_act_reverse_output:n {#2} } +\cs_new:Npn \__tl_reverse_group_preserve:nn #1#2 + { \__tl_act_reverse_output:n { {#2} } } +\cs_new:Npn \__tl_reverse_space:n #1 + { \__tl_act_reverse_output:n { ~ } } +\cs_new_protected:Npn \tl_reverse:N #1 + { \tl_set:Nx #1 { \exp_args:No \tl_reverse:n { #1 } } } +\cs_new_protected:Npn \tl_greverse:N #1 + { \tl_gset:Nx #1 { \exp_args:No \tl_reverse:n { #1 } } } +\cs_generate_variant:Nn \tl_reverse:N { c } +\cs_generate_variant:Nn \tl_greverse:N { c } \cs_new:Npn \tl_head:w #1#2 \q_stop {#1} \cs_new:Npn \tl_tail:w #1#2 \q_stop {#2} \cs_new:Npn \tl_head:n #1 { \etex_unexpanded:D \exp_after:wN { \tl_head:w #1 { } \q_stop } } \cs_new:Npn \tl_tail:n #1 - { \etex_unexpanded:D \tl_tail_aux:w #1 \q_mark { } \q_mark \q_stop } -\cs_new:Npn \tl_tail_aux:w #1 #2 \q_mark #3 \q_stop { {#2} } + { \etex_unexpanded:D \__tl_tail:w #1 \q_mark { } \q_mark \q_stop } +\cs_new:Npn \__tl_tail:w #1 #2 \q_mark #3 \q_stop { {#2} } \cs_new_nopar:Npn \tl_head:N { \exp_args:No \tl_head:n } \cs_generate_variant:Nn \tl_head:n { V , v , f } \cs_new_nopar:Npn \tl_tail:N { \exp_args:No \tl_tail:n } \cs_generate_variant:Nn \tl_tail:n { V , v , f } \cs_new:Npn \str_head:n #1 { - \exp_after:wN \str_head_aux:w + \exp_after:wN \__str_head:w \tl_to_str:n {#1} { { } } ~ \q_stop } -\cs_new:Npn \str_head_aux:w #1 ~ % +\cs_new:Npn \__str_head:w #1 ~ % { \tl_head:w #1 { ~ } } \cs_new:Npn \str_tail:n #1 { - \exp_after:wN \str_tail_aux:w + \exp_after:wN \__str_tail:w \reverse_if:N \if_charcode:w \scan_stop: \tl_to_str:n {#1} X X \q_stop } -\cs_new:Npn \str_tail_aux:w #1 X #2 \q_stop { \fi: #1 } +\cs_new:Npn \__str_tail:w #1 X #2 \q_stop { \fi: #1 } \prg_new_conditional:Npnn \tl_if_head_eq_charcode:nN #1#2 { p , T , F , TF } { \if_charcode:w \exp_not:N #2 - \tl_if_head_N_type:nTF { #1 ? } - { \exp_after:wN \exp_not:N \tl_head:w #1 \q_nil \q_stop } + \tl_if_head_is_N_type:nTF { #1 ? } + { + \exp_after:wN \exp_not:N + \tl_head:w #1 { ? \use_none:nn } \q_stop + } { \str_head:n {#1} } \prg_return_true: \else: @@ -533,10 +637,13 @@ { \if_catcode:w \exp_not:N #2 - \tl_if_head_N_type:nTF { #1 ? } - { \exp_after:wN \exp_not:N \tl_head:w #1 \q_nil \q_stop } + \tl_if_head_is_N_type:nTF { #1 ? } + { + \exp_after:wN \exp_not:N + \tl_head:w #1 { ? \use_none:nn } \q_stop + } { - \tl_if_head_group:nTF {#1} + \tl_if_head_is_group:nTF {#1} { \c_group_begin_token } { \c_space_token } } @@ -547,20 +654,21 @@ } \prg_new_conditional:Npnn \tl_if_head_eq_meaning:nN #1#2 { p , T , F , TF } { - \tl_if_head_N_type:nTF { #1 ? } - { \tl_if_head_eq_meaning_aux_normal:nN } - { \tl_if_head_eq_meaning_aux_special:nN } + \tl_if_head_is_N_type:nTF { #1 ? } + { \__tl_if_head_eq_meaning_normal:nN } + { \__tl_if_head_eq_meaning_special:nN } {#1} #2 } -\cs_new:Npn \tl_if_head_eq_meaning_aux_normal:nN #1 #2 +\cs_new:Npn \__tl_if_head_eq_meaning_normal:nN #1 #2 { - \exp_after:wN \if_meaning:w \tl_head:w #1 \q_nil \q_stop #2 + \exp_after:wN \if_meaning:w + \tl_head:w #1 { ?? \use_none:nnn } \q_stop #2 \prg_return_true: \else: \prg_return_false: \fi: } -\cs_new:Npn \tl_if_head_eq_meaning_aux_special:nN #1 #2 +\cs_new:Npn \__tl_if_head_eq_meaning_special:nN #1 #2 { \if_charcode:w \str_head:n {#1} \exp_not:N #2 \exp_after:wN \use:n @@ -570,7 +678,7 @@ \fi: { \if_catcode:w \exp_not:N #2 - \tl_if_head_group:nTF {#1} + \tl_if_head_is_group:nTF {#1} { \c_group_begin_token } { \c_space_token } \prg_return_true: @@ -579,13 +687,13 @@ \fi: } } -\prg_new_conditional:Npnn \tl_if_head_N_type:n #1 { p , T , F , TF } +\prg_new_conditional:Npnn \tl_if_head_is_N_type:n #1 { p , T , F , TF } { - \str_if_eq_return:xx + \__str_if_eq_x_return:nn { \exp_not:o { \use:n #1 { } } } { \exp_not:n { #1 { } } } } -\prg_new_conditional:Npnn \tl_if_head_group:n #1 { p , T , F , TF } +\prg_new_conditional:Npnn \tl_if_head_is_group:n #1 { p , T , F , TF } { \if_catcode:w * \exp_after:wN \use_none:n @@ -600,12 +708,12 @@ \prg_return_true: \fi: } -\prg_new_conditional:Npnn \tl_if_head_space:n #1 { p , T , F , TF } +\prg_new_conditional:Npnn \tl_if_head_is_space:n #1 { p , T , F , TF } { \tex_romannumeral:D \if_false: { \fi: - \tl_if_head_space_aux:w ? #1 ? ~ } + \__tl_if_head_is_space:w ? #1 ? ~ } } -\cs_new:Npn \tl_if_head_space_aux:w #1 ~ +\cs_new:Npn \__tl_if_head_is_space:w #1 ~ { \tl_if_empty:oTF { \use_none:n #1 } { \exp_after:wN \c_zero \exp_after:wN \prg_return_true: } @@ -615,218 +723,24 @@ \cs_new_protected:Npn \tl_show:N #1 { \cs_show:N #1 } \cs_generate_variant:Nn \tl_show:N { c } \cs_new_eq:NN \tl_show:n \etex_showtokens:D -\tl_const:Nx \c_job_name_tl { \tex_jobname:D } -\tl_const:Nn \c_space_tl { ~ } \tl_new:N \g_tmpa_tl \tl_new:N \g_tmpb_tl \tl_new:N \l_tmpa_tl \tl_new:N \l_tmpb_tl -\cs_new:Npn \str_if_eq_return:xx #1 #2 - { - \if_int_compare:w \pdftex_strcmp:D {#1} {#2} = \c_zero - \prg_return_true: - \else: - \prg_return_false: - \fi: - } -\cs_new:Npn \tl_if_single_p:N { \exp_args:No \tl_if_single_p:n } -\cs_new:Npn \tl_if_single:NT { \exp_args:No \tl_if_single:nT } -\cs_new:Npn \tl_if_single:NF { \exp_args:No \tl_if_single:nF } -\cs_new:Npn \tl_if_single:NTF { \exp_args:No \tl_if_single:nTF } -\prg_new_conditional:Npnn \tl_if_single:n #1 { p , T , F , TF } - { \str_if_eq_return:xx { \exp_not:o { \use_none:nn #1 ?? } } {?} } -\prg_new_conditional:Npnn \tl_if_single_token:n #1 { p , T , F , TF } - { - \tl_if_head_N_type:nTF {#1} - { \str_if_eq_return:xx { \exp_not:o { \use_none:n #1 } } { } } - { \str_if_eq_return:xx { \exp_not:n {#1} } { ~ } } - } -\cs_new:Npn \tl_act:NNNnn { \tex_romannumeral:D \tl_act_aux:NNNnn } -\cs_new:Npn \tl_act_aux:NNNnn #1 #2 #3 #4 #5 - { - \group_align_safe_begin: - \tl_act_loop:w #5 \q_tl_act_mark \q_tl_act_stop - {#4} #1 #2 #3 - \tl_act_result:n { } - } -\cs_new:Npn \tl_act_loop:w #1 \q_tl_act_stop - { - \tl_if_head_N_type:nTF {#1} - { \tl_act_normal:NwnNNN } - { - \tl_if_head_group:nTF {#1} - { \tl_act_group:nwnNNN } - { \tl_act_space:wwnNNN } - } - #1 \q_tl_act_stop - } -\cs_new:Npn \tl_act_normal:NwnNNN #1 #2 \q_tl_act_stop #3#4 - { - \if_meaning:w \q_tl_act_mark #1 - \exp_after:wN \tl_act_end:wn - \fi: - #4 {#3} #1 - \tl_act_loop:w #2 \q_tl_act_stop - {#3} #4 - } -\cs_new:Npn \tl_act_end:wn #1 \tl_act_result:n #2 - { \group_align_safe_end: \c_zero #2 } -\cs_new:Npn \tl_act_group:nwnNNN #1 #2 \q_tl_act_stop #3#4#5 - { - #5 {#3} {#1} - \tl_act_loop:w #2 \q_tl_act_stop - {#3} #4 #5 - } -\exp_last_unbraced:NNo - \cs_new:Npn \tl_act_space:wwnNNN \c_space_tl #1 \q_tl_act_stop #2#3#4#5 - { - #5 {#2} - \tl_act_loop:w #1 \q_tl_act_stop - {#2} #3 #4 #5 - } -\cs_new:Npn \tl_act_output:n #1 #2 \tl_act_result:n #3 - { #2 \tl_act_result:n { #3 #1 } } -\cs_new:Npn \tl_act_reverse_output:n #1 #2 \tl_act_result:n #3 - { #2 \tl_act_result:n { #1 #3 } } -\cs_new:Npn \tl_act_group_recurse:Nnn #1#2#3 - { - \exp_args:Nf #1 - { \exp_after:wN \exp_after:wN \exp_after:wN { #2 {#3} } } - } -\cs_new:Npn \tl_reverse_tokens:n #1 - { - \etex_unexpanded:D \exp_after:wN - { - \tex_romannumeral:D - \tl_act_aux:NNNnn - \tl_act_reverse_normal:nN - \tl_act_reverse_group:nn - \tl_act_reverse_space:n - { } - {#1} - } - } -\cs_new:Npn \tl_act_reverse_space:n #1 - { \tl_act_reverse_output:n {~} } -\cs_new:Npn \tl_act_reverse_normal:nN #1 #2 - { \tl_act_reverse_output:n {#2} } -\cs_new:Npn \tl_act_reverse_group:nn #1 - { - \tl_act_group_recurse:Nnn - \tl_act_reverse_output:n - { \tl_reverse_tokens:n } - } -\cs_new:Npn \tl_reverse:n #1 - { - \etex_unexpanded:D \exp_after:wN - { - \tex_romannumeral:D - \tl_act_aux:NNNnn - \tl_act_reverse_normal:nN - \tl_act_reverse_group_preserve:nn - \tl_act_reverse_space:n - { } - {#1} - } - } -\cs_new:Npn \tl_act_reverse_group_preserve:nn #1 #2 - { \tl_act_reverse_output:n { {#2} } } -\cs_generate_variant:Nn \tl_reverse:n { o , V } -\cs_new_protected:Npn \tl_reverse:N #1 - { \tl_set:Nx #1 { \exp_args:No \tl_reverse:n { #1 } } } -\cs_new_protected:Npn \tl_greverse:N #1 - { \tl_gset:Nx #1 { \exp_args:No \tl_reverse:n { #1 } } } -\cs_generate_variant:Nn \tl_reverse:N { c } -\cs_generate_variant:Nn \tl_greverse:N { c } -\cs_new:Npn \tl_length_tokens:n #1 - { - \int_eval:n - { - \tl_act_aux:NNNnn - \tl_act_length_normal:nN - \tl_act_length_group:nn - \tl_act_length_space:n - { } - {#1} - } - } -\cs_new:Npn \tl_act_length_normal:nN #1 #2 { 1 + } -\cs_new:Npn \tl_act_length_space:n #1 { 1 + } -\cs_new:Npn \tl_act_length_group:nn #1 #2 - { 2 + \tl_length_tokens:n {#2} + } -\tl_const:Nn \c_tl_act_uppercase_tl - { - aA bB cC dD eE fF gG hH iI jJ kK lL mM - nN oO pP qQ rR sS tT uU vV wW xX yY zZ - } -\tl_const:Nn \c_tl_act_lowercase_tl - { - Aa Bb Cc Dd Ee Ff Gg Hh Ii Jj Kk Ll Mm - Nn Oo Pp Qq Rr Ss Tt Uu Vv Ww Xx Yy Zz - } -\cs_new:Npn \tl_expandable_uppercase:n #1 - { - \etex_unexpanded:D \exp_after:wN - { - \tex_romannumeral:D - \tl_act_case_aux:nn { \c_tl_act_uppercase_tl } {#1} - } - } -\cs_new:Npn \tl_expandable_lowercase:n #1 - { - \etex_unexpanded:D \exp_after:wN - { - \tex_romannumeral:D - \tl_act_case_aux:nn { \c_tl_act_lowercase_tl } {#1} - } - } -\cs_new:Npn \tl_act_case_aux:nn - { - \tl_act_aux:NNNnn - \tl_act_case_normal:nN - \tl_act_case_group:nn - \tl_act_case_space:n - } -\cs_new:Npn \tl_act_case_space:n #1 { \tl_act_output:n {~} } -\cs_new:Npn \tl_act_case_normal:nN #1 #2 - { - \exp_args:Nf \tl_act_output:n - { - \exp_args:NNo \prg_case_str:nnn #2 {#1} - { \exp_stop_f: #2 } - } - } -\cs_new:Npn \tl_act_case_group:nn #1 #2 - { - \exp_after:wN \tl_act_output:n \exp_after:wN - { \exp_after:wN { \tex_romannumeral:D \tl_act_case_aux:nn {#1} {#2} } } - } -\cs_new:Npn \tl_item:nn #1#2 - { - \exp_args:Nf \tl_item_aux:nn - { - \int_eval:n - { - \int_compare:nNnT {#2} < \c_zero - { \tl_length:n {#1} + } - #2 - } - } - #1 - \q_recursion_tail - \prg_break_point:n { } - } -\cs_new:Npn \tl_item_aux:nn #1#2 - { - \quark_if_recursion_tail_break:n {#2} - \int_compare:nNnTF {#1} = \c_zero - { \tl_map_break:n { \exp_not:n {#2} } } - { \exp_args:Nf \tl_item_aux:nn { \int_eval:n { #1 - 1 } } } - } -\cs_new_nopar:Npn \tl_item:Nn { \exp_args:No \tl_item:nn } -\cs_generate_variant:Nn \tl_item:Nn { c } +\cs_new_eq:NN \tl_length_tokens:n \tl_count_tokens:n +\cs_new_eq:NN \tl_length:N \tl_count:N +\cs_new_eq:NN \tl_length:c \tl_count:c +\cs_new_eq:NN \tl_length:n \tl_count:n +\cs_new_eq:NN \tl_length:V \tl_count:V +\cs_new_eq:NN \tl_length:o \tl_count:o \prg_new_conditional:Npnn \tl_if_empty:x #1 { p , T , F , TF } - { \str_if_eq_return:xx { } {#1} } + { \__str_if_eq_x_return:nn { } {#1} } +\prg_new_eq_conditional:NNn \tl_if_head_group:n \tl_if_head_is_group:n + { p , T , F , TF } +\prg_new_eq_conditional:NNn \tl_if_head_N_type:n \tl_if_head_is_N_type:n + { p , T , F , TF } +\prg_new_eq_conditional:NNn \tl_if_head_space:n \tl_if_head_is_space:n + { p , T , F , TF } %% %% %% End of file `l3tl.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3token.sty b/Master/texmf-dist/tex/latex/l3kernel/l3token.sty index cd05ac7b262..bac0b7a8832 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3token.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3token.sty @@ -46,17 +46,17 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3token.dtx 3491 2012-03-04 06:13:18Z bruno $ +\GetIdInfo$Id: l3token.dtx 3986 2012-07-15 19:23:51Z joseph $ {L3 Experimental token manipulation} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\package_check_loaded_expl: +\__expl_package_check: \cs_new_protected:Npn \char_set_catcode:nn #1#2 - { \tex_catcode:D #1 = \int_eval:w #2 \int_eval_end: } + { \tex_catcode:D #1 = \__int_eval:w #2 \__int_eval_end: } \cs_new:Npn \char_value_catcode:n #1 - { \tex_the:D \tex_catcode:D \int_eval:w #1\int_eval_end: } + { \tex_the:D \tex_catcode:D \__int_eval:w #1\__int_eval_end: } \cs_new_protected:Npn \char_show_value_catcode:n #1 - { \tex_showthe:D \tex_catcode:D \int_eval:w #1 \int_eval_end: } + { \tex_showthe:D \tex_catcode:D \__int_eval:w #1 \__int_eval_end: } \cs_new_protected:Npn \char_set_catcode_escape:N #1 { \char_set_catcode:nn { `#1 } \c_zero } \cs_new_protected:Npn \char_set_catcode_group_begin:N #1 @@ -122,29 +122,29 @@ \cs_new_protected:Npn \char_set_catcode_invalid:n #1 { \char_set_catcode:nn {#1} \c_fifteen } \cs_new_protected:Npn \char_set_mathcode:nn #1#2 - { \tex_mathcode:D #1 = \int_eval:w #2 \int_eval_end: } + { \tex_mathcode:D #1 = \__int_eval:w #2 \__int_eval_end: } \cs_new:Npn \char_value_mathcode:n #1 - { \tex_the:D \tex_mathcode:D \int_eval:w #1\int_eval_end: } + { \tex_the:D \tex_mathcode:D \__int_eval:w #1\__int_eval_end: } \cs_new_protected:Npn \char_show_value_mathcode:n #1 - { \tex_showthe:D \tex_mathcode:D \int_eval:w #1 \int_eval_end: } + { \tex_showthe:D \tex_mathcode:D \__int_eval:w #1 \__int_eval_end: } \cs_new_protected:Npn \char_set_lccode:nn #1#2 - { \tex_lccode:D #1 = \int_eval:w #2 \int_eval_end: } + { \tex_lccode:D #1 = \__int_eval:w #2 \__int_eval_end: } \cs_new:Npn \char_value_lccode:n #1 - { \tex_the:D \tex_lccode:D \int_eval:w #1\int_eval_end: } + { \tex_the:D \tex_lccode:D \__int_eval:w #1\__int_eval_end: } \cs_new_protected:Npn \char_show_value_lccode:n #1 - { \tex_showthe:D \tex_lccode:D \int_eval:w #1 \int_eval_end: } + { \tex_showthe:D \tex_lccode:D \__int_eval:w #1 \__int_eval_end: } \cs_new_protected:Npn \char_set_uccode:nn #1#2 - { \tex_uccode:D #1 = \int_eval:w #2 \int_eval_end: } + { \tex_uccode:D #1 = \__int_eval:w #2 \__int_eval_end: } \cs_new:Npn \char_value_uccode:n #1 - { \tex_the:D \tex_uccode:D \int_eval:w #1\int_eval_end: } + { \tex_the:D \tex_uccode:D \__int_eval:w #1\__int_eval_end: } \cs_new_protected:Npn \char_show_value_uccode:n #1 - { \tex_showthe:D \tex_uccode:D \int_eval:w #1 \int_eval_end: } + { \tex_showthe:D \tex_uccode:D \__int_eval:w #1 \__int_eval_end: } \cs_new_protected:Npn \char_set_sfcode:nn #1#2 - { \tex_sfcode:D #1 = \int_eval:w #2 \int_eval_end: } + { \tex_sfcode:D #1 = \__int_eval:w #2 \__int_eval_end: } \cs_new:Npn \char_value_sfcode:n #1 - { \tex_the:D \tex_sfcode:D \int_eval:w #1\int_eval_end: } + { \tex_the:D \tex_sfcode:D \__int_eval:w #1\__int_eval_end: } \cs_new_protected:Npn \char_show_value_sfcode:n #1 - { \tex_showthe:D \tex_sfcode:D \int_eval:w #1 \int_eval_end: } + { \tex_showthe:D \tex_sfcode:D \__int_eval:w #1 \__int_eval_end: } \cs_new_protected:Npn \token_new:Nn #1#2 { \cs_new_eq:NN #1 #2 } \cs_new_eq:NN \c_group_begin_token { \cs_new_eq:NN \c_group_end_token } @@ -178,13 +178,13 @@ \use:nn { \group_end: - \seq_set_from_clist:Nn \l_char_active_seq + \seq_set_split:Nnn \l_char_active_seq { } } } - { { " , $ , & , ^ , _ , ~ } } %$ + { { " $ & ^ _ ~ } } %$ \seq_new:N \l_char_special_seq -\seq_set_from_clist:Nn \l_char_special_seq - { \ , \" , \# , \$ , \% , \& , \\ , \^ , \_ , \{ , \} , \~ } +\seq_set_split:Nnn \l_char_special_seq { } + { \ \" \# \$ \% \& \\ \^ \_ \{ \} \~ } \prg_new_conditional:Npnn \token_if_group_begin:N #1 { p , T , F , TF } { \if_catcode:w \exp_not:N #1 \c_group_begin_token @@ -269,10 +269,10 @@ \group_end: \prg_new_conditional:Npnn \token_if_macro:N #1 { p , T , F , TF } { - \exp_after:wN \token_if_macro_p_aux:w + \exp_after:wN \__token_if_macro_p:w \token_to_meaning:N #1 MA; \q_stop } - \cs_new:Npn \token_if_macro_p_aux:w #1 MA #2 ; #3 \q_stop + \cs_new:Npn \__token_if_macro_p:w #1 MA #2 ; #3 \q_stop { \if_int_compare:w \pdftex_strcmp:D { #2 } { cro } = \c_zero \prg_return_true: @@ -288,12 +288,15 @@ } \prg_new_conditional:Npnn \token_if_expandable:N #1 { p , T , F , TF } { - \cs_if_exist:NTF #1 - { - \exp_after:wN \if_meaning:w \exp_not:N #1 #1 - \prg_return_false: \else: \prg_return_true: \fi: - } - { \prg_return_false: } + \exp_after:wN \if_meaning:w \exp_not:N #1 #1 + \prg_return_false: + \else: + \if_cs_exist:N #1 + \prg_return_true: + \else: + \prg_return_false: + \fi: + \fi: } \group_begin: \char_set_lccode:nn { `T } { `T } @@ -308,23 +311,23 @@ \group_end: \prg_new_conditional:Npnn \token_if_chardef:N #1 { p , T , F , TF } { - \str_if_eq_return:xx + \__str_if_eq_x_return:nn { - \exp_after:wN \token_if_chardef_aux:w + \exp_after:wN \__token_if_chardef:w \token_to_meaning:N #1 CHAR" \q_stop } { \token_to_str:N \char } } \prg_new_conditional:Npnn \token_if_mathchardef:N #1 { p , T , F , TF } { - \str_if_eq_return:xx + \__str_if_eq_x_return:nn { - \exp_after:wN \token_if_chardef_aux:w + \exp_after:wN \__token_if_chardef:w \token_to_meaning:N #1 CHAR" \q_stop } { \token_to_str:N \mathchar } } - \cs_new:Npn \token_if_chardef_aux:w #1 CHAR" #2 \q_stop { #1 CHAR } + \cs_new:Npn \__token_if_chardef:w #1 CHAR" #2 \q_stop { #1 CHAR } \prg_new_conditional:Npnn \token_if_dim_register:N #1 { p , T , F , TF } { \if_meaning:w \tex_dimen:D #1 @@ -333,16 +336,16 @@ \if_meaning:w \tex_dimendef:D #1 \prg_return_false: \else: - \str_if_eq_return:xx + \__str_if_eq_x_return:nn { - \exp_after:wN \token_if_dim_register_aux:w + \exp_after:wN \__token_if_dim_register:w \token_to_meaning:N #1 ZIMEX \q_stop } { \token_to_str:N \ } \fi: \fi: } - \cs_new:Npn \token_if_dim_register_aux:w #1 ZIMEX #2 \q_stop { #1 ~ } + \cs_new:Npn \__token_if_dim_register:w #1 ZIMEX #2 \q_stop { #1 ~ } \prg_new_conditional:Npnn \token_if_int_register:N #1 { p , T , F , TF } { % \token_if_chardef:NTF #1 { \prg_return_true: } @@ -355,9 +358,9 @@ \if_meaning:w \tex_countdef:D #1 \prg_return_false: \else: - \str_if_eq_return:xx + \__str_if_eq_x_return:nn { - \exp_after:wN \token_if_int_register_aux:w + \exp_after:wN \__token_if_int_register:w \token_to_meaning:N #1 COUXY \q_stop } { \token_to_str:N \ } @@ -366,7 +369,7 @@ % } % } } - \cs_new:Npn \token_if_int_register_aux:w #1 COUXY #2 \q_stop { #1 ~ } + \cs_new:Npn \__token_if_int_register:w #1 COUXY #2 \q_stop { #1 ~ } \prg_new_conditional:Npnn \token_if_muskip_register:N #1 { p , T , F , TF } { \if_meaning:w \tex_muskip:D #1 @@ -375,16 +378,16 @@ \if_meaning:w \tex_muskipdef:D #1 \prg_return_false: \else: - \str_if_eq_return:xx + \__str_if_eq_x_return:nn { - \exp_after:wN \token_if_muskip_register_aux:w + \exp_after:wN \__token_if_muskip_register:w \token_to_meaning:N #1 MUSKIP \q_stop } { \token_to_str:N \ } \fi: \fi: } - \cs_new:Npn \token_if_muskip_register_aux:w #1 MUSKIP #2 \q_stop { #1 ~ } + \cs_new:Npn \__token_if_muskip_register:w #1 MUSKIP #2 \q_stop { #1 ~ } \prg_new_conditional:Npnn \token_if_skip_register:N #1 { p , T , F , TF } { \if_meaning:w \tex_skip:D #1 @@ -393,16 +396,16 @@ \if_meaning:w \tex_skipdef:D #1 \prg_return_false: \else: - \str_if_eq_return:xx + \__str_if_eq_x_return:nn { - \exp_after:wN \token_if_skip_register_aux:w + \exp_after:wN \__token_if_skip_register:w \token_to_meaning:N #1 SKIP \q_stop } { \token_to_str:N \ } \fi: \fi: } - \cs_new:Npn \token_if_skip_register_aux:w #1 SKIP #2 \q_stop { #1 ~ } + \cs_new:Npn \__token_if_skip_register:w #1 SKIP #2 \q_stop { #1 ~ } \prg_new_conditional:Npnn \token_if_toks_register:N #1 { p , T , F , TF } { \if_meaning:w \tex_toks:D #1 @@ -411,33 +414,33 @@ \if_meaning:w \tex_toksdef:D #1 \prg_return_false: \else: - \str_if_eq_return:xx + \__str_if_eq_x_return:nn { - \exp_after:wN \token_if_toks_register_aux:w + \exp_after:wN \__token_if_toks_register:w \token_to_meaning:N #1 YOKS \q_stop } { \token_to_str:N \ } \fi: \fi: } - \cs_new:Npn \token_if_toks_register_aux:w #1 YOKS #2 \q_stop { #1 ~ } + \cs_new:Npn \__token_if_toks_register:w #1 YOKS #2 \q_stop { #1 ~ } \prg_new_conditional:Npnn \token_if_protected_macro:N #1 { p , T , F , TF } { - \str_if_eq_return:xx + \__str_if_eq_x_return:nn { - \exp_after:wN \token_if_protected_macro_aux:w + \exp_after:wN \__token_if_protected_macro:w \token_to_meaning:N #1 PROYECYEZ~MACRO \q_stop } { \token_to_str:N \ } } - \cs_new:Npn \token_if_protected_macro_aux:w + \cs_new:Npn \__token_if_protected_macro:w #1 PROYECYEZ~MACRO #2 \q_stop { #1 ~ } \prg_new_conditional:Npnn \token_if_long_macro:N #1 { p , T , F , TF } { - \str_if_eq_return:xx + \__str_if_eq_x_return:nn { - \exp_after:wN \token_if_long_macro_aux:w + \exp_after:wN \__token_if_long_macro:w \token_to_meaning:N #1 LOXG~MACRO \q_stop } { \token_to_str:N \ } @@ -445,14 +448,14 @@ \prg_new_conditional:Npnn \token_if_protected_long_macro:N #1 { p , T , F , TF } { - \str_if_eq_return:xx + \__str_if_eq_x_return:nn { - \exp_after:wN \token_if_long_macro_aux:w + \exp_after:wN \__token_if_long_macro:w \token_to_meaning:N #1 LOXG~MACRO \q_stop } { \token_to_str:N \protected \token_to_str:N \ } } - \cs_new:Npn \token_if_long_macro_aux:w #1 LOXG~MACRO #2 \q_stop { #1 ~ } + \cs_new:Npn \__token_if_long_macro:w #1 LOXG~MACRO #2 \q_stop { #1 ~ } } \tex_chardef:D \c_token_A_int = `A ~ % \group_begin: @@ -467,19 +470,19 @@ \token_if_macro:NTF #1 \prg_return_false: { - \exp_after:wN \token_if_primitive_aux:NNw + \exp_after:wN \__token_if_primitive:NNw \token_to_meaning:N #1 ; ; ; \q_stop #1 } } - \cs_new:Npn \token_if_primitive_aux:NNw #1#2 #3 ; #4 \q_stop + \cs_new:Npn \__token_if_primitive:NNw #1#2 #3 ; #4 \q_stop { - \tl_if_empty:oTF { \token_if_primitive_aux_space:w #3 ~ } - { \token_if_primitive_aux_loop:N #3 ; \q_stop } - { \token_if_primitive_aux_nullfont:N } + \tl_if_empty:oTF { \__token_if_primitive_space:w #3 ~ } + { \__token_if_primitive_loop:N #3 ; \q_stop } + { \__token_if_primitive_nullfont:N } } } -\cs_new:Npn \token_if_primitive_aux_space:w #1 ~ { } -\cs_new:Npn \token_if_primitive_aux_nullfont:N #1 +\cs_new:Npn \__token_if_primitive_space:w #1 ~ { } +\cs_new:Npn \__token_if_primitive_nullfont:N #1 { \if_meaning:w \tex_nullfont:D #1 \prg_return_true: @@ -487,25 +490,25 @@ \prg_return_false: \fi: } -\cs_new:Npn \token_if_primitive_aux_loop:N #1 +\cs_new:Npn \__token_if_primitive_loop:N #1 { - \if_num:w `#1 < \c_token_A_int % - \exp_after:wN \token_if_primitive_auxii:Nw + \if_int_compare:w `#1 < \c_token_A_int % + \exp_after:wN \__token_if_primitive:Nw \exp_after:wN #1 \else: - \exp_after:wN \token_if_primitive_aux_loop:N + \exp_after:wN \__token_if_primitive_loop:N \fi: } -\cs_new:Npn \token_if_primitive_auxii:Nw #1 #2 \q_stop +\cs_new:Npn \__token_if_primitive:Nw #1 #2 \q_stop { \if:w : #1 - \exp_after:wN \token_if_primitive_aux_undefined:N + \exp_after:wN \__token_if_primitive_undefined:N \else: \prg_return_false: \exp_after:wN \use_none:n \fi: } -\cs_new:Npn \token_if_primitive_aux_undefined:N #1 +\cs_new:Npn \__token_if_primitive_undefined:N #1 { \if_cs_exist:N #1 \prg_return_true: @@ -515,32 +518,32 @@ } \cs_new_eq:NN \l_peek_token ? \cs_new_eq:NN \g_peek_token ? -\cs_new_eq:NN \l_peek_search_token ? -\tl_new:N \l_peek_search_tl -\cs_new_nopar:Npn \peek_true:w { } -\cs_new_nopar:Npn \peek_true_aux:w { } -\cs_new_nopar:Npn \peek_false:w { } -\cs_new:Npn \peek_tmp:w { } +\cs_new_eq:NN \l__peek_search_token ? +\tl_new:N \l__peek_search_tl +\cs_new_nopar:Npn \__peek_true:w { } +\cs_new_nopar:Npn \__peek_true_aux:w { } +\cs_new_nopar:Npn \__peek_false:w { } +\cs_new:Npn \__peek_tmp:w { } \cs_new_protected_nopar:Npn \peek_after:Nw { \tex_futurelet:D \l_peek_token } \cs_new_protected_nopar:Npn \peek_gafter:Nw { \tex_global:D \tex_futurelet:D \g_peek_token } -\cs_new_protected:Npn \peek_true_remove:w +\cs_new_protected:Npn \__peek_true_remove:w { \group_align_safe_end: - \tex_afterassignment:D \peek_true_aux:w - \cs_set_eq:NN \peek_tmp:w + \tex_afterassignment:D \__peek_true_aux:w + \cs_set_eq:NN \__peek_tmp:w } -\cs_new_protected:Npn \peek_token_generic:NNTF #1#2#3#4 +\cs_new_protected:Npn \__peek_token_generic:NNTF #1#2#3#4 { - \cs_set_eq:NN \l_peek_search_token #2 - \tl_set:Nn \l_peek_search_tl {#2} - \cs_set_nopar:Npx \peek_true:w + \cs_set_eq:NN \l__peek_search_token #2 + \tl_set:Nn \l__peek_search_tl {#2} + \cs_set_nopar:Npx \__peek_true:w { \exp_not:N \group_align_safe_end: \exp_not:n {#3} } - \cs_set_nopar:Npx \peek_false:w + \cs_set_nopar:Npx \__peek_false:w { \exp_not:N \group_align_safe_end: \exp_not:n {#4} @@ -548,17 +551,17 @@ \group_align_safe_begin: \peek_after:Nw #1 } -\cs_new_protected:Npn \peek_token_generic:NNT #1#2#3 - { \peek_token_generic:NNTF #1 #2 {#3} { } } -\cs_new_protected:Npn \peek_token_generic:NNF #1#2#3 - { \peek_token_generic:NNTF #1 #2 { } {#3} } -\cs_new_protected:Npn \peek_token_remove_generic:NNTF #1#2#3#4 - { - \cs_set_eq:NN \l_peek_search_token #2 - \tl_set:Nn \l_peek_search_tl {#2} - \cs_set_eq:NN \peek_true:w \peek_true_remove:w - \cs_set_nopar:Npx \peek_true_aux:w { \exp_not:n {#3} } - \cs_set_nopar:Npx \peek_false:w +\cs_new_protected:Npn \__peek_token_generic:NNT #1#2#3 + { \__peek_token_generic:NNTF #1 #2 {#3} { } } +\cs_new_protected:Npn \__peek_token_generic:NNF #1#2#3 + { \__peek_token_generic:NNTF #1 #2 { } {#3} } +\cs_new_protected:Npn \__peek_token_remove_generic:NNTF #1#2#3#4 + { + \cs_set_eq:NN \l__peek_search_token #2 + \tl_set:Nn \l__peek_search_tl {#2} + \cs_set_eq:NN \__peek_true:w \__peek_true_remove:w + \cs_set_nopar:Npx \__peek_true_aux:w { \exp_not:n {#3} } + \cs_set_nopar:Npx \__peek_false:w { \exp_not:N \group_align_safe_end: \exp_not:n {#4} @@ -566,28 +569,28 @@ \group_align_safe_begin: \peek_after:Nw #1 } -\cs_new_protected:Npn \peek_token_remove_generic:NNT #1#2#3 - { \peek_token_remove_generic:NNTF #1 #2 {#3} { } } -\cs_new_protected:Npn \peek_token_remove_generic:NNF #1#2#3 - { \peek_token_remove_generic:NNTF #1 #2 { } {#3} } -\cs_new_nopar:Npn \peek_execute_branches_catcode: +\cs_new_protected:Npn \__peek_token_remove_generic:NNT #1#2#3 + { \__peek_token_remove_generic:NNTF #1 #2 {#3} { } } +\cs_new_protected:Npn \__peek_token_remove_generic:NNF #1#2#3 + { \__peek_token_remove_generic:NNTF #1 #2 { } {#3} } +\cs_new_nopar:Npn \__peek_execute_branches_catcode: { \if_catcode:w - \exp_not:N \l_peek_token \exp_not:N \l_peek_search_token - \exp_after:wN \peek_true:w + \exp_not:N \l_peek_token \exp_not:N \l__peek_search_token + \exp_after:wN \__peek_true:w \else: - \exp_after:wN \peek_false:w + \exp_after:wN \__peek_false:w \fi: } -\cs_new_nopar:Npn \peek_execute_branches_meaning: +\cs_new_nopar:Npn \__peek_execute_branches_meaning: { - \if_meaning:w \l_peek_token \l_peek_search_token - \exp_after:wN \peek_true:w + \if_meaning:w \l_peek_token \l__peek_search_token + \exp_after:wN \__peek_true:w \else: - \exp_after:wN \peek_false:w + \exp_after:wN \__peek_false:w \fi: } -\cs_new_nopar:Npn \peek_execute_branches_charcode: +\cs_new_nopar:Npn \__peek_execute_branches_charcode: { \bool_if:nTF { @@ -595,107 +598,107 @@ || \token_if_eq_catcode_p:NN \l_peek_token \c_group_end_token || \token_if_eq_meaning_p:NN \l_peek_token \c_space_token } - { \peek_false:w } + { \__peek_false:w } { - \exp_after:wN \peek_execute_branches_charcode_aux:NN - \l_peek_search_tl + \exp_after:wN \__peek_execute_branches_charcode_aux:NN + \l__peek_search_tl } } -\cs_new:Npn \peek_execute_branches_charcode_aux:NN #1#2 +\cs_new:Npn \__peek_execute_branches_charcode_aux:NN #1#2 { \if:w \exp_not:N #1 \exp_not:N #2 - \exp_after:wN \peek_true:w + \exp_after:wN \__peek_true:w \else: - \exp_after:wN \peek_false:w + \exp_after:wN \__peek_false:w \fi: #2 } -\cs_new_protected_nopar:Npn \peek_ignore_spaces_execute_branches: +\cs_new_protected_nopar:Npn \__peek_ignore_spaces_execute_branches: { \token_if_eq_meaning:NNTF \l_peek_token \c_space_token { - \tex_afterassignment:D \peek_ignore_spaces_execute_branches_aux: - \cs_set_eq:NN \peek_tmp:w + \tex_afterassignment:D \__peek_ignore_spaces_execute_branches_aux: + \cs_set_eq:NN \__peek_tmp:w } - { \peek_execute_branches: } + { \__peek_execute_branches: } } -\cs_new_protected_nopar:Npn \peek_ignore_spaces_execute_branches_aux: - { \peek_after:Nw \peek_ignore_spaces_execute_branches: } +\cs_new_protected_nopar:Npn \__peek_ignore_spaces_execute_branches_aux: + { \peek_after:Nw \__peek_ignore_spaces_execute_branches: } \group_begin: - \cs_set:Npn \peek_def:nnnn #1#2#3#4 + \cs_set:Npn \__peek_def:nnnn #1#2#3#4 { - \peek_def_aux:nnnnn {#1} {#2} {#3} {#4} { TF } - \peek_def_aux:nnnnn {#1} {#2} {#3} {#4} { T } - \peek_def_aux:nnnnn {#1} {#2} {#3} {#4} { F } + \__peek_def:nnnnn {#1} {#2} {#3} {#4} { TF } + \__peek_def:nnnnn {#1} {#2} {#3} {#4} { T } + \__peek_def:nnnnn {#1} {#2} {#3} {#4} { F } } - \cs_set:Npn \peek_def_aux:nnnnn #1#2#3#4#5 + \cs_set:Npn \__peek_def:nnnnn #1#2#3#4#5 { \cs_new_nopar:cpx { #1 #5 } { \tl_if_empty:nF {#2} - { \exp_not:n { \cs_set_eq:NN \peek_execute_branches: #2 } } + { \exp_not:n { \cs_set_eq:NN \__peek_execute_branches: #2 } } \exp_not:c { #3 #5 } \exp_not:n {#4} } } - \peek_def:nnnn { peek_catcode:N } + \__peek_def:nnnn { peek_catcode:N } { } - { peek_token_generic:NN } - { \peek_execute_branches_catcode: } - \peek_def:nnnn { peek_catcode_ignore_spaces:N } - { \peek_execute_branches_catcode: } - { peek_token_generic:NN } - { \peek_ignore_spaces_execute_branches: } - \peek_def:nnnn { peek_catcode_remove:N } + { __peek_token_generic:NN } + { \__peek_execute_branches_catcode: } + \__peek_def:nnnn { peek_catcode_ignore_spaces:N } + { \__peek_execute_branches_catcode: } + { __peek_token_generic:NN } + { \__peek_ignore_spaces_execute_branches: } + \__peek_def:nnnn { peek_catcode_remove:N } { } - { peek_token_remove_generic:NN } - { \peek_execute_branches_catcode: } - \peek_def:nnnn { peek_catcode_remove_ignore_spaces:N } - { \peek_execute_branches_catcode: } - { peek_token_remove_generic:NN } - { \peek_ignore_spaces_execute_branches: } - \peek_def:nnnn { peek_charcode:N } + { __peek_token_remove_generic:NN } + { \__peek_execute_branches_catcode: } + \__peek_def:nnnn { peek_catcode_remove_ignore_spaces:N } + { \__peek_execute_branches_catcode: } + { __peek_token_remove_generic:NN } + { \__peek_ignore_spaces_execute_branches: } + \__peek_def:nnnn { peek_charcode:N } { } - { peek_token_generic:NN } - { \peek_execute_branches_charcode: } - \peek_def:nnnn { peek_charcode_ignore_spaces:N } - { \peek_execute_branches_charcode: } - { peek_token_generic:NN } - { \peek_ignore_spaces_execute_branches: } - \peek_def:nnnn { peek_charcode_remove:N } + { __peek_token_generic:NN } + { \__peek_execute_branches_charcode: } + \__peek_def:nnnn { peek_charcode_ignore_spaces:N } + { \__peek_execute_branches_charcode: } + { __peek_token_generic:NN } + { \__peek_ignore_spaces_execute_branches: } + \__peek_def:nnnn { peek_charcode_remove:N } { } - { peek_token_remove_generic:NN } - { \peek_execute_branches_charcode: } - \peek_def:nnnn { peek_charcode_remove_ignore_spaces:N } - { \peek_execute_branches_charcode: } - { peek_token_remove_generic:NN } - { \peek_ignore_spaces_execute_branches: } - \peek_def:nnnn { peek_meaning:N } + { __peek_token_remove_generic:NN } + { \__peek_execute_branches_charcode: } + \__peek_def:nnnn { peek_charcode_remove_ignore_spaces:N } + { \__peek_execute_branches_charcode: } + { __peek_token_remove_generic:NN } + { \__peek_ignore_spaces_execute_branches: } + \__peek_def:nnnn { peek_meaning:N } { } - { peek_token_generic:NN } - { \peek_execute_branches_meaning: } - \peek_def:nnnn { peek_meaning_ignore_spaces:N } - { \peek_execute_branches_meaning: } - { peek_token_generic:NN } - { \peek_ignore_spaces_execute_branches: } - \peek_def:nnnn { peek_meaning_remove:N } + { __peek_token_generic:NN } + { \__peek_execute_branches_meaning: } + \__peek_def:nnnn { peek_meaning_ignore_spaces:N } + { \__peek_execute_branches_meaning: } + { __peek_token_generic:NN } + { \__peek_ignore_spaces_execute_branches: } + \__peek_def:nnnn { peek_meaning_remove:N } { } - { peek_token_remove_generic:NN } - { \peek_execute_branches_meaning: } - \peek_def:nnnn { peek_meaning_remove_ignore_spaces:N } - { \peek_execute_branches_meaning: } - { peek_token_remove_generic:NN } - { \peek_ignore_spaces_execute_branches: } + { __peek_token_remove_generic:NN } + { \__peek_execute_branches_meaning: } + \__peek_def:nnnn { peek_meaning_remove_ignore_spaces:N } + { \__peek_execute_branches_meaning: } + { __peek_token_remove_generic:NN } + { \__peek_ignore_spaces_execute_branches: } \group_end: \exp_args:Nno \use:nn - { \cs_new:Npn \token_get_prefix_arg_replacement_aux:wN #1 } + { \cs_new:Npn \__peek_get_prefix_arg_replacement:wN #1 } { \tl_to_str:n { macro : } #2 -> #3 \q_stop #4 } { #4 {#1} {#2} {#3} } \cs_new:Npn \token_get_prefix_spec:N #1 { \token_if_macro:NTF #1 { - \exp_after:wN \token_get_prefix_arg_replacement_aux:wN + \exp_after:wN \__peek_get_prefix_arg_replacement:wN \token_to_meaning:N #1 \q_stop \use_i:nnn } { \scan_stop: } @@ -704,7 +707,7 @@ { \token_if_macro:NTF #1 { - \exp_after:wN \token_get_prefix_arg_replacement_aux:wN + \exp_after:wN \__peek_get_prefix_arg_replacement:wN \token_to_meaning:N #1 \q_stop \use_ii:nnn } { \scan_stop: } @@ -713,47 +716,11 @@ { \token_if_macro:NTF #1 { - \exp_after:wN \token_get_prefix_arg_replacement_aux:wN + \exp_after:wN \__peek_get_prefix_arg_replacement:wN \token_to_meaning:N #1 \q_stop \use_iii:nnn } { \scan_stop: } } -\group_begin: - \char_set_catcode_active:N \^^@ - \cs_set:Npn \char_tmp:NN #1#2 - { - \cs_new:Npn #1 ##1 - { - \char_set_catcode_active:n { `##1 } - \group_begin: - \char_set_lccode:nn { `\^^@ } { `##1 } - \tl_to_lowercase:n { \group_end: #2 ^^@ } - } - } - \char_tmp:NN \char_set_active:Npn \cs_set:Npn - \char_tmp:NN \char_set_active:Npx \cs_set:Npx - \char_tmp:NN \char_gset_active:Npn \cs_gset:Npn - \char_tmp:NN \char_gset_active:Npx \cs_gset:Npx - \char_tmp:NN \char_set_active_eq:NN \cs_set_eq:NN - \char_tmp:NN \char_gset_active_eq:NN \cs_gset_eq:NN -\group_end: -\cs_new_protected_nopar:Npn \peek_execute_branches_N_type: - { - \bool_if:nTF - { - \token_if_eq_catcode_p:NN \l_peek_token \c_group_begin_token || - \token_if_eq_catcode_p:NN \l_peek_token \c_group_end_token || - \token_if_eq_meaning_p:NN \l_peek_token \c_space_token - } - { \peek_false:w } - { \peek_true:w } - } -\cs_new_protected_nopar:Npn \peek_N_type:TF - { \peek_token_generic:NNTF \peek_execute_branches_N_type: \scan_stop: } -\cs_new_protected_nopar:Npn \peek_N_type:T - { \peek_token_generic:NNT \peek_execute_branches_N_type: \scan_stop: } -\cs_new_protected_nopar:Npn \peek_N_type:F - { \peek_token_generic:NNF \peek_execute_branches_N_type: \scan_stop: } %% %% %% End of file `l3token.sty'. |