From 999f3351fc67fb9112cf91b9fe6fe469dee7b9b7 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 23 Jan 2014 23:05:24 +0000 Subject: xint (23jan14) git-svn-id: svn://tug.org/texlive/trunk@32768 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/generic/xint/xint.sty | 4 +- Master/texmf-dist/tex/generic/xint/xintbinhex.sty | 4 +- Master/texmf-dist/tex/generic/xint/xintcfrac.sty | 4 +- Master/texmf-dist/tex/generic/xint/xintexpr.sty | 139 ++++++++++++++++++---- Master/texmf-dist/tex/generic/xint/xintfrac.sty | 37 +++--- Master/texmf-dist/tex/generic/xint/xintgcd.sty | 4 +- Master/texmf-dist/tex/generic/xint/xintseries.sty | 4 +- Master/texmf-dist/tex/generic/xint/xinttools.sty | 6 +- 8 files changed, 149 insertions(+), 53 deletions(-) (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/generic/xint/xint.sty b/Master/texmf-dist/tex/generic/xint/xint.sty index 5064a290659..ebea163246a 100644 --- a/Master/texmf-dist/tex/generic/xint/xint.sty +++ b/Master/texmf-dist/tex/generic/xint/xint.sty @@ -21,7 +21,7 @@ %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %%---------------------------------------------------------------- -%% The xint bundle (version 1.09j of January 9, 2014) +%% The xint bundle (version 1.09k of January 21, 2014) %% xint: Expandable operations on long numbers %% Copyright (C) 2013-2014 by Jean-Francois Burnol %%---------------------------------------------------------------- @@ -101,7 +101,7 @@ \XINTsetupcatcodes% \XINT_providespackage \ProvidesPackage{xint}% - [2014/01/09 v1.09j Expandable operations on long numbers (jfB)]% + [2014/01/21 v1.09k Expandable operations on long numbers (jfB)]% \long\def\xint_firstofthree #1#2#3{#1}% \long\def\xint_secondofthree #1#2#3{#2}% \long\def\xint_thirdofthree #1#2#3{#3}% diff --git a/Master/texmf-dist/tex/generic/xint/xintbinhex.sty b/Master/texmf-dist/tex/generic/xint/xintbinhex.sty index eff3a8281d1..3d37f49d216 100644 --- a/Master/texmf-dist/tex/generic/xint/xintbinhex.sty +++ b/Master/texmf-dist/tex/generic/xint/xintbinhex.sty @@ -21,7 +21,7 @@ %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %%---------------------------------------------------------------- -%% The xint bundle (version 1.09j of January 9, 2014) +%% The xint bundle (version 1.09k of January 21, 2014) %% xintbinhex: Expandable binary and hexadecimal conversions %% Copyright (C) 2013-2014 by Jean-Francois Burnol %%---------------------------------------------------------------- @@ -101,7 +101,7 @@ \XINTsetupcatcodes% \XINT_providespackage \ProvidesPackage{xintbinhex}% - [2014/01/09 v1.09j Expandable binary and hexadecimal conversions (jfB)]% + [2014/01/21 v1.09k Expandable binary and hexadecimal conversions (jfB)]% \chardef\xint_c_xvi 16 \chardef\xint_c_ii^vii 128 \mathchardef\xint_c_ii^viii 256 diff --git a/Master/texmf-dist/tex/generic/xint/xintcfrac.sty b/Master/texmf-dist/tex/generic/xint/xintcfrac.sty index 9b05709ba26..ba63d917d1b 100644 --- a/Master/texmf-dist/tex/generic/xint/xintcfrac.sty +++ b/Master/texmf-dist/tex/generic/xint/xintcfrac.sty @@ -21,7 +21,7 @@ %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %%---------------------------------------------------------------- -%% The xint bundle (version 1.09j of January 9, 2014) +%% The xint bundle (version 1.09k of January 21, 2014) %% xintcfrac: Expandable continued fractions with xint package %% Copyright (C) 2013-2014 by Jean-Francois Burnol %%---------------------------------------------------------------- @@ -101,7 +101,7 @@ \XINTsetupcatcodes% \XINT_providespackage \ProvidesPackage{xintcfrac}% - [2014/01/09 v1.09j Expandable continued fractions with xint package (jfB)]% + [2014/01/21 v1.09k Expandable continued fractions with xint package (jfB)]% \def\xintCFrac {\romannumeral0\xintcfrac }% \def\xintcfrac #1% {% diff --git a/Master/texmf-dist/tex/generic/xint/xintexpr.sty b/Master/texmf-dist/tex/generic/xint/xintexpr.sty index 239625f466c..8c6a99fc993 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 (version 1.09j of January 9, 2014) +%% The xint bundle (version 1.09k of January 21, 2014) %% xintexpr: Expandable expression parser %% Copyright (C) 2013-2014 by Jean-Francois Burnol %%---------------------------------------------------------------- @@ -101,10 +101,11 @@ \XINTsetupcatcodes% \XINT_providespackage \ProvidesPackage{xintexpr}% - [2014/01/09 v1.09j Expandable expression parser (jfB)]% -\def\xint_gob_til_! #1!{}% nota bene: this ! has catcode 11 -\edef\XINT_expr_lock #1!% - {\noexpand\expandafter\space\noexpand\csname .=#1\noexpand\endcsname }% + [2014/01/21 v1.09k Expandable expression parser (jfB)]% +\def\xint_gob_til_! #1!{}% nota bene: this ! has catcode 11 +\expandafter\def\expandafter +\XINT_expr_lock\expandafter#\expandafter1\expandafter !\expandafter + {\expandafter\expandafter\space\csname .=#1\endcsname }% \def\XINT_expr_unlock {\expandafter\XINT_expr_unlock_a\string }% \def\XINT_expr_unlock_a #1.={}% \def\XINT_expr_unexpectedtoken {\xintError:ignored }% @@ -223,8 +224,11 @@ {% \ifnum \xint_c_ix<1#1 \expandafter\XINT_expr_scandec_I - \else % We assume we are dealing with a function name!! - \expandafter\XINT_expr_scanfunc + \else + \if #1"\expandafter\expandafter\expandafter\XINT_expr_scanhex_I + \else % We assume we are dealing with a function name!! + \expandafter\expandafter\expandafter\XINT_expr_scanfunc + \fi \fi #1% }% \def\XINT_expr_scanfunc @@ -269,13 +273,14 @@ \XINT_expr_lock\romannumeral-`0\XINT_expr_scanfracpart_b }% \def\XINT_expr_scanintpart_a #1% Please no braced material: 123{FORBIDDEN} -{% careful that ! has catcode letter... spaces needed after ... - \ifcat #1\relax - \expandafter !% stop number scan if \relax, \count, \numexpr, or - \else \xint_afterfi{\ifx !#1\expandafter !\else % also \xintexpr etc.. - \expandafter\expandafter\expandafter - \XINT_expr_scanintpart_aa\expandafter\string\fi }% - \fi #1% +{% careful that ! has catcode letter here + \ifcat #1\relax\else + \ifx !#1\else + \expandafter\expandafter\expandafter + \xint_thirdofthree + \fi\fi + \xint_firstoftwo !% this stops the scan + {\expandafter\XINT_expr_scanintpart_aa\string }#1% }% \def\XINT_expr_scanintpart_aa #1% {% @@ -296,19 +301,20 @@ \expandafter #1\romannumeral-`0\expandafter \XINT_expr_scanintpart_a\romannumeral-`0\romannumeral-`0% }% -\def\XINT_expr_scandec_transition #1% +\def\XINT_expr_scandec_transition .% {% \expandafter.\romannumeral-`0\expandafter \XINT_expr_scanfracpart_a\romannumeral-`0\romannumeral-`0% }% \def\XINT_expr_scanfracpart_a #1% {% - \ifcat #1\relax - \expandafter !% stop number scan - \else \xint_afterfi{\ifx !#1\expandafter !\else - \expandafter\expandafter\expandafter - \XINT_expr_scanfracpart_aa\expandafter\string\fi }% - \fi #1% + \ifcat #1\relax\else + \ifx !#1\else + \expandafter\expandafter\expandafter + \xint_thirdofthree + \fi\fi + \xint_firstoftwo !% this stops the scan + {\expandafter\XINT_expr_scanfracpart_aa\string }#1% }% \def\XINT_expr_scanfracpart_aa #1% {% @@ -324,6 +330,87 @@ \expandafter #1\romannumeral-`0\expandafter \XINT_expr_scanfracpart_a\romannumeral-`0\romannumeral-`0% }% +\def\XINT_expr_scanhex_I #1% +{% + \expandafter\XINT_expr_getop\romannumeral-`0\expandafter + \XINT_expr_lock\expandafter\XINT_expr_inhex + \romannumeral-`0\XINT_expr_scanhexI_a +}% +\def\XINT_expr_inhex #1.#2#3;% expanded inside \csname..\endcsname +{% + \if#2I\xintHexToDec{#1}% + \else + \xintiiMul{\xintiiPow{625}{\xintLength{#3}}}{\xintHexToDec{#1#3}}% + [\the\numexpr-4*\xintLength{#3}]% + \fi +}% +\def\XINT_expr_scanhexI_a #1% +{% + \ifcat #1\relax\else + \ifx !#1\else + \expandafter\expandafter\expandafter + \xint_thirdofthree + \fi\fi + \xint_firstoftwo {.I;!}% + {\expandafter\XINT_expr_scanhexI_aa\string }#1% +}% +\def\XINT_expr_scanhexI_aa #1% +{% + \if\ifnum`#1>`/ + \ifnum`#1>`9 + \ifnum`#1>`@ + \ifnum`#1>`F + 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}% + {\xint_afterfi {.I;!}}% + \fi + #1% +}% +\def\XINT_expr_scanhexI_b #1% +{% + \expandafter #1\romannumeral-`0\expandafter + \XINT_expr_scanhexI_a\romannumeral-`0\romannumeral-`0% +}% +\def\XINT_expr_scanhex_transition .% +{% + \expandafter.\expandafter.\romannumeral-`0\expandafter + \XINT_expr_scanhexII_a\romannumeral-`0\romannumeral-`0% +}% +\def\XINT_expr_scanhexII_a #1% +{% + \ifcat #1\relax\else + \ifx !#1\else + \expandafter\expandafter\expandafter + \xint_thirdofthree + \fi\fi + \xint_firstoftwo {;!}% this stops the scan + {\expandafter\XINT_expr_scanhexII_aa\string }#1% +}% +\def\XINT_expr_scanhexII_aa #1% +{% + \if\ifnum`#1>`/ + \ifnum`#1>`9 + \ifnum`#1>`@ + \ifnum`#1>`F + 0\else1\fi\else0\fi\else1\fi\else0\fi 1% + \expandafter\XINT_expr_scanhexII_b + \else + \xint_afterfi {;!}% + \fi + #1% +}% +\def\XINT_expr_scanhexII_b #1% +{% + \expandafter #1\romannumeral-`0\expandafter + \XINT_expr_scanhexII_a\romannumeral-`0\romannumeral-`0% +}% \def\XINT_expr_getop #1% this #1 is the current locked computed value {% full expansion of next token, first swallowing a possible space \expandafter\XINT_expr_getop_a\expandafter #1% @@ -337,8 +424,12 @@ {\ifx #2\relax\expandafter\xint_firstofthree \else\expandafter\xint_secondofthree % tacit multiplication \fi }% - {\ifx !#2\expandafter\xint_secondofthree % tacit multiplication - \else\expandafter\xint_thirdofthree + {\ifx !#2\expandafter\xint_secondofthree % tacit multiplication + \else % 1.09k adds tacit multiplication in front of ( + \if (#2\expandafter\expandafter\expandafter\xint_secondofthree + \else + \expandafter\expandafter\expandafter\xint_thirdofthree + \fi \fi }% {\XINT_expr_foundend #1}% {\XINT_expr_foundop *#1#2}% @@ -1033,6 +1124,7 @@ \def\xintexprSafeCatcodes {% for end user. \edef\xintexprRestoreCatcodes {% + \catcode34=\the\catcode34 % " \catcode63=\the\catcode63 % ? \catcode124=\the\catcode124 % | \catcode38=\the\catcode38 % & @@ -1055,6 +1147,7 @@ \catcode61=\the\catcode61 % = \catcode32=\the\catcode32\relax % space }% it's hard to know where to stop... + \catcode34=12 % " \catcode63=12 % ? \catcode124=12 % | \catcode38=4 % & diff --git a/Master/texmf-dist/tex/generic/xint/xintfrac.sty b/Master/texmf-dist/tex/generic/xint/xintfrac.sty index 25d24fd4bcd..81b676eb21e 100644 --- a/Master/texmf-dist/tex/generic/xint/xintfrac.sty +++ b/Master/texmf-dist/tex/generic/xint/xintfrac.sty @@ -21,7 +21,7 @@ %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %%---------------------------------------------------------------- -%% The xint bundle (version 1.09j of January 9, 2014) +%% The xint bundle (version 1.09k of January 21, 2014) %% xintfrac: Expandable operations on fractions %% Copyright (C) 2013-2014 by Jean-Francois Burnol %%---------------------------------------------------------------- @@ -101,7 +101,7 @@ \XINTsetupcatcodes% \XINT_providespackage \ProvidesPackage{xintfrac}% - [2014/01/09 v1.09j Expandable operations on fractions (jfB)]% + [2014/01/21 v1.09k Expandable operations on fractions (jfB)]% \chardef\xint_c_vi 6 \chardef\xint_c_vii 7 \chardef\xint_c_xviii 18 @@ -1926,11 +1926,11 @@ }% \def\XINT_fladd_noopt #1#2\Z #3% {% - #1[\XINTdigits]{\XINT_FL_Add {\XINTdigits+2}{#2}{#3}}% + #1[\XINTdigits]{\XINT_FL_Add {\XINTdigits+\xint_c_ii}{#2}{#3}}% }% \def\XINT_fladd_opt #1[\Z #2]#3#4% {% - #1[#2]{\XINT_FL_Add {#2+2}{#3}{#4}}% + #1[#2]{\XINT_FL_Add {#2+\xint_c_ii}{#3}{#4}}% }% \def\XINT_FL_Add #1#2% {% @@ -1951,13 +1951,14 @@ }% \def\XINT_FL_Add_d #1[#2]#3[#4]#5% {% - \xintSgnFork {\ifnum \numexpr #2-#4-#5>1 \expandafter 1% - \else\ifnum \numexpr #4-#2-#5>1 - \xint_afterfi {\expandafter-\expandafter1}% - \else \expandafter\expandafter\expandafter0% - \fi - \fi}% - {#3[#4]}{\xintAdd {#1[#2]}{#3[#4]}}{#1[#2]}% + \ifnum \numexpr #2-#4-#5>\xint_c_i + \expandafter \xint_secondofthree_thenstop + \else + \ifnum \numexpr #4-#2-#5>\xint_c_i + \expandafter\expandafter\expandafter\xint_thirdofthree_thenstop + \fi + \fi + \xintadd {#1[#2]}{#3[#4]}% }% \def\XINT_FL_Add_zero 0\XINT_FL_Add_c 0[0]#1[#2]#3{#1[#2]}% \def\XINT_FL_Add_zerobis 0\XINT_FL_Add_d #1[#2]0[0]#3{#1[#2]}% @@ -1973,11 +1974,11 @@ }% \def\XINT_flsub_noopt #1#2\Z #3% {% - #1[\XINTdigits]{\XINT_FL_Add {\XINTdigits+2}{#2}{\xintOpp{#3}}}% + #1[\XINTdigits]{\XINT_FL_Add {\XINTdigits+\xint_c_ii}{#2}{\xintOpp{#3}}}% }% \def\XINT_flsub_opt #1[\Z #2]#3#4% {% - #1[#2]{\XINT_FL_Add {#2+2}{#3}{\xintOpp{#4}}}% + #1[#2]{\XINT_FL_Add {#2+\xint_c_ii}{#3}{\xintOpp{#4}}}% }% \def\xintFloatMul {\romannumeral0\xintfloatmul}% \def\xintfloatmul #1{\XINT_flmul_chkopt \xintfloat #1\Z }% @@ -1991,11 +1992,11 @@ }% \def\XINT_flmul_noopt #1#2\Z #3% {% - #1[\XINTdigits]{\XINT_FL_Mul {\XINTdigits+2}{#2}{#3}}% + #1[\XINTdigits]{\XINT_FL_Mul {\XINTdigits+\xint_c_ii}{#2}{#3}}% }% \def\XINT_flmul_opt #1[\Z #2]#3#4% {% - #1[#2]{\XINT_FL_Mul {#2+2}{#3}{#4}}% + #1[#2]{\XINT_FL_Mul {#2+\xint_c_ii}{#3}{#4}}% }% \def\XINT_FL_Mul #1#2% {% @@ -2019,11 +2020,11 @@ }% \def\XINT_fldiv_noopt #1#2\Z #3% {% - #1[\XINTdigits]{\XINT_FL_Div {\XINTdigits+2}{#2}{#3}}% + #1[\XINTdigits]{\XINT_FL_Div {\XINTdigits+\xint_c_ii}{#2}{#3}}% }% \def\XINT_fldiv_opt #1[\Z #2]#3#4% {% - #1[#2]{\XINT_FL_Div {#2+2}{#3}{#4}}% + #1[#2]{\XINT_FL_Div {#2+\xint_c_ii}{#3}{#4}}% }% \def\XINT_FL_Div #1#2% {% @@ -2185,7 +2186,7 @@ \def\XINT_flpow_III #1#2[#3]#4% {% \expandafter\XINT_flpow_IIIend\expandafter - {\the\numexpr\if #41 -\fi#3\expandafter}% + {\the\numexpr\if #41-\fi#3\expandafter}% \xint_UDzerofork #4{{#2}}% 0{{1/#2}}% diff --git a/Master/texmf-dist/tex/generic/xint/xintgcd.sty b/Master/texmf-dist/tex/generic/xint/xintgcd.sty index 713011b67c7..b87c0ab419f 100644 --- a/Master/texmf-dist/tex/generic/xint/xintgcd.sty +++ b/Master/texmf-dist/tex/generic/xint/xintgcd.sty @@ -21,7 +21,7 @@ %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %%---------------------------------------------------------------- -%% The xint bundle (version 1.09j of January 9, 2014) +%% The xint bundle (version 1.09k of January 21, 2014) %% xintgcd: Euclidean algorithm with xint package %% Copyright (C) 2013-2014 by Jean-Francois Burnol %%---------------------------------------------------------------- @@ -101,7 +101,7 @@ \XINTsetupcatcodes% \XINT_providespackage \ProvidesPackage{xintgcd}% - [2014/01/09 v1.09j Euclide algorithm with xint package (jfB)]% + [2014/01/21 v1.09k Euclide algorithm with xint package (jfB)]% \def\xintGCD {\romannumeral0\xintgcd }% \def\xintgcd #1% {% diff --git a/Master/texmf-dist/tex/generic/xint/xintseries.sty b/Master/texmf-dist/tex/generic/xint/xintseries.sty index 4a234aad79e..41b8109630e 100644 --- a/Master/texmf-dist/tex/generic/xint/xintseries.sty +++ b/Master/texmf-dist/tex/generic/xint/xintseries.sty @@ -21,7 +21,7 @@ %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %%---------------------------------------------------------------- -%% The xint bundle (version 1.09j of January 9, 2014) +%% The xint bundle (version 1.09k of January 21, 2014) %% xintseries: Expandable partial sums with xint package %% Copyright (C) 2013-2014 by Jean-Francois Burnol %%---------------------------------------------------------------- @@ -101,7 +101,7 @@ \XINTsetupcatcodes% \XINT_providespackage \ProvidesPackage{xintseries}% - [2014/01/09 v1.09j Expandable partial sums with xint package (jfB)]% + [2014/01/21 v1.09k Expandable partial sums with xint package (jfB)]% \def\xintSeries {\romannumeral0\xintseries }% \def\xintseries #1#2% {% diff --git a/Master/texmf-dist/tex/generic/xint/xinttools.sty b/Master/texmf-dist/tex/generic/xint/xinttools.sty index 16e3a45750c..234b4ba56e3 100644 --- a/Master/texmf-dist/tex/generic/xint/xinttools.sty +++ b/Master/texmf-dist/tex/generic/xint/xinttools.sty @@ -21,7 +21,7 @@ %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %%---------------------------------------------------------------- -%% The xint bundle (version 1.09j of January 9, 2014) +%% The xint bundle (version 1.09k of January 21, 2014) %% xinttools: Expandable and non-expandable utilities %% Copyright (C) 2013-2014 by Jean-Francois Burnol %%---------------------------------------------------------------- @@ -65,6 +65,7 @@ \endgroup \def\XINT_storecatcodes {% takes care of all, to allow more economical code in modules + \catcode34=\the\catcode34 % " xintbinhex, and 1.09k xintexpr \catcode63=\the\catcode63 % ? xintexpr \catcode124=\the\catcode124 % | xintexpr \catcode38=\the\catcode38 % & xintexpr @@ -130,6 +131,7 @@ \catcode38=12 % & \catcode124=12 % | \catcode63=11 % ? + \catcode34=12 % " missing from v < 1.09k although needed in xintbinhex }% \XINT_setcatcodes }% @@ -150,7 +152,7 @@ \fi \XINT_providespackage \ProvidesPackage {xinttools}% - [2014/01/09 v1.09j Expandable and non-expandable utilities (jfB)]% + [2014/01/21 v1.09k Expandable and non-expandable utilities (jfB)]% \long\def\xint_gobble_ {}% \long\def\xint_gobble_i #1{}% \long\def\xint_gobble_ii #1#2{}% -- cgit v1.2.3