*** empty log message ***
[m17n/m17n-db.git] / MIM / cmc-kbd.mim
1 ;; cmc-kdb.mim -- Cham input method based on Cham keyboard
2 ;; Copyright (C) 2008
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 cmc kbd)
25
26 (description "Cham input method simulating Cham keyboard.")
27
28 (title "ꨆK")
29
30 (map
31  ;; Independent vowels and consonants
32  (independent
33   ;; Vowels
34   ("a" "ꨀ")
35   ("I" "ꨁ")
36   ("u" "ꨂ")
37   ("e" "ꨃ")
38   ("i" "ꨄ")
39   ("o" "ꨅ")
40   ;; Cosonants
41   ("k" "ꨆ")
42   ("A" "ꨇ")
43   ("g" "ꨈ")
44   ("G" "ꨉ")
45   ("z" "ꨊ")
46   ("Z" "ꨋ")
47   ("c" "ꨌ")
48   ("S" "ꨍ")
49   ("j" "ꨄ")
50   ("J" "ꨏ")
51   ("v" "ꨐ")
52   ("V" "ꨑ")
53   ("W" "ꨒ")
54   ("t" "ꨓ")
55   ("E" "ꨔ")
56   ("d" "ꨕ")
57   ("D" "ꨖ")
58   ("n" "ꨗ")
59   ("q" "ꨘ")
60   ("Q" "ꨙ")
61   ("p" "ꨚ")
62   ("F" "ꨛ")
63   ("f" "ꨜ")
64   ("b" "ꨝ")
65   ("B" "ꨞ")
66   ("m" "ꨟ")
67   ("M" "ꨠ")
68   ("O" "ꨡ")
69   ("y" "ꨢ")
70   ("r" "ꨣ")
71   ("l" "ꨤ")
72   ("w" "ꨥ")
73   ("x" "ꨦ")
74   ("s" "ꨧ")
75   ("h" "ꨨ"))
76  ;; Dependent vowels
77  (post-vowel
78   ("%" "ꨩ")
79   ("^" "ꨩꨮ")
80   ("{" "ꨪ")
81   ("[" "ꨪꩌ")
82   ("}" "ꨫ")
83   ("]" "ꨬ")
84   ("`" "ꨭ")
85   ("@" "ꨮ")
86   ("$" "ꨮꩃ")
87   ("#" "ꨮꩌ")
88   ("<" "ꨱ")
89   ("\"" "ꨱꨮ")
90   (">" "ꨱꩌ")
91   ("," "ꨲ"))
92  (pre-vowel
93   ("-" "ꨯ")
94   ("=" "ꨰ"))
95
96  ;; Medials
97  (post-medial
98   ("~" "ꨳ")
99   ("*" "ꨵ")
100   (")" "ꨵꨭ")
101   ("(" "ꨵꨶ")
102   ("&" "ꨶ"))
103
104  (pre-medial
105   ("\\" "ꨴ"))
106
107  ;; (";" ",")
108
109  ;; Final consonants.
110  (final
111   ("K" "ꩀ")
112   ;; ꩁ
113   ("U" "ꩂ")
114   ("/" "ꩃ")
115   ("C" "ꩄ")
116   ("T" "ꩅ")
117   ("N" "ꩆ")
118   ("P" "ꩇ")
119   ("Y" "ꩈ")
120   ("R" "ꩉ")
121   ("L" "ꩊ")
122   ("X" "ꩋ")
123   ("'" "ꩌ")
124   ("H" "ꩍ"))
125
126  (misc
127   ;; Digits
128   ("0" "꩐")
129   ("1" "꩑")
130   ("2" "꩒")
131   ("3" "꩓")
132   ("4" "꩔")
133   ("5" "꩕")
134   ("6" "꩖")
135   ("7" "꩗")
136   ("8" "꩘")
137   ("9" "꩙")
138
139   ;; Traditional punctuations.
140   ("_" "꩜")
141   ("|" "꩝")
142   ("||" "꩞")
143   ("|||" "꩟")
144
145   ;; ASCII remapping.
146   (";" ","))
147
148  (edit
149   ((BackSpace)
150    (set PREV @-1)
151    (cond ((= PREV PM)
152           (set PREV @-2)
153           (cond ((& (>= PREV 0xAA00) (<= PREV 0xAA28))
154                  (delete @-2) (insert PM))
155                 (1 (unhandle))))
156          ((| (= PREV PV1) (= PREV PV2))
157           (cond ((= @-2 PM)
158                  (cond ((& (>= @-3 0xAA00) (<= @-3 0xAA28))
159                         (delete @-4)
160                         (insert PREV) (insert PM))
161                        (1 (unhandle))))
162                 ((& (>= @-2 0xAA00) (<= @-2 0xAA28))
163                  (delete @-2)
164                  (insert PREV))
165                 (1 (unhandle))))
166          (1 (unhandle))))
167
168   ((Delete)
169    (set NEXT @+1)
170    (cond ((& (>= NEXT 0xAA00) (<= NEXT 0xAA28))
171           (set N2 @+2)
172           (cond ((= N2 PM)
173                  (set N3 @+3)
174                  (cond ((| (= N3 PV1) (= N3 PV2))
175                         (delete @+3) (insert NEXT) (insert N2))
176                        (1 (delete @+2) (insert NEXT))))
177                 ((| (= N2 PV1) (= N2 PV2))
178                  (delete @+2) (insert NEXT))
179                 (1 (unhandle))))
180          (1 (unhandle)))))
181  )
182
183 (state
184  (init
185   (t (set PM 0xAA34)                    ; PRE-MEDIAL
186      (set PV1 0xAA2F)                   ; PRE-VOWEL-1
187      (set PV2 0xAA30)                   ; PRE-VOWEL-2
188      )
189
190   (independent
191    (set C @-) (set PREV @-2)
192    (cond ((= PREV PM)
193           (set PREV @-3)
194           (cond ((| (= PREV PV1) (= PREV PV2))
195                  (delete @-3) (insert C) (insert PM) (insert PREV))
196                 ((| (< PREV 0xAA00) (> PREV 0xAA28))
197                  (delete @-2) (insert C) (insert PM))))
198          ((| (= PREV PV1) (= PREV PV2))
199           (cond ((= @-3 PM))
200                 ((| (< @-3 0xAA00) (> @-3 0xAA28))
201                  (delete @-2) (insert C) (insert PREV))))))
202
203   (pre-vowel
204    (set C @-) (set NEXT @+1)
205    (cond ((& (>= NEXT 0xAA00) (<= NEXT 0xAA28))
206           (delete @-1) (delete @+1) (insert NEXT) (insert C) (set NEXT @+1)))
207    (cond ((& (>= NEXT 0xAA33) (<= NEXT 0xAA36))
208           (delete @-1) (delete @+1) (insert NEXT) (insert C))))
209
210   (pre-medial
211    (set C @-) (set NEXT @+1)
212    (cond ((& (>= NEXT 0xAA00) (<= NEXT 0xAA28))
213           (delete @-1) (delete @+1) (insert NEXT) (insert C))))
214
215   (post-medial)
216   (post-vowel)
217   (final)
218   (misc)
219   (edit)))
220
221 ;; Local Variables:
222 ;; coding: utf-8
223 ;; mode: emacs-lisp
224 ;; End: