*** empty log message ***
[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 ;;; @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  (L
122   ;; Set L to CHOSEONG.
123   ("E" (set L ?ᄄ) ?ㄸ)
124   ("Q" (set L ?ᄈ) ?ㅃ)
125   ("W" (set L ?ᄍ) ?ㅉ)
126   ("S" (set L ?ᄔ) ?ㅥ)
127   ("sq" (set L ?ᄖ) ?ᄖ)
128   ("fd" (set L ?ᄛ) ?ᄛ)
129   ("qr" (set L ?ᄞ) ?ㅲ)
130   ("qs" (set L ?ᄟ) ?ᄟ)
131   ("qe" (set L ?ᄠ) ?ㅳ)
132   ("qtr" (set L ?ᄢ) ?ㅴ)
133   ("qte" (set L ?ᄣ) ?ㅵ)
134   ("qtq" (set L ?ᄤ) ?ᄤ)
135   ("qtt" (set L ?ᄥ) ?ᄥ)
136   ("qtw" (set L ?ᄦ) ?ᄦ)
137   ("qw" (set L ?ᄧ) ?ㅶ)
138   ("qc" (set L ?ᄨ) ?ᄨ)
139   ("qx" (set L ?ᄩ) ?ㅷ)
140   ("Qd" (set L ?ᄬ) ?ㅹ)
141   ("ts" (set L ?ᄮ) ?ㅻ)
142   ("ta" (set L ?ᄱ) ?ᄱ)
143   ("tqr" (set L ?ᄳ) ?ᄳ)
144   ("tT" (set L ?ᄴ) ?ᄴ)
145   ("td" (set L ?ᄵ) ?ᄵ)
146   ("tw" (set L ?ᄶ) ?ㅾ)
147   ("tc" (set L ?ᄷ) ?ᄷ)
148   ("tz" (set L ?ᄸ) ?ᄸ)
149   ("tx" (set L ?ᄹ) ?ᄹ)
150   ("tv" (set L ?ᄺ) ?ᄺ)
151   ("tg" (set L ?ᄻ) ?ᄻ)
152   ("tt" (set L ?ᄼ) ?ᄼ)
153   ("TT" (set L ?ᄽ) ?ᄽ)
154   ("tt/" (set L ?ᄾ) ?ᄾ)
155   ("TT/'" (set L ?ᄿ) ?ᄿ)
156   ("ds" (set L ?ᅂ) ?ᅂ)
157   ("da" (set L ?ᅃ) ?ᅃ)
158   ("dq" (set L ?ᅄ) ?ᅄ)
159   ("D" (set L ?ᅇ) ?ㆀ)
160   ("dw" (set L ?ᅈ) ?ᅈ)
161   ("dc" (set L ?ᅉ) ?ᅉ)
162   ("dx" (set L ?ᅊ) ?ᅊ)
163   ("dv" (set L ?ᅋ) ?ᅋ)
164   ("wd" (set L ?ᅍ) ?ᅍ)
165   ("ww" (set L ?ᅎ) ?ᅎ)
166   ("WW" (set L ?ᅏ) ?ᅏ)
167   ("ww/" (set L ?ᅐ) ?ᅐ)
168   ("WW/" (set L ?ᅑ) ?ᅑ)
169   ("cz" (set L ?ᅒ) ?ᅒ)
170   ("cg" (set L ?ᅓ) ?ᅓ)
171   ("cc" (set L ?ᅔ) ?ᅔ)
172   ("cc/" (set L ?ᅕ) ?ᅕ)
173   ("G" (set L ?ᅘ) ?ㆅ)
174   ("C" (set L ?ᅟ) ?ᅟ))
175
176  (V-head
177   ("y") ("u") ("i") ("o") ("p") ("O") ("P")
178   ("h") ("j") ("k") ("K") ("l")
179   ("b") ("n") ("m"))
180
181  (V
182   ;; Set V to JUNGSEONG.
183   ("k" (set V ?ᅡ) ?ㅏ (compose))
184   ("o" (set V ?ᅢ) ?ㅐ (compose))
185   ("i" (set V ?ᅣ) ?ㅑ (compose))
186   ("O" (set V ?ᅤ) ?ㅒ (compose))
187   ("j" (set V ?ᅥ) ?ㅓ (compose))
188   ("p" (set V ?ᅦ) ?ㅔ (compose))
189   ("u" (set V ?ᅧ) ?ㅕ (compose))
190   ("P" (set V ?ᅨ) ?ㅖ (compose))
191   ("h" (set V ?ᅩ) ?ㅗ (compose))
192   ("hk" (set V ?ᅪ) ?ㅘ (compose))
193   ("ho" (set V ?ᅫ) ?ㅙ (compose))
194   ("hl" (set V ?ᅬ) ?ㅚ (compose))
195   ("y" (set V ?ᅭ) ?ㅛ (compose))
196   ("n" (set V ?ᅮ) ?ㅜ (compose))
197   ("nj" (set V ?ᅯ) ?ㅝ (compose))
198   ("np" (set V ?ᅰ) ?ㅞ (compose))
199   ("nl" (set V ?ᅱ) ?ㅟ (compose))
200   ("b" (set V ?ᅲ) ?ㅠ (compose))
201   ("m" (set V ?ᅳ) ?ㅡ (compose))
202   ("ml" (set V ?ᅴ) ?ㅢ (compose))
203   ("l" (set V ?ᅵ) ?ㅣ (compose))
204   ("kh" (set V ?ᅶ) ?ᅶ (compose))
205   ("kn" (set V ?ᅷ) ?ᅷ (compose))
206   ("ih" (set V ?ᅸ) ?ᅸ (compose))
207   ("iy" (set V ?ᅹ) ?ᅹ (compose))
208   ("jh" (set V ?ᅺ) ?ᅺ (compose))
209   ("jn" (set V ?ᅻ) ?ᅻ (compose))
210   ("jm" (set V ?ᅼ) ?ᅼ (compose))
211   ("uh" (set V ?ᅽ) ?ᅽ (compose))
212   ("un" (set V ?ᅾ) ?ᅾ (compose))
213   ("hj" (set V ?ᅿ) ?ᅿ (compose))
214   ("hp" (set V ?ᆀ) ?ᆀ (compose))
215   ("hP" (set V ?ᆁ) ?ᆁ (compose))
216   ("hh" (set V ?ᆂ) ?ᆂ (compose))
217   ("hn" (set V ?ᆃ) ?ᆃ (compose))
218   ("yi" (set V ?ᆄ) ?ㆇ (compose))
219   ("yO" (set V ?ᆅ) ?ㆈ (compose))
220   ("yu" (set V ?ᆆ) ?ᆆ (compose))
221   ("yh" (set V ?ᆇ) ?ᆇ (compose))
222   ("yl" (set V ?ᆈ) ?ㆉ (compose))
223   ("nk" (set V ?ᆉ) ?ᆉ (compose))
224   ("no" (set V ?ᆊ) ?ᆊ (compose))
225   ("njm" (set V ?ᆋ) ?ᆋ (compose))
226   ("nu" (set V ?ᆌ) ?ᆌ (compose))
227   ("nn" (set V ?ᆍ) ?ᆍ (compose))
228   ("bk" (set V ?ᆎ) ?ᆎ (compose))
229   ("bj" (set V ?ᆏ) ?ᆏ (compose))
230   ("bp" (set V ?ᆐ) ?ᆐ (compose))
231   ("bu" (set V ?ᆑ) ?ㆊ (compose))
232   ("bP" (set V ?ᆒ) ?ㆋ (compose))
233   ("bn" (set V ?ᆓ) ?ᆓ (compose))
234   ("bl" (set V ?ᆔ) ?ㆌ (compose))
235   ("mn" (set V ?ᆕ) ?ᆕ (compose))
236   ("mm" (set V ?ᆖ) ?ᆖ (compose))
237   ("mln" (set V ?ᆗ) ?ᆗ (compose))
238   ("lk" (set V ?ᆘ) ?ᆘ (compose))
239   ("li" (set V ?ᆙ) ?ᆙ (compose))
240   ("lh" (set V ?ᆚ) ?ᆚ (compose))
241   ("ln" (set V ?ᆛ) ?ᆛ (compose))
242   ("lm" (set V ?ᆜ) ?ᆜ (compose))
243   ("lK" (set V ?ᆝ) ?ᆝ (compose))
244   ("K" (set V ?ᆞ) ?ᆞ (compose))
245   ("Kj" (set V ?ᆟ) ?ᆟ (compose))
246   ("Kn" (set V ?ᆠ) ?ᆠ (compose))
247   ("Kl" (set V ?ᆡ) ?ᆡ (compose))
248   ("KK" (set V ?ᆢ) ?ᆢ (compose)))
249
250  (T
251   ;; Set T to JONGSEONG.
252   ("rt" (set T ?ᆪ) ?ㄳ (compose))
253   ("sw" (set T ?ᆬ) ?ᆬ (compose))
254   ("sg" (set T ?ᆭ) ?ᆭ (compose))
255   ("fr" (set T ?ᆰ) ?ㄺ (compose))
256   ("fa" (set T ?ᆱ) ?ㄻ (compose))
257   ("fq" (set T ?ᆲ) ?ㄼ (compose))
258   ("ft" (set T ?ᆳ) ?ㄽ (compose))
259   ("fx" (set T ?ᆴ) ?ㄾ (compose))
260   ("fv" (set T ?ᆵ) ?ㄿ (compose))
261   ("rf" (set T ?ᇃ) ?ᇃ (compose))
262   ("rtr" (set T ?ᇄ) ?ᇄ (compose))
263   ("st" (set T ?ᇇ) ?ㅧ (compose))
264   ("st/" (set T ?ᇈ) ?ㅨ (compose))
265   ("sx" (set T ?ᇉ) ?ᇉ (compose))
266   ("ef" (set T ?ᇋ) ?ᇋ (compose))
267   ("frt" (set T ?ᇌ) ?ᇌ (compose))
268   ("fe" (set T ?ᇎ) ?ㅪ (compose))
269   ("feg" (set T ?ᇏ) ?ᇏ (compose))
270   ("far" (set T ?ᇑ) ?ᇑ (compose))
271   ("fat" (set T ?ᇒ) ?ᇒ (compose))
272   ("fqt" (set T ?ᇓ) ?ㅫ (compose))
273   ("fqg" (set T ?ᇔ) ?ᇔ (compose))
274   ("fqd" (set T ?ᇕ) ?ᇕ (compose))
275   ("ftt" (set T ?ᇖ) ?ᇖ (compose))
276   ("ft/" (set T ?ᇗ) ?ㅬ (compose))
277   ("fz" (set T ?ᇘ) ?ᇘ (compose))
278   ("fMd" (set T ?ᇙ) ?ㅭ (compose))
279   ("ar" (set T ?ᇚ) ?ᇚ (compose))
280   ("af" (set T ?ᇛ) ?ᇛ (compose))
281   ("at" (set T ?ᇝ) ?ㅯ (compose))
282   ("aT" (set T ?ᇞ) ?ᇞ (compose))
283   ("at/" (set T ?ᇟ) ?ㅰ (compose))
284   ("ac" (set T ?ᇠ) ?ᇠ (compose))
285   ("ag" (set T ?ᇡ) ?ᇡ (compose))
286   ("qf" (set T ?ᇣ) ?ᇣ (compose))
287   ("qg" (set T ?ᇥ) ?ᇥ (compose))
288   ("dR" (set T ?ᇭ) ?ᇭ (compose))
289   ("dt/" (set T ?ᇮ) ?ㆃ (compose))
290   ("dz" (set T ?ᇯ) ?ᇯ (compose))
291   ("gs" (set T ?ᇵ) ?ᇵ (compose))
292   ("gf" (set T ?ᇶ) ?ᇶ (compose))
293   ("ga" (set T ?ᇷ) ?ᇷ (compose))
294   ("gq" (set T ?ᇸ) ?ᇸ (compose)))
295
296  (special
297   ("J" (set V ?ᅠ) ?ᅠ (compose)))
298
299  (backspace
300   ((BackSpace) (cond ((> @@ 1) (undo)) (1 (unhandle))))))
301
302 (state
303  (init
304   ;; This is to suppress compose action.
305   (t (set L 0))
306   (L-or-T (set L L1) (set T 0x11A7) (shift state-L))
307   (L (set T 0x11A7) (shift state-L))
308   (V)
309   (T)
310   (special)
311   (backspace))
312  (state-L
313   (V (shift state-LV))
314   (backspace))
315  (state-LV
316   (L-or-T (shift state-LVL-or-LVT))
317   (T)
318   (backspace))
319  (state-LVL-or-LVT
320   (L-or-T-head (delete @<) (pushback 0) (set L 0) (shift state-fix-LVT))
321   (V-head (delete @<) (pushback 0) (set L 0) (shift state-fix-LV))
322   (backspace))
323  (state-fix-LVT
324   (L-or-T (set L L1) (set T 0x11A7) (shift state-fix-LVT-2))
325   (L (set T 0x11A7) (shift state-fix-LVT-2)))
326  (state-fix-LVT-2
327   (V (shift state-fix-LVT-3)))
328  (state-fix-LVT-3
329   (L-or-T (shift init)))
330  (state-fix-LV
331   (L-or-T (set L L1) (set T 0x11A7) (shift state-fix-LV-2))
332   (L (set T 0x11A7) (shift state-fix-LV-2)))
333  (state-fix-LV-2
334   (V (shift init))))
335
336 ;; Local Variables:
337 ;; coding: utf-8
338 ;; mode: lisp
339 ;; End: