summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/xint/xintexpr.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-07-27 21:26:25 +0000
committerKarl Berry <karl@freefriends.org>2017-07-27 21:26:25 +0000
commitfe6cc7d43e9608cb5bb2533480000837d7cf4827 (patch)
tree3098f2a8b1933b247a3aa7f6b58bb4e7dcca58f0 /Master/texmf-dist/tex/generic/xint/xintexpr.sty
parent654d2d2ad9ef4fc4de9cfd3b3d6038ef14ad4161 (diff)
xint (27jul17)
git-svn-id: svn://tug.org/texlive/trunk@44900 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/xint/xintexpr.sty')
-rw-r--r--Master/texmf-dist/tex/generic/xint/xintexpr.sty57
1 files changed, 37 insertions, 20 deletions
diff --git a/Master/texmf-dist/tex/generic/xint/xintexpr.sty b/Master/texmf-dist/tex/generic/xint/xintexpr.sty
index 91354f0a86e..8b8abe637c1 100644
--- a/Master/texmf-dist/tex/generic/xint/xintexpr.sty
+++ b/Master/texmf-dist/tex/generic/xint/xintexpr.sty
@@ -21,7 +21,7 @@
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%% ---------------------------------------------------------------
-%% The xint bundle 1.2k 2017/01/06
+%% The xint bundle 1.2l 2017/07/26
%% Copyright (C) 2013-2017 by Jean-Francois Burnol
%% xintexpr: Expandable expression parser
%% ---------------------------------------------------------------
@@ -81,13 +81,16 @@
\XINTsetupcatcodes%
\XINT_providespackage
\ProvidesPackage{xintexpr}%
- [2017/01/06 1.2k Expandable expression parser (JFB)]%
+ [2017/07/26 1.2l Expandable expression parser (JFB)]%
\catcode`! 11
-\def\xint_gob_til_! #1!{}% catcode 11 ! default in xintexpr.sty code.
-\edef\XINT_expr_lockscan#1!% not used for decimal numbers in xintexpr 1.2
- {\noexpand\expandafter\space\noexpand\csname .=#1\endcsname }%
-\edef\XINT_expr_lockit
- #1{\noexpand\expandafter\space\noexpand\csname .=#1\endcsname }%
+\let\XINT_Cmp \xintiiCmp
+\def\xint_gob_til_! #1!{}% ! with catcode 11
+\def\XINT_expr_lockscan#1{% not used for decimal numbers in xintexpr 1.2
+\def\XINT_expr_lockscan##1!{\expandafter#1\csname .=##1\endcsname}%
+}\XINT_expr_lockscan{ }%
+\def\XINT_expr_lockit#1{%
+\def\XINT_expr_lockit##1{\expandafter#1\csname .=##1\endcsname}%
+}\XINT_expr_lockit{ }%
\def\XINT_expr_unlock_hex_in #1% expanded inside \csname..\endcsname
{\expandafter\XINT_expr_inhex\romannumeral`&&@\XINT_expr_unlock#1;}%
\def\XINT_expr_inhex #1.#2#3;% expanded inside \csname..\endcsname
@@ -252,7 +255,7 @@
\if ^#1\xint_dothis\XINT_:::_end\fi
\xint_orthat\XINT_pfloat::_d #1}%
\def\XINT_pfloat::_d #1,#2%
- {\expandafter\XINT_pfloat::_e\romannumeral0\XINT_pfloat_opt [\xint_relax #2]{#1},{#2}}%
+ {\expandafter\XINT_pfloat::_e\romannumeral0\XINT_pfloat_opt [\xint:#2]{#1},{#2}}%
\def\XINT_pfloat::_e #1,#2#3{\XINT_pfloat::_b {#2}{#3, #1}}%
\def\XINT_expr_getnext #1%
{%
@@ -332,6 +335,7 @@
\def\XINT_expr_scanint_endbycs#1#2\XINT_expr_scanint_d{\endcsname #1}%
\def\XINT_expr_scanint_c\string #1\XINT_expr_scanint_d
{%
+ \if _#1\xint_dothis\XINT_expr_scanint_d\fi
\if e#1\xint_dothis{[\the\numexpr0\XINT_expr_scanexp_a +}\fi
\if E#1\xint_dothis{[\the\numexpr0\XINT_expr_scanexp_a +}\fi
\if .#1\xint_dothis{\XINT_expr_startdec_a .}\fi
@@ -355,6 +359,7 @@
\def\XINT_expr_gobz_scanint_endbycs#1#2\XINT_expr_scanint_d{0\endcsname #1}%
\def\XINT_expr_gobz_scanint_c\string #1\XINT_expr_scanint_d
{%
+ \if _#1\xint_dothis\XINT_expr_gobz_scanint_d\fi
\if e#1\xint_dothis{0[\the\numexpr0\XINT_expr_scanexp_a +}\fi
\if E#1\xint_dothis{0[\the\numexpr0\XINT_expr_scanexp_a +}\fi
\if .#1\xint_dothis{\XINT_expr_gobz_startdec_a .}\fi
@@ -389,6 +394,7 @@
}%
\def\XINT_expr_scandec_c\string #1#2\the\numexpr#3-\xint_c_i.%
{%
+ \if _#1\xint_dothis{\XINT_expr_scandec_d#3.}\fi
\if e#1\xint_dothis{[\the\numexpr#3\XINT_expr_scanexp_a +}\fi
\if E#1\xint_dothis{[\the\numexpr#3\XINT_expr_scanexp_a +}\fi
\xint_orthat {[#3]\endcsname #1}%
@@ -402,8 +408,9 @@
{\string#2\expandafter\XINT_expr_scandec_d}\the\numexpr#1-\xint_c_i.%
}%
\def\XINT_expr_gobz_scandec_endbycs #1#2\xint_c_i.{0[0]\endcsname #1}%
-\def\XINT_expr_gobz_scandec_c\if0#1#2\fi #3\xint_c_i.%
+\def\XINT_expr_gobz_scandec_c\if0#1#2\fi #3\numexpr#4-\xint_c_i.%
{%
+ \if _#1\xint_dothis{\XINT_expr_gobz_scandec_b #4.}\fi
\if e#1\xint_dothis{0[\the\numexpr0\XINT_expr_scanexp_a +}\fi
\if E#1\xint_dothis{0[\the\numexpr0\XINT_expr_scanexp_a +}\fi
\xint_orthat {0[0]\endcsname #1}%
@@ -425,6 +432,7 @@
}%
\def\XINT_expr_scanexp_c\string #1\XINT_expr_scanexp_d
{%
+ \if _#1\xint_dothis \XINT_expr_scanexp_d \fi
\if +#1\xint_dothis {\XINT_expr_scanexp_a +}\fi
\if -#1\xint_dothis {\XINT_expr_scanexp_a -}\fi
\xint_orthat {]\endcsname #1}%
@@ -440,7 +448,11 @@
{%
\expandafter\XINT_expr_scanexp_bb\romannumeral`&&@#1%
}%
-\def\XINT_expr_scanexp_cb\string #1\XINT_expr_scanexp_db {]\endcsname #1}%
+\def\XINT_expr_scanexp_cb\string #1\XINT_expr_scanexp_db
+{%
+ \if _#1\xint_dothis\XINT_expr_scanexp_d\fi
+ \xint_orthat{]\endcsname #1}%
+}%
\def\XINT_expr_scanhex_I #1% #1="
{%
\expandafter\XINT_expr_getop\csname.=\expandafter
@@ -461,12 +473,9 @@
0\else1\fi\else0\fi\else1\fi\else0\fi 1%
\expandafter\XINT_expr_scanhexI_b
\else
- \if .#1%
- \expandafter\xint_firstoftwo
- \else % gather what we got so far, leave catcode 12 #1 in stream
- \expandafter\xint_secondoftwo
- \fi
- {\expandafter\XINT_expr_scanhex_transition}%
+ \if _#1\xint_dothis{\expandafter\XINT_expr_scanhexI_bgob}\fi
+ \if .#1\xint_dothis{\expandafter\XINT_expr_scanhex_transition}\fi
+ \xint_orthat % gather what we got so far, leave catcode 12 #1 in stream
{\xint_afterfi {.>\endcsname\endcsname}}%
\fi
#1%
@@ -475,6 +484,10 @@
{%
#1\expandafter\XINT_expr_scanhexI_a\romannumeral`&&@#2%
}%
+\def\XINT_expr_scanhexI_bgob #1#2%
+{%
+ \expandafter\XINT_expr_scanhexI_a\romannumeral`&&@#2%
+}%
\def\XINT_expr_scanhex_transition .#1%
{%
\expandafter.\expandafter.\expandafter
@@ -495,7 +508,8 @@
0\else1\fi\else0\fi\else1\fi\else0\fi 1%
\expandafter\XINT_expr_scanhexII_b
\else
- \xint_afterfi {\endcsname\endcsname}%
+ \if _#1\xint_dothis{\expandafter\XINT_expr_scanhexII_bgob}\fi
+ \xint_orthat{\xint_afterfi {\endcsname\endcsname}}%
\fi
#1%
}%
@@ -503,6 +517,10 @@
{%
#1\expandafter\XINT_expr_scanhexII_a\romannumeral`&&@#2%
}%
+\def\XINT_expr_scanhexII_bgob #1#2%
+{%
+ \expandafter\XINT_expr_scanhexII_a\romannumeral`&&@#2%
+}%
\def\XINT_expr_scanfunc
{%
\expandafter\XINT_expr_func\romannumeral`&&@\XINT_expr_scanfunc_a
@@ -975,8 +993,7 @@
\let\XINT_flexpr_op_:] \XINT_expr_op_:]
\let\XINT_iiexpr_op_:] \XINT_expr_op_:]
\let\XINT_expr_precedence_][: \xint_c_iii
-\edef\XINT_expr_op_][: #1{\xint_c_ii \expandafter\noexpand
- \csname XINT_expr_itself_][\endcsname #10\string :}%
+\edef\XINT_expr_op_][: #1{\xint_c_ii\noexpand\XINT_expr_itself_][#10\string :}%
\let\XINT_flexpr_op_][: \XINT_expr_op_][:
\let\XINT_iiexpr_op_][: \XINT_expr_op_][:
\catcode`[ 12 \catcode`] 12
@@ -2652,7 +2669,7 @@
\toks0 \expandafter{\the\toks0
\def\xintListSel:x:csv {~xintListSel:f:csv }%
}%
-\odef\XINT_expr_redefinemacros {\the\toks0}% Not \edef ! (subtle)
+\odef\XINT_expr_redefinemacros {\the\toks0}%
\def\XINT_expr_redefineprints
{%
\def\XINT_flexpr_noopt