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