From 002c21425ce199a6ec027abc714d843785de1269 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 7 Aug 2017 21:08:44 +0000 Subject: xint (7aug17) git-svn-id: svn://tug.org/texlive/trunk@44975 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/generic/xint/xint.dtx | 822 ++++++++++++------------- Master/texmf-dist/source/generic/xint/xint.ins | 2 +- 2 files changed, 395 insertions(+), 429 deletions(-) (limited to 'Master/texmf-dist/source/generic') diff --git a/Master/texmf-dist/source/generic/xint/xint.dtx b/Master/texmf-dist/source/generic/xint/xint.dtx index 0c3e58ba9cc..24d5b76835c 100644 --- a/Master/texmf-dist/source/generic/xint/xint.dtx +++ b/Master/texmf-dist/source/generic/xint/xint.dtx @@ -3,27 +3,27 @@ % Extract all files via "etex xint.dtx" and do "make help" % or follow instructions from extracted README.md. %<*dtx> -\def\xintdtxtimestamp {Time-stamp: <31-07-2017 at 22:49:40 CEST>} +\def\xintdtxtimestamp {Time-stamp: <06-08-2017 at 23:22:42 CEST>} % %<*drv> %% --------------------------------------------------------------- -\def\xintdocdate {2017/07/31} -\def\xintbndldate{2017/07/31} -\def\xintbndlversion {1.2m} +\def\xintdocdate {2017/08/06} +\def\xintbndldate{2017/08/06} +\def\xintbndlversion {1.2n} % %% README %% CHANGE LOG -%% xint 1.2m -%% 2017/07/31 +%% xint 1.2n +%% 2017/08/06 % -% Source: xint.dtx 1.2m 2017/07/31 (doc 2017/07/31) +% Source: xint.dtx 1.2n 2017/08/06 (doc 2017/08/06) % Author: Jean-Francois Burnol % Info: Expandable operations on big integers, decimals, fractions % License: LPPL 1.3c % %<*!readme&!changes&!dohtmlsh&!dopdfsh&!makefile> %% --------------------------------------------------------------- -%% The xint bundle 1.2m 2017/07/31 +%% The xint bundle 1.2n 2017/08/06 %% Copyright (C) 2013-2017 by Jean-Francois Burnol %%% xintkernel: Paraphernalia for the xint packages %%% xinttools: Expandable and non-expandable utilities @@ -100,7 +100,7 @@ automatically loads `xintfrac` which itself loads `xint`; but use of the `xintbinhex`. Package `xintcore` is the subset of `xint` providing only the five -operations on big integers: `\xintiiAdd`, `\xintiiMul`,\ ... It is (by +operations on big integers: `\xintiiAdd`, `\xintiiMul`, ... It is (by default) loaded by the (LaTeX only) package [bnumexpr](http://www.ctan.org/pkg/bnumexpr) which provides a more light-weight expression parser handling only big integers, the four @@ -250,6 +250,22 @@ Makefile.mk. %-------------------------------------------------------- %<*changes>------------------------------------------------------- +`1.2n (2017/08/06)` +---- + +### Incompatible changes + + - **xintbinhex** does not load package **xintcore** anymore, but only + **xintkernel**. + +### Improvements and new features + + - **xintbinhex** has only **xintkernel** as dependency. + + - Macros of **xintbinhex** have been improved for speed and increased maximal + sizes of allowable inputs. + + `1.2m (2017/07/31)` ---- @@ -3217,8 +3233,8 @@ pdfpagemode=UseOutlines} \node [block, below left of=A] (tools) {\xinttoolsname}; \node [block, right of=core, xshift=1cm] (bnumexpr) {\href{http://www.ctan.org/pkg/bnumexpr}{bnumexpr}}; \node [block, below of=core] (xint) {\xintname}; - \node [block, left of=xint, xshift=-.5cm] (binhex) {\xintbinhexname}; - \node [block, left of=binhex] (gcd) {\xintgcdname}; + \node [block, left of=xint, xshift=-.5cm] (gcd) {\xintgcdname}; + \node [block, left of=gcd] (binhex) {\xintbinhexname}; \node [block, below of=xint] (frac) {\xintfracname}; \node [block, below of=frac, yshift=-.5cm] (expr) {\xintexprname}; \node [block, below right of=frac, xshift=1cm] (cfrac) {\xintcfracname}; @@ -3228,7 +3244,7 @@ pdfpagemode=UseOutlines} \path [line,-{Stealth[length=5mm]}] (kernel) -- (tools); \path [line,-{Stealth[length=5mm]}] (core) -- (bnumexpr); \path [line,-{Stealth[length=5mm]}] (core) to [out=180,in=90] (gcd.north); - \path [line,-{Stealth[length=5mm]}] (core) to [out=180,in=90] (binhex.north); + \path [line,-{Stealth[length=5mm]}] (kernel) -- (binhex); \path [line,-{Stealth[length=5mm]}] (core) -- (xint); \path [line,-{Stealth[length=5mm]}] (xint) -- (frac); \path [line,-{Stealth[length=5mm]}] (frac) -- (expr); @@ -3236,8 +3252,8 @@ pdfpagemode=UseOutlines} \path [line,-{Stealth[length=5mm]}] (frac) to [out=0,in=90] (cfrac.north); \path [line,dashed,-{Stealth[length=5mm]}] (binhex.south) -- (expr); \path [line,dashed,-{Stealth[length=5mm]}] (gcd.south) -- (expr); - \path [line,dashed,-{Stealth[length=5mm]}] (tools) -- (gcd); -% \path [line,dashed,-{Stealth[length=5mm]}] (tools) to [out=270,in=180] (frac); + \path [line,dashed,-{Stealth[length=5mm]}] (tools) to [out=0, in=90] + (gcd.north);% je dois positionner mieux mais pas le temps de lire 700 pages \path [line,-{Stealth[length=5mm]}] (tools) to [out=270,in=180] (expr); \end{tikzpicture}}\bigskip \end{figure} @@ -3254,8 +3270,8 @@ pdfpagemode=UseOutlines} functionalities of the lower module it is necessary to use the suitable |\usepackage| (\LaTeX) or |\input| (Plain \TeX.)\par - Notice that since |1.2i| the macro \csbxint{XTrunc} does not cause a - partial dependency of \xintfracname on \xinttoolsname anymore.\par + Note: at |1.2n| \xintbinhexname has no dependency on \xintcorename + anymore, it only loads \xintkernelname. The \href{http://ctan.org/pkg/bnumexpr}{bnumexpr} package is a separate package (\LaTeX{} only) by the author which uses (by default) @@ -13319,18 +13335,56 @@ principles are necessarily different due to the aim of achieving expandability. \localtableofcontents -This package provides expandable conversions of arbitrarily big integers to +This package provides expandable conversions of (big) integers to and from binary and hexadecimal. It was first included in the |1.08| (|2013/06/07|) release of \xintname. Its routines remained un-modified until their complete rewrite at release |1.2m| (|2017/07/31|). The new macros are faster, using techniques from the |1.2| (|2015/10/10|) release of \xintcorename. But the inputs are now limited to a -few thousand characters (check next for the respective maxima, the values -given have a safety margin for nested contexts). +few thousand digits, whereas the |1.08| could handle (slowly...) tens of +thousands of digits. + +\autoref{tab:binhexsizes} recapitulates the maximal allowed sizes (they got +increased at |1.2n|)\CHANGED{1.2n}: +for macro |\xintFooToBar| in the first column, the value in the second column +is the maximal |N| such that |\edef\X{\xintFooToBar{}}| does not +raise an error with standard \TeX\ memory parameters (input stack +size=\dtt{5000}, expansion depth=\dtt{10000}, parameter stack +size=\dtt{10000}). The tests were done with TL2017 and |etex|. Nested calls +will allow slightly lesser values only. The third column gives the +corresponding maximal size of output. The fourth column gives the \TeX\ +parameter cited in the error message when trying with |N+1| digits. -The argument is first \fexpan ded. +\begin{table}[htbp] +\capstart + \centering +\def\E#1#2!{\edef\F{\the\numexpr(#1-\xintLength{#2})/2}% + \relax\romannumeral\xintreplicate{\F}{ }#2% + \romannumeral\xintreplicate{#1-\F-\xintLength{#2}}{ }\relax}% +% non satisfactory because depends on #1 oddness, but well. Temporary destined +% to stay... +\begin{tabular}{r>{\E{19}}c<{!}>{\E{19}}c<{!}r} + \hline + &Max\ length\ of\ input&->\ length\ of\ output&Limiting factor\\ + \csbxint{DecToHex}&6014&4995&input stack size=5000\\ + \csbxint{DecToBin}&6014&19979&input stack size=5000\\ + \csbxint{HexToDec}&8298&9992&input stack size=5000\\ + \csbxint{BinToDec}&19988&6017&input stack size=5000\\ + \csbxint{BinToHex}&19988&4997&input stack size=5000\\ + \csbxint{HexToBin}&4996&19984&input stack size=5000\\ + \csbxint{CHexToBin}&4997&19988&input stack size=5000\\ + \hline +\end{tabular} +\caption{Maximal sizes of inputs (at \texttt{1.2n}) for \xintbinhexname macros}\label{tab:binhexsizes} +\end{table} + +Roughly, base |10| numbers are limited to \dtt{6000} digits, hexadecimal +numbers to (almost) \dtt{5000} digits, and binary numbers to (almost) +\dtt{20000} digits. With the surprising exception of \csbxint{HexToDec} which +allows almost \dtt{8300} hexadecimal digits on input.\CHANGED{1.2n} +The argument is first \fexpan ded. It may optionally have a unique leading minus sign (a plus sign is not allowed), and leading zeroes. @@ -13363,7 +13417,8 @@ binary, decimal, or hexadecimal notation. With this package loaded additionally to \xintexprname, hexadecimal input is possible in expressions: simply by using the prefix |"|. Such hexadecimal -numbers may have a fractional part. Lowercase letters are allowed there. +numbers may have a fractional part. Lowercase hexadecimal letters are +currently \emph{not} recognized as such in expressions. Currently the |p| postfix notation from standard programming languages given a power of two multiplicand is not implemented. @@ -13373,27 +13428,18 @@ power of two multiplicand is not implemented. Converts from decimal to hexadecimal.\etype{f} -Input limited to |4000| digits (only a few more allowed) with standard \TeX\ -settings.\CHANGED{1.2m} - \texttt{\string\xintDecToHex \string{\printnumber{2718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427427466391932003}\string}}\endgraf\noindent\dtt{->\printnumber{\xintDecToHex{2718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427427466391932003}}} \subsection{\csbh{xintDecToBin}}\label{xintDecToBin} Converts from decimal to binary.\etype{f} -Input limited to |4000| digits (only a few more allowed) with standard \TeX\ -settings.\CHANGED{1.2m} - \texttt{\string\xintDecToBin \string{\printnumber{2718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427427466391932003}\string}}\endgraf\noindent\dtt{->\printnumber{\xintDecToBin{2718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427427466391932003}}} \subsection{\csbh{xintHexToDec}}\label{xintHexToDec} Converts from hexadecimal to decimal.\etype{f} -Input limited to about |5500| hexadecimal digits with standard \TeX\ -settings.\CHANGED{1.2m} - \texttt{\string\xintHexToDec \string{\printnumber{11A9397C66949A97051F7D0A817914E3E0B17C41B11C48BAEF2B5760BB38D272F46DCE46C6032936BF37DAC918814C63}\string}}\endgraf\noindent \dtt{->\printnumber{\xintHexToDec{11A9397C66949A97051F7D0A817914E3E0B17C41B11C48BAEF2B5760BB38D272F46DCE46C6032936BF37DAC918814C63}}} @@ -13402,9 +13448,6 @@ settings.\CHANGED{1.2m} Converts from binary to decimal.\etype{f} -Input limited to about |19950| binary digits with standard \TeX\ -settings.\CHANGED{1.2m} - \texttt{\string\xintBinToDec \string{\printnumber{100011010100100111001011111000110011010010100100110101001011100000101000111110111110100001010100000010111100100010100111000111110000010110001011111000100000110110001000111000100100010111010111011110010101101010111011000001011101100111000110100100111001011110100011011011100111001000110110001100000001100101001001101101011111100110111110110101100100100011000100000010100110001100011}\string}}\endgraf\noindent \dtt{->\printnumber{\xintBinToDec{100011010100100111001011111000110011010010100100110101001011100000101000111110111110100001010100000010111100100010100111000111110000010110001011111000100000110110001000111000100100010111010111011110010101101010111011000001011101100111000110100100111001011110100011011011100111001000110110001100000001100101001001101101011111100110111110110101100100100011000100000010100110001100011}}} @@ -13413,9 +13456,6 @@ settings.\CHANGED{1.2m} Converts from binary to hexadecimal.\etype{f} -Input limited to about |13300| binary digits with standard \TeX\ -settings.\CHANGED{1.2m} - \texttt{\string\xintBinToHex \string{\printnumber{100011010100100111001011111000110011010010100100110101001011100000101000111110111110100001010100000010111100100010100111000111110000010110001011111000100000110110001000111000100100010111010111011110010101101010111011000001011101100111000110100100111001011110100011011011100111001000110110001100000001100101001001101101011111100110111110110101100100100011000100000010100110001100011}\string}}\endgraf\noindent \dtt{->\printnumber{\xintBinToHex{100011010100100111001011111000110011010010100100110101001011100000101000111110111110100001010100000010111100100010100111000111110000010110001011111000100000110110001000111000100100010111010111011110010101101010111011000001011101100111000110100100111001011110100011011011100111001000110110001100000001100101001001101101011111100110111110110101100100100011000100000010100110001100011}}} @@ -13425,9 +13465,6 @@ settings.\CHANGED{1.2m} Converts from hexadecimal to binary. Up to three leading zeroes of the output are trimmed.\etype{f} -Input limited to about |4950| hexadecimal digits with standard \TeX\ -settings.\CHANGED{1.2m} - \texttt{\string\xintHexToBin \string{\printnumber{11A9397C66949A97051F7D0A817914E3E0B17C41B11C48BAEF2B5760BB38D272F46DCE46C6032936BF37DAC918814C63}\string}}\endgraf\noindent \dtt{->\printnumber{\xintHexToBin{11A9397C66949A97051F7D0A817914E3E0B17C41B11C48BAEF2B5760BB38D272F46DCE46C6032936BF37DAC918814C63}}} @@ -13438,9 +13475,6 @@ Converts from hexadecimal to binary.\etype{f} Same as \csbxint{HexToBin}, but an input with |N| hexadecimal digits will give an output with exactly |4N| binary digits, leading zeroes are not trimmed.\CHANGED{1.2m} -Input limited to about |4950| hexadecimal digits with standard \TeX\ -settings. - \texttt{\string\xintCHexToBin \string{\printnumber{11A9397C66949A97051F7D0A817914E3E0B17C41B11C48BAEF2B5760BB38D272F46DCE46C6032936BF37DAC918814C63}\string}}\endgraf\noindent \dtt{->\printnumber{\xintCHexToBin{11A9397C66949A97051F7D0A817914E3E0B17C41B11C48BAEF2B5760BB38D272F46DCE46C6032936BF37DAC918814C63}}} @@ -15334,6 +15368,13 @@ $1$ or $-1$. % This is \expandafter|\xintbndlversion| of \expandafter|\xintbndldate|. % % \begin{itemize} +% +% \item Release |1.2n| of |2017/08/06| modified \xintbinhexnameimp to depend +% only on \xintkernelnameimp: it does not load \xintcorenameimp anymore. +% Also, macros were rewritten and in particular conversion from decimal +% allows bigger arguments (up to around |6000| rather than |4000| digits as +% in |1.2m|). +% % \item Release |1.2m| of |2017/07/31| has rewritten entirely the % \xintbinhexnameimp module. The new routines (in the style of the |1.2| % from \xintcorenameimp) are faster (depending on the macro |1.5x--2.5x| @@ -15572,7 +15613,7 @@ $1$ or $-1$. \fi \XINT_providespackage \ProvidesPackage {xintkernel}% - [2017/07/31 1.2m Paraphernalia for the xint packages (JFB)]% + [2017/08/06 1.2n Paraphernalia for the xint packages (JFB)]% % \end{macrocode} % \subsection{Constants} % \begin{macrocode} @@ -16158,7 +16199,7 @@ $1$ or $-1$. % \begin{macrocode} \XINT_providespackage \ProvidesPackage{xinttools}% - [2017/07/31 1.2m Expandable and non-expandable utilities (JFB)]% + [2017/08/06 1.2n Expandable and non-expandable utilities (JFB)]% % \end{macrocode} % \lverb|\XINT_toks is used in macros such as \xintFor. It is not used % elsewhere in the xint bundle.| @@ -18062,7 +18103,7 @@ $1$ or $-1$. % \begin{macrocode} \XINT_providespackage \ProvidesPackage{xintcore}% - [2017/07/31 1.2m Expandable arithmetic on big integers (JFB)]% + [2017/08/06 1.2n Expandable arithmetic on big integers (JFB)]% % \end{macrocode} % \subsection{(WIP!) Error conditions and exceptions} % \lverb|As per the Mike Cowlishaw/IBM's General Decimal Arithmetic Specification @@ -18205,7 +18246,9 @@ $1$ or $-1$. \ifdefined\m@ne\let\xint_c_mone\m@ne \else\csname newcount\endcsname\xint_c_mone \xint_c_mone -1 \fi \newcount\xint_c_x^viii \xint_c_x^viii 100000000 -\newcount\xint_c_x^ix \xint_c_x^ix 1000000000 +\ifdefined\xint_c_x^ix\else +\csname newcount\endcsname\xint_c_x^ix \xint_c_x^ix 1000000000 +\fi \newcount\xint_c_x^viii_mone \xint_c_x^viii_mone 99999999 \newcount\xint_c_xii_e_viii \xint_c_xii_e_viii 1200000000 \newcount\xint_c_xi_e_viii_mone \xint_c_xi_e_viii_mone 1099999999 @@ -18696,33 +18739,6 @@ $1$ or $-1$. }% \def\XINT_unsep_clean 1{\relax}% % \end{macrocode} -% \subsection{\csh{XINT_unsepb_loop}} -% -% \lverb|This is used as -%( \the\numexpr0\XINT_unsepb_loop (blocks of digits with ! as separator)% -%: \xint_bye!2!3!4!5!6!7!8!9!\xint_bye\xint_c_i\relax -%) -% It removes the !'s and outputs the digits (being careful not to suppress -% leading zeroes) with a 0 prefix to remove later. Each block is allowed up to -% nine digits. -% -% This is the same as \XINT_unsep_loop except that the digits blocks have no -% 1-prefix. Used by \xintHexToDec of 1.2m.| -% \begin{macrocode} -\def\XINT_unsepb_loop #1!#2!#3!#4!#5!#6!#7!#8!#9!% -{% - \expandafter\XINT_unsep_clean - \the\numexpr 1#1\expandafter\XINT_unsep_clean - \the\numexpr 1#2\expandafter\XINT_unsep_clean - \the\numexpr 1#3\expandafter\XINT_unsep_clean - \the\numexpr 1#4\expandafter\XINT_unsep_clean - \the\numexpr 1#5\expandafter\XINT_unsep_clean - \the\numexpr 1#6\expandafter\XINT_unsep_clean - \the\numexpr 1#7\expandafter\XINT_unsep_clean - \the\numexpr 1#8\expandafter\XINT_unsep_clean - \the\numexpr 1#9\XINT_unsepb_loop -}% -% \end{macrocode} % \subsection{\csh{XINT_unsep_cuzsmall}} % % \lverb|This is used as @@ -18813,21 +18829,6 @@ $1$ or $-1$. \expandafter#1\xint_gob_til_one ##2##3##4##5##6##7##8% }}\XINT_zeroes_forviii_end{ }% % \end{macrocode} -% \subsection{\csh{XINT_zeroes_foriv}} -% \lverb|& -%( \romannumeral0\XINT_zeroes_foriv #1\R{0\R}{00\R}{000\R}% -%: \R{0\R}{00\R}{000\R}\R\W -%) -% Helper macro needed by 1.2m \xintHexToDec of xintbinhex.| -% \begin{macrocode} -\def\XINT_zeroes_foriv #1#2#3#4#5#6#7#8% -{% - \xint_gob_til_R #8\XINT_zeroes_foriv_end\R\XINT_zeroes_foriv -}% -\def\XINT_zeroes_foriv_end\R\XINT_zeroes_foriv #1#2\W - {\XINT_zeroes_foriv_done #1}% -\def\XINT_zeroes_foriv_done #1\R{ #1}% -% \end{macrocode} % \subsection{\csh{XINT_sepbyviii_Z}} % % \lverb|This is used as @@ -21394,7 +21395,7 @@ $1$ or $-1$. % \begin{macrocode} \XINT_providespackage \ProvidesPackage{xint}% - [2017/07/31 1.2m Expandable operations on big integers (JFB)]% + [2017/08/06 1.2n Expandable operations on big integers (JFB)]% % \end{macrocode} % \subsection{More token management} % \begin{macrocode} @@ -23352,6 +23353,14 @@ $1$ or $-1$. % The macros from |1.08| (|2013/06/07|) remained unchanged % until their complete rewrite at |1.2m| (|2017/07/31|). % +% At |1.2n| dependencies on \xintcorenameimp were removed, so now the package +% loads only \xintkernelnameimp (this could have been done earlier). +% +% Also at |1.2n|, macros evolved again, the main improvements being in the +% increased allowable sizes of the input for |\xintDecToHex|, |\xintDecToBin|, +% |\xintBinToHex|. Use of |\csname| governed expansion at some places rather +% than |\numexpr| with some clean-up after it. +% % \subsection{Catcodes, \protect\eTeX{} and reload detection} % % The code for reload detection was initially copied from \textsc{Heiko @@ -23374,7 +23383,7 @@ $1$ or $-1$. \catcode58=12 % : \let\z\endgroup \expandafter\let\expandafter\x\csname ver@xintbinhex.sty\endcsname - \expandafter\let\expandafter\w\csname ver@xintcore.sty\endcsname + \expandafter\let\expandafter\w\csname ver@xintkernel.sty\endcsname \expandafter \ifx\csname PackageInfo\endcsname\relax \def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}% @@ -23387,15 +23396,15 @@ $1$ or $-1$. \aftergroup\endinput \else \ifx\x\relax % plain-TeX, first loading of xintbinhex.sty - \ifx\w\relax % but xintcore.sty not yet loaded. - \def\z{\endgroup\input xintcore.sty\relax}% + \ifx\w\relax % but xintkernel.sty not yet loaded. + \def\z{\endgroup\input xintkernel.sty\relax}% \fi \else \def\empty {}% \ifx\x\empty % LaTeX, first loading, % variable is initialized, but \ProvidesPackage not yet seen - \ifx\w\relax % xintcore.sty not yet loaded. - \def\z{\endgroup\RequirePackage{xintcore}}% + \ifx\w\relax % xintkernel.sty not yet loaded. + \def\z{\endgroup\RequirePackage{xintkernel}}% \fi \else \aftergroup\endinput % xintbinhex already loaded. @@ -23409,97 +23418,112 @@ $1$ or $-1$. % \begin{macrocode} \XINT_providespackage \ProvidesPackage{xintbinhex}% - [2017/07/31 1.2m Expandable binary and hexadecimal conversions (JFB)]% + [2017/08/06 1.2n Expandable binary and hexadecimal conversions (JFB)]% % \end{macrocode} % \subsection{Constants, etc...} +% \lverb|1.2n switches to \csname-governed expansion at various places.| % \begin{macrocode} \newcount\xint_c_ii^xv \xint_c_ii^xv 32768 \newcount\xint_c_ii^xvi \xint_c_ii^xvi 65536 -\newcount\xint_c_x^v \xint_c_x^v 100000 \def\XINT_tmpa #1{\ifx\relax#1\else - \expandafter\edef\csname XINT_sdth_#1\endcsname - {\ifcase #1 0\or 1\or 2\or 3\or 4\or 5\or 6\or 7\or - 8\or 9\or A\or B\or C\or D\or E\or F\else\space\fi}% + \expandafter\edef\csname XINT_csdth_#1\endcsname + {\endcsname\ifcase #1 0\or 1\or 2\or 3\or 4\or 5\or 6\or 7\or + 8\or 9\or A\or B\or C\or D\or E\or F\fi}% \expandafter\XINT_tmpa\fi }% -\XINT_tmpa {-1}{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}{14}{15}\relax +\XINT_tmpa {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}{14}{15}\relax \def\XINT_tmpa #1{\ifx\relax#1\else - \expandafter\edef\csname XINT_sdtb_#1\endcsname - {\ifcase #1 + \expandafter\edef\csname XINT_csdtb_#1\endcsname + {\endcsname\ifcase #1 0000\or 0001\or 0010\or 0011\or 0100\or 0101\or 0110\or 0111\or - 1000\or 1001\or 1010\or 1011\or 1100\or 1101\or 1110\or 1111\else\space\fi}% + 1000\or 1001\or 1010\or 1011\or 1100\or 1101\or 1110\or 1111\fi}% \expandafter\XINT_tmpa\fi }% -\XINT_tmpa {-1}{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}{14}{15}\relax +\XINT_tmpa {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}{14}{15}\relax \let\XINT_tmpa\relax -\expandafter\def\csname XINT_sbth_0000\endcsname {0}% -\expandafter\def\csname XINT_sbth_0001\endcsname {1}% -\expandafter\def\csname XINT_sbth_0010\endcsname {2}% -\expandafter\def\csname XINT_sbth_0011\endcsname {3}% -\expandafter\def\csname XINT_sbth_0100\endcsname {4}% -\expandafter\def\csname XINT_sbth_0101\endcsname {5}% -\expandafter\def\csname XINT_sbth_0110\endcsname {6}% -\expandafter\def\csname XINT_sbth_0111\endcsname {7}% -\expandafter\def\csname XINT_sbth_1000\endcsname {8}% -\expandafter\def\csname XINT_sbth_1001\endcsname {9}% -\expandafter\def\csname XINT_sbth_1010\endcsname {10}% -\expandafter\def\csname XINT_sbth_1011\endcsname {11}% -\expandafter\def\csname XINT_sbth_1100\endcsname {12}% -\expandafter\def\csname XINT_sbth_1101\endcsname {13}% -\expandafter\def\csname XINT_sbth_1110\endcsname {14}% -\expandafter\def\csname XINT_sbth_1111\endcsname {15}% -\expandafter\def\csname XINT_sbth_1010\endcsname {A}% -\expandafter\def\csname XINT_sbth_1011\endcsname {B}% -\expandafter\def\csname XINT_sbth_1100\endcsname {C}% -\expandafter\def\csname XINT_sbth_1101\endcsname {D}% -\expandafter\def\csname XINT_sbth_1110\endcsname {E}% -\expandafter\def\csname XINT_sbth_1111\endcsname {F}% -\let\XINT_sbth_none \empty -\expandafter\def\csname XINT_shtb_0\endcsname {0000}% -\expandafter\def\csname XINT_shtb_1\endcsname {0001}% -\expandafter\def\csname XINT_shtb_2\endcsname {0010}% -\expandafter\def\csname XINT_shtb_3\endcsname {0011}% -\expandafter\def\csname XINT_shtb_4\endcsname {0100}% -\expandafter\def\csname XINT_shtb_5\endcsname {0101}% -\expandafter\def\csname XINT_shtb_6\endcsname {0110}% -\expandafter\def\csname XINT_shtb_7\endcsname {0111}% -\expandafter\def\csname XINT_shtb_8\endcsname {1000}% -\expandafter\def\csname XINT_shtb_9\endcsname {1001}% -\def\XINT_shtb_A {1010}% -\def\XINT_shtb_B {1011}% -\def\XINT_shtb_C {1100}% -\def\XINT_shtb_D {1101}% -\def\XINT_shtb_E {1110}% -\def\XINT_shtb_F {1111}% -\let\XINT_shtb_none \empty -\def\XINT_smallhex #1!% -{% - \expandafter\XINT_smallhex_a - \the\numexpr (#1+\xint_c_viii)/\xint_c_xvi-\xint_c_i\xint:#1\xint: -}% -\def\XINT_smallhex_a #1\xint:#2\xint: -{% - \csname XINT_sdth_#1\expandafter\expandafter\expandafter\endcsname - \csname XINT_sdth_\the\numexpr #2-\xint_c_xvi*#1\relax\expandafter\endcsname - \romannumeral`&&@% -}% -\def\XINT_smallbin #1!% -{% - \expandafter\XINT_smallbin_a - \the\numexpr (#1+\xint_c_viii)/\xint_c_xvi-\xint_c_i\xint:#1\xint: -}% -\def\XINT_smallbin_a #1\xint:#2\xint: -{% - \csname XINT_sdtb_#1\expandafter\expandafter\expandafter\endcsname - \csname XINT_sdtb_\the\numexpr #2-\xint_c_xvi*#1\relax\expandafter\endcsname - \romannumeral`&&@% +\expandafter\def\csname XINT_csbth_0000\endcsname {\endcsname0}% +\expandafter\def\csname XINT_csbth_0001\endcsname {\endcsname1}% +\expandafter\def\csname XINT_csbth_0010\endcsname {\endcsname2}% +\expandafter\def\csname XINT_csbth_0011\endcsname {\endcsname3}% +\expandafter\def\csname XINT_csbth_0100\endcsname {\endcsname4}% +\expandafter\def\csname XINT_csbth_0101\endcsname {\endcsname5}% +\expandafter\def\csname XINT_csbth_0110\endcsname {\endcsname6}% +\expandafter\def\csname XINT_csbth_0111\endcsname {\endcsname7}% +\expandafter\def\csname XINT_csbth_1000\endcsname {\endcsname8}% +\expandafter\def\csname XINT_csbth_1001\endcsname {\endcsname9}% +\expandafter\def\csname XINT_csbth_1010\endcsname {\endcsname A}% +\expandafter\def\csname XINT_csbth_1011\endcsname {\endcsname B}% +\expandafter\def\csname XINT_csbth_1100\endcsname {\endcsname C}% +\expandafter\def\csname XINT_csbth_1101\endcsname {\endcsname D}% +\expandafter\def\csname XINT_csbth_1110\endcsname {\endcsname E}% +\expandafter\def\csname XINT_csbth_1111\endcsname {\endcsname F}% +\let\XINT_csbth_none \endcsname +\expandafter\def\csname XINT_cshtb_0\endcsname {\endcsname0000}% +\expandafter\def\csname XINT_cshtb_1\endcsname {\endcsname0001}% +\expandafter\def\csname XINT_cshtb_2\endcsname {\endcsname0010}% +\expandafter\def\csname XINT_cshtb_3\endcsname {\endcsname0011}% +\expandafter\def\csname XINT_cshtb_4\endcsname {\endcsname0100}% +\expandafter\def\csname XINT_cshtb_5\endcsname {\endcsname0101}% +\expandafter\def\csname XINT_cshtb_6\endcsname {\endcsname0110}% +\expandafter\def\csname XINT_cshtb_7\endcsname {\endcsname0111}% +\expandafter\def\csname XINT_cshtb_8\endcsname {\endcsname1000}% +\expandafter\def\csname XINT_cshtb_9\endcsname {\endcsname1001}% +\def\XINT_cshtb_A {\endcsname1010}% +\def\XINT_cshtb_B {\endcsname1011}% +\def\XINT_cshtb_C {\endcsname1100}% +\def\XINT_cshtb_D {\endcsname1101}% +\def\XINT_cshtb_E {\endcsname1110}% +\def\XINT_cshtb_F {\endcsname1111}% +\let\XINT_cshtb_none \endcsname +% \end{macrocode} +% \subsection{Helper macros} +% \subsubsection{\csh{XINT_zeroes_foriv}} +% \lverb|& +%( \romannumeral0\XINT_zeroes_foriv #1\R{0\R}{00\R}{000\R}$% +%: \R{0\R}{00\R}{000\R}\R\W +%) +% expands to the or 0 or 00 or 000 needed which when adjoined to #1 +% extend it to length 4N.| +% \begin{macrocode} +\def\XINT_zeroes_foriv #1#2#3#4#5#6#7#8% +{% + \xint_gob_til_R #8\XINT_zeroes_foriv_end\R\XINT_zeroes_foriv }% +\def\XINT_zeroes_foriv_end\R\XINT_zeroes_foriv #1#2\W + {\XINT_zeroes_foriv_done #1}% +\def\XINT_zeroes_foriv_done #1\R{ #1}% % \end{macrocode} -% \subsection{\csh{xintDecToHex}} -% \lverb|Complete rewrite at 1.2m in the 1.2 style. +% \subsubsection{\csh{XINT_unsepb_loop}} % -% Faster but currently limited at about 4007 decimal digits on input -% [expansion depth=10000]. +% \lverb|This is used as +%( \the\numexpr0\XINT_unsepb_loop (blocks of digits with ! as separator)% +%: \xint_bye!2!3!4!5!6!7!8!9!\xint_bye\xint_c_i\relax +%) +% It removes the !'s and outputs the digits (being careful not to suppress +% leading zeroes) with a 0 prefix to remove later. Each block is allowed up to +% nine digits. % -% 1.2m version robust against non terminated inputs. +% This is the same as \XINT_unsep_loop from xintcore.sty except that the +% digits blocks have no 1-prefix. Was done for \xintHexToDec at 1.2m.| +% \begin{macrocode} +\def\XINT_unsepb_loop #1!#2!#3!#4!#5!#6!#7!#8!#9!% +{% + \expandafter\XINT_unsep_clean + \the\numexpr 1#1\expandafter\XINT_unsep_clean + \the\numexpr 1#2\expandafter\XINT_unsep_clean + \the\numexpr 1#3\expandafter\XINT_unsep_clean + \the\numexpr 1#4\expandafter\XINT_unsep_clean + \the\numexpr 1#5\expandafter\XINT_unsep_clean + \the\numexpr 1#6\expandafter\XINT_unsep_clean + \the\numexpr 1#7\expandafter\XINT_unsep_clean + \the\numexpr 1#8\expandafter\XINT_unsep_clean + \the\numexpr 1#9\XINT_unsepb_loop +}% +\def\XINT_unsep_clean 1{\relax}% also in xintcore +% \end{macrocode} +% \subsection{\csh{xintDecToHex}} +% \lverb|Complete rewrite at 1.2m in the 1.2 style. Also, 1.2m is robust +% against non terminated inputs. +% +% Improvements of coding at 1.2n, increased maximal size. % % An input without leading zeroes gives an output without leading zeroes.| % \begin{macrocode} @@ -23518,101 +23542,100 @@ $1$ or $-1$. \def\XINT_dth_neg {\expandafter-\romannumeral0\XINT_dth_main}% \def\XINT_dth_main #1\xint: {% - \expandafter\XINT_dth_start + \expandafter\XINT_dth_finish + \romannumeral`&&@\expandafter\XINT_dthb_start \romannumeral0\XINT_zeroes_foriv #1\R{0\R}{00\R}{000\R}\R{0\R}{00\R}{000\R}\R\W - #1\xint_bye\xint_bye\XINT_dthb_final_a!2!3!4!5!6!7!8!9!\W + #1\xint_bye\XINT_dth_tohex }% -\def\XINT_dth_start #1#2#3#4#5% +\def\XINT_dthb_start #1#2#3#4#5% {% - \xint_bye#5\XINT_dth_small\xint_bye - \XINT_dth_start_a #1#2#3#4#5% + \xint_bye#5\XINT_dthb_small\xint_bye\XINT_dthb_start_a #1#2#3#4#5% }% -\def\XINT_dth_start_a #1#2#3#4#5% +\def\XINT_dthb_small\xint_bye\XINT_dthb_start_a #1\xint_bye#2{#2#1!}% +\def\XINT_dthb_start_a #1#2#3#4#5#6#7#8#9% {% - \expandafter\XINT_dth_A\the\numexpr\XINT_dth_a - #1#2#3#4\XINT_dth_nextfour!2!3!4!5!6!7!8!9!\Z #5% + \expandafter\XINT_dthb_again\the\numexpr\expandafter\XINT_dthb_update + \the\numexpr#1#2#3#4% + \xint_bye#9\XINT_dthb_lastpass\xint_bye + #5#6#7#8!\XINT_dthb_exclam\relax\XINT_dthb_nextfour!2!3!4!5!6!7!8!9!\Z #9% }% -\def\XINT_dth_small\xint_bye\XINT_dth_start_a #1\xint_bye #2\W +\def\XINT_dthb_exclam {!\XINT_dthb_exclam!}% +\def\XINT_dthb_update #1!% {% - \expandafter\XINT_dth_B_finish - \romannumeral`&&@\XINT_tofourhex#1!\space + \expandafter\XINT_dthb_update_a + \the\numexpr (#1+\xint_c_ii^xv)/\xint_c_ii^xvi-\xint_c_i\xint: + #1\xint:% }% -\def\XINT_dth_a #1!#2!#3!#4!#5!#6!#7!#8!#9!% -{% - \expandafter\XINT_dth_update - \the\numexpr #1\expandafter\XINT_dth_update - \the\numexpr #2\expandafter\XINT_dth_update - \the\numexpr #3\expandafter\XINT_dth_update - \the\numexpr #4\expandafter\XINT_dth_update - \the\numexpr #5\expandafter\XINT_dth_update - \the\numexpr #6\expandafter\XINT_dth_update - \the\numexpr #7\expandafter\XINT_dth_update - \the\numexpr #8\expandafter\XINT_dth_update - \the\numexpr #9\XINT_dth_a -}% -\def\XINT_dth_nextfour #1\Z #2#3#4#5% +\def\XINT_dthb_update_a #1\xint:#2\xint:#3% {% - #2#3#4#5!\relax\XINT_dth_nextfour!2!3!4!5!6!7!8!9!\Z + 0000+#1\expandafter#3\the\numexpr#2-#1*\xint_c_ii^xvi }% -\def\XINT_dth_update #1!% +\def\XINT_dthb_nextfour #1\Z #2#3#4#5#6% {% - \expandafter\XINT_dth_update_a - \the\numexpr (#1+\xint_c_ii^xv)/\xint_c_ii^xvi-\xint_c_i\xint: - #1\xint:% + \xint_bye#6\XINT_dthb_lastpass\xint_bye + #2#3#4#5!\XINT_dthb_exclam\relax\XINT_dthb_nextfour!2!3!4!5!6!7!8!9!\Z #6% }% -\def\XINT_dth_update_a #1\xint:#2\xint: +\def\XINT_dthb_lastpass\xint_bye #1!#2\xint_bye#3{#1!#3!}% +\def\XINT_dth_tohex {% - 0000+#1\expandafter!\expandafter!\the\numexpr#2-#1*\xint_c_ii^xvi + \expandafter\expandafter\expandafter\XINT_dth_tohex_a\csname\XINT_tofourhex }% -\def\XINT_dth_A #1!!% +\def\XINT_dth_tohex_a\endcsname{!\XINT_dth_tohex!}% +\def\XINT_dthb_a #1!#2!#3!#4!#5!#6!#7!#8!#9!% {% - \ifnum #1>\xint_c_ \xint_dothis{\XINT_dth_again #1!}\fi - \xint_orthat{\XINT_dth_again}% + \expandafter\XINT_dthb_update + \the\numexpr #1\expandafter\XINT_dthb_update + \the\numexpr #2\expandafter\XINT_dthb_update + \the\numexpr #3\expandafter\XINT_dthb_update + \the\numexpr #4\expandafter\XINT_dthb_update + \the\numexpr #5\expandafter\XINT_dthb_update + \the\numexpr #6\expandafter\XINT_dthb_update + \the\numexpr #7\expandafter\XINT_dthb_update + \the\numexpr #8\expandafter\XINT_dthb_update + \the\numexpr #9\XINT_dthb_a +}% +\def\XINT_dthb_again #1!#2!% +{% + \ifx\XINT_dthb_exclam#2% + \expandafter\xint_firstoftwo + \else + \expandafter\xint_secondoftwo + \fi + {\expandafter\XINT_dthb_again\the\numexpr\expandafter\XINT_dthb_a + \romannumeral`&&@\ifnum #1>\xint_c_ \xint_dothis{#1!}\fi\xint_orthat{}}% + {\ifnum #1>\xint_c_ \xint_dothis{#2#1!}\fi\xint_orthat{!#2!}}% }% -\def\XINT_dth_again #1\Z #2% +\def\XINT_tofourhex #1!% {% - \xint_bye #2\XINT_dth_B_a\xint_bye - \expandafter\XINT_dth_A\the\numexpr\XINT_dth_a #1\Z #2% + \expandafter\XINT_tofourhex_a + \the\numexpr (#1+\xint_c_ii^vii)/\xint_c_ii^viii-\xint_c_i\xint: + #1\xint: }% -\def\XINT_dth_B_a\xint_bye - \expandafter\XINT_dth_A\the\numexpr\XINT_dth_a #1\XINT_dth_nextfour #2\Z +\def\XINT_tofourhex_a #1\xint:#2\xint: {% - \expandafter\XINT_dth_B_finish\romannumeral`&&@\XINT_dth_B_c #1!% + \expandafter\XINT_tofourhex_c + \the\numexpr (#1+\xint_c_viii)/\xint_c_xvi-\xint_c_i\xint: + #1\xint: + \the\numexpr #2-\xint_c_ii^viii*#1!% }% -\def\XINT_dth_B_c #1!#2!#3!#4!#5!#6!#7!#8!#9!% +\def\XINT_tofourhex_c #1\xint:#2\xint: {% - \XINT_tofourhex#1!% - \XINT_tofourhex#2!% - \XINT_tofourhex#3!% - \XINT_tofourhex#4!% - \XINT_tofourhex#5!% - \XINT_tofourhex#6!% - \XINT_tofourhex#7!% - \XINT_tofourhex#8!% - \XINT_tofourhex#9!% - \XINT_dth_B_c + XINT_csdth_#1% + \csname XINT_csdth_\the\numexpr #2-\xint_c_xvi*#1\relax + \csname \expandafter\XINT_tofourhex_d }% -% attention ici mon #1 compte pour 4 chiffres hexa -\def\XINT_tofourhex #1!% +\def\XINT_tofourhex_d #1!% {% - \expandafter\XINT_tofourhex_a - \the\numexpr (#1+\xint_c_ii^vii)/\xint_c_ii^viii-\xint_c_i\xint: #1\xint: + \expandafter\XINT_tofourhex_e + \the\numexpr (#1+\xint_c_viii)/\xint_c_xvi-\xint_c_i\xint: + #1\xint: }% -\def\XINT_tofourhex_a #1\xint: #2\xint: +\def\XINT_tofourhex_e #1\xint:#2\xint: {% - \expandafter\XINT_tofourhex_b - \the\numexpr #2-\xint_c_ii^viii*#1\xint:#1\xint: + XINT_csdth_#1% + \csname XINT_csdth_\the\numexpr #2-\xint_c_xvi*#1\endcsname }% -\def\XINT_tofourhex_b #1\xint: #2\xint: -{% - \XINT_smallhex #2!% - \XINT_smallhex #1!% -}% -\def\XINT_dthb_final_a #1\W{1)\relax \xint:\XINT_dthb_final_b\xint:\W}% -\def\XINT_dthb_final_b #1\W{1\relax \xint:\XINT_dthb_final_c\xint:\W}% -\def\XINT_dthb_final_c #1\W{-1)\relax \XINT_dthb_final_d\xint:\xint:\W}% -\def\XINT_dthb_final_d #1\W{\endcsname}% % \end{macrocode} % \lverb|We only clean-up up to 3 zero hexadecimal digits, as output was % produced in chunks of 4 hex digits. If input had no leading zero, output @@ -23622,7 +23645,7 @@ $1$ or $-1$. % The coding is for varying a bit, I did not check if efficient, it does not % matter.| % \begin{macrocode} -\def\XINT_dth_B_finish #1#2#3% +\def\XINT_dth_finish !\XINT_dth_tohex!#1#2#3% {% \unless\if#10\xint_dothis{ #1#2#3}\fi \unless\if#20\xint_dothis{ #2#3}\fi @@ -23631,14 +23654,14 @@ $1$ or $-1$. }% % \end{macrocode} % \subsection{\csh{xintDecToBin}} -% \lverb|Complete rewrite at 1.2m in the 1.2 style. +% \lverb|Complete rewrite at 1.2m in the 1.2 style. Also, 1.2m is robust +% against non terminated inputs. % -% Much faster but currently limited at about 4007 decimal digits on input -% [expansion depth=10000] -% -% 1.2m version robust against non terminated inputs. +% Revisited at 1.2n like in \xintDecToHex: increased maximal size. % % An input without leading zeroes gives an output without leading zeroes. +% +% Most of the code canvas is shared with \xintDecToHex. % | % \begin{macrocode} \def\xintDecToBin {\romannumeral0\xintdectobin }% @@ -23656,106 +23679,56 @@ $1$ or $-1$. \def\XINT_dtb_neg {\expandafter-\romannumeral0\XINT_dtb_main}% \def\XINT_dtb_main #1\xint: {% - \expandafter\XINT_dtb_start + \expandafter\XINT_dtb_finish + \romannumeral`&&@\expandafter\XINT_dthb_start \romannumeral0\XINT_zeroes_foriv #1\R{0\R}{00\R}{000\R}\R{0\R}{00\R}{000\R}\R\W - #1\xint_bye\xint_bye\XINT_dthb_final_a!2!3!4!5!6!7!8!9!\W -}% -\def\XINT_dtb_start #1#2#3#4#5% -{% - \xint_bye#5\XINT_dtb_small\xint_bye - \XINT_dtb_start_a #1#2#3#4#5% -}% -\def\XINT_dtb_start_a #1#2#3#4#5% -{% - \expandafter\XINT_dtb_A\the\numexpr\XINT_dtb_a - #1#2#3#4\XINT_dtb_nextfour!2!3!4!5!6!7!8!9!\Z #5% -}% -\def\XINT_dtb_small\xint_bye\XINT_dtb_start_a #1\xint_bye #2\W -{% - \expandafter\XINT_dtb_B_finish - \romannumeral`&&@\XINT_tosixteenbits#1!\space -}% -\def\XINT_dtb_a #1!#2!#3!#4!#5!#6!#7!#8!#9!% -{% - \expandafter\XINT_dtb_update - \the\numexpr #1\expandafter\XINT_dtb_update - \the\numexpr #2\expandafter\XINT_dtb_update - \the\numexpr #3\expandafter\XINT_dtb_update - \the\numexpr #4\expandafter\XINT_dtb_update - \the\numexpr #5\expandafter\XINT_dtb_update - \the\numexpr #6\expandafter\XINT_dtb_update - \the\numexpr #7\expandafter\XINT_dtb_update - \the\numexpr #8\expandafter\XINT_dtb_update - \the\numexpr #9\XINT_dtb_a -}% -\def\XINT_dtb_nextfour #1\Z #2#3#4#5% -{% - #2#3#4#5!\relax\XINT_dtb_nextfour!2!3!4!5!6!7!8!9!\Z + #1\xint_bye\XINT_dtb_tobin }% -\def\XINT_dtb_update #1!% +\def\XINT_dtb_tobin {% - \expandafter\XINT_dtb_update_a - \the\numexpr (#1+\xint_c_ii^xv)/\xint_c_ii^xvi-\xint_c_i\xint: - #1\xint:% + \expandafter\expandafter\expandafter\XINT_dtb_tobin_a\csname\XINT_tosixteenbits }% -\def\XINT_dtb_update_a #1\xint:#2\xint: +\def\XINT_dtb_tobin_a\endcsname{!\XINT_dtb_tobin!}% +\def\XINT_tosixteenbits #1!% {% - 0000+#1\expandafter!\expandafter!\the\numexpr#2-#1*\xint_c_ii^xvi + \expandafter\XINT_tosixteenbits_a + \the\numexpr (#1+\xint_c_ii^vii)/\xint_c_ii^viii-\xint_c_i\xint: + #1\xint: }% -\def\XINT_dtb_A #1!!% +\def\XINT_tosixteenbits_a #1\xint:#2\xint: {% - \ifnum #1>\xint_c_ \xint_dothis{\XINT_dtb_again #1!}\fi - \xint_orthat{\XINT_dtb_again}% + \expandafter\XINT_tosixteenbits_c + \the\numexpr (#1+\xint_c_viii)/\xint_c_xvi-\xint_c_i\xint: + #1\xint: + \the\numexpr #2-\xint_c_ii^viii*#1!% }% -\def\XINT_dtb_again #1\Z #2% +\def\XINT_tosixteenbits_c #1\xint:#2\xint: {% - \xint_bye #2\XINT_dtb_B_a\xint_bye - \expandafter\XINT_dtb_A\the\numexpr\XINT_dtb_a #1\Z #2% + XINT_csdtb_#1% + \csname XINT_csdtb_\the\numexpr #2-\xint_c_xvi*#1\relax + \csname \expandafter\XINT_tosixteenbits_d }% -\def\XINT_dtb_B_a\xint_bye - \expandafter\XINT_dtb_A\the\numexpr\XINT_dtb_a #1\XINT_dtb_nextfour #2\Z +\def\XINT_tosixteenbits_d #1!% {% - \expandafter\XINT_dtb_B_finish\romannumeral`&&@\XINT_dtb_B_c #1!% + \expandafter\XINT_tosixteenbits_e + \the\numexpr (#1+\xint_c_viii)/\xint_c_xvi-\xint_c_i\xint: + #1\xint: }% -\def\XINT_dtb_B_c #1!#2!#3!#4!#5!#6!#7!#8!#9!% +\def\XINT_tosixteenbits_e #1\xint:#2\xint: {% - \XINT_tosixteenbits#1!% - \XINT_tosixteenbits#2!% - \XINT_tosixteenbits#3!% - \XINT_tosixteenbits#4!% - \XINT_tosixteenbits#5!% - \XINT_tosixteenbits#6!% - \XINT_tosixteenbits#7!% - \XINT_tosixteenbits#8!% - \XINT_tosixteenbits#9!% - \XINT_dtb_B_c + XINT_csdtb_#1% + \csname XINT_csdtb_\the\numexpr #2-\xint_c_xvi*#1\endcsname }% -% attention ici mon #1 compte pour 4 chiffres hexa -\def\XINT_tosixteenbits #1!% +\def\XINT_dtb_finish !\XINT_dtb_tobin!#1#2#3#4#5#6#7#8% {% - \expandafter\XINT_tosixteenbits_a - \the\numexpr (#1+\xint_c_ii^vii)/\xint_c_ii^viii-\xint_c_i\xint: #1\xint: + \expandafter\XINT_dtb_finish_a\the\numexpr #1#2#3#4#5#6#7#8\relax }% -\def\XINT_tosixteenbits_a #1\xint: #2\xint: -{% - \expandafter\XINT_tosixteenbits_b - \the\numexpr #2-\xint_c_ii^viii*#1\xint:#1\xint: -}% -\def\XINT_tosixteenbits_b #1\xint: #2\xint: -{% - \XINT_smallbin #2!% - \XINT_smallbin #1!% -}% -\def\XINT_dtb_B_finish #1#2#3#4#5#6#7#8% -{% - \expandafter\XINT_dtb_B_finish_a\the\numexpr #1#2#3#4#5#6#7#8\relax -}% -\def\XINT_dtb_B_finish_a #1{% -\def\XINT_dtb_B_finish_a ##1##2##3##4##5##6##7##8##9% +\def\XINT_dtb_finish_a #1{% +\def\XINT_dtb_finish_a ##1##2##3##4##5##6##7##8##9% {% \expandafter#1\the\numexpr ##1##2##3##4##5##6##7##8##9\relax -}}\XINT_dtb_B_finish_a { }% +}}\XINT_dtb_finish_a { }% % \end{macrocode} % \subsection{\csh{xintHexToDec}} % \lverb|Completely (and belatedly) rewritten at 1.2m in the 1.2 style. @@ -23766,8 +23739,7 @@ $1$ or $-1$. % robustness is not on purpose but from need to expand argument and then grab % it again. So we do it safely. % -% Input should not have more than circa 5538 hexadecimal digits, else, TeX -% capacity exceeded [parameter stack size=10000] +% Increased maximal size at 1.2n. % % 1.2m version robust against non terminated inputs. % @@ -23806,9 +23778,15 @@ $1$ or $-1$. \xint_bye!2!3!4!5!6!7!8!9!\xint_bye\XINT_htd_nextfour}% \def\XINT_htd_startbb 1#1#2!{\XINT_htd_again #1!#2% \xint_bye!2!3!4!5!6!7!8!9!\xint_bye\XINT_htd_nextfour}% +% \end{macrocode} +% \lverb|It is a bit annoying to grab all to the end here. I have a version, +% modeled on the 1.2n variant of \xintDecToHex which solved that problem +% there, but it did not prove enough if at all faster in my brief testing and +% it had the defect of a reduced maximal allowed size of the input. | +% \begin{macrocode} \def\XINT_htd_again #1\XINT_htd_nextfour #2% {% - \xint_bye #2\XINT_htd_end_a\xint_bye + \xint_bye #2\XINT_htd_finish\xint_bye \expandafter\XINT_htd_A\the\numexpr \XINT_htd_a #1\XINT_htd_nextfour #2% }% @@ -23827,12 +23805,17 @@ $1$ or $-1$. }% \def\XINT_htd_nextfour #1#2#3#4% {% - *\xint_c_ii^xvi+"#1#2#3#4+\xint_c_x^ix\relax\xint_bye!% + *\xint_c_ii^xvi+"#1#2#3#4+1000000000\relax\xint_bye!% 2!3!4!5!6!7!8!9!\xint_bye\XINT_htd_nextfour }% -\def\XINT_htd_update 1#1#2#3#4#5#6!% +% \end{macrocode} +% \lverb|If the innocent looking commented out $#6 is left in the pattern as +% was the case at 1.2m, the maximal size becomes limited at 5538 digits, not +% 8298! (with parameter stack size = 10000.) | +% \begin{macrocode} +\def\XINT_htd_update 1#1#2#3#4#5%#6!% {% - *\xint_c_ii^xvi+#1#2#3#4#5+\xint_c_x^ix!#6!% + *\xint_c_ii^xvi+10000#1#2#3#4#5!%#6!% }% \def\XINT_htd_A 1#1% {% @@ -23840,32 +23823,45 @@ $1$ or $-1$. \expandafter\XINT_htd_Ab \fi 1#1% }% -\def\XINT_htd_Aa 10#1#2#3#4#5!{\XINT_htd_again #1#2#3#4!#5!}% -\def\XINT_htd_Ab 1#1#2#3#4#5#6!{\XINT_htd_again #1!#2#3#4#5!#6!}% -% \end{macrocode} -% \lverb|\XINT_unsepb_loop is in xintcore. It removes the ! separators, the -% blocs of digits not being prefixed by 1; \XINT_unsep_loop on the other hand -% assumes 1 prefix on the digit blocks| -% \begin{macrocode} -\def\XINT_htd_end_a\xint_bye +\def\XINT_htd_Aa 10#1#2#3#4{\XINT_htd_again #1#2#3#4!}% +\def\XINT_htd_Ab 1#1#2#3#4#5{\XINT_htd_again #1!#2#3#4#5!}% +\def\XINT_htd_finish\xint_bye \expandafter\XINT_htd_A\the\numexpr \XINT_htd_a #1\XINT_htd_nextfour {% - \expandafter\XINT_htd_end_b\the\numexpr0\XINT_unsepb_loop #1% + \expandafter\XINT_htd_finish_cuz\the\numexpr0\XINT_htd_unsep_loop #1% }% -\def\XINT_htd_end_b #1{% -\def\XINT_htd_end_b ##1##2##3##4##5% +\def\XINT_htd_unsep_loop #1!#2!#3!#4!#5!#6!#7!#8!#9!% +{% + \expandafter\XINT_unsep_clean + \the\numexpr 1#1#2\expandafter\XINT_unsep_clean + \the\numexpr 1#3#4\expandafter\XINT_unsep_clean + \the\numexpr 1#5#6\expandafter\XINT_unsep_clean + \the\numexpr 1#7#8\expandafter\XINT_unsep_clean + \the\numexpr 1#9\XINT_htd_unsep_loop_a +}% +\def\XINT_htd_unsep_loop_a #1!#2!#3!#4!#5!#6!#7!#8!#9!% +{% + #1\expandafter\XINT_unsep_clean + \the\numexpr 1#2#3\expandafter\XINT_unsep_clean + \the\numexpr 1#4#5\expandafter\XINT_unsep_clean + \the\numexpr 1#6#7\expandafter\XINT_unsep_clean + \the\numexpr 1#8#9\XINT_htd_unsep_loop +}% +\def\XINT_unsep_clean 1{\relax}% also in xintcore +\def\XINT_htd_finish_cuz #1{% +\def\XINT_htd_finish_cuz ##1##2##3##4##5% {\expandafter#1\the\numexpr ##1##2##3##4##5\relax}% -}\XINT_htd_end_b{ }% +}\XINT_htd_finish_cuz{ }% % \end{macrocode} % \subsection{\csh{xintBinToDec}} % \lverb|Redone entirely for 1.2m. Starts by converting to hexadecimal -% first (but with unexpanded \XINT_sbth_xxxx macros). +% first. % -% Maximal size of input around 19984 digits (expansion depth=10000). +% Increased maximal size at 1.2n. % % An input without leading zeroes gives an output without leading zeroes. % -% 1.2m robust against non-terminated input.| +% Robust against non-terminated input.| % \begin{macrocode} \def\xintBinToDec {\romannumeral0\xintbintodec }% \def\xintbintodec #1% @@ -23882,20 +23878,12 @@ $1$ or $-1$. \def\XINT_btd_N {\expandafter-\romannumeral0\XINT_btd_main }% \def\XINT_btd_main #1\xint: {% - \expandafter\XINT_btd_htd - \csname\expandafter\XINT_btd_tohex + \csname XINT_btd_htd\csname\expandafter\XINT_bth_loop \romannumeral0\XINT_zeroes_foriv - #1\R{0\R}{00\R}{000\R}\R{0\R}{00\R}{000\R}\R\W - #1\XINT_btd_tohex_endcsname2345678\W -}% -\def\XINT_btd_tohex #1#2#3#4#5#6#7#8% -{% - XINT_sbth_#1#2#3#4\expandafter\endcsname - \csname XINT_sbth_#5#6#7#8\expandafter\endcsname - \csname\XINT_btd_tohex + #1\R{0\R}{00\R}{000\R}\R{0\R}{00\R}{000\R}\R\W + #1\xint_bye2345678\xint_bye none\endcsname\xint: }% -\def\XINT_btd_tohex_endcsname#1\W{none\endcsname}% -\def\XINT_btd_htd #1\XINT_sbth_none +\def\XINT_btd_htd #1\xint: {% \expandafter\XINT_htd_startb \the\numexpr\expandafter\XINT_htd_starta @@ -23906,16 +23894,17 @@ $1$ or $-1$. % \end{macrocode} % \subsection{\csh{xintBinToHex}} % \lverb|Complete rewrite for 1.2m. -% -% But input should not have more than about 13320 binary digits (expansion +% But input for 1.2m version limited to about 13320 binary digits (expansion % depth=10000). % +% Again redone for 1.2n for \csname governed expansion: increased maximal size. +% % Size of output is ceil(size(input)/4), leading zeroes in output (inherited % from the input) are not trimmed. % % An input without leading zeroes gives an output without leading zeroes. % -% 1.2m robust against non-terminated input. +% Robust against non-terminated input. % | % \begin{macrocode} \def\xintBinToHex {\romannumeral0\xintbintohex }% @@ -23931,39 +23920,37 @@ $1$ or $-1$. \krof }% \def\XINT_bth_N {\expandafter-\romannumeral0\XINT_bth_main }% -\def\XINT_bth_main #1{% -\def\XINT_bth_main ##1\xint: +\def\XINT_bth_main #1\xint: {% - \expandafter\expandafter\expandafter#1% - \csname\expandafter\XINT_bth_tohex + \csname space\csname\expandafter\XINT_bth_loop \romannumeral0\XINT_zeroes_foriv - ##1\R{0\R}{00\R}{000\R}\R{0\R}{00\R}{000\R}\R\W - ##1\XINT_bth_tohex_endcsname2345678\W -}}\XINT_bth_main{ }% -\def\XINT_bth_tohex #1#2#3#4#5#6#7#8% + #1\R{0\R}{00\R}{000\R}\R{0\R}{00\R}{000\R}\R\W + #1\xint_bye2345678\xint_bye none\endcsname +}% +\def\XINT_bth_loop #1#2#3#4#5#6#7#8% {% - XINT_sbth_#1#2#3#4\expandafter\expandafter\expandafter\endcsname - \csname XINT_sbth_#5#6#7#8\expandafter\expandafter\expandafter\endcsname - \csname\XINT_bth_tohex + XINT_csbth_#1#2#3#4% + \csname XINT_csbth_#5#6#7#8% + \csname\XINT_bth_loop }% -\def\XINT_bth_tohex_endcsname#1\W{none\endcsname}% % \end{macrocode} % \subsection{\csh{xintHexToBin}} -% \lverb|Completely rewritten for 1.2m. Limited to inputs of at most about -% 4994 hexadecimal digits [input stack size=5000]. +% \lverb|Completely rewritten for 1.2m. % % Attention this macro is not robust against arguments expanding after % themselves. % % Only up to three zeros are removed on front of output: if the input had a % leading zero, there will be a leading zero (and then possibly 4n of them if -% inputs had more leading zeroes) on output.| +% inputs had more leading zeroes) on output. +% +% Rewritten again at 1.2n for \csname governed expansion.| % \begin{macrocode} \def\xintHexToBin {\romannumeral0\xinthextobin }% \def\xinthextobin #1% {% \expandafter\XINT_htb_checkin\romannumeral`&&@#1% - \xint_bye 23456789\xint_bye none\endcsname\relax + \xint_bye 23456789\xint_bye none\endcsname }% \def\XINT_htb_checkin #1% {% @@ -23973,44 +23960,22 @@ $1$ or $-1$. \krof }% \def\XINT_htb_N {\expandafter-\romannumeral0\XINT_htb_main }% -\def\XINT_htb_main {\expandafter\XINT_htb_cuz\the\numexpr\XINT_htb_loop}% +\def\XINT_htb_main {\csname XINT_htb_cuz\csname\XINT_htb_loop}% \def\XINT_htb_loop #1#2#3#4#5#6#7#8#9% {% - 1\csname XINT_shtb_#1\endcsname - \csname XINT_shtb_#2\endcsname - \expandafter\XINT_unsep_clean - \the\numexpr1\csname XINT_shtb_#3\endcsname - \csname XINT_shtb_#4\endcsname - \expandafter\XINT_unsep_clean - \the\numexpr1\csname XINT_shtb_#5\endcsname - \csname XINT_shtb_#6\endcsname - \expandafter\XINT_unsep_clean - \the\numexpr1\csname XINT_shtb_#7\endcsname - \csname XINT_shtb_#8\endcsname - \expandafter\XINT_unsep_clean - \the\numexpr1\csname XINT_shtb_#9\endcsname - \XINT_htb_loop_a -}% -\def\XINT_htb_loop_a #1#2#3#4#5#6#7#8#9% -{% - \csname XINT_shtb_#1\endcsname - \expandafter\XINT_unsep_clean - \the\numexpr1\csname XINT_shtb_#2\endcsname - \csname XINT_shtb_#3\endcsname - \expandafter\XINT_unsep_clean - \the\numexpr1\csname XINT_shtb_#4\endcsname - \csname XINT_shtb_#5\endcsname - \expandafter\XINT_unsep_clean - \the\numexpr1\csname XINT_shtb_#6\endcsname - \csname XINT_shtb_#7\endcsname - \expandafter\XINT_unsep_clean - \the\numexpr1\csname XINT_shtb_#8\endcsname - \csname XINT_shtb_#9\endcsname - \expandafter\XINT_unsep_clean - \the\numexpr\XINT_htb_loop + XINT_cshtb_#1% + \csname XINT_cshtb_#2% + \csname XINT_cshtb_#3% + \csname XINT_cshtb_#4% + \csname XINT_cshtb_#5% + \csname XINT_cshtb_#6% + \csname XINT_cshtb_#7% + \csname XINT_cshtb_#8% + \csname XINT_cshtb_#9% + \csname \XINT_htb_loop }% \def\XINT_htb_cuz #1{% -\def\XINT_htb_cuz 1##1##2##3##4% +\def\XINT_htb_cuz ##1##2##3##4% {\expandafter#1\the\numexpr##1##2##3##4\relax}% }\XINT_htb_cuz { }% % \end{macrocode} @@ -24018,13 +23983,15 @@ $1$ or $-1$. % \lverb|The 1.08 macro had same functionality as \xintHexToBin, and slightly % different code, the 1.2m version has the same code as \xintHexToBin except % that it does not remove leading zeros from output: if the input had N -% hexadecimal digits, the output will have exactly 4N binary digits.| +% hexadecimal digits, the output will have exactly 4N binary digits. +% +% Rewritten again at 1.2n for \csname governed expansion.| % \begin{macrocode} \def\xintCHexToBin {\romannumeral0\xintchextobin }% \def\xintchextobin #1% {% \expandafter\XINT_chtb_checkin\romannumeral`&&@#1% - \xint_bye 23456789\xint_bye none\endcsname\relax + \xint_bye 23456789\xint_bye none\endcsname }% \def\XINT_chtb_checkin #1% {% @@ -24034,8 +24001,7 @@ $1$ or $-1$. \krof }% \def\XINT_chtb_N {\expandafter-\romannumeral0\XINT_chtb_main }% -\def\XINT_chtb_main - {\expandafter\xint_gobble_thenstop\the\numexpr\XINT_htb_loop}% +\def\XINT_chtb_main {\csname space\csname\XINT_htb_loop}% \XINT_restorecatcodes_endinput% % \end{macrocode} % @@ -24120,7 +24086,7 @@ $1$ or $-1$. % \begin{macrocode} \XINT_providespackage \ProvidesPackage{xintgcd}% - [2017/07/31 1.2m Euclide algorithm with xint package (JFB)]% + [2017/08/06 1.2n Euclide algorithm with xint package (JFB)]% % \end{macrocode} % \subsection{\csh{xintGCD}, \csh{xintiiGCD}} % \begin{macrocode} @@ -24787,7 +24753,7 @@ $1$ or $-1$. % \begin{macrocode} \XINT_providespackage \ProvidesPackage{xintfrac}% - [2017/07/31 1.2m Expandable operations on fractions (JFB)]% + [2017/08/06 1.2n Expandable operations on fractions (JFB)]% % \end{macrocode} % \subsection{\csh{XINT_cntSgnFork}} % \lverb|1.09i. Used internally, #1 must expand to \m@ne, \z@, or \@ne or @@ -28776,7 +28742,7 @@ $1$ or $-1$. % \begin{macrocode} \XINT_providespackage \ProvidesPackage{xintseries}% - [2017/07/31 1.2m Expandable partial sums with xint package (JFB)]% + [2017/08/06 1.2n Expandable partial sums with xint package (JFB)]% % \end{macrocode} % \subsection{\csh{xintSeries}} % \begin{macrocode} @@ -29274,7 +29240,7 @@ $1$ or $-1$. % \begin{macrocode} \XINT_providespackage \ProvidesPackage{xintcfrac}% - [2017/07/31 1.2m Expandable continued fractions with xint package (JFB)]% + [2017/08/06 1.2n Expandable continued fractions with xint package (JFB)]% % \end{macrocode} % \subsection{\csh{xintCFrac}} % \begin{macrocode} @@ -30525,7 +30491,7 @@ $1$ or $-1$. % \begin{macrocode} \XINT_providespackage \ProvidesPackage{xintexpr}% - [2017/07/31 1.2m Expandable expression parser (JFB)]% + [2017/08/06 1.2n Expandable expression parser (JFB)]% \catcode`! 11 \let\XINT_Cmp \xintiiCmp % \end{macrocode} @@ -34527,9 +34493,9 @@ $1$ or $-1$. \iffalse % grep -c -e "^{%" xint*sty xint.sty:178 -xintbinhex.sty:66 +xintbinhex.sty:55 xintcfrac.sty:183 -xintcore.sty:280 +xintcore.sty:278 xintexpr.sty:168 xintfrac.sty:439 xintgcd.sty:50 @@ -34538,13 +34504,13 @@ xintseries.sty:48 xinttools.sty:138 \fi % grep -o "^{%" xint*sty | wc -l -\def\totala{ 1563} +\def\totala{ 1550} \iffalse % grep -c -e "^}%" xint*sty xint.sty:177 -xintbinhex.sty:64 +xintbinhex.sty:54 xintcfrac.sty:183 -xintcore.sty:277 +xintcore.sty:275 xintexpr.sty:199 xintfrac.sty:437 xintgcd.sty:52 @@ -34553,7 +34519,7 @@ xintseries.sty:48 xinttools.sty:137 \fi % grep -o "^}%" xint*sty | wc -l -\def\totalb{ 1588} +\def\totalb{ 1576} \DeleteShortVerb{\|} \def\mymacro #1{\mymacroaux #1} \def\mymacroaux #1#2{\strut \csname #1nameimp\endcsname:& \dtt{ #2.}\tabularnewline } @@ -34590,8 +34556,8 @@ xinttools.sty:137 Right bracket \] Circumflex \^ Underscore \_ Grave accent \` Left brace \{ Vertical bar \| Right brace \} Tilde \~} -\CheckSum {30439}% 30303 pour 1.2h, 30403 pour 1.2i, 30750 pour 1.2j, - % 30677 pour 1.2k, 30931 pour 1.2l +\CheckSum {30253}% 30303 pour 1.2h, 30403 pour 1.2i, 30750 pour 1.2j, + % 30677 pour 1.2k, 30931 pour 1.2l, 30439 pour 1.2m \makeatletter\check@checksum\makeatother \Finale %% End of file xint.dtx diff --git a/Master/texmf-dist/source/generic/xint/xint.ins b/Master/texmf-dist/source/generic/xint/xint.ins index b405e1f602a..ef332270ab9 100644 --- a/Master/texmf-dist/source/generic/xint/xint.ins +++ b/Master/texmf-dist/source/generic/xint/xint.ins @@ -21,7 +21,7 @@ %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %% --------------------------------------------------------------- -%% The xint bundle 1.2m 2017/07/31 +%% The xint bundle 1.2n 2017/08/06 %% Copyright (C) 2013-2017 by Jean-Francois Burnol %% --------------------------------------------------------------- %% -- cgit v1.2.3