%%%%%%%%%%%%%%%%%%%%%%%%%%% utfhebr.sty %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% utfhebr.sty 
% scanner module for the Hebrew segment of UTF-8
% supposes Hebrew mode
% loaded and called by utf8.sty
% 17.07.1999
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% (c) Klaus Lagally
%     Institut fuer Informatik
%     Universitaet Stuttgart
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\catcode`\@ = 11

\a@ident {utfhebr.sty} {3.09 Hebrew segment of UTF-8} {17.07.1999}

\newtoks \utfb@oldchar

\def \utfb@scan #1{% modified scanner call: token sequence -> \a@tokens
\iftest@scan \tracingmacros = 1 \fi
\def \sc@char {}\utfb@oldchar {!}\def \sc@beg {\utfb@word }%
\sc@beg #1\@ \@ \@ \@@ % transform
\iftest@scan \tracingmacros = 0 \xpa \a@verb \xpa (\the\a@tokens )>\fi }

\def \utfb@word #1#2{% transform input into internal notation
\ifx #1\@ \def \next {\utfb@end #1#2}\else
%\ifcat \nxp #1\relax \def \next {\utfb@cs #1#2}\else	% control sequence
\ifnum `#1=214 \def \next {\utfb@dvi #2}\else
\ifnum `#1=215 \def \next {\utfb@dvii #2}\else
\ifnum 128 > `#1\def \next {\utfb@asci #1#2}\else
%\fi
\fi\fi\fi\fi \next }

\def \utfb@end #1\@@ {\relax }

\def \utfb@asci #1{% ASCII item
\def \sc@char {#1}\sc@put \utfb@word }

\def \utfb@next {% save and deposit character
\utfb@oldchar \xpa{\sc@char }\sc@put \utfb@word }

\def \utfb@asci #1{% deposit ASCII item
\def \sc@char {#1}\utfb@next }

\def \utfb@dvi #1{% segment D6
	\a@lb `#1\relax \advance \a@lb -128 
	\a@lq \a@lb \divide \a@lq 8
	\edef \sc@char {}%
\ifcase \a@lq \or \or \or \or \or 
\or \advance \a@lb -48 \edef \sc@char 
	{\ifcase \a@lb
	\n@xp\a@e\or \n@xp\a@I\or \n@xp\a@A\or \n@xp\a@O\or 
	i\or \n@xp\a@E\or e\or a\or
	\fi }%
\or \advance \a@lb -56 \edef \sc@char 
	{\ifcase \a@lb
	A\or \n@xp\a@o\or \or u\or 
	\the\utfb@oldchar\or |\or B\or \or
	\fi }%
\fi \utfb@next }
%\utfb@oldchar \xpa{\sc@char }\sc@put \utfb@word }

\def \utfb@dvii #1{% segment D7
	\a@lb `#1\relax \advance \a@lb -128 
	\a@lq \a@lb \divide \a@lq 8
\ifcase \a@lq \edef \sc@char 
	{\ifcase \a@lb
%	|\or \or \or :\or \or \or \or \or
	|\or \n@xp\a@Ze\or \n@xp\a@Za\or :\or \n@xp\a@Zi\or \or \or \or
	\fi }%
\or \advance \a@lb  -8 \edef \sc@char {}%
\or \advance \a@lb -16 \edef \sc@char 
	{\ifcase \a@lb
	Q\or v\or g\or d\or h\or w\or z\or X\or
	\fi }%
\or \advance \a@lb -24 \edef \sc@char 
	{\ifcase \a@lb
	C\or y\or k\or k\or l\or m\or m\or n\or
	\fi }%
\or \advance \a@lb -32 \edef \sc@char 
	{\ifcase \a@lb
	n\or s\or P\or f\or f\or S\or S\or q\or
	\fi }%
\or \advance \a@lb -40 \edef \sc@char 
	{\ifcase \a@lb
	r\or \n@xp\a@S \or t\or \or \or \or \or \or
	\fi }%
\or \advance \a@lb -48 \edef \sc@char 
	{\ifcase \a@lb
	w\n@xp\a@U w\or wy\or y\n@xp\a@U y\or '\or 
	''\or \or \or \or
	\fi }%
\or \advance \a@lb -56 \edef \sc@char 
	{\ifcase \a@lb
	\or \or \or \or \or \or \or "|\or
	\fi }%
\fi \utfb@next }
%\utfb@oldchar \xpa{\sc@char }\sc@put \utfb@word }

\def \utfb@ll {\let \sc@char \a@zz }

\def \a@zz {!}

\def \utf@b@cs #1#2{% test word end
\def \sc@char {#1}\sc@put 
%\ifx #2\@ \def \next {\sc@endscan #2}\else
\ifx #2\@ \def \next {\utfb@end #2}\else
\ifcat -\nxp #2 \def \next {\utfb@word #2}\else
\def \next {\sc@back #2}\fi \fi \next }

\def \utfb@cs #1#2{% control sequence within a word; push back?
\xpa \ifx #1\closegeresh \def \next {\utf@b@cs {\nxp \lq }#2}\else 
\xpa \ifx #1\closequote \def \next {\utf@b@cs {`}#2}\else 
	\def \next {\sc@back #1#2}%
\fi\fi \next }

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

\message {scanner module for the Hebrew segment of UTF-8 installed.}

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

