8cea1621b406408458ef7bb379a3dbe5c771a231
[m17n/m17n-db.git] / ko-han2.mim
1 ;; ko-han2.mim -- Input method for Korean Hangul
2 ;; Copyright (C) 2003, 2004
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., 59 Temple Place, Suite 330, Boston, MA
22 ;; 02111-1307, USA.
23
24 ;;; <li> ko-han2.mim
25 ;;;
26 ;;; Input method for Korean Hangul using Hangul keyboard layout.
27
28 (input-method ko han2)
29
30 (title "한2")
31
32 (description
33  "Hangul input method with 2벌식.
34 This input method uses this keyboard layout:
35   KEY:  r R s e E f a q Q t T d w W c z x v g k i j p P u h y n b m l o O
36   한글:ㄱㄲㄴㄷㄸㄹㅁㅂㅃㅅㅆㅇㅈㅉㅊㅋㅌㅍㅎㅏㅑㅓㅔㅖㅕㅗㅛㅜㅠㅡㅣㅐㅒ
37 ")
38
39 (macro
40  (compose
41   ;; Convert Jamo sequence LV[T] into a precomposed character.
42   ;; See the Unicode Standard Version 3.0, Section 3.11.
43   (> L 0
44      ((set LIndex L) (sub LIndex 0x1100)
45       (set VIndex V) (sub VIndex 0x1161)
46       (set TIndex T) (sub TIndex 0x11A7)
47       ;; S = (LIndex * VCount + Vindex) * TCount + TIndex + SBase
48       (set S LIndex)
49       (mul S 21) ;; VCount
50       (add S VIndex)
51       (mul S 28) ;; TCount
52       (add S TIndex)
53       (add S 0xAC00) ;; SBase
54       (delete @<)
55       (insert S)))))
56
57 (map
58  (L-or-T-head
59   ("q") ("Q") ("w") ("W") ("e") ("E") ("r") ("R") ("t") ("T")
60   ("a") ("s") ("S") ("d") ("D") ("f") ("F") ("g") ("G")
61   ("z") ("x") ("c") ("C") ("v"))
62
63  (L-or-T
64   ;; Set L1 to CHOSEONG, T to JONGSEONG.
65   ("r" (set L1 ?ᄀ) (set T ?ᆨ) ?ㄱ (compose))
66   ("R" (set L1 ?ᄁ) (set T ?ᆩ) ?ㄲ (compose))
67   ("s" (set L1 ?ᄂ) (set T ?ᆫ) ?ㄴ (compose))
68   ("e" (set L1 ?ᄃ) (set T ?ᆮ) ?ㄷ (compose))
69   ("f" (set L1 ?ᄅ) (set T ?ᆯ) ?ㄹ (compose))
70   ("a" (set L1 ?ᄆ) (set T ?ᆷ) ?ㅁ (compose))
71   ("q" (set L1 ?ᄇ) (set T ?ᆸ) ?ㅂ (compose))
72   ("t" (set L1 ?ᄉ) (set T ?ᆺ) ?ㅅ (compose))
73   ("T" (set L1 ?ᄊ) (set T ?ᆻ) ?ㅆ (compose))
74   ("d" (set L1 ?ᄋ) (set T ?ᆼ) ?ㅇ (compose))
75   ("w" (set L1 ?ᄌ) (set T ?ᆽ) ?ㅈ (compose))
76   ("c" (set L1 ?ᄎ) (set T ?ᆾ) ?ㅊ (compose))
77   ("z" (set L1 ?ᄏ) (set T ?ᆿ) ?ㅋ (compose))
78   ("x" (set L1 ?ᄐ) (set T ?ᇀ) ?ㅌ (compose))
79   ("v" (set L1 ?ᄑ) (set T ?ᇁ) ?ㅍ (compose))
80   ("g" (set L1 ?ᄒ) (set T ?ᇂ) ?ㅎ (compose))
81   ("sr" (set L1 ?ᄓ) (set T ?ᇅ) ?ᄓ (compose))
82   ("se" (set L1 ?ᄕ) (set T ?ᇆ) ?ㅦ (compose))
83   ("er" (set L1 ?ᄗ) (set T ?ᇊ) ?ᄗ (compose))
84   ("fs" (set L1 ?ᄘ) (set T ?ᇍ) ?ᄘ (compose))
85   ("F" (set L1 ?ᄙ) (set T ?ᇐ) ?ᄙ (compose))
86   ("fg" (set L1 ?ᄚ) (set T ?ᆶ) ?ㅀ (compose))
87   ("aq" (set L1 ?ᄜ) (set T ?ᇜ) ?ㅮ (compose))
88   ("ad" (set L1 ?ᄝ) (set T ?ᇢ) ?ㅱ (compose))
89   ("qt" (set L1 ?ᄡ) (set T ?ᆹ) ?ㅄ (compose))
90   ("qv" (set L1 ?ᄪ) (set T ?ᇤ) ?ᄪ (compose))
91   ("qd" (set L1 ?ᄫ) (set T ?ᇦ) ?ㅸ (compose))
92   ("tr" (set L1 ?ᄭ) (set T ?ᇧ) ?ㅺ (compose))
93   ("te" (set L1 ?ᄯ) (set T ?ᇨ) ?ㅼ (compose))
94   ("tf" (set L1 ?ᄰ) (set T ?ᇩ) ?ᄰ (compose))
95   ("tq" (set L1 ?ᄲ) (set T ?ᇪ) ?ㅽ (compose))
96   ("t/" (set L1 ?ᅀ) (set T ?ᇫ) ?ㅿ (compose))
97   ("dr" (set L1 ?ᅁ) (set T ?ᇬ) ?ᅁ (compose))
98   ("dt" (set L1 ?ᅅ) (set T ?ᇱ) ?ㆂ (compose))
99   ("dt/" (set L1 ?ᅆ) (set T ?ᇲ) ?ㆃ (compose))
100   ("d/" (set L1 ?ᅌ) (set T ?ᇰ) ?ㆁ (compose))
101   ("vq" (set L1 ?ᅖ) (set T ?ᇳ) ?ᅖ (compose))
102   ("vd" (set L1 ?ᅗ) (set T ?ᇴ) ?ㆄ (compose))
103   ("g/" (set L1 ?ᅙ) (set T ?ᇹ) ?ㆆ (compose)))
104
105  (L
106   ;; Set L to CHOSEONG.
107   ("E" (set L ?ᄄ) ?ㄸ)
108   ("Q" (set L ?ᄈ) ?ㅃ)
109   ("W" (set L ?ᄍ) ?ㅉ)
110   ("S" (set L ?ᄔ) ?ㅥ)
111   ("sq" (set L ?ᄖ) ?ᄖ)
112   ("fd" (set L ?ᄛ) ?ᄛ)
113   ("qr" (set L ?ᄞ) ?ㅲ)
114   ("qs" (set L ?ᄟ) ?ᄟ)
115   ("qe" (set L ?ᄠ) ?ㅳ)
116   ("qtr" (set L ?ᄢ) ?ㅴ)
117   ("qte" (set L ?ᄣ) ?ㅵ)
118   ("qtq" (set L ?ᄤ) ?ᄤ)
119   ("qtt" (set L ?ᄥ) ?ᄥ)
120   ("qtw" (set L ?ᄦ) ?ᄦ)
121   ("qw" (set L ?ᄧ) ?ㅶ)
122   ("qc" (set L ?ᄨ) ?ᄨ)
123   ("qx" (set L ?ᄩ) ?ㅷ)
124   ("Qd" (set L ?ᄬ) ?ㅹ)
125   ("ts" (set L ?ᄮ) ?ㅻ)
126   ("ta" (set L ?ᄱ) ?ᄱ)
127   ("tqr" (set L ?ᄳ) ?ᄳ)
128   ("tT" (set L ?ᄴ) ?ᄴ)
129   ("td" (set L ?ᄵ) ?ᄵ)
130   ("tw" (set L ?ᄶ) ?ㅾ)
131   ("tc" (set L ?ᄷ) ?ᄷ)
132   ("tz" (set L ?ᄸ) ?ᄸ)
133   ("tx" (set L ?ᄹ) ?ᄹ)
134   ("tv" (set L ?ᄺ) ?ᄺ)
135   ("tg" (set L ?ᄻ) ?ᄻ)
136   ("tt" (set L ?ᄼ) ?ᄼ)
137   ("TT" (set L ?ᄽ) ?ᄽ)
138   ("tt/" (set L ?ᄾ) ?ᄾ)
139   ("TT/'" (set L ?ᄿ) ?ᄿ)
140   ("ds" (set L ?ᅂ) ?ᅂ)
141   ("da" (set L ?ᅃ) ?ᅃ)
142   ("dq" (set L ?ᅄ) ?ᅄ)
143   ("D" (set L ?ᅇ) ?ㆀ)
144   ("dw" (set L ?ᅈ) ?ᅈ)
145   ("dc" (set L ?ᅉ) ?ᅉ)
146   ("dx" (set L ?ᅊ) ?ᅊ)
147   ("dv" (set L ?ᅋ) ?ᅋ)
148   ("wd" (set L ?ᅍ) ?ᅍ)
149   ("ww" (set L ?ᅎ) ?ᅎ)
150   ("WW" (set L ?ᅏ) ?ᅏ)
151   ("ww/" (set L ?ᅐ) ?ᅐ)
152   ("WW/" (set L ?ᅑ) ?ᅑ)
153   ("cz" (set L ?ᅒ) ?ᅒ)
154   ("cg" (set L ?ᅓ) ?ᅓ)
155   ("cc" (set L ?ᅔ) ?ᅔ)
156   ("cc/" (set L ?ᅕ) ?ᅕ)
157   ("G" (set L ?ᅘ) ?ㆅ)
158   ("C" (set L ?ᅟ) ?ᅟ))
159
160  (V-head
161   ("y") ("u") ("i") ("o") ("p") ("O") ("P")
162   ("h") ("j") ("k") ("K") ("l")
163   ("b") ("n") ("m"))
164
165  (V
166   ;; Set V to JUNGSEONG.
167   ("k" (set V ?ᅡ) ?ㅏ (compose))
168   ("o" (set V ?ᅢ) ?ㅐ (compose))
169   ("i" (set V ?ᅣ) ?ㅑ (compose))
170   ("O" (set V ?ᅤ) ?ㅒ (compose))
171   ("j" (set V ?ᅥ) ?ㅓ (compose))
172   ("p" (set V ?ᅦ) ?ㅔ (compose))
173   ("u" (set V ?ᅧ) ?ㅕ (compose))
174   ("P" (set V ?ᅨ) ?ㅖ (compose))
175   ("h" (set V ?ᅩ) ?ㅗ (compose))
176   ("hk" (set V ?ᅪ) ?ㅘ (compose))
177   ("ho" (set V ?ᅫ) ?ㅙ (compose))
178   ("hl" (set V ?ᅬ) ?ㅚ (compose))
179   ("y" (set V ?ᅭ) ?ㅛ (compose))
180   ("n" (set V ?ᅮ) ?ㅜ (compose))
181   ("nj" (set V ?ᅯ) ?ㅝ (compose))
182   ("np" (set V ?ᅰ) ?ㅞ (compose))
183   ("nl" (set V ?ᅱ) ?ㅟ (compose))
184   ("b" (set V ?ᅲ) ?ㅠ (compose))
185   ("m" (set V ?ᅳ) ?ㅡ (compose))
186   ("ml" (set V ?ᅴ) ?ㅢ (compose))
187   ("l" (set V ?ᅵ) ?ㅣ (compose))
188   ("kh" (set V ?ᅶ) ?ᅶ (compose))
189   ("kn" (set V ?ᅷ) ?ᅷ (compose))
190   ("ih" (set V ?ᅸ) ?ᅸ (compose))
191   ("iy" (set V ?ᅹ) ?ᅹ (compose))
192   ("jh" (set V ?ᅺ) ?ᅺ (compose))
193   ("jn" (set V ?ᅻ) ?ᅻ (compose))
194   ("jm" (set V ?ᅼ) ?ᅼ (compose))
195   ("uh" (set V ?ᅽ) ?ᅽ (compose))
196   ("un" (set V ?ᅾ) ?ᅾ (compose))
197   ("hj" (set V ?ᅿ) ?ᅿ (compose))
198   ("hp" (set V ?ᆀ) ?ᆀ (compose))
199   ("hP" (set V ?ᆁ) ?ᆁ (compose))
200   ("hh" (set V ?ᆂ) ?ᆂ (compose))
201   ("hn" (set V ?ᆃ) ?ᆃ (compose))
202   ("yi" (set V ?ᆄ) ?ㆇ (compose))
203   ("yO" (set V ?ᆅ) ?ㆈ (compose))
204   ("yu" (set V ?ᆆ) ?ᆆ (compose))
205   ("yh" (set V ?ᆇ) ?ᆇ (compose))
206   ("yl" (set V ?ᆈ) ?ㆉ (compose))
207   ("nk" (set V ?ᆉ) ?ᆉ (compose))
208   ("no" (set V ?ᆊ) ?ᆊ (compose))
209   ("njm" (set V ?ᆋ) ?ᆋ (compose))
210   ("nu" (set V ?ᆌ) ?ᆌ (compose))
211   ("nn" (set V ?ᆍ) ?ᆍ (compose))
212   ("bk" (set V ?ᆎ) ?ᆎ (compose))
213   ("bj" (set V ?ᆏ) ?ᆏ (compose))
214   ("bp" (set V ?ᆐ) ?ᆐ (compose))
215   ("bu" (set V ?ᆑ) ?ㆊ (compose))
216   ("bP" (set V ?ᆒ) ?ㆋ (compose))
217   ("bn" (set V ?ᆓ) ?ᆓ (compose))
218   ("bl" (set V ?ᆔ) ?ㆌ (compose))
219   ("mn" (set V ?ᆕ) ?ᆕ (compose))
220   ("mm" (set V ?ᆖ) ?ᆖ (compose))
221   ("mln" (set V ?ᆗ) ?ᆗ (compose))
222   ("lk" (set V ?ᆘ) ?ᆘ (compose))
223   ("li" (set V ?ᆙ) ?ᆙ (compose))
224   ("lh" (set V ?ᆚ) ?ᆚ (compose))
225   ("ln" (set V ?ᆛ) ?ᆛ (compose))
226   ("lm" (set V ?ᆜ) ?ᆜ (compose))
227   ("lK" (set V ?ᆝ) ?ᆝ (compose))
228   ("K" (set V ?ᆞ) ?ᆞ (compose))
229   ("Kj" (set V ?ᆟ) ?ᆟ (compose))
230   ("Kn" (set V ?ᆠ) ?ᆠ (compose))
231   ("Kl" (set V ?ᆡ) ?ᆡ (compose))
232   ("KK" (set V ?ᆢ) ?ᆢ (compose)))
233
234  (T
235   ;; Set T to JONGSEONG.
236   ("rt" (set T ?ᆪ) ?ㄳ (compose))
237   ("sw" (set T ?ᆬ) ?ᆬ (compose))
238   ("sg" (set T ?ᆭ) ?ᆭ (compose))
239   ("fr" (set T ?ᆰ) ?ㄺ (compose))
240   ("fa" (set T ?ᆱ) ?ㄻ (compose))
241   ("fq" (set T ?ᆲ) ?ㄼ (compose))
242   ("ft" (set T ?ᆳ) ?ㄽ (compose))
243   ("fx" (set T ?ᆴ) ?ㄾ (compose))
244   ("fv" (set T ?ᆵ) ?ㄿ (compose))
245   ("rf" (set T ?ᇃ) ?ᇃ (compose))
246   ("rtr" (set T ?ᇄ) ?ᇄ (compose))
247   ("st" (set T ?ᇇ) ?ㅧ (compose))
248   ("st/" (set T ?ᇈ) ?ㅨ (compose))
249   ("sx" (set T ?ᇉ) ?ᇉ (compose))
250   ("ef" (set T ?ᇋ) ?ᇋ (compose))
251   ("frt" (set T ?ᇌ) ?ᇌ (compose))
252   ("fe" (set T ?ᇎ) ?ㅪ (compose))
253   ("feg" (set T ?ᇏ) ?ᇏ (compose))
254   ("far" (set T ?ᇑ) ?ᇑ (compose))
255   ("fat" (set T ?ᇒ) ?ᇒ (compose))
256   ("fqt" (set T ?ᇓ) ?ㅫ (compose))
257   ("fqg" (set T ?ᇔ) ?ᇔ (compose))
258   ("fqd" (set T ?ᇕ) ?ᇕ (compose))
259   ("ftt" (set T ?ᇖ) ?ᇖ (compose))
260   ("ft/" (set T ?ᇗ) ?ㅬ (compose))
261   ("fz" (set T ?ᇘ) ?ᇘ (compose))
262   ("fmd" (set T ?ᇙ) ?ㅭ (compose))
263   ("ar" (set T ?ᇚ) ?ᇚ (compose))
264   ("af" (set T ?ᇛ) ?ᇛ (compose))
265   ("at" (set T ?ᇝ) ?ㅯ (compose))
266   ("aT" (set T ?ᇞ) ?ᇞ (compose))
267   ("at/" (set T ?ᇟ) ?ㅰ (compose))
268   ("ac" (set T ?ᇠ) ?ᇠ (compose))
269   ("ag" (set T ?ᇡ) ?ᇡ (compose))
270   ("qf" (set T ?ᇣ) ?ᇣ (compose))
271   ("qg" (set T ?ᇥ) ?ᇥ (compose))
272   ("dR" (set T ?ᇭ) ?ᇭ (compose))
273   ("dt/" (set T ?ᇮ) ?ㆃ (compose))
274   ("dz" (set T ?ᇯ) ?ᇯ (compose))
275   ("gs" (set T ?ᇵ) ?ᇵ (compose))
276   ("gf" (set T ?ᇶ) ?ᇶ (compose))
277   ("ga" (set T ?ᇷ) ?ᇷ (compose))
278   ("gq" (set T ?ᇸ) ?ᇸ (compose)))
279
280  (special
281   ("J" (set V ?ᅠ) ?ᅠ (compose)))
282
283  (backspace
284   ((BackSpace) (undo))))
285
286 (state
287  (init
288   (L-or-T (set L L1) (set T 0x11A7) (shift state-L))
289   (L (set T 0x11A7) (shift state-L))
290   (V)
291   (T)
292   (special)
293   (backspace))
294  (state-L
295   (V (shift state-LV))
296   (backspace))
297  (state-LV
298   (L-or-T (shift state-LVL-or-LVT))
299   (T)
300   (backspace))
301  (state-LVL-or-LVT
302   (L-or-T-head (delete @<) (pushback 0) (set L 0) (shift state-fix-LVT))
303   (V-head (delete @<) (pushback 0) (set L 0) (shift state-fix-LV))
304   (backspace))
305  (state-fix-LVT
306   (L-or-T (set L L1) (set T 0x11A7) (shift state-fix-LVT-2))
307   (L (set T 0x11A7) (shift state-fix-LVT-2)))
308  (state-fix-LVT-2
309   (V (shift state-fix-LVT-3)))
310  (state-fix-LVT-3
311   (L-or-T (shift init)))
312  (state-fix-LV
313   (L-or-T (set L L1) (set T 0x11A7) (shift state-fix-LV-2))
314   (L (set T 0x11A7) (shift state-fix-LV-2)))
315  (state-fix-LV-2
316   (V (shift init))))
317
318 ;; Local Variables:
319 ;; coding: utf-8
320 ;; mode: lisp
321 ;; End: