%%%%%%%%%%%%%%%%%%%%%%%%%%% hescan.sty %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% hescan.sty
% experimental scanner for Hebrew files
% to install it, include it as a LaTeX style option "hedscan"
% to activate it, say "\setcode {hed}" or "\setcode {HED}"
% or "\setcode {pccode}" or "\setcode {newcode}"
% 02.03.95
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% (c) Klaus Lagally
%     Institut fuer Informatik
%     Universitaet Stuttgart
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\ifx \hedatcode \undefined \else \xpa \endinput \fi

\chardef \hedatcode = \catcode`\@  \catcode`\@ = 11

\a@ident {hescan.sty} {3.03} {02.03.95}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% dynamic definitions for Hebrew
{\catcode `\ =9 \catcode `\^^M=9 \catcode `\^^I=9
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\gdef \sethed@codes {\seta@codes % activate and change some codes
\globaldefs=1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% correct handling of double consonants; hacked
\def \sc@A {va}   \def \sc@B {ga}   \def \sc@C {da}   \def \sc@D {ha}
\def \sc@E {wa}   \def \sc@F {za}   \def \sc@G {Xa}   \def \sc@H {Va}
\def \sc@I {ya}   \def \sc@J {ka}   \def \sc@K {ka}   \def \sc@L {la}
\def \sc@M {ma}   \def \sc@N {ma}   \def \sc@O {na}   \def \sc@P {na}
\def \sc@Q {sa}   \def \sc@R {Pa}   \def \sc@S {fa}   \def \sc@T {fa}
\def \sc@U {Sa}   \def \sc@V {Sa}   \def \sc@W {qa}   \def \sc@X {ra}
\def \sc@Y {\n@xp \a@S a}  	    \def \sc@Z {ta}	  
\def \sc@s {\n@xp \a@S a}  	    \def \sc@@ {QQ}
\a@digits = {0123456789}	\a@paren  = {()[]}	\a@first = {"`}
\globaldefs=0 
\lccode `-=`<% for Maqqeph 
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}% end of dynamic definitions for Hebrew
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def \hed@scan #1>{% modified scanner call: token sequence -> \a@tokens
\iftest@scan \ifshow \else \a@verb #1>\fi \tracingmacros = 1 \fi
\global\sc@next = {}\global\sc@rest = {}%
\global\def \a@rest {}\global\a@tokens = {}%
\novocalize \lowercase {\sc@beg #1>>}% transform
\iftest@scan \tracingmacros = 0 \xpa \a@verb \xpa (\the\a@tokens )>\fi }

\def \hed@word #1#2{% transform input into internal notation
\def \next {\hed@word #2}%
\ifx #1>\let \next \relax \else
\ifx #1<\def \sc@char {B}\sc@put \else
\ifcat \noexpand #1a\ifx #1#2\def \next {\hed@word -#2}\fi
	\edef \sc@char {\csname sc@#1\endcsname }\sc@put
\else \def \sc@char {#1}\sc@put
\fi\fi\fi \next }

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

\def \a@hedcode {hed}            \def \a@HEDcode {HED}            
\def \heb@newcode {newcode}      \def \heb@pccode {pccode}      
\let \hed@setcode \setcode

\newcount \is@m      \is@m = 64   	% redefine characters
\newcount \is@n      \is@n = 128	% pccode
\newcount \is@l	     \is@l = 224	% newcode
\loop 	\lccode \is@n = \is@m \catcode \is@n = 11
	\lccode \is@l = \is@m \catcode \is@l = 11
\ifnum 90 > \is@m \advance \is@m 1 
	\advance \is@n 1 \advance \is@l 1     
\repeat

\def \set@heb@newcode {% substitute new scanner
\sethed@codes	\let \a@scan \hed@scan
\let \sc@beg \hed@word 	\let \sc@word \hed@word  
\message {input coding set to Hebrew `pccode' and `newcode' conventions}}

\def \setcode #1{\def \next {#1}% switch input coding
\ifx \next \a@hedcode \set@heb@newcode \else
\ifx \next \a@HEDcode \set@heb@newcode \else
\ifx \next \heb@newcode \set@heb@newcode \else
\ifx \next \heb@pccode \set@heb@newcode \else
	\hed@setcode {#1}%
\fi\fi\fi\fi }

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

\message {scanner for Hebrew codes `pccode' and `newcode' installed.}

\catcode `\@ = \hedatcode
\endinput
%%%%%%%%%%%%%%%%%%%%%%%% EOF %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

