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