summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-10-02 23:04:11 +0000
committerKarl Berry <karl@freefriends.org>2011-10-02 23:04:11 +0000
commitbb33b6aa379703cfbc67cab3ceace446e594fa3b (patch)
tree4c08d23164f533a068cf9106a6e44bb07ac737c8 /Master/texmf-dist/tex/generic
parentaf940299969ece442832d1700f8359006f70dff7 (diff)
texapi 1.04 (2oct11)
git-svn-id: svn://tug.org/texlive/trunk@24170 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic')
-rw-r--r--Master/texmf-dist/tex/generic/texapi/texapi.tex69
1 files changed, 66 insertions, 3 deletions
diff --git a/Master/texmf-dist/tex/generic/texapi/texapi.tex b/Master/texmf-dist/tex/generic/texapi/texapi.tex
index 28f33717fb3..0312d1aeb42 100644
--- a/Master/texmf-dist/tex/generic/texapi/texapi.tex
+++ b/Master/texmf-dist/tex/generic/texapi/texapi.tex
@@ -4,7 +4,7 @@
% Author: Paul Isambert.
% E-mail: zappathustra AT free DOT fr
% Comments and suggestions are welcome.
-% Date: January 2011.
+% Date: October 2011.
%
\ifx\texapialreadyloaded\somethingtotallyundefined
\else
@@ -16,7 +16,7 @@
\expandafter\endinput
\fi
%
-\def\texapiversion{1.03}
+\def\texapiversion{1.04}
\expandafter\edef\csname pi@restorecatcodes\endcsname{%
\catcode`\noexpand\@=\the\catcode`@\relax
\catcode`\noexpand\_=\the\catcode`_\relax
@@ -222,7 +222,7 @@
\def\reverse#1{%
\ifcs{pi@reverse_\commandtoname#1}
{\usecs{pi@reverse_\commandtoname#1}}
- {\senderror{texapi}{You can't use `\string\reverse' before `\string#1'}#1}%
+ {\unless#1}%
}
%
\def\pi@ifdef_simple#1#2{%
@@ -354,6 +354,67 @@
\fi
}
%
+\pi@ifdef_onearg\ifwhatever{%
+ #1%
+ \ifx\pi@ifwhatever_false aa%
+ \pi@ifwhatever_true
+ \else
+ \expandafter\expandafter\expandafter\firstoftwo
+ \fi
+ \else
+ \expandafter\secondoftwo
+ \fi
+ }
+\def\pi@ifwhatever_false#1\fi#2\fi{\secondoftwo}
+\def\pi@ifwhatever_true#1\fi#2\fi{\fi\firstoftwo}
+%
+\pi@ifdef_onearg\ifexpression{%
+ \pi@ifexpression_or#1|\pi@terminator
+ }
+\def\pi@ifexpression_or#1|#2\pi@terminator{%
+ \ifemptystring{#2}
+ {\pi@ifexpression_and#1&\pi@terminator}
+ {\ifexpression{#1}{\firstoftwo}{\pi@ifexpression_removeor#2\pi@terminator}}%
+ }
+\def\pi@ifexpression_and#1&#2\pi@terminator{%
+ \ifemptystring{#2}
+ {\passtrimleft{#1}\pi@ifexpression_not}
+ {\ifexpression{#1}{\pi@ifexpression_removeand#2\pi@terminator}{\secondoftwo}}%
+ }
+\def\pi@ifexpression_removeor#1|\pi@terminator{%
+ \pi@ifexpression_or#1|\pi@terminator
+ }
+\def\pi@ifexpression_removeand#1&\pi@terminator{%
+ \pi@ifexpression_or#1|\pi@terminator
+ }
+\def\pi@ifexpression_not#1{%
+ \ifprefix-{#1}% See line 858, where \newstring{-} is declared, so this remains expandable.
+ {\expandafter\pi@ifexpression_braces\gobbleone#1{}\pi@terminator
+ % Trimming will also remove braces.
+ {\expandafter\passtrimright\expandafter{\gobbleone#1}\ifexpression}
+ {\expandafter\ifwhatever\expandafter{\gobbleone#1}}
+ \secondoftwo\firstoftwo}
+ {\pi@ifexpression_braces#1{}\pi@terminator
+ {\passtrimright{#1}\ifexpression}
+ {\ifwhatever{#1}}}%
+ }
+\def\pi@ifexpression_braces#1#{%
+ \pi@gobbletoterminator{%
+ \ifemptystring{#1}}
+ }
+%
+\long\def\ifelseif#1{%
+ \pi@ifelseif{}#1\iftrue{}\pi@terminator
+ }
+\long\def\pi@reverse_ifelseif#1{%
+ \pi@ifelseif\reverse#1\iffalse{}\pi@terminator
+ }
+\long\def\pi@ifelseif#1#2#3{%
+ #1\ifwhatever{#2}
+ {\pi@gobbletoterminator{#3}}
+ {\pi@ifelseif{#1}}%
+ }
+%
%
%
%
@@ -795,6 +856,8 @@
##3{##1}{##2}}%
}
%
+\newstring{-}% This is for \ifprefix on line 391 above.
+%
\pi@ifdef_twoarg\ifprefix{%
\ifemptystring{#1}\firstoftwo
{\ifcs{pi@strings_ifprefix:\detokenize{#1}}