%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% arabaux.sty
% auxiliary macros for ArabTeX 
% 27.04.2003
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% (c) Klaus Lagally
%     Institut fuer Formale Methoden der Informatik
%     Universitaet Stuttgart
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\a@ident {arabaux.sty} {3.11 auxiliary macros for ArabTeX} {21.05.2003}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def \a@message #1{% ArabTeX message
\message{(ArabTeX) #1}}

\def \isfalse {\xxpa \iffalse \fi }   % invert condition before \fi
\def \setiffalse {\xpa \iffalse \fi } % invert condition before \fi

\def \NOT #1{00\if #1\xpa \setiffalse \fi }

\def \AND #1#2{00\if #1\if #2\else \xxpa \setiffalse \fi
\else \xpa \setiffalse \fi }

\def \OR #1#2{00\if #1\else \if #2\else \xpa \setiffalse \fi \fi }

\def \isx #1#2{00\ifx #1#2\else\xpa \setiffalse \fi }

\def \iscat #1#2{00\ifcat #1#2\else\xpa \setiffalse \fi }

\def \is #1#2{00\if #1#2\else\xpa \setiffalse \fi }

\long\def \Return #1\fi {\fi #1}
\long\def \ReturnFi #1\fi {\fi #1}
\long\def \ReturnElseFi #1\else #2\fi {\fi #1}

\long\def \cond #1#2#3\fi {% call conditional
#1\ReturnElseFi {#2}\else \ReturnFi {#3}\fi }

%%%%%%%%%%%%%%%%%%%% 

\def \@gobble #1{}

\let \protect \relax

\ifx \@\undefined \def \@{@}\fi

\ifx \nil \undefined \def \nil {NIL}\fi

\def \pdef #1{% define robust command
\edef #1{\nxp\protect \xpa\nxp\csname \xpa\@gobble\string #1 \endcsname }%
\xpa\def \csname \xpa\@gobble\string #1 \endcsname }

\def \a@extend #1#2{% extend command definition, no pars!
\xpa\gdef \xpa#1\xpa{#1#2}}

%%%%%%%%%%%%%%%%%%%% 

% map token to action
% allow list of labels
\def \case #1\of #{%
  \begingroup \tracingmacros 0
  \def \l@@kup ##1#1##2##{\h@@d }%
  \getc@se #1\of }

\def \getc@se #1\of #2#3\endcase {%
  \doc@se #1#2\default {}\@end }

\def \doc@se #1#2\default #3#4\@end {%
  \l@@kup #2#1{#3}\@end }

\def \h@@d #1#2\@end {\endgroup #1}

% evaluate map: sets \result
\def \evalcase #1\of #{%
  \begingroup \tracingmacros 0
  \def \l@@kup ##1#1##2##{\r@sult }%
  \getc@se #1\of }

\def \r@sult #1#2\@end {\endgroup \def \result {#1}}

% apply function to map: 
\def \apply #1\tocase #2\of #{%
  \begingroup \tracingmacros 0
  \def \l@@kup ##1#2##2##{\@pply {#1}}%
  \getc@se #2\of }

\def \@pply #1#2#3\@end {\endgroup #1{#2}}

%%%%%%%%%%%%%%%%%%%%%%%% tracing control %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def \tr@ceoff {% suspend temporarily, local, no nesting!
\edef \tr@ceon {\nxp\tracingmacros \the\tracingmacros }\tracingmacros 0 }

\def \notr@ce {% suspend temporarily, for NFSS only, no nesting!
\edef \dotr@ce {\nxp\tracingmacros \the\tracingmacros }\tracingmacros 0 }

\let \tr@ceon \relax     \let \dotr@ce \relax

\let \a@setfontsize \@setfontsize

\def \@setfontsize #1#2#3{% do not trace NFSS routine
\notr@ce \a@setfontsize {#1}{#2}{#3}\dotr@ce }

%%%%%%%%%%%%%%%%%%%%%%%% list utilities %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\long\def \is@in@list #1#2>{00% #1 token, #2 list                
  \begingroup \tracingmacros 0
  \def \l@@kup ##1#1##2\@ {\endgroup \ifx >##2\isfalse \fi }% 
  \l@@kup #2#1>\@ }

\long\def \ismember #1#2{00% #1 token, #2 list                
  \begingroup \tracingmacros 0
  \def \l@@kup ##1#1##2\@@ {\endgroup \ifx \nil ##2\xpa \setiffalse \fi }% 
  \l@@kup #2#1\nil \@@ }

\long\def \is@in@set #1#2{% #1 = symbol, #2 = token list of symbols
\xpa \ismember \xpa #1\xpa {\the #2}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcount \hours        \newcount \mins

\def \timeofday 
{\hours \time \divide \hours 60 \the\hours:%
\mins \time \multiply \hours 60 \advance \mins -\hours 
\ifnum 10 > \mins \relax 0\fi \the\mins }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\endinput
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% EOF %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


