Update copyright year.
[m17n/m17n-db.git] / MIM / unicode.mim
1 ;; unicode.mim -- Input method for Unicode characters by typing character code
2 ;; Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009
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 (input-method t unicode)
25
26 (description (_"Input method for Unicode BMP characters using hexadigits.
27 Type C-u followed by four hexadecimal numbers [0-9A-Fa-f]
28 of a Unicode character code.
29 "))
30
31 (title "UNICODE")
32
33 (variable
34  (prompt (_"Preedit prompt
35 Prompt string shown in the preedit area while typing hexadecimal numbers.")
36          "U+"))
37 (command
38  (start (_"Start Unicode
39 Start typing hexadecimal numbers of Unicode character.")
40         (C-U)))
41
42 (map
43  (starter
44   (start prompt))
45
46  (hex
47   ("0" "0") ("1" "1") ("2" "2") ("3" "3") ("4" "4")
48   ("5" "5") ("6" "6") ("7" "7") ("8" "8") ("9" "9")
49   ("A" "A") ("B" "B") ("C" "C") ("D" "D") ("E" "E") ("F" "F")
50   ("a" "A") ("b" "B") ("c" "C") ("d" "D") ("e" "E") ("f" "F"))
51
52  (backspace
53   ((BackSpace))))
54
55 (state
56  (init
57   (starter (set code 0) (set count 0) (shift uni-hex)))
58
59  (uni-hex
60   (hex (set this @-1)
61        (cond ((< @-1 ?A) (sub this 48))
62              (1 (sub this 55)))
63        (set code (+ (* code 16) this))
64        (set count (+ count 1))
65        (cond ((= count 4)
66               (delete @<) (insert code) (shift init))))
67   (backspace (undo))))
68
69 ;; Local Variables:
70 ;; mode: lisp
71 ;; End: