1 ;;; quail/lao.el --- Quail package for inputting Lao characters
3 ;; Copyright (C) 1997 Electrotechnical Laboratory, JAPAN.
4 ;; Licensed to the Free Software Foundation.
6 ;; Keywords: multilingual, input method, Lao
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
32 (defconst lao-keyboard-mapping
33 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; control codes
34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; control codes
35 0 "1" "=" "3" "4" "
\e(1l
\e(B" "5" "
\e(1'
\e(B" ; SPC .. '
36 "7" "8" "6" "
\e(1mh
\e(B" "
\e(1A
\e(B" "9" "
\e(1c
\e(B" "
\e(1=
\e(B" ; ( .. /
37 "
\e(1"
\e(B" "
\e(1B
\e(B" "
\e(1?
\e(B" "
\e(1b
\e(B" "
\e(16
\e(B" "
\e(1X
\e(B" "
\e(1Y
\e(B" "
\e(1$
\e(B" ; 0 .. 7
38 "
\e(15
\e(B" "
\e(1(
\e(B" "%" "
\e(1G
\e(B" "
\e(1}
\e(B" "
\e(1m
\e(B" ">" "\)" ; 8 .. ?
39 "2" "
\e(1Qi
\e(B" "
\e(1Vi
\e(B" "
\e(1O
\e(B" "." "
\e(1Si
\e(B" "," ":" ; @ .. G
40 "
\e(1j
\e(B" "
\e(1N
\e(B" "
\e(1k
\e(B" "!" "?" "
\e(1f
\e(B" "
\e(1Wi
\e(B" "
\e(1|
\e(B" ; H .. O
41 "
\e(1]
\e(B" "
\e(1[i
\e(B" "_" ";" "+" "
\e(1Ui
\e(B" "x" "0" ; P .. W
42 "\(" "
\e(1Ti
\e(B" "\"" "
\e(1:
\e(B" 0 "
\e(1E
\e(B" "
\e(1\
\e(B" "
\e(1*
\e(B" ; X .. _
43 "
\e(1'
\e(B" "
\e(1Q
\e(B" "
\e(1V
\e(B" "
\e(1a
\e(B" "
\e(1!
\e(B" "
\e(1S
\e(B" "
\e(14
\e(B" "
\e(1`
\e(B" ; ` .. g
44 "
\e(1i
\e(B" "
\e(1C
\e(B" "
\e(1h
\e(B" "
\e(1R
\e(B" "
\e(1J
\e(B" "
\e(17
\e(B" "
\e(1W
\e(B" "
\e(19
\e(B" ; h .. o
45 "
\e(1-
\e(B" "
\e(1[
\e(B" "
\e(1>
\e(B" "
\e(1K
\e(B" "
\e(1P
\e(B" "
\e(1U
\e(B" "
\e(1M
\e(B" "
\e(1d
\e(B" ; p .. w
46 "
\e(1;
\e(B" "
\e(1T
\e(B" "
\e(1<
\e(B" "-" "
\e(1K\
\e(B" "/" "~" 0] ; x .. DEL
47 "A table which maps ASCII key codes to corresponding Lao characters."
52 ;; Template of a cdr part of a Quail map when a consonant is entered.
53 (defvar lao-consonant-alist nil)
54 ;; Template of a cdr part of a Quail map when a vowel upper is entered.
55 (defvar lao-vowel-upper-alist nil)
56 ;; Template of a cdr part of a Quail map when a vowel lower is entered.
57 (defvar lao-vowel-lower-alist nil)
58 ;; Template of a cdr part of a Quail map when a semivowel lower is entered.
59 (defvar lao-semivowel-lower-alist nil)
61 ;; Return a Quail map corresponding to KEY of length LEN.
62 ;; The car part of the map is a translation generated automatically.
63 ;; The cdr part of the map is a copy of ALIST.
64 (defun lao-generate-quail-map (key len alist)
68 (setq str (concat str (aref lao-keyboard-mapping (aref key idx)))
70 (cons (string-to-char (compose-string str)) (copy-alist alist))))
72 ;; Return a Quail map corresponding to KEY of length LEN when Lao
73 ;; tone mark is entered.
74 (defun lao-tone-input (key len)
75 (lao-generate-quail-map key len nil))
77 ;; Return a Quail map corresponding to KEY of length LEN when Lao
78 ;; vowel upper is entered.
79 (defun lao-vowel-upper-input (key len)
80 (lao-generate-quail-map key len lao-vowel-upper-alist))
82 ;; Return a Quail map corresponding to KEY of length LEN when Lao
83 ;; vowel lower is entered.
84 (defun lao-vowel-lower-input (key len)
85 (lao-generate-quail-map key len lao-vowel-lower-alist))
87 ;; Return a Quail map corresponding to KEY of length LEN when Lao
88 ;; semivowel lower is entered.
89 (defun lao-semivowel-lower-input (key len)
90 (lao-generate-quail-map key len lao-semivowel-lower-alist))
92 ;; Return an alist which can be a cdr part of a Quail map
93 ;; corresponding to the current key when Lao consonant is entered.
94 (defun lao-consonant-input (key len)
95 (copy-alist lao-consonant-alist))
98 "lao" "Lao" "
\e(1"
\e(B" t
99 "Lao input method simulating Lao keyboard layout based on Thai TIS620"
102 (defmacro lao-quail-define-rules (&rest rules)
107 semivowel-lower-alist
111 (setq trans (nth 1 rule))
113 (setq trans (car trans)))
114 (setq c-set (char-category-set (string-to-char trans)))
115 (cond ((aref c-set ?2) ; vowel upper
116 (setq consonant-alist
117 (cons (cons (string-to-char (car rule))
118 'lao-vowel-upper-input)
120 ((aref c-set ?3) ; vowel lower
121 (setq consonant-alist
122 (cons (cons (string-to-char (car rule))
123 'lao-vowel-lower-input)
125 semivowel-lower-alist
126 (cons (cons (string-to-char (car rule))
127 'lao-vowel-lower-input)
128 semivowel-lower-alist)))
129 ((aref c-set ?4) ; tone
130 (setq consonant-alist
131 (cons (cons (string-to-char (car rule))
135 (cons (cons (string-to-char (car rule))
139 (cons (cons (string-to-char (car rule))
142 ((aref c-set ?9) ; semivowel lower
143 (setq consonant-alist
144 (cons (cons (string-to-char (car rule))
145 'lao-semivowel-lower-input)
148 (cons (cons (string-to-char (car rule))
149 'lao-semivowel-lower-input)
150 vowel-upper-alist))))
153 (cons 'quail-define-rules rules)
154 `(setq lao-consonant-alist ',consonant-alist
155 lao-vowel-upper-alist ',vowel-upper-alist
156 lao-vowel-lower-alist ',vowel-lower-alist
157 lao-semivowel-lower-alist ',semivowel-lower-alist))))
159 (lao-quail-define-rules
166 ("'" ("
\e(1'
\e(B" . lao-consonant-input))
170 ("+" "
\e0
\e(1mh
\e1
\e(B")
171 ("," ("
\e(1A
\e(B" . lao-consonant-input))
174 ("/" ("
\e(1=
\e(B" . lao-consonant-input))
175 ("0" ("
\e(1"
\e(B" . lao-consonant-input))
176 ("1" ("
\e(1B
\e(B" . lao-consonant-input))
177 ("2" ("
\e(1?
\e(B" . lao-consonant-input))
179 ("4" ("
\e(16
\e(B" . lao-consonant-input))
182 ("7" ("
\e(1$
\e(B" . lao-consonant-input))
183 ("8" ("
\e(15
\e(B" . lao-consonant-input))
184 ("9" ("
\e(1(
\e(B" . lao-consonant-input))
186 (";" ("
\e(1G
\e(B" . lao-consonant-input))
187 ("<" ("
\e(1}
\e(B" . lao-consonant-input))
192 ("A" "
\e0
\e(1Qi
\e1
\e(B")
193 ("B" "
\e0
\e(1Vi
\e1
\e(B")
196 ("E" "
\e0
\e(1Si
\e1
\e(B")
200 ("I" ("
\e(1N
\e(B" . lao-consonant-input))
205 ("N" "
\e0
\e(1Wi
\e1
\e(B")
206 ("O" ("
\e(1|
\e(B" . lao-consonant-input))
208 ("Q" "
\e0
\e(1[i
\e1
\e(B")
212 ("U" "
\e0
\e(1Ui
\e1
\e(B")
216 ("Y" "
\e0
\e(1Ti
\e1
\e(B")
218 ("[" ("
\e(1:
\e(B" . lao-consonant-input))
219 ("]" ("
\e(1E
\e(B" . lao-consonant-input))
221 ("_" ("
\e(1*
\e(B" . lao-consonant-input))
222 ("`" ("
\e(1'
\e(B" . lao-consonant-input))
226 ("d" ("
\e(1!
\e(B" . lao-consonant-input))
228 ("f" ("
\e(14
\e(B" . lao-consonant-input))
231 ("i" ("
\e(1C
\e(B" . lao-consonant-input))
234 ("l" ("
\e(1J
\e(B" . lao-consonant-input))
235 ("m" ("
\e(17
\e(B" . lao-consonant-input))
237 ("o" ("
\e(19
\e(B" . lao-consonant-input))
238 ("p" ("
\e(1-
\e(B" . lao-consonant-input))
240 ("r" ("
\e(1>
\e(B" . lao-consonant-input))
241 ("s" ("
\e(1K
\e(B" . lao-consonant-input))
244 ("v" ("
\e(1M
\e(B" . lao-consonant-input))
246 ("x" ("
\e(1;
\e(B" . lao-consonant-input))
248 ("z" ("
\e(1<
\e(B" . lao-consonant-input))
250 ("|" ("
\e0
\e(1K\
\e1
\e(B" . lao-consonant-input))
266 ;;; quail/lao.el ends here