%%%%%%%%%%%%%%%%%%%%%%%%%%% 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}"
% 13.07.94
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% (c) Klaus Lagally
%     Institut fuer Informatik
%     Universitaet Stuttgart
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

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

\version = {1.02}  		\datum = {13.07.94}
\message {\the\version }	\message {(\the\datum )}

\edef \arabtexconfig {\arabtexconfig 
hescan.sty \the\version \space (\the\datum) }

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

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

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% dynamic definitions for Hebrew
{\catcode `\ =9 \catcode `\^^M=9 \catcode `\^^I=9
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\gdef \sethed@codes {\seta@codes % activate and change some codes
\globaldefs=1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def \sc@A {v}   \def \sc@B {g}   \def \sc@C {d}   \def \sc@D {h}
\def \sc@E {w}   \def \sc@F {z}   \def \sc@G {H}   \def \sc@H {V}
\def \sc@I {y}   \def \sc@J {k}   \def \sc@K {k}   \def \sc@L {l}
\def \sc@M {m}   \def \sc@N {m}   \def \sc@O {n}   \def \sc@P {n}
\def \sc@Q {s}   \def \sc@R {P}   \def \sc@S {f}   \def \sc@T {f}
\def \sc@U {S}   \def \sc@V {S}   \def \sc@W {q}   \def \sc@X {r}
\def \sc@Y {\n@xp \a@S }  	  \def \sc@Z {t}	  
\def \sc@s {\n@xp \a@S }  	  \def \sc@@ {QQ}
\a@digits = {0123456789}	\a@paren  = {()[]}		
\a@first = {"`}
\globaldefs=0 }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}% 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 = {}\lowercase {\sc@beg #1>>}% transform
\iftest@scan \tracingmacros = 0 %
\expandafter \a@verb \expandafter (\the\a@tokens )>\fi }

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

\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
\h@mzafalse  \iz@fetfalse \sethed@codes
\let \sc@beg \hed@word 	\let \sc@word \hed@word  \let \a@scan \hed@scan
\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 }

\def \hed@word #1#2{% transform input into internal notation
\def \next {\hed@word #2}%
\ifx #1>\let \next \relax \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 \next }

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

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

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

