summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3int.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3int.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3int.dtx65
1 files changed, 50 insertions, 15 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx
index 26155d7526d..96ee0d939f1 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/19}
+% \date{Released 2017/09/18}
%
% \maketitle
%
@@ -1010,7 +1010,8 @@
% or directly in the input stream.
% When debugging, use parentheses to catch early termination.
% \begin{macrocode}
-\__debug_patch_args:nNNpn { { (#1) } }
+\__debug_patch_args:nNNpn
+ { { \__debug_chk_expr:nNnN {#1} \@@_eval:w { } \int_eval:n } }
\cs_new:Npn \int_eval:n #1
{ \@@_value:w \@@_eval:w #1 \@@_eval_end: }
% \end{macrocode}
@@ -1028,7 +1029,8 @@
% 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) } }
+\__debug_patch_args:nNNpn
+ { { \__debug_chk_expr:nNnN {#1} \@@_eval:w { } \int_abs:n } }
\cs_new:Npn \int_abs:n #1
{
\@@_value:w \exp_after:wN \@@_abs:N
@@ -1037,7 +1039,11 @@
}
\cs_new:Npn \@@_abs:N #1
{ \if_meaning:w - #1 \else: \exp_after:wN #1 \fi: }
-\__debug_patch_args:nNNpn { { (#1) } { (#2) } }
+\__debug_patch_args:nNNpn
+ {
+ { \__debug_chk_expr:nNnN {#1} \@@_eval:w { } \int_max:nn }
+ { \__debug_chk_expr:nNnN {#2} \@@_eval:w { } \int_max:nn }
+ }
\cs_set:Npn \int_max:nn #1#2
{
\@@_value:w \exp_after:wN \@@_maxmin:wwN
@@ -1046,7 +1052,11 @@
>
\exp_stop_f:
}
-\__debug_patch_args:nNNpn { { (#1) } { (#2) } }
+\__debug_patch_args:nNNpn
+ {
+ { \__debug_chk_expr:nNnN {#1} \@@_eval:w { } \int_min:nn }
+ { \__debug_chk_expr:nNnN {#2} \@@_eval:w { } \int_min:nn }
+ }
\cs_set:Npn \int_min:nn #1#2
{
\@@_value:w \exp_after:wN \@@_maxmin:wwN
@@ -1091,7 +1101,11 @@
% 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) } }
+\__debug_patch_args:nNNpn
+ {
+ { \__debug_chk_expr:nNnN {#1} \@@_eval:w { } \int_div_truncate:nn }
+ { \__debug_chk_expr:nNnN {#2} \@@_eval:w { } \int_div_truncate:nn }
+ }
\cs_new:Npn \int_div_truncate:nn #1#2
{
\@@_value:w \@@_eval:w
@@ -1121,7 +1135,11 @@
% \end{macrocode}
% Finally there's the modulus operation.
% \begin{macrocode}
-\__debug_patch_args:nNNpn { { (#1) } { (#2) } }
+\__debug_patch_args:nNNpn
+ {
+ { \__debug_chk_expr:nNnN {#1} \@@_eval:w { } \int_mod:nn }
+ { \__debug_chk_expr:nNnN {#2} \@@_eval:w { } \int_mod:nn }
+ }
\cs_new:Npn \int_mod:nn #1#2
{
\@@_value:w \@@_eval:w \exp_after:wN \@@_mod:ww
@@ -1168,6 +1186,8 @@
% set up code to determine what can be done. No full engine testing just yet
% so everything is a little awkward.
% \begin{macrocode}
+\__debug_patch_args:nNNpn
+ { {#1} { \__debug_chk_expr:nNnN {#2} \@@_eval:w { } \int_const:Nn } }
\cs_new_protected:Npn \int_const:Nn #1#2
{
\int_compare:nNnTF {#2} < \c_zero
@@ -1184,7 +1204,7 @@
{
\__chk_if_free_cs:N #1
\tex_global:D \@@_constdef:Nw #1 =
- \@@_eval:w (#2) \@@_eval_end:
+ \@@_eval:w #2 \@@_eval_end:
}
}
}
@@ -1274,10 +1294,12 @@
% \UnitTested
% Adding and subtracting to and from a counter \ldots
% \begin{macrocode}
-\__debug_patch_args:nNNpn { {#1} { (#2) } }
+\__debug_patch_args:nNNpn
+ { {#1} { \__debug_chk_expr:nNnN {#2} \@@_eval:w { } \int_add:Nn } }
\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) } }
+\__debug_patch_args:nNNpn
+ { {#1} { \__debug_chk_expr:nNnN {#2} \@@_eval:w { } \int_sub:Nn } }
\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
@@ -1331,7 +1353,8 @@
% 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) } }
+\__debug_patch_args:nNNpn
+ { {#1} { \__debug_chk_expr:nNnN {#2} \@@_eval:w { } \int_set:Nn } }
\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 }
@@ -1536,7 +1559,12 @@
% \UnitTested
% More efficient but less natural in typing.
% \begin{macrocode}
-\__debug_patch_conditional_args:nNNpnn { { (#1) \@@_eval_end: } {#2} { (#3) } }
+\__debug_patch_conditional_args:nNNpnn
+ {
+ { \__debug_chk_expr:nNnN {#1} \@@_eval:w { } \int_compare:nNn }
+ { \@@_eval_end: #2 }
+ { \__debug_chk_expr:nNnN {#3} \@@_eval:w { } \int_compare:nNn }
+ }
\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:
@@ -1595,7 +1623,8 @@
% \UnitTested
% A predicate function.
% \begin{macrocode}
-\__debug_patch_conditional_args:nNNpnn { { (#1) } }
+\__debug_patch_conditional_args:nNNpnn
+ { { \__debug_chk_expr:nNnN {#1} \@@_eval:w { } \int_if_odd:n } }
\prg_new_conditional:Npnn \int_if_odd:n #1 { p , T , F , TF}
{
\if_int_odd:w \@@_eval:w #1 \@@_eval_end:
@@ -1604,7 +1633,8 @@
\prg_return_false:
\fi:
}
-\__debug_patch_conditional_args:nNNpnn { { (#1) } }
+\__debug_patch_conditional_args:nNNpnn
+ { { \__debug_chk_expr:nNnN {#1} \@@_eval:w { } \int_if_even:n } }
\prg_new_conditional:Npnn \int_if_even:n #1 { p , T , F , TF}
{
\if_int_odd:w \@@_eval:w #1 \@@_eval_end:
@@ -1720,7 +1750,12 @@
% 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) } }
+\__debug_patch_args:nNNpn
+ {
+ { \__debug_chk_expr:nNnN {#1} \@@_eval:w { } \int_step_function:nnnN }
+ { \__debug_chk_expr:nNnN {#2} \@@_eval:w { } \int_step_function:nnnN }
+ { \__debug_chk_expr:nNnN {#3} \@@_eval:w { } \int_step_function:nnnN }
+ }
\cs_new:Npn \int_step_function:nnnN #1#2#3
{
\exp_after:wN \@@_step:wwwN