comparison leim/quail/lao.el @ 58756:592861b6d3c5

(lao-key-alist): Declare it by defvar. (lao-key-alist-vector): New variable. (lao-consonant-key-alist, lao-semivowel-key-alist) (lao-vowel-key-alist, lao-voweltone-key-alist) (lao-tone-key-alist, lao-other-key-alist): Initialize them from lao-key-alist-vector.
author Kenichi Handa <handa@m17n.org>
date Sat, 04 Dec 2004 02:45:47 +0000
parents 695cf19ef79e
children 23a17af379b1 f2ebccfa87d4
comparison
equal deleted inserted replaced
58755:3d69c011b6e1 58756:592861b6d3c5
1 ;;; lao.el --- Quail package for inputting Lao characters -*-coding: iso-2022-7bit;-*- 1 ;;; lao.el --- Quail package for inputting Lao characters -*-coding: iso-2022-7bit;-*-
2 2
3 ;; Copyright (C) 1997 Electrotechnical Laboratory, JAPAN. 3 ;; Copyright (C) 1997 Electrotechnical Laboratory, JAPAN.
4 ;; Licensed to the Free Software Foundation. 4 ;; Licensed to the Free Software Foundation.
5 ;; Copyright (C) 2004
6 ;; National Institute of Advanced Industrial Science and Technology (AIST)
7 ;; Registration Number H14PRO021
5 8
6 ;; Keywords: multilingual, input method, Lao 9 ;; Keywords: multilingual, input method, Lao
7 10
8 ;; This file is part of GNU Emacs. 11 ;; This file is part of GNU Emacs.
9 12
40 (substring quail-current-key control-flag))) 43 (substring quail-current-key control-flag)))
41 (setq quail-current-str 44 (setq quail-current-str
42 (compose-string (quail-lookup-map-and-concat quail-current-key)))) 45 (compose-string (quail-lookup-map-and-concat quail-current-key))))
43 control-flag) 46 control-flag)
44 47
45 (defconst lao-key-alist 48 (defvar lao-key-alist
46 '(("!" . "1") 49 '(("!" . "1")
47 ("\"" . "=") 50 ("\"" . "=")
48 ("#" . "3") 51 ("#" . "3")
49 ("$" . "4") 52 ("$" . "4")
50 ("&" . "5") 53 ("&" . "5")
144 ("\\5" . "(1u(B") 147 ("\\5" . "(1u(B")
145 ("\\6" . "(1v(B") 148 ("\\6" . "(1v(B")
146 ("\\7" . "(1w(B") 149 ("\\7" . "(1w(B")
147 ("\\8" . "(1x(B") 150 ("\\8" . "(1x(B")
148 ("\\9" . "(1y(B") 151 ("\\9" . "(1y(B")
149 )) 152 )
150 153 "Alist of key sequences vs the corresponding Lao string to input.
151 (defconst lao-consonant-key-alist nil) 154 This variable is for the input method \"lao\".
152 (defconst lao-semivowel-key-alist nil) 155 If you change the value of this variable while quail/lao is already loaded,
153 (defconst lao-vowel-key-alist nil) 156 you need to re-load it to properly re-initialize related alists.")
154 (defconst lao-voweltone-key-alist nil) 157
155 (defconst lao-tone-key-alist nil) 158 ;; Temporary variable to initialize lao-consonant-key-alist, etc.
156 (defconst lao-other-key-alist nil) 159 (defconst lao-key-alist-vector
157 160 (let ((tail lao-key-alist)
158 (let ((tail lao-key-alist) 161 consonant-key-alist semivowel-key-alist vowel-key-alist
159 elt phonetic-type) 162 voweltone-key-alist tone-key-alist other-key-alist
160 (while tail 163 elt phonetic-type)
161 (setq elt (car tail) tail (cdr tail)) 164 (while tail
162 (if (stringp (cdr elt)) 165 (setq elt (car tail) tail (cdr tail))
163 (setq phonetic-type (get-char-code-property (aref (cdr elt) 0) 166 (if (stringp (cdr elt))
167 (setq phonetic-type (get-char-code-property (aref (cdr elt) 0)
168 'phonetic-type))
169 (setq phonetic-type (get-char-code-property (aref (aref (cdr elt) 0) 0)
164 'phonetic-type)) 170 'phonetic-type))
165 (setq phonetic-type (get-char-code-property (aref (aref (cdr elt) 0) 0) 171 (aset (cdr elt) 0 (compose-string (aref (cdr elt) 0))))
166 'phonetic-type)) 172 (cond ((eq phonetic-type 'consonant)
167 (aset (cdr elt) 0 (compose-string (aref (cdr elt) 0)))) 173 (setq consonant-key-alist (cons elt consonant-key-alist)))
168 (cond ((eq phonetic-type 'consonant) 174 ((memq phonetic-type '(vowel-upper vowel-lower))
169 (setq lao-consonant-key-alist (cons elt lao-consonant-key-alist))) 175 (if (stringp (cdr elt))
170 ((memq phonetic-type '(vowel-upper vowel-lower)) 176 (setq vowel-key-alist (cons elt vowel-key-alist))
171 (if (stringp (cdr elt)) 177 (setq voweltone-key-alist (cons elt voweltone-key-alist))))
172 (setq lao-vowel-key-alist (cons elt lao-vowel-key-alist)) 178 ((eq phonetic-type 'tone)
173 (setq lao-voweltone-key-alist 179 (setq tone-key-alist (cons elt tone-key-alist)))
174 (cons elt lao-voweltone-key-alist)))) 180 ((eq phonetic-type 'semivowel-lower)
175 ((eq phonetic-type 'tone) 181 (setq semivowel-key-alist (cons elt semivowel-key-alist)))
176 (setq lao-tone-key-alist (cons elt lao-tone-key-alist))) 182 (t
177 ((eq phonetic-type 'semivowel-lower) 183 (setq other-key-alist (cons elt other-key-alist)))))
178 (setq lao-semivowel-key-alist (cons elt lao-semivowel-key-alist))) 184 (vector consonant-key-alist semivowel-key-alist vowel-key-alist
179 (t 185 voweltone-key-alist tone-key-alist other-key-alist)))
180 (setq lao-other-key-alist (cons elt lao-other-key-alist)))))) 186
187 (defconst lao-consonant-key-alist (aref lao-key-alist-vector 0))
188 (defconst lao-semivowel-key-alist (aref lao-key-alist-vector 1))
189 (defconst lao-vowel-key-alist (aref lao-key-alist-vector 2))
190 (defconst lao-voweltone-key-alist (aref lao-key-alist-vector 3))
191 (defconst lao-tone-key-alist (aref lao-key-alist-vector 4))
192 (defconst lao-other-key-alist (aref lao-key-alist-vector 5))
193
194 ;; Done with it.
195 (makunbound 'lao-key-alist-vector)
181 196
182 (quail-define-package 197 (quail-define-package
183 "lao" "Lao" "(1E(B" t 198 "lao" "Lao" "(1E(B" t
184 "Lao input method simulating Lao keyboard layout based on Thai TIS620" 199 "Lao input method simulating Lao keyboard layout based on Thai TIS620"
185 nil t t t t nil nil nil 'quail-lao-update-translation nil t) 200 nil t t t t nil nil nil 'quail-lao-update-translation nil t)