From 59222c9505c42ce998b7dbef0b08077a2b0adc3c Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Sat, 12 Jul 2014 22:23:04 +0000
Subject: lisp-on-tex (12jul14)

git-svn-id: svn://tug.org/texlive/trunk@34578 c570f23f-e606-0410-a88d-b1316a301751
---
 .../tex/latex/lisp-on-tex/lisp-arith.sty           | 61 +++++++++++++++++++++-
 1 file changed, 60 insertions(+), 1 deletion(-)

(limited to 'Master/texmf-dist/tex/latex/lisp-on-tex/lisp-arith.sty')

diff --git a/Master/texmf-dist/tex/latex/lisp-on-tex/lisp-arith.sty b/Master/texmf-dist/tex/latex/lisp-on-tex/lisp-arith.sty
index 7f8d51dfdf0..23d48402873 100644
--- a/Master/texmf-dist/tex/latex/lisp-on-tex/lisp-arith.sty
+++ b/Master/texmf-dist/tex/latex/lisp-on-tex/lisp-arith.sty
@@ -76,6 +76,65 @@
 \addassoc\@globalenv\<{\@tlabel@func{\@arith@lt}}
 \def\@arith@lt#1\@tlabel@int#2\@tlabel@int#3{%
   \ifnum#2<#3 \gdef#1{\@tlabel@bool{t}}\else\gdef#1{\@tlabel@bool{f}}\fi}
+
 \addassoc\@globalenv\>{\@tlabel@func{\@arith@gt}}
 \def\@arith@gt#1\@tlabel@int#2\@tlabel@int#3{%
-  \ifnum#2>#3 \gdef#1{\@tlabel@bool{t}}\else\gdef#1{\@tlabel@bool{f}}\fi}
\ No newline at end of file
+  \ifnum#2>#3 \gdef#1{\@tlabel@bool{t}}\else\gdef#1{\@tlabel@bool{f}}\fi}
+
+\addassoc\@globalenv\leq{\@tlabel@func{\@arith@leq}}
+\def\@arith@leq#1\@tlabel@int#2\@tlabel@int#3{%
+  \ifnum#2<#3 \gdef#1{\@tlabel@bool{t}}\else\gdef#1{\@tlabel@bool{f}}\fi
+  \ifnum#2=#3 \gdef#1{\@tlabel@bool{t}}\fi}
+
+\addassoc\@globalenv\geq{\@tlabel@func{\@arith@geq}}
+\def\@arith@geq#1\@tlabel@int#2\@tlabel@int#3{%
+  \ifnum#2>#3 \gdef#1{\@tlabel@bool{t}}\else\gdef#1{\@tlabel@bool{f}}\fi
+  \ifnum#2=#3 \gdef#1{\@tlabel@bool{t}}\fi}
+
+\addassoc\@globalenv\isZeroQ{\@tlabel@func{\@arith@is@zero}}
+\def\@arith@is@zero#1\@tlabel@int#2{%
+  \ifnum#2=0 \gdef#1{\@tlabel@bool{t}}\else\gdef#1{\@tlabel@bool{f}}\fi}
+
+\addassoc\@globalenv\positiveQ{\@tlabel@func{\@arith@is@positive}}
+\def\@arith@is@positive#1\@tlabel@int#2{%
+  \ifnum#2>0 \gdef#1{\@tlabel@bool{t}}\else\gdef#1{\@tlabel@bool{f}}\fi}
+
+\addassoc\@globalenv\negativeQ{\@tlabel@func{\@arith@is@negative}}
+\def\@arith@is@positive#1\@tlabel@int#2{%
+  \ifnum#2<0 \gdef#1{\@tlabel@bool{t}}\else\gdef#1{\@tlabel@bool{f}}\fi}
+
+\addassoc\@globalenv\max{\@tlabel@func{\@arith@max}}
+\def\@arith@max#1#2#3{%
+  \ifx#2\@tlabel@int
+    \@temp@inti#3\relax
+    \let\@next@max\@@arith@max
+  \else
+    \errmessage{LISP on TeX [integer max]: Invalid argument or Too few arguments}%
+  \fi\@next@max#1}
+\def\@@arith@max#1#2#3{%
+  \ifx#2\relax
+    \let\@next@max\@@arith@pm@fin
+  \else\ifx#2\@tlabel@int
+    \ifnum#3>\@temp@inti\@temp@inti#3\relax\fi
+    \let\@next@max\@@arith@max
+  \else
+    \errmessage{LISP on TeX [integer max]: Invalid argument}%
+  \fi\fi\@next@max#1}
+
+\addassoc\@globalenv\min{\@tlabel@func{\@arith@min}}
+\def\@arith@min#1#2#3{%
+  \ifx#2\@tlabel@int
+    \@temp@inti#3\relax
+    \let\@next@min\@@arith@min
+  \else
+    \errmessage{LISP on TeX [integer min]: Invalid argument or Too few arguments}%
+  \fi\@next@min#1}
+\def\@@arith@min#1#2#3{%
+  \ifx#2\relax
+    \let\@next@min\@@arith@pm@fin
+  \else\ifx#2\@tlabel@int
+    \ifnum#3<\@temp@inti\@temp@inti#3\relax\fi
+    \let\@next@min\@@arith@min
+  \else
+    \errmessage{LISP on TeX [integer min]: Invalid argument}%
+  \fi\fi\@next@min#1}
-- 
cgit v1.2.3

