1%%%%%%%%%%%%%%%%%%%%%%%%%%%%% hmac.sty %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2% hmac.sty
3% Scanner for MAC Hebrew
4% to install it, include it as a LaTeX package or style option "hmac"
5% with Plain TeX, say "\input hmac.sty"
6% to activate it, say "\setcode{hmac}"
7% 07.03.2002
8%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9% (c) Klaus Lagally
10%     Institut fuer Informatik
11%     Universitaet Stuttgart
12%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13
14\ifx \hmacatcode \undefined \else \expandafter \endinput
15\fi % load only once
16
17\chardef \hmacatcode = \catcode`\@  \catcode`\@ = 11
18
19\a@ident {hmac.sty} {3.10a MAC Hebrew encoding} {07.03.2002}
20
21%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
22
23\def \hmac@catcodes {% assignments for MAC Hebrew
24\countdef \is@m=2	\is@m = 160
25\countdef \is@n=4       \is@n = 32
26\loop \ifnum \catcode \is@m = 11 \else \catcode \is@m = 11 \fi
27\global\lccode \is@m = \is@n
28\ifnum 255 > \is@m \advance \is@m 1 \advance \is@n 1 \repeat
29\is@m=0 \is@n=0
30\catcode `\^^81 11
31\catcode `\^^a0 12 }
32
33{\hmac@catcodes
34%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35% dynamic definitions for Hebrew
36{\catcode `\^ 7 \catcode `\ =9 \catcode `\^^M=9 \catcode `\^^I=9
37%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38\gdef \sethmac@codes {% activate and change some codes
39\globaldefs=1
40%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41\def \sc@^^81 {yy"A}
42\def \sc@^^a0 {@}  \def \sc@^^a1 {!}
43\def \sc@^^a2 {\a@dq}                  \def \sc@^^a3 {\a@hsh}
44\def \sc@^^a4 {\a@dlr}                 \def \sc@^^a5 {\a@pct}
45\def \sc@^^a6 {\a@dlr}                 \def \sc@^^a7 {\a@qt}
46\def \sc@^^a8 {(}  \def \sc@^^a9 {)}   \def \sc@^^aa {*}   \def \sc@^^ab {+}
47\def \sc@^^ac {,}  \def \sc@^^ad {\h@phen}
48\def \sc@^^ae {.}  \def \sc@^^af {/}
49
50\def \sc@^^b0 {0}  \def \sc@^^b1 {1}   \def \sc@^^b2 {2}   \def \sc@^^b3 {3}
51\def \sc@^^b4 {4}  \def \sc@^^b5 {5}   \def \sc@^^b6 {6}   \def \sc@^^b7 {7}
52\def \sc@^^b8 {8}  \def \sc@^^b9 {9}   \def \sc@^^ba {:}   \def \sc@^^bb {;}
53\def \sc@^^bc {\a@rab}                 \def \sc@^^bd {=}
54\def \sc@^^be {\a@lab}                 \def \sc@^^bf {?}
55
56\def \sc@^^c0 {l"\n@xp\a@o}            \def \sc@^^c1 {,,}
57\def \sc@^^c2 {@}                      \def \sc@^^c3 {@}
58\def \sc@^^c4 {@}                      \def \sc@^^c5 {@}
59\def \sc@^^c6 {"\n@xp\a@Zu}            \def \sc@^^c7 {w"\n@xp\a@o}
60\def \sc@^^c8 {w"\n@xp\a@Zu}           \def \sc@^^c9 {\a@ell}
61\def \sc@^^ca {N}                      \def \sc@^^cb {"A}
62\def \sc@^^cc {"a}                     \def \sc@^^cd {"\n@xp\a@E}
63\def \sc@^^ce {"e}                     \def \sc@^^cf {"i}
64
65\def \sc@^^d0 {\a@end}                 \def \sc@^^d1 {\a@emd}
66\def \sc@^^d2 {\a@lq\a@lq}             \def \sc@^^d3 {\a@rq\a@rq}
67\def \sc@^^d4 {\a@lq}                  \def \sc@^^d5 {\a@rq}
68\def \sc@^^d6 {\n@xp\a@S"\n@xp\a@Ze}   \def \sc@^^d7 {\n@xp\a@S"\n@xp\a@Za}
69\def \sc@^^d8 {"\n@xp\a@Zo}            \def \sc@^^d9 {"\n@xp\a@e}
70\def \sc@^^da {"\n@xp\a@A}             \def \sc@^^db {"\n@xp\a@I}
71\def \sc@^^dc {"u}                     \def \sc@^^dd {"\n@xp\a@o}
72\def \sc@^^de {"o}                     \def \sc@^^df {"\n@xp\a@O}
73
74\def \sc@^^e0 {Q}  \def \sc@^^e1 {b}   \def \sc@^^e2 {g}   \def \sc@^^e3 {d}
75\def \sc@^^e4 {h}  \def \sc@^^e5 {w}   \def \sc@^^e6 {z}   \def \sc@^^e7 {X}
76\def \sc@^^e8 {C}  \def \sc@^^e9 {y}   \def \sc@^^ea {k}   \def \sc@^^eb {k}
77\def \sc@^^ec {l}  \def \sc@^^ed {m}   \def \sc@^^ee {m}   \def \sc@^^ef {n}
78
79\def \sc@^^f0 {n}  \def \sc@^^f1 {s}   \def \sc@^^f2 {P}   \def \sc@^^f3 {p}
80\def \sc@^^f4 {p}  \def \sc@^^f5 {S}   \def \sc@^^f6 {S}   \def \sc@^^f7 {q}
81\def \sc@^^f8 {r}  \def\sc@^^f9{\n@xp\a@S}
82\def \sc@^^fa {t}  \def \sc@^^fb {\a@rbc}
83\def \sc@^^fc {]}  \def \sc@^^fd {\a@lbc}
84\def \sc@^^fe {[}  \def \sc@^^ff {\a@bar}
85
86\a@digits = {0123456789}	\a@paren  = {()[]}	\a@first = {"`^^e6}
87\globaldefs=0 }
88%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
89}% end of dynamic definitions for MAC Hebrew
90%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
91
92\gdef \hmac@scan #1>{% standard scanner call: token sequence -> \a@tokens
93\iftest@scan \tracingmacros = 1
94\ifshow \else \lowercase{\a@verb #1>}\fi\fi
95\global\def \a@rest {}\global\a@tokens = {}\sc@beg #1\@ \@@
96\iftest@scan \tracingmacros = 0 %
97\xpa \a@verb \xpa (\the\a@tokens )>\fi }
98
99%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
100
101\gdef \hmac@beg {% start MAC Hebrew scanner
102\h@mzafalse \iz@fetfalse \@ssimfalse \novocalize % because of explicit quoting
103\hmac@word }
104
105{\catcode `\^^M=13 \endlinechar = -1
106\gdef \hmac@word #1{% transform input into internal notation
107\ifx #1\@ \def \next {\sc@endscan }\else % finished
108\if \nxp ^^M\nxp #1\def \next {\hmac@par #1}% active character
109\else \def \next {\hmac@w@rd #1}%
110\fi\fi \next }%
111} % catcode 13
112
113\gdef \hmac@w@rd #1#2{% special cases
114\case #1\of
115{             #2{\hmac@word #1-#2}
116           -{\hmac@minus #2}
117        ^^a0{\sc@back #2}
118%        ^^ad{\hmac@minus #2}
119\default {\hmac@@word #1#2}
120}\endcase }
121
122\gdef \hmac@@word #1{% default branch
123\ifcat a\nxp #1\edef \sc@char {\csname sc@#1\endcsname }%
124\else \def \sc@char {\nxp #1}%
125\fi \sc@put \hmac@word }
126
127%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
128
129\gdef \hmac@minus {% hyphen between words
130\def \sc@char {-}\sc@put \hmac@beg }
131
132\gdef \hmac@par #1\@ \@@ {% new line, push back the rest
133\sc@back \\ #1\@ \@@ }
134
135\gdef \hmac@endscan \@@ {\global\let \a@scan \hmac@scan }
136%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
137} % \hmac@catcodes
138
139\def \set@hmac {% select the MAC Hebrew scanner
140\let \sc@beg \hmac@beg                 \let \sc@word \hmac@word
141\let \sc@back \sc@@back                \let \sc@endscan \hmac@endscan
142\global\let \a@scan \hmac@scan   \sethmac@codes
143\hmac@catcodes
144\a@message {input encoding set to MAC Hebrew and ISO 8859-8 conventions}}
145
146\xpa \def \xpa \sc@table \xpa {\sc@table % add the MAC Hebrew encoding
147hmac\set@hmac	iso8859-8\set@hmac	iso88598\set@hmac }
148
149%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
150
151\a@message {scanner for MAC Hebrew code installed.}
152
153\catcode `\@ = \hmacatcode
154\endinput
155%%%%%%%%%%%%%%%%%%%%%%%% EOF %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
156
157