summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/xint/xintexpr.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/xint/xintexpr.sty')
-rw-r--r--Master/texmf-dist/tex/generic/xint/xintexpr.sty124
1 files changed, 51 insertions, 73 deletions
diff --git a/Master/texmf-dist/tex/generic/xint/xintexpr.sty b/Master/texmf-dist/tex/generic/xint/xintexpr.sty
index 84db61a81a1..d1862e9130f 100644
--- a/Master/texmf-dist/tex/generic/xint/xintexpr.sty
+++ b/Master/texmf-dist/tex/generic/xint/xintexpr.sty
@@ -21,7 +21,7 @@
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%% ---------------------------------------------------------------
-%% The xint bundle 1.4k 2022/05/18
+%% The xint bundle 1.4l 2022/05/29
%% Copyright (C) 2013-2022 by Jean-Francois Burnol
%% xintexpr: Expandable expression parser
%% ---------------------------------------------------------------
@@ -31,26 +31,25 @@
\catcode123=1 % {
\catcode125=2 % }
\catcode64=11 % @
- \catcode35=6 % #
\catcode44=12 % ,
- \catcode45=12 % -
\catcode46=12 % .
\catcode58=12 % :
- \def\z {\endgroup}%
+ \catcode94=7 % ^
+ \def\empty{}\def\space{ }\newlinechar10
+ \def\z{\endgroup}%
\expandafter\let\expandafter\x\csname ver@xintexpr.sty\endcsname
\expandafter\let\expandafter\w\csname ver@xintfrac.sty\endcsname
\expandafter\let\expandafter\t\csname ver@xinttools.sty\endcsname
- \expandafter
- \ifx\csname PackageInfo\endcsname\relax
- \def\y#1#2{\immediate\write-1{Package #1 Info: #2.}}%
+ % I don't think engine exists providing \expanded but not \numexpr
+ \expandafter\ifx\csname expanded\endcsname\relax
+ \expandafter\ifx\csname PackageWarning\endcsname\relax
+ \immediate\write128{^^JPackage xintexpr Warning:^^J%
+ \space\space\space\space
+ \expanded not available, aborting input.^^J}%
\else
- \def\y#1#2{\PackageInfo{#1}{#2}}%
+ \PackageWarningNoLine{xintexpr}{\expanded not available, aborting input}%
\fi
- \expandafter
- % I don't think engine exists providing \expanded but not \numexpr
- \ifx\csname expanded\endcsname\relax
- \y{xintexpr}{\expanded not available, aborting input}%
- \aftergroup\endinput
+ \def\z{\endgroup\endinput}%
\else
\ifx\x\relax % plain-TeX, first loading of xintexpr.sty
\ifx\w\relax % but xintfrac.sty not yet loaded.
@@ -62,7 +61,6 @@
{\z\input xinttools.sty\relax}%
\fi
\else
- \def\empty {}%
\ifx\x\empty % LaTeX, first loading,
% variable is initialized, but \ProvidesPackage not yet seen
\ifx\w\relax % xintfrac.sty not yet loaded.
@@ -74,7 +72,7 @@
{\z\RequirePackage{xinttools}}%
\fi
\else
- \aftergroup\endinput % xintexpr already loaded.
+ \def\z{\endgroup\endinput}% xintexpr already loaded.
\fi
\fi
\fi
@@ -82,7 +80,7 @@
\XINTsetupcatcodes%
\XINT_providespackage
\ProvidesPackage{xintexpr}%
- [2022/05/18 v1.4k Expandable expression parser (JFB)]%
+ [2022/05/29 v1.4l Expandable expression parser (JFB)]%
\catcode`! 11
\let\XINT_Cmp \xintiiCmp
\def\XINTfstop{\noexpand\XINTfstop}%
@@ -125,10 +123,12 @@
<%
pol([\XINT:expr:toblist_b #1!#3}^])\XINT:expr:toblist_c #1!}%
>%
-\def\XINT:expr:toblist_b #1!#2}%
-<%
- \if\relax#2\relax\xintexprEmptyItem\else#1<#2>\fi\XINT:expr:toblist_c #1!}%
->%
+\catcode`{ 1 \catcode`} 2
+\def\XINT:expr:toblist_b #1{%
+\def\XINT:expr:toblist_b ##1!##2#1%
+{%
+ \if\relax##2\relax\xintexprEmptyItem\else##1{##2}\fi\XINT:expr:toblist_c ##1!#1%
+}}\catcode`{ 12 \catcode`} 12 \XINT:expr:toblist_b<}>%
\def\XINT:expr:toblist_c #1}#2%
<%
\if ^#2\xint_dothis<\xint_gob_til_^>\fi
@@ -224,7 +224,7 @@
\if ^#2\expandafter\xint_gob_til_^\else\expandafter\XINT:expr:mapwithin_a\fi
#1!#2%
}%
-\begingroup % should I check lccode s generally if corrupted context at load?
+\begingroup
\catcode`[ 1 \catcode`] 2 \lccode`[`{ \lccode`]`}
\catcode`< 1 \catcode`> 2 \catcode`{ 12 \catcode`} 12
\lowercase<\endgroup
@@ -412,69 +412,38 @@
\def\xintifsgnexpr #1{\romannumeral0\xintiiifsgn {\xinttheexpr #1\relax}}%
\def\xintifsgnfloatexpr #1{\romannumeral0\xintiiifsgn {\xintthefloatexpr #1\relax}}%
\def\xintifsgniiexpr #1{\romannumeral0\xintiiifsgn {\xinttheiiexpr #1\relax}}%
-\def\xintFracToSci #1{\expandafter\XINT_FracToSci\romannumeral`&&@#1/\W[\R}%
-\def\XINT_FracToSci #1/#2#3[#4%
-{%
- \xint_gob_til_W #2\XINT_FracToSci_noslash\W
- \xint_gob_til_R #4\XINT_FracToSci_slash_noN\R
- \XINT_FracToSci_slash_N #1/#2#3[#4%
-}%
-\def\XINT_FracToSci_noslash#1\XINT_FracToSci_slash_N #2[#3%
-{%
- \xint_gob_til_R #3\XINT_FracToSci_noslash_noN\R
- \XINT_FracToSci_noslash_N #2[#3%
-}%
-\def\XINT_FracToSci_noslash_noN\R\XINT_FracToSci_noslash_N #1/\W[\R{#1}%
-\def\XINT_FracToSci_noslash_N #1[#2]/\W[\R%
-{%
- \ifnum#2=\xint_c_ #1\else
- \romannumeral0\expandafter\XINT_pfloat_keeptrimmed_fork\romannumeral0\xintrez{#1[#2]}%
- \fi
-}%
-\def\XINT_FracToSci_slash_noN\R\XINT_FracToSci_slash_N #1#2/#3/\W[\R%
-{%
- #1\xint_gob_til_zero#1\expandafter\iffalse\xint_gobble_ii0\iftrue
- #2\if\XINT_isOne{#3}1\else/#3\fi\fi
-}%
-\def\XINT_FracToSci_slash_N #1#2/#3[#4]/\W[\R%
+\def\xint_FracToSci_x #1{\expandafter\XINT_FracToSci_x\romannumeral`&&@#1/\W[\R}%
+\def\XINT_FracToSci_x #1/#2#3[#4%
{%
- \ifnum#4=\xint_c_ #1#2\else
- \romannumeral0\expandafter\XINT_pfloat_keeptrimmed_fork\romannumeral0\xintrez{#1#2[#4]}%
- \fi
- \if\XINT_isOne{#3}1\else\if#10\else/#3\fi\fi
+ \xint_gob_til_W #2\XINT_FracToSci_x_noslash\W
+ \xint_gob_til_R #4\XINT_FracToSci_x_slash_noN\R
+ \XINT_FracToSci_x_slash_N #1/#2#3[#4%
}%
-\let\xintexprPrintOne\xintFracToSci
-\def\xintFracToDecimal #1{\expandafter\XINT_FracToDecimal\romannumeral`&&@#1/\W[\R}%
-\def\XINT_FracToDecimal #1/#2#3[#4%
+\def\XINT_FracToSci_x_noslash#1\XINT_FracToSci_x_slash_N #2[#3%
{%
- \xint_gob_til_W #2\XINT_FracToDecimal_noslash\W
- \xint_gob_til_R #4\XINT_FracToDecimal_slash_noN\R
- \XINT_FracToDecimal_slash_N #1/#2#3[#4%
+ \xint_gob_til_R #3\XINT_FracToSci_x_noslash_noN\R
+ \XINT_FracToSci_x_noslash_N #2[#3%
}%
-\def\XINT_FracToDecimal_noslash#1\XINT_FracToDecimal_slash_N #2[#3%
-{%
- \xint_gob_til_R #3\XINT_FracToDecimal_noslash_noN\R
- \XINT_FracToDecimal_noslash_N #2[#3%
-}%
-\def\XINT_FracToDecimal_noslash_noN\R\XINT_FracToDecimal_noslash_N #1/\W[\R{#1}%
-\def\XINT_FracToDecimal_noslash_N #1[#2]/\W[\R%
+\def\XINT_FracToSci_x_noslash_noN\R\XINT_FracToSci_x_noslash_N #1/\W[\R{#1}%
+\def\XINT_FracToSci_x_noslash_N #1[#2]/\W[\R%
{%
\ifnum#2=\xint_c_ #1\else
- \romannumeral0\expandafter\XINT_dectostr\romannumeral0\xintrez{#1[#2]}%
+ \romannumeral0\expandafter\XINT_pfloat_a_fork\romannumeral0\xintrez{#1[#2]}%
\fi
}%
-\def\XINT_FracToDecimal_slash_noN\R\XINT_FracToDecimal_slash_N #1#2/#3/\W[\R%
+\def\XINT_FracToSci_x_slash_noN\R\XINT_FracToSci_x_slash_N #1#2/#3/\W[\R%
{%
#1\xint_gob_til_zero#1\expandafter\iffalse\xint_gobble_ii0\iftrue
#2\if\XINT_isOne{#3}1\else/#3\fi\fi
}%
-\def\XINT_FracToDecimal_slash_N #1#2/#3[#4]/\W[\R%
+\def\XINT_FracToSci_x_slash_N #1#2/#3[#4]/\W[\R%
{%
\ifnum#4=\xint_c_ #1#2\else
- \romannumeral0\expandafter\XINT_dectostr\romannumeral0\xintrez{#1#2[#4]}%
+ \romannumeral0\expandafter\XINT_pfloat_a_fork\romannumeral0\xintrez{#1#2[#4]}%
\fi
\if\XINT_isOne{#3}1\else\if#10\else/#3\fi\fi
}%
+\let\xintexprPrintOne\xint_FracToSci_x
\def\XINT_embrace#1{{#1}}%
\def\xint_gob_til_! #1!{}% ! with catcode 11
\def\xintError:noopening
@@ -4579,12 +4548,21 @@
}%
\let\XINT_tmpa\undefined \let\XINT_tmpb\undefined \let\XINT_tmpc\undefined
\let\XINT_tmpd\undefined \let\XINT_tmpe\undefined
-\ifdefined\RequirePackage\expandafter\xint_firstoftwo\else\expandafter\xint_secondoftwo\fi
-{\RequirePackage{xinttrig}%
-\RequirePackage{xintlog}}%
-{\input xinttrig.sty
-\input xintlog.sty
-}%
+\ifdefined\RequirePackage
+ \ifcsname ver@xinttrig.sty\endcsname
+ \@@input xinttrig.sty\relax
+ \else
+ \RequirePackage{xinttrig}%
+ \fi
+ \ifcsname ver@xintlog.sty\endcsname
+ \@@input xintlog.sty\relax
+ \else
+ \RequirePackage{xintlog}%
+ \fi
+\else
+ \input xinttrig.sty
+ \input xintlog.sty
+\fi
\XINTrestorecatcodesendinput%
\endinput
%%