Moved from the parent directory.
[m17n/m17n-db.git] / MIM / bo-ewts.mim
1 ;; bo-ewts.mim -- Tibetan input method with EWTS
2 ;; Copyright (C) 2007
3 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
4 ;;   Registration Number H15PRO112
5
6 ;; This file is part of the m17n database; a sub-part of the m17n
7 ;; library.
8
9 ;; The m17n library is free software; you can redistribute it and/or
10 ;; modify it under the terms of the GNU Lesser General Public License
11 ;; as published by the Free Software Foundation; either version 2.1 of
12 ;; the License, or (at your option) any later version.
13
14 ;; The m17n library is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 ;; Lesser General Public License for more details.
18
19 ;; You should have received a copy of the GNU Lesser General Public
20 ;; License along with the m17n library; if not, write to the Free
21 ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 ;; Boston, MA 02110-1301, USA.
23
24 (input-method bo ewts)
25
26 (description "Tibetan input method based on EWTS.
27 This implementation is based on THDL Extended Wylie Transliteration Scheme
28 Version 2.0 <http://www.thdl.org/collections/langling/ewts/ewts.php>.")
29
30 (variable
31  (precomposed
32   (_"Flag to tell whether or not to generate precomposed characters.
33 If 1, generate precomposed characters if available (e.g. \"ྲྀ\"(U+0F76).
34 If 0, generate only decomposed characters (e.g. \"ྲྀ\" (U+0FB2 U+0F80).")
35   0 0 1))
36
37 (title "ཀ")
38
39 (map
40  ;; This map is used also for subjoined consonants.
41  (consonant
42   ("k" "ཀ")
43   ("kh" "ཁ")
44   ("g" "ག")
45   ("ng" "ང")
46   ("c" "ཅ")
47   ("ch" "ཆ")
48   ("j" "ཇ")
49   ("ny" "ཉ")
50   ("t" "ཏ")
51   ("th" "ཐ")
52   ("d" "ད")
53   ("n" "ན")
54   ("p" "པ")
55   ("ph" "ཕ")
56   ("b" "བ")
57   ("m" "མ")
58   ("ts" "ཙ")
59   ("tsh" "ཚ")
60   ("dz" "ཛ")
61   ("w" "ཝ")
62   ("zh" "ཞ")
63   ("z" "ཟ")
64   ("'" "འ")
65   ("y" "ཡ")
66   ("r" "ར")
67   ("l" "ལ")
68   ("sh" "ཤ")
69   ("s" "ས")
70   ("h" "ཧ")
71   ("a" "ཨ"))
72
73  ;; Standard Tibetan Stacks listed at:
74  ;; <http://www.thdl.org/collections/langling/tibstacks.html>
75  (standard-stack
76   ("kl" "ཀླ")
77   ("kr" "ཀྲ")
78   ("kw" "ཀྭ")
79   ("ky" "ཀྱ")
80   ("khr" "ཁྲ")
81   ("khw" "ཁྭ")
82   ("khy" "ཁྱ")
83   ("gl" "གླ")
84   ("gr" "གྲ")
85   ("grw" "གྲྭ")
86   ("gw" "གྭ")
87   ("gy" "གྱ")
88   ("cw" "ཅྭ")
89   ("nyw" "ཉྭ")
90   ("tr" "ཏྲ")
91   ("tw" "ཏྭ")
92   ("thr" "ཐྲ")
93   ("dr" "དྲ")
94   ("drw" "དྲྭ")
95   ("dw" "དྭ")
96   ("pr" "པྲ")
97   ("py" "པྱ")
98   ("phr" "ཕྲ")
99   ("phy" "ཕྱ")
100   ("phyw" "ཕྱྭ")
101   ("bl" "བླ")
102   ("br" "བྲ")
103   ("by" "བྱ")
104   ("mr" "མྲ")
105   ("my" "མྱ")
106   ("tsw" "ཙྭ")
107   ("tshw" "ཚྭ")
108   ("zhw" "ཞྭ")
109   ("zl" "ཟླ")
110   ("zw" "ཟྭ")
111   ("rb" "རྦ")
112   ("rd" "རྡ")
113   ("rdz" "རྫ")
114   ("rg" "རྒ")
115   ("rgw" "རྒྭ")
116   ("rgy" "རྒྱ")
117   ("rj" "རྗ")
118   ("rk" "རྐ")
119   ("rky" "རྐྱ")
120   ("rl" "རླ")
121   ("rm" "རྨ")
122   ("rmy" "རྨྱ")
123   ("rn" "རྣ")
124   ("rng" "རྔ")
125   ("rny" "རྙ")
126   ("rt" "རྟ")
127   ("rts" "རྩ")
128   ("rtsw" "རྩྭ")
129   ("rw" "རྭ")
130   ("lb" "ལྦ")
131   ("lc" "ལྕ")
132   ("ld" "ལྡ")
133   ("lg" "ལྒ")
134   ("lh" "ལྷ")
135   ("lj" "ལྗ")
136   ("lk" "ལྐ")
137   ("lng" "ལྔ")
138   ("lp" "ལྤ")
139   ("lt" "ལྟ")
140   ("shr" "ཤྲ")
141   ("shw" "ཤྭ")
142   ("sb" "སྦ")
143   ("sbr" "སྦྲ")
144   ("sby" "སྦྱ")
145   ("sd" "སྡ")
146   ("sg" "སྒ")
147   ("sgr" "སྒྲ")
148   ("sgy" "སྒྱ")
149   ("sk" "སྐ")
150   ("skr" "སྐྲ")
151   ("sky" "སྐྱ")
152   ("sl" "སླ")
153   ("sm" "སྨ")
154   ("smr" "སྨྲ")
155   ("smy" "སྨྱ")
156   ("sn" "སྣ")
157   ("sng" "སྔ")
158   ("snr" "སྣྲ")
159   ("sny" "སྙ")
160   ("sp" "སྤ")
161   ("spr" "སྤྲ")
162   ("spy" "སྤྱ")
163   ("sr" "སྲ")
164   ("st" "སྟ")
165   ("sts" "སྩ")
166   ("sw" "སྭ")
167   ("hr" "ཧྲ")
168   ("hw" "ཧྭ"))
169
170  (sanskrit
171   ("T" "ཊ")
172   ("Th" "ཋ")
173   ("D" "ཌ")
174   ("N" "ཎ")
175   ("Sh" "ཥ")
176   ("oM" (cond (precomposed "ༀ") (1 "ཨོཾ")))
177   ("R+" "ཪ"))
178
179  (force-stack
180   ("+"))
181
182  (break-stack
183   ("."))
184
185  (special-subjoined
186   ("h" (cond ((= precomposed 0) "ྷ")
187              ((= @-1 ?ག) (delete @-1) "གྷ")
188              ((= @-1 ?ད) (delete @-1)  "དྷ")
189              ((= @-1 ?བ) (delete @-1)  "བྷ")
190              ((= @-1 ?ཛ) (delete @-1)  "ཛྷ")
191              (1 "ྷ")))
192   ("Sh" (cond ((= precomposed 0) "ྵ")
193               ((= @-1 ?ཀ) (delete @-1) "ཀྵ")
194               (1 "ྵ")))
195   ("W" "ྺ")
196   ("Y" "ྻ")
197   ("R" "ྼ"))
198
199  (vowel
200   ("a" "")
201   ("i" "ི")
202   ("u" "ུ")
203   ("e" "ེ")
204   ("o" "ོ")
205   ("-i" (cond ((= precomposed 0) "ྀ")
206               ((= @-1 ?ྲ) "ྲྀ")
207               ((= @-1 ?ླ) "ླྀ")
208               (1 "ྀ")))
209   ("A" "ཱ")
210   ("I" "ཱི")
211   ("U" "ཱུ")
212   ("ai" "ཻ")
213   ("au" "ཽ")
214   ("r-I" "ཷ")
215   ("l-I" "ཹ")
216   ("-I" (cond ((= precomposed 0) "ཱྀ")
217               ((= @-1 ?ྲ) "ཷ")
218               ((= @-1 ?ླ) "ཹ")
219               (1 "ཱྀ"))))
220
221  (others
222   ;; Numbers
223   ("0" "༠")
224   ("1" "༡")
225   ("2" "༢")
226   ("3" "༣")
227   ("4" "༤")
228   ("5" "༥")
229   ("6" "༦")
230   ("7" "༧")
231   ("8" "༨")
232   ("9" "༩")
233   ;; These half numbers are not in EWTS but for convenience.
234   ("-1" "༪")
235   ("-2" "༫")
236   ("-3" "༬")
237   ("-4" "༭")
238   ("-5" "༮")
239   ("-6" "༯")
240   ("-7" "༰")
241   ("-8" "༱")
242   ("-9" "༲")
243   ("-0" "༳")
244   ;; Sanskrit-related marks
245   ("H" "ཿ")
246   ("M" "ཾ")
247   ("~M" "ྃ")
248   ("~M`" "ྂ")
249   ("?" "྄")
250   ("&" "྅")
251   ;; Intersyllabic marks
252   (" " "་")
253   ("*" "༌")
254   ;; Phrase deliminating marks
255   ("/" "།")
256   ("//" "༎")
257   (";" "༏")
258   ("|" "༑")
259   ("!" "༈")
260   (":" "༔")
261   ("_" " ")
262   ("=" "༴")
263   ;; Head marks
264   ("@" "༄")
265   ("#" "༅")
266   ("$" "༆")
267   ("%" "༇")
268   ;; Paired punctuation marks (brackets)
269   ("<" "༺")
270   (">" "༻")
271   ("(" "༼")
272   (">" "༽")
273   ;; Miscellaneous
274   ("~X" "༵")
275   ("X" "༷")
276   ("^" "༹"))
277  
278  (escape
279   ("\\" (mark @BEG) "\\" (shift dispatch-escape))
280   ("[" (shift non-tibetan)))
281
282  (unicode
283   ("u" "u" (set MAX-COUNT 4) (shift unicode))
284   ("U" "U" (set MAX-COUNT 8) (shift unicode)))
285
286  (unescape
287   ("]"))
288
289  (hexadigit
290   ("0" "0")
291   ("1" "1")
292   ("2" "2")
293   ("3" "3")
294   ("4" "4")
295   ("5" "5")
296   ("6" "6")
297   ("7" "7")
298   ("8" "8")
299   ("9" "9")
300   ("A" "A") ("a" "A")
301   ("B" "B") ("b" "B")
302   ("C" "C") ("c" "C")
303   ("D" "D") ("d" "D")
304   ("E" "E") ("e" "E")
305   ("F" "F") ("f" "F"))
306
307  (backspace
308   ((Backspace) (undo))))
309
310 (state
311  (init
312   (consonant (shift after-consonant))
313   (standard-stack (shift after-consonant))
314   (sanskrit (shift after-consonant))
315   (vowel (move @<) "ཨ" (move @>) (shift after-vowel))
316   (others)
317   (escape)
318   (backsapce))
319
320  (after-consonant
321   (force-stack (shift consonant-stack))
322   (break-stack (shift init))
323   (vowel (shift after-vowel)))
324   
325  (consonant-stack
326   "ཀ+"
327   (special-subjoined (shift after-consonant))
328   (consonant (set C @-1) (delete @-1) (add C #x50) (insert C)
329              (shift after-consonant))
330   (force-stack)
331   (nil (pop)))
332
333  (after-vowel
334   (force-stack (shift vowel-stack)))
335
336  (vowel-stack
337   "ཀ+"
338   (vowel (shift after-vowel)))
339
340  (dispatch-escape
341   (unicode)
342   (nil (delete @BEG) (shift init) (unhandle)))
343
344  (unicode
345   "ཀu"
346   (t (set COUNT 0) (set UNICODE 0))
347   (hexadigit (cond ((> @-1 ?9) (set UNICODE (+ (* UNICODE 16) (- @-1 55))))
348                    (1 (set UNICODE (+ (* UNICODE 16) (- @-1 48)))))
349              (set COUNT (+ COUNT 1))
350              (cond ((= COUNT MAX-COUNT) (delete @BEG) (insert UNICODE)
351                     (shift init)))))
352
353  (non-tibetan
354   "ཀA"
355   (unescape (shift init))
356   (nil (unhandle))))
357
358 ;; Local Variables:
359 ;; mode: lisp
360 ;; End: