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