1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2% aparse.sty
3% ArabTeX
4% Parser 26.05.2003
5%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6% (c) Klaus Lagally
7%     Institut fuer Formale Methoden der Informatik
8%     Universitaet Stuttgart
9%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10
11\a@ident {aparse.sty} {3.11 get syllables } {26.05.2003}
12
13%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14% dynamic definitions for Arabic
15{\catcode `\^ 7 \catcode `\ =9 \catcode `\^^M=9 \catcode `\^^I=9
16%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17\gdef \def@arabvoc {% define vowel parsing routines for Arabic
18%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
19
20%%%%%%%%%%%%%%%%%%%%%%%%%% short vowels %%%%%%%%%%%%%%%%%%%%%%%%%%
21
22\def \sv@a {\sv@@a }% short a
23\def \sv@e {\sv@@e }% short e
24\def \sv@i {\sv@@i }% short i
25\def \sv@o {\sv@@o }% short o
26\def \sv@u {\sv@@u }% short u
27
28%%%%%%%%%%%%%%%%%%%%%%%%%% long vowels, plene %%%%%%%%%%%%%%%%%%%%%%%%%%
29
30\def \sv@A {\sv@@A }% long a
31\def \sv@E {\sv@@E }% long e
32\def \sv@I {\sv@@I }% long i
33\def \sv@O {\sv@@O }% long o
34\def \sv@U {\sv@@U }% long u
35\def \sv@Y {\sv@Ytest }% alif maqsura or tooth
36
37%%%%%%%%%%%%%%%%%%%%%%%%%% long vowels, defective %%%%%%%%%%%%%%%%%%%%%%%%%%
38
39\sv@def \a@a {\sv@a@a }% defective long a = Qur'an alif
40\sv@def \a@e {\sv@a@e }% explicit sukun
41\sv@def \a@i {\sv@a@i }% defective long i
42\sv@def \a@o {\sv@U   }% special short u
43\sv@def \a@u {\sv@a@u }% defective long u
44
45%%%%%%%%%%%%%%%%%%%%%%%%%% special vowels %%%%%%%%%%%%%%%%%%%%%%%%%%
46
47%\sv@def \a@A {\sv@a }% Turkish "a
48\sv@def \a@A {\sv@a@A }% Turkish "a
49\sv@def \a@E {\sv@a@E }% Kurdish ^e
50\sv@def \a@I {\sv@i }% Turkish "i
51\sv@def \a@O {\sv@a@O }% Kurdish and Turkish "o
52%\sv@def \a@U {\sv@u }% Turkish "u
53\sv@def \a@U {\sv@a@U }% Turkish "u
54
55%%%%%%%%%%%%%%%%%%%%%%%%%% extra vowels %%%%%%%%%%%%%%%%%%%%%%%%%%
56
57\sv@def \a@Za {\sv@Za }% Kashmiri .a
58\sv@def \a@Ze {\sv@Ze }% explicit shadda
59\sv@def \a@Zi {\sv@Zi }% Sindhi -IN
60\sv@def \a@Zo {\sv@Zo }% Kashmiri .o
61\sv@def \a@Zu {\sv@Zu }% Kashmiri .u
62
63\sv@def \a@ZA {\sv@ZA }% Kashmiri .A
64\sv@def \a@ZE {\sv@ZE }% explicit madda
65\sv@def \a@ZI {\sv@ZI }% Kashmiri .y
66\sv@def \a@ZO {\sv@ZO }% Kashmiri .O
67\sv@def \a@ZU {\sv@ZU }% Kashmiri .U
68
69%%%%%%%%%%%%%%%%%%%%%%%%%% hamza handling %%%%%%%%%%%%%%%%%%%%%%%%%%
70
71\def \syl@hamzabeg {\syl@@hamzabeg }% initial hamza
72
73\def \syl@hamza {\syl@@hamza }% non-initial hamza, context #1'
74
75\def \syl@test@voc {\syl@@test@voc }% vowel or sukun ?
76
77%%%%%%%%%%%%%%%%%%%%%%%%%% miscellaneous %%%%%%%%%%%%%%%%%%%%%%%%%%
78
79\def \check@high {\check@@high }% long form for tooth ?
80}
81%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
82}% end of dynamic definitions for Arabic
83%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
84
85%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
86% static definitions for Arabic
87%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
88
89\def \sv@def #1{% define \sv@#1
90\xpa \def \csname sv@\string #1\endcsname }
91
92\newtoks \a@revwd
93\newtoks \sv@revwd       \newtoks \last@con
94\newcount \last@mod     \newcount \last@voc
95\newif \ifsyl@wdend	\newif \ifm@dda
96
97\def \a@parse #1>{% parse token sequence into syllables
98\iftest@parse \tracingmacros = 1
99\iftest@scan \else \a@verb (#1)>\fi\fi
100\last@con ={.}\last@mod = 0 \last@voc = 0 \global\@highfalse
101\global \sv@revwd ={}\global \a@revwd ={}\syl@beg #1<<<>%
102\iftest@parse \tracingmacros = 0 %
103\xpa \a@verb \xpa (\the\a@revwd )>\fi }
104
105\def \test@wdend #1#2#3{% test for end of word: k #1 #2 #3
106\case #1\of
107{      N<{\syl@wdendtrue }
108       |"{\test@wdend #2#3<}
109\default {\if\is@shortvowel #1\test@wdend #2#3<\else
110	\ifcat -\nxp #1\syl@wdendtrue \else \syl@wdendfalse
111	\fi\fi	}
112}\endcase }
113
114\def \isat@wdend #1#2#3{00% at end of word?
115\test@wdend #1#2#3\ifsyl@wdend \else \xpa \setiffalse \fi }
116
117\def \is@vowel #1{% test for all vowels
118\is@in@list #1aeiouAEIOUY%
119\a@a \a@e \a@i \a@o \a@u
120\a@A \a@E \a@I \a@O \a@U
121\a@Za \a@Ze \a@Zi \a@Zo \a@Zu
122\a@ZA \a@ZE \a@ZI \a@ZO \a@ZU >}
123
124\def \is@shortvowel #1{% test for short vowels
125\is@in@list #1aeiou\a@a >}
126
127\def \syl@end #1>{% kill the rest
128\relax }
129
130%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% start of word %%%%%%%%%%%%%%%%%%%%%%%%%%
131
132\def \syl@beg #1{% start new word
133\global\@highfalse
134\case #1\of
135{	<{\syl@end }
136	Q{\syl@hamzabeg }
137	^{\syl@hamzabeg A}
138	B{\syl@tatwilbeg }
139	"{\syl@quote@beg }
140	|{\syl@bar }
141	Y{\syl@con Y}
142    \cap {\syl@beg }
143\default {\syl@@beg #1}
144}\endcase }
145
146\def \syl@@beg #1{% start new word
147\ifcat -\nxp #1\def \next {\syl@spec #1}\else
148\if\is@vowel #1\def \next {\syl@wasla #1}% check for wasla
149  \else \def \next {\syl@con #1}% start syllable
150\fi\fi \next }
151
152\def \syl@bar #1{% check for || as "|
153\case #1\of
154{	|{\syl@quote@beg #1}
155	B{\syl@con |B}
156\default {\put@con W\v@cfalse \@sukfalse\syl@voctest #1}
157}\endcase }
158
159\def \syl@wasla #1{% start word with vowel without hamza
160\put@con a\def \next {\syl@voc #1}% prepare for vowel
161\ifx \a@lang \a@hebr % Hebrew mode
162	\ifx #1U\put@con W\else % Hebrew: no carrier, shureq follows
163	\ifx #1A\add@fathaspec % Hebrew: qames
164\fi\fi\fi
165\ifx #1E\put@con E\put@syl \def \next {\syl@con }\else
166\ifx #1\a@ZA \add@kh@hamzl \put@syl \def \next {\syl@con }\else
167\ifx #1A\ifiz@fet \add@madda \put@syl \def \next {\syl@con }\else
168		\def \next {\syl@voctest }%
169        \fi \else
170\ifiz@fet \else	% wasla only in Arabic ?
171\ifh@mza \if\is@shortvowel #1%
172        \if@wasla \add@wasla \put@syl \def \next {\syl@con }% next syllable
173        \fi\fi
174\fi\fi\fi\fi\fi \next }
175
176\def \syl@wasla #1{% start word with vowel without hamza
177\def \next {\syl@voc #1}% prepare for vowel
178\ifu@gh \put@con Y\add@hamza\else \put@con a%
179\ifx \a@lang \a@hebr % Hebrew mode
180	\ifx #1U\put@con W\else % Hebrew: no carrier, shureq follows
181	\ifx #1A\add@fathaspec % Hebrew: qames
182\fi\fi\fi
183\ifx #1E\put@con E\put@syl \def \next {\syl@con }\else
184\ifx #1\a@ZA \add@kh@hamzl \put@syl \def \next {\syl@con }\else
185\ifx #1A\ifiz@fet \add@madda \put@syl \def \next {\syl@con }\else
186		\def \next {\syl@voctest }%
187        \fi \else
188\ifiz@fet \else	% wasla only in Arabic ?
189\ifh@mza \if\is@shortvowel #1%
190        \if@wasla \add@wasla \put@syl \def \next {\syl@con }% next syllable
191        \fi\fi
192\fi\fi\fi\fi\fi\fi \next }
193
194\def \syl@tatwilbeg #1{% start word with tatwIl: -- #1
195	\put@con B%
196\if\is@vowel #1\def \next {\syl@voc #1}% harakat on tatwil
197\else \put@syl \def \next {\syl@con #1}% join
198\fi \next }
199
200\def \syl@spec #1#2{% deposit special character
201\ifx #1<\let \next \syl@end
202\else \put@spec #1% deposit character
203	\ifx #1-\def \next {\syl@con #2}\else	% create joining form
204	\ifx #2<\let \next \syl@end \else 	% isolated character
205		\def \next {\syl@beg #2}% 	% start new word
206	\fi\fi
207\fi \next }
208
209\def \sv@syl #1#2#3{% explicit syllable
210\put@con #1\last@mod 0#2\last@voc 0#3\@highfalse \put@syl \syl@con }
211
212%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% start of syllable %%%%%%%%%%%%%%%%%%%%%%%%%%
213
214\def \syl@con #1{% start a new syllable
215\case #1\of
216{	<{\syl@end }% not done
217	Q{\syl@hamza } % no Hamza
218	B{\put@con B\put@syl \syl@con }
219	W{\put@con w\syl@Wspec }% no ending wA or w-
220	"{\syl@quote@con }
221	|{\syl@bar@con }
222    \cap {\syl@con }
223 \sv@syl {\sv@syl }
224\default {\syl@@con #1}
225}\endcase }
226
227\def \syl@@con #1#2{% start a new syllable
228	\def \next {\syl@voctest #2}%
229\ifx #2\cap \def \next {\syl@@con #1}\else
230\ifx #1-\ifx #2<\def \next {\syl@spec #1#2}% joining form
231	\else \def \next {\syl@beg #2}% ignore hyphen, tie
232	\fi \else
233\ifcat -\nxp #1\def \next {\syl@spec #1#2}\else % special character
234\ifx #2-\def \next {\syl@assim #1}% assimilate?
235\else \put@con #1% deposit consonant
236        \ifx #1#2\if@ssim \add@shadda
237		\def \next {\syl@shadd@voctest #2}%
238        \fi\fi
239	\ifiz@fet\ifx #1X\ifx #2w\put@syl
240        	\def \next {\syl@con #2}% waw-e-ma`dul
241	\fi\fi\fi
242\fi\fi\fi\fi \next }
243
244\def \syl@bar@con #1{% |
245\case #1\of
246{	|{\syl@quote@con #1}
247	B{\syl@tatwil }
248\default {\put@con |\@sukfalse \syl@voctest #1}
249}\endcase }
250
251\def \syl@tatwil #1{% test for 2 tatwils
252\put@con B%
253\ifx #1B\add@shadda \def \next {\syl@voctest }%
254\else \def \next {\syl@voctest #1}%
255\fi \next }
256
257\def\syl@shadd@voctest #1#2{% hyphen after shadda ? context #1#1 #2
258\ifx #2-\def \next {\syl@hyphen #1}\else
259	\def \next {\syl@voctest #2}%
260\fi \next }
261
262%%%%%%%%%%%%%%%%%%%%%%%%%% hyphen %%%%%%%%%%%%%%%%%%%%%%%%%%
263
264\def \syl@hyphen #1#2#3{% hyphen after consonant,           	 #1 - #2 #3
265\ifx #2<\add@sukun \put@syl \def \next {\syl@con -#2#3}\else 	% k - ||
266\ifx #3<\def \next {\syl@contie #1#2#3}\else			% k - x ||
267\ifx #3N\def \next {\syl@contie #1#2#3}\else			% k - x N
268\ifcat -\nxp #3\def \next {\syl@contie #1#2#3}\else		% k - x -
269\ifx #1l\def \next {\syl@art #2#3}\else 			% l - #2 #3
270\ifx #1\a@H \put@syl \put@spec W\def \next {\syl@beg #2#3}\else	% H - x
271\ifiz@fet \def \next {\syl@voctest #2#3}% 			Persian suffix
272\else	\add@sukun \put@syl \def \next {\syl@beg #2#3}%    	start new word
273\fi\fi\fi\fi\fi\fi\fi \next }
274
275\def \syl@art #1#2#3{% article, (a)l-#1#2#3
276	\def \next {\syl@beg #1#2#3}% ought to test for sun letter !
277\ifx #1#2% no sukun before double (sun) letter
278	\ifx #1Q\add@sukun \else
279	\ifx #2#3\def \next {\syl@beg #2#3}% special case l-ll
280	\fi \fi
281\else \add@sukun % moon letter
282\fi \put@syl \next }
283
284\def \syl@assim #1#2{% test for assimilation #1 - #2
285\ifx #2\cap \def \next {\syl@assim #1}\else
286	\put@con #1\def \next {\syl@hyphen #1#2}% #1 - #2
287\if@ssim\ifx #1#2% ought to test for sun letter !
288	\put@con l\def\next {\syl@art #1#2}% substitute l - #1 #2
289        \fi
290\fi\fi \next }
291
292\def \syl@contie #1#2#3{% connecting vowel, #1 - #2#3
293	\def \next {\syl@voctest #2#3}%
294\ifiz@fet \sv@test@izafet #1#2#3%
295\fi \next }
296
297\def \syl@voctie #1#2#3{% hyphen after vowel, #1 - #2 #3
298	\def \next {\put@syl \syl@con -#2#3}%	close syllable
299\ifiz@fet\ifx #3<\sv@test@izafet #1#2#3\else
300	\ifcat -\nxp #3\sv@test@izafet #1#2#3\else
301	\ifx #1a\put@con \a@H % supply final silent H
302		\def \next {\syl@hyphen \a@H #2#3}\else
303	\ifx #1e\put@con \a@H % supply final silent H
304		\def \next {\syl@hyphen \a@H #2#3}%
305	\fi\fi\fi\fi
306\fi \next }
307
308%%%%%%%%%%%%%%%%%%%%%%%%%% special cases for Persian %%%%%%%%%%%%%%%%%%%%%%%%%%
309
310\def \syl@hahtie #1#2#3{% connecting vowel, H - #2#3
311   \def \next {\syl@hah #2#3}%
312\case #2\of
313{      IE{}
314\default {\sv@test@izafet #1#2#3}
315}\endcase \next }
316
317\def \syl@hah{% H at the end, ha-ye hawwaz-e ma.hfi
318\put@syl \put@spec W\syl@beg }
319
320\def \sv@izafet #1#2{% #1 - i/e/_i
321\case #1\of
322{  I\a@H{\add@hamza }
323      AU{\put@syl \put@con y}
324}\endcase
325\ifx #2\a@i \add@kasraspec \else \add@kasra % long izafet ?
326\fi \put@syl \syl@con }
327
328\def \sv@wahdat #1#2{% #1 - I/E
329\case #1\of
330{  I\a@H{\put@syl \put@spec W\put@con a}
331      AU{\put@syl \put@con Y\add@hamza }
332}\endcase
333\ifx #2I\add@kasra \fi
334\put@syl \put@con y\put@syl \syl@con }
335
336\def \sv@test@izafet #1#2#3{% special cases for -e, -i, -_e, -_i, -I, -E
337\case #2\of
338{	e{\def \next {\sv@izafet #1e#3}}
339i\a@i\a@E{\def \next {\sv@izafet #1i#3}}
340	y{\def \next {\sv@izafet #1e}}
341	I{\def \next {\sv@wahdat #1I#3}}
342	E{\def \next {\sv@wahdat #1E#3}}
343}\endcase }
344
345\def \syl@endvoc #1{% test for H
346	\def \next {\syl@con #1}%
347\ifiz@fet \ifx #1\a@H \put@con \a@H
348	\def \next {\syl@@endvoc }%
349\fi\fi \next }
350
351\def \syl@@endvoc #1#2{% char after H
352\case #1\of
353{	-{\syl@hahtie \a@H #2}
354	Q{\add@hamza \syl@voc }
355	<{\put@syl \syl@end #2}
356	"{\put@syl \syl@quote@beg #2}
357	|{\put@syl \syl@bar #2}
358\default {\put@syl
359	  \ifcat -\nxp #1\def \next {\syl@spec #1#2}\else
360		\def \next {\syl@beg #1#2}% start a new word
361	  \fi \next }
362}\endcase }
363
364%%%%%%%%%%%%%%%%%%%%%%%%%% quoting %%%%%%%%%%%%%%%%%%%%%%%%%%
365
366\def \syl@quote@beg #1#2{% start word with quote: " #1 #2
367\case #1\of
368{	'{\put@con Q\syl@voctest #2}
369	Q{\put@con Q\syl@voctest }
370	|{\put@spec W\syl@beg #2}% start new word
371\default {\syl@@quote@beg #1#2}
372}\endcase }
373
374\def \syl@@quote@beg #1{% start word with quote: " #1 #2
375\if\is@vowel #1\def \next {\syl@wasla #1}% 	" v k: alif vowel
376%	\if@wasla \v@ctrue \else \add@wasla \togglev@c \fi
377	\if@wasla \v@ctrue \@waslafalse \else \@waslatrue \togglev@c \fi
378\else \put@con a\togglev@c \add@wasla \put@syl  % alif implied
379	\ifx #1"\def \next {\syl@con }% 	" " k: alif wasla
380     	\else \def \next {\syl@con #1}% 	" k:   alif wasla
381	\fi
382\fi \next }
383
384\def \syl@quote@con #1#2{% start syllable with quote: " #1 #2
385\case #1\of
386{	'{\put@con Q\syl@voctest #2}
387	Q{\put@con Q\syl@voctest }
388	|{\put@con W\syl@voctest #2}
389\default {\togglev@c \syl@con #2}
390}\endcase }
391
392% original version of logic:
393\def \syl@quote@voc #1#2{% continue syllable with quote: " #1 #2
394\case #1\of
395{	B{\togglev@c \add@sukun \put@syl \syl@con #1#2}
396	"{\togglev@c \add@sukun \put@syl \syl@beg #2}
397	|{\syl@@quote@voc #2}
398	'{\add@hamza \syl@voctest #2}
399	Q{\add@hamza \syl@voctest }
400\default {\togglev@c \syl@voctest #1#2}% vowel: sukun
401}\endcase }
402
403% patches for Arnoud Vrolijk:
404% make "' sukun hamza instead of hamza modifier
405\def \syl@quote@voc #1{% continue syllable with quote: " #1 #2
406\case #1\of
407{	B{\togglev@c \add@sukun \put@syl \syl@con #1}
408	"{\togglev@c \add@sukun \put@syl \syl@beg }
409	|{\syl@@quote@voc }
410\default {\togglev@c \syl@voctest #1}% vowel: sukun
411}\endcase }
412
413\def \syl@@quote@voc #1{% continue syllable with quote: "| #1 #2
414	\put@syl \put@spec W%
415\if\is@vowel #1\def \next {\syl@wasla #1}% vowel: wasla
416\else \def \next {\syl@con #1}% consonant
417\fi \next }
418
419\def \togglev@c {% toggle diacritic
420\ifv@c  \v@cfalse  \else \v@ctrue  \fi % toggle vowel indicator
421\if@suk \@sukfalse \else \@suktrue \fi % toggle sukun, wasla
422}
423
424\def \voc@suk {% normalize vowels and sukun
425\let \ifv@c \if@vocals \let \if@suk \if@sukun }
426
427%%%%%%%%%%%%%%%%%%%%%%%%%% vowel or end of syllable %%%%%%%%%%%%%%%%%%%%%%%%%%
428
429\def \syl@@test@voc #1{% vowel or sukun ? 	variant in Hebrew!
430\if\is@vowel #1\def \next {\syl@voc #1}% test for vowel
431\else \def \next {\syl@con #1}%
432	\ifurd@ \ifx #1h\else \add@sukun \fi
433	\else \add@sukun
434	\fi \put@syl
435\fi \next }
436
437\def \syl@voctest #1{% continue open syllable: K #1
438\case #1\of
439{	"{\syl@quote@voc }
440	^{\m@ddatrue \syl@voctest }
441	|{\syl@bar@voc }
442	B{\syl@tatwil@voc }
443    \cap {\syl@voctest }
444\default {\syl@test@voc #1}
445}\endcase }
446
447\def \syl@bar@voc #1{% K | #1
448\ifx #1|\def \next {\syl@quote@voc |}\else
449\ifx #1"\def \next {\syl@test@quote }\else
450\if\is@vowel #1\def \next {\syl@test@voc #1|}\else
451	\def \next {\syl@test@voc |#1}% no bar
452\fi\fi\fi \next }
453
454\def \syl@tatwil@voc #1{% K B #1
455\if\is@vowel #1\def \next {\syl@test@voc #1B}\else
456	\def \next {\syl@test@voc B#1}% no vowel
457\fi \next }
458
459\def \syl@test@quote #1{% K |" #1
460\if\is@vowel #1\def \next {\syl@quote@voc #1|}\else
461	\put@syl \put@con |\def \next {\syl@quote@voc "#1}%
462\fi \next }
463
464\iffalse % deleted for efficiency; for documentation only !
465% and also for compatibility with the Hebrew mode !!
466\def \syl@voc #1{% test for vowel
467\case #1\of
468{	<{\syl@end }% this cannot happen! or can it?
469	-{\syl@voc }% ignore hyphen here
470   a \a@A{\sv@@a }% short a, Turkish "a
471   e	 {\sv@@e }% short e
472   i \a@I{\sv@@i }% short i, Turkish "i
473   o	 {\sv@@o }% short o
474   u \a@U{\sv@@u }% short u, Turkish "u
475   A	 {\sv@@A }% long a
476   E	 {\sv@@E }% long e
477   I	 {\sv@@I }% long i
478   O	 {\sv@@O }% long o
479   U \a@o{\sv@@U }% long u, special short u
480   Y	 {\sv@Ytest }% alif maqsura or tooth
481    \a@a {\sv@a@a }% Qur'an alif
482    \a@e {\sv@a@e }% frei
483    \a@i {\sv@a@i }% defective long i
484    \a@u {\sv@a@u }% defective long u
485    \a@E {\sv@a@E }% kurdish ^e
486    \a@O {\sv@a@O }% Kurdish and Turkish "o
487   \a@Za {\sv@Za }% Kashmiri .A
488   \a@Ze {\sv@Ze }% Kashmiri .a
489   \a@Zi {\sv@Zi }% Sindhi -IN
490   \a@Zo {\sv@Zo }% Kashmiri u'
491   \a@Zu {\sv@Zu }% Kashmiri U'
492\default {\csname sv@\string #1\endcsname}% switch on vowel
493}\endcase }
494\fi
495
496\def \syl@voc #1{% test for vowel, also for Hebrew mode
497\case #1\of
498{	<{\syl@end }% this cannot happen! or can it?
499	-{\syl@voc }% ignore hyphen here
500\default {\csname sv@\string #1\endcsname}% switch on vowel
501}\endcase }
502
503%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
504% auxiliary vowel routines
505%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
506
507\def \test@B #1#2{% tatweel or ligature break
508\case #1\of
509{      |B{\put@con #1\put@syl #2}
510\default {#2#1}% deposit vowel carrier
511}\endcase }
512
513%%%%%%%%%%%%%%%%%%%%%%%%%% short vowels %%%%%%%%%%%%%%%%%%%%%%%%%%
514
515\def \sv@@a #1{% short a
516\ifk@rd \put@syl \def \next {\test@B #1\sv@a@Hvwl }\else
517\def \next {\sv@aInt #1}\fi \next }
518
519\def \sv@@a #1{% short a
520\ifu@gh \put@syl \put@con a\put@syl \def \next {\syl@con #1}\else
521\ifk@rd \put@syl \def \next {\test@B #1\sv@a@Hvwl }\else
522	\def \next {\sv@aInt #1}%
523\fi\fi \next }
524
525\def \sv@a@Hvwl {% kurdish aH carrier
526\put@con \a@H \put@syl \syl@endvoc }
527
528\def \sv@aInt #1{% short a
529\ifx #1N\def \next {\syl@Nspec }% tanwin alif
530\else \add@fatha \put@syl \def \next {\sv@@aInt #1}%
531\fi \next }
532
533\def \sv@@aInt #1{% short a
534\case #1\of
535{	e{\ifurd@ \put@con E\else \put@con Y\add@hamza
536	  \fi \put@syl \syl@con }\else
537       ou{\put@con w\put@syl \syl@con }\else
538	i{\put@con y\put@syl \syl@con }\else
539\default {\syl@endvoc #1}% test for H
540}\endcase }
541
542%%%%%%%%%%%%%%%%%%%%%%%%%%
543
544\def \sv@@e {% short e
545\ifk@rd \xpa \sv@a \else
546\ift@rk \xxpa \sv@a \else \xxpa \sv@eInt \fi\fi }
547
548\def \sv@@e {% short e
549\ifk@rd \def \next {\sv@a }\else
550\ift@rk \def \next {\sv@a }\else
551\ifu@gh \put@syl \put@con \a@Y \put@syl \def \next {\syl@con }\else
552\def \next {\sv@eInt }\fi\fi\fi \next }
553
554\def \sv@eInt #1{% zwarakay in Pashto, otherwise short a
555\ifk@sh \put@syl \put@con \a@E \put@syl \def \next {\syl@con #1}%
556\else \def \next {\syl@endvoc #1}% test for H
557	\ifp@sht \add@zwarakay \put@syl
558		\ifx #1e\def \next {\syl@con }\put@con Y\add@hamza \put@syl
559		\fi
560	\else \add@kasra \put@syl
561		\ifiz@fet % provisions for the preposition be-
562		\if\is@vowel #1\def \next {\syl@beg #1}%
563		\fi\fi
564	\fi
565\fi \next }
566
567%%%%%%%%%%%%%%%%%%%%%%%%%%
568
569\def \sv@@i #1{% short i
570\case #1\of
571{	y{\sv@@I }% iy -> I
572	N{\add@kasratan \put@syl \syl@ignore }% tanwin yah
573	-{\add@kasra \syl@voctie i}
574\default {\add@kasra \put@syl \syl@con #1}% next syllable
575}\endcase }
576
577\def \sv@@i {% short i
578\ifu@gh \put@syl \put@con Y\put@syl \xpa \syl@con
579\else \xpa \sv@@iInt \fi }
580
581\def \sv@@iInt #1{% short i
582\case #1\of
583{	y{\sv@@I }% iy -> I
584	N{\add@kasratan \put@syl \syl@ignore }% tanwin yah
585	-{\add@kasra \syl@voctie i}
586\default {\add@kasra \put@syl \syl@con #1}% next syllable
587}\endcase }
588
589%%%%%%%%%%%%%%%%%%%%%%%%%%
590
591\def \sv@@o #1{% ammad in Pashto, otherwise short u
592\ifk@sh \put@syl \put@con \a@W \put@syl
593		\def \next {\syl@con #1}\else
594\ifk@rd \put@syl \def \next {\test@B #1\sv@a@Wvwl }\else
595	\def \next {\sv@oInt #1}%
596\fi\fi \next }
597
598\def \sv@@o #1{% ammad in Pashto, otherwise short u
599\ifk@sh \put@syl \put@con \a@W \put@syl
600		\def \next {\syl@con #1}\else
601\ifu@gh \put@syl \put@con w\put@syl
602		\def \next {\syl@con #1}\else
603\ifk@rd \put@syl \def \next {\test@B #1\sv@a@Wvwl }\else
604	\def \next {\sv@oInt #1}%
605\fi\fi\fi \next }
606
607\def \sv@a@Wvwl {% kurdish O carrier
608\put@con \a@W \put@syl \syl@con }
609
610\def \sv@oInt #1{% ammad in Pashto, otherwise short u
611\ifp@sht \add@ammad \else \add@damma
612\fi \put@syl
613\ifx #1i\put@con y\put@syl \def \next {\syl@con }\else
614	\def \next {\syl@endvoc #1}% test for H
615\fi \next }
616
617%%%%%%%%%%%%%%%%%%%%%%%%%%
618
619\def \sv@@u {% short u
620\ifk@rd \put@syl \xpa \sv@ukurd \else \xpa \sv@uInt \fi }
621
622\def \sv@@u {% short u
623\ifk@rd \put@syl \def \next {\sv@ukurd }\else
624\ifu@gh \put@syl \put@con \a@w \put@syl \def \next {\syl@con }\else
625\def \next {\sv@uInt }\fi\fi \next }
626
627\def \sv@ukurd #1{% short u, for Kurdish
628\ifx #1Q\def \next {\syl@hamza }\else
629\def \next {\test@B #1\sv@wvwl }\fi \next }
630
631\def \sv@wvwl {% w carrier
632\put@con w\put@syl \syl@con }
633
634\def \sv@uInt #1{% short u, otherwise
635\case #1\of
636{	w{\sv@UInt }% uw -> U
637	N{\add@dammatan \put@syl \syl@ignore }% tanwin waw
638\default {\add@damma \put@syl \syl@con #1}% next syllable
639}\endcase }
640
641%%%%%%%%%%%%%%%%%%%%%%%%%% long vowels %%%%%%%%%%%%%%%%%%%%%%%%%%
642
643\def \sv@@A #1{% long A
644\ifk@rd \else \add@fatha \fi
645\put@syl \test@B #1\sv@Avwl }
646
647\def \sv@Avwl #1{% long A vowel
648	\put@con a% may also serve as consonant, carry vowels
649	\ifm@dda \add@madda \m@ddafalse \fi
650\ifx #1-\def \next {\syl@voctie A}\else
651	\def \next {\syl@voctest #1}\@sukfalse % next syllable
652\fi \next }
653
654\def \sv@Aa #1{% long a + a ? whence ??
655\case #1\of
656{      |B{\put@con #1\put@syl \put@con a%
657	  \ifm@dda \add@madda \m@ddafalse
658	  \fi \put@syl \syl@con }
659	-{\ifm@dda \add@madda \m@ddafalse
660	  \fi \syl@voctie A}
661	a{\ifm@dda \add@madda \m@ddafalse
662	  \fi \sv@AaN }
663	"{\ifm@dda \add@madda \m@ddafalse
664	  \fi \v@ctrue \@suktrue \sv@Aa }
665\default {\ifm@dda \add@madda \m@ddafalse
666	  \fi \put@syl \syl@con #1}% next syllable
667}\endcase }
668
669\def \sv@AaN #1{% long a + aN ?
670	\def \next {\syl@con a#1}% next syllable
671\ifx #1N\def \next {\syl@aN}\else \put@syl
672\fi \next }
673
674%%%%%%%%%%%%%%%%%%%%%%%%%%
675
676\def \sv@@E {% long e
677\ift@rk \xpa \sv@I \else \xpa \sv@EInt \fi }
678
679\def \sv@EInt #1{% long E
680\ifk@sh \put@syl \put@con E\put@syl \def \next {\syl@con #1}%
681\else	\def \next {\test@B #1\sv@Evwl }%
682	\ifp@sht \add@zwarakay \else
683	\ifiz@fet \else \add@kasra
684	\fi\fi 	\put@syl
685\fi \next }
686
687\def \sv@Evwl #1{% long E vowel
688\ifx #1e\put@con L\def \next {\syl@con }\else 	% ey
689	\def \next {\syl@con #1}% next syllable
690\ifp@sht \put@con \a@Y \else
691\ifurd@ \put@con E\else
692	\put@con y%
693\fi\fi\fi \put@syl \next }
694
695%%%%%%%%%%%%%%%%%%%%%%%%%%
696
697\def \sv@@I #1{% long i
698\ifk@sh \put@syl \put@con y\add@kasraspec \put@syl
699		\def \next {\syl@con #1}\else
700	\add@kasra \put@syl \def \next {\test@B #1\sv@Ivwl }%
701\fi \next }
702
703\def \sv@Ivwl #1{% long i carrier
704	\put@con y\ifm@dda \add@madda \m@ddafalse \fi	% -I becomes -iy,
705\case #1\of
706{	y{\@sukfalse \add@shadda \syl@voctest}		% -Iy becomes -iyy
707	-{\syl@voctie I}
708\default {\@sukfalse \syl@voctest #1}% next syllable
709}\endcase }
710
711%%%%%%%%%%%%%%%%%%%%%%%%%%
712
713\def \sv@@O #1{% long o
714\ifp@sht \add@ammad \else
715\ifiz@fet \else \add@damma
716\fi\fi \put@syl \test@B #1\sv@Ovwl }
717
718\def \sv@Ovwl {% long o carrier
719\put@con w\put@syl \syl@con }
720
721%%%%%%%%%%%%%%%%%%%%%%%%%%
722
723\def \sv@@U #1{% long u
724\ifk@sh \put@syl \put@con w\add@ammad \put@syl
725		\def \next {\syl@con #1}\else
726\ifk@rd \put@syl \def \next {\test@B #1\sv@wwvwl }\else
727	\def \next {\sv@UInt #1}%
728\fi\fi \next }
729
730\def \sv@wwvwl {% kurdish double w carrier
731\put@con w\put@syl \put@con w\put@syl \syl@con }
732
733\def \sv@UInt #1{% long u
734\add@damma \put@syl \test@B #1\sv@Uvwl }
735
736\def \sv@Uvwl #1{% long u carrier
737	\put@con w\ifm@dda \add@madda \m@ddafalse \fi	% -U becomes -uw
738\case #1\of
739{	w{\@sukfalse\add@shadda \syl@voctest}		% -Uw becomes -uww
740	-{\syl@voctie U} 				% not -U-
741	A{\put@syl \put@con a\put@syl \syl@con }	% not -UA
742\default {\sv@@Uvwl #1}
743}\endcase }
744
745\def \sv@@Uvwl #1{% long u carrier
746\ifiz@fet\ifx #1Q\def \next {\sv@UQ}\else		% not -U'
747		\def \next {\syl@voctest #1}\@sukfalse 	% next syllable
748	 \fi
749\else 	 \def \next {\syl@voctest #1}\@sukfalse 	% next syllable
750\fi \next }
751
752\def \sv@UQ #1#2#3#4{% UQU#2#3#4, U' in Farsi
753\if\isat@wdend #2#3#4\add@hamza % final hamza on waw ?
754	\ifx #2-\def \next {\syl@hyphen Q#3#4}% ezafe ?
755	\else \def \next {\syl@voctest #2#3#4}% vowel ?
756	\fi
757\else \put@syl \def \next {\syl@hamza U#2#3#4}% next syllable
758\fi \next }
759
760%%%%%%%%%%%%%%%%%%%%%%%%%%
761
762\def \sv@Ytest #1{% is alif maqsura vowel or consonant?
763\case #1\of
764{	"{\put@syl \syl@con Y#1}
765      < B{\sv@YInt #1}
766\default {\ifcat -\nxp #1\def \next {\sv@YInt #1}%
767	  \else \put@syl \def \next {\syl@con Y#1}%
768	  \fi \next }
769}\endcase }
770
771\def \sv@YInt #1{% alif maqsura is vowel
772\add@fatha \put@syl \test@B #1\sv@Yvwl }
773
774\def \sv@Yvwl {% put alif maqsura
775\put@con Y\ifqur@n \add@fathaspec \fi \put@syl \syl@con }
776
777%%%%%%%%%%%%%%%%%%%%%%%%%% special vowels %%%%%%%%%%%%%%%%%%%%%%%%%%
778
779\def \sv@a@a #1{% Qur'an alif
780	\add@fathaspec \put@syl
781\case #1\of
782{   \a@H {\put@con \a@H\put@syl \syl@con }%
783	U{\put@con w\put@syl \syl@con }%
784	Y{\put@con Y\put@syl \syl@con }%
785	I{\put@con y\put@syl \syl@con }%
786\default {\syl@con #1}%
787}\endcase }
788
789\def \sv@a@e {% explicit sukun
790\add@sukun \put@syl \syl@con }
791
792\def \sv@a@i {% defective long i
793\add@kasraspec \put@syl \syl@con }
794
795\def \sv@a@u {% defective long u
796\add@ammad \put@syl \syl@con }
797
798%%%%%%%%%%%%%%%%%%%%%%%%%%
799
800\def \sv@a@A {% Uighuric and Turkish
801\ifu@gh \put@syl \put@con \a@H \put@syl \xpa \syl@con
802\else \xpa \sv@a \fi }
803
804\def \sv@a@E #1{% kurdish ^e
805\ifk@rd \put@syl \def \next {\test@B #1\sv@a@Evwl }\else
806\add@kasraspec \put@syl \def \next {\syl@con #1}\fi \next }
807
808\def \sv@a@Evwl {% kurdish E carrier
809\put@con \a@E \put@syl \syl@con }
810
811\def \sv@a@O #1{% Kurdish and Turkish "o
812\put@syl
813\ifk@rd \def \next {\test@B #1\sv@wa@Evwl }\else
814\def \next {\test@B #1\sv@wvwl }\fi \next }
815
816\def \sv@a@O #1{% Kurdish and Turkish "o
817\put@syl
818\ifu@gh \put@con \a@W \put@syl \def \next {\syl@con #1}\else
819\ifk@rd \def \next {\test@B #1\sv@wa@Evwl }\else
820\def \next {\test@B #1\sv@wvwl }\fi\fi \next }
821
822\def \sv@wa@Evwl {% kurdish W E carrier
823\put@con w\put@syl \put@con \a@E \put@syl \syl@con }
824
825\def \sv@a@U {% Uighuric and Turkish
826\ifu@gh \put@syl \put@con \a@aw \put@syl \xpa \syl@con
827\else \xpa \sv@u \fi }
828
829%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
830
831\def \sv@Za {% Kashmiri .a
832\add@kh@hamza \put@syl \syl@con }
833
834\def \sv@Ze {% explicit shadda
835%\add@shadda \put@syl \syl@con }
836%\add@shadda \syl@voctest }
837\voc@suk \add@shadda \syl@voctest }
838
839\def \sv@Zi {% Sindhi -IN
840\add@bars \put@syl \syl@con }
841
842\def \sv@Zo {% Kashmiri .o
843\put@syl \put@con \a@aU \put@syl \syl@con }
844
845\def \sv@Zu {% Kashmiri .u
846\add@kl@hamza \put@syl \syl@con }
847
848%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
849
850\def \sv@ZA {% Kashmiri .A
851\put@syl \put@con A%
852\add@kh@hamzl \put@syl \syl@con }
853
854\def \sv@ZE {% explicit madda
855\add@madda \put@syl \syl@con }
856
857\def \sv@ZI {% Kashmiri .y
858\put@syl \put@con \a@as \syl@voctest }
859
860\def \sv@ZO {% Kashmiri .O
861\put@syl \put@con \a@aU \put@syl \put@con A\add@fatha \put@syl \syl@con }
862
863\def \sv@ZU {% Kashmiri .U
864\add@kl@hamzl \put@syl \syl@con }
865
866%%%%%%%%%%%%%%%%%%%%%%%%%% Nunation %%%%%%%%%%%%%%%%%%%%%%%%%%
867
868\def \syl@Nspec {% tanwin fatha
869\ifh@mza \ifaN@alif \def \next {\syl@aN@alif }%
870	\else \def \next {\syl@aN }%
871	\fi
872\else \add@fathatan \put@syl \def \next {\syl@ignore }%
873\fi \next }
874
875\def \syl@aN #1{% tanwin fatha on actual character, alif required ?
876	\add@fathatan \put@syl \def \next {\syl@ignore #1}%
877\ifcat -\nxp #1%
878	\xpa\if \xpa\is@in@list \the\last@con YTaB>\else
879		\put@con a\put@syl 	% deposit alif
880	\fi
881\fi \next }
882
883\def \syl@aN@alif #1{% tanwin fatha at the end, alif required ?
884\ifcat -\nxp #1\def \next {\syl@ignore #1}%
885	\xpa\if \xpa\is@in@list \the\last@con YTaB>\else
886		\ifv@c \put@syl \v@ctrue \else \put@syl
887		\fi \put@con a% 		% deposit alif
888	\fi
889\else	\def \next {\syl@ignore }%
890	\ifv@c \put@syl \v@ctrue \else \put@syl
891	\fi \put@con #1% 		% deposit character
892\fi \add@fathatan \put@syl \next }
893
894\def \syl@Wspec #1{% final w with silent alif ?
895\case #1\of
896{	-{\syl@Wspec }% ignore hyphen
897	u{\add@damma \put@syl
898	  \put@con a\put@syl \syl@con }%	% ending w-u
899\default {\add@sukun \put@syl
900	  \put@con a\put@syl \syl@con }%	% ending w
901}\endcase }
902
903\def \syl@ignore #1{% kill the rest after Tanwin except U, A, a, y, and Y
904\case #1\of
905{	-{\syl@ignore }
906	U{\put@con w\put@syl \syl@ignore }
907       aA{\put@con a\put@syl \syl@ignore }
908	Y{\put@con Y\put@syl \syl@ignore }
909	y{\put@con y\put@syl \syl@ignore }
910\default {\let \next \syl@ignore
911	  \ifcat -\nxp #1\def \next {\syl@con #1}% 	% tie
912	  \fi \next }
913}\endcase }
914
915%%%%%%%%%%%%%%%%%%%%%%%%%% Hamza %%%%%%%%%%%%%%%%%%%%%%%%%%
916
917\newif \if@ay
918
919\def \syl@@hamzabeg #1#2{% initial hamza
920\ifk@rd \ifx #2i\def \next {\syl@con }\put@con a% alif
921	\add@hamza \add@hamzalow \put@syl
922	\else \put@con Y\add@hamza \def \next {\syl@voctest #2}%
923	\fi \else
924\ifh@mza \def \next {\syl@beghamza #1#2}\else
925	\def \next {\syl@hamzaverb #1#2}% verbatim mode
926\fi\fi \next }
927
928\def \syl@@hamzabeg #1#2{% initial hamza
929\ifk@rd \ifx #2i\def \next {\syl@con }\put@con a% alif
930	\add@hamza \add@hamzalow \put@syl
931	\else \put@con Y\add@hamza \def \next {\syl@voctest #2}%
932	\fi \else
933\ifu@gh \put@con Y\add@hamza \def \next {\syl@voctest #2}\else
934\ifh@mza \def \next {\syl@beghamza #1#2}\else
935	\def \next {\syl@hamzaverb #1#2}% verbatim mode
936\fi\fi\fi \next }
937
938\def \syl@@hamza #1{% non-initial hamza, context #1'
939\ifx #1-\def \next {\syl@hamzabeg #1}\else
940\ifh@mza \def \next {\syl@arabhamza #1}\else
941	\def \next {\syl@hamzaverb #1}% verbatim mode
942\fi\fi \next }
943
944\def \syl@hamzaverb #1{% verbatim hamza, #1 = carrier
945\case #1\of
946{	|{\put@con Q}
947	A{\put@con a\add@madda \@sukfalse }
948	y{\put@con Y\add@hamza }
949	u{\put@con w\add@hamza }
950	i{\put@con a\add@hamza \add@hamzalow }
951\default {\put@con #1\add@hamza }
952}\endcase \syl@voctest }
953
954\def \syl@beghamza #1#2{% start word with hamza, context '#2
955\ifx #2"\def \next {\syl@beghamza #1}\togglev@c % toggle vowel
956\else \def \next {\syl@@beghamza #2}%
957\fi \next }
958
959\def \syl@@beghamza #1{% start word with hamza, context '#1
960\put@con a\def \next {\syl@con }% alif
961\case #1\of
962{	A{\add@madda }
963    \a@a {\add@fathaspec }
964    a\a@A{\add@hamza \add@fatha }
965i\a@i\a@I{\add@hamza \add@kasra \add@hamzalow }
966ou\a@O\a@U{\add@hamza \add@damma }
967   eE\a@E{\add@hamza \ifp@sht \add@zwarakay \else \add@kasra \fi }
968    I\a@e{\add@hamza \add@kasra \add@hamzalow \put@syl \put@con y}
969OU\a@o\a@p\a@w{\add@hamza \add@damma \put@syl \put@con w}
970\default {\add@hamza \add@sukun \def \next {\syl@con #1}}
971}\endcase
972\put@syl \next }
973
974\def \syl@arabhamza #1#2#3{% non-initial hamza, context #1'#2#3
975\case #2\of
976{	"{\togglev@c \syl@hamza #1#3}	% toggle vowel
977	|{\syl@hamza #1#3} 		% ignore bar
978   AIUYEO{\syl@hamzamid #1#2#3#3} 	% arabic rules
979\default {\syl@@arabhamza #1#2#3}	% test for final position
980}\endcase }
981
982\def \syl@@arabhamza #1#2#3#4{% non-initial hamza, context #1'#2#3#4
983	\def \next {\syl@hamzamid #1#2#3#3#4}%
984\if\isat@wdend #2#3#4% test for hamza as last consonant
985\ifiz@fet \else \def \next {\syl@hamzaend #1#2#3#4}%
986\fi\fi \next }
987
988\def \syl@hamzamid #1#2#3{% test for #1 a y ; obsolete?
989	\@ayfalse
990\ifx #2a\ifx #3y\@aytrue
991\fi\fi \syl@@hamzamid #1#2#3}
992
993\def \syl@@hamzamid #1#2#3{% intermediate hamza, context #1'#2#3
994	\def \next {\syl@voctest #2}%
995\ifx #1I\ifqur@n \put@con B\else \put@con Y\fi \add@hamza \else
996\if\is@in@list #1iy>\put@con Y\add@hamza \else
997\if\is@in@list #2iIE>\put@con Y\add@hamza
998	\ifqur@n \add@hamzalow \fi \else
999\if\is@in@list #1uo>\put@con w\add@hamza \else
1000\if\is@in@list #2uo>\put@con w\add@hamza \else
1001\if\is@in@list #2UO>%
1002	\ifqur@n \put@Q #1\else \put@con w\add@hamza \fi \else
1003\if\is@in@list #1AUO>\put@Q #1\else
1004\if\is@in@list #2A>\put@con a\add@madda
1005	\put@syl \def \next {\syl@con }\else
1006\if\is@in@list #2\a@a>\put@con a\add@fathaspec
1007	\put@syl \def \next {\syl@con }\else
1008\ifx #1a\put@con a\add@hamza \else
1009\ifx #2a\ifqur@n \put@Q #1\else \put@con a\add@hamza \fi \else
1010	\put@Q #1% deposit Hamza
1011\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1012\ifx #2Q\def \next {\syl@doublehamza }%
1013\fi \next }
1014
1015\def \syl@hamzaend #1{% final hamza, context #1'
1016\case #1\of
1017{	i{\put@con Y\add@hamza \syl@voctest }
1018	u{\put@con w\add@hamza \syl@voctest }
1019	a{\put@con a\add@hamza \syl@voctest }
1020\default {\syl@@hamzaend #1}
1021}\endcase }
1022
1023\def \syl@@hamzaend #1#2#3{% final hamza, context #1'#2#3
1024\put@con Q\def \next {\syl@voctest #2#3}% deposit Hamza
1025\ifx #2a\ifx #3N\def \next {\syl@hamza@Nspec #1}%
1026\fi\fi \next }
1027
1028\def \syl@hamza@Nspec #1#2{% #1'aN , put alif ?
1029\ifx #1A\else
1030\ifx #1U\else
1031\if\is@end@char #1\else
1032	\ifqur@n \put@con B\else \put@con Y\fi \add@hamza
1033\fi\fi\fi
1034	\add@fathatan \put@syl
1035\ifx #1A\else
1036	\ifx #2Y\put@con Y% put alif maqsoura
1037	\else \put@con a% put alif
1038	\fi
1039	\put@syl
1040\fi \syl@ignore #2}
1041
1042\def \syl@doublehamza #1{% double Hamza
1043\add@shadda \syl@voctest }
1044
1045\def \put@Q #1{% deposit isolated hamza after #1
1046\ifqur@n \if\is@end@char #1\put@con Q\else \put@con B\add@hamza \fi
1047\else\put@con Q%
1048\fi }
1049
1050%%%%%%%%%%%%%%%%%%%%%% deposit characters %%%%%%%%%%%%%%%%%%%%%%%%%%
1051
1052\def \check@@high #1{%				% long form for tooth ?
1053\if\is@in@list #1YntCbyp>%			% YntCbyp : toggle
1054	\if@high \global\@highfalse \else \global\@hightrue
1055	\fi \else
1056\if\is@in@list #1sxSD>\global\@hightrue \else 	% sxSD    : force high
1057	\global\@highfalse			% otherwise : force low
1058\fi\fi }
1059
1060\def \put@con #1{% start syllable
1061\last@con ={#1}}
1062
1063\def \put@syl {% deposit syllable
1064\if@high \advance \last@mod \c@high \fi
1065\xpa \check@high \the\last@con
1066\let \ifv@c \if@vocals \let \if@suk \if@sukun
1067\def \rev@wd {\the\last@con \the\last@mod +\the\last@voc *}\put@rev@wd
1068\global \@waslatrue }
1069
1070\def \put@spec #1{% deposit special character
1071\last@con={#1}\def \rev@wd {#10+0*}\put@rev@wd
1072\global \@waslafalse }
1073
1074\def \put@rev@wd {% deposit output item				% no group!
1075\edef \temp {\global \nxp\a@revwd {\rev@wd \the\a@revwd }%	% \temp
1076\global \nxp\sv@revwd {\the\sv@revwd \rev@wd }}\temp
1077\last@mod = 0 \last@voc = 0 }
1078
1079%%%%%%%%%%%%%%%%%%%%%% deposit .harakAt %%%%%%%%%%%%%%%%%%%%%%%%%%
1080
1081\def \add@shadda    {\advance \last@mod \c@shadda }
1082\def \add@hamza     {\advance \last@mod \c@hamza }
1083\def \add@hamzalow  {\advance \last@mod \c@hamzalow }
1084\def \add@madda     {\advance \last@mod \c@madda }
1085
1086\def \add@wasla     {\if@suk \last@voc \c@wasla \fi }
1087\def \add@sukun     {\if@suk \last@voc \c@sukun \fi }
1088\def \add@fatha     {\ifv@c \last@voc \c@fatha 	\fi }
1089\def \add@kasra     {\ifv@c \last@voc \c@kasra 	\fi }
1090\def \add@damma     {\ifv@c \last@voc \c@damma 	\fi }
1091\def \add@zwarakay  {\ifv@c \last@voc \c@zwarakay \fi }
1092\def \add@fathatan  {\ifv@c \last@voc \c@fathatan \fi }
1093\def \add@kasratan  {\ifv@c \last@voc \c@kasratan \fi }
1094\def \add@dammatan  {\ifv@c \last@voc \c@dammatan \fi }
1095\def \add@fathaspec {\ifv@c \last@voc \c@fathaspec \fi }
1096\def \add@kasraspec {\ifv@c \last@voc \c@kasraspec \fi }
1097\def \add@ammad     {\ifv@c \last@voc \c@ammad 	  \fi }
1098\def \add@bars      {\ifv@c \last@voc \c@bars     \fi }
1099\def \add@kh@hamza  {\ifv@c \last@voc \c@kh@hamza \fi }
1100\def \add@kl@hamza  {\ifv@c \last@voc \c@kl@hamza \fi }
1101\def \add@kh@hamzl  {\ifv@c \last@voc \c@kh@hamzl \fi }
1102\def \add@kl@hamzl  {\ifv@c \last@voc \c@kl@hamzl \fi }
1103
1104%%%%%%%%%%%%%%%%%%%%% output code constants %%%%%%%%%%%%%%%%%%%%%%%%%%
1105
1106\chardef \c@shadda   = 1     \chardef \c@hamza    = 2
1107\chardef \c@hamzalow = 3     \chardef \c@madda    = 4
1108\chardef \c@high     = 10
1109
1110\chardef \c@sukun     = 1    \chardef \c@fatha     = 2
1111\chardef \c@kasra     = 3    \chardef \c@damma     = 4
1112\chardef \c@fathatan  = 5    \chardef \c@kasratan  = 6
1113\chardef \c@dammatan  = 7    \chardef \c@zwarakay  = 8
1114\chardef \c@wasla     = 9    \chardef \c@fathaspec = 10
1115\chardef \c@kasraspec = 11   \chardef \c@ammad     = 12
1116\chardef \c@kas@fath  = 13   \chardef \c@bars      = 14
1117\chardef \c@kh@hamza  = 15   \chardef \c@kl@hamza  = 16
1118\chardef \c@kh@hamzl  = 17   \chardef \c@kl@hamzl  = 18
1119
1120%%%%%%%%%%%%%%%%%%%%%%%% end of routines %%%%%%%%%%%%%%%%%%%%%%%%
1121
1122\endinput
1123%%%%%%%%%%%%%%%%%%%%%%%% EOF %%%%%%%%%%%%%%%%%%%%%%%%
1124