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