New file.
[m17n/m17n-contrib.git] / im / tai-sonla.mim
1 ;; tai-sonla.mim -- Tai Viet input method with Phonetic sequence
2 ;; Copyright (C) 2007
3 ;;   Thua Thien Hue Center of Information Technology (HueCIT, Vietnam)
4 ;; Copyright (C) 2007
5 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
6 ;;   Registration Number H15PRO112
7
8 ;; This file is part of the m17n contrib; a sub-part of the m17n
9 ;; library.
10
11 ;; The m17n library is free software; you can redistribute it and/or
12 ;; modify it under the terms of the GNU Lesser General Public License
13 ;; as published by the Free Software Foundation; either version 2.1 of
14 ;; the License, or (at your option) any later version.
15
16 ;; The m17n library is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19 ;; Lesser General Public License for more details.
20
21 ;; You should have received a copy of the GNU Lesser General Public
22 ;; License along with the m17n library; if not, write to the Free
23 ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 ;; Boston, MA 02110-1301, USA.
25
26 (input-method tai sonla-kbd)
27
28 (title "꫞")
29
30 (description (_"Tai Viet input method using the phonetic key sequence with the Tai Son La keyboard layout.
31 The phonetic key sequence means that you type a syllable in this order:
32   C W? V v? F? T?
33 where
34   C is an initial consonant,
35   W is a label for labializing C ('ꪫ'),
36   V is a vowel (V1:prefix, V2:combining, or V3:postfix),
37   v is the second vowel of a digraph vowel
38         (in the case that V is 'ꪹ' and v is 'ꪸ', 'ꪷ', or 'ꪱ'),
39   F is a final consonant,
40   T is a tonemark (spacing or combining).
41
42 You can type special symbols by these keys:
43   '$' -> 'ꫛ'
44   '#' -> 'ꫜ'
45   '%' -> 'ꫝ'
46   '!' -> '꫞'
47   '@' -> '꫟'
48 "))
49
50 (macro
51  (adjust-tone
52   (set TT @-1)
53   (delete @-)
54   (cond ((| (= T ?ꫀ) (= T ?ꫂ)) (delete @-) (move @>))
55         ((> T 0) (move M) (delete @+) (move @>)))
56   (set T TT)
57   (cond ((| (= T ?ꫀ) (= T ?ꫂ)) (insert T))
58         ((> T 0) (move M) (insert T) (move @>)))))
59
60 (map
61  (consonant
62   ("k" "ꪀ")
63   ("K" "ꪁ")
64   ("x" "ꪂ")
65   ("X" "ꪃ")
66   ("q" "ꪄ")
67   ("Q" "ꪅ")
68   ("|" "ꪆ")
69   ("\"" "ꪇ")
70   ("g" "ꪈ")
71   ("G" "ꪉ")
72   ("c" "ꪊ")
73   ("C" "ꪋ")
74   ("." "ꪌ")
75   (">" "ꪍ")
76   ("s" "ꪎ")
77   ("S" "ꪏ")
78   ("z" "ꪐ")
79   ("Z" "ꪑ")
80   ("d" "ꪒ")
81   ("D" "ꪓ")
82   ("t" "ꪔ")
83   ("T" "ꪕ")
84   ("w" "ꪖ")
85   ("W" "ꪗ")
86   ("n" "ꪘ")
87   ("N" "ꪙ")
88   ("b" "ꪚ")
89   ("B" "ꪛ")
90   ("p" "ꪜ")
91   ("P" "ꪝ")
92   ("/" "ꪞ")
93   ("?" "ꪟ")
94   ("f" "ꪠ")
95   ("F" "ꪡ")
96   ("m" "ꪢ")
97   ("M" "ꪣ")
98   ("j" "ꪤ")
99   ("J" "ꪥ")
100   ("r" "ꪦ")
101   ("R" "ꪧ")
102   ("l" "ꪨ")
103   ("L" "ꪩ")
104   ("v" "ꪪ")
105   ("V" "ꪫ")
106   ("h" "ꪬ")
107   ("H" "ꪭ")
108   ("o" "ꪮ")
109   ("O" "ꪯ"))
110
111  (final-c
112   ("b" "ꪚ")
113   ("d" "ꪒ")
114   ("k" "ꪀ")
115   ("J" "ꪥ")
116   ("M" "ꪣ")
117   ("N" "ꪙ")
118   ("G" "ꪉ")
119   ("V" "ꪫ"))  
120
121  (high-v
122   ("V" "ꪫ"))  
123
124  (special
125   ("$" "ꫛ")
126   ("#" "ꫜ")
127   ("%" "ꫝ")
128   ("!" "꫞")
129   ("@" "꫟"))
130
131  (vowel-pre
132   ("e" "ꪵ")
133   ("," "ꪶ")
134   ("E" "ꪹ")
135   ("Y" "ꪻ")
136   ("y" "ꪼ")
137   ("o^" "ꪶ"))
138
139  (vowel-combining
140   ("}" "ꪰ")
141   ("i" "ꪲ")
142   ("U" "ꪳ")
143   ("u" "ꪴ")
144   ("[" "ꪷ")
145   ("I" "ꪸ")
146   ("{" "ꪾ")
147   ("awm" "ꪾ"))
148
149  (vowel-post
150   ("a" "ꪱ")
151   ;; ("A" "ꪱꪲ")
152   ("<" "ꪺ")
153   ("]" "ꪽ")
154   ;; Note: "ꪮ" and "ꪯ" can be consonant and vowel. 
155   ("o" "ꪮ")
156   ("O" "ꪯ"))
157
158  (vowel-digraph
159   ("r" "ꪸ")
160   ("R" "ꪷ")
161   ("A" "ꪱ"))
162
163  (tone
164   (":" "ꫀ")
165   (";" "ꫂ")
166   ("\"" "꪿")
167   ("'" "꫁"))
168
169  (punctuation
170   ("!!" "!")
171   ("@@" "@")
172   ("##" "#")
173   ("$$" "$")
174   ("%%" "%")
175   (",," ",")
176   (".." ".")
177   (";;" ";")
178   ("::" ":")
179   (";;" ";")
180   ("\"\"" "\"")
181   ("//" "/")
182   ("||" "|")
183   ("''" "'")
184   ("!!" "?")
185   ("??" "?")
186   ("[[" "[")
187   ("]]" "]")
188   ("{{" "{")
189   ("}}" "}")
190   ("<<" "<")
191   (">>" ">"))
192
193  (backspace
194   ((BackSpace) (sub K 1) (undo K))))
195
196 (state
197  (init
198   (t (set K 0))
199   (consonant (mark M) (shift after-c))
200   (special)
201   (punctuation)
202   (vowel-pre)
203   (vowel-post)
204   (vowel-combining)
205   (tone))
206
207  (after-c
208   (t (mark M) (set V2 0) (set K @@))
209   (high-v (mark M))
210   (vowel-pre (set V1 @-1)
211              (delete @-)
212              (move @<) (insert V1) (move @>) (shift after-c-vpre))
213   (vowel-combining (cond ((> V2 0) (move @-) (delete @-) (move @>))
214                          (1 (set K @@)))
215                    (set V2 @-1) (mark M))
216   (vowel-post (shift after-c-v))
217   (vowel-digraph (mark M) (move @<) (insert "ꪹ") (move @>)
218                  (shift after-c-v))
219   (final-c (delete @-) (pushback 1) (shift init))
220   (backspace)
221   (nil (shift after-c-v)))
222   
223  (after-c-vpre
224   (t (set K @@))
225   (vowel-combining (set V2 @-1) (mark M) (shift after-c-v))
226   (vowel-post (shift after-c-v))
227   (backspace)
228   (nil (shift after-c-v)))
229
230  (after-c-v
231   (t (set T 0) (set K @@))
232   (tone (cond ((= T 0) (set K @@))) (adjust-tone))
233   (final-c (shift after-c-v-f))
234   (backspace))
235
236  (after-c-v-f
237   (t (set K @@))
238   (tone (adjust-tone))
239   (backspace)))