summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/doc/latex/boolexpr/README8
-rw-r--r--Master/texmf-dist/doc/latex/boolexpr/boolexpr.pdfbin205833 -> 219762 bytes
-rw-r--r--Master/texmf-dist/source/latex/boolexpr/boolexpr.dtx202
-rw-r--r--Master/texmf-dist/source/latex/boolexpr/boolexpr.ins2
-rw-r--r--Master/texmf-dist/tex/latex/boolexpr/boolexpr.sty122
5 files changed, 195 insertions, 139 deletions
diff --git a/Master/texmf-dist/doc/latex/boolexpr/README b/Master/texmf-dist/doc/latex/boolexpr/README
index 9391eabbf3c..aefb3b73bd9 100644
--- a/Master/texmf-dist/doc/latex/boolexpr/README
+++ b/Master/texmf-dist/doc/latex/boolexpr/README
@@ -1,4 +1,4 @@
-% boolexpr : Purely expandable boolean expressions and switch (eTeX)
+% boolexpr : Purely expandable boolean expressions and switch (eTeX - v3.1 2009/09/30)
%
% The \boolexpr macro evaluate boolean expressions in a *purely expandable way*.
%
@@ -61,8 +61,4 @@
% (pdf)latex boolexpr.dtx
% makeindex -s gind.ist boolexpr.idx
%
-% F Chervet - July 2009
-
-
-
-
+% F Chervet - Jul-Sep 2009 \ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/boolexpr/boolexpr.pdf b/Master/texmf-dist/doc/latex/boolexpr/boolexpr.pdf
index 729cd3e3618..25b21030ca1 100644
--- a/Master/texmf-dist/doc/latex/boolexpr/boolexpr.pdf
+++ b/Master/texmf-dist/doc/latex/boolexpr/boolexpr.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/boolexpr/boolexpr.dtx b/Master/texmf-dist/source/latex/boolexpr/boolexpr.dtx
index 60c967e3666..508e81aa350 100644
--- a/Master/texmf-dist/source/latex/boolexpr/boolexpr.dtx
+++ b/Master/texmf-dist/source/latex/boolexpr/boolexpr.dtx
@@ -1,5 +1,5 @@
% \iffalse meta-comment
-% boolexpr : purely expandable boolean expressions and switch (eTeX) [v3.0 2009/09/03]
+% boolexpr : purely expandable boolean expressions and switch (eTeX) [v3.1 2009/09/30]
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
@@ -38,7 +38,7 @@
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: boolexpr 2009/09/03 v3.0 provides purely expandable boolean expressions and switch (eTeX)}
+\Msg{* Package: boolexpr 2009/09/30 v3.1 provides purely expandable boolean expressions and switch (eTeX)}
\Msg{************************************************************************}
\keepsilent
@@ -96,14 +96,14 @@ boolexpr : a purely expandable boolean expressions and switch (eTeX)
\listfiles
\edef\thisfile{\jobname}
\def\thisinfo{Purely expandable boolean expressions and switch (\eTeX).}
-\def\thisversion{v3.0}
-\def\thisdate{2009/09/03}
+\def\thisversion{v3.1}
+\def\thisdate{2009/09/30}
\let\loadclass\LoadClass
\def\LoadClass#1{\loadclass[abstracton]{scrartcl}\let\scrmaketitle\maketitle\AtEndOfClass{\let\maketitle\scrmaketitle}}
\documentclass[a4paper,oneside]{ltxdoc}
\usepackage[latin9]{inputenc}
\usepackage[american]{babel}
-\usepackage{etex,holtxdoc,etoolbox,xspace,geometry,tocloft,fancyhdr,color,bbding,makecell,enumitem,framed,txfonts,relsize}\CodelineNumbered
+\usepackage{etex,holtxdoc,etextools,xspace,geometry,tocloft,fancyhdr,color,bbding,makecell,enumitem,framed,txfonts,relsize}\CodelineNumbered
\usepackage{fancyvrb,ifpdf}
\IfFileExists{\thisfile.sty}
{\RequirePackage{\thisfile}}
@@ -124,7 +124,7 @@ boolexpr : a purely expandable boolean expressions and switch (eTeX)
%</driver>
% \fi
%
-% \CheckSum{307}
+% \CheckSum{383}
%
% \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
@@ -210,7 +210,7 @@ boolexpr : a purely expandable boolean expressions and switch (eTeX)
%
% \makeatother
%
-% \title{\vskip-2cm\mdseries The {\bfseries \ThisPackage}\kern.6em package}
+% \title{\vskip-2.3cm\mdseries The {\bfseries \ThisPackage}\kern.6em package}
% \author{\small\xemail{florent.chervet@free.fr}}
% \date{\thisdate -- \thisversion}
% \subtitle{\thisinfo}
@@ -257,7 +257,7 @@ boolexpr : a purely expandable boolean expressions and switch (eTeX)
% \cmdref{boolexpr} will expand to \textbf{0} if the expression is \textbf{true}, making it proper to work with |\ifcase|
% Furthermore, \thispackage defines a \cmdref{switch} syntax which remains purely expandable.
%
-% \textbf{Be aware that \cs{boolexpr} (a little like \cs{numexpr}) works only if its argument is purely expandable};
+% \textbf{Be aware that \cs{boolexpr} (a little like \cs{numexpr}) works only if its argument is purely expandable};
% the same for \cs{switch}. If you wish a more general \cs{CASE} syntax refer to this excellent paper:
% \url{http://www.tug.org/TUGboat/Articles/tb14-1/tb38fine.pdf}.
%
@@ -267,12 +267,13 @@ boolexpr : a purely expandable boolean expressions and switch (eTeX)
% \end{abstract}\vskip-.5\baselineskip
%
% \cftbeforesecskip=5pt plus2pt minus4pt
-% \smallskip\setcounter{tocdepth}{2}
+% \smallskip\setcounter{tocdepth}{2}\enlargethispage{\baselineskip}
+% \renewcommand\contentsname{Contents\vskip-5pt}
% {\smaller\tableofcontents}
%
% \def\B#1{\texttt{[}\meta{#1}\texttt{]}}
%
-% \catcode95 11% _
+% \catcode95 11^^A% _
% \section{Introduction -- Using \thispackage : \cs{boolexpr} and \cs{switch}}
%
% \begin{declcs}{boolexpr}\,\M{boolean expression}
@@ -634,7 +635,7 @@ boolexpr : a purely expandable boolean expressions and switch (eTeX)
% \otherwise something else%
% !evaluated(\endswitch)
% \end{VerbEx}
-% &
+% &
% \ifboolexprLoaded \loggingall
% \vspace*{2cm}%
% \switch[\value{myCounter}]
@@ -655,7 +656,7 @@ boolexpr : a purely expandable boolean expressions and switch (eTeX)
% !evaluated(\endswitch)
% \end{VerbEx}
% &
-% \ifboolexprLoaded
+% \ifboolexprLoaded
% \ifdefined\pdfstrcmp
% \vspace*{2cm}%
% \switch[\pdfstrcmp{DuMmY}]
@@ -674,6 +675,15 @@ boolexpr : a purely expandable boolean expressions and switch (eTeX)
% \else Results in \textcolor{green}{green} were not evaluated at compilation time: \thispackage was not found.
% \fi
%
+% \subsection{Purely expandable macros for tests with \xpackage{boolexpr}}
+%
+% Please refer to the \xpackage{etextools} package documentation at :§
+% \url{http://www.ctan.org/tex-archive/macros/latex/contrib/etextools/etextools.pdf}
+%
+%
+%
+%
+%
% \StopEventually{
% }
%
@@ -779,14 +789,14 @@ boolexpr : a purely expandable boolean expressions and switch (eTeX)
% \begin{macrocode}
%<*package>
\ProvidesPackage{boolexpr}
- [2009/09/03 v3.0 Purely expandable boolean expressions and switch (eTeX)]
+ [2009/09/30 v3.1 Purely expandable boolean expressions and switch (eTeX)]
% \end{macrocode}
% \iffalse
%<package>
% \fi
%
% \subsection{Special catcode}
-% The colon (:) will be used as a delimiter. We give it a category code of 4.
+% The colon (/) will be used as a delimiter. We give it a category code of 8 (as in \xpackage{etextools}):
% \iffalse
%<package>% Make a colon (:) of catcode 4 (used as delimiter)
% \fi
@@ -800,10 +810,13 @@ boolexpr : a purely expandable boolean expressions and switch (eTeX)
\catcode#1 #2\relax
}
\TMP@EnsureCode{95}{11}% _
-\TMP@EnsureCode{36}{12}% $
+\TMP@EnsureCode{47}{8}% / etextool delimiter
\TMP@EnsureCode{60}{12}% <
\TMP@EnsureCode{61}{12}% =
\TMP@EnsureCode{62}{12}% >
+\TMP@EnsureCode{43}{12}% -
+\TMP@EnsureCode{45}{12}% +
+\TMP@EnsureCode{58}{8}% : delimitor
% \end{macrocode}
% \iffalse
%<package>
@@ -826,10 +839,19 @@ boolexpr : a purely expandable boolean expressions and switch (eTeX)
% \fi
%
%
-% \begin{macro}{\bex__ifnotblank}
-% The following macro is purely expandable and its code is most probably due to D. Arseneau (\xpackage{url.sty})
+% \begin{macro}{\bex@nbk}
+% The following macro is purely expandable and its code is most probably due to D. Arseneau (\xpackage{url.sty}).
+% \cs{bex@nbk} means if \textbf{n}ot \textbf{b}lan\textbf{k}.
% \begin{macrocode}
-\long\def\bex__ifnotblank#1#2$#3#4#5$${#4}
+\long\def\bex@nbk#1#2/#3#4#5//{#4}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\bex@ifoptchar}
+% \cs{bex@ifoptchar} checks if a character is a single opening bracket `\,\textbf{[}\,`.
+% \begin{macrocode}
+\long\def\bex@ifoptchar#1[#2/#3#{\csname @\if @\detokenize{#1#2}@%
+ first\else second\fi oftwo\endcsname}
% \end{macrocode}
% \end{macro}
%
@@ -854,15 +876,15 @@ boolexpr : a purely expandable boolean expressions and switch (eTeX)
% \fi
% \begin{macrocode}
\long\def\bex@rel#1{%
- \bex@test_eval#1${\bex@eval{#1}}
- {\bex@test_neq#1<>$${\bex@neq #1$}
- {\bex@test_infeq#1<=$${\bex@infeq #1$}
- {\bex@test_inf#1<$${\bex@inf #1$}
- {\bex@test_supeq#1>=$${\bex@supeq #1$}
- {\bex@test_sup#1>$${\bex@sup #1$}
- {\bex@test_eq#1=$${\bex@eq #1$}
+ \bex@test_eval#1/{\bex@eval{#1}}
+ {\bex@test_neq#1<>//{\bex@neq #1/}
+ {\bex@test_infeq#1<=//{\bex@infeq #1/}
+ {\bex@test_inf#1<//{\bex@inf #1/}
+ {\bex@test_supeq#1>=//{\bex@supeq #1/}
+ {\bex@test_sup#1>//{\bex@sup #1/}
+ {\bex@test_eq#1=//{\bex@eq #1/}
{\@latex@error{Unknown relation found while scanning
- \noexpand\boolexpr!}\@ehd}$$}$$}$$}$$}$$}$$}}
+ \noexpand\boolexpr!}\@ehd}//}//}//}//}//}//}}
% \end{macrocode}
% \end{macro}
% \iffalse
@@ -875,13 +897,13 @@ boolexpr : a purely expandable boolean expressions and switch (eTeX)
%<package>% Tests macros to determine the type of each atomic expression
% \fi
% \begin{macrocode}
-\def\bex@test_neq#1<>#2${\bex__ifnotblank#2$}
-\def\bex@test_eq#1=#2${\bex__ifnotblank #2$}
-\def\bex@test_infeq#1<=#2${\bex__ifnotblank #2$}
-\def\bex@test_inf#1<#2${\bex__ifnotblank #2$}
-\def\bex@test_supeq#1>=#2${\bex__ifnotblank #2$}
-\def\bex@test_sup#1>#2${\bex__ifnotblank #2$}
-\long\def\bex@test_eval#1#2${%
+\def\bex@test_neq#1<>#2/{\bex@nbk#2/}
+\def\bex@test_eq#1=#2/{\bex@nbk #2/}
+\def\bex@test_infeq#1<=#2/{\bex@nbk #2/}
+\def\bex@test_inf#1<#2/{\bex@nbk #2/}
+\def\bex@test_supeq#1>=#2/{\bex@nbk #2/}
+\def\bex@test_sup#1>#2/{\bex@nbk #2/}
+\long\def\bex@test_eval#1#2/{%
\ifcat\noexpand#1\relax% #1 is a control sequence
\bex@test_Eval{#1}
\else \expandafter\@secondoftwo
@@ -902,7 +924,6 @@ boolexpr : a purely expandable boolean expressions and switch (eTeX)
%<package>
% \fi
%
-%
% \begin{macro}{Evaluation macros}
% They evaluate each \textit{atomic expression} according to its type:
% \iffalse
@@ -911,7 +932,7 @@ boolexpr : a purely expandable boolean expressions and switch (eTeX)
% \begin{macrocode}
\long\def\bex@true_or_false#1{\csname bex@%
\ifnum\numexpr#1 true\else false\fi part\endcsname}
-\def\bex@false_or_true#1{\csname bex@%
+\long\def\bex@false_or_true#1{\csname bex@%
\ifnum\numexpr#1 false\else true\fi part\endcsname}
% \end{macrocode}
%
@@ -919,12 +940,12 @@ boolexpr : a purely expandable boolean expressions and switch (eTeX)
%<package>
% \fi
% \begin{macrocode}
-\def\bex@eq#1=#2${\bex@true_or_false{#1-(#2)=0}}
-\def\bex@neq#1<>#2${\bex@false_or_true{#1-(#2)=0}}
-\def\bex@infeq#1<=#2${\bex@false_or_true{#1-(#2)>0}}
-\def\bex@inf#1<#2${\bex@true_or_false{#1-(#2)<0}}
-\def\bex@supeq#1>=#2${\bex@false_or_true{#1-(#2)<0}}
-\def\bex@sup#1>#2${\bex@true_or_false{#1-(#2)>0}}
+\def\bex@eq#1=#2/{\bex@true_or_false{#1-(#2)=0}}
+\def\bex@neq#1<>#2/{\bex@false_or_true{#1-(#2)=0}}
+\def\bex@infeq#1<=#2/{\bex@false_or_true{#1-(#2)>0}}
+\def\bex@inf#1<#2/{\bex@true_or_false{#1-(#2)<0}}
+\def\bex@supeq#1>=#2/{\bex@false_or_true{#1-(#2)<0}}
+\def\bex@sup#1>#2/{\bex@true_or_false{#1-(#2)>0}}
\long\def\bex@eval#1{\bex@true_or_false{#1=0}}
% \end{macrocode}
% \end{macro}
@@ -940,7 +961,7 @@ boolexpr : a purely expandable boolean expressions and switch (eTeX)
%<package>% \bex@OR splits the string to evaluate into two parts: before the first \OR and after
% \fi
% \begin{macrocode}
-\long\def\bex@OR#1\OR#2${\bex@AND{#2}#1\AND$}
+\long\def\bex@OR#1\OR#2:{\bex@AND{#2}#1\AND:}
% \end{macrocode}
% \end{macro}
% \iffalse
@@ -953,10 +974,10 @@ boolexpr : a purely expandable boolean expressions and switch (eTeX)
%<package>% \bex@AND splits the string to evaluate into two parts: before the first \AND and after:
% \fi
% \begin{macrocode}
-\long\def\bex@AND#1#2\AND#3${%
+\long\def\bex@AND#1#2\AND#3:{%
\bex@rel{#2}
- {\bex__ifnotblank #3$${\bex@ANDAND{#1}#3$}{+0}$$}
- {\bex__ifnotblank #1$${\bex@OR#1$}{+1}$$}}
+ {\bex@nbk #3//{\bex@ANDAND{#1}#3:}{+0}//}
+ {\bex@nbk #1//{\bex@OR#1:}{+1}//}}
% \end{macrocode}
% \end{macro}
% \iffalse
@@ -970,10 +991,10 @@ boolexpr : a purely expandable boolean expressions and switch (eTeX)
%<package>% \bex@ANDAND evaluate successive atomic expressions related by \AND:
% \fi
% \begin{macrocode}
-\long\def\bex@ANDAND#1#2\AND#3${%
+\long\def\bex@ANDAND#1#2\AND#3:{%
\bex@rel{#2}
- {\bex__ifnotblank #3$${\bex@ANDAND{#1}#3$}{+0}$$}
- {\bex__ifnotblank #1$${\bex@OR#1$}{+1}$$}}
+ {\bex@nbk #3//{\bex@ANDAND{#1}#3:}{+0}//}
+ {\bex@nbk #1//{\bex@OR#1:}{+1}//}}
% \end{macrocode}
% \end{macro}
% \iffalse
@@ -986,7 +1007,7 @@ boolexpr : a purely expandable boolean expressions and switch (eTeX)
%<package>% \boolexpr: the entry point for evaluating boolean expressions
% \fi
% \begin{macrocode}
-\newcommand\boolexpr[1]{\bex__ifnotblank #1$${\numexpr\bex@OR#1 \OR$}{+1}$$}
+\newcommand\boolexpr[1]{\bex@nbk #1//{\numexpr\bex@OR#1\OR:}{+1}//}
% \end{macrocode}
% \end{macro}
% \iffalse
@@ -1009,20 +1030,20 @@ boolexpr : a purely expandable boolean expressions and switch (eTeX)
% \begin{macro}{\switch}
% \cs{switch} is not long to implement... see:
% \begin{macrocode}
-\long\def \switch#1\endswitch {\bex__ifnotblank#1$${\bex@switch_opt#1 \endswitch}{}$$}
-\long\def \bex@switch_opt#1#2\endswitch {\bex_ifsinglechar [{#1}%
+\long\def \switch#1\endswitch {\bex@nbk#1//{\bex@switch_opt#1\endswitch}{}//}
+\long\def \bex@switch_opt#1#2\endswitch{\bex@ifoptchar#1/[/
{\bex@switch_opti#1#2\endswitch}{\bex@switch_opti[]#1#2\endswitch}}%]
\def \bex@switch_opti[#1]#2\endswitch {\bex@switch_otherwise[{#1}]#2\otherwise\endswitch}
\def\bex@switch_otherwise[#1]#2\otherwise#3\endswitch{%
\bex@switch_case[{#1}]#2\case\endswitch
- {\bex__ifnotblank#3$${\bex@otherwise#3\endswitch}{}$$}
+ {\bex@nbk#3//{\bex@otherwise#3\endswitch}{}//}
\endswitch}
-\def\bex@switch_case[#1]#2\case#3\endswitch{\bex__ifnotblank#2$$%
+\def\bex@switch_case[#1]#2\case#3\endswitch{\bex@nbk#2//%
{\bex@case[{#1}]#2\endcase%
- {\bex__ifnotblank#3$${\bex@switch_case[{#1}]#3\endswitch}\@firstoftwo$$}}%
- {\bex__ifnotblank#3$${\bex@switch_case[{#1}]#3\endswitch}\@firstoftwo$$}$$}
+ {\bex@nbk#3//{\bex@switch_case[{#1}]#3\endswitch}\@firstoftwo//}}%
+ {\bex@nbk#3//{\bex@switch_case[{#1}]#3\endswitch}\@firstoftwo//}//}
\long\def\bex@case[#1]#2#3\endcase{\ifboolexpr{#1#2}{\bex@after_endswitch{#3}}}
@@ -1031,29 +1052,55 @@ boolexpr : a purely expandable boolean expressions and switch (eTeX)
% \end{macrocode}
% \end{macro}
%
+% \subsubsection{Purely expandable macros for tests with \xpackage{boolexpr}}
%
-% \begin{macro}{bex_ifsinglechar}
-% From \Xpackage{etextools}:
+%\begin{macro}{\bex@pdfmatch}
% \begin{macrocode}
-\ifdefined\pdfmatch
-\long\def\bex_ifsinglechar#1#2{\csname @%
- \ifnum\pdfmatch{\detokenize{^[#1]$}}{\detokenize{#2}}=1 first\else second\fi
- oftwo\endcsname}
-\else
-\long\gdef\bex_ifsinglechar#1#2{\csname @%
- \bex__ifnotblank#2$${%
- \if\expandafter\@car\detokenize{#2}\relax\@nil\expandafter\@car\detokenize{#1}\string\\\@nil
- \expandafter\expandafter\expandafter\ifx
- \expandafter\expandafter\expandafter\\\expandafter\@cdr\detokenize{#2}\@nil\\%
- first%
- \else second%
- \fi
- \else second%
- \fi}{second}$$oftwo\endcsname}
-\fi
+\long\def\bex@pdfmatch#1#2{\ifnum\pdfmatch{#2}{#1}=0 1\else0\fi}
+% \end{macrocode}
+%\end{macro}
+%
+% \begin{macro}{\bex@ifempty}
+% \begin{macrocode}
+\long\def\bex@ifempty#1{\if\relax\detokenize{#1}\relax0\else1\fi}
+\long\def\bex_ifempty#1{\csname @\if\relax\detokenize{#1}\relax first\else second\fi oftwo\endcsname}
% \end{macrocode}
% \end{macro}
%
+%\begin{macro}{\bex@ifblank}
+% \begin{macrocode}
+\long\def\bex@ifblank#1{\bex@nbk#1//10//}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\bex@ifx}
+% \begin{macrocode}
+\long\def\bex@ifx#1#2{\bex__ifx#1#2//}
+\long\def\bex_ifx#1#2#3/#4#5#6//{\bex@nbk#6//{\ifx#1#2\bex_else#5\else\bex_fi#6\fi}{#5}//}
+\long\def\bex_else#1\else#2\fi{\fi#1}
+\long\def\bex_fi#1\fi{\fi#1}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\bex@comp}
+% \begin{macrocode}
+\long\def\bex@comp#1{\bex@ifoptchar#1/[/\bex@c@mp{\bex@c@mp@[\numexpr]}}
+\long\def\bex@c@mp[#1#2]#3#4#5{%
+ \bex_ifempty{#2}{%
+ \ifx #1\dimexpr \bex@c@mp@\ifdim\dimexpr{#3}{#4}{#5}%
+ \else\ifx #1\numexpr \bex@c@mp@\ifnum\numexpr{#3}{#4}{#5}%
+ \else\ifx #1\glueexpr \bex@c@mp@\ifdim\glueexpr{#3}{#4}{#5}%
+ \else\ifx #1\muexpr \bex@c@mp@\ifdim\muexpr{#3}{#4}{#5}%
+ \else\ifx #1\number \bex@c@mp@\ifnum\numexpr{#3}{#4}{#5}%
+ \else\PackageError{boolexpr}{%
+ Invalid comparison test while scanning \string\bex@comp\MessageBreak
+ found: \detokenize{#1}}%
+ \fi\fi\fi\fi\fi}%
+ {\PackageError{boolexpr}{Invalid comparison test while scanning \string\bex@comp\MessageBreak
+ found: \detokenize{#1}}}}
+\long\def\bex@c@mp@#1#2#3#4#5{#1#2#3#4#5 0\else 1\fi}
+% \end{macrocode}
+%\end{macro}
%
% \begin{macrocode}
\bex@AtEnd\let\bex@AtEnd\@undefined
@@ -1065,15 +1112,16 @@ boolexpr : a purely expandable boolean expressions and switch (eTeX)
% \thispackage should work either with \eTeX{} or \eTeX-\LaTeX{}...
%
% May be build a ``real'' |\NOT| operator.
-%
-% \begin{History}
%
+% \begin{History}
+% \begin{Version}{2009/09/30 v3.1}
+% \item Support of |\pdfmatch| added (|\bex@pdfmatch|) \\
+% \end{Version}
+%
% \begin{Version}{2009/09/03 v3.0 -- \eTeX{}- and Xe\TeX{}- stable}
% \item
% Many bug fixed in \cmdref{switch}. Tested on \LaTeX, pdf\LaTeX{} and Xe\LaTeX.
% \item
-% Optimization of test macros (hopefully no best solution exists...)
-% \item
% Revision of this pdf documentation.
% \end{Version}
%
diff --git a/Master/texmf-dist/source/latex/boolexpr/boolexpr.ins b/Master/texmf-dist/source/latex/boolexpr/boolexpr.ins
index 16f207cba5a..29d0280e35d 100644
--- a/Master/texmf-dist/source/latex/boolexpr/boolexpr.ins
+++ b/Master/texmf-dist/source/latex/boolexpr/boolexpr.ins
@@ -26,7 +26,7 @@
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: boolexpr 2009/09/03 v3.0 provides purely expandable boolean expressions and switch (eTeX)}
+\Msg{* Package: boolexpr 2009/09/30 v3.1 provides purely expandable boolean expressions and switch (eTeX)}
\Msg{************************************************************************}
\keepsilent
diff --git a/Master/texmf-dist/tex/latex/boolexpr/boolexpr.sty b/Master/texmf-dist/tex/latex/boolexpr/boolexpr.sty
index 202b064b961..1acae56abd9 100644
--- a/Master/texmf-dist/tex/latex/boolexpr/boolexpr.sty
+++ b/Master/texmf-dist/tex/latex/boolexpr/boolexpr.sty
@@ -24,7 +24,7 @@
%%
%% boolexpr : a purely expandable boolean expressions and switch (eTeX)
\ProvidesPackage{boolexpr}
- [2009/09/03 v3.0 Purely expandable boolean expressions and switch (eTeX)]
+ [2009/09/30 v3.1 Purely expandable boolean expressions and switch (eTeX)]
% Make a colon (:) of catcode 4 (used as delimiter)
\let\bex@AtEnd\@empty
@@ -36,37 +36,42 @@
\catcode#1 #2\relax
}
\TMP@EnsureCode{95}{11}% _
-\TMP@EnsureCode{36}{12}% $
+\TMP@EnsureCode{47}{8}% / etextool delimiter
\TMP@EnsureCode{60}{12}% <
\TMP@EnsureCode{61}{12}% =
\TMP@EnsureCode{62}{12}% >
+\TMP@EnsureCode{43}{12}% -
+\TMP@EnsureCode{45}{12}% +
+\TMP@EnsureCode{58}{8}% : delimitor
% Three helper macros
\let\bex@truepart\@firstoftwo
\let\bex@falsepart\@secondoftwo
-\long\def\bex__ifnotblank#1#2$#3#4#5$${#4}
+\long\def\bex@nbk#1#2/#3#4#5//{#4}
+\long\def\bex@ifoptchar#1[#2/#3#{\csname @\if @\detokenize{#1#2}@%
+ first\else second\fi oftwo\endcsname}
% \bex@rel tests each atomic expression: choose which evaluation macro to use first
\long\def\bex@rel#1{%
- \bex@test_eval#1${\bex@eval{#1}}
- {\bex@test_neq#1<>$${\bex@neq #1$}
- {\bex@test_infeq#1<=$${\bex@infeq #1$}
- {\bex@test_inf#1<$${\bex@inf #1$}
- {\bex@test_supeq#1>=$${\bex@supeq #1$}
- {\bex@test_sup#1>$${\bex@sup #1$}
- {\bex@test_eq#1=$${\bex@eq #1$}
+ \bex@test_eval#1/{\bex@eval{#1}}
+ {\bex@test_neq#1<>//{\bex@neq #1/}
+ {\bex@test_infeq#1<=//{\bex@infeq #1/}
+ {\bex@test_inf#1<//{\bex@inf #1/}
+ {\bex@test_supeq#1>=//{\bex@supeq #1/}
+ {\bex@test_sup#1>//{\bex@sup #1/}
+ {\bex@test_eq#1=//{\bex@eq #1/}
{\@latex@error{Unknown relation found while scanning
- \noexpand\boolexpr!}\@ehd}$$}$$}$$}$$}$$}$$}}
+ \noexpand\boolexpr!}\@ehd}//}//}//}//}//}//}}
% Tests macros to determine the type of each atomic expression
-\def\bex@test_neq#1<>#2${\bex__ifnotblank#2$}
-\def\bex@test_eq#1=#2${\bex__ifnotblank #2$}
-\def\bex@test_infeq#1<=#2${\bex__ifnotblank #2$}
-\def\bex@test_inf#1<#2${\bex__ifnotblank #2$}
-\def\bex@test_supeq#1>=#2${\bex__ifnotblank #2$}
-\def\bex@test_sup#1>#2${\bex__ifnotblank #2$}
-\long\def\bex@test_eval#1#2${%
+\def\bex@test_neq#1<>#2/{\bex@nbk#2/}
+\def\bex@test_eq#1=#2/{\bex@nbk #2/}
+\def\bex@test_infeq#1<=#2/{\bex@nbk #2/}
+\def\bex@test_inf#1<#2/{\bex@nbk #2/}
+\def\bex@test_supeq#1>=#2/{\bex@nbk #2/}
+\def\bex@test_sup#1>#2/{\bex@nbk #2/}
+\long\def\bex@test_eval#1#2/{%
\ifcat\noexpand#1\relax% #1 is a control sequence
\bex@test_Eval{#1}
\else \expandafter\@secondoftwo
@@ -85,73 +90,80 @@
% Evaluation macro that evaluates an atomic expression depending on its type:
\long\def\bex@true_or_false#1{\csname bex@%
\ifnum\numexpr#1 true\else false\fi part\endcsname}
-\def\bex@false_or_true#1{\csname bex@%
+\long\def\bex@false_or_true#1{\csname bex@%
\ifnum\numexpr#1 false\else true\fi part\endcsname}
-\def\bex@eq#1=#2${\bex@true_or_false{#1-(#2)=0}}
-\def\bex@neq#1<>#2${\bex@false_or_true{#1-(#2)=0}}
-\def\bex@infeq#1<=#2${\bex@false_or_true{#1-(#2)>0}}
-\def\bex@inf#1<#2${\bex@true_or_false{#1-(#2)<0}}
-\def\bex@supeq#1>=#2${\bex@false_or_true{#1-(#2)<0}}
-\def\bex@sup#1>#2${\bex@true_or_false{#1-(#2)>0}}
+\def\bex@eq#1=#2/{\bex@true_or_false{#1-(#2)=0}}
+\def\bex@neq#1<>#2/{\bex@false_or_true{#1-(#2)=0}}
+\def\bex@infeq#1<=#2/{\bex@false_or_true{#1-(#2)>0}}
+\def\bex@inf#1<#2/{\bex@true_or_false{#1-(#2)<0}}
+\def\bex@supeq#1>=#2/{\bex@false_or_true{#1-(#2)<0}}
+\def\bex@sup#1>#2/{\bex@true_or_false{#1-(#2)>0}}
\long\def\bex@eval#1{\bex@true_or_false{#1=0}}
% \bex@OR splits the string to evaluate into two parts: before the first \OR and after
-\long\def\bex@OR#1\OR#2${\bex@AND{#2}#1\AND$}
+\long\def\bex@OR#1\OR#2:{\bex@AND{#2}#1\AND:}
% \bex@AND splits the string to evaluate into two parts: before the first \AND and after:
-\long\def\bex@AND#1#2\AND#3${%
+\long\def\bex@AND#1#2\AND#3:{%
\bex@rel{#2}
- {\bex__ifnotblank #3$${\bex@ANDAND{#1}#3$}{+0}$$}
- {\bex__ifnotblank #1$${\bex@OR#1$}{+1}$$}}
+ {\bex@nbk #3//{\bex@ANDAND{#1}#3:}{+0}//}
+ {\bex@nbk #1//{\bex@OR#1:}{+1}//}}
% \bex@ANDAND evaluate successive atomic expressions related by \AND:
-\long\def\bex@ANDAND#1#2\AND#3${%
+\long\def\bex@ANDAND#1#2\AND#3:{%
\bex@rel{#2}
- {\bex__ifnotblank #3$${\bex@ANDAND{#1}#3$}{+0}$$}
- {\bex__ifnotblank #1$${\bex@OR#1$}{+1}$$}}
+ {\bex@nbk #3//{\bex@ANDAND{#1}#3:}{+0}//}
+ {\bex@nbk #1//{\bex@OR#1:}{+1}//}}
% \boolexpr: the entry point for evaluating boolean expressions
-\newcommand\boolexpr[1]{\bex__ifnotblank #1$${\numexpr\bex@OR#1 \OR$}{+1}$$}
+\newcommand\boolexpr[1]{\bex@nbk #1//{\numexpr\bex@OR#1\OR:}{+1}//}
% \ifboolexpr: the LaTeX form of \boolexpr tests
\newcommand\ifboolexpr[1]{\bex@true_or_false{\boolexpr{#1}=0}}
-\long\def \switch#1\endswitch {\bex__ifnotblank#1$${\bex@switch_opt#1 \endswitch}{}$$}
-\long\def \bex@switch_opt#1#2\endswitch {\bex_ifsinglechar [{#1}%
+\long\def \switch#1\endswitch {\bex@nbk#1//{\bex@switch_opt#1\endswitch}{}//}
+\long\def \bex@switch_opt#1#2\endswitch{\bex@ifoptchar#1/[/
{\bex@switch_opti#1#2\endswitch}{\bex@switch_opti[]#1#2\endswitch}}%]
\def \bex@switch_opti[#1]#2\endswitch {\bex@switch_otherwise[{#1}]#2\otherwise\endswitch}
\def\bex@switch_otherwise[#1]#2\otherwise#3\endswitch{%
\bex@switch_case[{#1}]#2\case\endswitch
- {\bex__ifnotblank#3$${\bex@otherwise#3\endswitch}{}$$}
+ {\bex@nbk#3//{\bex@otherwise#3\endswitch}{}//}
\endswitch}
-\def\bex@switch_case[#1]#2\case#3\endswitch{\bex__ifnotblank#2$$%
+\def\bex@switch_case[#1]#2\case#3\endswitch{\bex@nbk#2//%
{\bex@case[{#1}]#2\endcase%
- {\bex__ifnotblank#3$${\bex@switch_case[{#1}]#3\endswitch}\@firstoftwo$$}}%
- {\bex__ifnotblank#3$${\bex@switch_case[{#1}]#3\endswitch}\@firstoftwo$$}$$}
+ {\bex@nbk#3//{\bex@switch_case[{#1}]#3\endswitch}\@firstoftwo//}}%
+ {\bex@nbk#3//{\bex@switch_case[{#1}]#3\endswitch}\@firstoftwo//}//}
\long\def\bex@case[#1]#2#3\endcase{\ifboolexpr{#1#2}{\bex@after_endswitch{#3}}}
\long\def\bex@after_endswitch#1#2\endswitch{#1}
\long\def\bex@otherwise#1\otherwise#2\endswitch{#1}
-\ifdefined\pdfmatch
-\long\def\bex_ifsinglechar#1#2{\csname @%
- \ifnum\pdfmatch{\detokenize{^[#1]$}}{\detokenize{#2}}=1 first\else second\fi
- oftwo\endcsname}
-\else
-\long\gdef\bex_ifsinglechar#1#2{\csname @%
- \bex__ifnotblank#2$${%
- \if\expandafter\@car\detokenize{#2}\relax\@nil\expandafter\@car\detokenize{#1}\string\\\@nil
- \expandafter\expandafter\expandafter\ifx
- \expandafter\expandafter\expandafter\\\expandafter\@cdr\detokenize{#2}\@nil\\%
- first%
- \else second%
- \fi
- \else second%
- \fi}{second}$$oftwo\endcsname}
-\fi
+\long\def\bex@pdfmatch#1#2{\ifnum\pdfmatch{#2}{#1}=0 1\else0\fi}
+\long\def\bex@ifempty#1{\if\relax\detokenize{#1}\relax0\else1\fi}
+\long\def\bex_ifempty#1{\csname @\if\relax\detokenize{#1}\relax first\else second\fi oftwo\endcsname}
+\long\def\bex@ifblank#1{\bex@nbk#1//10//}
+\long\def\bex@ifx#1#2{\bex__ifx#1#2//}
+\long\def\bex_ifx#1#2#3/#4#5#6//{\bex@nbk#6//{\ifx#1#2\bex_else#5\else\bex_fi#6\fi}{#5}//}
+\long\def\bex_else#1\else#2\fi{\fi#1}
+\long\def\bex_fi#1\fi{\fi#1}
+\long\def\bex@comp#1{\bex@ifoptchar#1/[/\bex@c@mp{\bex@c@mp@[\numexpr]}}
+\long\def\bex@c@mp[#1#2]#3#4#5{%
+ \bex_ifempty{#2}{%
+ \ifx #1\dimexpr \bex@c@mp@\ifdim\dimexpr{#3}{#4}{#5}%
+ \else\ifx #1\numexpr \bex@c@mp@\ifnum\numexpr{#3}{#4}{#5}%
+ \else\ifx #1\glueexpr \bex@c@mp@\ifdim\glueexpr{#3}{#4}{#5}%
+ \else\ifx #1\muexpr \bex@c@mp@\ifdim\muexpr{#3}{#4}{#5}%
+ \else\ifx #1\number \bex@c@mp@\ifnum\numexpr{#3}{#4}{#5}%
+ \else\PackageError{boolexpr}{%
+ Invalid comparison test while scanning \string\bex@comp\MessageBreak
+ found: \detokenize{#1}}%
+ \fi\fi\fi\fi\fi}%
+ {\PackageError{boolexpr}{Invalid comparison test while scanning \string\bex@comp\MessageBreak
+ found: \detokenize{#1}}}}
+\long\def\bex@c@mp@#1#2#3#4#5{#1#2#3#4#5 0\else 1\fi}
\bex@AtEnd\let\bex@AtEnd\@undefined
\endinput
%%