diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3int.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3int.dtx | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx index fba1893a993..26155d7526d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2017/07/15} +% \date{Released 2017/07/19} % % \maketitle % @@ -1008,7 +1008,9 @@ % \begin{macro}{\int_eval:n} % Wrapper for \cs{@@_eval:w}: can be used in an integer expression % or directly in the input stream. +% When debugging, use parentheses to catch early termination. % \begin{macrocode} +\__debug_patch_args:nNNpn { { (#1) } } \cs_new:Npn \int_eval:n #1 { \@@_value:w \@@_eval:w #1 \@@_eval_end: } % \end{macrocode} @@ -1026,6 +1028,7 @@ % evaluation. The absolute value is obtained by removing a leading % sign if any. All three functions expand in two steps. % \begin{macrocode} +\__debug_patch_args:nNNpn { { (#1) } } \cs_new:Npn \int_abs:n #1 { \@@_value:w \exp_after:wN \@@_abs:N @@ -1034,6 +1037,7 @@ } \cs_new:Npn \@@_abs:N #1 { \if_meaning:w - #1 \else: \exp_after:wN #1 \fi: } +\__debug_patch_args:nNNpn { { (#1) } { (#2) } } \cs_set:Npn \int_max:nn #1#2 { \@@_value:w \exp_after:wN \@@_maxmin:wwN @@ -1042,6 +1046,7 @@ > \exp_stop_f: } +\__debug_patch_args:nNNpn { { (#1) } { (#2) } } \cs_set:Npn \int_min:nn #1#2 { \@@_value:w \exp_after:wN \@@_maxmin:wwN @@ -1086,6 +1091,7 @@ % truncating behaviour that we want. The details are thanks to Heiko % Oberdiek: getting things right in all cases is not so easy. % \begin{macrocode} +\__debug_patch_args:nNNpn { { (#1) } { (#2) } } \cs_new:Npn \int_div_truncate:nn #1#2 { \@@_value:w \@@_eval:w @@ -1115,6 +1121,7 @@ % \end{macrocode} % Finally there's the modulus operation. % \begin{macrocode} +\__debug_patch_args:nNNpn { { (#1) } { (#2) } } \cs_new:Npn \int_mod:nn #1#2 { \@@_value:w \@@_eval:w \exp_after:wN \@@_mod:ww @@ -1177,7 +1184,7 @@ { \__chk_if_free_cs:N #1 \tex_global:D \@@_constdef:Nw #1 = - \@@_eval:w #2 \@@_eval_end: + \@@_eval:w (#2) \@@_eval_end: } } } @@ -1267,8 +1274,10 @@ % \UnitTested % Adding and subtracting to and from a counter \ldots % \begin{macrocode} +\__debug_patch_args:nNNpn { {#1} { (#2) } } \cs_new_protected:Npn \int_add:Nn #1#2 { \tex_advance:D #1 by \@@_eval:w #2 \@@_eval_end: } +\__debug_patch_args:nNNpn { {#1} { (#2) } } \cs_new_protected:Npn \int_sub:Nn #1#2 { \tex_advance:D #1 by - \@@_eval:w #2 \@@_eval_end: } \cs_new_protected:Npn \int_gadd:Nn @@ -1322,6 +1331,7 @@ % if they are not defined. Thus there is no need for the checking % code seen with token list variables. % \begin{macrocode} +\__debug_patch_args:nNNpn { {#1} { (#2) } } \cs_new_protected:Npn \int_set:Nn #1#2 { #1 ~ \@@_eval:w #2 \@@_eval_end: } \cs_new_protected:Npn \int_gset:Nn { \tex_global:D \int_set:Nn } @@ -1526,6 +1536,7 @@ % \UnitTested % More efficient but less natural in typing. % \begin{macrocode} +\__debug_patch_conditional_args:nNNpnn { { (#1) \@@_eval_end: } {#2} { (#3) } } \prg_new_conditional:Npnn \int_compare:nNn #1#2#3 { p , T , F , TF } { \if_int_compare:w \@@_eval:w #1 #2 \@@_eval:w #3 \@@_eval_end: @@ -1584,6 +1595,7 @@ % \UnitTested % A predicate function. % \begin{macrocode} +\__debug_patch_conditional_args:nNNpnn { { (#1) } } \prg_new_conditional:Npnn \int_if_odd:n #1 { p , T , F , TF} { \if_int_odd:w \@@_eval:w #1 \@@_eval_end: @@ -1592,6 +1604,7 @@ \prg_return_false: \fi: } +\__debug_patch_conditional_args:nNNpnn { { (#1) } } \prg_new_conditional:Npnn \int_if_even:n #1 { p , T , F , TF} { \if_int_odd:w \@@_eval:w #1 \@@_eval_end: @@ -1707,6 +1720,7 @@ % step size of zero before checking the sign, but we optimize for the % most frequent case (positive step). % \begin{macrocode} +\__debug_patch_args:nNNpn { { (#1) } { (#2) } { (#3) } } \cs_new:Npn \int_step_function:nnnN #1#2#3 { \exp_after:wN \@@_step:wwwN @@ -2466,13 +2480,24 @@ % \begin{variable}[deprecated = 2018-12-31]{\c_minus_one} % The actual allocation mechanism is in \pkg{l3alloc}; it requires % \cs{c_one} to be defined. In package mode, reuse \tn{m@ne}. +% We also store in two global token lists some code for +% \cs{debug_deprecation_on:} and \cs{debug_deprecation_off:}. For the +% latter, we need to locally set \cs{c_minus_one} back to the constant +% hence use a private name. We use \cs{tex_let:D} directly because +% \cs{c_minus_one} (as all deprecated commands) is made outer by +% \cs{debug_deprecation_on:}. % \begin{macrocode} -%<*package> -\cs_new_eq:NN \c_minus_one \m@ne -%</package> -%<*initex> -\int_const:Nn \c_minus_one { -1 } -%</initex> +%<package>\cs_gset_eq:NN \c__deprecation_minus_one \m@ne +%<initex>\int_const:Nn \c__deprecation_minus_one { -1 } +\cs_new_eq:NN \c_minus_one \c__deprecation_minus_one +\__debug:TF + { + \tl_gput_right:Nn \g__debug_deprecation_on_tl + { \__deprecation_error:Nnn \c_minus_one { -1 } { 2018-12-31 } } + \tl_gput_right:Nn \g__debug_deprecation_off_tl + { \tex_let:D \c_minus_one \c__deprecation_minus_one } + } + { } % \end{macrocode} % \end{variable} % |