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