diff options
author | Karl Berry <karl@freefriends.org> | 2021-05-13 21:13:13 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-05-13 21:13:13 +0000 |
commit | 6a388cdf8e758efeeeb4d614735137e275dd22de (patch) | |
tree | e105ee945f2b3607a51e50c50a9e36958df1971e | |
parent | aac785f6c46081d4ec382ebb08c31b71064fc863 (diff) |
bnumexpr (13may21)
git-svn-id: svn://tug.org/texlive/trunk@59182 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/bnumexpr/README | 126 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/bnumexpr/README.md | 106 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.pdf | bin | 88010 -> 88616 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.tex | 8 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/bnumexpr/bnumexprchanges.tex | 13 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/bnumexpr/bnumexpr.dtx | 1138 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/bnumexpr/bnumexpr.ins | 56 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/bnumexpr/bnumexpr.sty | 660 | ||||
-rwxr-xr-x | Master/tlpkg/libexec/ctan2tds | 3 |
9 files changed, 1011 insertions, 1099 deletions
diff --git a/Master/texmf-dist/doc/latex/bnumexpr/README b/Master/texmf-dist/doc/latex/bnumexpr/README deleted file mode 100644 index a8f5c0341f3..00000000000 --- a/Master/texmf-dist/doc/latex/bnumexpr/README +++ /dev/null @@ -1,126 +0,0 @@ -Source: bnumexpr.dtx -Version: v1.2e, 2019/01/08 (doc: 2019/01/08) -Author: Jean-Francois Burnol -Info: Expressions with big integers -License: LPPL 1.3c - - - -README: USAGE, INSTALLATION, LICENSE - - -Usage - -The package bnumexpr allows _expandable_ computations with big integers -and the four infix operators +, -, *, / familiar from the \numexpr e-TeX -parser. - -Besides extending the scope to arbitrarily big numbers (and having a -more complete syntax, for example -(1) is legal input), it adds the (by -default) floored division operator //, and its associated modulo /:, the -power operator ^ (or equivalently **), and the factorial post-fix -operator !. The space character as well as the underscore character _ -both may serve to optionally separate digits in long numbers, for better -readability of the input. - -For example: - - \bnumeval{( 92_874_927_979^5 - 31_9792_7979^6 ) / 30!} - - The above expands (in two steps) to `-4006240736596543944035189` - (the `/` does rounded division to match the `\numexpr` behaviour). - -The expression parser is scaled-down from the \xinttheiiexpr...\relax -parser as provided by package xintexpr[1]: it does not handle -hexadecimal input, boolean operators, dummy or user defined variables, -functions, etc... - -By default, the package loads xintcore[2] (release 1.3d is then -required) but it is possible via option _custom_ and macro -\bnumexprsetup to map the operators to macros of one's own choice. It is -the responsability of the user to load the packages providing these -custom macros. - -Notice that the possibility not to use the xintcore macros might be -removed in the future: perhaps a future release will maintain during -computations a private internal representation (especially tailored -either for the xintcore macros or new ones which would be included -within bnumexpr.sty itself) and the constraints this implies may render -optional use of other macros impossible. - - -Installation - -Obtain bnumexpr.dtx (and possibly, bnumexpr.ins and the README) from -CTAN: - - http://www.ctan.org/pkg/bnumexpr - -Both "tex bnumexpr.ins" and "tex bnumexpr.dtx" extract from bnumexpr.dtx -the following files: - -bnumexpr.sty - this is the style file. - -README.md - reconstitutes this README. - -bnumexprchanges.tex - lists changes from the initial version. - -bnumexpr.tex - can be used to generate the documentation: - - with latex+dvipdfmx: "latex bnumexpr.tex" (thrice) then - "dvipdfmx bnumexpr.dvi". - - Ignore dvipdfmx warnings, but if the pdf file has problems with - fonts (possibly from an old dvipdfmx), use then rather pdflatex. - - - with pdflatex: "pdflatex bnumexpr.tex" (thrice). - - In both cases files README.md and bnumexprchanges.tex must be - present in the same repertory. - -without bnumexpr.tex: - "pdflatex bnumexpr.dtx" (thrice) extracts all files and - simultaneously generates the pdf documentation. - -Finishing the installation: - - bnumexpr.sty --> TDS:tex/latex/bnumexpr/ - - bnumexpr.dtx --> TDS:source/latex/bnumexpr/ - bnumexpr.ins --> TDS:source/latex/bnumexpr/ - - bnumexpr.pdf --> TDS:doc/latex/bnumexpr/ - README --> TDS:doc/latex/bnumexpr/ - -Files bnumexpr.tex, bnumexprchanges.tex, README.md may be discarded. - - -License - -Copyright (C) 2014-2019 by Jean-Francois Burnol - -This Work may be distributed and/or modified under the -conditions of the LaTeX Project Public License 1.3c. -This version of this license is in - - http://www.latex-project.org/lppl/lppl-1-3c.txt - -and version 1.3 or later is part of all distributions of -LaTeX version 2005/12/01 or later. - -This Work has the LPPL maintenance status "author-maintained". - -The Author and Maintainer of this Work is Jean-Francois Burnol. - -This Work consists of the main source file bnumexpr.dtx and the derived -files - - bnumexpr.sty, bnumexpr.pdf, bnumexpr.ins, bnumexpr.tex, - bnumexprchanges.tex, README.md - -[1] http://www.ctan.org/pkg/xint - -[2] http://www.ctan.org/pkg/xint diff --git a/Master/texmf-dist/doc/latex/bnumexpr/README.md b/Master/texmf-dist/doc/latex/bnumexpr/README.md index c632a66cf39..bda6edef58a 100644 --- a/Master/texmf-dist/doc/latex/bnumexpr/README.md +++ b/Master/texmf-dist/doc/latex/bnumexpr/README.md @@ -1,74 +1,65 @@ - | Source: bnumexpr.dtx -| Version: v1.2e, 2019/01/08 (doc: 2019/01/08) +| Version: v1.4, 2021/05/12 (doc: 2021/05/12) | Author: Jean-Francois Burnol | Info: Expressions with big integers | License: LPPL 1.3c -README: [Usage], [Installation], [License] -========================================== - -Usage ------ - -The package `bnumexpr` allows _expandable_ computations with big -integers and the four infix operators `+`, `-`, `*`, `/` familiar from -the `\numexpr` e-TeX parser. - -Besides extending the scope to arbitrarily big numbers (and having a -more complete syntax, for example `-(1)` is legal input), it adds the -(by default) floored division operator `//`, and its associated modulo -`/:`, the power operator `^` (or equivalently `**`), and the factorial -post-fix operator `!`. The space character as well as the underscore -character `_` both may serve to optionally separate digits in long -numbers, for better readability of the input. - -For example: - - \bnumeval{( 92_874_927_979^5 - 31_9792_7979^6 ) / 30!} - - The above expands (in two steps) to `-4006240736596543944035189` - (the `/` does rounded division to match the `\numexpr` behaviour). - -The expression parser is scaled-down from the `\xinttheiiexpr...\relax` -parser as provided by package xintexpr[^1]: it does not handle -hexadecimal input, boolean operators, dummy or user defined variables, -functions, etc... - -By default, the package loads xintcore[^1] (release 1.3d is then -required) but it is possible via option _custom_ and macro -`\bnumexprsetup` to map the operators to macros of one's own choice. It -is the responsability of the user to load the packages providing these -custom macros. - -Notice that the possibility not to use the xintcore macros might be +bnumexpr usage +============== + +The LaTeX package `bnumexpr` allows expandable computations with +integers and the four infix operators `+`, `-`, `*`, `/` using the +expression syntax familiar from the `\numexpr` e-TeX parser, with +these extensions: + +- arbitrarily big integers, +- floored division `//`, +- associated modulo `/:`, +- power operators `^` and `**`, +- factorial post-fix operator `!`, +- comma separated expressions, +- the space character as well as the underscore may serve + to separate groups of digits, +- optional conversion of output to hexadecimal. + +The expression parser is a scaled-down variant from the +`\xintiiexpr...\relax` +parser from package [xintexpr](http://ctan.org/pkg/xintexpr). + +To support hexadecimal input and output, the package +[xintbinhex](http://ctan.org/pkg/xint) is loaded automatically. + +The package loads by default [xintcore](http://ctan.org/pkg/xint) +but the option _custom_ together with macro `\bnumexprsetup` allow to map +the syntax elements to macros from an alternative big integer +expandable engine of the user own choosing, +and then [xintcore](http://ctan.org/pkg/xint) is not loaded. + +Note; the possibility not to use the xintcore macros might be removed in the future: perhaps a future release will maintain during computations a private internal representation (especially tailored either for the xintcore macros or new ones which would be included within `bnumexpr.sty` itself) and the constraints this implies may render optional use of other macros impossible. -[^1]: <http://www.ctan.org/pkg/xint> - Installation ------------- +============ -Obtain `bnumexpr.dtx` (and possibly, `bnumexpr.ins` and the `README`) -from CTAN: +Use your installation manager to install or update `bnumexpr`. + +Else, obtain `bnumexpr.dtx`, from CTAN: > <http://www.ctan.org/pkg/bnumexpr> -Both `"tex bnumexpr.ins"` and `"tex bnumexpr.dtx"` extract from -`bnumexpr.dtx` the following files: +Run `"etex bnumexpr.dtx"` to extract these files: `bnumexpr.sty` : this is the style file. `README.md` - : reconstitutes this README. `bnumexprchanges.tex` - : lists changes from the initial version. + : change history. `bnumexpr.tex` : can be used to generate the documentation: @@ -76,13 +67,10 @@ Both `"tex bnumexpr.ins"` and `"tex bnumexpr.dtx"` extract from : - with latex+dvipdfmx: `"latex bnumexpr.tex"` (thrice) then `"dvipdfmx bnumexpr.dvi"`. - : Ignore dvipdfmx warnings, but if the pdf file has problems with - fonts (possibly from an old dvipdfmx), use then rather pdflatex. - : - with pdflatex: `"pdflatex bnumexpr.tex"` (thrice). : In both cases files `README.md` and `bnumexprchanges.tex` must - be present in the same repertory. + be located in the same repertory as `bnumexpr.tex` and `bnumexpr.dtx`. without `bnumexpr.tex`: : `"pdflatex bnumexpr.dtx"` (thrice) extracts all files and @@ -93,18 +81,14 @@ Finishing the installation: bnumexpr.sty --> TDS:tex/latex/bnumexpr/ bnumexpr.dtx --> TDS:source/latex/bnumexpr/ - bnumexpr.ins --> TDS:source/latex/bnumexpr/ bnumexpr.pdf --> TDS:doc/latex/bnumexpr/ - README --> TDS:doc/latex/bnumexpr/ - -Files `bnumexpr.tex`, `bnumexprchanges.tex`, `README.md` may be -discarded. + README.me --> TDS:doc/latex/bnumexpr/ License -------- +======= -Copyright (C) 2014-2019 by Jean-Francois Burnol +Copyright (C) 2014-2021 by Jean-Francois Burnol | This Work may be distributed and/or modified under the | conditions of the LaTeX Project Public License 1.3c. @@ -122,6 +106,6 @@ The Author and Maintainer of this Work is Jean-Francois Burnol. This Work consists of the main source file `bnumexpr.dtx` and the derived files - bnumexpr.sty, bnumexpr.pdf, bnumexpr.ins, bnumexpr.tex, - bnumexprchanges.tex, README.md + bnumexpr.sty, bnumexpr.pdf, bnumexpr.tex, bnumexprchanges.tex, + and README.md diff --git a/Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.pdf b/Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.pdf Binary files differindex 5d8bf66573f..d6fce09181b 100644 --- a/Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.pdf +++ b/Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.pdf diff --git a/Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.tex b/Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.tex index ebcf3b00438..d31477086c5 100644 --- a/Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.tex +++ b/Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.tex @@ -21,12 +21,12 @@ %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %% --------------------------------------------------------------- -\def\bnedocdate {2019/01/08}% package bnumexpr documentation date -\def\bnepackdate{2019/01/08}% package bnumexpr date -\def\bneversion {1.2e} % package bnumexpr version +\def\bnedocdate {2021/05/12}% package bnumexpr documentation date +\def\bnepackdate{2021/05/12}% package bnumexpr date +\def\bneversion {1.4} % package bnumexpr version %% --------------------------------------------------------------- %% The bnumexpr package: Expressions with big integers -%% Copyright (C) 2014-2019 by Jean-Francois Burnol +%% Copyright (C) 2014-2021 by Jean-Francois Burnol %% %% latex bnumexpr.tex (thrice) && dvipdfmx bnumexpr.dvi %% to produce bnumexpr.pdf diff --git a/Master/texmf-dist/doc/latex/bnumexpr/bnumexprchanges.tex b/Master/texmf-dist/doc/latex/bnumexpr/bnumexprchanges.tex index b09e504cd4b..e39bd39df1e 100644 --- a/Master/texmf-dist/doc/latex/bnumexpr/bnumexprchanges.tex +++ b/Master/texmf-dist/doc/latex/bnumexpr/bnumexprchanges.tex @@ -22,8 +22,19 @@ %% in the same archive or directory.) %% --------------------------------------------------------------- %% The bnumexpr package: Expressions with big integers -%% Copyright (C) 2014-2019 by Jean-Francois Burnol +%% Copyright (C) 2014-2021 by Jean-Francois Burnol %% +\item[1.4 (2021/05/12)] + \begin{itemize} + \item technology transfer from \xintexprname |1.4| of + |2020/01/31|. The |\expanded| primitive is now required (TeXLive + 2019). + \item addition to the syntax of the |"| prefix for hexadecimal + input. + \item addition of |\evaltohex| which is like |\bnumeval| with an extra + conversion step to hexadecimal notation. + \end{itemize} + \item[1.2e (2019/01/08)] Fixes a documentation glitch (extra braces when mentioning |\the\numexpr| or |\thebnumexpr|). diff --git a/Master/texmf-dist/source/latex/bnumexpr/bnumexpr.dtx b/Master/texmf-dist/source/latex/bnumexpr/bnumexpr.dtx index 085380f9428..83e0ab6c381 100644 --- a/Master/texmf-dist/source/latex/bnumexpr/bnumexpr.dtx +++ b/Master/texmf-dist/source/latex/bnumexpr/bnumexpr.dtx @@ -1,86 +1,77 @@ -% -*- coding: iso-latin-1; time-stamp-format: "%02d-%02m-%:y at %02H:%02M:%02S %Z" -*- +% -*- coding: utf-8-unix; time-stamp-format: "%02d-%02m-%:y %02H:%02M:%02S %Z"; sentence-end-double-space: t; -*- %<*dtx> -\def\bnedtxtimestamp {Time-stamp: <08-01-2019 at 13:04:43 CET>} +\def\bnedtxtimestamp {Time-stamp: <12-05-2021 22:05:26 CEST>} \iffalse %</dtx> %<*drv> %% --------------------------------------------------------------- -\def\bnedocdate {2019/01/08}% package bnumexpr documentation date -\def\bnepackdate{2019/01/08}% package bnumexpr date -\def\bneversion {1.2e} % package bnumexpr version +\def\bnedocdate {2021/05/12}% package bnumexpr documentation date +\def\bnepackdate{2021/05/12}% package bnumexpr date +\def\bneversion {1.4} % package bnumexpr version %</drv> %<*readme>-------------------------------------------------------- - | Source: bnumexpr.dtx -| Version: v1.2e, 2019/01/08 (doc: 2019/01/08) +| Version: v1.4, 2021/05/12 (doc: 2021/05/12) | Author: Jean-Francois Burnol | Info: Expressions with big integers | License: LPPL 1.3c -README: [Usage], [Installation], [License] -========================================== - -Usage ------ - -The package `bnumexpr` allows _expandable_ computations with big -integers and the four infix operators `+`, `-`, `*`, `/` familiar from -the `\numexpr` e-TeX parser. - -Besides extending the scope to arbitrarily big numbers (and having a -more complete syntax, for example `-(1)` is legal input), it adds the -(by default) floored division operator `//`, and its associated modulo -`/:`, the power operator `^` (or equivalently `**`), and the factorial -post-fix operator `!`. The space character as well as the underscore -character `_` both may serve to optionally separate digits in long -numbers, for better readability of the input. - -For example: - - \bnumeval{( 92_874_927_979^5 - 31_9792_7979^6 ) / 30!} - - The above expands (in two steps) to `-4006240736596543944035189` - (the `/` does rounded division to match the `\numexpr` behaviour). - -The expression parser is scaled-down from the `\xinttheiiexpr...\relax` -parser as provided by package xintexpr[^1]: it does not handle -hexadecimal input, boolean operators, dummy or user defined variables, -functions, etc... - -By default, the package loads xintcore[^1] (release 1.3d is then -required) but it is possible via option _custom_ and macro -`\bnumexprsetup` to map the operators to macros of one's own choice. It -is the responsability of the user to load the packages providing these -custom macros. - -Notice that the possibility not to use the xintcore macros might be +bnumexpr usage +============== + +The LaTeX package `bnumexpr` allows expandable computations with +integers and the four infix operators `+`, `-`, `*`, `/` using the +expression syntax familiar from the `\numexpr` e-TeX parser, with +these extensions: + +- arbitrarily big integers, +- floored division `//`, +- associated modulo `/:`, +- power operators `^` and `**`, +- factorial post-fix operator `!`, +- comma separated expressions, +- the space character as well as the underscore may serve + to separate groups of digits, +- optional conversion of output to hexadecimal. + +The expression parser is a scaled-down variant from the +`\xintiiexpr...\relax` +parser from package [xintexpr](http://ctan.org/pkg/xintexpr). + +To support hexadecimal input and output, the package +[xintbinhex](http://ctan.org/pkg/xint) is loaded automatically. + +The package loads by default [xintcore](http://ctan.org/pkg/xint) +but the option _custom_ together with macro `\bnumexprsetup` allow to map +the syntax elements to macros from an alternative big integer +expandable engine of the user own choosing, +and then [xintcore](http://ctan.org/pkg/xint) is not loaded. + +Note; the possibility not to use the xintcore macros might be removed in the future: perhaps a future release will maintain during computations a private internal representation (especially tailored either for the xintcore macros or new ones which would be included within `bnumexpr.sty` itself) and the constraints this implies may render optional use of other macros impossible. -[^1]: <http://www.ctan.org/pkg/xint> - Installation ------------- +============ -Obtain `bnumexpr.dtx` (and possibly, `bnumexpr.ins` and the `README`) -from CTAN: +Use your installation manager to install or update `bnumexpr`. + +Else, obtain `bnumexpr.dtx`, from CTAN: > <http://www.ctan.org/pkg/bnumexpr> -Both `"tex bnumexpr.ins"` and `"tex bnumexpr.dtx"` extract from -`bnumexpr.dtx` the following files: +Run `"etex bnumexpr.dtx"` to extract these files: `bnumexpr.sty` : this is the style file. `README.md` - : reconstitutes this README. `bnumexprchanges.tex` - : lists changes from the initial version. + : change history. `bnumexpr.tex` : can be used to generate the documentation: @@ -88,13 +79,10 @@ Both `"tex bnumexpr.ins"` and `"tex bnumexpr.dtx"` extract from : - with latex+dvipdfmx: `"latex bnumexpr.tex"` (thrice) then `"dvipdfmx bnumexpr.dvi"`. - : Ignore dvipdfmx warnings, but if the pdf file has problems with - fonts (possibly from an old dvipdfmx), use then rather pdflatex. - : - with pdflatex: `"pdflatex bnumexpr.tex"` (thrice). : In both cases files `README.md` and `bnumexprchanges.tex` must - be present in the same repertory. + be located in the same repertory as `bnumexpr.tex` and `bnumexpr.dtx`. without `bnumexpr.tex`: : `"pdflatex bnumexpr.dtx"` (thrice) extracts all files and @@ -105,18 +93,14 @@ Finishing the installation: bnumexpr.sty --> TDS:tex/latex/bnumexpr/ bnumexpr.dtx --> TDS:source/latex/bnumexpr/ - bnumexpr.ins --> TDS:source/latex/bnumexpr/ bnumexpr.pdf --> TDS:doc/latex/bnumexpr/ - README --> TDS:doc/latex/bnumexpr/ - -Files `bnumexpr.tex`, `bnumexprchanges.tex`, `README.md` may be -discarded. + README.me --> TDS:doc/latex/bnumexpr/ License -------- +======= -Copyright (C) 2014-2019 by Jean-Francois Burnol +Copyright (C) 2014-2021 by Jean-Francois Burnol | This Work may be distributed and/or modified under the | conditions of the LaTeX Project Public License 1.3c. @@ -134,17 +118,28 @@ The Author and Maintainer of this Work is Jean-Francois Burnol. This Work consists of the main source file `bnumexpr.dtx` and the derived files - bnumexpr.sty, bnumexpr.pdf, bnumexpr.ins, bnumexpr.tex, - bnumexprchanges.tex, README.md + bnumexpr.sty, bnumexpr.pdf, bnumexpr.tex, bnumexprchanges.tex, + and README.md %</readme>-------------------------------------------------------- %<*!readme> %% --------------------------------------------------------------- %% The bnumexpr package: Expressions with big integers -%% Copyright (C) 2014-2019 by Jean-Francois Burnol +%% Copyright (C) 2014-2021 by Jean-Francois Burnol %% %</!readme> %<*changes>------------------------------------------------------- +\item[1.4 (2021/05/12)] + \begin{itemize} + \item technology transfer from \xintexprname |1.4| of + |2020/01/31|. The |\expanded| primitive is now required (TeXLive + 2019). + \item addition to the syntax of the |"| prefix for hexadecimal + input. + \item addition of |\evaltohex| which is like |\bnumeval| with an extra + conversion step to hexadecimal notation. + \end{itemize} + \item[1.2e (2019/01/08)] Fixes a documentation glitch (extra braces when mentioning |\the\numexpr| or |\thebnumexpr|). @@ -235,35 +230,6 @@ and the derived files %%% mode: latex %%% End: %</drv>----------------------------------------------------------- -%<*ins>----------------------------------------------------------- -%% tex bnumexpr.ins will extract bnumexpr.sty from bnumexpr.dtx -%% -\input docstrip.tex -\askforoverwritefalse -\generate{\nopreamble\nopostamble -\file{README.md}{\from{bnumexpr.dtx}{readme}} -\usepreamble\defaultpreamble -\usepostamble\defaultpostamble -\file{bnumexprchanges.tex}{\from{bnumexpr.dtx}{changes}} -\file{bnumexpr.tex}{\from{bnumexpr.dtx}{drv}} -\file{bnumexpr.sty}{\from{bnumexpr.dtx}{package}}} -\catcode32=13\relax% active space -\let =\space% -\Msg{************************************************************************} -\Msg{*} -\Msg{* To finish the installation you have to move the following} -\Msg{* files into a directory searched by TeX:} -\Msg{*} -\Msg{* bnumexpr.sty} -\Msg{*} -\Msg{* To produce the documentation run latex thrice on bnumexpr.tex} -\Msg{* then dvipdfmx on bnumexpr.dvi. (ignore the dvipdfmx warnings)} -\Msg{*} -\Msg{* Happy TeXing!} -\Msg{*} -\Msg{************************************************************************} -\endbatchfile -%</ins>----------------------------------------------------------- %<*dtx> \fi % end of \iffalse block around generated files \chardef\noetex 0 @@ -311,7 +277,6 @@ and the derived files \usepreamble\defaultpreamble \usepostamble\defaultpostamble \file{bnumexprchanges.tex}{\from{bnumexpr.dtx}{changes}} - \file{bnumexpr.ins}{\from{bnumexpr.dtx}{ins}} \file{bnumexpr.tex}{\from{bnumexpr.dtx}{drv}} \file{bnumexpr.sty}{\from{bnumexpr.dtx}{package}}} \endgroup @@ -346,7 +311,6 @@ and the derived files \pagestyle{headings} \usepackage[T1]{fontenc} -\usepackage[latin1]{inputenc} \usepackage[hscale=0.66,vscale=0.75]{geometry} @@ -361,13 +325,13 @@ and the derived files \definecolor{joli}{RGB}{225,95,0} \definecolor{JOLI}{RGB}{225,95,0} \definecolor{BLUE}{RGB}{0,0,255} -%\definecolor{niceone}{RGB}{38,128,192}% utilisé avant pour urlcolor +%\definecolor{niceone}{RGB}{38,128,192}% utilisé avant pour urlcolor %\colorlet{smallverbcolor}{RoyalPurple}% \colorlet{jfverbcolor}{yellow!5} \colorlet{smallverbcolor}{NavyBlue}% \colorlet{softwrapcolor}{blue} \colorlet{digitscolor}{OrangeRed} -% transféré de xint-manual.tex (maintenant dans xint.dtx) +% transféré de xint-manual.tex (maintenant dans xint.dtx) \DeclareFontFamily{U}{MdSymbolC}{} \DeclareFontShape {U}{MdSymbolC}{m}{n}{<-> MdSymbolC-Regular}{} @@ -383,14 +347,14 @@ and the derived files \usepackage[english]{babel} -\usepackage[pdfencoding=pdfdoc]{hyperref} +\usepackage{hyperref} \hypersetup{% %linktoc=all,% breaklinks=true,% colorlinks=true,% urlcolor=SkyBlue,% linkcolor=PineGreen,% -pdfauthor={Jean-Fran\c cois Burnol},% +pdfauthor={Jean-François Burnol},% pdftitle={The bnumexpr package},% pdfsubject={Arithmetic with TeX},% pdfkeywords={Expansion, arithmetic, TeX},% @@ -403,7 +367,7 @@ pdfpagemode=UseOutlines} \def\MicroFont {\ttfamily\cdbx@SetSoftWrapBox\color{smallverbcolor}} %\def\MicroFont {\ttfamily \color[named]{OrangeRed}\cdbx@SetSoftWrapBox } -% \MacroFont est utilisé par macrocode, mais sa définition est figée dans +% \MacroFont est utilisé par macrocode, mais sa définition est figée dans % \macro@font au \begin{document} \def\MacroFont {\ttfamily \baselineskip12pt\relax } @@ -419,7 +383,7 @@ pdfpagemode=UseOutlines} \def\macrocode{\macro@code \frenchspacing \@vobeyspaces - \makestarlowast % \makequotesstraight (obsolète) + \makestarlowast % \makequotesstraight (obsolète) \xmacro@code } %--- lower * symbol in text @@ -443,11 +407,11 @@ pdfpagemode=UseOutlines} % } %------------ -% Tentative, mardi 09 septembre 2014 à 22:41:28 +% Tentative, mardi 09 septembre 2014 à 22:41:28 -% Modifié mardi 13 octobre 2015 à 15:24:00 pour utilisable en +% Modifié mardi 13 octobre 2015 à 15:24:00 pour utilisable en % argument, et en particulier dans un \footnote{}. Mais utilise -% \scantokens et macro délimitée maintenant. +% \scantokens et macro délimitée maintenant. %\def\jf@makeletter #1{\catcode`#111\relax } @@ -471,7 +435,7 @@ pdfpagemode=UseOutlines} \@jfverb }% -% Pour v1.2 je laisse tomber les colorbox. À la place je change la couleur +% Pour v1.2 je laisse tomber les colorbox. À la place je change la couleur % du texte. J'utilise le violet de xint. (mis dans \Microfont) % \def\@@@jfverb #1{\ifcat\noexpand#1$% $ % \endgroup\else @@ -487,13 +451,15 @@ pdfpagemode=UseOutlines} \makeatother -% mardi 13 octobre 2015 à 15:32:51 +% mardi 13 octobre 2015 à 15:32:51 % le | n'est pas encore actif ici! \catcode`| \active \def\bneshow #1% - {|\thebnumexpr#1\relax|$$\color{digitscolor}\thebnumexpr#1\relax$$} + {|\thebnumexpr#1\relax|$$\color{digitscolor}\bnumexpr#1\relax$$} \def\bneshoweval #1% {|\bnumeval{#1}|$$\color{digitscolor}\bnumeval{#1}$$} + \def\bneshowevaltohex #1% + {|\evaltohex{#1}|$$\color{digitscolor}\evaltohex{#1}$$} \catcode`| 12 \DeclareRobustCommand\csa [1]{{\char92\detokenize{#1}}} @@ -533,7 +499,7 @@ pdfpagemode=UseOutlines} % Actually my \centeredline works nicely in list environments. -% \ignorespaces ajouté le 9 juin 2013. +% \ignorespaces ajouté le 9 juin 2013. % Note: \centeredline creates a group @@ -569,7 +535,7 @@ pdfpagemode=UseOutlines} } {\centering - \textsc{Jean-François Burnol}\par + \textsc{Jean-François Burnol}\par \footnotesize jfbu (at) free (dot) fr\par Package version: \bneversion\ (\bnepackdate); @@ -580,33 +546,53 @@ pdfpagemode=UseOutlines} \etocsetnexttocdepth{section} \tableofcontents -\section{Examples} +\section{\csh{thebnumexpr}, \csh{bnumeval}, \csh{evaltohex}} \label{sec:bnumexpr} -Package \bnumname provides |\thebnumexpr|\meta{expression}|\relax| which is -analogous to |\the\numexpr|\meta{expression}|\relax|, with these extensions: +\LaTeX\ Package \bnumname provides |\thebnumexpr|\meta{expression}|\relax|:% +% +\footnote{Since |1.4|, one can use |\bnumexpr...\relax| directly in + typesetting context, it is not mandatory to prefix it with |\bnethe| or to + use |\thebnumexpr|.} +% +it is analogous to + |\the\numexpr|\meta{expression}|\relax|, with these extensions: \begin{itemize} \item it allows arbitrarily big integers, \item it computes powers (with either |**| or |^| as infix operator), \item it computes factorials (with |!| as postfix operator), \item it has an operator |//| for floored division and |/:| for the associated modulo, -\item the space character can be used to separate in the source blocks of -digits for better readability of long numbers, -\item since |1.2b| the underscore |_| may also be used as visual digit +\item the space character is ignored and can thus be used to separate in the + source blocks of digits for better readability of long numbers, +\item also the underscore |_| may be used as visual digit separator, \item comma separated expressions are allowed. \end{itemize} -It expands completely, but in two steps (whereas -|\the\numexpr|\meta{expression}|\relax| expands in one step only, and -|\numexpr| by itself is not expandable). +There is also an alternative interface |\bnumeval|\marg{expression}, where the +expression is fetched as braced argument. And there is +|\evaltohex|\marg{expression} which does the same as +|\bnumeval|\marg{expression} but with a conversion to hexadecimal notation of +the (possibly comma separated) output. Hexadecimal input uses the |"| prefix. -|1.2d| adds a |\bnumeval|\marg{expression} interface. The |\bnumeval| macro -also expands completely in two steps. +This package parser is a scaled-down variant of |\xintiiexpr| from package +\xintexprname, dropping support for nested structures, functions, variables, +booleans, etc..., but incorporating by default support for hexadecimal input +as \xintbinhexname will be automatically loaded. -Examples: +The \eTeX{} extensions are required, this is the default on all modern +installations for \verb?latex|pdflatex? and also for \verb?xelatex|lualatex?. -\noindent\bneshow {1 208 637 867 * (2 187 917 891 + 3 109 197 072)}% +Further, at |1.4| (|2021/05/12|) the |\expanded| primitive is +required. It is available in all engines since \TeX Live 2019. + +By default the arithmetic operations are executed via the \xintcorename +macros, but via option |custom| and usage of |\bnumexprsetup| it is +possible to replace them by expandable macros of a custom origin. + +\section{Examples} + +\noindent\bneshow {---1 208 637 867 * (2 187 917 891 - 3 109 197 072)}% \bneshoweval {(13_8089_1090-300_1890_2902)*(1083_1908_3901-109_8290_3890)}% \bneshow{(92_874_927_979**5-31_9792_7979**6)/30!}% \bneshoweval {30!/20!/21/22/23/24/25/(26*27*28*29)}% @@ -614,6 +600,8 @@ Examples: \bneshoweval {13^50/12^50, 12^50}% \bneshow {(1^10+2^10+3^10+4^10+5^10+6^10+7^10+8^10+9^10)^3}% \bneshoweval {100!/36^100}% +\bneshoweval {"10*"100*"1000*"A0000, 16^(1+2+3+4)*10}% +\bneshowevaltohex{"7FFFFFFF+1, "400^3, "ABCDEF*"FEDCBA}% \section{Differences from \csh{numexpr}} @@ -622,16 +610,11 @@ Apart from the extension to big integers (i.e. exceeding the \TeX{} limit at differences between |\bnumexpr| and |\numexpr|: \begin{enumerate} -\item one must use either |\thebnumexpr| or |\bnethe\bnumexpr| to get a - printable result, as |\bnumexpr...\relax| expands to a private format (using - |\number| as prefix to |\bnumexpr| would only serve to trigger the expansion - to the \bnumname private format, hence will raise a \TeX\ error), - -\item one may embed directly (without |\bnethe|) a |\bnumexpr...\relax| - in another one (or in a |\xintexpr...\relax|), but not in a - |\numexpr...\relax|; on the other hand a |\numexpr...\relax| does not need to - be prefixed by |\the| or |\number| inside |\bnethe\bnumexpr| or - |\thebnumexpr|, +\item one may embed directly |\bnumexpr...\relax| in another one (or in + a |\xintexpr...\relax|), but not in a |\numexpr...\relax|: it must + then be using |\thebnumexpr...| or |\bnethe\bnumexpr...| syntax; on + the other hand a |\numexpr...\relax| does not need to be prefixed by + |\the| or |\number| inside |\bnumexpr...\relax|. \item contrarily to |\numexpr|, the |\bnumexpr| parser stops only after having found (and swallowed) a mandatory ending |\relax| token, @@ -644,9 +627,9 @@ differences between |\bnumexpr| and |\numexpr|: |\thebnumexpr 3 5+79\relax| expands (in two steps) to \expandafter\expandafter\expandafter|\thebnumexpr 3 5+79\relax| -\item one may do |\edef\tmp{\bnumexpr 1+2\relax}|, and then either use - |\tmp| in another |\bnumexpr...\relax|, or print it via - |\bnethe\tmp|. The computation is done at the time of the |\edef| +\item one may do |\edef\variable{\bnumexpr 1+2\relax}|, and then either use + |\variable| in another |\bnumexpr...\relax|, or print it via + |\bnethe\variable| (or directly since |1.4|). The computation is done at the time of the |\edef| (and two expansion steps suffice). This is again in contrast with |\numexpr...\relax| which, without |\the| (or |\number| or |\romannumeral|) as prefix would not expand inside an |\edef|, @@ -666,22 +649,12 @@ differences between |\bnumexpr| and |\numexpr|: % \thebnumexpr 2\cnta\relax \item more generally, tacit multiplication applies in front of parenthesized - sub-expressions, or sub |\bnumexpr...\relax| (or |\numexpr...\relax|), + sub-expressions, or sub |\bnumexpr...\relax| (or |\numexpr...\relax|), or + also after parentheses in front of numbers, \item the underscore |_| is accepted within the digits composing a number and - is silently ignored by |\bnumexpr|, + is silently ignored by |\bnumexpr|. -\item |\numexpr| accepts \TeX\ syntax for hexadecimal input |"EF| (or octal - input |'377|), but currently |\bnumexpr| does not. This could possibly be - added in future% -% -\footnote{It is only a matter of copying pasting relevant code from - \xintexprname, so depends upon user demands addressed to the author |;-)|.} -% - (hexadecimal prefix |"| is part of the recognized - |\xintiiexpr| syntax from \xintexprname if \xintbinhexname is loaded.) In - the meantime, one may encapsulate such inputs (obeying \TeX's bound on - numbers) into a sub |\numexpr...\relax|. \end{enumerate} An important thing to keep in mind is that if one has a calculation @@ -692,37 +665,6 @@ situation is exactly as with a |\the\numexpr...\relax|, thus one may need to terminate the number to avoid premature expansion of following tokens; for example with the |\space| token. -The parser |\bnumexpr| is a scaled-down version of parser |\xintiiexpr| from -package \xintexprname. It lacks in particular -boolean operators, square roots and other functions, variables, hexadecimal -inputs, etc... it may be slightly faster when handling complicated -expressions as it does not have to check so many things. - -The documentation of \xintexprname explains that there is an -impact on the memory of \TeX{} (the string pool, the hash table) as each -intermediate number is stored as a dummy control sequence name during -processing. After thousands of evaluations with numbers having hundreds of -digits, parts of the \TeX{} memory can become saturated and end the -\verb?latex|pdflatex? run, but the problem can be avoided via enlarged memory -parameters for |pdftex|, as made possible by modern TeX installations. -Anyhow, computations with thousands of digits take time, and this is probably -a more stringent constraint. - -If the same operations need to be repeated again and again tens of thousands -of times on varying (big) numbers, the memory problem mentioned above may be -avoided by using nested macros rather than |\bnumexpr| or |\xintexpr| -expressions. Utility |\xintNewIIExpr| from package \xintexprname can be used -to construct the possibly very complicated nested macro from a given -expression with the needed operators and usual {\catcode`# 12 |#1, #2, #3, - ...|} placeholders. - -% je voulais dire qu'une telle macro pouvait être préparée séparément, mais il -% faudrait expliquer qu'il faut récupérer son \meaning, et j'ai le problème de -% mes \romannumeral`&&@ maintenant... note 2015/10/27. Donc je laisse tomber. - -The \eTeX{} extensions are required (this is the default on all modern -installations for \verb?latex|pdflatex? and also for \verb?xelatex|lualatex?). - \section{Printing big numbers} \LaTeX{} will not split long numbers at the end of lines. I personally @@ -746,13 +688,9 @@ often use helper macros (not in the package) of the following type: It is the expected one with infix operators and parentheses, the recognized operators being |+|, |-|, |*|, |/| (rounded division), |^| (power), |**| (power), |//| (by default floored division), -|/:| (the associated modulo) and |!| (factorial).% -% -\footnote{Releases |1.2b| and earlier associated in the default configuration - truncated division to |//|. This was changed at |1.2c| to stay in sync with - \xintcorename |1.2p|. For backwards compatibility, one may add to existing - document \string\bnumexprsetup\{div=\string\xintiiDivTrunc, - mod=\string\xintiiModTrunc\}.} +|/:| (the associated modulo) and |!| (factorial). One can input hexadecimal +numbers as in \TeX\ syntax for number assignments, i.e. using a |"| prefix and +only uppercase letters |ABCDEF|. The modulo |/:| is by default associated with the floored division |//|, but using |\bnumexprsetup{mod=...}| it can, like the other operators, be remapped @@ -763,7 +701,9 @@ expression is handled token by token, any component (digit, operator, parenthesis... even the ending |\relax|) may arise on the spot from macro expansions. -The precedence rules are the expected ones. +The precedence rules are the expected ones. Tacit multiplication applies in +front of parentheses, and after them, and it has an elevated precedence +compared to multiplication explicitly induced by |*|. There is currently no user interface to change precedence levels. The three operators |/|, |//|, |/:| are at the same level of precedence as the @@ -771,7 +711,12 @@ multiplication |*|. The factorial postfix |!| has highest precedence. The minus signs inherit the precedence level of the previously encountered infix operators. -In case of equal precedence the operations are left-associative, +In case of equal precedence the operations are left-associative,% +% +\footnote{But it has been announced at \xintexprname \texttt{1.4} that + probably in future power operator will become right-associative, and if this + is done, this will be transferred to \bnumname also.} +% hence:\newline \bneshoweval{2^3^4, (2^3)^4, 2^(3^4)} The underscore |_| can be used to separate digits in long numbers, for @@ -784,11 +729,10 @@ package \xintcorename. \section{\csh{bnumexprsetup}} -Package \bnumname needs that some big integer engine provides the macros -doing the actual computations. By default, it loads package -\xintcorename (a subset of \href{http://www.ctan.org/pkg/xint}{xint}; -version |1.3d| is required) and uses \csa{bnumexprsetup} in the following -way: +Package \bnumname needs that some big integer engine provides the macros doing +the actual computations. By default, it loads package \xintcorename (a subset +of \href{http://www.ctan.org/pkg/xint}{xint}) and uses \csa{bnumexprsetup} in +the following way: \begin{verbatim} \usepackage{xintcore} \bnumexprsetup{add=\xintiiAdd, sub=\xintiiSub, mul=\xintiiMul, @@ -830,6 +774,9 @@ Macro |\bnumexprsetup| can be used multiple times in the same document, thus allowing to switch math engines or to remap operators to some other arithmetic macros of the same math engine. Its effect obeys the local scope. +At |1.4| release there is no option to customize how the hexadecimal input and +output is handled, it goes necessarily via the \xintbinhexname macros. + \section{Readme} \begingroup \makeatletter\def\x{\baselineskip10pt @@ -855,7 +802,7 @@ macros of the same math engine. Its effect obeys the local scope. \newgeometry{hscale=0.75,vscale=0.75}% ATTENTION \newgeometry fait % un reset de vscale si on ne le - % précise pas ici !!! + % précise pas ici !!! \MakePercentIgnore % @@ -867,505 +814,546 @@ macros of the same math engine. Its effect obeys the local scope. % % \section{Package \bnumnameimp implementation} % \label{sec:bnumexprcode} +% \etocdefaultlines +% \localtableofcontents % -% \localtableofcontents \bigskip +% Comments are sparse. Actually at |1.4|, there are simply no comments. I +% transferred from \xintexprname its |\expanded| based infra-structure from +% its own |1.4| release of January 2020. It is a possibility that, even +% though I did remove very large chunks of unneeded macros, in the end, some +% more simplifications could have been considered here. % -% Comments are sparse. Error handling by the parser is kept to a minimum; if -% something goes wrong, the offensive token gets discarded, and some undefined -% control sequence attempts to trigger writing to the log of some sort of -% informative message. It is recommended to set |\errorcontextlines| to at -% least |2| for more meaningful context. +% Error handling by the parser is kept to a minimum; if something goes wrong, +% the offensive token gets discarded, and it is not even always the case that +% some expandable error message is issued. % % \subsection{Package identification and catcode setup} -% |v1.2c| forgot to identify itself as such |:(|. Fixed (of course) at |v1.2d|. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}% -\ProvidesPackage{bnumexpr}[2019/01/08 v1.2e Expressions with big integers (JFB)]% -\edef\BNErestorecatcodes {\catcode`\noexpand\!\the\catcode`\! - \catcode`\noexpand\?\the\catcode`\? - \catcode`\noexpand\_\the\catcode`\_ - \catcode`\noexpand\:\the\catcode`\: - \catcode`\noexpand\(\the\catcode`\( - \catcode`\noexpand\)\the\catcode`\) - \catcode`\noexpand\*\the\catcode`\* - \catcode`\noexpand\,\the\catcode`\,\relax }% -\catcode`\! 11 -\catcode`\? 11 -\catcode`\_ 11 -\catcode`\: 11 -\catcode`\, 12 -\catcode`\* 12 -\catcode`\( 12 +\ProvidesPackage{bnumexpr}[2021/05/12 v1.4 Expressions with big integers (JFB)]% % \end{macrocode} -% \subsection{Some helper macros and constants from xint} -% These macros from xint should not change, hence overwriting them here should -% not be cause for alarm. I opted against renaming everything with |\BNE_| -% prefix rather than |\xint_|. The |\xint_dothis|/|\xint_orthat| thing is a new -% style I have adopted for expandably forking. The least probable branches -% should be specified first, for better efficiency. See examples of uses in the -% present code. +% \subsection{Load unconditionally xintbinhex} +% Newly done at |1.4|. Formerly, \bnumname had no dependency if loaded +% with option |custom|. But for |1.4| release I have decided to add +% unconditional support for hexadecimal notation. +% +% Let's require the most recent xint date at time of +% writing. We should check for availability of \string\expanded\space but well. +% % \begin{macrocode} -\chardef\xint_c_ 0 -\chardef\xint_c_i 1 -\chardef\xint_c_ii 2 -\chardef\xint_c_vi 6 -\chardef\xint_c_vii 7 -\chardef\xint_c_viii 8 -\chardef\xint_c_ix 9 -\chardef\xint_c_x 10 -\long\def\xint_gobble_i #1{}% -\long\def\xint_gobble_iii #1#2#3{}% -\long\def\xint_firstofone #1{#1}% -\long\def\xint_firstoftwo #1#2{#1}% -\long\def\xint_secondoftwo #1#2{#2}% -\long\def\xint_firstofthree #1#2#3{#1}% -\long\def\xint_secondofthree #1#2#3{#2}% -\long\def\xint_thirdofthree #1#2#3{#3}% -\def\xint_gob_til_! #1!{}% this ! has catcode 11 -\long\def\xint_UDsignfork #1-#2#3\krof {#2}% -\long\def\xint_afterfi #1#2\fi {\fi #1}% -\long\def\xint_dothis #1#2\xint_orthat #3{\fi #1}% -\let\xint_orthat \xint_firstofone -\long\def\xint_zapspaces #1 #2{#1#2\xint_zapspaces }% +\RequirePackage{xintbinhex}[2021/05/10]% % \end{macrocode} % \subsection{\csh{bnumexprsetup}} -% New with |v1.2a|. Replaces removed |\bnumexprUsesbigintcalc| etc... % \begin{macrocode} -\catcode`! 3 -\def\bnumexprsetup #1{\BNE_parsekeys #1,=!,}% -\def\BNE_parsekeys #1=#2#3,{\ifx!#2\expandafter\BNE_parsedone\fi +{\catcode`! 3 \catcode`_ 11 % + \gdef\bnumexprsetup #1{\BNE_parsekeys #1,=!,}% + \gdef\BNE_parsekeys #1=#2#3,% + {% + \ifx!#2\expandafter\BNE_parsedone\fi \expandafter -\let\csname BNE_Op_\xint_zapspaces #1 \xint_gobble_i\endcsname=#2\BNE_parsekeys + \let\csname BNE_Op_\xint_zapspaces #1 \xint_gobble_i\endcsname% + =#2\BNE_parsekeys + }% + \gdef\BNE_parsedone #1\BNE_parsekeys {}% }% -\catcode`! 11 -\def\BNE_parsedone #1\BNE_parsekeys {}% % \end{macrocode} % \subsection{Package options} -% |v1.2c| replaces former key |divtrunc| by |div|. |v1.2d| requires (by -% default) |xintcore 1.3d|. % \begin{macrocode} -\def\BNE_tmpa {0}% -\DeclareOption {custom}{\def\BNE_tmpa {1}}% +\def\BNEtmpa {0}% +\DeclareOption {custom}{\def\BNEtmpa {1}}% \ProcessOptions\relax -\if0\BNE_tmpa % Default is to load xintcore.sty - \RequirePackage{xintcore}[2019/01/06]% xintcore 1.3d +\edef\BNErestorecatcodes{\XINTrestorecatcodes}% +\XINTsetcatcodes% +\if0\BNEtmpa\expandafter\xint_secondoftwo\fi +\xint_gobble_i{% + \RequirePackage{xintcore}[2021/05/10]% \bnumexprsetup{add=\xintiiAdd, sub=\xintiiSub, mul=\xintiiMul, divround=\xintiiDivRound, div=\xintiiDivFloor, mod=\xintiiMod, pow=\xintiiPow, fac=\xintiiFac}% -\fi +}% +% \end{macrocode} +% Strangely those three are not defined in xintkernel.sty, but only in xint.sty +% \begin{macrocode} +\long\def\xint_firstofthree #1#2#3{#1}% +\long\def\xint_secondofthree #1#2#3{#2}% +\long\def\xint_thirdofthree #1#2#3{#3}% % \end{macrocode} % \subsection{\csh{bnumexpr}, \csh{thebnumexpr}, \csh{bnethe}, \csh{bnumeval}} -% In the full |\xintexpr|, the final unlocking may involve post-treatment of -% the comma separated values, hence there are |_print| macros to handle the -% possibly comma separated values. Here we may just identify |_print| with -% |_unlock|. -% -% With |v1.2a| the gathering of numbers happens directly inside -% |\csname...\endcsname|. There is no more a ``locking'' macro. -% -% Attention |v1.2d| gives new meaning to |\bnumeval|, the former meaning is -% now named |\bnumexpro|. The leading space in |\BNE_wrap| is removed at it -% served to nothing. % \begin{macrocode} -\def\bnumexpr {\romannumeral0\bnumexpro }% -\def\bnumexpro{\expandafter\BNE_wrap\romannumeral0\BNE_eval }% -\def\BNE_eval {\expandafter\BNE_until_end_a\romannumeral-`0\BNE_getnext }% -\def\BNE_wrap {!\BNE_usethe\BNE_protect\BNE_unlock }% -\protected\def\BNE_usethe\BNE_protect {\BNE:missing_bnethe!}% -\def\BNE_protect\BNE_unlock - {\noexpand\BNE_protect\noexpand\BNE_unlock\noexpand }% -\let\BNE_done\space +\def\XINTfstop {\noexpand\XINTfstop}% +\def\bnumexpr {\romannumeral0\bnumexpro}% +\def\bnumexpro {\expandafter\BNE_wrap\romannumeral0\bnebareeval }% +\def\BNE_wrap {\XINTfstop\BNEprint.}% +\def\bnumeval #1% + {\expanded\expandafter\BNEprint\expandafter.\romannumeral0\bnebareeval#1\relax}% +\def\evaltohex #1% + {\expanded\expandafter\BNEprinthex\expandafter.\romannumeral0\bnebareeval#1\relax}% \def\thebnumexpr - {\romannumeral-`0\expandafter\BNE_unlock\romannumeral0\BNE_eval }% -\def\bnethe #1{\romannumeral-`0\expandafter\xint_gobble_iii\romannumeral-`0#1}% -\def\bnumeval#1% - {\romannumeral-`0\expandafter\BNE_unlock\romannumeral0\BNE_eval#1\relax}% -\def\BNE_unlock {\expandafter\BNE_unlock_a\string }% -\def\BNE_unlock_a #1.={}% + {\expanded\expandafter\BNEprint\expandafter.\romannumeral0\bnebareeval}% +\def\bnebareeval{\BNE_start}% +\def\bnethe#1{\expanded\expandafter\xint_gobble_i\romannumeral`&&@#1}% +\protected\def\BNEprint.#1{{\BNE_print#1.}}% +\def\BNE_print#1{#1\expandafter\BNE_print_a\string}% +\def\BNE_print_a#1{\unless\if#1.\expandafter\BNE_print_b\fi}% +\def\BNE_print_b + {\expandafter\BNE_print_c\expandafter{\expandafter\xint_gobble_i\string}}% +\def\BNE_print_c#1{, #1\expandafter\BNE_print_a\string}% +\protected\def\BNEprinthex.#1{{\BNE_printhex#1.}}% +\def\BNE_printhex#1{\xintDecToHex{#1}\expandafter\BNE_printhex_a\string}% +\def\BNE_printhex_a#1{\unless\if#1.\expandafter\BNE_printhex_b\fi}% +\def\BNE_printhex_b + {\expandafter\BNE_printhex_c\expandafter{\expandafter\xint_gobble_i\string}}% +\def\BNE_printhex_c#1{, \xintDecToHex{#1}\expandafter\BNE_printhex_a\string}% % \end{macrocode} % \subsection{\csh{BNE_getnext}} -% The getnext scans forward to find a number: after expansion of what comes -% next, an opening parenthesis signals a parenthesized sub-expression, a |!| -% with catcode 11 signals there was there a sub |\bnumexpr...\relax| (now -% evaluated), a minus sign is treated as a prefix operator inheriting its -% precedence level from the previous operator, a plus sign is swallowed, a -% |\count| or |\dimen| will get fetched to |\number| (in case of a count -% variable, this provides a full locked number but |\count0 1| for example is -% like |1231| if |\count0|'s value is |123|); a digit triggers the -% number scanner. With |v1.2a| the gathering of digits happens directly inside -% |\csname .=...\endcsname|. Leading zeroes are trimmed directly. -% The flow then proceeds with |\BNE_getop| which looks for the next operator -% or possibly the end of the expression. Note: |\bnumexpr\relax| is -% illegal. -% -% Extended in v1.2a to recognize |\ht|, etc... % \begin{macrocode} \def\BNE_getnext #1% {% - \expandafter\BNE_getnext_a\romannumeral-`0#1% + \expandafter\BNE_put_op_first\romannumeral`&&@% + \expandafter\BNE_getnext_a\romannumeral`&&@#1% }% +\def\BNE_put_op_first #1#2#3{\expandafter#2\expandafter#3\expandafter{#1}}% \def\BNE_getnext_a #1% {% - \xint_gob_til_! #1\BNE_gn_foundexpr !% this ! has catcode 11 - \ifcat\relax#1% \count or \numexpr etc... token or count, dimen, skip cs - \expandafter\BNE_gn_countetc - \else - \expandafter\expandafter\expandafter\BNE_gn_fork\expandafter\string - \fi - #1% + \ifx\relax #1\xint_dothis\BNE_foundprematureend\fi + \ifx\XINTfstop#1\xint_dothis\BNE_subexpr\fi + \ifcat\relax#1\xint_dothis\BNE_countetc\fi + \xint_orthat{}\BNE_getnextfork #1% }% -\def\BNE_gn_foundexpr !#1\fi !{\expandafter\BNE_getop\xint_gobble_iii }% -\def\BNE_gn_countetc #1% +\def\BNE_foundprematureend\BNE_getnextfork #1{{}\xint_c_\relax}% +\def\BNE_subexpr #1.#2% {% - \ifx\count#1\else\ifx\dimen#1\else\ifx\numexpr#1\else\ifx\dimexpr#1\else - \ifx\skip#1\else\ifx\glueexpr#1\else\ifx\fontdimen#1\else\ifx\ht#1\else - \ifx\dp#1\else\ifx\wd#1\else\ifx\fontcharht#1\else\ifx\fontcharwd#1\else - \ifx\fontchardp#1\else\ifx\fontcharic#1\else - \BNE_gn_unpackvar - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi - \expandafter\BNE_getnext\number #1% + \expanded{\unexpanded{{#2}}\expandafter}\romannumeral`&&@\BNE_getop }% -\def\BNE_gn_unpackvar\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi - \expandafter\BNE_getnext\number #1% +\def\BNE_countetc\BNE_getnextfork#1% {% - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi - \expandafter\BNE_getop\csname .=\number#1\endcsname + \if0\ifx\count#11\fi + \ifx\dimen#11\fi + \ifx\numexpr#11\fi + \ifx\dimexpr#11\fi + \ifx\skip#11\fi + \ifx\glueexpr#11\fi + \ifx\fontdimen#11\fi + \ifx\ht#11\fi + \ifx\dp#11\fi + \ifx\wd#11\fi + \ifx\fontcharht#11\fi + \ifx\fontcharwd#11\fi + \ifx\fontchardp#11\fi + \ifx\fontcharic#11\fi 0\expandafter\BNE_fetch_as_number\fi + \expandafter\BNE_getnext_a\number #1% +}% +\def\BNE_fetch_as_number + \expandafter\BNE_getnext_a\number #1% +{% + \expanded{{{\number#1}}\expandafter}\romannumeral`&&@\BNE_getop }% % \end{macrocode} -% This is quite simplified here compared to |\xintexpr|, for various reasons: we -% have dropped the |\xintNewExpr| thing, and we can treat the |(| directly as we -% don't have to get back to check if we are in an |\xintexpr|, -% |\xintfloatexpr|, etc.. +% In the case of hitting a |(|, previous release inserted directly a +% |\BNE_oparen|. But the expansion architecture imported from upstream +% |\xintiiexpr| has been refactored, and the |..._oparen| meaning and +% usage evolved. We stick with |{}\xint_c_ii^v (| from upstream, +% which works (I am 15 months away from \xintexprname |1.4|). % \begin{macrocode} -\def\BNE_gn_fork #1{% - \if#1+\xint_dothis \BNE_getnext\fi - \if#1-\xint_dothis -\fi - \if#1(\xint_dothis \BNE_oparen \fi - \xint_orthat {\BNE_scan_number #1}% +\def\BNE_getnextfork #1{% + \if#1+\xint_dothis \BNE_getnext_a \fi + \if#1-\xint_dothis {{}{}-}\fi + \if#1(\xint_dothis {{}\xint_c_ii^v (}\fi + \xint_orthat {\BNE_scan_number #1}% }% % \end{macrocode} -% \subsection{Parsing an integer} -% We gather a string of digits, plus and minus prefixes have already been -% swallowed. There might be some leading string of zeros which will have to be -% removed. In the full |\xintexpr| the situation is more involved as it -% has to recognize and accept decimal numbers, numbers in scientific notation, -% also hexadecimal numbers, function names, variable names\dots +% \subsection{Parsing an integer in decimal or hexadecimal notation} % \begin{macrocode} -\def\BNE_scan_number #1% this #1 has necessarily here catcode 12 +\def\BNE_scan_number #1% {% - \ifnum \xint_c_ix<1#1 \else\expandafter\BNE_notadigit\fi - \BNE_scan_nbr #1% + \if "#1\xint_dothis \BNE_scanhex\fi + \ifnum \xint_c_ix<1\string#1 \xint_dothis \BNE_startint\fi + \xint_orthat \BNE_notadigit #1% }% -\def\BNE_notadigit\BNE_scan_nbr #1{\BNE:not_a_digit!\BNE_getnext }% -% \end{macrocode} -% Scanning for a number. We gather it directly inside csname. earlier -% version did a chain of romannumeral. No limit on number of digits -% anymore from the maximal expansion depth. We only have to be careful -% about leading zeros. -% -% If we hit against some catcode eleven |!|, this means there was a -% sub |\bnumexpr..\relax|. We then apply tacit multiplication. -% \begin{macrocode} -\def\BNE_scan_nbr #1% -{% the #1 here is a catcode 12 digit - \if#10\expandafter\BNE_scan_nbr_gobzeroes - \else - \expandafter\BNE_scan_nbr_start - \fi #1% +\def\BNE_notadigit#1{\BNE_getnext }% +\def\BNE_startint #1% +{% + \if #10\expandafter\BNE_gobz_a\else\expandafter\BNE_scanint_a\fi #1% }% -\def\BNE_scan_nbr_start #1#2% +\def\BNE_scanint_a #1#2% + {\expanded\bgroup{{\iffalse}}\fi #1% + \expandafter\BNE_scanint_main\romannumeral`&&@#2}% +\def\BNE_gobz_a #1#2% + {\expanded\bgroup{{\iffalse}}\fi + \expandafter\BNE_gobz_scanint_main\romannumeral`&&@#2}% +\def\BNE_scanint_main #1% {% - \expandafter\BNE_getop\csname.=#1% - \expandafter\BNE_scanint_b\romannumeral-`0#2% + \ifcat \relax #1\expandafter\BNE_scanint_hit_cs \fi + \ifnum\xint_c_ix<1\string#1 \else\expandafter\BNE_scanint_next\fi + #1\BNE_scanint_again }% -\def\BNE_scan_nbr_gobzeroes #1% +\def\BNE_scanint_again #1% {% - \expandafter\BNE_getop\csname.=% - \expandafter\BNE_gobz_scanint_b\romannumeral-`0#1% + \expandafter\BNE_scanint_main\romannumeral`&&@#1% }% -\def\BNE_scanint_b #1% +\def\BNE_scanint_hit_cs \ifnum#1\fi#2\BNE_scanint_again {% - \ifcat \relax #1\expandafter\BNE_scanint_endbycs\expandafter #1\fi - \ifnum\xint_c_ix<1\string#1 \else\expandafter\BNE_scanint_c\fi - \string#1\BNE_scanint_d + \iffalse{{{\fi}}\expandafter}\romannumeral`&&@\BNE_getop#2% }% -\def\BNE_scanint_endbycs#1#2\BNE_scanint_d{\endcsname #1}% -\def\BNE_scanint_c\string #1\BNE_scanint_d +\def\BNE_scanint_next #1\BNE_scanint_again {% - \if _#1\xint_dothis{\expandafter\BNE_scanint_d\xint_gobble_i}\fi - \ifcat a#1\xint_dothis{\endcsname*}\fi % tacit multiplication - \xint_orthat {\expandafter\endcsname \string}#1% + \if _#1\xint_dothis\BNE_scanint_again\fi + \xint_orthat + {\iffalse{{{\fi}}\expandafter}\romannumeral`&&@\BNE_getop#1}% }% -\def\BNE_scanint_d #1% +\def\BNE_gobz_scanint_main #1% {% - \expandafter\BNE_scanint_b\romannumeral-`0#1% + \ifcat \relax #1\expandafter\BNE_gobz_scanint_hit_cs\fi + \ifnum\xint_c_x<1\string#1 \else\expandafter\BNE_gobz_scanint_next\fi + #1\BNE_scanint_again }% -\def\BNE_gobz_scanint_b #1% +\def\BNE_gobz_scanint_again #1% {% - \ifcat \relax #1\expandafter\BNE_gobz_scanint_endbycs\expandafter #1\fi - \ifnum\xint_c_x<1\string#1 \else\expandafter\BNE_gobz_scanint_c\fi - \string#1\BNE_scanint_d + \expandafter\BNE_gobz_scanint_main\romannumeral`&&@#1% }% -\def\BNE_gobz_scanint_endbycs#1#2\BNE_scanint_d{0\endcsname #1}% -\def\BNE_gobz_scanint_c\string #1\BNE_scanint_d +\def\BNE_gobz_scanint_hit_cs\ifnum#1\fi#2\BNE_scanint_again {% - \if _#1\xint_dothis\BNE_gobz_scanint_d\fi - \ifcat a#1\xint_dothis{0\endcsname*#1}\fi % tacit multiplication - \if 0#1\xint_dothis\BNE_gobz_scanint_d\fi - \xint_orthat {0\expandafter\endcsname \string#1}% + 0\iffalse{{{\fi}}\expandafter}\romannumeral`&&@\BNE_getop#2% }% -\def\BNE_gobz_scanint_d #1% +\def\BNE_gobz_scanint_next #1\BNE_scanint_again {% - \expandafter\BNE_gobz_scanint_b\romannumeral-`0#1% + \if _#1\xint_dothis\BNE_gobz_scanint_again\fi + \if 0#1\xint_dothis\BNE_gobz_scanint_again\fi + \xint_orthat + {0\iffalse{{{\fi}}\expandafter}\romannumeral`&&@\BNE_getop#1}% +}% +\def\BNE_hex_in #1.% +{% + \expanded{{{\xintHexToDec{#1}}}\expandafter}\romannumeral`&&@\BNE_getop +}% +\def\BNE_scanhex #1% #1=" +{% + \expandafter\BNE_hex_in\expanded\bgroup\BNE_scanhex_a +}% +\def\BNE_scanhex_a #1% +{% + \ifcat #1\relax\xint_dothis{.\iffalse{\fi}#1}\fi + \xint_orthat {\BNE_scanhex_aa #1}% +}% +\def\BNE_scanhex_aa #1% +{% + \if\ifnum`#1>`/ + \ifnum`#1>`9 + \ifnum`#1>`@ + \ifnum`#1>`F + 0\else1\fi\else0\fi\else1\fi\else0\fi 1% + \expandafter\BNE_scanhex_b + \else + \if _#1\xint_dothis{\expandafter\BNE_scanhex_bgob}\fi + \xint_orthat {\xint_afterfi {.\iffalse{\fi}}}% + \fi + #1% +}% +\def\BNE_scanhex_b #1#2% +{% + #1\expandafter\BNE_scanhex_a\romannumeral`&&@#2% +}% +\def\BNE_scanhex_bgob #1#2% +{% + \expandafter\BNE_scanhex_a\romannumeral`&&@#2% }% -% \end{macrocode} -% \begin{macrocode} % \end{macrocode} % \subsection{\csh{BNE_getop}} -% This finds the next infix operator or closing parenthesis or expression end. -% It then leaves in the token flow <precedence> <operator> <locked number>. -% The <precedence> stops expansion and ultimately gives back control to a -% |\BNE_until_<op>| command. The code here is derived from more involved -% context where the actual macro associated to the operator may vary, -% depending if we are in |\xintexpr|, |\xintfloatexpr| or |\xintiiexpr|. Here -% things are simpler but I have kept the general scheme, thus the actual macro -% to be used for the <operator> is not decided immediately. -% -% |v1.2a| adds a technique for allowing two-letters operators, for -% |//|, |/:| and |**|. % \begin{macrocode} -\def\BNE_getop #1#2% this #1 is the current locked computed value +\def\BNE_getop #1% {% - \expandafter\BNE_getop_a\expandafter #1\romannumeral-`0#2% + \expandafter\BNE_getop_a\romannumeral`&&@#1% }% \catcode`* 11 -\def\BNE_getop_a #1#2% -{% if a control sequence is found, must be \relax, or possibly register or - % variable if tacit multiplication is allowed - \ifx \relax #2\xint_dothis\xint_firstofthree\fi - % tacit multiplications: - \ifcat \relax #2\xint_dothis\xint_secondofthree\fi - \if (#2\xint_dothis \xint_secondofthree\fi - \ifx !#2\xint_dothis \xint_secondofthree\fi +\def\BNE_getop_a #1% +{% + \ifx \relax #1\xint_dothis\xint_firstofthree\fi + \ifcat \relax #1\xint_dothis\xint_secondofthree\fi + \ifnum\xint_c_ix<1\string#1 \xint_dothis\xint_secondofthree\fi + \if (#1\xint_dothis \xint_secondofthree\fi %) \xint_orthat \xint_thirdofthree - {\BNE_foundend #1}% - {\BNE_precedence_* *#1#2}% tacit multiplication - {\BNE_scanop_a #2#1}% + {\BNE_foundend}% + {\BNE_precedence_*** *#1}% + {\expandafter\BNE_scanop_a \string#1}% }% \catcode`* 12 -\def\BNE_foundend {\xint_c_ \relax }% \relax is only a place-holder here. -\def\BNE_scanop_a #1#2#3% - {\expandafter\BNE_scanop_b\expandafter #1\expandafter #2\romannumeral-`0#3}% -\def\BNE_scanop_b #1#2#3% +\def\BNE_foundend {\xint_c_ \relax}% +\def\BNE_scanop_a #1#2% +{% + \expandafter\BNE_scanop_b\expandafter#1\romannumeral`&&@#2% +}% +\def\BNE_scanop_b #1#2% +{% + \ifcat#2\relax\xint_dothis{\BNE_foundop_a #1#2}\fi + \ifcsname BNE_itself_#1#2\endcsname + \xint_dothis + {\expandafter\BNE_scanop_c\csname BNE_itself_#1#2\endcsname}\fi + \xint_orthat {\BNE_foundop_a #1#2}% +}% +\def\BNE_scanop_c #1#2% +{% + \expandafter\BNE_scanop_d\expandafter#1\romannumeral`&&@#2% +}% +\def\BNE_scanop_d #1#2% {% - \ifcat#3\relax\xint_dothis{\BNE_foundop #1#2#3}\fi - \ifcsname BNE_itself_#1#3\endcsname + \ifcat#2\relax \xint_dothis{\BNE_foundop #1#2}\fi + \ifcsname BNE_itself_#1#2\endcsname \xint_dothis - {\expandafter\BNE_foundop\csname BNE_itself_#1#3\endcsname #2}\fi - \xint_orthat {\BNE_foundop #1#2#3}% + {\expandafter\BNE_scanop_c\csname BNE_itself_#1#2\endcsname }\fi + \xint_orthat {\csname BNE_precedence_#1\endcsname #1#2}% }% -\def\BNE_foundop #1% +\def\BNE_foundop_a #1% {% \ifcsname BNE_precedence_#1\endcsname \csname BNE_precedence_#1\expandafter\endcsname \expandafter #1% \else - \BNE_notanoperator {#1}\expandafter\BNE_getop + \xint_afterfi{\BNE_getop\romannumeral0% + \XINT_expandableerror + {"#1" is unknown as operator. (I)nsert one:} }%<<deliberate space \fi }% -\def\BNE_notanoperator #1{\BNE:not_an_operator! \xint_gobble_i {#1}}% +\def\BNE_foundop #1{\csname BNE_precedence_#1\endcsname #1}% % \end{macrocode} -% \subsection{Until macros for global expression and parenthesized sub-ones} -% The minus sign as prefix is treated here. +% \subsection{Expansion spanning; opening and closing parentheses} % \begin{macrocode} -\catcode`) 11 -\def\BNE_tmpa #1{% - \def\BNE_until_end_a ##1% +\def\BNE_tmpa #1#2#3#4#5% +{% + \def#1% start + {% + \expandafter#2\romannumeral`&&@\BNE_getnext + }% + \def#2##1% check {% \xint_UDsignfork - ##1{\expandafter\BNE_until_end_a\romannumeral-`0#1}% - -{\BNE_until_end_b ##1}% + ##1{\expandafter#3\romannumeral`&&@#4}% + -{#3##1}% \krof }% -}\expandafter\BNE_tmpa\csname BNE_op_-vi\endcsname -\def\BNE_until_end_b #1#2% + \def#3##1##2% checkp {% - \ifcase #1\expandafter\BNE_done - \or - \xint_afterfi{\BNE:extra_)_?\expandafter - \BNE_until_end_a\romannumeral-`0\BNE_getop }% + \ifcase ##1% + \expandafter\BNE_done + \or\expandafter#5% \else - \xint_afterfi{\expandafter\BNE_until_end_a - \romannumeral-`0\csname BNE_op_#2\endcsname }% + \expandafter#3\romannumeral`&&@\csname BNE_op_##2\expandafter\endcsname \fi }% -\catcode`( 11 -\def\BNE_op_( {\expandafter\BNE_until_)_a\romannumeral-`0\BNE_getnext }% -\let\BNE_oparen\BNE_op_( -\catcode`( 12 -\def\BNE_tmpa #1{% - \def\BNE_until_)_a ##1{\xint_UDsignfork - ##1{\expandafter \BNE_until_)_a\romannumeral-`0#1}% - -{\BNE_until_)_b ##1}% - \krof }% -}\expandafter\BNE_tmpa\csname BNE_op_-vi\endcsname -\def \BNE_until_)_b #1#2% + \def#5% + {% + \XINT_expandableerror + {An extra ) has been removed. Hit Return, fingers crossed.}% + \expandafter#2\romannumeral`&&@\expandafter\BNE_put_op_first + \romannumeral`&&@\BNE_getop_legacy + }% +}% +\let\BNE_done\space +\expandafter\BNE_tmpa + \csname BNE_start\expandafter\endcsname + \csname BNE_check\expandafter\endcsname + \csname BNE_checkp\expandafter\endcsname + \csname BNE_op_-xii\expandafter\endcsname + \csname BNE_extra_)\endcsname +\def\BNE_tmpa #1#2#3#4#5#6% +{% + \def #1##1% op_( + {% + \expandafter #4\romannumeral`&&@\BNE_getnext + }% + \def #2##1% op_) {% - \ifcase #1\expandafter \BNE_missing_)_? % missing ) ? - \or\expandafter \BNE_getop % found closing ) - \else \xint_afterfi - {\expandafter \BNE_until_)_a\romannumeral-`0\csname BNE_op_#2\endcsname }% + \expanded{\unexpanded{\BNE_put_op_first{##1}}\expandafter}\romannumeral`&&@\BNE_getop + }% + \def #3% oparen + {% + \expandafter #4\romannumeral`&&@\BNE_getnext + }% + \def #4##1% check- + {% + \xint_UDsignfork + ##1{\expandafter#5\romannumeral`&&@#6}% + -{#5##1}% + \krof + }% + \def #5##1##2% checkp + {% + \ifcase ##1\expandafter\BNE_missing_) + \or \csname BNE_op_##2\expandafter\endcsname + \else + \expandafter #5\romannumeral`&&@\csname BNE_op_##2\expandafter\endcsname \fi }% -\def\BNE_missing_)_? {\BNE:missing_)_inserted \xint_c_ \BNE_done }% -\let\BNE_precedence_) \xint_c_i -\let\BNE_op_) \BNE_getop +}% +\expandafter\BNE_tmpa + \csname BNE_op_(\expandafter\endcsname + \csname BNE_op_)\expandafter\endcsname + \csname BNE_oparen\expandafter\endcsname + \csname BNE_check-_)\expandafter\endcsname + \csname BNE_checkp_)\expandafter\endcsname + \csname BNE_op_-xii\endcsname +\catcode`) 11 +\let\BNE_precedence_)\xint_c_i +\def\BNE_missing_) + {\XINT_expandableerror{Sorry to report a missing ) at the end of this journey.}% + \xint_c_ \BNE_done }% \catcode`) 12 % \end{macrocode} -% \subsection{The arithmetic operators.} -% This is where the infix operators are mapped to actual macros. These macros -% must ``f-expand'' their arguments, and know how to handle then big integers -% having no leading zeros and at most a minus sign. -% -% |v1.2a| adds |//| for truncated division, |/:| for modulo operations -% and |**| for powers (synonym to |^|). -% -% |v1.2c| has |//| and |/:| per default associated to floored division. +% \subsection{The comma as binary operator} % \begin{macrocode} -\def\BNE_tmpc #1#2#3#4#5#6#7% -{% - \def #1##1% \BNE_op_<op> - {% keep value, get next number and operator, then do until - \expandafter #2\expandafter ##1\romannumeral-`0\expandafter\BNE_getnext }% - \def #2##1##2% \BNE_until_<op>_a - {\xint_UDsignfork - ##2{\expandafter #2\expandafter ##1\romannumeral-`0#4}% - -{#3##1##2}% - \krof }% - \def #3##1##2##3##4% \BNE_until_<op>_b - {% either execute next operation now, or first do next (possibly unary) - \ifnum ##2>#5% - \xint_afterfi {\expandafter #2\expandafter ##1\romannumeral-`0% - \csname BNE_op_##3\endcsname {##4}}% - \else \xint_afterfi {\expandafter ##2\expandafter ##3% - \csname .=#6{\BNE_unlock ##1}{\BNE_unlock ##4}\endcsname }% - \fi }% - \let #7#5% -}% -\def\BNE_tmpb #1#2#3% +\def\BNE_tmpa #1#2#3#4#5% {% - \expandafter\BNE_tmpc - \csname BNE_op_#1\expandafter\endcsname - \csname BNE_until_#1_a\expandafter\endcsname - \csname BNE_until_#1_b\expandafter\endcsname - \csname BNE_op_-#2\expandafter\endcsname - \csname xint_c_#2\expandafter\endcsname - \csname #3\expandafter\endcsname - \csname BNE_precedence_#1\endcsname + \def #1##1% \BNE_op_, + {% + \expanded{\unexpanded{#2{##1}}\expandafter}% + \romannumeral`&&@\expandafter#3\romannumeral`&&@\BNE_getnext + }% + \def #2##1##2##3##4{##2##3{##1##4}}% \BNE_exec_, + \def #3##1% \BNE_check-_, + {% + \xint_UDsignfork + ##1{\expandafter#4\romannumeral`&&@#5}% + -{#4##1}% + \krof + }% + \def #4##1##2% \BNE_checkp_, + {% + \ifnum ##1>\xint_c_iii + \expandafter#4% + \romannumeral`&&@\csname BNE_op_##2\expandafter\endcsname + \else + \expandafter##1\expandafter##2% + \fi + }% }% -\BNE_tmpb +{vi}{BNE_Op_add}% -\BNE_tmpb -{vi}{BNE_Op_sub}% -\BNE_tmpb *{vii}{BNE_Op_mul}% -\BNE_tmpb /{vii}{BNE_Op_divround}% -\BNE_tmpb ^{viii}{BNE_Op_pow}% -\expandafter\def\csname BNE_itself_**\endcsname {^}% shortcut for alias -\expandafter\def\csname BNE_itself_//\endcsname {//}% -\expandafter\def\csname BNE_itself_/:\endcsname {/:}% -\BNE_tmpb {//}{vii}{BNE_Op_div}% -\BNE_tmpb {/:}{vii}{BNE_Op_mod}% -% \end{macrocode} -% \subsection{! as postfix factorial operator} -% New with |v1.2a|. -% \begin{macrocode} -\let\BNE_precedence_! \xint_c_x -\def\BNE_op_! #1% - {\expandafter\BNE_getop\csname .=\BNE_Op_fac{\BNE_unlock #1}\endcsname }% +\expandafter\BNE_tmpa + \csname BNE_op_,\expandafter\endcsname + \csname BNE_exec_,\expandafter\endcsname + \csname BNE_check-_,\expandafter\endcsname + \csname BNE_checkp_,\expandafter\endcsname + \csname BNE_op_-xii\endcsname +\expandafter\let\csname BNE_precedence_,\endcsname\xint_c_iii % \end{macrocode} % \subsection{The minus as prefix operator of variable precedence level} -% It inherits the level of precedence of the previous operator. % \begin{macrocode} -\def\BNE_tmpa #1% -{% -\expandafter\BNE_tmpb - \csname BNE_op_-#1\expandafter\endcsname - \csname BNE_until_-#1_a\expandafter\endcsname - \csname BNE_until_-#1_b\expandafter\endcsname - \csname xint_c_#1\endcsname -}% -\def\BNE_tmpb #1#2#3#4% +\def\BNE_tmpb #1#2#3#4#5% {% \def #1% \BNE_op_-<level> - {% get next number+operator then switch to _until macro - \expandafter #2\romannumeral-`0\BNE_getnext + {% + \expandafter #2\romannumeral`&&@\expandafter#3% + \romannumeral`&&@\BNE_getnext }% - \def #2##1% \BNE_until_-<level>_a - {\xint_UDsignfork - ##1{\expandafter #2\romannumeral-`0#1}% - -{#3##1}% - \krof }% - \def #3##1##2##3% \BNE_until_-<level>_b + \def #2##1##2##3% \BNE_exec_-<level> {% - \ifnum ##1>#4% - \xint_afterfi {\expandafter #2\romannumeral-`0% - \csname BNE_op_##2\endcsname {##3}}% - \else - \xint_afterfi {\expandafter ##1\expandafter ##2% - \csname .=\expandafter\BNE_Op_opp - \romannumeral-`0\BNE_unlock ##3\endcsname }% - \fi + \expandafter ##1\expandafter ##2\expandafter + {\expandafter{\romannumeral`&&@\expandafter\BNE_Op_opp\xint_firstofone##3}}% }% + \def #3##1% \BNE_check-_-<level> + {% + \xint_UDsignfork + ##1{\expandafter #4\romannumeral`&&@#1}% + -{#4##1}% + \krof + }% + \def #4##1##2% \BNE_checkp_-<level> + {% + \ifnum ##1>#5% + \expandafter #4% + \romannumeral`&&@\csname BNE_op_##2\expandafter\endcsname + \else + \expandafter ##1\expandafter ##2% + \fi + }% +}% +\def\BNE_tmpa #1% +{% +\expandafter\BNE_tmpb + \csname BNE_op_-#1\expandafter\endcsname + \csname BNE_exec_-#1\expandafter\endcsname + \csname BNE_check-_-#1\expandafter\endcsname + \csname BNE_checkp_-#1\expandafter\endcsname + \csname xint_c_#1\endcsname }% -\BNE_tmpa {vi}% -\BNE_tmpa {vii}% -\BNE_tmpa {viii}% +\BNE_tmpa {xii}% +\BNE_tmpa {xiv}% +\BNE_tmpa {xvi}% +\BNE_tmpa {xviii}% \def\BNE_Op_opp #1{\if-#1\else\if0#10\else-#1\fi\fi }% % \end{macrocode} -% \subsection{The comma may separate expressions.} -% It suffices to treat the comma as a binary operator of precedence |ii|. We -% insert a space after the comma. The current code in |\xintexpr| does not do -% it at this stage, but only later during the final unlocking, as there is -% anyhow need for some processing for final formatting and was considered to -% be as well the opportunity to insert the space. Here, let's do it -% immediately. These spaces are not an issue when |\bnumexpr| is -% identified as a sub-expression in |\xintexpr|, for example in: -% |\xinttheiiexpr lcm(\bnumexpr 175-12,123+34,56*31\relax)\relax| (this -% example requires package |xintgcd|). +% \subsection{The infix operators.} % \begin{macrocode} -\catcode`, 11 -\def\BNE_op_, #1% +\def\BNE_defbin_c #1#2#3#4#5#6#7% {% - \expandafter \BNE_until_,_a\expandafter #1\romannumeral-`0\BNE_getnext -}% -\def\BNE_tmpa #1{% #1 = \BNE_op_-vi - \def\BNE_until_,_a ##1##2% + \def #1##1% \BNE_op_<op> + {% + \expanded{\unexpanded{#2{##1}}\expandafter}% + \romannumeral`&&@\expandafter#3\romannumeral`&&@\BNE_getnext + }% + \def #2##1##2##3##4% \BNE_exec_<op> + {% + \expandafter##2\expandafter##3\expandafter + {\expandafter{\romannumeral`&&@#6##1##4}}% + }% + \def #3##1% \BNE_check-_<op> {% \xint_UDsignfork - ##2{\expandafter \BNE_until_,_a\expandafter ##1\romannumeral-`0#1}% - -{\BNE_until_,_b ##1##2}% - \krof }% -}\expandafter\BNE_tmpa\csname BNE_op_-vi\endcsname -\def\BNE_until_,_b #1#2#3#4% -{% - \ifnum #2>\xint_c_ii - \xint_afterfi {\expandafter \BNE_until_,_a - \expandafter #1\romannumeral-`0% - \csname BNE_op_#3\endcsname {#4}}% - \else - \xint_afterfi {\expandafter #2\expandafter #3% - \csname .=\BNE_unlock #1, \BNE_unlock #4\endcsname }% + ##1{\expandafter#4\romannumeral`&&@#5}% + -{#4##1}% + \krof + }% + \def #4##1##2% \BNE_checkp_<op> + {% + \ifnum ##1>#7% + \expandafter#4% + \romannumeral`&&@\csname BNE_op_##2\expandafter\endcsname + \else + \expandafter ##1\expandafter ##2% \fi + }% +}% +\def\BNE_defbin_b #1#2#3#4% +{% + \expandafter\BNE_defbin_c + \csname BNE_op_#1\expandafter\endcsname + \csname BNE_exec_#1\expandafter\endcsname + \csname BNE_check-_#1\expandafter\endcsname + \csname BNE_checkp_#1\expandafter\endcsname + \csname BNE_op_-#3\expandafter\endcsname + \csname #4\expandafter\endcsname + \csname BNE_precedence_#1\endcsname + \expandafter + \let\csname BNE_precedence_#1\expandafter\endcsname + \csname xint_c_#2\endcsname +}% +\BNE_defbin_b {//} {xiv}{xiv}{BNE_Op_div}% +\BNE_defbin_b {/:} {xiv}{xiv}{BNE_Op_mod}% +\BNE_defbin_b + {xii}{xii}{BNE_Op_add}% +\BNE_defbin_b - {xii}{xii}{BNE_Op_sub}% +\BNE_defbin_b * {xiv}{xiv}{BNE_Op_mul}% +\BNE_defbin_b / {xiv}{xiv}{BNE_Op_divround}% +\BNE_defbin_b ^ {xviii}{xviii}{BNE_Op_pow}% +\expandafter\def\csname BNE_itself_**\endcsname {^}% +\expandafter\def\csname BNE_itself_//\endcsname {//}% +\expandafter\def\csname BNE_itself_/:\endcsname {/:}% +\expandafter\let\csname BNE_precedence_***\endcsname \xint_c_xvi +% \end{macrocode} +% \subsection{! as postfix factorial operator} +% \begin{macrocode} +\catcode`! 11 +\let\BNE_precedence_! \xint_c_xx +\def\BNE_op_! #1% +{% + \expandafter\BNE_put_op_first + \expanded{{{\BNE_Op_fac#1}}\expandafter}\romannumeral`&&@\BNE_getop }% -\let \BNE_precedence_, \xint_c_ii % \end{macrocode} % \subsection{Cleanup} % \begin{macrocode} -\let\BNE_tmpa\relax \let\BNE_tmpb\relax \let\BNE_tmpc\relax -\BNErestorecatcodes +\let\BNEtmpa\relax \let\BNE_tmpa\relax \let\BNE_tmpb\relax \let\BNE_tmpc\relax +\BNErestorecatcodes% % \end{macrocode} % \MakePercentComment %</package> %<*dtx> - \DeleteShortVerb{\|} \CharacterTable {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -1382,7 +1370,7 @@ macros of the same math engine. Its effect obeys the local scope. Right bracket \] Circumflex \^ Underscore \_ Grave accent \` Left brace \{ Vertical bar \| Right brace \} Tilde \~} -\CheckSum {881} +\CheckSum {949} \makeatletter\check@checksum\makeatother \Finale %% End of file xint.dtx diff --git a/Master/texmf-dist/source/latex/bnumexpr/bnumexpr.ins b/Master/texmf-dist/source/latex/bnumexpr/bnumexpr.ins deleted file mode 100644 index 90da59a83de..00000000000 --- a/Master/texmf-dist/source/latex/bnumexpr/bnumexpr.ins +++ /dev/null @@ -1,56 +0,0 @@ -%% -%% This is file `bnumexpr.ins', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% bnumexpr.dtx (with options: `ins') -%% -%% IMPORTANT NOTICE: -%% -%% For the copyright see the source file. -%% -%% Any modified versions of this file must be renamed -%% with new filenames distinct from bnumexpr.ins. -%% -%% For distribution of the original source see the terms -%% for copying and modification in the file bnumexpr.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 bnumexpr package: Expressions with big integers -%% Copyright (C) 2014-2019 by Jean-Francois Burnol -%% -%% tex bnumexpr.ins will extract bnumexpr.sty from bnumexpr.dtx -%% -\input docstrip.tex -\askforoverwritefalse -\generate{\nopreamble\nopostamble -\file{README.md}{\from{bnumexpr.dtx}{readme}} -\usepreamble\defaultpreamble -\usepostamble\defaultpostamble -\file{bnumexprchanges.tex}{\from{bnumexpr.dtx}{changes}} -\file{bnumexpr.tex}{\from{bnumexpr.dtx}{drv}} -\file{bnumexpr.sty}{\from{bnumexpr.dtx}{package}}} -\catcode32=13\relax% active space -\let =\space% -\Msg{************************************************************************} -\Msg{*} -\Msg{* To finish the installation you have to move the following} -\Msg{* files into a directory searched by TeX:} -\Msg{*} -\Msg{* bnumexpr.sty} -\Msg{*} -\Msg{* To produce the documentation run latex thrice on bnumexpr.tex} -\Msg{* then dvipdfmx on bnumexpr.dvi. (ignore the dvipdfmx warnings)} -\Msg{*} -\Msg{* Happy TeXing!} -\Msg{*} -\Msg{************************************************************************} -\endbatchfile -\endinput -%% -%% End of file `bnumexpr.ins'. diff --git a/Master/texmf-dist/tex/latex/bnumexpr/bnumexpr.sty b/Master/texmf-dist/tex/latex/bnumexpr/bnumexpr.sty index 6854b28e37c..708694b02e5 100644 --- a/Master/texmf-dist/tex/latex/bnumexpr/bnumexpr.sty +++ b/Master/texmf-dist/tex/latex/bnumexpr/bnumexpr.sty @@ -22,363 +22,473 @@ %% in the same archive or directory.) %% --------------------------------------------------------------- %% The bnumexpr package: Expressions with big integers -%% Copyright (C) 2014-2019 by Jean-Francois Burnol +%% Copyright (C) 2014-2021 by Jean-Francois Burnol %% \NeedsTeXFormat{LaTeX2e}% -\ProvidesPackage{bnumexpr}[2019/01/08 v1.2e Expressions with big integers (JFB)]% -\edef\BNErestorecatcodes {\catcode`\noexpand\!\the\catcode`\! - \catcode`\noexpand\?\the\catcode`\? - \catcode`\noexpand\_\the\catcode`\_ - \catcode`\noexpand\:\the\catcode`\: - \catcode`\noexpand\(\the\catcode`\( - \catcode`\noexpand\)\the\catcode`\) - \catcode`\noexpand\*\the\catcode`\* - \catcode`\noexpand\,\the\catcode`\,\relax }% -\catcode`\! 11 -\catcode`\? 11 -\catcode`\_ 11 -\catcode`\: 11 -\catcode`\, 12 -\catcode`\* 12 -\catcode`\( 12 -\chardef\xint_c_ 0 -\chardef\xint_c_i 1 -\chardef\xint_c_ii 2 -\chardef\xint_c_vi 6 -\chardef\xint_c_vii 7 -\chardef\xint_c_viii 8 -\chardef\xint_c_ix 9 -\chardef\xint_c_x 10 -\long\def\xint_gobble_i #1{}% -\long\def\xint_gobble_iii #1#2#3{}% -\long\def\xint_firstofone #1{#1}% -\long\def\xint_firstoftwo #1#2{#1}% -\long\def\xint_secondoftwo #1#2{#2}% -\long\def\xint_firstofthree #1#2#3{#1}% -\long\def\xint_secondofthree #1#2#3{#2}% -\long\def\xint_thirdofthree #1#2#3{#3}% -\def\xint_gob_til_! #1!{}% this ! has catcode 11 -\long\def\xint_UDsignfork #1-#2#3\krof {#2}% -\long\def\xint_afterfi #1#2\fi {\fi #1}% -\long\def\xint_dothis #1#2\xint_orthat #3{\fi #1}% -\let\xint_orthat \xint_firstofone -\long\def\xint_zapspaces #1 #2{#1#2\xint_zapspaces }% -\catcode`! 3 -\def\bnumexprsetup #1{\BNE_parsekeys #1,=!,}% -\def\BNE_parsekeys #1=#2#3,{\ifx!#2\expandafter\BNE_parsedone\fi +\ProvidesPackage{bnumexpr}[2021/05/12 v1.4 Expressions with big integers (JFB)]% +\RequirePackage{xintbinhex}[2021/05/10]% +{\catcode`! 3 \catcode`_ 11 % + \gdef\bnumexprsetup #1{\BNE_parsekeys #1,=!,}% + \gdef\BNE_parsekeys #1=#2#3,% + {% + \ifx!#2\expandafter\BNE_parsedone\fi \expandafter -\let\csname BNE_Op_\xint_zapspaces #1 \xint_gobble_i\endcsname=#2\BNE_parsekeys + \let\csname BNE_Op_\xint_zapspaces #1 \xint_gobble_i\endcsname% + =#2\BNE_parsekeys + }% + \gdef\BNE_parsedone #1\BNE_parsekeys {}% }% -\catcode`! 11 -\def\BNE_parsedone #1\BNE_parsekeys {}% -\def\BNE_tmpa {0}% -\DeclareOption {custom}{\def\BNE_tmpa {1}}% +\def\BNEtmpa {0}% +\DeclareOption {custom}{\def\BNEtmpa {1}}% \ProcessOptions\relax -\if0\BNE_tmpa % Default is to load xintcore.sty - \RequirePackage{xintcore}[2019/01/06]% xintcore 1.3d +\edef\BNErestorecatcodes{\XINTrestorecatcodes}% +\XINTsetcatcodes% +\if0\BNEtmpa\expandafter\xint_secondoftwo\fi +\xint_gobble_i{% + \RequirePackage{xintcore}[2021/05/10]% \bnumexprsetup{add=\xintiiAdd, sub=\xintiiSub, mul=\xintiiMul, divround=\xintiiDivRound, div=\xintiiDivFloor, mod=\xintiiMod, pow=\xintiiPow, fac=\xintiiFac}% -\fi -\def\bnumexpr {\romannumeral0\bnumexpro }% -\def\bnumexpro{\expandafter\BNE_wrap\romannumeral0\BNE_eval }% -\def\BNE_eval {\expandafter\BNE_until_end_a\romannumeral-`0\BNE_getnext }% -\def\BNE_wrap {!\BNE_usethe\BNE_protect\BNE_unlock }% -\protected\def\BNE_usethe\BNE_protect {\BNE:missing_bnethe!}% -\def\BNE_protect\BNE_unlock - {\noexpand\BNE_protect\noexpand\BNE_unlock\noexpand }% -\let\BNE_done\space +}% +\long\def\xint_firstofthree #1#2#3{#1}% +\long\def\xint_secondofthree #1#2#3{#2}% +\long\def\xint_thirdofthree #1#2#3{#3}% +\def\XINTfstop {\noexpand\XINTfstop}% +\def\bnumexpr {\romannumeral0\bnumexpro}% +\def\bnumexpro {\expandafter\BNE_wrap\romannumeral0\bnebareeval }% +\def\BNE_wrap {\XINTfstop\BNEprint.}% +\def\bnumeval #1% + {\expanded\expandafter\BNEprint\expandafter.\romannumeral0\bnebareeval#1\relax}% +\def\evaltohex #1% + {\expanded\expandafter\BNEprinthex\expandafter.\romannumeral0\bnebareeval#1\relax}% \def\thebnumexpr - {\romannumeral-`0\expandafter\BNE_unlock\romannumeral0\BNE_eval }% -\def\bnethe #1{\romannumeral-`0\expandafter\xint_gobble_iii\romannumeral-`0#1}% -\def\bnumeval#1% - {\romannumeral-`0\expandafter\BNE_unlock\romannumeral0\BNE_eval#1\relax}% -\def\BNE_unlock {\expandafter\BNE_unlock_a\string }% -\def\BNE_unlock_a #1.={}% + {\expanded\expandafter\BNEprint\expandafter.\romannumeral0\bnebareeval}% +\def\bnebareeval{\BNE_start}% +\def\bnethe#1{\expanded\expandafter\xint_gobble_i\romannumeral`&&@#1}% +\protected\def\BNEprint.#1{{\BNE_print#1.}}% +\def\BNE_print#1{#1\expandafter\BNE_print_a\string}% +\def\BNE_print_a#1{\unless\if#1.\expandafter\BNE_print_b\fi}% +\def\BNE_print_b + {\expandafter\BNE_print_c\expandafter{\expandafter\xint_gobble_i\string}}% +\def\BNE_print_c#1{, #1\expandafter\BNE_print_a\string}% +\protected\def\BNEprinthex.#1{{\BNE_printhex#1.}}% +\def\BNE_printhex#1{\xintDecToHex{#1}\expandafter\BNE_printhex_a\string}% +\def\BNE_printhex_a#1{\unless\if#1.\expandafter\BNE_printhex_b\fi}% +\def\BNE_printhex_b + {\expandafter\BNE_printhex_c\expandafter{\expandafter\xint_gobble_i\string}}% +\def\BNE_printhex_c#1{, \xintDecToHex{#1}\expandafter\BNE_printhex_a\string}% \def\BNE_getnext #1% {% - \expandafter\BNE_getnext_a\romannumeral-`0#1% + \expandafter\BNE_put_op_first\romannumeral`&&@% + \expandafter\BNE_getnext_a\romannumeral`&&@#1% }% +\def\BNE_put_op_first #1#2#3{\expandafter#2\expandafter#3\expandafter{#1}}% \def\BNE_getnext_a #1% {% - \xint_gob_til_! #1\BNE_gn_foundexpr !% this ! has catcode 11 - \ifcat\relax#1% \count or \numexpr etc... token or count, dimen, skip cs - \expandafter\BNE_gn_countetc - \else - \expandafter\expandafter\expandafter\BNE_gn_fork\expandafter\string - \fi - #1% + \ifx\relax #1\xint_dothis\BNE_foundprematureend\fi + \ifx\XINTfstop#1\xint_dothis\BNE_subexpr\fi + \ifcat\relax#1\xint_dothis\BNE_countetc\fi + \xint_orthat{}\BNE_getnextfork #1% }% -\def\BNE_gn_foundexpr !#1\fi !{\expandafter\BNE_getop\xint_gobble_iii }% -\def\BNE_gn_countetc #1% +\def\BNE_foundprematureend\BNE_getnextfork #1{{}\xint_c_\relax}% +\def\BNE_subexpr #1.#2% {% - \ifx\count#1\else\ifx\dimen#1\else\ifx\numexpr#1\else\ifx\dimexpr#1\else - \ifx\skip#1\else\ifx\glueexpr#1\else\ifx\fontdimen#1\else\ifx\ht#1\else - \ifx\dp#1\else\ifx\wd#1\else\ifx\fontcharht#1\else\ifx\fontcharwd#1\else - \ifx\fontchardp#1\else\ifx\fontcharic#1\else - \BNE_gn_unpackvar - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi - \expandafter\BNE_getnext\number #1% + \expanded{\unexpanded{{#2}}\expandafter}\romannumeral`&&@\BNE_getop }% -\def\BNE_gn_unpackvar\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi - \expandafter\BNE_getnext\number #1% +\def\BNE_countetc\BNE_getnextfork#1% {% - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi - \expandafter\BNE_getop\csname .=\number#1\endcsname + \if0\ifx\count#11\fi + \ifx\dimen#11\fi + \ifx\numexpr#11\fi + \ifx\dimexpr#11\fi + \ifx\skip#11\fi + \ifx\glueexpr#11\fi + \ifx\fontdimen#11\fi + \ifx\ht#11\fi + \ifx\dp#11\fi + \ifx\wd#11\fi + \ifx\fontcharht#11\fi + \ifx\fontcharwd#11\fi + \ifx\fontchardp#11\fi + \ifx\fontcharic#11\fi 0\expandafter\BNE_fetch_as_number\fi + \expandafter\BNE_getnext_a\number #1% }% -\def\BNE_gn_fork #1{% - \if#1+\xint_dothis \BNE_getnext\fi - \if#1-\xint_dothis -\fi - \if#1(\xint_dothis \BNE_oparen \fi - \xint_orthat {\BNE_scan_number #1}% +\def\BNE_fetch_as_number + \expandafter\BNE_getnext_a\number #1% +{% + \expanded{{{\number#1}}\expandafter}\romannumeral`&&@\BNE_getop }% -\def\BNE_scan_number #1% this #1 has necessarily here catcode 12 +\def\BNE_getnextfork #1{% + \if#1+\xint_dothis \BNE_getnext_a \fi + \if#1-\xint_dothis {{}{}-}\fi + \if#1(\xint_dothis {{}\xint_c_ii^v (}\fi + \xint_orthat {\BNE_scan_number #1}% +}% +\def\BNE_scan_number #1% {% - \ifnum \xint_c_ix<1#1 \else\expandafter\BNE_notadigit\fi - \BNE_scan_nbr #1% + \if "#1\xint_dothis \BNE_scanhex\fi + \ifnum \xint_c_ix<1\string#1 \xint_dothis \BNE_startint\fi + \xint_orthat \BNE_notadigit #1% }% -\def\BNE_notadigit\BNE_scan_nbr #1{\BNE:not_a_digit!\BNE_getnext }% -\def\BNE_scan_nbr #1% -{% the #1 here is a catcode 12 digit - \if#10\expandafter\BNE_scan_nbr_gobzeroes - \else - \expandafter\BNE_scan_nbr_start - \fi #1% +\def\BNE_notadigit#1{\BNE_getnext }% +\def\BNE_startint #1% +{% + \if #10\expandafter\BNE_gobz_a\else\expandafter\BNE_scanint_a\fi #1% +}% +\def\BNE_scanint_a #1#2% + {\expanded\bgroup{{\iffalse}}\fi #1% + \expandafter\BNE_scanint_main\romannumeral`&&@#2}% +\def\BNE_gobz_a #1#2% + {\expanded\bgroup{{\iffalse}}\fi + \expandafter\BNE_gobz_scanint_main\romannumeral`&&@#2}% +\def\BNE_scanint_main #1% +{% + \ifcat \relax #1\expandafter\BNE_scanint_hit_cs \fi + \ifnum\xint_c_ix<1\string#1 \else\expandafter\BNE_scanint_next\fi + #1\BNE_scanint_again +}% +\def\BNE_scanint_again #1% +{% + \expandafter\BNE_scanint_main\romannumeral`&&@#1% +}% +\def\BNE_scanint_hit_cs \ifnum#1\fi#2\BNE_scanint_again +{% + \iffalse{{{\fi}}\expandafter}\romannumeral`&&@\BNE_getop#2% +}% +\def\BNE_scanint_next #1\BNE_scanint_again +{% + \if _#1\xint_dothis\BNE_scanint_again\fi + \xint_orthat + {\iffalse{{{\fi}}\expandafter}\romannumeral`&&@\BNE_getop#1}% +}% +\def\BNE_gobz_scanint_main #1% +{% + \ifcat \relax #1\expandafter\BNE_gobz_scanint_hit_cs\fi + \ifnum\xint_c_x<1\string#1 \else\expandafter\BNE_gobz_scanint_next\fi + #1\BNE_scanint_again }% -\def\BNE_scan_nbr_start #1#2% +\def\BNE_gobz_scanint_again #1% {% - \expandafter\BNE_getop\csname.=#1% - \expandafter\BNE_scanint_b\romannumeral-`0#2% + \expandafter\BNE_gobz_scanint_main\romannumeral`&&@#1% }% -\def\BNE_scan_nbr_gobzeroes #1% +\def\BNE_gobz_scanint_hit_cs\ifnum#1\fi#2\BNE_scanint_again {% - \expandafter\BNE_getop\csname.=% - \expandafter\BNE_gobz_scanint_b\romannumeral-`0#1% + 0\iffalse{{{\fi}}\expandafter}\romannumeral`&&@\BNE_getop#2% }% -\def\BNE_scanint_b #1% +\def\BNE_gobz_scanint_next #1\BNE_scanint_again {% - \ifcat \relax #1\expandafter\BNE_scanint_endbycs\expandafter #1\fi - \ifnum\xint_c_ix<1\string#1 \else\expandafter\BNE_scanint_c\fi - \string#1\BNE_scanint_d + \if _#1\xint_dothis\BNE_gobz_scanint_again\fi + \if 0#1\xint_dothis\BNE_gobz_scanint_again\fi + \xint_orthat + {0\iffalse{{{\fi}}\expandafter}\romannumeral`&&@\BNE_getop#1}% }% -\def\BNE_scanint_endbycs#1#2\BNE_scanint_d{\endcsname #1}% -\def\BNE_scanint_c\string #1\BNE_scanint_d +\def\BNE_hex_in #1.% {% - \if _#1\xint_dothis{\expandafter\BNE_scanint_d\xint_gobble_i}\fi - \ifcat a#1\xint_dothis{\endcsname*}\fi % tacit multiplication - \xint_orthat {\expandafter\endcsname \string}#1% + \expanded{{{\xintHexToDec{#1}}}\expandafter}\romannumeral`&&@\BNE_getop }% -\def\BNE_scanint_d #1% +\def\BNE_scanhex #1% #1=" {% - \expandafter\BNE_scanint_b\romannumeral-`0#1% + \expandafter\BNE_hex_in\expanded\bgroup\BNE_scanhex_a }% -\def\BNE_gobz_scanint_b #1% +\def\BNE_scanhex_a #1% {% - \ifcat \relax #1\expandafter\BNE_gobz_scanint_endbycs\expandafter #1\fi - \ifnum\xint_c_x<1\string#1 \else\expandafter\BNE_gobz_scanint_c\fi - \string#1\BNE_scanint_d + \ifcat #1\relax\xint_dothis{.\iffalse{\fi}#1}\fi + \xint_orthat {\BNE_scanhex_aa #1}% }% -\def\BNE_gobz_scanint_endbycs#1#2\BNE_scanint_d{0\endcsname #1}% -\def\BNE_gobz_scanint_c\string #1\BNE_scanint_d +\def\BNE_scanhex_aa #1% {% - \if _#1\xint_dothis\BNE_gobz_scanint_d\fi - \ifcat a#1\xint_dothis{0\endcsname*#1}\fi % tacit multiplication - \if 0#1\xint_dothis\BNE_gobz_scanint_d\fi - \xint_orthat {0\expandafter\endcsname \string#1}% + \if\ifnum`#1>`/ + \ifnum`#1>`9 + \ifnum`#1>`@ + \ifnum`#1>`F + 0\else1\fi\else0\fi\else1\fi\else0\fi 1% + \expandafter\BNE_scanhex_b + \else + \if _#1\xint_dothis{\expandafter\BNE_scanhex_bgob}\fi + \xint_orthat {\xint_afterfi {.\iffalse{\fi}}}% + \fi + #1% }% -\def\BNE_gobz_scanint_d #1% +\def\BNE_scanhex_b #1#2% {% - \expandafter\BNE_gobz_scanint_b\romannumeral-`0#1% + #1\expandafter\BNE_scanhex_a\romannumeral`&&@#2% }% -\def\BNE_getop #1#2% this #1 is the current locked computed value +\def\BNE_scanhex_bgob #1#2% {% - \expandafter\BNE_getop_a\expandafter #1\romannumeral-`0#2% + \expandafter\BNE_scanhex_a\romannumeral`&&@#2% +}% +\def\BNE_getop #1% +{% + \expandafter\BNE_getop_a\romannumeral`&&@#1% }% \catcode`* 11 -\def\BNE_getop_a #1#2% -{% if a control sequence is found, must be \relax, or possibly register or - % variable if tacit multiplication is allowed - \ifx \relax #2\xint_dothis\xint_firstofthree\fi - % tacit multiplications: - \ifcat \relax #2\xint_dothis\xint_secondofthree\fi - \if (#2\xint_dothis \xint_secondofthree\fi - \ifx !#2\xint_dothis \xint_secondofthree\fi +\def\BNE_getop_a #1% +{% + \ifx \relax #1\xint_dothis\xint_firstofthree\fi + \ifcat \relax #1\xint_dothis\xint_secondofthree\fi + \ifnum\xint_c_ix<1\string#1 \xint_dothis\xint_secondofthree\fi + \if (#1\xint_dothis \xint_secondofthree\fi %) \xint_orthat \xint_thirdofthree - {\BNE_foundend #1}% - {\BNE_precedence_* *#1#2}% tacit multiplication - {\BNE_scanop_a #2#1}% + {\BNE_foundend}% + {\BNE_precedence_*** *#1}% + {\expandafter\BNE_scanop_a \string#1}% }% \catcode`* 12 -\def\BNE_foundend {\xint_c_ \relax }% \relax is only a place-holder here. -\def\BNE_scanop_a #1#2#3% - {\expandafter\BNE_scanop_b\expandafter #1\expandafter #2\romannumeral-`0#3}% -\def\BNE_scanop_b #1#2#3% +\def\BNE_foundend {\xint_c_ \relax}% +\def\BNE_scanop_a #1#2% +{% + \expandafter\BNE_scanop_b\expandafter#1\romannumeral`&&@#2% +}% +\def\BNE_scanop_b #1#2% +{% + \ifcat#2\relax\xint_dothis{\BNE_foundop_a #1#2}\fi + \ifcsname BNE_itself_#1#2\endcsname + \xint_dothis + {\expandafter\BNE_scanop_c\csname BNE_itself_#1#2\endcsname}\fi + \xint_orthat {\BNE_foundop_a #1#2}% +}% +\def\BNE_scanop_c #1#2% {% - \ifcat#3\relax\xint_dothis{\BNE_foundop #1#2#3}\fi - \ifcsname BNE_itself_#1#3\endcsname + \expandafter\BNE_scanop_d\expandafter#1\romannumeral`&&@#2% +}% +\def\BNE_scanop_d #1#2% +{% + \ifcat#2\relax \xint_dothis{\BNE_foundop #1#2}\fi + \ifcsname BNE_itself_#1#2\endcsname \xint_dothis - {\expandafter\BNE_foundop\csname BNE_itself_#1#3\endcsname #2}\fi - \xint_orthat {\BNE_foundop #1#2#3}% + {\expandafter\BNE_scanop_c\csname BNE_itself_#1#2\endcsname }\fi + \xint_orthat {\csname BNE_precedence_#1\endcsname #1#2}% }% -\def\BNE_foundop #1% +\def\BNE_foundop_a #1% {% \ifcsname BNE_precedence_#1\endcsname \csname BNE_precedence_#1\expandafter\endcsname \expandafter #1% \else - \BNE_notanoperator {#1}\expandafter\BNE_getop + \xint_afterfi{\BNE_getop\romannumeral0% + \XINT_expandableerror + {"#1" is unknown as operator. (I)nsert one:} }%<<deliberate space \fi }% -\def\BNE_notanoperator #1{\BNE:not_an_operator! \xint_gobble_i {#1}}% -\catcode`) 11 -\def\BNE_tmpa #1{% - \def\BNE_until_end_a ##1% +\def\BNE_foundop #1{\csname BNE_precedence_#1\endcsname #1}% +\def\BNE_tmpa #1#2#3#4#5% +{% + \def#1% start + {% + \expandafter#2\romannumeral`&&@\BNE_getnext + }% + \def#2##1% check {% \xint_UDsignfork - ##1{\expandafter\BNE_until_end_a\romannumeral-`0#1}% - -{\BNE_until_end_b ##1}% + ##1{\expandafter#3\romannumeral`&&@#4}% + -{#3##1}% \krof }% -}\expandafter\BNE_tmpa\csname BNE_op_-vi\endcsname -\def\BNE_until_end_b #1#2% + \def#3##1##2% checkp {% - \ifcase #1\expandafter\BNE_done - \or - \xint_afterfi{\BNE:extra_)_?\expandafter - \BNE_until_end_a\romannumeral-`0\BNE_getop }% + \ifcase ##1% + \expandafter\BNE_done + \or\expandafter#5% \else - \xint_afterfi{\expandafter\BNE_until_end_a - \romannumeral-`0\csname BNE_op_#2\endcsname }% + \expandafter#3\romannumeral`&&@\csname BNE_op_##2\expandafter\endcsname \fi }% -\catcode`( 11 -\def\BNE_op_( {\expandafter\BNE_until_)_a\romannumeral-`0\BNE_getnext }% -\let\BNE_oparen\BNE_op_( -\catcode`( 12 -\def\BNE_tmpa #1{% - \def\BNE_until_)_a ##1{\xint_UDsignfork - ##1{\expandafter \BNE_until_)_a\romannumeral-`0#1}% - -{\BNE_until_)_b ##1}% - \krof }% -}\expandafter\BNE_tmpa\csname BNE_op_-vi\endcsname -\def \BNE_until_)_b #1#2% + \def#5% {% - \ifcase #1\expandafter \BNE_missing_)_? % missing ) ? - \or\expandafter \BNE_getop % found closing ) - \else \xint_afterfi - {\expandafter \BNE_until_)_a\romannumeral-`0\csname BNE_op_#2\endcsname }% - \fi + \XINT_expandableerror + {An extra ) has been removed. Hit Return, fingers crossed.}% + \expandafter#2\romannumeral`&&@\expandafter\BNE_put_op_first + \romannumeral`&&@\BNE_getop_legacy }% -\def\BNE_missing_)_? {\BNE:missing_)_inserted \xint_c_ \BNE_done }% -\let\BNE_precedence_) \xint_c_i -\let\BNE_op_) \BNE_getop -\catcode`) 12 -\def\BNE_tmpc #1#2#3#4#5#6#7% +}% +\let\BNE_done\space +\expandafter\BNE_tmpa + \csname BNE_start\expandafter\endcsname + \csname BNE_check\expandafter\endcsname + \csname BNE_checkp\expandafter\endcsname + \csname BNE_op_-xii\expandafter\endcsname + \csname BNE_extra_)\endcsname +\def\BNE_tmpa #1#2#3#4#5#6% {% - \def #1##1% \BNE_op_<op> - {% keep value, get next number and operator, then do until - \expandafter #2\expandafter ##1\romannumeral-`0\expandafter\BNE_getnext }% - \def #2##1##2% \BNE_until_<op>_a - {\xint_UDsignfork - ##2{\expandafter #2\expandafter ##1\romannumeral-`0#4}% - -{#3##1##2}% - \krof }% - \def #3##1##2##3##4% \BNE_until_<op>_b - {% either execute next operation now, or first do next (possibly unary) - \ifnum ##2>#5% - \xint_afterfi {\expandafter #2\expandafter ##1\romannumeral-`0% - \csname BNE_op_##3\endcsname {##4}}% - \else \xint_afterfi {\expandafter ##2\expandafter ##3% - \csname .=#6{\BNE_unlock ##1}{\BNE_unlock ##4}\endcsname }% - \fi }% - \let #7#5% -}% -\def\BNE_tmpb #1#2#3% -{% - \expandafter\BNE_tmpc - \csname BNE_op_#1\expandafter\endcsname - \csname BNE_until_#1_a\expandafter\endcsname - \csname BNE_until_#1_b\expandafter\endcsname - \csname BNE_op_-#2\expandafter\endcsname - \csname xint_c_#2\expandafter\endcsname - \csname #3\expandafter\endcsname - \csname BNE_precedence_#1\endcsname + \def #1##1% op_( + {% + \expandafter #4\romannumeral`&&@\BNE_getnext + }% + \def #2##1% op_) + {% + \expanded{\unexpanded{\BNE_put_op_first{##1}}\expandafter}\romannumeral`&&@\BNE_getop + }% + \def #3% oparen + {% + \expandafter #4\romannumeral`&&@\BNE_getnext + }% + \def #4##1% check- + {% + \xint_UDsignfork + ##1{\expandafter#5\romannumeral`&&@#6}% + -{#5##1}% + \krof + }% + \def #5##1##2% checkp + {% + \ifcase ##1\expandafter\BNE_missing_) + \or \csname BNE_op_##2\expandafter\endcsname + \else + \expandafter #5\romannumeral`&&@\csname BNE_op_##2\expandafter\endcsname + \fi + }% }% -\BNE_tmpb +{vi}{BNE_Op_add}% -\BNE_tmpb -{vi}{BNE_Op_sub}% -\BNE_tmpb *{vii}{BNE_Op_mul}% -\BNE_tmpb /{vii}{BNE_Op_divround}% -\BNE_tmpb ^{viii}{BNE_Op_pow}% -\expandafter\def\csname BNE_itself_**\endcsname {^}% shortcut for alias -\expandafter\def\csname BNE_itself_//\endcsname {//}% -\expandafter\def\csname BNE_itself_/:\endcsname {/:}% -\BNE_tmpb {//}{vii}{BNE_Op_div}% -\BNE_tmpb {/:}{vii}{BNE_Op_mod}% -\let\BNE_precedence_! \xint_c_x -\def\BNE_op_! #1% - {\expandafter\BNE_getop\csname .=\BNE_Op_fac{\BNE_unlock #1}\endcsname }% -\def\BNE_tmpa #1% +\expandafter\BNE_tmpa + \csname BNE_op_(\expandafter\endcsname + \csname BNE_op_)\expandafter\endcsname + \csname BNE_oparen\expandafter\endcsname + \csname BNE_check-_)\expandafter\endcsname + \csname BNE_checkp_)\expandafter\endcsname + \csname BNE_op_-xii\endcsname +\catcode`) 11 +\let\BNE_precedence_)\xint_c_i +\def\BNE_missing_) + {\XINT_expandableerror{Sorry to report a missing ) at the end of this journey.}% + \xint_c_ \BNE_done }% +\catcode`) 12 +\def\BNE_tmpa #1#2#3#4#5% {% -\expandafter\BNE_tmpb - \csname BNE_op_-#1\expandafter\endcsname - \csname BNE_until_-#1_a\expandafter\endcsname - \csname BNE_until_-#1_b\expandafter\endcsname - \csname xint_c_#1\endcsname + \def #1##1% \BNE_op_, + {% + \expanded{\unexpanded{#2{##1}}\expandafter}% + \romannumeral`&&@\expandafter#3\romannumeral`&&@\BNE_getnext + }% + \def #2##1##2##3##4{##2##3{##1##4}}% \BNE_exec_, + \def #3##1% \BNE_check-_, + {% + \xint_UDsignfork + ##1{\expandafter#4\romannumeral`&&@#5}% + -{#4##1}% + \krof + }% + \def #4##1##2% \BNE_checkp_, + {% + \ifnum ##1>\xint_c_iii + \expandafter#4% + \romannumeral`&&@\csname BNE_op_##2\expandafter\endcsname + \else + \expandafter##1\expandafter##2% + \fi + }% }% -\def\BNE_tmpb #1#2#3#4% +\expandafter\BNE_tmpa + \csname BNE_op_,\expandafter\endcsname + \csname BNE_exec_,\expandafter\endcsname + \csname BNE_check-_,\expandafter\endcsname + \csname BNE_checkp_,\expandafter\endcsname + \csname BNE_op_-xii\endcsname +\expandafter\let\csname BNE_precedence_,\endcsname\xint_c_iii +\def\BNE_tmpb #1#2#3#4#5% {% \def #1% \BNE_op_-<level> - {% get next number+operator then switch to _until macro - \expandafter #2\romannumeral-`0\BNE_getnext + {% + \expandafter #2\romannumeral`&&@\expandafter#3% + \romannumeral`&&@\BNE_getnext }% - \def #2##1% \BNE_until_-<level>_a - {\xint_UDsignfork - ##1{\expandafter #2\romannumeral-`0#1}% - -{#3##1}% - \krof }% - \def #3##1##2##3% \BNE_until_-<level>_b + \def #2##1##2##3% \BNE_exec_-<level> {% - \ifnum ##1>#4% - \xint_afterfi {\expandafter #2\romannumeral-`0% - \csname BNE_op_##2\endcsname {##3}}% - \else - \xint_afterfi {\expandafter ##1\expandafter ##2% - \csname .=\expandafter\BNE_Op_opp - \romannumeral-`0\BNE_unlock ##3\endcsname }% - \fi + \expandafter ##1\expandafter ##2\expandafter + {\expandafter{\romannumeral`&&@\expandafter\BNE_Op_opp\xint_firstofone##3}}% + }% + \def #3##1% \BNE_check-_-<level> + {% + \xint_UDsignfork + ##1{\expandafter #4\romannumeral`&&@#1}% + -{#4##1}% + \krof + }% + \def #4##1##2% \BNE_checkp_-<level> + {% + \ifnum ##1>#5% + \expandafter #4% + \romannumeral`&&@\csname BNE_op_##2\expandafter\endcsname + \else + \expandafter ##1\expandafter ##2% + \fi }% }% -\BNE_tmpa {vi}% -\BNE_tmpa {vii}% -\BNE_tmpa {viii}% -\def\BNE_Op_opp #1{\if-#1\else\if0#10\else-#1\fi\fi }% -\catcode`, 11 -\def\BNE_op_, #1% +\def\BNE_tmpa #1% {% - \expandafter \BNE_until_,_a\expandafter #1\romannumeral-`0\BNE_getnext +\expandafter\BNE_tmpb + \csname BNE_op_-#1\expandafter\endcsname + \csname BNE_exec_-#1\expandafter\endcsname + \csname BNE_check-_-#1\expandafter\endcsname + \csname BNE_checkp_-#1\expandafter\endcsname + \csname xint_c_#1\endcsname }% -\def\BNE_tmpa #1{% #1 = \BNE_op_-vi - \def\BNE_until_,_a ##1##2% +\BNE_tmpa {xii}% +\BNE_tmpa {xiv}% +\BNE_tmpa {xvi}% +\BNE_tmpa {xviii}% +\def\BNE_Op_opp #1{\if-#1\else\if0#10\else-#1\fi\fi }% +\def\BNE_defbin_c #1#2#3#4#5#6#7% +{% + \def #1##1% \BNE_op_<op> + {% + \expanded{\unexpanded{#2{##1}}\expandafter}% + \romannumeral`&&@\expandafter#3\romannumeral`&&@\BNE_getnext + }% + \def #2##1##2##3##4% \BNE_exec_<op> + {% + \expandafter##2\expandafter##3\expandafter + {\expandafter{\romannumeral`&&@#6##1##4}}% + }% + \def #3##1% \BNE_check-_<op> {% \xint_UDsignfork - ##2{\expandafter \BNE_until_,_a\expandafter ##1\romannumeral-`0#1}% - -{\BNE_until_,_b ##1##2}% - \krof }% -}\expandafter\BNE_tmpa\csname BNE_op_-vi\endcsname -\def\BNE_until_,_b #1#2#3#4% -{% - \ifnum #2>\xint_c_ii - \xint_afterfi {\expandafter \BNE_until_,_a - \expandafter #1\romannumeral-`0% - \csname BNE_op_#3\endcsname {#4}}% + ##1{\expandafter#4\romannumeral`&&@#5}% + -{#4##1}% + \krof + }% + \def #4##1##2% \BNE_checkp_<op> + {% + \ifnum ##1>#7% + \expandafter#4% + \romannumeral`&&@\csname BNE_op_##2\expandafter\endcsname \else - \xint_afterfi {\expandafter #2\expandafter #3% - \csname .=\BNE_unlock #1, \BNE_unlock #4\endcsname }% + \expandafter ##1\expandafter ##2% \fi + }% +}% +\def\BNE_defbin_b #1#2#3#4% +{% + \expandafter\BNE_defbin_c + \csname BNE_op_#1\expandafter\endcsname + \csname BNE_exec_#1\expandafter\endcsname + \csname BNE_check-_#1\expandafter\endcsname + \csname BNE_checkp_#1\expandafter\endcsname + \csname BNE_op_-#3\expandafter\endcsname + \csname #4\expandafter\endcsname + \csname BNE_precedence_#1\endcsname + \expandafter + \let\csname BNE_precedence_#1\expandafter\endcsname + \csname xint_c_#2\endcsname +}% +\BNE_defbin_b {//} {xiv}{xiv}{BNE_Op_div}% +\BNE_defbin_b {/:} {xiv}{xiv}{BNE_Op_mod}% +\BNE_defbin_b + {xii}{xii}{BNE_Op_add}% +\BNE_defbin_b - {xii}{xii}{BNE_Op_sub}% +\BNE_defbin_b * {xiv}{xiv}{BNE_Op_mul}% +\BNE_defbin_b / {xiv}{xiv}{BNE_Op_divround}% +\BNE_defbin_b ^ {xviii}{xviii}{BNE_Op_pow}% +\expandafter\def\csname BNE_itself_**\endcsname {^}% +\expandafter\def\csname BNE_itself_//\endcsname {//}% +\expandafter\def\csname BNE_itself_/:\endcsname {/:}% +\expandafter\let\csname BNE_precedence_***\endcsname \xint_c_xvi +\catcode`! 11 +\let\BNE_precedence_! \xint_c_xx +\def\BNE_op_! #1% +{% + \expandafter\BNE_put_op_first + \expanded{{{\BNE_Op_fac#1}}\expandafter}\romannumeral`&&@\BNE_getop }% -\let \BNE_precedence_, \xint_c_ii -\let\BNE_tmpa\relax \let\BNE_tmpb\relax \let\BNE_tmpc\relax -\BNErestorecatcodes +\let\BNEtmpa\relax \let\BNE_tmpa\relax \let\BNE_tmpb\relax \let\BNE_tmpc\relax +\BNErestorecatcodes% \endinput %% %% End of file `bnumexpr.sty'. diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index a870d1a49be..b728d68c571 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -2884,6 +2884,7 @@ my $core_latex = "$Master/texmf-dist/tex/latex"; 'biblatex-oxref' => 'luatex', # no doc remake 'bguq' => 'latex', # requires interaction 'bhcexam' => 'latex', # requires interaction + 'bnumexpr' => 'etex', 'bosisio' => 'latex -translate-file=empty.tcx', # ^^, no 8-bit 'bullcntr' => 'latex', # requires interaction 'canoniclayout'=> 'tex', @@ -3015,7 +3016,7 @@ my $core_latex = "$Master/texmf-dist/tex/latex"; 'xmuthesis' => 'etex', 'yathesis' => 'pdftex', ); -$standardinsrunner = "latex"; +$standardinsrunner = "etex"; $standardinsrunner_opt = ""; %specialinsrunner_opt = (); # not yet |