1;;; tibetan.el --- support for Tibetan language -*- coding: iso-2022-7bit; -*-
2
3;; Copyright (C) 1997, 2001, 2002, 2003, 2004, 2005, 2006, 2007
4;;   Free Software Foundation, Inc.
5;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
6;;   National Institute of Advanced Industrial Science and Technology (AIST)
7;;   Registration Number H14PRO021
8
9;; Keywords: multilingual, Tibetan
10
11;; This file is part of GNU Emacs.
12
13;; GNU Emacs is free software; you can redistribute it and/or modify
14;; it under the terms of the GNU General Public License as published by
15;; the Free Software Foundation; either version 2, or (at your option)
16;; any later version.
17
18;; GNU Emacs is distributed in the hope that it will be useful,
19;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21;; GNU General Public License for more details.
22
23;; You should have received a copy of the GNU General Public License
24;; along with GNU Emacs; see the file COPYING.  If not, write to the
25;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
26;; Boston, MA 02110-1301, USA.
27
28;; Author: Toru TOMABECHI, <Toru.Tomabechi@orient.unil.ch>
29
30;; Created: Feb. 17. 1997
31
32;; History:
33;; 1997.03.13 Modification for special signs and punctuations.
34
35;;; Commentary:
36
37;;; Code:
38
39;;; Tibetan Character set.
40;;; \x2130 -- \x234a is a subset of Unicode v.2 \x0f00 - \x0fb9
41;;; with a slight modification. And there are some subjoined
42;;; consonants which are not specified in Unicode.
43;;; I hope I can add missing characters later.
44;;;
45;;;     00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
46;;;2120 // $(7!!(B $(7!"(B $(7!#(B $(7!$(B $(7!%(B $(7!&(B $(7!'(B $(7!((B $(7!)(B $(7!*(B $(7!+(B $(7!,(B $(7!-(B $(7!.(B $(7!/(B ; obsolete glyphs (2123-5)
47;;;2130 $(7!0(B $(7!1(B $(7!2(B $(7!3(B $(7!4(B $(7!5(B $(7!6(B $(7!7(B $(7!8(B $(7!9(B $(7!:(B $(7!;(B $(7!<(B $(7!=(B $(7!>(B $(7!?(B ; Punctuations,
48;;;2140 $(7!@(B $(7!A(B $(7!B(B $(7!C(B $(7!D(B $(7!E(B $(7!F(B $(7!G(B $(7!H(B $(7!I(B $(7!J(B $(7!K(B $(7!L(B $(7!M(B $(7!N(B $(7!O(B ; Digits and
49;;;2150 $(7!P(B $(7!Q(B $(7!R(B $(7!S(B $(7!T(B $(7!U(B $(7!V(B $(7!W(B $(7!X(B $(7!Y(B $(7!Z(B $(7![(B $(7!\(B $(7!](B $(7!^(B $(7!_(B ; Special signs.
50;;;2160 $(7!`(B $(7!a(B $(7!b(B $(7!c(B $(7!d(B $(7!e(B $(7!f(B $(7!g(B $(7!h(B $(7!i(B $(7!j(B $(7!k(B $(7!l(B $(7!m(B $(7!n(B $(7!o(B ;
51;;;2170 $(7!p(B $(7!q(B $(7!r(B $(7!s(B $(7!t(B $(7!u(B $(7!v(B $(7!w(B $(7!x(B $(7!y(B $(7!z(B $(7!{(B $(7!|(B $(7!}(B $(7!~(B // ;
52;;;
53;;;     00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
54;;;2220 // $(7"!(B $(7""(B $(7"#(B $(7"$(B $(7"%(B $(7"&(B $(7"'(B $(7"((B $(7")(B $(7"*(B $(7"+(B $(7",(B $(7"-(B $(7".(B $(7"/(B ; Base consonants
55;;;2230 $(7"0(B $(7"1(B $(7"2(B $(7"3(B $(7"4(B $(7"5(B $(7"6(B $(7"7(B $(7"8(B $(7"9(B $(7":(B $(7";(B $(7"<(B $(7"=(B $(7">(B $(7"?(B ; and
56;;;2240 $(7"@(B $(7"A(B $(7"B(B $(7"C(B $(7"D(B $(7"E(B $(7"F(B $(7"G(B $(7"H(B $(7"I(B $(7"J(B $(7"K(B $(7"L(B $(7"M(B $(7"N(B $(7"O(B ; Vowel signs.
57;;;2250 $(7"P(B $(7"Q(B $(7"R(B $(7"S(B $(7"T(B $(7"U(B $(7"V(B $(7"W(B $(7"X(B $(7"Y(B $(7"Z(B $(7"[(B $(7"\(B $(7"](B $(7"^(B $(7"_(B ; (\x2251 = vowel a)
58;;;2260 $(7"`(B $(7"a(B $(7"b(B $(7"c(B $(7"d(B $(7"e(B $(7"f(B $(7"g(B $(7"h(B $(7"i(B $(7"j(B $(7"k(B $(7"l(B $(7"m(B $(7"n(B $(7"o(B ; Long vowels and
59;;;2270 $(7"p(B $(7"q(B $(7"r(B $(7"s(B $(7"t(B $(7"u(B $(7"v(B $(7"w(B $(7"x(B $(7"y(B $(7"z(B $(7"{(B $(7"|(B $(7"}(B $(7"~(B // ; vocalic r, l ARE
60;;;                                                     ; atomically
61;;;                                                     ; encoded.
62;;;     00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
63;;;2320 // $(7#!(B $(7#"(B $(7##(B $(7#$(B $(7#%(B $(7#&(B $(7#'(B $(7#((B $(7#)(B $(7#*(B $(7#+(B $(7#,(B $(7#-(B $(7#.(B $(7#/(B ; Subjoined consonants
64;;;2330 $(7#0(B $(7#1(B $(7#2(B $(7#3(B $(7#4(B $(7#5(B $(7#6(B $(7#7(B $(7#8(B $(7#9(B $(7#:(B $(7#;(B $(7#<(B $(7#=(B $(7#>(B $(7#?(B ;
65;;;2340 $(7#@(B $(7#A(B $(7#B(B $(7#C(B $(7#D(B $(7#E(B $(7#F(B $(7#G(B $(7#H(B $(7#I(B $(7#J(B $(7#K(B $(7#L(B $(7#M(B $(7#N(B $(7#O(B ;
66;;;2350 $(7#P(B $(7#Q(B $(7#R(B $(7#S(B $(7#T(B $(7#U(B $(7#V(B $(7#W(B $(7#X(B $(7#Y(B $(7#Z(B $(7#[(B $(7#\(B $(7#](B $(7#^(B $(7#_(B ; Hereafter, the chars
67;;;2360 $(7#`(B $(7#a(B $(7#b(B $(7#c(B $(7#d(B $(7#e(B $(7#f(B $(7#g(B $(7#h(B $(7#i(B $(7#j(B $(7#k(B $(7#l(B $(7#m(B $(7#n(B $(7#o(B ; are not specified
68;;;2370 $(7#p(B $(7#q(B $(7#r(B $(7#s(B $(7#t(B $(7#u(B $(7#v(B $(7#w(B $(7#x(B $(7#y(B $(7#z(B $(7#{(B $(7#|(B $(7#}(B $(7#~(B // ; in Unicode.
69;;;
70;;;     00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
71;;;2420 // $(7$!(B $(7$"(B $(7$#(B $(7$$(B $(7$%(B $(7$&(B $(7$'(B $(7$((B $(7$)(B $(7$*(B $(7$+(B $(7$,(B $(7$-(B $(7$.(B $(7$/(B ; Precomposed
72;;;2430 $(7$0(B $(7$1(B $(7$2(B $(7$3(B $(7$4(B $(7$5(B $(7$6(B $(7$7(B $(7$8(B $(7$9(B $(7$:(B $(7$;(B $(7$<(B $(7$=(B $(7$>(B $(7$?(B ; consonants for
73;;;2440 $(7$@(B $(7$A(B $(7$B(B $(7$C(B $(7$D(B $(7$E(B $(7$F(B $(7$G(B $(7$H(B $(7$I(B $(7$J(B $(7$K(B $(7$L(B $(7$M(B $(7$N(B $(7$O(B ; ordinary Tibetan.
74;;;2450 $(7$P(B $(7$Q(B $(7$R(B $(7$S(B $(7$T(B $(7$U(B $(7$V(B $(7$W(B $(7$X(B $(7$Y(B $(7$Z(B $(7$[(B $(7$\(B $(7$](B $(7$^(B $(7$_(B ; They are decomposed
75;;;2460 $(7$`(B $(7$a(B $(7$b(B $(7$c(B $(7$d(B $(7$e(B $(7$f(B $(7$g(B $(7$h(B $(7$i(B $(7$j(B $(7$k(B $(7$l(B $(7$m(B $(7$n(B $(7$o(B ; into base and
76;;;2470 $(7$p(B $(7$q(B $(7$r(B $(7$s(B $(7$t(B $(7$u(B $(7$v(B $(7$w(B $(7$x(B $(7$y(B $(7$z(B $(7${(B $(7$|(B $(7$}(B $(7$~(B // ; subjoined consonants
77;;;                                                     ; when written on a
78;;;     00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F ; file in Tibetan
79;;;2520 // $(7%!(B $(7%"(B $(7%#(B $(7%$(B $(7%%(B $(7%&(B $(7%'(B $(7%((B $(7%)(B $(7%*(B $(7%+(B $(7%,(B $(7%-(B $(7%.(B $(7%/(B ; coding system.
80;;;2530 $(7%0(B $(7%1(B $(7%2(B $(7%3(B $(7%4(B $(7%5(B $(7%6(B $(7%7(B $(7%8(B $(7%9(B $(7%:(B $(7%;(B $(7%<(B $(7%=(B $(7%>(B $(7%?(B ;
81;;;2540 $(7%@(B $(7%A(B $(7%B(B $(7%C(B $(7%D(B $(7%E(B $(7%F(B $(7%G(B $(7%H(B $(7%I(B $(7%J(B $(7%K(B $(7%L(B $(7%M(B $(7%N(B $(7%O(B ;
82;;;2550 $(7%P(B $(7%Q(B $(7%R(B $(7%S(B $(7%T(B $(7%U(B $(7%V(B $(7%W(B $(7%X(B $(7%Y(B $(7%Z(B $(7%[(B $(7%\(B $(7%](B $(7%^(B $(7%_(B ;
83;;;2560 $(7%`(B $(7%a(B $(7%b(B $(7%c(B $(7%d(B $(7%e(B $(7%f(B $(7%g(B $(7%h(B $(7%i(B $(7%j(B $(7%k(B $(7%l(B $(7%m(B $(7%n(B $(7%o(B ;
84;;;2570 $(7%p(B $(7%q(B $(7%r(B $(7%s(B $(7%t(B $(7%u(B $(7%v(B $(7%w(B $(7%x(B $(7%y(B $(7%z(B $(7%{(B $(7%|(B $(7%}(B $(7%~(B // ;
85;;;
86
87
88(make-coding-system
89 'tibetan-iso-8bit 2 ?Q
90 "8-bit encoding for ASCII (MSB=0) and TIBETAN (MSB=1)."
91 '(ascii tibetan nil nil
92   nil nil)
93 '((safe-charsets ascii tibetan)
94   (post-read-conversion . tibetan-post-read-conversion)
95   (pre-write-conversion . tibetan-pre-write-conversion)))
96
97(define-coding-system-alias 'tibetan 'tibetan-iso-8bit)
98
99(set-language-info-alist
100 "Tibetan" '((charset tibetan tibetan-1-column)
101	     (coding-system tibetan-iso-8bit)
102	     (coding-priority iso-2022-7bit tibetan-iso-8bit)
103	     (input-method . "tibetan-wylie")
104	     (features tibet-util)
105	     (documentation . t)
106	     (sample-text
107	      . (tibetan-compose-string
108		 (copy-sequence
109"Tibetan (4$(7"7r'"]0"7"]14"20"21!;4%P0"G#!"Q14"20"21!;(B) $(7!4!5!5!>4"70"714$P0"!#C"Q1!;4"Er'"S0"E"S14"G0"G1!;4"70"714"2r'"[0"2"[1!;4"Dr'"[0"D"[14"#0"#14"G0"G1!>4"Ir'"]r'"_0"I"]"_1!;4"90"9"Q1!;4"/r'"S0"/"S1!;4"50"5"Q14#2x!#9r'"[0"2#9"[1!;4"Hx!"Rx!"Ur'"c0"H"A"U"c1!>(B")))))
110
111
112;; `$(7"A(B' is included in the pattern for subjoined consonants because we
113;; treat it specially in tibetan-add-components.
114;; modified by Tomabechi 1999/12/10
115;; modified by Tomabechi 2000/06/08
116;;          To allow infinite addition of vowels/modifiers
117;;          as specified in Unicode v.3
118;; $(7"A(B is removed from the class of subjoined. Tomabechi 2000/06/08
119;; (for Unicode support)
120(defconst tibetan-composable-pattern
121  "[$(7"!(B-$(7"J"K(B][$(7#!(B-$(7#J#K#L#M(B]*[$(7"Q"R"S(B-$(7"^"a"b"e(B]*[$(7"_"c"d"g(B-$(7"l!I!e!g(B]*"
122  "Regexp matching a composable sequence of Tibetan characters.")
123
124;; Register a function to compose Tibetan characters.
125(aset composition-function-table (make-char 'tibetan)
126      (list (cons tibetan-composable-pattern 'tibetan-composition-function)))
127
128;;;
129;;; Definitions of conversion data.
130;;;
131
132
133;;; alists for tibetan char <-> transcription conversion
134;;; longer transcription should come first
135(defconst tibetan-consonant-transcription-alist
136  '(("tsh" . "$(7";(B")
137    ("dzh" . "$(7"=(B")
138    ("kSH" . "$(7"J(B")
139    ("kh" . "$(7""(B")
140    ("gh" . "$(7"$(B")
141    ("ng" . "$(7"%(B")
142    ("ch" . "$(7"'(B")
143    ("ny" . "$(7"*(B")
144    ("TH" . "$(7",(B")
145    ("DH" . "$(7".(B")
146    ("th" . "$(7"1(B")
147    ("dh" . "$(7"3(B")
148    ("ph" . "$(7"6(B")
149    ("bh" . "$(7"8(B")
150    ("ts" . "$(7":(B")
151    ("dz" . "$(7"<(B")
152    ("zh" . "$(7"?(B")
153    ("sh" . "$(7"E(B")
154    ("SH" . "$(7"F(B")
155    ("k" . "$(7"!(B")
156    ("g" . "$(7"#(B")
157    ("c" . "$(7"&(B")
158    ("j" . "$(7"((B")
159    ("T" . "$(7"+(B")
160    ("D" . "$(7"-(B")
161    ("N" . "$(7"/(B")
162    ("t" . "$(7"0(B")
163    ("d" . "$(7"2(B")
164    ("n" . "$(7"4(B")
165    ("p" . "$(7"5(B")
166    ("b" . "$(7"7(B")
167    ("m" . "$(7"9(B")
168    ("w" . "$(7">(B")
169    ("z" . "$(7"@(B")
170    ("'" . "$(7"A(B")
171    ("y" . "$(7"B(B")
172    ("r" . "$(7"C(B")
173    ("l" . "$(7"D(B")
174    ("s" . "$(7"G(B")
175    ("h" . "$(7"H(B")
176    ("H" . "$(7"H(B")
177    ("A" . "$(7"I(B")
178    ;; Added by Tomabechi 1999/12/10
179    ("R" . "$(7"K(B") ;; fixed form RA
180    ))
181
182
183(defconst tibetan-vowel-transcription-alist
184  '(
185    ;; Composite Vowels
186    ;; Added by Tomabechi 2000/06/08
187    ("frr" . "$(7"X(B")
188    ("fll" . "$(7"Z(B")
189    ("fa" . "$(7"R(B")
190    ("fi" . "$(7"T(B")
191    ("fu" . "$(7"V(B")
192    ("fr" . "$(7"W(B")
193    ("fl" . "$(7"Y(B")
194    ("fI" . "$(7"b(B")
195    ;; Normal Vowels
196    ("ai" . "$(7"\(B")
197    ("au" . "$(7"^(B")
198    ("ee" . "$(7"\(B")
199    ("oo" . "$(7"^(B")
200    ("a" . "$(7"Q(B")			; invisible vowel sign (\x2251)
201    ("i" . "$(7"S(B")
202    ("u" . "$(7"U(B")
203    ("e" . "$(7"[(B")
204    ("o" . "$(7"](B")
205    ("E" . "$(7"\(B")
206    ("O" . "$(7"^(B")
207    ("I" . "$(7"a(B")
208    ("," . "$(7"e(B")			; idem.
209    ))
210
211(defconst tibetan-modifier-transcription-alist
212  '(("M" . "$(7"_(B")
213    ("~" . "$(7"c(B")
214    ("`" . "$(7"d(B")
215    ("x" . "$(7"i(B")
216    ("X" . "$(7"j(B")
217    ("v" . "$(7"g(B")
218    ("V" . "$(7"h(B")
219    ("q" . "$(7"k(B")
220    ("Q" . "$(7"l(B")
221    ("_/" . "$(7!I(B")
222    ("_o" . "$(7!g(B")
223    ("_O" . "$(7!e(B")))
224
225(defconst tibetan-precomposed-transcription-alist
226  '(("phyw" . "$(7$G(B")
227    ("tshw" . "$(7$)(B")
228    ("rtsw" . "$(7%.(B")
229    ("khw" . "$(7$"(B")
230    ("nyw" . "$(7$%(B")
231    ("tsw" . "$(7$((B")
232    ("zhw" . "$(7$*(B")
233    ("shw" . "$(7$.(B")
234    ("khy" . "$(7$A(B")
235    ("phy" . "$(7$D(B")
236    ("khr" . "$(7$Q(B")
237    ("thr" . "$(7$T(B")
238    ("phr" . "$(7$W(B")
239    ("shr" . "$(7$Z(B")
240    ("dzr" . "$(7$^(B")
241    ("grw" . "$(7$_(B")
242    ("rng" . "$(7%#(B")
243    ("rny" . "$(7%%(B")
244    ("rts" . "$(7%+(B")
245    ("rdz" . "$(7%,(B")
246    ("rgw" . "$(7%-(B")
247    ("rky" . "$(7%0(B")
248    ("rgy" . "$(7%1(B")
249    ("rmy" . "$(7%2(B")
250    ("lng" . "$(7%B(B")
251    ("sng" . "$(7%R(B")
252    ("sny" . "$(7%S(B")
253    ("sts" . "$(7%Z(B")
254    ("sky" . "$(7%`(B")
255    ("sgy" . "$(7%a(B")
256    ("spy" . "$(7%b(B")
257    ("sby" . "$(7%c(B")
258    ("smy" . "$(7%d(B")
259    ("skr" . "$(7%p(B")
260    ("sgr" . "$(7%q(B")
261    ("snr" . "$(7%r(B")
262    ("spr" . "$(7%s(B")
263    ("sbr" . "$(7%t(B")
264    ("smr" . "$(7%u(B")
265    ("kw" . "$(7$!(B")
266    ("gw" . "$(7$#(B")
267    ("cw" . "$(7$$(B")
268    ("tw" . "$(7$&(B")
269    ("dw" . "$(7$'(B")
270    ("zw" . "$(7$+(B")
271    ("rw" . "$(7$,(B")
272    ("lw" . "$(7$-(B")
273    ("sw" . "$(7$/(B")
274    ("hw" . "$(7$0(B")
275    ("ky" . "$(7$@(B")
276    ("gy" . "$(7$B(B")
277    ("py" . "$(7$C(B")
278    ("by" . "$(7$E(B")
279    ("my" . "$(7$F(B")
280    ("kr" . "$(7$P(B")
281    ("gr" . "$(7$R(B")
282    ("tr" . "$(7$S(B")
283    ("dr" . "$(7$U(B")
284    ("pr" . "$(7$V(B")
285    ("brk" . "$(7"7%!(B")
286    ("brg" . "$(7"7%"(B")
287    ("brng" . "$(7"7%#(B")
288    ("brj" . "$(7"7%$(B")
289    ("brny" . "$(7"7%%(B")
290    ("brt" .  "$(7"7%&(B")
291    ("brd" . "$(7"7%'(B")
292    ("brn" . "$(7"7%((B")
293    ("brts" . "$(7"7%+(B")
294    ("brdz" . "$(7"7%,(B")
295    ("brl" . "$(7"7$d(B")
296    ("br" . "$(7$X(B")
297    ("mr" . "$(7$Y(B")
298    ("sr" . "$(7$[(B")
299    ("hr" . "$(7$\(B")
300    ("jr" . "$(7$](B")
301    ("kl" . "$(7$`(B")
302    ("gl" . "$(7$a(B")
303    ("blt" . "$(7"7%E(B")
304    ("bld" . "$(7"7%F(B")
305    ("bl" . "$(7$b(B")
306    ("zl" . "$(7$c(B")
307    ("rl" . "$(7$d(B")
308    ("sl" . "$(7$e(B")
309    ("rk" . "$(7%!(B")
310    ("rg" . "$(7%"(B")
311    ("rj" . "$(7%$(B")
312    ("rt" . "$(7%&(B")
313    ("rd" . "$(7%'(B")
314    ("rn" . "$(7%((B")
315    ("rb" . "$(7%)(B")
316    ("rm" . "$(7%*(B")
317    ("lk" . "$(7%@(B")
318    ("lg" . "$(7%A(B")
319    ("lc" . "$(7%C(B")
320    ("lj" . "$(7%D(B")
321    ("lt" . "$(7%E(B")
322    ("ld" . "$(7%F(B")
323    ("ln" . "$(7!!(B")			; dummy \x2121
324    ("lp" . "$(7%G(B")
325    ("lb" . "$(7%H(B")
326    ("lh" . "$(7%I(B")
327    ("sk" . "$(7%P(B")
328    ("sg" . "$(7%Q(B")
329    ("st" . "$(7%T(B")
330    ("sd" . "$(7%U(B")
331    ("sn" . "$(7%V(B")
332    ("sp" . "$(7%W(B")
333    ("sb" . "$(7%X(B")
334    ("sm" . "$(7%Y(B"))
335  )
336
337
338(defconst tibetan-subjoined-transcription-alist
339  (sort '(("+k"  . "$(7#!(B")
340	  ("+kh" . "$(7#"(B")
341	  ("+g"  . "$(7##(B")
342	  ("+gh" . "$(7#$(B")
343	  ("+ng" . "$(7#%(B")
344	  ("+c"  . "$(7#&(B")
345	  ("+ch" . "$(7#'(B")
346	  ("+j"  . "$(7#((B")
347	  ("+ny"  . "$(7#*(B")
348	  ("+T"  . "$(7#+(B")
349	  ("+TH" . "$(7#,(B")
350	  ("+D"  . "$(7#-(B")
351	  ("+DH" . "$(7#.(B")
352	  ("+N"  . "$(7#/(B")
353	  ("+t"  . "$(7#0(B")
354	  ("+th" . "$(7#1(B")
355	  ("+d"  . "$(7#2(B")
356	  ("+dh" . "$(7#3(B")
357	  ("+n"  . "$(7#4(B")
358	  ("+p"  . "$(7#5(B")
359	  ("+ph" . "$(7#6(B")
360	  ("+b"  . "$(7#7(B")
361	  ("+bh" . "$(7#8(B")
362	  ("+m"  . "$(7#9(B")
363	  ("+ts" . "$(7#:(B")
364	  ("+tsh" . "$(7#;(B")
365	  ("+dz" . "$(7#<(B")
366	  ("+dzh" . "$(7#=(B")
367	  ("+w"  . "$(7#>(B")
368	  ("+zh" . "$(7#?(B")
369	  ("+z"  . "$(7#@(B")
370	  ("+'"  . "$(7#A(B")
371	  ("+y"  . "$(7#B(B")
372	  ("+r"  . "$(7#C(B")
373	  ("+l"  . "$(7#D(B")
374	  ("+sh" . "$(7#E(B")
375	  ("+SH" . "$(7#F(B")
376	  ("+s"  . "$(7#G(B")
377	  ("+h"  . "$(7#H(B")
378	  ("+A"  . "$(7#I(B")
379	  ("+kSH" . "$(7#J(B")
380	  ;; Added by Tomabechi 1999/12/10
381	  ("+W" . "$(7#K(B") ;; fixed form subscribed WA
382	  ("+Y" . "$(7#L(B") ;; fixed form subscribed YA
383	  ("+R" . "$(7#M(B") ;; fixed form subscribed RA
384	  )
385	(lambda (x y) (> (length (car x)) (length (car y))))))
386
387;;;
388;;; alist for Tibetan base consonant <-> subjoined consonant conversion.
389;;;
390(defconst tibetan-base-to-subjoined-alist
391  '(("$(7"!(B" . "$(7#!(B")
392    ("$(7""(B" . "$(7#"(B")
393    ("$(7"#(B" . "$(7##(B")
394    ("$(7"$(B" . "$(7#$(B")
395    ("$(7"%(B" . "$(7#%(B")
396    ("$(7"&(B" . "$(7#&(B")
397    ("$(7"'(B" . "$(7#'(B")
398    ("$(7"((B" . "$(7#((B")
399    ("$(7"*(B" . "$(7#*(B")
400    ("$(7"+(B" . "$(7#+(B")
401    ("$(7",(B" . "$(7#,(B")
402    ("$(7"-(B" . "$(7#-(B")
403    ("$(7".(B" . "$(7#.(B")
404    ("$(7"/(B" . "$(7#/(B")
405    ("$(7"0(B" . "$(7#0(B")
406    ("$(7"1(B" . "$(7#1(B")
407    ("$(7"2(B" . "$(7#2(B")
408    ("$(7"3(B" . "$(7#3(B")
409    ("$(7"4(B" . "$(7#4(B")
410    ("$(7"5(B" . "$(7#5(B")
411    ("$(7"6(B" . "$(7#6(B")
412    ("$(7"7(B" . "$(7#7(B")
413    ("$(7"8(B" . "$(7#8(B")
414    ("$(7"9(B" . "$(7#9(B")
415    ("$(7":(B" . "$(7#:(B")
416    ("$(7";(B" . "$(7#;(B")
417    ("$(7"<(B" . "$(7#<(B")
418    ("$(7"=(B" . "$(7#=(B")
419    ("$(7">(B" . "$(7#>(B")
420    ("$(7"?(B" . "$(7#?(B")
421    ("$(7"@(B" . "$(7#@(B")
422    ("$(7"A(B" . "$(7#A(B")
423    ("$(7"B(B" . "$(7#B(B")
424    ("$(7"C(B" . "$(7#C(B")
425    ("$(7"D(B" . "$(7#D(B")
426    ("$(7"E(B" . "$(7#E(B")
427    ("$(7"F(B" . "$(7#F(B")
428    ("$(7"G(B" . "$(7#G(B")
429    ("$(7"H(B" . "$(7#H(B")
430    ("$(7"I(B" . "$(7#I(B")
431    ("$(7"J(B" . "$(7#J(B")
432    ;; Added by Tomabechi 1999/12/10
433    ("$(7"K(B" . "$(7#M(B") ;; Fixed form RA (224B->234D)
434    ))
435
436;;; alist for Tibetan composite vowels (long i, vocalic r, etc.)
437;;; New varialble. created by Tomabechi 2000/06/08
438(defconst tibetan-composite-vowel-alist
439  '(;; LONG A
440    ;; ("$(7"R(B" . ((bc . tc) ?$(7"R(B))
441    ;; LONG I
442    ("$(7"T(B" . (?$(7"R(B (tc . bc) ?$(7"S(B))
443    ;; LONG U
444    ("$(7"V(B" . (?$(7"R(B (bc . tc) ?$(7"U(B))
445    ;; VOCALIC R
446    ("$(7"W(B" . (?$(7#C(B (tc . bc) ?$(7"a(B))
447    ;; LONG VOCALIC R
448    ("$(7"X(B" . (?$(7#C(B (bc . tc) ?$(7"R(B (tc . bc) ?$(7"a(B))
449    ;; VOCALIC L
450    ("$(7"Y(B" . (?$(7#D(B (tc . bc) ?$(7"a(B))
451    ;;$(7!;(BLONG VOCALIC L
452    ("$(7"Z(B" . (?$(7#D(B (bc . tc) ?$(7"R(B (tc . bc) ?$(7"a(B))
453    ;; LONG REVERSE I
454    ("$(7"b(B" . (?$(7"R(B (tc . bc) ?$(7"a(B))
455    ))
456
457
458
459;;;
460;;; alist for Tibetan consonantic components <-> precomposed glyph conversion.
461;;; (includes some punctuation conversion rules)
462;;;
463(defconst tibetan-precomposition-rule-alist
464  `(("$(7"6#B#>(B" . "$(7$G(B")
465    ("$(7"##C#>(B" . "$(7$_(B")
466    ("$(7";#>(B" . "$(7$)(B")
467    ("$(7"C#:#>(B" . "$(7%.(B")
468    ("$(7"C###>(B" . "$(7%-(B")
469    ("$(7"C#!#B(B" . "$(7%0(B")
470    ("$(7"C###B(B" . "$(7%1(B")
471    ("$(7"C#9#B(B" . "$(7%2(B")
472    ("$(7"G#!#B(B" . "$(7%`(B")
473    ("$(7"G###B(B" . "$(7%a(B")
474    ("$(7"G#5#B(B" . "$(7%b(B")
475    ("$(7"G#7#B(B" . "$(7%c(B")
476    ("$(7"G#9#B(B" . "$(7%d(B")
477    ("$(7"G#!#C(B" . "$(7%p(B")
478    ("$(7"G###C(B" . "$(7%q(B")
479    ("$(7"G#4#C(B" . "$(7%r(B")
480    ("$(7"G#5#C(B" . "$(7%s(B")
481    ("$(7"G#7#C(B" . "$(7%t(B")
482    ("$(7"G#9#C(B" . "$(7%u(B")
483    ("$(7""#>(B" . "$(7$"(B")
484    ("$(7"*#>(B" . "$(7$%(B")
485    ("$(7":#>(B" . "$(7$((B")
486    ("$(7"?#>(B" . "$(7$*(B")
487    ("$(7"E#>(B" . "$(7$.(B")
488    ("$(7""#B(B" . "$(7$A(B")
489    ("$(7"6#B(B" . "$(7$D(B")
490    ("$(7""#C(B" . "$(7$Q(B")
491    ("$(7"1#C(B" . "$(7$T(B")
492    ("$(7"6#C(B" . "$(7$W(B")
493    ("$(7"E#C(B" . "$(7$Z(B")
494    ("$(7"<#C(B" . "$(7$^(B")
495    ("$(7"C#%(B" . "$(7%#(B")
496    ("$(7"C#*(B" . "$(7%%(B")
497    ("$(7"C#:(B" . "$(7%+(B")
498    ("$(7"C#<(B" . "$(7%,(B")
499    ("$(7"D#%(B" . "$(7%B(B")
500    ("$(7"G#%(B" . "$(7%R(B")
501    ("$(7"G#*(B" . "$(7%S(B")
502    ("$(7"G#:(B" . "$(7%Z(B")
503    ("$(7"!#>(B" . "$(7$!(B")
504    ("$(7"##>(B" . "$(7$#(B")
505    ("$(7"&#>(B" . "$(7$$(B")
506    ("$(7"0#>(B" . "$(7$&(B")
507    ("$(7"2#>(B" . "$(7$'(B")
508    ("$(7"@#>(B" . "$(7$+(B")
509    ("$(7"C#>(B" . "$(7$,(B")
510    ("$(7"D#>(B" . "$(7$-(B")
511    ("$(7"G#>(B" . "$(7$/(B")
512    ("$(7"H#>(B" . "$(7$0(B")
513    ("$(7"!#B(B" . "$(7$@(B")
514    ("$(7"##B(B" . "$(7$B(B")
515    ("$(7"5#B(B" . "$(7$C(B")
516    ("$(7"7#B(B" . "$(7$E(B")
517    ("$(7"9#B(B" . "$(7$F(B")
518    ("$(7"!#C(B" . "$(7$P(B")
519    ("$(7"##C(B" . "$(7$R(B")
520    ("$(7"0#C(B" . "$(7$S(B")
521    ("$(7"2#C(B" . "$(7$U(B")
522    ("$(7"5#C(B" . "$(7$V(B")
523    ("$(7"7#C(B" . "$(7$X(B")
524    ("$(7"9#C(B" . "$(7$Y(B")
525    ("$(7"G#C(B" . "$(7$[(B")
526    ("$(7"H#C(B" . "$(7$\(B")
527    ("$(7"(#C(B" . "$(7$](B")
528    ("$(7"!#D(B" . "$(7$`(B")
529    ("$(7"##D(B" . "$(7$a(B")
530    ("$(7"7#D(B" . "$(7$b(B")
531    ("$(7"@#D(B" . "$(7$c(B")
532    ("$(7"C#D(B" . "$(7$d(B")
533    ("$(7"G#D(B" . "$(7$e(B")
534    ("$(7"C#!(B" . "$(7%!(B")
535    ("$(7"C##(B" . "$(7%"(B")
536    ("$(7"C#((B" . "$(7%$(B")
537    ("$(7"C#0(B" . "$(7%&(B")
538    ("$(7"C#2(B" . "$(7%'(B")
539    ("$(7"C#4(B" . "$(7%((B")
540    ("$(7"C#7(B" . "$(7%)(B")
541    ("$(7"C#9(B" . "$(7%*(B")
542    ("$(7"D#!(B" . "$(7%@(B")
543    ("$(7"D##(B" . "$(7%A(B")
544    ("$(7"D#4(B" . "$(7!!(B") ; dummy 0x2121 added 2000/06/08 for transition l -> lng
545    ("$(7"D#&(B" . "$(7%C(B")
546    ("$(7"D#((B" . "$(7%D(B")
547    ("$(7"D#0(B" . "$(7%E(B")
548    ("$(7"D#2(B" . "$(7%F(B")
549    ("$(7"D#5(B" . "$(7%G(B")
550    ("$(7"D#7(B" . "$(7%H(B")
551    ("$(7"D#H(B" . "$(7%I(B")
552    ("$(7"G#!(B" . "$(7%P(B")
553    ("$(7"G##(B" . "$(7%Q(B")
554    ("$(7"G#0(B" . "$(7%T(B")
555    ("$(7"G#2(B" . "$(7%U(B")
556    ("$(7"G#4(B" . "$(7%V(B")
557    ("$(7"G#5(B" . "$(7%W(B")
558    ("$(7"G#7(B" . "$(7%X(B")
559    ("$(7"G#9(B" . "$(7%Y(B")))
560
561(defconst tibetan-regexp
562  (let ((l (list tibetan-precomposed-transcription-alist
563		 tibetan-consonant-transcription-alist
564		 tibetan-vowel-transcription-alist
565		 tibetan-modifier-transcription-alist
566		 tibetan-subjoined-transcription-alist))
567	(separator "\\|")
568	tail pattern)
569    (while l
570      (setq tail (car l) l (cdr l))
571      (while tail
572	(setq pattern (cons separator (cons (car (car tail)) pattern))
573	      tail (cdr tail))))
574    (apply 'concat (nreverse (cdr pattern))))
575  "Regexp matching a Tibetan transcription of a composable Tibetan sequence.
576The result of matching is to be used for indexing alists at conversion
577from a roman transcription to the corresponding Tibetan character.")
578
579(defvar tibetan-precomposed-regexp
580  (let ((l tibetan-precomposed-transcription-alist)
581	temp)
582    (setq temp "^\\(")
583    (setq temp
584	  (concat temp (car (car l))))
585    (setq l (cdr l))
586    (while l
587      (setq temp
588	    (concat temp "\\|" (car (car l))))
589      (setq l (cdr l)))
590    (concat temp "\\)"))
591  "Regexp string to match a romanized Tibetan complex consonant.
592The result of matching is to be used for indexing alists when the input key
593from an input method is converted to the corresponding precomposed glyph.")
594
595(defvar tibetan-precomposition-rule-regexp
596  (let ((l tibetan-precomposition-rule-alist)
597	temp)
598    (setq temp "\\(")
599    (setq temp (concat temp (car (car l))))
600    (setq l (cdr l))
601    (while l
602      (setq temp (concat temp "\\|" (car (car l))))
603      (setq l (cdr l)))
604    (concat temp "\\)"))
605  "Regexp string to match a sequence of Tibetan consonantic components, i.e.,
606one base consonant and one or more subjoined consonants.
607The result of matching is to be used for indexing alist when the component
608sequence is converted to the corresponding precomposed glyph.
609This also matches some punctuation characters which need conversion.")
610
611(defvar tibetan-decomposed nil)
612(defvar tibetan-decomposed-temp nil)
613
614(provide 'tibetan)
615
616;;; arch-tag: 8d37c8d7-f95d-450f-9ec2-819e61fc79a7
617;;; tibetan.el ends here
618