Commit | Line | Data |
---|---|---|
24b31c88 KH |
1 | ;;; quail/lao.el --- Quail package for inputting Lao characters |
2 | ||
3 | ;; Copyright (C) 1997 Electrotechnical Laboratory, JAPAN. | |
4 | ;; Licensed to the Free Software Foundation. | |
5 | ||
6 | ;; Keywords: multilingual, input method, Lao | |
7 | ||
8 | ;; This file is part of GNU Emacs. | |
9 | ||
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) | |
13 | ;; any later version. | |
14 | ||
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. | |
19 | ||
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. | |
24 | ||
25 | ;;; Code: | |
26 | ||
27 | (require 'quail) | |
28 | (require 'lao-util) | |
29 | ||
653b6bad KH |
30 | (defun quail-lao-update-translation (control-flag) |
31 | (if (integerp control-flag) | |
32 | ;; Non-composable character typed. | |
33 | (setq quail-current-str | |
34 | (buffer-substring (overlay-start quail-overlay) | |
35 | (overlay-end quail-overlay)) | |
36 | unread-command-events | |
37 | (string-to-list | |
38 | (substring quail-current-key control-flag))) | |
39 | (setq quail-current-str | |
40 | (compose-string (quail-lookup-map-and-concat quail-current-key)))) | |
41 | control-flag) | |
42 | ||
43 | (defconst lao-key-alist | |
44 | '(("!" . "1") | |
45 | ("\"" . "=") | |
46 | ("#" . "3") | |
47 | ("$" . "4") | |
48 | ("&" . "5") | |
49 | ("%" . "\e(1l\e(B") | |
50 | ("'" . "\e(1'\e(B") | |
51 | ("(" . "7") | |
52 | (")" . "8") | |
53 | ("*" . "6") | |
54 | ("+" . ["\e(1mh\e(B"]) | |
55 | ("," . "\e(1A\e(B") | |
56 | ("-" . "\e(1*\e(B") | |
57 | ("." . "\e(1c\e(B") | |
58 | ("/" . "\e(1=\e(B") | |
59 | ("0" . "\e(1"\e(B") | |
60 | ("1" . "\e(1B\e(B") | |
61 | ("2" . "\e(1?\e(B") | |
62 | ("3" . "\e(1b\e(B") | |
63 | ("4" . "\e(16\e(B") | |
64 | ("5" . "\e(1X\e(B") | |
65 | ("6" . "\e(1Y\e(B") | |
66 | ("7" . "\e(1$\e(B") | |
67 | ("8" . "\e(15\e(B") | |
68 | ("9" . "\e(1(\e(B") | |
69 | (":" . "%") | |
70 | (";" . "\e(1G\e(B") | |
71 | ("<" . "\e(1}\e(B") | |
72 | ("=" . "\e(1m\e(B") | |
73 | (">" . "$") | |
74 | ("?" . ")") | |
75 | ("@" . "2") | |
76 | ("A" . ["\e(1Qi\e(B"]) | |
77 | ("B" . ["\e(1Vi\e(B"]) | |
78 | ("C" . "\e(1O\e(B") | |
79 | ("D" . ".") | |
80 | ("E" . ["\e(1Si\e(B"]) | |
81 | ("F" . ",") | |
82 | ("G" . ":") | |
83 | ("H" . "\e(1j\e(B") | |
84 | ("I" . "\e(1N\e(B") | |
85 | ("J" . "\e(1k\e(B") | |
86 | ("K" . "!") | |
87 | ("L" . "?") | |
88 | ("M" . "\e(1f\e(B") | |
89 | ("N" . ["\e(1Wi\e(B"]) | |
90 | ("O" . "\e(1|\e(B") | |
91 | ("P" . "\e(1]\e(B") | |
92 | ("Q" . ["\e(1[i\e(B"]) | |
93 | ("R" . "_") | |
94 | ("S" . ";") | |
95 | ("T" . "+") | |
96 | ("U" . ["\e(1Ui\e(B"]) | |
97 | ("V" . "x") | |
98 | ("W" . "0") | |
99 | ("X" . "(") | |
100 | ("Y" . ["\e(1Ti\e(B"]) | |
101 | ("Z" . "\"") | |
102 | ("[" . "\e(1:\e(B") | |
103 | ("]" . "\e(1E\e(B") | |
104 | ("^" . "\e(1\\e(B") | |
105 | ("_" . "9") | |
106 | ("`" . "\e(1'\e(B") | |
107 | ("a" . "\e(1Q\e(B") | |
108 | ("b" . "\e(1V\e(B") | |
109 | ("c" . "\e(1a\e(B") | |
110 | ("d" . "\e(1!\e(B") | |
111 | ("e" . "\e(1S\e(B") | |
112 | ("f" . "\e(14\e(B") | |
113 | ("g" . "\e(1`\e(B") | |
114 | ("h" . "\e(1i\e(B") | |
115 | ("i" . "\e(1C\e(B") | |
116 | ("j" . "\e(1h\e(B") | |
117 | ("k" . "\e(1R\e(B") | |
118 | ("l" . "\e(1J\e(B") | |
119 | ("m" . "\e(17\e(B") | |
120 | ("n" . "\e(1W\e(B") | |
121 | ("o" . "\e(19\e(B") | |
122 | ("p" . "\e(1-\e(B") | |
123 | ("q" . "\e(1[\e(B") | |
124 | ("r" . "\e(1>\e(B") | |
125 | ("s" . "\e(1K\e(B") | |
126 | ("t" . "\e(1P\e(B") | |
127 | ("u" . "\e(1U\e(B") | |
128 | ("v" . "\e(1M\e(B") | |
129 | ("w" . "\e(1d\e(B") | |
130 | ("x" . "\e(1;\e(B") | |
131 | ("y" . "\e(1T\e(B") | |
132 | ("z" . "\e(1<\e(B") | |
133 | ("{" . "-") | |
134 | ("|" . ["\e(1K\\e(B"]) | |
135 | ("}" . "/") | |
136 | ("~" . "\e(1l\e(B") | |
137 | ("\\0" . "\e(1p\e(B") | |
138 | ("\\1" . "\e(1q\e(B") | |
139 | ("\\2" . "\e(1r\e(B") | |
140 | ("\\3" . "\e(1s\e(B") | |
141 | ("\\4" . "\e(1t\e(B") | |
142 | ("\\5" . "\e(1u\e(B") | |
143 | ("\\6" . "\e(1v\e(B") | |
144 | ("\\7" . "\e(1w\e(B") | |
145 | ("\\8" . "\e(1x\e(B") | |
146 | ("\\9" . "\e(1y\e(B") | |
147 | )) | |
148 | ||
149 | (defconst lao-consonant-key-alist nil) | |
150 | (defconst lao-semivowel-key-alist nil) | |
151 | (defconst lao-vowel-key-alist nil) | |
152 | (defconst lao-voweltone-key-alist nil) | |
153 | (defconst lao-tone-key-alist nil) | |
154 | (defconst lao-other-key-alist nil) | |
155 | ||
156 | (let ((tail lao-key-alist) | |
157 | elt phonetic-type) | |
158 | (while tail | |
159 | (setq elt (car tail) tail (cdr tail)) | |
160 | (if (stringp (cdr elt)) | |
161 | (setq phonetic-type (get-char-code-property (aref (cdr elt) 0) | |
162 | 'phonetic-type)) | |
163 | (setq phonetic-type (get-char-code-property (aref (aref (cdr elt) 0) 0) | |
164 | 'phonetic-type)) | |
165 | (aset (cdr elt) 0 (compose-string (aref (cdr elt) 0)))) | |
166 | (cond ((eq phonetic-type 'consonant) | |
167 | (setq lao-consonant-key-alist (cons elt lao-consonant-key-alist))) | |
168 | ((memq phonetic-type '(vowel-upper vowel-lower)) | |
169 | (if (stringp (cdr elt)) | |
170 | (setq lao-vowel-key-alist (cons elt lao-vowel-key-alist)) | |
171 | (setq lao-voweltone-key-alist | |
172 | (cons elt lao-voweltone-key-alist)))) | |
173 | ((eq phonetic-type 'tone) | |
174 | (setq lao-tone-key-alist (cons elt lao-tone-key-alist))) | |
175 | ((eq phonetic-type 'semivowel-lower) | |
176 | (setq lao-semivowel-key-alist (cons elt lao-semivowel-key-alist))) | |
177 | (t | |
178 | (setq lao-other-key-alist (cons elt lao-other-key-alist)))))) | |
24b31c88 KH |
179 | |
180 | (quail-define-package | |
486aa609 | 181 | "lao" "Lao" "\e(1E\e(B" t |
24b31c88 | 182 | "Lao input method simulating Lao keyboard layout based on Thai TIS620" |
653b6bad KH |
183 | nil t t t t nil nil nil 'quail-lao-update-translation nil t) |
184 | ||
185 | (quail-install-map | |
186 | (quail-map-from-table | |
187 | '((base-state (lao-consonant-key-alist . svt-state) | |
188 | lao-vowel-key-alist | |
189 | lao-voweltone-key-alist | |
190 | lao-tone-key-alist | |
191 | lao-other-key-alist) | |
192 | (svt-state (lao-semivowel-key-alist . v-state) | |
193 | (lao-vowel-key-alist . t-state) | |
194 | lao-voweltone-key-alist) | |
195 | (v-state (lao-vowel-key-alist . t-state)) | |
196 | (t-state lao-tone-key-alist)))) | |
24b31c88 KH |
197 | |
198 | ;;; quail/lao.el ends here |