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