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