diff options
author | Karl Berry <karl@freefriends.org> | 2013-11-24 00:00:29 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-11-24 00:00:29 +0000 |
commit | c9f8bd8bf029f005f02efea2a67dade996df2515 (patch) | |
tree | 671b749f2efa72f532d714a47ea4d3d79be5b4ce /Master/texmf-dist/tex/generic/xint/xinttools.sty | |
parent | 42b82c7597e89fadde85939a364fa8d8aa24f2fa (diff) |
xint (23nov13)
git-svn-id: svn://tug.org/texlive/trunk@32224 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/xint/xinttools.sty')
-rw-r--r-- | Master/texmf-dist/tex/generic/xint/xinttools.sty | 1043 |
1 files changed, 1043 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/generic/xint/xinttools.sty b/Master/texmf-dist/tex/generic/xint/xinttools.sty new file mode 100644 index 00000000000..9e2fad8b5d6 --- /dev/null +++ b/Master/texmf-dist/tex/generic/xint/xinttools.sty @@ -0,0 +1,1043 @@ +%% +%% This is file `xinttools.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% xint.dtx (with options: `xinttools') +%% +%% IMPORTANT NOTICE: +%% +%% For the copyright see the source file. +%% +%% Any modified versions of this file must be renamed +%% with new filenames distinct from xinttools.sty. +%% +%% For distribution of the original source see the terms +%% for copying and modification in the file xint.dtx. +%% +%% This generated file may be distributed as long as the +%% original source files, as listed above, are part of the +%% same distribution. (The sources need not necessarily be +%% in the same archive or directory.) +%% +%%---------------------------------------------------------------- +%% The xint bundle (version 1.09g of November 22, 2013) +%% xinttools: Expandable and non-expandable utilities +%% Copyright (C) 2013 by Jean-Francois Burnol +%%---------------------------------------------------------------- +%% +\begingroup\catcode61\catcode48\catcode32=10\relax% + \catcode13=5 % ^^M + \endlinechar=13 % + \catcode123=1 % { + \catcode125=2 % } + \catcode64=11 % @ + \catcode95=11 % _ + \catcode35=6 % # + \catcode44=12 % , + \catcode45=12 % - + \catcode46=12 % . + \catcode58=12 % : + \expandafter\let\expandafter\x\csname ver@xint.sty\endcsname + \expandafter + \ifx\csname PackageInfo\endcsname\relax + \def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}% + \else + \def\y#1#2{\PackageInfo{#1}{#2}}% + \fi + \expandafter + \ifx\csname numexpr\endcsname\relax + \y{xinttools}{\numexpr not available, aborting input}% + \aftergroup\endinput + \else + \ifx\x\relax % plain-TeX, first loading + \else + \def\empty {}% + \ifx\x\empty % LaTeX, first loading, + % variable is initialized, but \ProvidesPackage not yet seen + \else + \y{xinttools}{I was already loaded, aborting input}% + \aftergroup\endinput + \fi + \fi + \fi + \def\ChangeCatcodesIfInputNotAborted + {% + \endgroup + \def\XINT_storecatcodes + {% takes care of all, to allow more economical code in modules + \catcode63=\the\catcode63 % ? xintexpr + \catcode124=\the\catcode124 % | xintexpr + \catcode38=\the\catcode38 % & xintexpr + \catcode64=\the\catcode64 % @ xintexpr + \catcode33=\the\catcode33 % ! xintexpr + \catcode93=\the\catcode93 % ] -, xintfrac, xintseries, xintcfrac + \catcode91=\the\catcode91 % [ -, xintfrac, xintseries, xintcfrac + \catcode36=\the\catcode36 % $ xintgcd only + \catcode94=\the\catcode94 % ^ + \catcode96=\the\catcode96 % ` + \catcode47=\the\catcode47 % / + \catcode41=\the\catcode41 % ) + \catcode40=\the\catcode40 % ( + \catcode42=\the\catcode42 % * + \catcode43=\the\catcode43 % + + \catcode62=\the\catcode62 % > + \catcode60=\the\catcode60 % < + \catcode58=\the\catcode58 % : + \catcode46=\the\catcode46 % . + \catcode45=\the\catcode45 % - + \catcode44=\the\catcode44 % , + \catcode35=\the\catcode35 % # + \catcode95=\the\catcode95 % _ + \catcode125=\the\catcode125 % } + \catcode123=\the\catcode123 % { + \endlinechar=\the\endlinechar + \catcode13=\the\catcode13 % ^^M + \catcode32=\the\catcode32 % + \catcode61=\the\catcode61\relax % = + }% + \edef\XINT_restorecatcodes_endinput + {% + \XINT_storecatcodes\noexpand\endinput % + }% + \def\XINT_setcatcodes + {% + \catcode61=12 % = + \catcode32=10 % space + \catcode13=5 % ^^M + \endlinechar=13 % + \catcode123=1 % { + \catcode125=2 % } + \catcode95=11 % _ (replaces @ everywhere, starting with 1.06b) + \catcode35=6 % # + \catcode44=12 % , + \catcode45=12 % - + \catcode46=12 % . + \catcode58=11 % : (made letter for error cs) + \catcode60=12 % < + \catcode62=12 % > + \catcode43=12 % + + \catcode42=12 % * + \catcode40=12 % ( + \catcode41=12 % ) + \catcode47=12 % / + \catcode96=12 % ` + \catcode94=11 % ^ + \catcode36=3 % $ + \catcode91=12 % [ + \catcode93=12 % ] + \catcode33=11 % ! + \catcode64=11 % @ + \catcode38=12 % & + \catcode124=12 % | + \catcode63=11 % ? + }% + \XINT_setcatcodes + }% +\ChangeCatcodesIfInputNotAborted +\def\XINTsetupcatcodes {% for use by other modules + \edef\XINT_restorecatcodes_endinput + {% + \XINT_storecatcodes\noexpand\endinput % + }% + \XINT_setcatcodes +}% +\ifdefined\ProvidesPackage + \let\XINT_providespackage\relax +\else + \def\XINT_providespackage #1#2[#3]% + {\immediate\write-1{Package: #2 #3}% + \expandafter\xdef\csname ver@#2.sty\endcsname{#3}}% +\fi +\XINT_providespackage +\ProvidesPackage {xinttools}% + [2013/11/22 v1.09g Expandable and non-expandable utilities (jfB)]% +\def\xint_gobble_ {}% +\def\xint_gobble_i #1{}% +\def\xint_gobble_ii #1#2{}% +\def\xint_gobble_iii #1#2#3{}% +\def\xint_gobble_iv #1#2#3#4{}% +\def\xint_gobble_v #1#2#3#4#5{}% +\def\xint_gobble_vi #1#2#3#4#5#6{}% +\def\xint_gobble_vii #1#2#3#4#5#6#7{}% +\def\xint_gobble_viii #1#2#3#4#5#6#7#8{}% +\long\def\xint_firstofone #1{#1}% long since 1.09f, 2013/11/01 +\xint_firstofone{\let\XINT_sptoken= } % 1.09d, 2013/10/22 +\long\def\xint_firstoftwo #1#2{#1}% long since 1.09e, 2013/10/28 +\long\def\xint_secondoftwo #1#2{#2}% idem +\def\xint_firstoftwo_andstop #1#2{ #1}% +\def\xint_secondoftwo_andstop #1#2{ #2}% +\def\xint_minus_andstop { -}% +\def\xint_gob_til_R #1\R {}% +\def\xint_gob_til_W #1\W {}% +\def\xint_gob_til_Z #1\Z {}% +\long\def\xint_bye #1\xint_bye {}% long since 1.09f +\let\xint_relax\relax +\def\xint_brelax {\xint_relax }% +\long\def\xint_gob_til_xint_relax #1\xint_relax {}% long since 1.09f +\def\xint_afterfi #1#2\fi {\fi #1}% +\chardef\xint_c_ 0 +\chardef\xint_c_viii 8 +\newtoks\XINT_toks +\newcount\XINT_count % 1.09g: \xintFor from 1.09f modified \count 255 :-( +\def\xintReverseOrder {\romannumeral0\xintreverseorder }% +\def\xintreverseorder #1% +{% + \XINT_rord_main {}#1% + \xint_relax + \xint_bye\xint_bye\xint_bye\xint_bye + \xint_bye\xint_bye\xint_bye\xint_bye + \xint_relax +}% +\def\XINT_rord_main #1#2#3#4#5#6#7#8#9% +{% + \xint_bye #9\XINT_rord_cleanup\xint_bye + \XINT_rord_main {#9#8#7#6#5#4#3#2#1}% +}% +\def\XINT_rord_cleanup\xint_bye\XINT_rord_main #1#2\xint_relax +{% + \expandafter\space\xint_gob_til_xint_relax #1% +}% +\def\xintRevWithBraces {\romannumeral0\xintrevwithbraces }% +\def\xintRevWithBracesNoExpand {\romannumeral0\xintrevwithbracesnoexpand }% +\def\xintrevwithbraces #1% +{% + \expandafter\XINT_revwbr_loop\expandafter{\expandafter}% + \romannumeral-`0#1\xint_relax\xint_relax\xint_relax\xint_relax + \xint_relax\xint_relax\xint_relax\xint_relax\xint_bye +}% +\def\xintrevwithbracesnoexpand #1% +{% + \XINT_revwbr_loop {}% + #1\xint_relax\xint_relax\xint_relax\xint_relax + \xint_relax\xint_relax\xint_relax\xint_relax\xint_bye +}% +\def\XINT_revwbr_loop #1#2#3#4#5#6#7#8#9% +{% + \xint_gob_til_xint_relax #9\XINT_revwbr_finish_a\xint_relax + \XINT_revwbr_loop {{#9}{#8}{#7}{#6}{#5}{#4}{#3}{#2}#1}% +}% +\def\XINT_revwbr_finish_a\xint_relax\XINT_revwbr_loop #1#2\xint_bye +{% + \XINT_revwbr_finish_b #2\R\R\R\R\R\R\R\Z #1% +}% +\def\XINT_revwbr_finish_b #1#2#3#4#5#6#7#8\Z +{% + \xint_gob_til_R + #1\XINT_revwbr_finish_c 8% + #2\XINT_revwbr_finish_c 7% + #3\XINT_revwbr_finish_c 6% + #4\XINT_revwbr_finish_c 5% + #5\XINT_revwbr_finish_c 4% + #6\XINT_revwbr_finish_c 3% + #7\XINT_revwbr_finish_c 2% + \R\XINT_revwbr_finish_c 1\Z +}% +\def\XINT_revwbr_finish_c #1#2\Z +{% + \expandafter\expandafter\expandafter + \space + \csname xint_gobble_\romannumeral #1\endcsname +}% +\def\xintLength {\romannumeral0\xintlength }% +\def\xintlength #1% +{% + \XINT_length_loop + {0}#1\xint_relax\xint_relax\xint_relax\xint_relax + \xint_relax\xint_relax\xint_relax\xint_relax\xint_bye +}% +\def\XINT_length_loop #1#2#3#4#5#6#7#8#9% +{% + \xint_gob_til_xint_relax #9\XINT_length_finish_a\xint_relax + \expandafter\XINT_length_loop\expandafter {\the\numexpr #1+8\relax}% +}% +\def\XINT_length_finish_a\xint_relax + \expandafter\XINT_length_loop\expandafter #1#2\xint_bye +{% + \XINT_length_finish_b #2\W\W\W\W\W\W\W\Z {#1}% +}% +\def\XINT_length_finish_b #1#2#3#4#5#6#7#8\Z +{% + \xint_gob_til_W + #1\XINT_length_finish_c 8% + #2\XINT_length_finish_c 7% + #3\XINT_length_finish_c 6% + #4\XINT_length_finish_c 5% + #5\XINT_length_finish_c 4% + #6\XINT_length_finish_c 3% + #7\XINT_length_finish_c 2% + \W\XINT_length_finish_c 1\Z +}% +\def\XINT_length_finish_c #1#2\Z #3{\expandafter\space\the\numexpr #3-#1\relax}% +\def\xintZapFirstSpaces {\romannumeral0\xintzapfirstspaces }% +\edef\xintzapfirstspaces #1% + {\noexpand\XINT_zapbsp_a \space #1\space\space\noexpand\xint_bye\xint_relax }% +\xint_firstofone {\def\XINT_zapbsp_a #1 } %<- space token here +{% + \XINT_zapbsp_again? #1\xint_bye\XINT_zapbsp_b {#1}% +}% +\def\XINT_zapbsp_again? #1{\xint_bye #1\XINT_zapbsp_again }% +\edef\XINT_zapbsp_again\XINT_zapbsp_b #1{\noexpand\XINT_zapbsp_a\space }% +\def\XINT_zapbsp_b #1#2\xint_relax + {\XINT_zapbsp_end? #2\XINT_zapbsp_e\empty #2{#1}}% +\def\XINT_zapbsp_end? #1{\xint_bye #1\XINT_zapbsp_end }% +\def\XINT_zapbsp_end\XINT_zapbsp_e\empty #1\xint_bye #2{#2#1}% +\xint_firstofone{\def\XINT_zapbsp_e #1 } \xint_bye + {\expandafter\XINT_zapbsp_f \expandafter{#1}}% +\edef\XINT_zapbsp_f #1#2{#2\space\space #1}% +\def\xintZapLastSpaces {\romannumeral0\xintzaplastspaces }% +\edef\xintzaplastspaces #1{\noexpand\XINT_zapesp_a {\space}\noexpand\empty + #1\space\space\noexpand\xint_bye \xint_relax}% +\xint_firstofone {\def\XINT_zapesp_a #1#2 } %<- second space here + {\expandafter\XINT_zapesp_b\expandafter{#2}{#1}}% +\def\XINT_zapesp_b #1#2#3\xint_relax + {\XINT_zapesp_end? #3\XINT_zapesp_e {#2#1}\empty #3\xint_relax }% +\def\XINT_zapesp_end? #1{\xint_bye #1\XINT_zapesp_end }% +\def\XINT_zapesp_end\XINT_zapesp_e #1#2\xint_relax {#1}% +\edef\XINT_zapesp_e #1{\noexpand \XINT_zapesp_a {#1\space\space}}% +\def\xintZapSpaces {\romannumeral0\xintzapspaces }% +\edef\xintzapspaces #1% + {\noexpand\XINT_zapsp_a \space #1\space\space\noexpand\xint_bye\xint_relax}% +\xint_firstofone {\def\XINT_zapsp_a #1 } %<- space token here +{% + \XINT_zapsp_again? #1\xint_bye\XINT_zapesp_b {#1}{}% +}% +\def\XINT_zapsp_again? #1{\xint_bye #1\XINT_zapsp_again }% +\edef\XINT_zapsp_again\XINT_zapesp_b #1#2{\noexpand\XINT_zapsp_a\space }% +\def\xintZapSpacesB {\romannumeral0\xintzapspacesb }% +\def\xintzapspacesb #1{\XINT_zapspb_one? #1\xint_relax\xint_relax + \xint_bye\xintzapspaces {#1}}% +\def\XINT_zapspb_one? #1#2% + {\xint_gob_til_xint_relax #1\XINT_zapspb_onlyspaces\xint_relax + \xint_gob_til_xint_relax #2\XINT_zapspb_bracedorone\xint_relax + \xint_bye {#1}}% +\def\XINT_zapspb_onlyspaces\xint_relax + \xint_gob_til_xint_relax\xint_relax\XINT_zapspb_bracedorone\xint_relax + \xint_bye #1\xint_bye\xintzapspaces #2{ }% +\def\XINT_zapspb_bracedorone\xint_relax + \xint_bye #1\xint_relax\xint_bye\xintzapspaces #2{ #1}% +\def\xintCSVtoList {\romannumeral0\xintcsvtolist }% +\def\xintcsvtolist #1{\expandafter\xintApply\expandafter\xintzapspacesb + \expandafter{\romannumeral0\xintcsvtolistnonstripped{#1}}}% +\def\xintCSVtoListNoExpand {\romannumeral0\xintcsvtolistnoexpand }% +\def\xintcsvtolistnoexpand #1{\expandafter\xintApply\expandafter\xintzapspacesb + \expandafter{\romannumeral0\xintcsvtolistnonstrippednoexpand{#1}}}% +\def\xintCSVtoListNonStripped {\romannumeral0\xintcsvtolistnonstripped }% +\def\xintCSVtoListNonStrippedNoExpand + {\romannumeral0\xintcsvtolistnonstrippednoexpand }% +\def\xintcsvtolistnonstripped #1% +{% + \expandafter\XINT_csvtol_loop_a\expandafter + {\expandafter}\romannumeral-`0#1% + ,\xint_bye,\xint_bye,\xint_bye,\xint_bye + ,\xint_bye,\xint_bye,\xint_bye,\xint_bye,\Z +}% +\def\xintcsvtolistnonstrippednoexpand #1% +{% + \XINT_csvtol_loop_a + {}#1,\xint_bye,\xint_bye,\xint_bye,\xint_bye + ,\xint_bye,\xint_bye,\xint_bye,\xint_bye,\Z +}% +\def\XINT_csvtol_loop_a #1#2,#3,#4,#5,#6,#7,#8,#9,% +{% + \xint_bye #9\XINT_csvtol_finish_a\xint_bye + \XINT_csvtol_loop_b {#1}{{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9}}% +}% +\def\XINT_csvtol_loop_b #1#2{\XINT_csvtol_loop_a {#1#2}}% +\def\XINT_csvtol_finish_a\xint_bye\XINT_csvtol_loop_b #1#2#3\Z +{% + \XINT_csvtol_finish_b #3\R,\R,\R,\R,\R,\R,\R,\Z #2{#1}% +}% +\def\XINT_csvtol_finish_b #1,#2,#3,#4,#5,#6,#7,#8\Z +{% + \xint_gob_til_R + #1\XINT_csvtol_finish_c 8% + #2\XINT_csvtol_finish_c 7% + #3\XINT_csvtol_finish_c 6% + #4\XINT_csvtol_finish_c 5% + #5\XINT_csvtol_finish_c 4% + #6\XINT_csvtol_finish_c 3% + #7\XINT_csvtol_finish_c 2% + \R\XINT_csvtol_finish_c 1\Z +}% +\def\XINT_csvtol_finish_c #1#2\Z +{% + \csname XINT_csvtol_finish_d\romannumeral #1\endcsname +}% +\def\XINT_csvtol_finish_dviii #1#2#3#4#5#6#7#8#9{ #9}% +\def\XINT_csvtol_finish_dvii #1#2#3#4#5#6#7#8#9{ #9{#1}}% +\def\XINT_csvtol_finish_dvi #1#2#3#4#5#6#7#8#9{ #9{#1}{#2}}% +\def\XINT_csvtol_finish_dv #1#2#3#4#5#6#7#8#9{ #9{#1}{#2}{#3}}% +\def\XINT_csvtol_finish_div #1#2#3#4#5#6#7#8#9{ #9{#1}{#2}{#3}{#4}}% +\def\XINT_csvtol_finish_diii #1#2#3#4#5#6#7#8#9{ #9{#1}{#2}{#3}{#4}{#5}}% +\def\XINT_csvtol_finish_dii #1#2#3#4#5#6#7#8#9{ #9{#1}{#2}{#3}{#4}{#5}{#6}}% +\def\XINT_csvtol_finish_di #1#2#3#4#5#6#7#8#9% + { #9{#1}{#2}{#3}{#4}{#5}{#6}{#7}}% +\def\xintListWithSep {\romannumeral0\xintlistwithsep }% +\def\xintListWithSepNoExpand {\romannumeral0\xintlistwithsepnoexpand }% +\long\def\xintlistwithsep #1#2% + {\expandafter\XINT_lws\expandafter {\romannumeral-`0#2}{#1}}% +\long\def\XINT_lws #1#2{\XINT_lws_start {#2}#1\xint_bye }% +\long\def\xintlistwithsepnoexpand #1#2{\XINT_lws_start {#1}#2\xint_bye }% +\long\def\XINT_lws_start #1#2% +{% + \xint_bye #2\XINT_lws_dont\xint_bye + \XINT_lws_loop_a {#2}{#1}% +}% +\long\def\XINT_lws_dont\xint_bye\XINT_lws_loop_a #1#2{ }% +\long\def\XINT_lws_loop_a #1#2#3% +{% + \xint_bye #3\XINT_lws_end\xint_bye + \XINT_lws_loop_b {#1}{#2#3}{#2}% +}% +\long\def\XINT_lws_loop_b #1#2{\XINT_lws_loop_a {#1#2}}% +\long\def\XINT_lws_end\xint_bye\XINT_lws_loop_b #1#2#3{ #1}% +\def\xintNthElt {\romannumeral0\xintnthelt }% +\def\xintNthEltNoExpand {\romannumeral0\xintntheltnoexpand }% +\def\xintnthelt #1% +{% + \expandafter\XINT_nthelt_a\expandafter {\the\numexpr #1}% +}% +\def\xintntheltnoexpand #1% +{% + \expandafter\XINT_ntheltnoexpand_a\expandafter {\the\numexpr #1}% +}% +\def\XINT_nthelt_a #1#2% +{% + \ifnum #1<0 + \xint_afterfi{\expandafter\XINT_nthelt_c\expandafter + {\romannumeral0\xintrevwithbraces {#2}}{-#1}}% + \else + \xint_afterfi{\expandafter\XINT_nthelt_c\expandafter + {\romannumeral-`0#2}{#1}}% + \fi +}% +\def\XINT_ntheltnoexpand_a #1#2% +{% + \ifnum #1<0 + \xint_afterfi{\expandafter\XINT_nthelt_c\expandafter + {\romannumeral0\xintrevwithbracesnoexpand {#2}}{-#1}}% + \else + \xint_afterfi{\expandafter\XINT_nthelt_c\expandafter + {#2}{#1}}% + \fi +}% +\def\XINT_nthelt_c #1#2% +{% + \ifnum #2>\xint_c_ + \expandafter\XINT_nthelt_loop_a + \else + \expandafter\XINT_length_loop + \fi {#2}#1\xint_relax\xint_relax\xint_relax\xint_relax + \xint_relax\xint_relax\xint_relax\xint_relax\xint_bye +}% +\def\XINT_nthelt_loop_a #1% +{% + \ifnum #1>\xint_c_viii + \expandafter\XINT_nthelt_loop_b + \else + \expandafter\XINT_nthelt_getit + \fi + {#1}% +}% +\def\XINT_nthelt_loop_b #1#2#3#4#5#6#7#8#9% +{% + \xint_gob_til_xint_relax #9\XINT_nthelt_silentend\xint_relax + \expandafter\XINT_nthelt_loop_a\expandafter{\the\numexpr #1-8}% +}% +\def\XINT_nthelt_silentend #1\xint_bye { }% +\def\XINT_nthelt_getit #1% +{% + \expandafter\expandafter\expandafter\XINT_nthelt_finish + \csname xint_gobble_\romannumeral\numexpr#1-1\endcsname +}% +\def\XINT_nthelt_finish #1#2\xint_bye + {\xint_gob_til_xint_relax #1\expandafter\space + \xint_gobble_iii\xint_relax\space #1}% +\def\xintApply {\romannumeral0\xintapply }% +\def\xintApplyNoExpand {\romannumeral0\xintapplynoexpand }% +\def\xintapply #1#2% +{% + \expandafter\XINT_apply\expandafter {\romannumeral-`0#2}% + {#1}% +}% +\def\XINT_apply #1#2{\XINT_apply_loop_a {}{#2}#1\xint_bye }% +\def\xintapplynoexpand #1#2{\XINT_apply_loop_a {}{#1}#2\xint_bye }% +\def\XINT_apply_loop_a #1#2#3% +{% + \xint_bye #3\XINT_apply_end\xint_bye + \expandafter + \XINT_apply_loop_b + \expandafter {\romannumeral-`0#2{#3}}{#1}{#2}% +}% +\def\XINT_apply_loop_b #1#2{\XINT_apply_loop_a {#2{#1}}}% +\def\XINT_apply_end\xint_bye\expandafter\XINT_apply_loop_b + \expandafter #1#2#3{ #2}% +\def\xintApplyUnbraced {\romannumeral0\xintapplyunbraced }% +\def\xintApplyUnbracedNoExpand {\romannumeral0\xintapplyunbracednoexpand }% +\def\xintapplyunbraced #1#2% +{% + \expandafter\XINT_applyunbr\expandafter {\romannumeral-`0#2}% + {#1}% +}% +\def\XINT_applyunbr #1#2{\XINT_applyunbr_loop_a {}{#2}#1\xint_bye }% +\def\xintapplyunbracednoexpand #1#2% + {\XINT_applyunbr_loop_a {}{#1}#2\xint_bye }% +\def\XINT_applyunbr_loop_a #1#2#3% +{% + \xint_bye #3\XINT_applyunbr_end\xint_bye + \expandafter\XINT_applyunbr_loop_b + \expandafter {\romannumeral-`0#2{#3}}{#1}{#2}% +}% +\def\XINT_applyunbr_loop_b #1#2{\XINT_applyunbr_loop_a {#2#1}}% +\def\XINT_applyunbr_end\xint_bye\expandafter\XINT_applyunbr_loop_b + \expandafter #1#2#3{ #2}% +\def\xintSeq {\romannumeral0\xintseq }% +\def\xintseq #1{\XINT_seq_chkopt #1\xint_bye }% +\def\XINT_seq_chkopt #1% +{% + \ifx [#1\expandafter\XINT_seq_opt + \else\expandafter\XINT_seq_noopt + \fi #1% +}% +\def\XINT_seq_noopt #1\xint_bye #2% +{% + \expandafter\XINT_seq\expandafter + {\the\numexpr#1\expandafter}\expandafter{\the\numexpr #2}% +}% +\def\XINT_seq #1#2% +{% + \ifcase\xintiiSgn{\the\numexpr #2-#1\relax} + \expandafter\xint_firstoftwo_andstop + \or + \expandafter\XINT_seq_p + \else + \expandafter\XINT_seq_n + \fi + {#2}{#1}% +}% +\def\XINT_seq_p #1#2% +{% + \ifnum #1>#2 + \xint_afterfi{\expandafter\XINT_seq_p}% + \else + \expandafter\XINT_seq_e + \fi + \expandafter{\the\numexpr #1-1}{#2}{#1}% +}% +\def\XINT_seq_n #1#2% +{% + \ifnum #1<#2 + \xint_afterfi{\expandafter\XINT_seq_n}% + \else + \expandafter\XINT_seq_e + \fi + \expandafter{\the\numexpr #1+1}{#2}{#1}% +}% +\def\XINT_seq_e #1#2#3{ }% +\def\XINT_seq_opt [\xint_bye #1]#2#3% +{% + \expandafter\XINT_seqo\expandafter + {\the\numexpr #2\expandafter}\expandafter + {\the\numexpr #3\expandafter}\expandafter + {\the\numexpr #1}% +}% +\def\XINT_seqo #1#2% +{% + \ifcase\xintiiSgn{\the\numexpr #2-#1\relax} + \expandafter\XINT_seqo_a + \or + \expandafter\XINT_seqo_pa + \else + \expandafter\XINT_seqo_na + \fi + {#1}{#2}% +}% +\def\XINT_seqo_a #1#2#3{ {#1}}% +\def\XINT_seqo_o #1#2#3#4{ #4}% +\def\XINT_seqo_pa #1#2#3% +{% + \ifcase\XINT_Sgn {#3} + \expandafter\XINT_seqo_o + \or + \expandafter\XINT_seqo_pb + \else + \xint_afterfi{\expandafter\space\xint_gobble_iv}% + \fi + {#1}{#2}{#3}{{#1}}% +}% +\def\XINT_seqo_pb #1#2#3% +{% + \expandafter\XINT_seqo_pc\expandafter{\the\numexpr #1+#3}{#2}{#3}% +}% +\def\XINT_seqo_pc #1#2% +{% + \ifnum#1>#2 + \expandafter\XINT_seqo_o + \else + \expandafter\XINT_seqo_pd + \fi + {#1}{#2}% +}% +\def\XINT_seqo_pd #1#2#3#4{\XINT_seqo_pb {#1}{#2}{#3}{#4{#1}}}% +\def\XINT_seqo_na #1#2#3% +{% + \ifcase\XINT_Sgn {#3} + \expandafter\XINT_seqo_o + \or + \xint_afterfi{\expandafter\space\xint_gobble_iv}% + \else + \expandafter\XINT_seqo_nb + \fi + {#1}{#2}{#3}{{#1}}% +}% +\def\XINT_seqo_nb #1#2#3% +{% + \expandafter\XINT_seqo_nc\expandafter{\the\numexpr #1+#3}{#2}{#3}% +}% +\def\XINT_seqo_nc #1#2% +{% + \ifnum#1<#2 + \expandafter\XINT_seqo_o + \else + \expandafter\XINT_seqo_nd + \fi + {#1}{#2}% +}% +\def\XINT_seqo_nd #1#2#3#4{\XINT_seqo_nb {#1}{#2}{#3}{#4{#1}}}% +\def\xintloop #1#2\repeat {#1#2\xintloop_again\fi\xint_gobble_i {#1#2}}% +\def\xintloop_again\fi\xint_gobble_i #1{\fi + #1\xintloop_again\fi\xint_gobble_i {#1}}% +\def\xintbreakloop #1\xintloop_again\fi\xint_gobble_i #2{}% +\def\xintbreakloopanddo #1#2\xintloop_again\fi\xint_gobble_i #3{#1}% +\def\xintloopskiptonext #1\xintloop_again\fi\xint_gobble_i #2{% + #2\xintloop_again\fi\xint_gobble_i {#2}}% +\def\xintiloop [#1+#2]{% + \expandafter\xintiloop_a\the\numexpr #1\expandafter.\the\numexpr #2.}% +\def\xintiloop_a #1.#2.#3#4\repeat{% + #3#4\xintiloop_again\fi\xint_gobble_iii {#1}{#2}{#3#4}}% +\def\xintiloop_again\fi\xint_gobble_iii #1#2{% + \fi\expandafter\xintiloop_again_b\the\numexpr#1+#2.#2.}% +\def\xintiloop_again_b #1.#2.#3{% + #3\xintiloop_again\fi\xint_gobble_iii {#1}{#2}{#3}}% +\def\xintbreakiloop #1\xintiloop_again\fi\xint_gobble_iii #2#3#4{}% +\def\xintbreakiloopanddo #1.#2\xintiloop_again\fi\xint_gobble_iii #3#4#5{#1}% +\def\xintiloopindex #1\xintiloop_again\fi\xint_gobble_iii #2% + {#2#1\xintiloop_again\fi\xint_gobble_iii {#2}}% +\def\xintouteriloopindex #1\xintiloop_again + #2\xintiloop_again\fi\xint_gobble_iii #3% + {#3#1\xintiloop_again #2\xintiloop_again\fi\xint_gobble_iii {#3}}% +\def\xintiloopskiptonext #1\xintiloop_again\fi\xint_gobble_iii #2#3{% + \expandafter\xintiloop_again_b \the\numexpr#2+#3.#3.}% +\def\xintiloopskipandredo #1\xintiloop_again\fi\xint_gobble_iii #2#3#4{% + #4\xintiloop_again\fi\xint_gobble_iii {#2}{#3}{#4}}% +\def\XINT_xflet #1% +{% + \def\XINT_xflet_macro {#1}\XINT_xflet_zapsp +}% +\def\XINT_xflet_zapsp +{% + \expandafter\futurelet\expandafter\XINT_token + \expandafter\XINT_xflet_sp?\romannumeral-`0% +}% +\def\XINT_xflet_sp? +{% + \ifx\XINT_token\XINT_sptoken + \expandafter\XINT_xflet_zapsp + \else\expandafter\XINT_xflet_zapspB + \fi +}% +\def\XINT_xflet_zapspB +{% + \expandafter\futurelet\expandafter\XINT_tokenB + \expandafter\XINT_xflet_spB?\romannumeral-`0% +}% +\def\XINT_xflet_spB? +{% + \ifx\XINT_tokenB\XINT_sptoken + \expandafter\XINT_xflet_zapspB + \else\expandafter\XINT_xflet_eq? + \fi +}% +\def\XINT_xflet_eq? +{% + \ifx\XINT_token\XINT_tokenB + \expandafter\XINT_xflet_macro + \else\expandafter\XINT_xflet_zapsp + \fi +}% +\catcode`Z 3 +\long\def\xintApplyInline #1#2% +{% + \long\expandafter\def\expandafter\XINT_inline_macro + \expandafter ##\expandafter 1\expandafter {#1{##1}}% + \XINT_xflet\XINT_inline_b #2Z% this Z has catcode 3 +}% +\def\XINT_inline_b +{% + \ifx\XINT_token Z\expandafter\xint_gobble_i + \else\expandafter\XINT_inline_d\fi +}% +\long\def\XINT_inline_d #1% +{% + \long\def\XINT_item{{#1}}\XINT_xflet\XINT_inline_e +}% +\def\XINT_inline_e +{% + \ifx\XINT_token Z\expandafter\XINT_inline_w + \else\expandafter\XINT_inline_f\fi +}% +\def\XINT_inline_f +{% + \expandafter\XINT_inline_g\expandafter{\XINT_inline_macro {##1}}% +}% +\long\def\XINT_inline_g #1% +{% + \expandafter\XINT_inline_macro\XINT_item + \long\def\XINT_inline_macro ##1{#1}\XINT_inline_d +}% +\def\XINT_inline_w #1% +{% + \expandafter\XINT_inline_macro\XINT_item +}% +\def\XINT_tmpa #1#2{\ifnum #2<#1 \xint_afterfi {{#########2}}\fi}% +\def\XINT_tmpb #1#2{\ifnum #1<#2 \xint_afterfi {{#########2}}\fi}% +\def\XINT_tmpc #1% +{% + \expandafter\edef \csname XINT_for_left#1\endcsname + {\xintApplyUnbraced {\XINT_tmpa #1}{123456789}}% + \expandafter\edef \csname XINT_for_right#1\endcsname + {\xintApplyUnbraced {\XINT_tmpb #1}{123456789}}% +}% +\xintApplyInline \XINT_tmpc {123456789}% +\long\def\xintBreakFor #1Z{}% +\long\def\xintBreakForAndDo #1#2Z{#1}% +\def\xintFor {\let\xintifForFirst\xint_firstoftwo + \futurelet\XINT_token\XINT_for_ifstar }% +\def\XINT_for_ifstar {\ifx\XINT_token*\expandafter\XINT_forx + \else\expandafter\XINT_for \fi }% +\catcode`U 3 % with numexpr +\catcode`V 3 % with xintfrac.sty (xint.sty not enough) +\catcode`D 3 % with dimexpr +\def\XINT_flet_zapsp +{% + \futurelet\XINT_token\XINT_flet_sp? +}% +\def\XINT_flet_sp? +{% + \ifx\XINT_token\XINT_sptoken + \xint_afterfi{\expandafter\XINT_flet_zapsp\romannumeral0}% + \else\expandafter\XINT_flet_macro + \fi +}% +\long\def\XINT_for #1#2in#3#4#5% +{% + \XINT_count #2\relax + \expandafter\XINT_toks\expandafter + {\expandafter\XINT_for_d\the\XINT_count{#5}}% + \def\XINT_flet_macro {\expandafter\XINT_for_forever?\space}% + \expandafter\XINT_flet_zapsp #3Z% +}% +\def\XINT_for_forever? #1Z% +{% + \ifx\XINT_token U\XINT_to_forever\fi + \ifx\XINT_token V\XINT_to_forever\fi + \ifx\XINT_token D\XINT_to_forever\fi + \expandafter\the\expandafter\XINT_toks\romannumeral0\xintcsvtolist {#1}Z% +}% +\def\XINT_to_forever\fi #1\xintcsvtolist #2{\fi \XINT_forever #2}% +\long\def\XINT_forx *#1#2in#3#4#5% +{% + \XINT_count #2\relax + \expandafter\XINT_toks\expandafter + {\expandafter\XINT_forx_d\the\XINT_count{#5}}% + \XINT_xflet\XINT_forx_forever? #3Z% +}% +\def\XINT_forx_forever? +{% + \ifx\XINT_token U\XINT_to_forxever\fi + \ifx\XINT_token V\XINT_to_forxever\fi + \ifx\XINT_token D\XINT_to_forxever\fi + \XINT_forx_empty? +}% +\def\XINT_to_forxever\fi #1\XINT_forx_empty? {\fi \XINT_forever }% +\catcode`U 11 +\catcode`D 11 +\catcode`V 11 +\def\XINT_forx_empty? +{% + \ifx\XINT_token Z\expandafter\xintBreakFor\fi + \the\XINT_toks +}% +\long\def\XINT_for_d #1#2#3% +{% + \long\def\XINT_y ##1##2##3##4##5##6##7##8##9{#2}% + \XINT_toks {{#3}}% + \long\edef\XINT_x {\noexpand\XINT_y \csname XINT_for_left#1\endcsname + \the\XINT_toks \csname XINT_for_right#1\endcsname }% + \XINT_toks {\XINT_x\let\xintifForFirst\xint_secondoftwo\XINT_for_d #1{#2}}% + \futurelet\XINT_token\XINT_for_last? +}% +\long\def\XINT_forx_d #1#2#3% +{% + \long\def\XINT_y ##1##2##3##4##5##6##7##8##9{#2}% + \XINT_toks {{#3}}% + \long\edef\XINT_x {\noexpand\XINT_y \csname XINT_for_left#1\endcsname + \the\XINT_toks \csname XINT_for_right#1\endcsname }% + \XINT_toks {\XINT_x\let\xintifForFirst\xint_secondoftwo\XINT_forx_d #1{#2}}% + \XINT_xflet\XINT_for_last? +}% +\def\XINT_for_last? +{% + \let\xintifForLast\xint_secondoftwo + \ifx\XINT_token Z\let\xintifForLast\xint_firstoftwo + \xint_afterfi{\xintBreakForAndDo\XINT_x}\fi + \the\XINT_toks +}% +\catcode`U 3 +\catcode`D 3 +\catcode`V 3 +\let\xintegers U% +\let\xintintegers U% +\let\xintdimensions D% +\let\xintrationals V% +\def\XINT_forever #1% +{% + \expandafter\XINT_forever_a + \csname XINT_?expr_\ifx#1UU\else\ifx#1DD\else V\fi\fi a\expandafter\endcsname + \csname XINT_?expr_\ifx#1UU\else\ifx#1DD\else V\fi\fi i\expandafter\endcsname + \csname XINT_?expr_\ifx#1UU\else\ifx#1DD\else V\fi\fi \endcsname +}% +\catcode`U 11 +\catcode`D 11 +\catcode`V 11 +\def\XINT_?expr_Ua #1#2% + {\expandafter{\expandafter\numexpr\the\numexpr #1\expandafter\relax + \expandafter\relax\expandafter}% + \expandafter{\the\numexpr #2}}% +\def\XINT_?expr_Da #1#2% + {\expandafter{\expandafter\dimexpr\number\dimexpr #1\expandafter\relax + \expandafter s\expandafter p\expandafter\relax\expandafter}% + \expandafter{\number\dimexpr #2}}% +\catcode`Z 11 +\def\XINT_?expr_Va #1#2% +{% + \expandafter\XINT_?expr_Vb\expandafter + {\romannumeral-`0\xintrawwithzeros{\xintZapSpacesB{#2}}}% + {\romannumeral-`0\xintrawwithzeros{\xintZapSpacesB{#1}}}% +}% +\catcode`Z 3 +\def\XINT_?expr_Vb #1#2{\expandafter\XINT_?expr_Vc #2.#1.}% +\def\XINT_?expr_Vc #1/#2.#3/#4.% +{% + \xintifEq {#2}{#4}% + {\XINT_?expr_Vf {#3}{#1}{#2}}% + {\expandafter\XINT_?expr_Vd\expandafter + {\romannumeral0\xintiimul {#2}{#4}}% + {\romannumeral0\xintiimul {#1}{#4}}% + {\romannumeral0\xintiimul {#2}{#3}}% + }% +}% +\def\XINT_?expr_Vd #1#2#3{\expandafter\XINT_?expr_Ve\expandafter {#2}{#3}{#1}}% +\def\XINT_?expr_Ve #1#2{\expandafter\XINT_?expr_Vf\expandafter {#2}{#1}}% +\def\XINT_?expr_Vf #1#2#3{{#2/#3}{{0}{#1}{#2}{#3}}}% +\def\XINT_?expr_Ui {{\numexpr 1\relax}{1}}% +\def\XINT_?expr_Di {{\dimexpr 0pt\relax}{65536}}% +\def\XINT_?expr_Vi {{1/1}{0111}}% +\def\XINT_?expr_U #1#2% + {\expandafter{\expandafter\numexpr\the\numexpr #1+#2\relax\relax}{#2}}% +\def\XINT_?expr_D #1#2% + {\expandafter{\expandafter\dimexpr\the\numexpr #1+#2\relax sp\relax}{#2}}% +\def\XINT_?expr_V #1#2{\XINT_?expr_Vx #2}% +\def\XINT_?expr_Vx #1#2% +{% + \expandafter\XINT_?expr_Vy\expandafter + {\romannumeral0\xintiiadd {#1}{#2}}{#2}% +}% +\def\XINT_?expr_Vy #1#2#3#4% +{% + \expandafter{\romannumeral0\xintiiadd {#3}{#1}/#4}{{#1}{#2}{#3}{#4}}% +}% +\def\XINT_forever_a #1#2#3#4% +{% + \ifx #4[\expandafter\XINT_forever_opt_a + \else\expandafter\XINT_forever_b + \fi #1#2#3#4% +}% +\def\XINT_forever_b #1#2#3Z{\expandafter\XINT_forever_c\the\XINT_toks #2#3}% +\long\def\XINT_forever_c #1#2#3#4#5% + {\expandafter\XINT_forever_d\expandafter #2#4#5{#3}Z}% +\def\XINT_forever_opt_a #1#2#3[#4+#5]#6Z% +{% + \expandafter\expandafter\expandafter + \XINT_forever_opt_c\expandafter\the\expandafter\XINT_toks + \romannumeral-`0#1{#4}{#5}#3% +}% +\long\def\XINT_forever_opt_c #1#2#3#4#5#6{\XINT_forever_d #2{#4}{#5}#6{#3}Z}% +\long\def\XINT_forever_d #1#2#3#4#5% +{% + \long\def\XINT_y ##1##2##3##4##5##6##7##8##9{#5}% + \XINT_toks {{#2}}% + \long\edef\XINT_x {\noexpand\XINT_y \csname XINT_for_left#1\endcsname + \the\XINT_toks \csname XINT_for_right#1\endcsname }% + \XINT_x + \let\xintifForFirst\xint_secondoftwo + \expandafter\XINT_forever_d\expandafter #1\romannumeral-`0#4{#2}{#3}#4{#5}% +}% +\catcode`j 3 +\long\def\xintForpair #1#2#3in#4#5#6% +{% + \let\xintifForFirst\xint_firstoftwo + \XINT_toks {\XINT_forpair_d #2{#6}}% + \expandafter\the\expandafter\XINT_toks #4jZ% +}% +\long\def\XINT_forpair_d #1#2#3(#4)#5% +{% + \long\def\XINT_y ##1##2##3##4##5##6##7##8##9{#2}% + \XINT_toks \expandafter{\romannumeral0\xintcsvtolist{ #4}}% + \long\edef\XINT_x {\noexpand\XINT_y \csname XINT_for_left#1\endcsname + \the\XINT_toks \csname XINT_for_right\the\numexpr#1+1\endcsname}% + \let\xintifForLast\xint_secondoftwo + \ifx #5j\let\xintifForLast\xint_firstoftwo\expandafter\xintBreakForAndDo\fi + \XINT_x\let\xintifForFirst\xint_secondoftwo\XINT_forpair_d #1{#2}% +}% +\long\def\xintForthree #1#2#3in#4#5#6% +{% + \let\xintifForFirst\xint_firstoftwo + \XINT_toks {\XINT_forthree_d #2{#6}}% + \expandafter\the\expandafter\XINT_toks #4jZ% +}% +\long\def\XINT_forthree_d #1#2#3(#4)#5% +{% + \long\def\XINT_y ##1##2##3##4##5##6##7##8##9{#2}% + \XINT_toks \expandafter{\romannumeral0\xintcsvtolist{ #4}}% + \long\edef\XINT_x {\noexpand\XINT_y \csname XINT_for_left#1\endcsname + \the\XINT_toks \csname XINT_for_right\the\numexpr#1+2\endcsname}% + \let\xintifForLast\xint_secondoftwo + \ifx #5j\let\xintifForLast\xint_firstoftwo\expandafter\xintBreakForAndDo\fi + \XINT_x\let\xintifForFirst\xint_secondoftwo\XINT_forthree_d #1{#2}% +}% +\long\def\xintForfour #1#2#3in#4#5#6% +{% + \let\xintifForFirst\xint_firstoftwo + \XINT_toks {\XINT_forfour_d #2{#6}}% + \expandafter\the\expandafter\XINT_toks #4jZ% +}% +\long\def\XINT_forfour_d #1#2#3(#4)#5% +{% + \long\def\XINT_y ##1##2##3##4##5##6##7##8##9{#2}% + \XINT_toks \expandafter{\romannumeral0\xintcsvtolist{ #4}}% + \long\edef\XINT_x {\noexpand\XINT_y \csname XINT_for_left#1\endcsname + \the\XINT_toks \csname XINT_for_right\the\numexpr#1+3\endcsname}% + \let\xintifForLast\xint_secondoftwo + \ifx #5j\let\xintifForLast\xint_firstoftwo\expandafter\xintBreakForAndDo\fi + \XINT_x\let\xintifForFirst\xint_secondoftwo\XINT_forfour_d #1{#2}% +}% +\catcode`Z 11 +\catcode`j 11 +\def\xintAssign #1\to +{% + \expandafter\XINT_assign_a\romannumeral-`0#1{}\to +}% +\def\XINT_assign_a #1% attention to the # at the beginning of next line +#{% + \def\xint_temp {#1}% + \ifx\empty\xint_temp + \expandafter\XINT_assign_b + \else + \expandafter\XINT_assign_B + \fi +}% +\def\XINT_assign_b #1#2\to #3% +{% + \edef #3{#1}\def\xint_temp {#2}% + \ifx\empty\xint_temp + \else + \xint_afterfi{\XINT_assign_a #2\to }% + \fi +}% +\def\XINT_assign_B #1\to #2% +{% + \edef #2{\xint_temp}% +}% +\def\xintRelaxArray #1% +{% + \edef\XINT_restoreescapechar {\escapechar\the\escapechar\relax}% + \escapechar -1 + \edef\xint_arrayname {\string #1}% + \XINT_restoreescapechar + \expandafter\let\expandafter\xint_temp + \csname\xint_arrayname 0\endcsname + \XINT_count 0 + \loop + \global\expandafter\let + \csname\xint_arrayname\the\XINT_count\endcsname\relax + \ifnum \XINT_count < \xint_temp + \advance\XINT_count 1 + \repeat + \global\expandafter\let\csname\xint_arrayname 00\endcsname\relax + \global\let #1\relax +}% +\def\xintAssignArray #1\to #2% 1.06b: #1 may now be empty +{% + \edef\XINT_restoreescapechar {\escapechar\the\escapechar\relax }% + \escapechar -1 + \edef\xint_arrayname {\string #2}% + \XINT_restoreescapechar + \XINT_count 0 + \expandafter\XINT_assignarray_loop \romannumeral-`0#1\xint_relax + \csname\xint_arrayname 00\endcsname + \csname\xint_arrayname 0\endcsname + {\xint_arrayname}% + #2% +}% +\def\XINT_assignarray_loop #1% +{% + \def\xint_temp {#1}% + \ifx\xint_brelax\xint_temp + \expandafter\edef\csname\xint_arrayname 0\endcsname{\the\XINT_count }% + \expandafter\expandafter\expandafter\XINT_assignarray_end_a + \else + \advance\XINT_count 1 + \expandafter\edef + \csname\xint_arrayname\the\XINT_count\endcsname{\xint_temp }% + \expandafter\XINT_assignarray_loop + \fi +}% +\def\XINT_assignarray_end_a #1% +{% + \expandafter\XINT_assignarray_end_b\expandafter #1% +}% +\def\XINT_assignarray_end_b #1#2#3% +{% + \expandafter\XINT_assignarray_end_c + \expandafter #1\expandafter #2\expandafter {#3}% +}% +\def\XINT_assignarray_end_c #1#2#3#4% +{% + \def #4##1% + {% + \romannumeral0\expandafter #1\expandafter{\the\numexpr ##1}% + }% + \def #1##1% + {% + \ifnum ##1< 0 + \xint_afterfi {\xintError:ArrayIndexIsNegative\space 0}% + \else + \xint_afterfi {% + \ifnum ##1>#2 + \xint_afterfi {\xintError:ArrayIndexBeyondLimit\space 0}% + \else + \xint_afterfi + {\expandafter\expandafter\expandafter + \space\csname #3##1\endcsname}% + \fi}% + \fi + }% +}% +\let\xintDigitsOf\xintAssignArray +\XINT_restorecatcodes_endinput% +\endinput +%% +%% End of file `xinttools.sty'. |