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