diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/xint/xintexpr.sty')
-rw-r--r-- | Master/texmf-dist/tex/generic/xint/xintexpr.sty | 69 |
1 files changed, 55 insertions, 14 deletions
diff --git a/Master/texmf-dist/tex/generic/xint/xintexpr.sty b/Master/texmf-dist/tex/generic/xint/xintexpr.sty index 68fa92e62d3..05a7bad4a86 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.3a 2018/03/07 +%% The xint bundle 1.3b 2018/05/18 %% Copyright (C) 2013-2018 by Jean-Francois Burnol %% xintexpr: Expandable expression parser %% --------------------------------------------------------------- @@ -81,7 +81,7 @@ \XINTsetupcatcodes% \XINT_providespackage \ProvidesPackage{xintexpr}% - [2018/03/07 1.3a Expandable expression parser (JFB)]% + [2018/05/18 1.3b Expandable expression parser (JFB)]% \catcode`! 11 \let\XINT_Cmp \xintiiCmp \def\xint_gob_til_! #1!{}% ! with catcode 11 @@ -305,12 +305,14 @@ \def\XINT_expr_scan_macropar #1#2{\expandafter\XINT_expr_getop\csname .=#1#2\endcsname }% \catcode96 11 % ` \def\XINT_expr_scan_nbr_or_func #1% this #1 has necessarily here catcode 12 -{% +{%( + \if )#1\xint_dothis \XINT_expr_gotnil \fi \if "#1\xint_dothis \XINT_expr_scanhex_I\fi \if `#1\xint_dothis {\XINT_expr_onliteral_`}\fi \ifnum \xint_c_ix<1#1 \xint_dothis \XINT_expr_startint\fi \xint_orthat \XINT_expr_scanfunc #1% }% +\def\XINT_expr_gotnil{\expandafter\XINT_expr_getop\csname.= \endcsname}% \def\XINT_expr_onliteral_` #1#2#3({\xint_c_xviii `{#2}}% \catcode96 12 % ` \def\XINT_expr_startint #1% @@ -1435,6 +1437,10 @@ {\expandafter\XINT_expr_getop\csname .=\xintRaw{#1}\endcsname }% \def\XINT_expr_onliteral_qfloat #1)% {\expandafter\XINT_expr_getop\csname .=\XINTinFloatdigits{#1}\endcsname }% +\def\XINT_expr_onliteral_random #1)% + {\expandafter\XINT_expr_getop\csname .=\XINTinRandomFloatSdigits\endcsname }% +\def\XINT_expr_onliteral_qrand #1)% + {\expandafter\XINT_expr_getop\csname .=\XINTinRandomFloatSixteen\endcsname }% \def\XINT_expr_op__ #1% op__ with two _'s {% \ifcsname XINT_expr_var_#1\endcsname @@ -2054,13 +2060,13 @@ \expandafter\xint_secondoftwo\fi {#4}{#5[\xintNum{#2}]}{#1}% }% -\def\XINT:expr:one:or:two #1,#2,#3!#4#5% +\def\XINT:expr:tacitzeroifonearg #1,#2,#3!#4#5% {% \if\relax#3\relax\expandafter\xint_firstoftwo\else \expandafter\xint_secondoftwo\fi {#4{0}}{#5{\xintNum{#2}}}{#1}% }% -\def\XINT:iiexpr:one:or:two #1,#2,#3!#4% +\def\XINT:iiexpr:tacitzeroifonearg #1,#2,#3!#4% {% \if\relax#3\relax\expandafter\xint_firstoftwo\else \expandafter\xint_secondoftwo\fi @@ -2257,7 +2263,7 @@ \def\XINT_expr_func_round #1#2#3% {% \expandafter #1\expandafter #2\csname.=% - \expandafter\XINT:expr:one:or:two + \expandafter\XINT:expr:tacitzeroifonearg \romannumeral`&&@\XINT_expr_unlock #3,,!\xintiRound\xintRound \endcsname }% @@ -2265,14 +2271,14 @@ \def\XINT_iiexpr_func_round #1#2#3% {% \expandafter #1\expandafter #2\csname.=% - \expandafter\XINT:iiexpr:one:or:two + \expandafter\XINT:iiexpr:tacitzeroifonearg \romannumeral`&&@\XINT_expr_unlock #3,,!\xintiRound \endcsname }% \def\XINT_expr_func_trunc #1#2#3% {% \expandafter #1\expandafter #2\csname.=% - \expandafter\XINT:expr:one:or:two + \expandafter\XINT:expr:tacitzeroifonearg \romannumeral`&&@\XINT_expr_unlock #3,,!\xintiTrunc\xintTrunc \endcsname }% @@ -2280,7 +2286,7 @@ \def\XINT_iiexpr_func_trunc #1#2#3% {% \expandafter #1\expandafter #2\csname.=% - \expandafter\XINT:iiexpr:one:or:two + \expandafter\XINT:iiexpr:tacitzeroifonearg \romannumeral`&&@\XINT_expr_unlock #3,,!\xintiTrunc \endcsname }% @@ -2376,6 +2382,35 @@ \romannumeral`&&@\XINT_expr_unlock #3,!\xintiiPFactorial \endcsname }% +\def\XINT_expr_func_randrange #1#2#3% +{% + \expandafter #1\expandafter #2\csname.=% + \expandafter\XINT:expr:randrange + \romannumeral`&&@\XINT_expr_unlock #3,,!% + \endcsname +}% +\let\XINT_flexpr_func_randrange\XINT_expr_func_randrange +\def\XINT_iiexpr_func_randrange #1#2#3% +{% + \expandafter #1\expandafter #2\csname.=% + \expandafter\XINT:iiexpr:randrange + \romannumeral`&&@\XINT_expr_unlock #3,,!% + \endcsname +}% +\def\XINT:expr:randrange #1,#2,#3!% +{% + \if\relax#3\relax\expandafter\xint_firstoftwo\else + \expandafter\xint_secondoftwo\fi + {\xintiiRandRange{\XINT:NEhook:one\xintNum{#1}}}% + {\xintiiRandRangeAtoB{\XINT:NEhook:one\xintNum{#1}}% + {\XINT:NEhook:one\xintNum{#2}}}% +}% +\def\XINT:iiexpr:randrange #1,#2,#3!% +{% + \if\relax#3\relax\expandafter\xint_firstoftwo\else + \expandafter\xint_secondoftwo\fi + {\xintiiRandRange{#1}}{\xintiiRandRangeAtoB{#1}{#2}}% +}% \def\XINT_expr_func_quo #1#2#3% {% \expandafter #1\expandafter #2\csname.=% @@ -2859,13 +2894,13 @@ \expandafter\xint_secondoftwo\fi {\XINT:NE:one#4}{\XINT:NE:oneopt#5[\XINT:NE:one\xintNum{#2}]}{#1}% }% -\def\XINT:newexpr:one:or:two #1,#2,#3!#4#5% +\def\XINT:newexpr:tacitzeroifonearg #1,#2,#3!#4#5% {% \if\relax#3\relax\expandafter\xint_firstoftwo\else \expandafter\xint_secondoftwo\fi {\XINT:NE:two#4{0}}{\XINT:NE:two#5{\XINT:NE:one\xintNum{#2}}}{#1}% }% -\def\XINT:newiiexpr:one:or:two #1,#2,#3!#4% +\def\XINT:newiiexpr:tacitzeroifonearg #1,#2,#3!#4% {% \if\relax#3\relax\expandafter\xint_firstoftwo\else \expandafter\xint_secondoftwo\fi @@ -2943,9 +2978,11 @@ \let\XINT:NEhook:one\XINT:NE:one \let\XINT:NEhook:two\XINT:NE:two \let\XINT:NEhook:csv\XINT:NE:csv - \let\XINT:expr:one:and:opt \XINT:newexpr:one:and:opt - \let\XINT:expr:one:or:two \XINT:newexpr:one:or:two - \let\XINT:iiexpr:one:or:two \XINT:newiiexpr:one:or:two + \let\XINT:expr:one:and:opt \XINT:newexpr:one:and:opt + \let\XINT:expr:one:or:two:nums \XINT:newexpr:one:or:two:nums + \let\XINT:iiexpr:one:or:two: \XINT:newiiexpr:one:or:two: + \let\XINT:expr:tacitzeroifonearg \XINT:newexpr:tacitzeroifonearg + \let\XINT:iiexpr:tacitzeroifonearg \XINT:newiiexpr:tacitzeroifonearg \let\XINT:expr:two:to:two \XINT:newexpr:two:to:two \let\XINT:expr:two:to:one \XINT:newexpr:two:to:one \let\XINT:flexpr:two:to:one \XINT:newflexpr:two:to:one @@ -2979,6 +3016,10 @@ \def\xintListSel:x:csv {~xintListSel:f:csv }% \let\XINT:expr:userfunc \XINT:newexpr:userfunc \let\XINT:expr:macrofunc\XINT:newexpr:macrofunc + \def\XINTinRandomFloatSdigits{~XINTinRandomFloatSdigits }% + \def\XINTinRandomFloatSixteen{~XINTinRandomFloatSixteen }% + \def\xintiiRandRange{~xintiiRandRange }% + \def\xintiiRandRangeAtoB{~xintiiRandRangeAtoB }% }% \def\XINT_expr_redefineprints {% |