diff options
author | Karl Berry <karl@freefriends.org> | 2016-11-21 22:24:46 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-11-21 22:24:46 +0000 |
commit | f41f19063b4eeb01ac278d4d84341194ac4497c4 (patch) | |
tree | 859a01b4cb8ecd3def23f9be9a6e56f04e6c18e4 /Master/texmf-dist/tex/generic/xint/xintexpr.sty | |
parent | 4d1331362d70d28653f078bfc64f62e05933bf7b (diff) |
xint (21nov16)
git-svn-id: svn://tug.org/texlive/trunk@42550 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.sty | 76 |
1 files changed, 67 insertions, 9 deletions
diff --git a/Master/texmf-dist/tex/generic/xint/xintexpr.sty b/Master/texmf-dist/tex/generic/xint/xintexpr.sty index b2736c3398b..2e7812a152f 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.2g 2016/03/19 +%% The xint bundle 1.2h 2016/11/20 %% Copyright (C) 2013-2016 by Jean-Francois Burnol %% xintexpr: Expandable expression parser %% --------------------------------------------------------------- @@ -81,7 +81,7 @@ \XINTsetupcatcodes% \XINT_providespackage \ProvidesPackage{xintexpr}% - [2016/03/19 1.2g Expandable expression parser (JFB)]% + [2016/11/20 1.2h 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 @@ -120,6 +120,10 @@ \def\xinttheiiexpr {\romannumeral`&&@\expandafter\XINT_iiexpr_print\romannumeral0\xintbareiieval }% \def\xintthe #1{\romannumeral`&&@\expandafter\xint_gobble_iii\romannumeral`&&@#1}% +\let\thexintexpr \xinttheexpr +\let\thexintiexpr \xinttheiexpr +\let\thexintfloatexpr\xintthefloatexpr +\let\thexintiiexpr \xinttheiiexpr \def\xintthecoords #1{\romannumeral`&&@\expandafter\expandafter\expandafter \XINT_thecoords_a \expandafter\xint_gobble_iii\romannumeral0#1}% @@ -189,6 +193,7 @@ \XINT_boolexpr_done \expandafter\xint_gobble_iv\romannumeral0\xinteval }% \def\xinttheboolexpr {\romannumeral`&&@\expandafter\expandafter\expandafter \XINT_boolexpr_print\expandafter\xint_gobble_iv\romannumeral0\xinteval }% +\let\thexintboolexpr\xinttheboolexpr \def\XINT_boolexpr_done { !\XINT_expr_usethe\XINT_protectii\XINT_boolexpr_print }% \def\xintifboolexpr #1{\romannumeral0\xintifnotzero {\xinttheexpr #1\relax}}% \def\xintifboolfloatexpr #1{\romannumeral0\xintifnotzero {\xintthefloatexpr #1\relax}}% @@ -1209,18 +1214,22 @@ \xintApplyInline{\XINT_tmpa {flexpr}\xintOpp}{{vi}{vii}{viii}{ix}}% \xintApplyInline{\XINT_tmpa {iiexpr}\xintiiOpp}{{vi}{vii}{viii}{ix}}% \let\XINT_expr_precedence_? \xint_c_x -\def\XINT_expr_op_? #1#2{\if ?#2\expandafter \XINT_expr_op_??\fi - \XINT_expr_op_?a #1{#2}}% +\def\XINT_expr_op_? #1#2% + {\XINT_expr_op_?checka #2!\xint_bye\XINT_expr_op_?a #1{#2}}% +\def\XINT_expr_op_?checka #1{\expandafter\XINT_expr_op_?checkb\detokenize{#1}}% +\def\XINT_expr_op_?checkb #1{\if ?#1\expandafter\XINT_expr_op_?checkc + \else\expandafter\xint_bye\fi }% +\def\XINT_expr_op_?checkc #1{\xint_gob_til_! #1\XINT_expr_op_?? !\xint_bye}% \def\XINT_expr_op_?a #1#2#3% {% \xintiiifNotZero{\XINT_expr_unlock #1}{\XINT_expr_getnext #2}{\XINT_expr_getnext #3}% }% \let\XINT_flexpr_op_?\XINT_expr_op_? \let\XINT_iiexpr_op_?\XINT_expr_op_? -\def\XINT_expr_op_?? #1#2#3#4#5#6% +\def\XINT_expr_op_?? !\xint_bye\xint_bye\XINT_expr_op_?a #1#2#3#4#5% {% - \xintiiifSgn {\XINT_expr_unlock #2}{\XINT_expr_getnext #4}{\XINT_expr_getnext #5}% - {\XINT_expr_getnext #6}% + \xintiiifSgn {\XINT_expr_unlock #1}% + {\XINT_expr_getnext #3}{\XINT_expr_getnext #4}{\XINT_expr_getnext #5}% }% \let\XINT_expr_precedence_! \xint_c_x \def\XINT_expr_op_! #1{\expandafter\XINT_expr_getop @@ -1522,7 +1531,7 @@ \def\XINT_expr_op:_d #1!#2#3#4#5% {\expandafter\XINT_expr_op:_b\expandafter #4\expandafter {\romannumeral`&&@#4{\XINT_expr_unlock#1}{#5}}}% -\def\XINT_expr_op:_noop\csname.=,#1\endcsname #2#3#4{\XINT_expr_seq:_b #3{#4}{#2}#1,}% +\def\XINT_expr_op:_noop\csname.=,#1\endcsname #2#3#4{\XINT_expr_op:_b #3{#4}{#2}#1,}% \def\XINT_expr_op:_end \csname.=^\endcsname #1#2#3{#3}% \def\XINT_expr_onlitteral_subs {\expandafter\XINT_expr_onlitteral_subs_f\romannumeral`&&@\XINT_expr_onlitteral_seq_a {}}% @@ -2323,9 +2332,58 @@ \XINT_tmpa\xintdeffloatfunc{flexpr}\XINT_NewFloatFunc{floatexpr}% \def\XINT_expr_defuserfunc #1#2{% \def #1##1##2##3{\expandafter ##1\expandafter ##2% - \csname .=\expandafter #2\romannumeral-`0\XINT_expr_unlock ##3,\endcsname + \csname .=\expandafter #2\romannumeral`&&@\XINT_expr_unlock ##3,\endcsname }% }% +\def\XINT_expr_wrapit #1{\expandafter\XINT_expr_wrap\csname.=#1\endcsname}% +\def\xintNewFunction #1#2[#3]#4% +{% + \edef\XINT_expr_tmpa {#1}% + \edef\XINT_expr_tmpa {\xint_zapspaces_o \XINT_expr_tmpa}% + \def\XINT_expr_tmpb ##1##2##3##4##5##6##7##8##9{#4}% + \begingroup + \ifcase #3\relax + \toks0{,}% + \or \toks0{##1,}% + \or \toks0{##1,##2,}% + \or \toks0{##1,##2,##3,}% + \or \toks0{##1,##2,##3,##4,}% + \or \toks0{##1,##2,##3,##4,##5,}% + \or \toks0{##1,##2,##3,##4,##5,##6,}% + \or \toks0{##1,##2,##3,##4,##5,##6,##7,}% + \or \toks0{##1,##2,##3,##4,##5,##6,##7,##8,}% + \else \toks0{##1,##2,##3,##4,##5,##6,##7,##8,##9,}% + \fi + \expandafter + \endgroup + \expandafter + \def\csname XINT_expr_macrofunc_\XINT_expr_tmpa\expandafter\endcsname + \the\toks0\expandafter{\XINT_expr_tmpb + {\XINT_expr_wrapit{##1}}{\XINT_expr_wrapit{##2}}{\XINT_expr_wrapit{##3}}% + {\XINT_expr_wrapit{##4}}{\XINT_expr_wrapit{##5}}{\XINT_expr_wrapit{##6}}% + {\XINT_expr_wrapit{##7}}{\XINT_expr_wrapit{##8}}{\XINT_expr_wrapit{##9}}}% + \expandafter\XINT_expr_newfunction + \csname XINT_expr_func_\XINT_expr_tmpa\expandafter\endcsname + \csname XINT_expr_macrofunc_\XINT_expr_tmpa\endcsname\xintbareeval + \expandafter\XINT_expr_newfunction + \csname XINT_iiexpr_func_\XINT_expr_tmpa\expandafter\endcsname + \csname XINT_expr_macrofunc_\XINT_expr_tmpa\endcsname\xintbareiieval + \expandafter\XINT_expr_newfunction + \csname XINT_flexpr_func_\XINT_expr_tmpa\expandafter\endcsname + \csname XINT_expr_macrofunc_\XINT_expr_tmpa\endcsname\xintbarefloateval + \ifxintverbose + \xintMessage {xintexpr}{Info} + {Function \XINT_expr_tmpa\space for the expression parsers is + associated to \string\XINT_expr_macrofunc_\XINT_expr_tmpa\space + with meaning \expandafter\meaning + \csname XINT_expr_macrofunc_\XINT_expr_tmpa\endcsname}% + \fi +}% +\def\XINT_expr_newfunction #1#2#3% +{% + \def#1##1##2##3{\expandafter ##1\expandafter ##2\romannumeral`&&@% + #3\expandafter#2\romannumeral`&&@\XINT_expr_unlock##3,\relax}% +}% \def\xintApply::csv #1#2% {\expandafter\XINT_applyon::_a\expandafter {\romannumeral`&&@#2}{#1}}% \def\XINT_applyon::_a #1#2{\XINT_applyon::_b {#2}{}#1,,}% |