Update AIST copyright years.
[bpt/emacs.git] / leim / quail / lao.el
1 ;;; lao.el --- Quail package for inputting Lao characters -*-coding: iso-2022-7bit;-*-
2
3 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
4 ;; National Institute of Advanced Industrial Science and Technology (AIST)
5 ;; Registration Number H14PRO021
6
7 ;; Keywords: multilingual, input method, Lao
8
9 ;; This file is part of GNU Emacs.
10
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; any later version.
15
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
20
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 ;; Boston, MA 02110-1301, USA.
25
26 ;;; Commentary:
27
28 ;;; Code:
29
30 (require 'quail)
31 (require 'lao-util)
32
33 (defun quail-lao-update-translation (control-flag)
34 (if (integerp control-flag)
35 ;; Non-composable character typed.
36 (setq quail-current-str
37 (buffer-substring (overlay-start quail-overlay)
38 (overlay-end quail-overlay))
39 unread-command-events
40 (string-to-list
41 (substring quail-current-key control-flag)))
42 (setq quail-current-str
43 (compose-string (quail-lookup-map-and-concat quail-current-key))))
44 control-flag)
45
46 (defvar lao-key-alist
47 '(("!" . "1")
48 ("\"" . "=")
49 ("#" . "3")
50 ("$" . "4")
51 ("&" . "5")
52 ("%" . "\e(1l\e(B")
53 ("'" . "\e(1'\e(B")
54 ("(" . "7")
55 (")" . "8")
56 ("*" . "6")
57 ("+" . ["\e(1mh\e(B"])
58 ("," . "\e(1A\e(B")
59 ("-" . "\e(1*\e(B")
60 ("." . "\e(1c\e(B")
61 ("/" . "\e(1=\e(B")
62 ("0" . "\e(1"\e(B")
63 ("1" . "\e(1B\e(B")
64 ("2" . "\e(1?\e(B")
65 ("3" . "\e(1b\e(B")
66 ("4" . "\e(16\e(B")
67 ("5" . "\e(1X\e(B")
68 ("6" . "\e(1Y\e(B")
69 ("7" . "\e(1$\e(B")
70 ("8" . "\e(15\e(B")
71 ("9" . "\e(1(\e(B")
72 (":" . "%")
73 (";" . "\e(1G\e(B")
74 ("<" . "\e(1}\e(B")
75 ("=" . "\e(1m\e(B")
76 (">" . "$")
77 ("?" . ")")
78 ("@" . "2")
79 ("A" . ["\e(1Qi\e(B"])
80 ("B" . ["\e(1Vi\e(B"])
81 ("C" . "\e(1O\e(B")
82 ("D" . ".")
83 ("E" . ["\e(1Si\e(B"])
84 ("F" . ",")
85 ("G" . ":")
86 ("H" . "\e(1j\e(B")
87 ("I" . "\e(1N\e(B")
88 ("J" . "\e(1k\e(B")
89 ("K" . "!")
90 ("L" . "?")
91 ("M" . "\e(1f\e(B")
92 ("N" . ["\e(1Wi\e(B"])
93 ("O" . "\e(1|\e(B")
94 ("P" . "\e(1]\e(B")
95 ("Q" . ["\e(1[i\e(B"])
96 ("R" . "_")
97 ("S" . ";")
98 ("T" . "+")
99 ("U" . ["\e(1Ui\e(B"])
100 ("V" . "x")
101 ("W" . "0")
102 ("X" . "(")
103 ("Y" . ["\e(1Ti\e(B"])
104 ("Z" . "\"")
105 ("[" . "\e(1:\e(B")
106 ("]" . "\e(1E\e(B")
107 ("^" . "\e(1\\e(B")
108 ("_" . "9")
109 ("`" . "\e(1'\e(B")
110 ("a" . "\e(1Q\e(B")
111 ("b" . "\e(1V\e(B")
112 ("c" . "\e(1a\e(B")
113 ("d" . "\e(1!\e(B")
114 ("e" . "\e(1S\e(B")
115 ("f" . "\e(14\e(B")
116 ("g" . "\e(1`\e(B")
117 ("h" . "\e(1i\e(B")
118 ("i" . "\e(1C\e(B")
119 ("j" . "\e(1h\e(B")
120 ("k" . "\e(1R\e(B")
121 ("l" . "\e(1J\e(B")
122 ("m" . "\e(17\e(B")
123 ("n" . "\e(1W\e(B")
124 ("o" . "\e(19\e(B")
125 ("p" . "\e(1-\e(B")
126 ("q" . "\e(1[\e(B")
127 ("r" . "\e(1>\e(B")
128 ("s" . "\e(1K\e(B")
129 ("t" . "\e(1P\e(B")
130 ("u" . "\e(1U\e(B")
131 ("v" . "\e(1M\e(B")
132 ("w" . "\e(1d\e(B")
133 ("x" . "\e(1;\e(B")
134 ("y" . "\e(1T\e(B")
135 ("z" . "\e(1<\e(B")
136 ("{" . "-")
137 ("|" . ["\e(1K\\e(B"])
138 ("}" . "/")
139 ("~" . "\e(1l\e(B")
140 ("\\0" . "\e(1p\e(B")
141 ("\\1" . "\e(1q\e(B")
142 ("\\2" . "\e(1r\e(B")
143 ("\\3" . "\e(1s\e(B")
144 ("\\4" . "\e(1t\e(B")
145 ("\\5" . "\e(1u\e(B")
146 ("\\6" . "\e(1v\e(B")
147 ("\\7" . "\e(1w\e(B")
148 ("\\8" . "\e(1x\e(B")
149 ("\\9" . "\e(1y\e(B")
150 )
151 "Alist of key sequences vs the corresponding Lao string to input.
152 This variable is for the input method \"lao\".
153 If you change the value of this variable while quail/lao is already loaded,
154 you need to re-load it to properly re-initialize related alists.")
155
156 ;; Temporary variable to initialize lao-consonant-key-alist, etc.
157 (defconst lao-key-alist-vector
158 (let ((tail lao-key-alist)
159 consonant-key-alist semivowel-key-alist vowel-key-alist
160 voweltone-key-alist tone-key-alist other-key-alist
161 elt phonetic-type)
162 (while tail
163 (setq elt (car tail) tail (cdr tail))
164 (if (stringp (cdr elt))
165 (setq phonetic-type (get-char-code-property (aref (cdr elt) 0)
166 'phonetic-type))
167 (setq phonetic-type (get-char-code-property (aref (aref (cdr elt) 0) 0)
168 'phonetic-type))
169 (aset (cdr elt) 0 (compose-string (aref (cdr elt) 0))))
170 (cond ((eq phonetic-type 'consonant)
171 (setq consonant-key-alist (cons elt consonant-key-alist)))
172 ((memq phonetic-type '(vowel-upper vowel-lower))
173 (if (stringp (cdr elt))
174 (setq vowel-key-alist (cons elt vowel-key-alist))
175 (setq voweltone-key-alist (cons elt voweltone-key-alist))))
176 ((eq phonetic-type 'tone)
177 (setq tone-key-alist (cons elt tone-key-alist)))
178 ((eq phonetic-type 'semivowel-lower)
179 (setq semivowel-key-alist (cons elt semivowel-key-alist)))
180 (t
181 (setq other-key-alist (cons elt other-key-alist)))))
182 (vector consonant-key-alist semivowel-key-alist vowel-key-alist
183 voweltone-key-alist tone-key-alist other-key-alist)))
184
185 (defconst lao-consonant-key-alist (aref lao-key-alist-vector 0))
186 (defconst lao-semivowel-key-alist (aref lao-key-alist-vector 1))
187 (defconst lao-vowel-key-alist (aref lao-key-alist-vector 2))
188 (defconst lao-voweltone-key-alist (aref lao-key-alist-vector 3))
189 (defconst lao-tone-key-alist (aref lao-key-alist-vector 4))
190 (defconst lao-other-key-alist (aref lao-key-alist-vector 5))
191
192 ;; Done with it.
193 (makunbound 'lao-key-alist-vector)
194
195 (quail-define-package
196 "lao" "Lao" "\e(1E\e(B" t
197 "Lao input method simulating Lao keyboard layout based on Thai TIS620"
198 nil t t t t nil nil nil 'quail-lao-update-translation nil t)
199
200 (quail-install-map
201 (quail-map-from-table
202 '((base-state (lao-consonant-key-alist . svt-state)
203 lao-vowel-key-alist
204 lao-voweltone-key-alist
205 lao-tone-key-alist
206 lao-other-key-alist)
207 (svt-state (lao-semivowel-key-alist . v-state)
208 (lao-vowel-key-alist . t-state)
209 lao-voweltone-key-alist)
210 (v-state (lao-vowel-key-alist . t-state))
211 (t-state lao-tone-key-alist))))
212
213 ;;; arch-tag: 23863a30-a8bf-402c-b7ce-c517a7aa8570
214 ;;; lao.el ends here