aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa1999-12-15 00:32:16 +0000
committerKenichi Handa1999-12-15 00:32:16 +0000
commit653b6bad9869ae61b054229921d2d4392f5b77cd (patch)
treeb36aea6898d587bb6bf722683a5ae9426f684eb0
parentc674f3518fa2a428fc07b6b48cdd767da15fb731 (diff)
downloademacs-653b6bad9869ae61b054229921d2d4392f5b77cd.tar.gz
emacs-653b6bad9869ae61b054229921d2d4392f5b77cd.zip
Rewritten for new composition.
-rw-r--r--leim/quail/lao.el394
-rw-r--r--leim/quail/lrt.el410
-rw-r--r--leim/quail/thai.el432
-rw-r--r--leim/quail/tibetan.el567
4 files changed, 513 insertions, 1290 deletions
diff --git a/leim/quail/lao.el b/leim/quail/lao.el
index e5c25afb129..955420af55b 100644
--- a/leim/quail/lao.el
+++ b/leim/quail/lao.el
@@ -27,240 +27,172 @@
27(require 'quail) 27(require 'quail)
28(require 'lao-util) 28(require 'lao-util)
29 29
30(eval-and-compile 30(defun quail-lao-update-translation (control-flag)
31 31 (if (integerp control-flag)
32(defconst lao-keyboard-mapping 32 ;; Non-composable character typed.
33 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; control codes 33 (setq quail-current-str
34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; control codes 34 (buffer-substring (overlay-start quail-overlay)
35 0 "1" "=" "3" "4" "(1l(B" "5" "(1'(B" ; SPC .. ' 35 (overlay-end quail-overlay))
36 "7" "8" "6" "(1mh(B" "(1A(B" "(1*(B" "(1c(B" "(1=(B" ; ( .. / 36 unread-command-events
37 "(1"(B" "(1B(B" "(1?(B" "(1b(B" "(16(B" "(1X(B" "(1Y(B" "(1$(B" ; 0 .. 7 37 (string-to-list
38 "(15(B" "(1((B" "%" "(1G(B" "(1}(B" "(1m(B" "$" "\)" ; 8 .. ? 38 (substring quail-current-key control-flag)))
39 "2" "(1Qi(B" "(1Vi(B" "(1O(B" "." "(1Si(B" "," ":" ; @ .. G 39 (setq quail-current-str
40 "(1j(B" "(1N(B" "(1k(B" "!" "?" "(1f(B" "(1Wi(B" "(1|(B" ; H .. O 40 (compose-string (quail-lookup-map-and-concat quail-current-key))))
41 "(1](B" "(1[i(B" "_" ";" "+" "(1Ui(B" "x" "0" ; P .. W 41 control-flag)
42 "\(" "(1Ti(B" "\"" "(1:(B" 0 "(1E(B" "(1\(B" "9" ; X .. _ 42
43 "(1'(B" "(1Q(B" "(1V(B" "(1a(B" "(1!(B" "(1S(B" "(14(B" "(1`(B" ; ` .. g 43(defconst lao-key-alist
44 "(1i(B" "(1C(B" "(1h(B" "(1R(B" "(1J(B" "(17(B" "(1W(B" "(19(B" ; h .. o 44 '(("!" . "1")
45 "(1-(B" "(1[(B" "(1>(B" "(1K(B" "(1P(B" "(1U(B" "(1M(B" "(1d(B" ; p .. w 45 ("\"" . "=")
46 "(1;(B" "(1T(B" "(1<(B" "-" "(1K\(B" "/" "~" 0] ; x .. DEL 46 ("#" . "3")
47 "A table which maps ASCII key codes to corresponding Lao characters." 47 ("$" . "4")
48 ) 48 ("&" . "5")
49 49 ("%" . "(1l(B")
50) 50 ("'" . "(1'(B")
51 51 ("(" . "7")
52;; Template of a cdr part of a Quail map when a consonant is entered. 52 (")" . "8")
53(defvar lao-consonant-alist nil) 53 ("*" . "6")
54;; Template of a cdr part of a Quail map when a vowel upper is entered. 54 ("+" . ["(1mh(B"])
55(defvar lao-vowel-upper-alist nil) 55 ("," . "(1A(B")
56;; Template of a cdr part of a Quail map when a vowel lower is entered. 56 ("-" . "(1*(B")
57(defvar lao-vowel-lower-alist nil) 57 ("." . "(1c(B")
58;; Template of a cdr part of a Quail map when a semivowel lower is entered. 58 ("/" . "(1=(B")
59(defvar lao-semivowel-lower-alist nil) 59 ("0" . "(1"(B")
60 60 ("1" . "(1B(B")
61;; Return a Quail map corresponding to KEY of length LEN. 61 ("2" . "(1?(B")
62;; The car part of the map is a translation generated automatically. 62 ("3" . "(1b(B")
63;; The cdr part of the map is a copy of ALIST. 63 ("4" . "(16(B")
64(defun lao-generate-quail-map (key len alist) 64 ("5" . "(1X(B")
65 (let ((str "") 65 ("6" . "(1Y(B")
66 (idx 0)) 66 ("7" . "(1$(B")
67 (while (< idx len) 67 ("8" . "(15(B")
68 (setq str (concat str (aref lao-keyboard-mapping (aref key idx))) 68 ("9" . "(1((B")
69 idx (1+ idx))) 69 (":" . "%")
70 (cons (string-to-char (compose-string str)) (copy-alist alist)))) 70 (";" . "(1G(B")
71 71 ("<" . "(1}(B")
72;; Return a Quail map corresponding to KEY of length LEN when Lao 72 ("=" . "(1m(B")
73;; tone mark is entered. 73 (">" . "$")
74(defun lao-tone-input (key len) 74 ("?" . ")")
75 (lao-generate-quail-map key len nil)) 75 ("@" . "2")
76 76 ("A" . ["(1Qi(B"])
77;; Return a Quail map corresponding to KEY of length LEN when Lao 77 ("B" . ["(1Vi(B"])
78;; vowel upper is entered. 78 ("C" . "(1O(B")
79(defun lao-vowel-upper-input (key len) 79 ("D" . ".")
80 (lao-generate-quail-map key len lao-vowel-upper-alist)) 80 ("E" . ["(1Si(B"])
81 81 ("F" . ",")
82;; Return a Quail map corresponding to KEY of length LEN when Lao 82 ("G" . ":")
83;; vowel lower is entered. 83 ("H" . "(1j(B")
84(defun lao-vowel-lower-input (key len) 84 ("I" . "(1N(B")
85 (lao-generate-quail-map key len lao-vowel-lower-alist)) 85 ("J" . "(1k(B")
86 86 ("K" . "!")
87;; Return a Quail map corresponding to KEY of length LEN when Lao 87 ("L" . "?")
88;; semivowel lower is entered. 88 ("M" . "(1f(B")
89(defun lao-semivowel-lower-input (key len) 89 ("N" . ["(1Wi(B"])
90 (lao-generate-quail-map key len lao-semivowel-lower-alist)) 90 ("O" . "(1|(B")
91 91 ("P" . "(1](B")
92;; Return an alist which can be a cdr part of a Quail map 92 ("Q" . ["(1[i(B"])
93;; corresponding to the current key when Lao consonant is entered. 93 ("R" . "_")
94(defun lao-consonant-input (key len) 94 ("S" . ";")
95 (copy-alist lao-consonant-alist)) 95 ("T" . "+")
96 ("U" . ["(1Ui(B"])
97 ("V" . "x")
98 ("W" . "0")
99 ("X" . "(")
100 ("Y" . ["(1Ti(B"])
101 ("Z" . "\"")
102 ("[" . "(1:(B")
103 ("]" . "(1E(B")
104 ("^" . "(1\(B")
105 ("_" . "9")
106 ("`" . "(1'(B")
107 ("a" . "(1Q(B")
108 ("b" . "(1V(B")
109 ("c" . "(1a(B")
110 ("d" . "(1!(B")
111 ("e" . "(1S(B")
112 ("f" . "(14(B")
113 ("g" . "(1`(B")
114 ("h" . "(1i(B")
115 ("i" . "(1C(B")
116 ("j" . "(1h(B")
117 ("k" . "(1R(B")
118 ("l" . "(1J(B")
119 ("m" . "(17(B")
120 ("n" . "(1W(B")
121 ("o" . "(19(B")
122 ("p" . "(1-(B")
123 ("q" . "(1[(B")
124 ("r" . "(1>(B")
125 ("s" . "(1K(B")
126 ("t" . "(1P(B")
127 ("u" . "(1U(B")
128 ("v" . "(1M(B")
129 ("w" . "(1d(B")
130 ("x" . "(1;(B")
131 ("y" . "(1T(B")
132 ("z" . "(1<(B")
133 ("{" . "-")
134 ("|" . ["(1K\(B"])
135 ("}" . "/")
136 ("~" . "(1l(B")
137 ("\\0" . "(1p(B")
138 ("\\1" . "(1q(B")
139 ("\\2" . "(1r(B")
140 ("\\3" . "(1s(B")
141 ("\\4" . "(1t(B")
142 ("\\5" . "(1u(B")
143 ("\\6" . "(1v(B")
144 ("\\7" . "(1w(B")
145 ("\\8" . "(1x(B")
146 ("\\9" . "(1y(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))))))
96 179
97(quail-define-package 180(quail-define-package
98 "lao" "Lao" "(1E(B" t 181 "lao" "Lao" "(1E(B" t
99 "Lao input method simulating Lao keyboard layout based on Thai TIS620" 182 "Lao input method simulating Lao keyboard layout based on Thai TIS620"
100 nil t t t t nil nil nil nil nil t) 183 nil t t t t nil nil nil 'quail-lao-update-translation nil t)
101 184
102(defmacro lao-quail-define-rules (&rest rules) 185(quail-install-map
103 (let ((l rules) 186 (quail-map-from-table
104 consonant-alist 187 '((base-state (lao-consonant-key-alist . svt-state)
105 vowel-upper-alist 188 lao-vowel-key-alist
106 vowel-lower-alist 189 lao-voweltone-key-alist
107 semivowel-lower-alist 190 lao-tone-key-alist
108 rule trans ch c-set) 191 lao-other-key-alist)
109 (while l 192 (svt-state (lao-semivowel-key-alist . v-state)
110 (setq rule (car l)) 193 (lao-vowel-key-alist . t-state)
111 (setq trans (nth 1 rule)) 194 lao-voweltone-key-alist)
112 (if (consp trans) 195 (v-state (lao-vowel-key-alist . t-state))
113 (setq trans (car trans))) 196 (t-state lao-tone-key-alist))))
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)
119 consonant-alist)))
120 ((aref c-set ?3) ; vowel lower
121 (setq consonant-alist
122 (cons (cons (string-to-char (car rule))
123 'lao-vowel-lower-input)
124 consonant-alist)
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))
132 'lao-tone-input)
133 consonant-alist)
134 vowel-upper-alist
135 (cons (cons (string-to-char (car rule))
136 'lao-tone-input)
137 vowel-upper-alist)
138 vowel-lower-alist
139 (cons (cons (string-to-char (car rule))
140 'lao-tone-input)
141 vowel-lower-alist)))
142 ((aref c-set ?9) ; semivowel lower
143 (setq consonant-alist
144 (cons (cons (string-to-char (car rule))
145 'lao-semivowel-lower-input)
146 consonant-alist)
147 vowel-upper-alist
148 (cons (cons (string-to-char (car rule))
149 'lao-semivowel-lower-input)
150 vowel-upper-alist))))
151 (setq l (cdr l)))
152 (list 'progn
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))))
158
159(lao-quail-define-rules
160 ("!" "1")
161 ("\"" "=")
162 ("#" "3")
163 ("$" "4")
164 ("&" "5")
165 ("%" "(1l(B")
166 ("'" ("(1'(B" . lao-consonant-input))
167 ("(" "7")
168 (")" "8")
169 ("*" "6")
170 ("+" "0(1mh1(B")
171 ("," ("(1A(B" . lao-consonant-input))
172 ("-" ("(1*(B" . lao-consonant-input))
173 ("." "(1c(B")
174 ("/" ("(1=(B" . lao-consonant-input))
175 ("0" ("(1"(B" . lao-consonant-input))
176 ("1" ("(1B(B" . lao-consonant-input))
177 ("2" ("(1?(B" . lao-consonant-input))
178 ("3" "(1b(B")
179 ("4" ("(16(B" . lao-consonant-input))
180 ("5" "(1X(B")
181 ("6" "(1Y(B")
182 ("7" ("(1$(B" . lao-consonant-input))
183 ("8" ("(15(B" . lao-consonant-input))
184 ("9" ("(1((B" . lao-consonant-input))
185 (":" "%")
186 (";" ("(1G(B" . lao-consonant-input))
187 ("<" ("(1}(B" . lao-consonant-input))
188 ("=" "(1m(B")
189 (">" "$")
190 ("?" ")")
191 ("@" "2")
192 ("A" "0(1Qi1(B")
193 ("B" "0(1Vi1(B")
194 ("C" "(1O(B")
195 ("D" ".")
196 ("E" "0(1Si1(B")
197 ("F" ",")
198 ("G" ":")
199 ("H" "(1j(B")
200 ("I" ("(1N(B" . lao-consonant-input))
201 ("J" "(1k(B")
202 ("K" "!")
203 ("L" "?")
204 ("M" "(1f(B")
205 ("N" "0(1Wi1(B")
206 ("O" ("(1|(B" . lao-consonant-input))
207 ("P" "(1](B")
208 ("Q" "0(1[i1(B")
209 ("R" "_")
210 ("S" ";")
211 ("T" "+")
212 ("U" "0(1Ui1(B")
213 ("V" "x")
214 ("W" "0")
215 ("X" "(")
216 ("Y" "0(1Ti1(B")
217 ("Z" "\"")
218 ("[" ("(1:(B" . lao-consonant-input))
219 ("]" ("(1E(B" . lao-consonant-input))
220 ("^" "(1\(B")
221 ("_" "9")
222 ("`" ("(1'(B" . lao-consonant-input))
223 ("a" "(1Q(B")
224 ("b" "(1V(B")
225 ("c" "(1a(B")
226 ("d" ("(1!(B" . lao-consonant-input))
227 ("e" "(1S(B")
228 ("f" ("(14(B" . lao-consonant-input))
229 ("g" "(1`(B")
230 ("h" "(1i(B")
231 ("i" ("(1C(B" . lao-consonant-input))
232 ("j" "(1h(B")
233 ("k" "(1R(B")
234 ("l" ("(1J(B" . lao-consonant-input))
235 ("m" ("(17(B" . lao-consonant-input))
236 ("n" "(1W(B")
237 ("o" ("(19(B" . lao-consonant-input))
238 ("p" ("(1-(B" . lao-consonant-input))
239 ("q" "(1[(B")
240 ("r" ("(1>(B" . lao-consonant-input))
241 ("s" ("(1K(B" . lao-consonant-input))
242 ("t" "(1P(B")
243 ("u" "(1U(B")
244 ("v" ("(1M(B" . lao-consonant-input))
245 ("w" "(1d(B")
246 ("x" ("(1;(B" . lao-consonant-input))
247 ("y" "(1T(B")
248 ("z" ("(1<(B" . lao-consonant-input))
249 ("{" "-")
250 ("|" ("0(1K\1(B" . lao-consonant-input))
251 ("}" "/")
252 ("~" "(1l(B")
253 ("\\0" "(1p(B")
254 ("\\1" "(1q(B")
255 ("\\2" "(1r(B")
256 ("\\3" "(1s(B")
257 ("\\4" "(1t(B")
258 ("\\5" "(1u(B")
259 ("\\6" "(1v(B")
260 ("\\7" "(1w(B")
261 ("\\8" "(1x(B")
262 ("\\9" "(1y(B")
263 )
264
265 197
266;;; quail/lao.el ends here 198;;; quail/lao.el ends here
diff --git a/leim/quail/lrt.el b/leim/quail/lrt.el
index b3521c9fb39..bdc1cc71cbf 100644
--- a/leim/quail/lrt.el
+++ b/leim/quail/lrt.el
@@ -31,353 +31,22 @@
31;; key sequence: 31;; key sequence:
32;; consonant [+ semi-vowel-sign-lo ] + vowel [+ maa-sakod ] [+ tone-mark ] 32;; consonant [+ semi-vowel-sign-lo ] + vowel [+ maa-sakod ] [+ tone-mark ]
33 33
34(eval-and-compile 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 (let ((lao-str (lao-transcribe-roman-to-lao-string quail-current-key)))
44 (if (> (aref lao-str 0) 255)
45 (setq quail-current-str lao-str)
46 (or quail-current-str
47 (setq quail-current-str quail-current-key)))))
48 control-flag)
35 49
36;; Upper vowels and tone-marks are put on the letter.
37;; Semi-vowel-sign-lo and lower vowels are put under the letter.
38(defconst lrt-single-consonant-table
39 `(("k" . ?(1!(B)
40 ("kh" . ?(1"(B)
41 ("qh" . ?(1$(B)
42 ("ng" . ?(1'(B)
43 ("j" . ?(1((B)
44 ("s" . ?(1J(B)
45 ("x" . ?(1*(B)
46 ("y" . ?(1-(B)
47 ("d" . ?(14(B)
48 ("t" . ?(15(B)
49 ("th" . ?(16(B)
50 ("dh" . ?(17(B)
51 ("n" . ?(19(B)
52 ("b" . ?(1:(B)
53 ("p" . ?(1;(B)
54 ("hp" . ?(1<(B)
55 ("fh" . ?(1=(B)
56 ("ph" . ?(1>(B)
57 ("f" . ?(1?(B)
58 ("m" . ?(1A(B)
59 ("gn" . ?(1B(B)
60 ("l" . ?(1E(B)
61 ("r" . ?(1C(B)
62 ("v" . ?(1G(B)
63 ("w" . ?(1G(B)
64 ("hh" . ?(1K(B)
65 ("O" . ?(1M(B)
66 ("h" . ?(1N(B)
67 ("nh" . ?(1|(B)
68 ("mh" . ?(1}(B)
69 ("lh" . "0(1K\(B1")
70 ))
71
72;; Semi-vowel-sign-lo is put under the first letter.
73;; Lower vowels are put under the last letter.
74;; Upper vowels and tone-marks are put on the last letter.
75(defconst lrt-double-consonant-table
76 '(("ngh" . "(1K'(B")
77 ("yh" . "(1K](B")
78 ("wh" . "(1KG(B")
79 ("hl" . "(1KE(B")
80 ("hy" . "(1K-(B")
81 ("hn" . "(1K9(B")
82 ("hm" . "(1KA(B")
83 ))
84
85(defconst lrt-semi-vowel-sign-lo
86 '("r" . ?(1\(B))
87
88(defconst lrt-vowel-table
89 '(("a" "(1P(B" (0 ?(1P(B) (0 ?(1Q(B))
90 ("ar" "(1R(B" (0 ?(1R(B))
91 ("i" "(1T(B" (0 ?(1T(B))
92 ("ii" "(1U(B" (0 ?(1U(B))
93 ("eu" "(1V(B" (0 ?(1V(B))
94 ("ur" "(1W(B" (0 ?(1W(B))
95 ("u" "(1X(B" (0 ?(1X(B))
96 ("uu" "(1Y(B" (0 ?(1Y(B))
97 ("e" "(1`(B (1P(B" (?(1`(B 0 ?(1P(B) (?(1`(B 0 ?(1Q(B))
98 ("ee" "(1`(B" (?(1`(B 0))
99 ("ae" "(1a(B (1P(B" (?(1a(B 0 ?(1P(B) (?(1a(B 0 ?(1Q(B))
100 ("aa" "(1a(B" (?(1a(B 0))
101 ("o" "(1b(B (1P(B" (?(1b(B 0 ?(1P(B) (0 ?(1[(B) (?(1-(B ?(1b(B 0 ?(1Q(B) (?(1G(B ?(1b(B 0 ?(1Q(B))
102 ("oo" "(1b(B" (?(1b(B 0))
103 ("oe" "(1`(B (1RP(B" (?(1`(B 0 ?(1R(B ?(1P(B) (0 ?(1Q(B ?(1M(B))
104 ("or" "(1m(B" (0 ?(1m(B) (0 ?(1M(B))
105 ("er" "(1`(B (1T(B" (?(1`(B 0 ?(1T(B))
106 ("ir" "(1`(B (1U(B" (?(1`(B 0 ?(1U(B))
107 ("ua" "(1[GP(B" (0 ?(1[(B ?(1G(B ?(1P(B) (0 ?(1Q(B ?(1G(B))
108 ("uaa" "(1[G(B" (0 ?(1[(B ?(1G(B) (0 ?(1G(B))
109 ("ie" "(1`Q]P(B" (?(1`(B 0 ?(1Q(B ?(1](B ?(1P(B) (0 ?(1Q(B ?(1](B))
110 ("ia" "(1`Q](B" (?(1`(B 0 ?(1Q(B ?(1](B) (0 ?(1](B))
111 ("ea" "(1`VM(B" (?(1`(B 0 ?(1V(B ?(1M(B))
112 ("eaa" "(1`WM(B" (?(1`(B 0 ?(1W(B ?(1M(B))
113 ("ai" "(1d(B" (?(1d(B 0))
114 ("ei" "(1c(B" (?(1c(B 0))
115 ("ao" "(1`[R(B" (?(1`(B 0 ?(1[(B ?(1R(B))
116 ("aM" "(1S(B" (0 ?(1S(B))))
117
118;; Maa-sakod is put at the tail.
119(defconst lrt-maa-sakod-table
120 '((?k . ?(1!(B)
121 (?g . ?(1'(B)
122 (?y . ?(1-(B)
123 (?d . ?(14(B)
124 (?n . ?(19(B)
125 (?b . ?(1:(B)
126 (?m . ?(1A(B)
127 (?v . ?(1G(B)
128 (?w . ?(1G(B)
129 ))
130
131(defconst lrt-tone-mark-table
132 '(("'" . ?(1h(B)
133 ("\"" . ?(1i(B)
134 ("^" . ?(1j(B)
135 ("+" . ?(1k(B)
136 ("~" . ?(1l(B)))
137
138;; Return list of composing patterns for normal (without maa-sakod)
139;; key sequence and with-maa-sakod key sequence starting with single
140;; consonant C and optional SEMI-VOWEL.
141(defun lrt-composing-pattern-single-c (c semi-vowel vowel-pattern)
142 (let* ((patterns (copy-sequence vowel-pattern))
143 (tail patterns)
144 place)
145 ;; Embed C and SEMI-VOWEL (if any) at the place of 0.
146 (while tail
147 ;; At first, make a copy.
148 (setcar tail (copy-sequence (car tail)))
149 ;; Then, do embedding.
150 (setq place (memq 0 (car tail)))
151 (setcar place c)
152 (if semi-vowel
153 (setcdr place (cons semi-vowel (cdr place))))
154 (setq tail (cdr tail)))
155 patterns))
156
157;; Return list of composing patterns for normal (without maa-sakod)
158;; key sequence and with-maa-sakod key sequence starting with double
159;; consonant STR and optional SEMI-VOWEL.
160(defun lrt-composing-pattern-double-c (str semi-vowel vowel-pattern)
161 (let* ((patterns (copy-sequence vowel-pattern))
162 (tail patterns)
163 (chars (string-to-list
164 (if (= (length str) 1)
165 (decompose-string str)
166 str)))
167 place)
168 ;; Embed C and SEMI-VOWEL (if any) at the place of 0.
169 (while tail
170 ;; At first, make a copy.
171 (setcar tail (copy-sequence (car tail)))
172 ;; Then, do embedding.
173 (setq place (memq 0 (car tail)))
174 (setcar place (car chars))
175 (setcdr place (cons (nth 1 chars) (cdr place)))
176 (if semi-vowel
177 ;; Embed SEMI-VOWEL in between CHARS.
178 (setcdr place (cons semi-vowel (cdr place))))
179 (setq tail (cdr tail)))
180 patterns))
181
182;; Return a string made of characters in CHAR-LIST while composing
183;; such characters as vowel-upper, vowel-lower, semi-vowel(lower),
184;; and tone-mark with the preceding base character.
185(defun lrt-compose-string (char-list)
186 ;; Make a copy because the following work alters it.
187 (setq char-list (copy-sequence char-list))
188 (let ((i -1)
189 (l char-list))
190 (while l
191 (if (memq (get-char-code-property (car l) 'phonetic-type)
192 '(vowel-upper vowel-lower semivowel-lower tone))
193 (let (composed-char)
194 (if (< i 0)
195 ;; No preceding base character.
196 (error "Invalid CHAR-LIST: %s" char-list))
197 (setq composed-char
198 (string-to-char (compose-chars (nth i char-list) (car l))))
199 (setcar (nthcdr i char-list) composed-char)
200 (setq l (cdr l))
201 (setcdr (nthcdr i char-list) l))
202 (setq l (cdr l))
203 (setq i (1+ i))))
204 (concat (apply 'vector char-list))))
205
206(defun lrt-compose-c-s-v (consonant semi-vowel vowel-pattern)
207 (let ((pattern-list
208 (if (integerp consonant)
209 (lrt-composing-pattern-single-c
210 consonant semi-vowel vowel-pattern)
211 (lrt-composing-pattern-double-c
212 consonant semi-vowel vowel-pattern))))
213 (cons (vector (lrt-compose-string (car pattern-list)))
214 (cons t pattern-list))))
215
216)
217
218(defun lrt-handle-maa-sakod ()
219 (interactive)
220 (if (or (= (length quail-current-key) 0)
221 (not quail-current-data))
222 (quail-self-insert-command)
223 (if (not (car quail-current-data))
224 (progn
225 (setq quail-current-data nil)
226 (setq unread-command-events
227 (cons last-command-event unread-command-events))
228 (quail-terminate-translation))
229 (if (not (integerp last-command-event))
230 (error "Bogus calling sequence"))
231 (let* ((maa-sakod (cdr (assq last-command-event lrt-maa-sakod-table)))
232 (maa-sakod-pattern (append
233 (or (cdr (assq maa-sakod
234 (nthcdr 3 quail-current-data)))
235 (nth 2 quail-current-data)
236 (nth 1 quail-current-data))
237 (list maa-sakod))))
238 (quail-delete-region)
239 (setq quail-current-str (lrt-compose-string maa-sakod-pattern))
240 (insert quail-current-str)
241 (quail-show-translations)
242 (setq quail-current-data (list nil maa-sakod-pattern))))))
243
244(defun lrt-handle-tone-mark ()
245 (interactive)
246 (if (= (length quail-current-key) 0)
247 (quail-self-insert-command)
248 (if (not quail-current-data)
249 (progn
250 (setq unread-command-events
251 (cons last-command-event unread-command-events))
252 (quail-terminate-translation))
253 (if (not (integerp last-command-event))
254 (error "Bogus calling sequence"))
255 (let* ((tone-mark (cdr (assoc (char-to-string last-command-event)
256 lrt-tone-mark-table)))
257 (tone-mark-pattern
258 (if (car quail-current-data)
259 (copy-sequence (nth 1 quail-current-data))
260 ;; No need of copy because lrt-handle-maa-sakod should
261 ;; have already done it.
262 (nth 1 quail-current-data)))
263 (tail tone-mark-pattern)
264 (double-consonant-keys lrt-double-consonant-table)
265 (double-consonant-flag nil)
266 place)
267
268 ;; Set DOUBLE-CONSONANT-FLAG to t if a user entered a double
269 ;; consonant.
270 (while (and double-consonant-keys (not double-consonant-flag))
271 (setq double-consonant-flag
272 (eq (string-match (car (car double-consonant-keys))
273 quail-current-key)
274 0)
275 double-consonant-keys (cdr double-consonant-keys)))
276
277 ;; Find a place to embed TONE-MARK. It should be after a
278 ;; single or double consonant and following upper or lower vowels.
279 (while (and tail (not place))
280 (if (and
281 (eq (get-char-code-property (car tail) 'phonetic-type)
282 'consonant)
283 ;; Skip `(1K(B' if it is the first letter of double consonant.
284 (or (not double-consonant-flag)
285 (/= (car tail) ?(1K(B)))
286 (progn
287 (setq place tail)
288 (setq tail (cdr tail))
289 (while (and tail
290 (memq (get-char-code-property (car tail)
291 'phonetic-type)
292 '(vowel-upper vowel-lower semivowel-lower)))
293 (setq place tail tail (cdr tail))))
294 (setq tail (cdr tail))))
295 ;; Embed TONE-MARK.
296 (setcdr place (cons tone-mark (cdr place)))
297 (quail-delete-region)
298 (insert (lrt-compose-string tone-mark-pattern))
299 (setq quail-current-data nil)
300 (quail-terminate-translation)))))
301
302(defmacro lrt-generate-quail-map ()
303 `(quail-install-map
304 ',(let ((map (list nil))
305 (semi-vowel-key (car lrt-semi-vowel-sign-lo))
306 (semi-vowel-char (cdr lrt-semi-vowel-sign-lo))
307 l1 e1 l2 e2 pattern key)
308 ;; Single consonants.
309 (setq l1 lrt-single-consonant-table)
310 (while l1
311 (setq e1 (car l1))
312 (quail-defrule-internal (car e1) (vector (cdr e1)) map)
313 (quail-defrule-internal
314 (concat (car e1) semi-vowel-key)
315 (if (stringp (cdr e1))
316 (compose-string (format "%s%c" (cdr e1) semi-vowel-char))
317 (compose-string (format "%c%c" (cdr e1) semi-vowel-char)))
318 map)
319 (setq l2 lrt-vowel-table)
320 (while l2
321 (setq e2 (car l2))
322 (setq key (concat (car e1) (car e2))
323 pattern (lrt-compose-c-s-v (cdr e1) nil (nthcdr 2 e2)))
324 (quail-defrule-internal key pattern map)
325 (quail-defrule-internal
326 (concat key " ")
327 (vector (concat (aref (car pattern) 0) " ")) map)
328 (setq key (concat (car e1) semi-vowel-key (car e2))
329 pattern (lrt-compose-c-s-v (cdr e1) semi-vowel-char
330 (nthcdr 2 e2)))
331 (quail-defrule-internal key pattern map)
332 (quail-defrule-internal
333 (concat key " ")
334 (vector (concat (aref (car pattern) 0) " ")) map)
335 (setq l2 (cdr l2)))
336 (setq l1 (cdr l1)))
337
338 ;; Double consonants.
339 (setq l1 lrt-double-consonant-table)
340 (while l1
341 (setq e1 (car l1))
342 (quail-defrule-internal (car e1) (vector (cdr e1)) map)
343 (quail-defrule-internal
344 (concat (car e1) semi-vowel-key)
345 (vector (concat (compose-string
346 (format "%c%c" (aref (cdr e1) 0) semi-vowel-char))
347 (substring (cdr e1) 1)))
348 map)
349 (setq l2 lrt-vowel-table)
350 (while l2
351 (setq e2 (car l2))
352 (setq key (concat (car e1) (car e2))
353 pattern (lrt-compose-c-s-v (cdr e1) nil (nthcdr 2 e2)))
354 (quail-defrule-internal key pattern map)
355 (quail-defrule-internal
356 (concat key " ")
357 (vector (concat (aref (car pattern) 0) " ")) map)
358 (setq key (concat (car e1) semi-vowel-key (car e2))
359 pattern (lrt-compose-c-s-v (cdr e1) semi-vowel-char
360 (nthcdr 2 e2)))
361 (quail-defrule-internal key pattern map)
362 (quail-defrule-internal
363 (concat key " ")
364 (vector (concat (aref (car pattern) 0) " ")) map)
365 (setq l2 (cdr l2)))
366 (setq l1 (cdr l1)))
367
368 ;; Vowels.
369 (setq l1 lrt-vowel-table)
370 (while l1
371 (setq e1 (car l1) l1 (cdr l1))
372 (quail-defrule-internal (car e1) (vector (nth 1 e1)) map))
373
374 ;; Tone-marks.
375 (setq l1 lrt-tone-mark-table)
376 (while l1
377 (setq e1 (car l1) l1 (cdr l1))
378 (quail-defrule-internal (car e1) (cdr e1) map))
379
380 map)))
381 50
382(quail-define-package 51(quail-define-package
383 "lao-lrt" "Lao" "(1E(BR" t 52 "lao-lrt" "Lao" "(1E(BR" t
@@ -386,38 +55,23 @@
386`\\' (backslash) + `\\' => (1f(B LAO KO LA (REPETITION) 55`\\' (backslash) + `\\' => (1f(B LAO KO LA (REPETITION)
387`\\' (backslash) + `$' => (1O(B LAO ELLIPSIS 56`\\' (backslash) + `$' => (1O(B LAO ELLIPSIS
388" 57"
389 '(("k" . lrt-handle-maa-sakod) 58 nil 'forget-last-selection 'deterministic 'kbd-translate 'show-layout
390 ("g" . lrt-handle-maa-sakod) 59 nil nil nil 'quail-lao-update-translation nil t)
391 ("y" . lrt-handle-maa-sakod)
392 ("d" . lrt-handle-maa-sakod)
393 ("n" . lrt-handle-maa-sakod)
394 ("b" . lrt-handle-maa-sakod)
395 ("m" . lrt-handle-maa-sakod)
396 ("v" . lrt-handle-maa-sakod)
397 ("w" . lrt-handle-maa-sakod)
398 ("'" . lrt-handle-tone-mark)
399 ("\"" . lrt-handle-tone-mark)
400 ("^" . lrt-handle-tone-mark)
401 ("+" . lrt-handle-tone-mark)
402 ("~" . lrt-handle-tone-mark))
403 'forget-last-selection 'deterministic 'kbd-translate 'show-layout
404 nil nil nil nil nil t)
405
406(lrt-generate-quail-map)
407
408;; Additional key definitions for Lao digits.
409 60
410(quail-defrule "\\0" ?(1p(B) 61;; LRT (Lao Roman Transcription) input method accepts the following
411(quail-defrule "\\1" ?(1q(B) 62;; key sequence:
412(quail-defrule "\\2" ?(1r(B) 63;; consonant [ semi-vowel-sign-lo ] vowel [ maa-sakod ] [ tone-mark ]
413(quail-defrule "\\3" ?(1s(B) 64
414(quail-defrule "\\4" ?(1t(B) 65(quail-install-map
415(quail-defrule "\\5" ?(1u(B) 66 (quail-map-from-table
416(quail-defrule "\\6" ?(1v(B) 67 '((base-state (lao-transcription-consonant-alist . sv-state)
417(quail-defrule "\\7" ?(1w(B) 68 lao-transcription-vowel-alist
418(quail-defrule "\\8" ?(1x(B) 69 lao-transcription-tone-alist)
419(quail-defrule "\\9" ?(1y(B) 70 (sv-state (lao-transcription-semi-vowel-alist . v-state)
420(quail-defrule "\\\\" ?(1f(B) 71 (lao-transcription-vowel-alist . mt-state))
421(quail-defrule "\\$" ?(1O(B) 72 (v-state (lao-transcription-vowel-alist . mt-state))
73 (mt-state (lao-transcription-maa-sakod-alist . t-state)
74 lao-transcription-tone-alist)
75 (t-state lao-transcription-tone-alist))))
422 76
423;;; quail/lrt.el ends here 77;;; quail/lrt.el ends here
diff --git a/leim/quail/thai.el b/leim/quail/thai.el
index 2824036243e..df215dff116 100644
--- a/leim/quail/thai.el
+++ b/leim/quail/thai.el
@@ -27,158 +27,47 @@
27(require 'quail) 27(require 'quail)
28(require 'thai-util) 28(require 'thai-util)
29 29
30(eval-and-compile 30(defun quail-thai-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(defun thai-generate-quail-map (translation-table)
44 (let ((i 0)
45 consonant vowel tone voweltone others)
46 ;; Categorize Thai characters into one of above.
47 (while (< i 128)
48 (let ((trans (aref translation-table i))
49 ptype)
50 (if (eq trans 0)
51 nil
52 (if (> (length trans) 1)
53 (setq ptype 'voweltone
54 trans (vector trans))
55 (setq ptype (get-char-code-property (aref trans 0) 'phonetic-type))
56 (cond ((memq ptype '(vowel-upper vowel-lower))
57 (setq ptype 'vowel))
58 ((not (memq ptype '(consonant tone)))
59 (setq ptype 'others))))
60 (set ptype (cons (cons (char-to-string i) trans)
61 (symbol-value ptype)))))
62 (setq i (1+ i)))
63
64 (quail-map-from-table
65 '((base-state (consonant . vt-state)
66 vowel tone voweltone others)
67 (vt-state (vowel . t-state)
68 voweltone tone)
69 (t-state tone)))))
31 70
32(defvar thai-keyboard-mapping-alist
33 '((kesmanee
34 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; control codes
35 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; control codes
36 0 "#" ",TF(B" ",Tr(B" ",Ts(B" ",Tt(B" "0,TQi1(B" ",T'(B" ; SPC .. '
37 ",Tv(B" ",Tw(B" ",Tu(B" ",Ty(B" ",TA(B" ",T"(B" ",Tc(B" ",T=(B" ; ( .. /
38 ",T((B" ",TE(B" "/" "_" ",T@(B" ",T6(B" ",TX(B" ",TV(B" ; 0 .. 7
39 ",T$(B" ",T5(B" ",T+(B" ",TG(B" ",T2(B" ",T*(B" ",TL(B" ",TF(B" ; 8 .. ?
40 ",Tq(B" ",TD(B" ",TZ(B" ",T)(B" ",T/(B" ",T.(B" ",Tb(B" ",T,(B" ; @ .. G
41 ",Tg(B" ",T3(B" ",Tk(B" ",TI(B" ",TH(B" ",Tn(B" ",Tl(B" ",TO(B" ; H .. O
42 ",T-(B" ",Tp(B" ",T1(B" ",T&(B" ",T8(B" ",Tj(B" ",TN(B" "\"" ; P .. W
43 ")" ",Tm(B" "(" ",T:(B" ",T_(B" ",TE(B" ",TY(B" ",Tx(B" ; X .. _
44 ",T#(B" ",T?(B" ",TT(B" ",Ta(B" ",T!(B" ",TS(B" ",T4(B" ",T`(B" ; ` .. g
45 ",Ti(B" ",TC(B" ",Th(B" ",TR(B" ",TJ(B" ",T7(B" ",TW(B" ",T9(B" ; h .. o
46 ",TB(B" ",Tf(B" ",T>(B" ",TK(B" ",TP(B" ",TU(B" ",TM(B" ",Td(B" ; p .. w
47 ",T;(B" ",TQ(B" ",T<(B" ",T0(B" ",To(B" "." ",T%(B" 0] ; x .. DEL
48 nil nil)
49
50 (pattachote
51 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; control codes
52 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; control codes
53 0 "+" ",T1(B" "/" "," "?" "_" ",T"(B" ; SPC .. '
54 "(" ")" "." "%" ",TP(B" ",Tq(B" ",T((B" ",T>(B" ; ( .. /
55 ",Tp(B" "=" ",Tr(B" ",Ts(B" ",Tt(B" ",Tu(B" ",TY(B" ",Tw(B" ; 0 .. 7
56 ",Tx(B" ",Ty(B" ",T&(B" ",Td(B" ",T?(B" ",Tv(B" ",T2(B" ",TL(B" ; 8 .. ?
57 "\"" ",Tk(B" ",TQ(B" ",T0(B" ",TS(B" ",Tf(B" ",T3(B" ",Tl(B" ; @ .. G
58 ",TW(B" ",T+(B" ",T<(B" ",T*(B" ",Tb(B" ",TN(B" ",TH(B" ",T6(B" ; H .. O
59 ",T2(B" ",Tj(B" ",T-(B" ",T8(B" ",TI(B" ",T=(B" ",T@(B" ",TD(B" ; P .. W
60 ",T.(B" ",TV(B" ",T.(B" ",Tc(B" ",TZ(B" ",T2(B" ",TX(B" "-" ; X .. _
61 ",T#(B" ",Ti(B" ",TT(B" ",TE(B" ",T'(B" ",TB(B" ",T!(B" ",TQ(B" ; ` .. g
62 ",TU(B" ",TA(B" ",TR(B" ",T9(B" ",T`(B" ",TJ(B" ",T$(B" ",TG(B" ; h .. o
63 ",Ta(B" ",Tg(B" ",TM(B" ",T7(B" ",TC(B" ",T4(B" ",TK(B" ",T5(B" ; p .. w
64 ",T;(B" ",Th(B" ",T:(B" ",TO(B" ",Tm(B" ",TF(B" ",T%(B" 0] ; x .. DEL
65 nil nil)
66 )
67 "Alist of Thai keyboard types vs. corresponding mapping tables.
68Each element is a list of:
69 KEYBOARD-TYPE, ASCII-THAI-TABLE, CONSONANT-MAP-TEMPLATE,
70 and VOWEL-UPPER-LOWER-TEMPLATE.
71
72KEYBOARD-TYPE is a symbol, one of kesmanee or pattachote.
73
74ASCII-THAI-TABLE is a vector indexed by an ASCII key code
75and the value is the one-char string of Thai character
76assigned at the location of ASCII key on the specific Thai keyboard.
77The value is 0 if no Thai character is assigned at the location.
78
79CONSONANT-MAP-TEMPLATE is a template of a cdr part of a Quail map when
80a consonant is entered.
81
82VOWEL-UPPER-LOWER-TEMPLATE is a template of a cdr part of a Quail map
83when a vowel upper or a vowel lower is entered.")
84
85(defmacro thai-keyboard-info (keyboard-type)
86 `(assq ,keyboard-type thai-keyboard-mapping-alist))
87
88)
89
90(defvar thai-current-keyboard-type nil
91 "Thai Keyboard type which Quail is assuming currently.
92This variable is used in Quail internally only.")
93
94;; Template of a cdr part of a Quail map when a consonant is entered.
95(defvar thai-consonant-alist nil)
96;; Template of a cdr part of a Quail map when a vowel upper or a vowel
97;; lower is entered.
98(defvar thai-vowel-upper-lower-alist nil)
99
100;; Return a Quail map corresponding to KEY of length LEN.
101;; The car part of the map is a translation generated automatically.
102;; The cdr part of the map is a copy of ALIST.
103(defun thai-generate-quail-map (key len alist)
104 (let ((str "")
105 (idx 0))
106 (while (< idx len)
107 (setq str (concat str (aref (nth 1 (thai-keyboard-info
108 thai-current-keyboard-type))
109 (aref key idx)))
110 idx (1+ idx)))
111 (cons (string-to-char (compose-string str)) (copy-alist alist))))
112
113;; Return a Quail map corresponding to KEY of length LEN when Thai
114;; tone mark is entered.
115(defun thai-tone-input (key len)
116 (thai-generate-quail-map key len nil))
117
118;; Return a Quail map corresponding to KEY of length LEN when Thai
119;; vowel upper or vowel lower is entered.
120(defun thai-vowel-upper-lower-input (key len)
121 (thai-generate-quail-map
122 key len
123 (nth 3 (thai-keyboard-info thai-current-keyboard-type))))
124
125;; Define RULES in Quail map. In addition, create
126;; `thai-consonant-alist-KEYBOARD-TYPE' and
127;; `thai-vowel-upper-lower-alist-KEYBOARD-TYPE'.
128
129;; The general composing rules are as follows:
130;;
131;; T
132;; V T V T
133;; CV -> C, CT -> C, CVT -> C, Cv -> C, CvT -> C
134;; v v
135;;
136;; where C: consonant, V: vowel upper, v: vowel lower, T: tone mark.
137
138(defmacro thai-quail-define-rules (keyboard-type &rest rules)
139 (let ((l rules)
140 consonant-alist
141 vowel-upper-lower-alist
142 rule trans ch c-set)
143 (while l
144 (setq rule (car l))
145 (setq trans (nth 1 rule))
146 (if (consp trans)
147 (setq trans (car trans)))
148 (setq c-set (char-category-set (string-to-char trans)))
149 (cond ((or (aref c-set ?2)
150 (aref c-set ?3))
151 (setq consonant-alist
152 (cons (cons (string-to-char (car rule))
153 'thai-vowel-upper-lower-input)
154 consonant-alist)))
155 ((aref c-set ?4)
156 (setq consonant-alist
157 (cons (cons (string-to-char (car rule))
158 'thai-tone-input)
159 consonant-alist)
160 vowel-upper-lower-alist
161 (cons (cons (string-to-char (car rule))
162 'thai-tone-input)
163 vowel-upper-lower-alist))))
164 (setq l (cdr l)))
165 `(progn
166 (quail-define-rules ,@rules)
167 (setcar (nthcdr 2 (thai-keyboard-info ,keyboard-type))
168 ',consonant-alist)
169 (setcar (nthcdr 3 (thai-keyboard-info ,keyboard-type))
170 ',vowel-upper-lower-alist))))
171
172;; Return an alist which can be a cdr part of a Quail map
173;; corresponding to the current key when Thai consonant is entered.
174(defun thai-consonant-input (key len)
175 (let ((quail-package-name (quail-name)))
176 (setq thai-current-keyboard-type
177 (cond ((string= quail-package-name "thai-pattachote") 'pattachote)
178 ((string= quail-package-name "thai-kesmanee") 'kesmanee)
179 (t (error "Invalid Quail package %s" quail-package-name))))
180 (copy-alist (nth 2 (thai-keyboard-info thai-current-keyboard-type)))))
181
182;; Thai Kesmanee keyboard support. 71;; Thai Kesmanee keyboard support.
183 72
184(quail-define-package 73(quail-define-package
@@ -189,106 +78,27 @@ The difference from the ordinal Thai keyboard:
189 ',T_(B' and ',To(B' are assigned to '\\' and '|' respectively, 78 ',T_(B' and ',To(B' are assigned to '\\' and '|' respectively,
190 ',T#(B' and ',T%(B' are assigned to '`' and '~' respectively, 79 ',T#(B' and ',T%(B' are assigned to '`' and '~' respectively,
191 Don't know where to assign characters ',Tz(B' and ',T{(B'." 80 Don't know where to assign characters ',Tz(B' and ',T{(B'."
192 nil t t nil t nil nil nil nil nil t) 81 nil t t nil t nil nil nil 'quail-thai-update-translation nil t)
193 82
194(thai-quail-define-rules 'kesmanee 83(quail-install-map
195 ("1" (",TE(B" . thai-consonant-input)) 84 (thai-generate-quail-map
196 ("!" "#") 85 [
197 ("2" "/") 86 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; control codes
198 ("@" ",Tq(B") 87 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; control codes
199 ("3" "_") 88 0 "#" ",TF(B" ",Tr(B" ",Ts(B" ",Tt(B" ",TQi(B" ",T'(B" ; SPC .. '
200 ("#" ",Tr(B") 89 ",Tv(B" ",Tw(B" ",Tu(B" ",Ty(B" ",TA(B" ",T"(B" ",Tc(B" ",T=(B" ; ( .. /
201 ("4" (",T@(B" . thai-consonant-input)) 90 ",T((B" ",TE(B" "/" "_" ",T@(B" ",T6(B" ",TX(B" ",TV(B" ; 0 .. 7
202 ("$" ",Ts(B") 91 ",T$(B" ",T5(B" ",T+(B" ",TG(B" ",T2(B" ",T*(B" ",TL(B" ",TF(B" ; 8 .. ?
203 ("5" (",T6(B" . thai-consonant-input)) 92 ",Tq(B" ",TD(B" ",TZ(B" ",T)(B" ",T/(B" ",T.(B" ",Tb(B" ",T,(B" ; @ .. G
204 ("%" ",Tt(B") 93 ",Tg(B" ",T3(B" ",Tk(B" ",TI(B" ",TH(B" ",Tn(B" ",Tl(B" ",TO(B" ; H .. O
205 ("6" ",TX(B") 94 ",T-(B" ",Tp(B" ",T1(B" ",T&(B" ",T8(B" ",Tj(B" ",TN(B" "\"" ; P .. W
206 ("^" ",TY(B") 95 ")" ",Tm(B" "(" ",T:(B" ",T_(B" ",TE(B" ",TY(B" ",Tx(B" ; X .. _
207 ("7" ",TV(B") 96 ",T#(B" ",T?(B" ",TT(B" ",Ta(B" ",T!(B" ",TS(B" ",T4(B" ",T`(B" ; ` .. g
208 ("&" "0,TQi1(B") 97 ",Ti(B" ",TC(B" ",Th(B" ",TR(B" ",TJ(B" ",T7(B" ",TW(B" ",T9(B" ; h .. o
209 ("8" (",T$(B" . thai-consonant-input)) 98 ",TB(B" ",Tf(B" ",T>(B" ",TK(B" ",TP(B" ",TU(B" ",TM(B" ",Td(B" ; p .. w
210 ("*" ",Tu(B") 99 ",T;(B" ",TQ(B" ",T<(B" ",T0(B" ",To(B" "." ",T%(B" 0 ; x .. DEL
211 ("9" (",T5(B" . thai-consonant-input)) 100 ]))
212 ("\(" ",Tv(B")
213 ("0" (",T((B" . thai-consonant-input))
214 ("\)" ",Tw(B")
215 ("-" (",T"(B" . thai-consonant-input))
216 ("_" ",Tx(B")
217 ("=" (",T*(B" . thai-consonant-input))
218 ("+" ",Ty(B")
219 ("\\" ",T_(B")
220 ("|" ",To(B")
221 ("`" (",T#(B" . thai-consonant-input))
222 ("~" (",T%(B" . thai-consonant-input))
223 ("q" ",Tf(B")
224 ("Q" ",Tp(B")
225 ("w" ",Td(B")
226 ("W" "\"")
227 ("e" ",TS(B")
228 ("E" (",T.(B" . thai-consonant-input))
229 ("r" (",T>(B" . thai-consonant-input))
230 ("R" (",T1(B" . thai-consonant-input))
231 ("t" ",TP(B")
232 ("T" (",T8(B" . thai-consonant-input))
233 ("y" ",TQ(B")
234 ("Y" ",Tm(B")
235 ("u" ",TU(B")
236 ("U" ",Tj(B")
237 ("i" (",TC(B" . thai-consonant-input))
238 ("I" (",T3(B" . thai-consonant-input))
239 ("o" (",T9(B" . thai-consonant-input))
240 ("O" ",TO(B")
241 ("p" (",TB(B" . thai-consonant-input))
242 ("P" (",T-(B" . thai-consonant-input))
243 ("\[" (",T:(B" . thai-consonant-input))
244 ("{" (",T0(B" . thai-consonant-input))
245 ("\]" (",TE(B" . thai-consonant-input))
246 ("}" ",")
247 101
248 ("a" (",T?(B" . thai-consonant-input))
249 ("A" ",TD(B")
250 ("s" (",TK(B" . thai-consonant-input))
251 ("S" (",T&(B" . thai-consonant-input))
252 ("d" (",T!(B" . thai-consonant-input))
253 ("D" (",T/(B" . thai-consonant-input))
254 ("f" (",T4(B" . thai-consonant-input))
255 ("F" ",Tb(B")
256 ("g" ",T`(B")
257 ("G" (",T,(B" . thai-consonant-input))
258 ("h" ",Ti(B")
259 ("H" ",Tg(B")
260 ("j" ",Th(B")
261 ("J" ",Tk(B")
262 ("k" ",TR(B")
263 ("K" (",TI(B" . thai-consonant-input))
264 ("l" (",TJ(B" . thai-consonant-input))
265 ("L" (",TH(B" . thai-consonant-input))
266 ("\;" (",TG(B" . thai-consonant-input))
267 (":" (",T+(B" . thai-consonant-input))
268 ("'" (",T'(B" . thai-consonant-input))
269 ("\"" ".")
270
271 ("z" (",T<(B" . thai-consonant-input))
272 ("Z" "(")
273 ("x" (",T;(B" . thai-consonant-input))
274 ("X" ")")
275 ("c" ",Ta(B")
276 ("C" (",T)(B" . thai-consonant-input))
277 ("v" (",TM(B" . thai-consonant-input))
278 ("V" (",TN(B" . thai-consonant-input))
279 ("b" ",TT(B")
280 ("B" ",TZ(B")
281 ("n" ",TW(B")
282 ("N" ",Tl(B")
283 ("m" (",T7(B" . thai-consonant-input))
284 ("M" ",Tn(B")
285 ("," (",TA(B" . thai-consonant-input))
286 ("<" (",T2(B" . thai-consonant-input))
287 ("." ",Tc(B")
288 (">" (",TL(B" . thai-consonant-input))
289 ("/" (",T=(B" . thai-consonant-input))
290 ("?" ",TF(B")
291 )
292 102
293 103
294;; Thai Pattachote keyboard support. 104;; Thai Pattachote keyboard support.
@@ -296,106 +106,22 @@ The difference from the ordinal Thai keyboard:
296(quail-define-package 106(quail-define-package
297 "thai-pattachote" "Thai" ",T!;(B>" t 107 "thai-pattachote" "Thai" ",T!;(B>" t
298 "Thai Pattachote input method with TIS620 keyboard layout" 108 "Thai Pattachote input method with TIS620 keyboard layout"
299 nil t t nil t nil nil nil nil nil t) 109 nil t t nil t nil nil nil 'quail-thai-update-translation nil t)
300 110
301(thai-quail-define-rules 'pattachote 111(quail-install-map
302 ("1" "=") 112 (thai-generate-quail-map
303 ("!" "+") 113 [ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; control codes
304 ("2" ",Tr(B") 114 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; control codes
305 ("@" "\"") 115 0 "+" ",T1(B" "/" "," "?" "_" ",T"(B" ; SPC .. '
306 ("3" ",Ts(B") 116 "(" ")" "." "%" ",TP(B" ",Tq(B" ",T((B" ",T>(B" ; ( .. /
307 ("#" "/") 117 ",Tp(B" "=" ",Tr(B" ",Ts(B" ",Tt(B" ",Tu(B" ",TY(B" ",Tw(B" ; 0 .. 7
308 ("4" ",Tt(B") 118 ",Tx(B" ",Ty(B" ",T&(B" ",Td(B" ",T?(B" ",Tv(B" ",T2(B" ",TL(B" ; 8 .. ?
309 ("$" ",") 119 "\"" ",Tk(B" ",TQ(B" ",T0(B" ",TS(B" ",Tf(B" ",T3(B" ",Tl(B" ; @ .. G
310 ("5" ",Tu(B") 120 ",TW(B" ",T+(B" ",T<(B" ",T*(B" ",Tb(B" ",TN(B" ",TH(B" ",T6(B" ; H .. O
311 ("%" "?") 121 ",T2(B" ",Tj(B" ",T-(B" ",T8(B" ",TI(B" ",T=(B" ",T@(B" ",TD(B" ; P .. W
312 ("6" ",TY(B") 122 ",T.(B" ",TV(B" ",T.(B" ",Tc(B" ",TZ(B" ",T2(B" ",TX(B" "-" ; X .. _
313 ("^" ",TX(B") 123 ",T#(B" ",Ti(B" ",TT(B" ",TE(B" ",T'(B" ",TB(B" ",T!(B" ",TQ(B" ; ` .. g
314 ("7" ",Tw(B") 124 ",TU(B" ",TA(B" ",TR(B" ",T9(B" ",T`(B" ",TJ(B" ",T$(B" ",TG(B" ; h .. o
315 ("&" "_") 125 ",Ta(B" ",Tg(B" ",TM(B" ",T7(B" ",TC(B" ",T4(B" ",TK(B" ",T5(B" ; p .. w
316 ("8" ",Tx(B") 126 ",T;(B" ",Th(B" ",T:(B" ",TO(B" ",Tm(B" ",TF(B" ",T%(B" 0 ; x .. DEL
317 ("*" ".") 127 ]))
318 ("9" ",Ty(B")
319 ("(" "(")
320 ("0" ",Tp(B")
321 (")" ")")
322 ("-" ",Tq(B")
323 ("_" "-")
324 ("=" ",Tv(B")
325 ("+" "%")
326 ("\\" ",TZ(B")
327 ("|" ",Tm(B")
328 ("`" (",T#(B" . thai-consonant-input))
329 ("~" (",T%(B" . thai-consonant-input))
330
331 ("q" ",Tg(B")
332 ("Q" ",Tj(B")
333 ("w" (",T5(B" . thai-consonant-input))
334 ("W" ",TD(B")
335 ("e" (",TB(B" . thai-consonant-input))
336 ("E" ",Tf(B")
337 ("r" (",TM(B" . thai-consonant-input))
338 ("R" (",T-(B" . thai-consonant-input))
339 ("t" (",TC(B" . thai-consonant-input))
340 ("T" (",TI(B" . thai-consonant-input))
341 ("y" ",Th(B")
342 ("Y" ",TV(B")
343 ("u" (",T4(B" . thai-consonant-input))
344 ("U" (",T=(B" . thai-consonant-input))
345 ("i" (",TA(B" . thai-consonant-input))
346 ("I" (",T+(B" . thai-consonant-input))
347 ("o" (",TG(B" . thai-consonant-input))
348 ("O" (",T6(B" . thai-consonant-input))
349 ("p" ",Ta(B")
350 ("P" (",T2(B" . thai-consonant-input))
351 ("\[" ",Tc(B")
352 ("{" ",TO(B")
353 ("\]" (",T2(B" . thai-consonant-input))
354 ("}" ",TF(B")
355
356 ("a" ",Ti(B")
357 ("A" ",Tk(B")
358 ("s" (",T7(B" . thai-consonant-input))
359 ("S" (",T8(B" . thai-consonant-input))
360 ("d" (",T'(B" . thai-consonant-input))
361 ("D" ",TS(B")
362 ("f" (",T!(B" . thai-consonant-input))
363 ("F" (",T3(B" . thai-consonant-input))
364 ("g" ",TQ(B")
365 ("G" ",Tl(B")
366 ("h" ",TU(B")
367 ("H" ",TW(B")
368 ("j" ",TR(B")
369 ("J" (",T<(B" . thai-consonant-input))
370 ("k" (",T9(B" . thai-consonant-input))
371 ("K" (",T*(B" . thai-consonant-input))
372 ("l" ",T`(B")
373 ("L" ",Tb(B")
374 (";" ",Td(B")
375 (":" (",T&(B" . thai-consonant-input))
376 ("'" (",T"(B" . thai-consonant-input))
377 ("\"" (",T1(B" . thai-consonant-input))
378
379 ("z" (",T:(B" . thai-consonant-input))
380 ("Z" (",T.(B" . thai-consonant-input))
381 ("x" (",T;(B" . thai-consonant-input))
382 ("X" (",T.(B" . thai-consonant-input))
383 ("c" (",TE(B" . thai-consonant-input))
384 ("C" (",T0(B" . thai-consonant-input))
385 ("v" (",TK(B" . thai-consonant-input))
386 ("V" (",T@(B" . thai-consonant-input))
387 ("b" ",TT(B")
388 ("B" ",TQ(B")
389 ("n" (",T$(B" . thai-consonant-input))
390 ("N" (",TH(B" . thai-consonant-input))
391 ("m" (",TJ(B" . thai-consonant-input))
392 ("M" (",TN(B" . thai-consonant-input))
393 ("," ",TP(B")
394 ("<" (",T?(B" . thai-consonant-input))
395 ("." (",T((B" . thai-consonant-input))
396 (">" (",T2(B" . thai-consonant-input))
397 ("/" (",T>(B" . thai-consonant-input))
398 ("?" (",TL(B" . thai-consonant-input))
399 )
400
401;;; quail/thai.el ends here
diff --git a/leim/quail/tibetan.el b/leim/quail/tibetan.el
index b6563d31b1d..e6d21a0cfc8 100644
--- a/leim/quail/tibetan.el
+++ b/leim/quail/tibetan.el
@@ -32,80 +32,109 @@
32;;; Code: 32;;; Code:
33 33
34(require 'quail) 34(require 'quail)
35 35(require 'tibet-util)
36;;; 36
37;;; Functions for making some composite punctuations. 37;; Now quail-current-key is set to Tibetan-Roman transcription. We
38;;; 38;; set quail-current-str to the corresponding Tibetan string (composed
39 39;; if necessary). Both Wylie and TibKey input methods use this
40(defun tibetan-quail-bzhi-shad (&rest ignore) 40;; function.
41 (quail-delete-region) 41
42 (quail-delete-overlays) 42(defun quail-tibetan-update-translation (control-flag)
43 (insert (compose-chars ?$(7!>(B '(mr . ml) ?\x20 '(mr . ml) ?$(7!>(B)) 43 (if (numberp control-flag)
44 (throw 'quail-tag nil)) 44 ;; Non-composable-character typed.
45 45 (setq quail-current-str
46(defun tibetan-quail-nyi-zla (&rest ignore) 46 (buffer-substring (overlay-start quail-overlay)
47 (quail-delete-region) 47 (overlay-end quail-overlay))
48 (quail-delete-overlays) 48 unread-command-events
49 (insert (compose-chars ?$(7#R(B '(mr . ml) ?$(7#S(B)) 49 (string-to-list
50 (throw 'quail-tag nil)) 50 (substring quail-current-key control-flag)))
51 51 ;; Special treatment of "-d..." and "-y...".
52(defun tibetan-quail-nyi-zla-phur-shad (&rest ignore) 52 (if (string-match "^-[dy]" quail-current-key)
53 (quail-delete-region) 53 (setq quail-current-key (substring quail-current-key 1)))
54 (quail-delete-overlays) 54 (let ((str (tibetan-transcription-to-tibetan quail-current-key)))
55 (insert (compose-chars ?$(7#R(B '(mr . ml) ?$(7#S(B '(bc . tl) ?$(7!I(B)) 55 ;; If quail-current-key is for punctuations, it can't be
56 (throw 'quail-tag nil)) 56 ;; transcribed by tibetan-transcription-to-tibetan, thus STR
57 57 ;; contains ASCII string now. In that case, use the current
58(defun tibetan-quail-nyi-zla-double (&rest ignore) 58 ;; characters set in quail-current-str.
59 (quail-delete-region) 59 (if (> (aref str 0) 255)
60 (quail-delete-overlays) 60 (setq quail-current-str (tibetan-compose-string str))
61 (insert (compose-chars ?$(7#R(B '(mr . ml) ?$(7#S(B '(mr . ml) ?$(7#S(B)) 61 (or quail-current-str
62 (throw 'quail-tag nil)) 62 (setq quail-current-str quail-current-key)))))
63 63 control-flag)
64(defun tibetan-quail-nyi-zla-triple (&rest ignore) 64
65 (quail-delete-region) 65;;; Wylie transcription based input methods.
66 (quail-delete-overlays) 66
67 (insert (compose-chars ?$(7#R(B '(mr . ml) ?$(7#S(B '(mr . ml) ?$(7#S(B '(mr . ml) ?$(7#S(B)) 67;; Special alist for `$(7"A(B'. It must be treated as a subjoined
68 (throw 'quail-tag nil)) 68;; consonant if it follows a consonant.
69 69(defconst tibetan-wylie-quote-alist '(("'" . ?$(7"A(B)))
70;;; 70
71;;; Setting-ups for Extended Wylie input. 71;; Special alist to avoid default stacking.
72;;; 72(defconst tibetan-wylie-non-stacking-alist
73 73 '(("-d" . "$(7"2(B")
74(defun quail-tibetan-input-wylie (key &rest ignore) 74 ("-y" . "$(7"B(B")))
75 (let (pc) 75
76 (quail-delete-region) 76;; Punctuations are not transcribed.
77 (quail-delete-overlays) 77
78 (setq pc (char-before (overlay-start quail-overlay)) 78(defconst tibetan-wylie-punctuation-alist
79 quail-current-str (tibetan-composition pc key)) 79 '(("." . " ")
80 (if (not (bobp)) 80 (":" . "$(8"`(B")
81 (progn 81 (" " . "$(8!;(B")
82 (delete-char -1) 82 ("/" . "$(8!=(B")
83 (insert (aref quail-current-str 0)) 83 ("//" . "$(7!>(B")
84 (setq quail-current-str (substring quail-current-str 1)))) 84 ("////" . ["$(7!>(B $(7!>(B"])
85 (move-overlay quail-overlay (point) (point)) 85 ("$" . "$(8!?(B")
86 (insert quail-current-str) 86 ("/\"" . "$(8!@(B") ; Not defined in Ext. Wylie.
87 (throw 'quail-tag nil))) 87 ("&" . "$(8!@(B")
88 88 (";" . "$(8!A(B")
89 ("%" . "$(8!D(B")
90 ("!" . "$(7!8(B")
91 ("<" . "$(7!l(B")
92 (">" . "$(7!m(B")
93 ("@" . "$(7"f(B")
94 ("*" . ["$(7!4!5(B"])
95 ("#" . ["$(7!4!5!5(B"])
96 ("^" . "$(7!6(B")
97 ("0" . "$(7!P(B")
98 ("1" . "$(7!Q(B")
99 ("2" . "$(7!R(B")
100 ("3" . "$(7!S(B")
101 ("4" . "$(7!T(B")
102 ("5" . "$(7!U(B")
103 ("6" . "$(7!V(B")
104 ("7" . "$(7!W(B")
105 ("8" . "$(7!X(B")
106 ("9" . "$(7!Y(B")
107 ("-0" . "$(7!c(B")
108 ("-1" . "$(7!Z(B")
109 ("-2" . "$(7![(B")
110 ("-3" . "$(7!\(B")
111 ("-4" . "$(7!](B")
112 ("-5" . "$(7!^(B")
113 ("-6" . "$(7!_(B")
114 ("-7" . "$(7!`(B")
115 ("-8" . "$(7!a(B")
116 ("-9" . "$(7!b(B")
117 ("|" . "$(7!1!2!3!9!:!B!C!E!F!G!H!I!J!K!L!M!N!O!d!f!h!j!k!n!o(B")))
89 118
90(quail-define-package "tibetan-wylie" "Tibetan" "TIBw" t 119(quail-define-package "tibetan-wylie" "Tibetan" "TIBw" t
91"Tibetan character input by Extended Wylie key assignment. 120"Tibetan character input by Extended Wylie key assignment.
92 121
93 +-------------------------------------+ 122 +-------------------------------------+
94 |2$(7"!`#T(B1$(8!;(B k |2$(7""`#T(B1$(8!;(B kh |2$(7"#`#T(B1$(8!;(B g |2$(7"$`#T(B1$(8!;(B gh |2$(7"%`#T(B1$(8!;(B ng| $(7"S(B i $(8!=(B / 123 |$(7"!$(8!;(B k |$(7""$(8!;(B kh |$(7"#$(8!;(B g |$(7"$$(8!;(B gh |$(7"%$(8!;(B ng| $(7"S(B i $(8!=(B /
95 |2$(7"&`#T(B1$(8!;(B c |2$(7"'`#T(B1$(8!;(B ch |2$(7"(`#T(B1$(8!;(B j | |$(7"*$(8!;(B ny| $(7"U(B u $(7!>(B // 124 |$(7"&$(8!;(B c |$(7"'$(8!;(B ch |$(7"($(8!;(B j | |$(7"*$(8!;(B ny| $(7"U(B u $(7!>(B //
96 |$(7"+$(8!;(B T |$(7",$(8!;(B TH |$(7"-$(8!;(B D |$(7".$(8!;(B DH |$(7"/$(8!;(B N | $(7"[(B e 2$(7!>P(B P$(7!>(B1 //// 125 |$(7"+$(8!;(B T |$(7",$(8!;(B TH |$(7"-$(8!;(B D |$(7".$(8!;(B DH |$(7"/$(8!;(B N | $(7"[(B e $(7!>(B $(7!>(B ////
97 |$(7"0$(8!;(B t |$(7"1$(8!;(B th |$(7"2$(8!;(B d |$(7"3$(8!;(B dh |$(7"4$(8!;(B n | $(7"](B o $(7!A(B ; 126 |$(7"0$(8!;(B t |$(7"1$(8!;(B th |$(7"2$(8!;(B d |$(7"3$(8!;(B dh |$(7"4$(8!;(B n | $(7"](B o $(7!A(B ;
98 |$(7"5$(8!;(B p |$(7"6$(8!;(B ph |$(7"7$(8!;(B b |$(7"8$(8!;(B bh |$(7"9$(8!;(B m | $(7"\(B ai (ee, E) $(8!?(B $ 127 |$(7"5$(8!;(B p |$(7"6$(8!;(B ph |$(7"7$(8!;(B b |$(7"8$(8!;(B bh |$(7"9$(8!;(B m | $(7"\(B ai (ee, E) $(8!?(B $
99 |$(7":$(8!;(B ts|$(7";$(8!;(B tsh|$(7"<$(8!;(B dz |$(7"=$(8!;(B dzh|$(7">$(8!;(B w | $(7"^(B au (oo, O) $(8!@(B & 128 |$(7":$(8!;(B ts|$(7";$(8!;(B tsh|$(7"<$(8!;(B dz |$(7"=$(8!;(B dzh|$(7">$(8!;(B w | $(7"^(B au (oo, O) $(8!@(B &
100 |$(7"?$(8!;(B zh|$(7"@$(8!;(B z |$(7"A$(8!;(B ' | |$(7"B$(8!;(B y | $(7"a(B I 2$(7#RP#SP#S(B1 * 129 |$(7"?$(8!;(B zh|$(7"@$(8!;(B z |$(7"A$(8!;(B ' | |$(7"B$(8!;(B y | $(7"a(B I $(7#R#S#S(B *
101 |$(7"C$(8!;(B r |$(7"D$(8!;(B l |$(7"E$(8!;(B sh |$(7"F$(8!;(B SH |$(7"G$(8!;(B s | $(7"`(B : 2$(7#RP#SP#SP#S(B1 # 130 |$(7"C$(8!;(B r |$(7"D$(8!;(B l |$(7"E$(8!;(B sh |$(7"F$(8!;(B SH |$(7"G$(8!;(B s | $(7"`(B : $(7#R#S#S#S(B #
102 |$(7"H$(8!;(B h |$(7"I$(8!;(B A |$(7"J$(8!;(B kSH| | | $(7"_(B M $(7!l(B $(7!m(B < > 131 |$(7"H$(8!;(B h |$(7"I$(8!;(B A |$(7"J$(8!;(B kSH| | | $(7"_(B M $(7!l(B $(7!m(B < >
103 +-------------------------------------+ $(8!D(B % 132 +-------------------------------------+ $(8!D(B %
104 (The consonant $(7"I$(8!;(B must be typed explicitly.) 133 (The consonant $(7"I$(8!;(B must be typed explicitly.)
105 134
106 NOT SPECIFIED IN EXT. WYLIE: 135 NOT SPECIFIED IN EXT. WYLIE:
107 +--------------------------------------------------------+ 136 +--------------------------------------------------------+
108 |$(7"c(B = ~ |$(7"d(B = ` |$(7"e(B = , |$(7"f(B = @ |$(7!g(B = _o|$(7!e(B = _O|2$(7#RP#S_!I(B1 = ^| 137 |$(7"c(B = ~ |$(7"d(B = ` |$(7"e(B = , |$(7"f(B = @ |$(7!g(B = _o|$(7!e(B = _O|$(7#R#S!I(B = ^|
109 +--------------------------------------------------------+ 138 +--------------------------------------------------------+
110 |$(7"i(B = x |$(7"j(B = X |$(7"g(B = v |$(7"h(B = V |$(7"k(B = q |$(7"l(B = Q | 139 |$(7"i(B = x |$(7"j(B = X |$(7"g(B = v |$(7"h(B = V |$(7"k(B = q |$(7"l(B = Q |
111 +-----------------------------------------------+ 140 +-----------------------------------------------+
@@ -120,127 +149,40 @@
120 149
121 Tsheg is assigned to SPC. Space is assigned to period '.'. 150 Tsheg is assigned to SPC. Space is assigned to period '.'.
122" 151"
123 nil nil nil) 152 nil nil nil nil nil nil nil nil
124 153 'quail-tibetan-update-translation)
125(quail-define-rules 154
126 ("." ?\x20) 155;; Here we build up a Quail map for a Tibtan sequence the whole of
127 ("k" quail-tibetan-input-wylie) 156;; which can be one composition.
128 ("g" quail-tibetan-input-wylie) 157;;
129 ("c" quail-tibetan-input-wylie) 158;; A Tibetan syllable is typically structured as follows:
130 ("j" quail-tibetan-input-wylie) 159;; [P] C [c+] V [M] [S [s]]
131 ("T" quail-tibetan-input-wylie) 160;; ^^^^^^^^^^^^
132 ("D" quail-tibetan-input-wylie) 161;; where P:prefix, C:base consonant, c:subjoined consonant,
133 ("N" quail-tibetan-input-wylie) 162;; V:vowel, M:vowel modifier, S:suffix, s:post suffix.
134 ("t" quail-tibetan-input-wylie) 163;; In this pattern, the part indicated by "^^^" can be one composition.
135 ("d" quail-tibetan-input-wylie) 164
136 ("n" quail-tibetan-input-wylie) 165(quail-install-map
137 ("p" quail-tibetan-input-wylie) 166 (quail-map-from-table
138 ("b" quail-tibetan-input-wylie) 167 '((base-state (tibetan-consonant-transcription-alist . sq-state)
139 ("m" quail-tibetan-input-wylie) 168 (tibetan-precomposed-transcription-alist . s-state)
140 ("w" quail-tibetan-input-wylie) 169 (tibetan-wylie-non-stacking-alist . sq-state)
141 ("z" quail-tibetan-input-wylie) 170 tibetan-subjoined-transcription-alist
142 ("'" quail-tibetan-input-wylie) 171 tibetan-vowel-transcription-alist
143 ("y" quail-tibetan-input-wylie) 172 tibetan-modifier-transcription-alist
144 ("r" quail-tibetan-input-wylie) 173 tibetan-wylie-punctuation-alist)
145 ("l" quail-tibetan-input-wylie) 174 (sq-state (tibetan-wylie-quote-alist . s-state)
146 ("SH" quail-tibetan-input-wylie) 175 (tibetan-subjoined-transcription-alist . s-state))
147 ("s" quail-tibetan-input-wylie) 176 (s-state (tibetan-subjoined-transcription-alist . s-state)
148 ("h" quail-tibetan-input-wylie) 177 (tibetan-vowel-transcription-alist . m-state))
149 ("H" quail-tibetan-input-wylie) 178 (m-state tibetan-modifier-transcription-alist))))
150 ("A" quail-tibetan-input-wylie)
151 ("+k" quail-tibetan-input-wylie)
152 ("+g" quail-tibetan-input-wylie)
153 ("+c" quail-tibetan-input-wylie)
154 ("+j" quail-tibetan-input-wylie)
155 ("+T" quail-tibetan-input-wylie)
156 ("+D" quail-tibetan-input-wylie)
157 ("+N" quail-tibetan-input-wylie)
158 ("+t" quail-tibetan-input-wylie)
159 ("+d" quail-tibetan-input-wylie)
160 ("+n" quail-tibetan-input-wylie)
161 ("+p" quail-tibetan-input-wylie)
162 ("+b" quail-tibetan-input-wylie)
163 ("+m" quail-tibetan-input-wylie)
164 ("+w" quail-tibetan-input-wylie)
165 ("+z" quail-tibetan-input-wylie)
166 ("+'" quail-tibetan-input-wylie)
167 ("+y" quail-tibetan-input-wylie)
168 ("+r" quail-tibetan-input-wylie)
169 ("+l" quail-tibetan-input-wylie)
170 ("+SH" quail-tibetan-input-wylie)
171 ("+s" quail-tibetan-input-wylie)
172 ("+h" quail-tibetan-input-wylie)
173 ("+H" quail-tibetan-input-wylie)
174 ("+A" quail-tibetan-input-wylie)
175 ("-d" ?$(7"2(B) ; To avoid default stacking
176 ("-y" ?$(7"B(B) ; Idem.
177 ("a" quail-tibetan-input-wylie) ; invisible vowel sign
178 ("i" quail-tibetan-input-wylie)
179 ("u" quail-tibetan-input-wylie)
180 ("e" quail-tibetan-input-wylie)
181 ("o" quail-tibetan-input-wylie)
182 ("I" quail-tibetan-input-wylie)
183 ("E" quail-tibetan-input-wylie)
184 ("O" quail-tibetan-input-wylie)
185 ("M" quail-tibetan-input-wylie)
186 ("~" quail-tibetan-input-wylie)
187 ("`" quail-tibetan-input-wylie)
188 ("," quail-tibetan-input-wylie)
189 ("x" quail-tibetan-input-wylie)
190 ("X" quail-tibetan-input-wylie)
191 ("v" quail-tibetan-input-wylie)
192 ("V" quail-tibetan-input-wylie)
193 ("q" quail-tibetan-input-wylie)
194 ("Q" quail-tibetan-input-wylie)
195 ("_o" quail-tibetan-input-wylie)
196 ("_O" quail-tibetan-input-wylie)
197;;; ("_/" quail-tibetan-input-wylie)
198 (":" ?$(8"`(B)
199 (" " ?$(8!;(B)
200 ("/" ?$(8!=(B)
201 ("//" ?$(7!>(B)
202 ("////" tibetan-quail-bzhi-shad)
203 ("$" ?$(8!?(B)
204 ("/\"" ?$(8!@(B) ; Not defined in Ext. Wylie.
205 ("&" ?$(8!@(B)
206 (";" ?$(8!A(B)
207 ("%" ?$(8!D(B)
208 ("!" ?$(7!8(B)
209 ("<" ?$(7!l(B)
210 (">" ?$(7!m(B)
211 ("@" ?$(7"f(B)
212 ("*" tibetan-quail-nyi-zla-double)
213 ("#" tibetan-quail-nyi-zla-triple)
214 ("^" tibetan-quail-nyi-zla-phur-shad)
215 ("0" ?$(7!P(B)
216 ("1" ?$(7!Q(B)
217 ("2" ?$(7!R(B)
218 ("3" ?$(7!S(B)
219 ("4" ?$(7!T(B)
220 ("5" ?$(7!U(B)
221 ("6" ?$(7!V(B)
222 ("7" ?$(7!W(B)
223 ("8" ?$(7!X(B)
224 ("9" ?$(7!Y(B)
225 ("-0" ?$(7!c(B)
226 ("-1" ?$(7!Z(B)
227 ("-2" ?$(7![(B)
228 ("-3" ?$(7!\(B)
229 ("-4" ?$(7!](B)
230 ("-5" ?$(7!^(B)
231 ("-6" ?$(7!_(B)
232 ("-7" ?$(7!`(B)
233 ("-8" ?$(7!a(B)
234 ("-9" ?$(7!b(B)
235 ("|" "$(7!1!2!3!9!:!B!C!E!F!G!H!I!J!K!L!M!N!O!d!f!h!j!k!n!o(B")
236 )
237 179
238;;; 180;;;
239;;; Setting-ups for TibKey input 181;;; TibKey key alignment based input method
240;;; 182;;;
241 183
242(defconst tibetan-tibkey-to-transcription-alist 184(defconst tibetan-tibkey-to-transcription-alist
243 '( 185 '(;; consonant
244 ("`" . "`") ; sna ldan 186 ("`" . "`") ; sna ldan
245 ("~" . "~") ; sna ldan + nada 187 ("~" . "~") ; sna ldan + nada
246 ("q" . "k") ; ka 188 ("q" . "k") ; ka
@@ -292,7 +234,7 @@
292 ("," . "s") ; sa 234 ("," . "s") ; sa
293 ("." . "h") ; ha 235 ("." . "h") ; ha
294 ("/" . "A") ; Aa 236 ("/" . "A") ; Aa
295 ;;subjoined 237 ;; subjoined
296 ("hq" . "+k") ; ka 238 ("hq" . "+k") ; ka
297 ("hQ" ."+kSH") ; kSHa 239 ("hQ" ."+kSH") ; kSHa
298 ("hw" . "+kh") ; kha 240 ("hw" . "+kh") ; kha
@@ -329,30 +271,118 @@
329 ("h," . "+s") ; sa 271 ("h," . "+s") ; sa
330 ("h." . "+h") ; ha 272 ("h." . "+h") ; ha
331 ("h/" . "+A") ; Aa 273 ("h/" . "+A") ; Aa
274 ;; Special rule for `$(7"B(B' to avoid stacking.
275 ("E" . "-y")
332 )) 276 ))
333 277
334(defun quail-tibetan-input-tibkey (key &rest ignore) 278(defconst tibetan-consonant-tibkey-alist nil)
335 (let (trans pc) 279(defconst tibetan-subjoined-tibkey-alist nil)
336 (setq trans (cdr (assoc key tibetan-tibkey-to-transcription-alist))) 280(defconst tibetan-vowel-tibkey-alist nil)
337 (quail-delete-region) 281(defconst tibetan-modifier-tibkey-alist nil)
338 (quail-delete-overlays) 282(defconst tibetan-non-stacking-tibkey-alist nil)
339 (setq pc (char-before (overlay-start quail-overlay)) 283
340 quail-current-str (tibetan-composition pc trans)) 284(let ((type-list '("consonant" "subjoined" "vowel" "modifier" "non-stacking"))
341 (if (not (bobp)) 285 (tail tibetan-tibkey-to-transcription-alist)
342 (progn 286 elt)
343 (delete-char -1) 287 (while tail
344 (insert (aref quail-current-str 0)) 288 (setq elt (car tail) tail (cdr tail))
345 (setq quail-current-str (substring quail-current-str 1)))) 289 (let ((types type-list)
346 (move-overlay quail-overlay (point) (point)) 290 type transcription trans-alist tibkey-alist)
347 (insert quail-current-str) 291 (while types
348 (throw 'quail-tag nil))) 292 (setq type (car types) types (cdr types))
349 293 (setq trans-alist
294 (if (string= type "non-stacking")
295 'tibetan-wylie-non-stacking-alist
296 (intern (format "tibetan-%s-transcription-alist" type)))
297 transcription
298 (cdr (assoc (cdr elt) (symbol-value trans-alist))))
299 (when transcription
300 (setq tibkey-alist (intern (format "tibetan-%s-tibkey-alist" type)))
301 (set tibkey-alist
302 (cons (cons (car elt) transcription)
303 (symbol-value tibkey-alist)))))
304 (or tibkey-alist
305 (error "No Tibetan transcription for %s" (cdr elt))))))
306
307(defconst tibetan-punctuation-tibkey-alist
308 '(("1" . "$(7!Q(B")
309 ("!" . ["$(7#R#S#S#S(B"]) ; nyi zla long
310 ("2" . "$(7!R(B")
311 ("@" . "$(7#S(B") ; nyi zla simple
312 ("3" . "$(7!S(B")
313;;; ("#" )
314 ("4" . "$(7!T(B")
315;;; ("$" )
316 ("5" . "$(7!U(B")
317 ("%" . "$(8!D(B")
318 ("6" . "$(7!V(B")
319 ("^" . "$(7!1(B")
320 ("7" . "$(7!W(B")
321 ("8" . "$(7!X(B")
322;;; ("*" ) ; avagraha, not supported yet
323 ("9" . "$(7!Y(B")
324 ("(" . "$(7!l(B")
325 ("0" . "$(7!P(B")
326 (")" . "$(7!m(B")
327;;; ("-" ) ; enphatic, not yet supported
328;;; ("_" ) ; id.
329;;; ("=" ) ; special sign, not yet supported
330 ("+" . "$(8!A(B")
331 ("\\" . "$(8!?(B")
332 ("|" . "$(7!8(B")
333 ("I" . "$(7"f(B") ; avagraha
334 (":" . "$(8"`(B")
335;;; (">" ?$(8!;(B) ; to be assigned to SPC
336 (">" . " ")
337 ("?" . "$(8!=(B")
338 ("??" . "$(7!>(B")
339 ("????" . ["$(7!>(B $(7!>(B"])
340 (" " . "$(8!;(B")
341 ))
350 342
343;; Convert TibKey string to Tibetan-Roman transcription string.
344;; If there's no proper conversion, return nil.
345(defun quail-tibkey-to-transcription (tibkey)
346 (let ((len (length tibkey))
347 (i 0)
348 (trans-list nil))
349 (while (< i len)
350 (let ((last len)
351 trans)
352 (while (and (not trans) (> last i))
353 (or (setq trans (cdr (assoc (substring tibkey i last)
354 tibetan-tibkey-to-transcription-alist)))
355 (setq last (1- last))))
356 (if trans
357 (setq trans-list (cons trans trans-list)
358 i last)
359 (setq trans-list nil i len))))
360 (apply 'concat (nreverse trans-list))))
361
362(defvar quail-tibkey-characters nil)
363
364(defun quail-tibkey-update-translation (control-flag)
365 (if (integerp control-flag)
366 ;; Non-composable-character typed.
367 (setq quail-current-str
368 (buffer-substring (overlay-start quail-overlay)
369 (overlay-end quail-overlay))
370 unread-command-events
371 (string-to-list
372 (substring quail-current-key control-flag)))
373 (let ((transcription (quail-tibkey-to-transcription quail-current-key)))
374 (if (> (length transcription) 0)
375 (let ((quail-current-key transcription))
376 (setq control-flag
377 (quail-tibetan-update-translation control-flag)))
378 (or quail-current-str
379 (setq quail-current-str quail-current-key)))))
380 control-flag)
351 381
352(quail-define-package "tibetan-tibkey" "Tibetan" "TIBt" t 382(quail-define-package "tibetan-tibkey" "Tibetan" "TIBt" t
353"Tibetan character input by TibKey key assignment. 383"Tibetan character input by TibKey key assignment.
354 384
355(This implementation is still incomplete. 385\(This implementation is still incomplete.
356 Therefore, the following key assignment is a provisional one.) 386 Therefore, the following key assignment is a provisional one.)
357 387
358 [NOT SHIFTED] 388 [NOT SHIFTED]
@@ -371,7 +401,7 @@
371 [SHIFTED] 401 [SHIFTED]
372 402
373 +----------------------------------------------------------+ 403 +----------------------------------------------------------+
374 |~$(7"c(B|!2$(7#RP#S(B1|@$(7#S(B|# |$ |%$(8!D(B |^$(7!1(B|& |* |($(7!l(B|)$(7!m(B|_ |+$(7!A(B| |$(7!8(B| 404 |~$(7"c(B|!$(7#R#S(B|@$(7#S(B|# |$ |%$(8!D(B |^$(7!1(B|& |* |($(7!l(B|)$(7!m(B|_ |+$(7!A(B| |$(7!8(B|
375 +----------------------------------------------------------+ 405 +----------------------------------------------------------+
376 |Q$(7"J(B|W$(7#T(B|E |R |T$(7"a(B|Y |U |I$(7"f(B|O$(7"+(B|P$(7",(B|{$(7"-(B|}$(7"/(B| 406 |Q$(7"J(B|W$(7#T(B|E |R |T$(7"a(B|Y |U |I$(7"f(B|O$(7"+(B|P$(7",(B|{$(7"-(B|}$(7"/(B|
377 +-----------------------------------------------+ 407 +-----------------------------------------------+
@@ -394,136 +424,17 @@
394 current implementation (especially special signs). I hope 424 current implementation (especially special signs). I hope
395 I'll complete in a future revision. 425 I'll complete in a future revision.
396" 426"
397 nil t) 427 nil nil nil nil nil nil nil nil
398 428 'quail-tibkey-update-translation)
399(quail-define-rules 429
400 ("`" quail-tibetan-input-tibkey) ; sna ldan, not supported yet 430(quail-install-map
401 ("~" quail-tibetan-input-tibkey) ; sna ldan + nada 431 (quail-map-from-table
402 ("1" ?$(7!Q(B) 432 '((base-state (tibetan-consonant-tibkey-alist . s-state)
403 ("!" tibetan-quail-nyi-zla) ; nyi zla long 433 (tibetan-non-stacking-tibkey-alist . s-state)
404 ("2" ?$(7!R(B) 434 tibetan-subjoined-tibkey-alist
405 ("@" ?$(7#S(B) ; nyi zla simple 435 tibetan-vowel-tibkey-alist
406 ("3" ?$(7!S(B) 436 tibetan-modifier-tibkey-alist
407;;; ("#" ) 437 tibetan-punctuation-tibkey-alist)
408 ("4" ?$(7!T(B) 438 (s-state (tibetan-subjoined-tibkey-alist . s-state)
409;;; ("$" ) 439 (tibetan-vowel-tibkey-alist . m-state))
410 ("5" ?$(7!U(B) 440 (m-state tibetan-modifier-tibkey-alist))))
411 ("%" ?$(8!D(B)
412 ("6" ?$(7!V(B)
413 ("^" ?$(7!1(B)
414 ("7" ?$(7!W(B)
415 ("8" ?$(7!X(B)
416;;; ("*" ) ; avagraha, not supported yet
417 ("9" ?$(7!Y(B)
418 ("(" ?$(7!l(B)
419 ("0" ?$(7!P(B)
420 (")" ?$(7!m(B)
421;;; ("-" ) ; enphatic, not yet supported
422;;; ("_" ) ; id.
423;;; ("=" ) ; special sign, not yet supported
424 ("+" ?$(8!A(B)
425 ("\\" ?$(8!?(B)
426 ("|" ?$(7!8(B)
427 ("q" quail-tibetan-input-tibkey) ; ka
428 ("Q" quail-tibetan-input-tibkey) ; kSHa
429 ("w" quail-tibetan-input-tibkey) ; kha
430 ("e" quail-tibetan-input-tibkey) ; ga
431 ("E" ?$(7"B(B)
432 ("r" quail-tibetan-input-tibkey) ; nga
433 ("t" quail-tibetan-input-tibkey) ; ca
434 ("T" quail-tibetan-input-tibkey) ; gi gu log
435 ("y" quail-tibetan-input-tibkey) ; cha
436 ("u" quail-tibetan-input-tibkey) ; ja
437 ("i" quail-tibetan-input-tibkey) ; nya
438 ("I" ?$(7"f(B) ; avagraha
439 ("o" quail-tibetan-input-tibkey) ; ta
440 ("O" quail-tibetan-input-tibkey) ; Ta
441 ("p" quail-tibetan-input-tibkey) ; tha
442 ("P" quail-tibetan-input-tibkey) ; THa
443 ("[" quail-tibetan-input-tibkey) ; da
444 ("{" quail-tibetan-input-tibkey) ; Da
445 ("]" quail-tibetan-input-tibkey) ; na
446 ("}" quail-tibetan-input-tibkey) ; Na
447 ("a" quail-tibetan-input-tibkey) ; pa
448 ("A" quail-tibetan-input-tibkey) ; Vowel sign a
449 ("s" quail-tibetan-input-tibkey) ; pha
450 ("d" quail-tibetan-input-tibkey) ; ba
451;;; ("D" ) ; special sign, not supported yet
452 ("f" quail-tibetan-input-tibkey) ; ma
453 ("F" quail-tibetan-input-tibkey) ; anusvara
454 ("g" quail-tibetan-input-tibkey) ; zhabs kyu
455 ("G" quail-tibetan-input-tibkey) ; gi gu
456 ("H" quail-tibetan-input-tibkey) ; viraama
457 ("j" quail-tibetan-input-tibkey) ; naro
458 ("J" quail-tibetan-input-tibkey) ; 'greng bu
459 ("k" quail-tibetan-input-tibkey);;tsa
460;;; ("K" ) ; tsadru, not supported yet
461 ("l" quail-tibetan-input-tibkey) ; tsha
462 (";" quail-tibetan-input-tibkey) ; dza
463 (":" ?$(8"`(B)
464 ("'" quail-tibetan-input-tibkey) ; wa
465 ("\"" quail-tibetan-input-tibkey) ; wa zur
466 ("z" quail-tibetan-input-tibkey) ; zha
467 ("x" quail-tibetan-input-tibkey) ; za
468 ("c" quail-tibetan-input-tibkey) ; 'a
469 ("C" quail-tibetan-input-tibkey) ; 'a chung
470 ("v" quail-tibetan-input-tibkey) ; ya
471 ("V" quail-tibetan-input-tibkey) ; ya btags
472 ("b" quail-tibetan-input-tibkey) ; ra
473 ("B" quail-tibetan-input-tibkey) ; ra btags
474 ("n" quail-tibetan-input-tibkey) ; la
475 ("N" quail-tibetan-input-tibkey) ; la btags
476 ("m" quail-tibetan-input-tibkey) ; sha
477 ("M" quail-tibetan-input-tibkey) ; SHa
478 ("," quail-tibetan-input-tibkey) ; sa
479 ("." quail-tibetan-input-tibkey) ; ha
480;;; (">" ?$(8!;(B) ; to be assigned to SPC
481 (">" ?\x20)
482 ("/" quail-tibetan-input-tibkey) ; Aa
483 ("?" ?$(8!=(B)
484 ("??" ?$(7!>(B)
485 ("????" tibetan-quail-bzhi-shad)
486 (" " ?$(8!;(B)
487 ;;subjoined
488 ("hq" quail-tibetan-input-tibkey) ; ka
489 ("hQ" quail-tibetan-input-tibkey) ; kSHa
490 ("hw" quail-tibetan-input-tibkey) ; kha
491 ("he" quail-tibetan-input-tibkey) ; ga
492 ("hr" quail-tibetan-input-tibkey) ; nga
493 ("ht" quail-tibetan-input-tibkey) ; ca
494 ("hy" quail-tibetan-input-tibkey) ; cha
495 ("hu" quail-tibetan-input-tibkey) ; ja
496 ("hi" quail-tibetan-input-tibkey) ; nya
497 ("ho" quail-tibetan-input-tibkey) ; ta
498 ("hO" quail-tibetan-input-tibkey) ; Ta
499 ("hp" quail-tibetan-input-tibkey) ; tha
500 ("hP" quail-tibetan-input-tibkey) ; THa
501 ("h[" quail-tibetan-input-tibkey) ; da
502 ("h{" quail-tibetan-input-tibkey) ; Da
503 ("h]" quail-tibetan-input-tibkey) ; na
504 ("h}" quail-tibetan-input-tibkey) ; Na
505 ("ha" quail-tibetan-input-tibkey) ; pa
506 ("hs" quail-tibetan-input-tibkey) ; pha
507 ("hd" quail-tibetan-input-tibkey) ; ba
508 ("hf" quail-tibetan-input-tibkey) ; ma
509 ("hk" quail-tibetan-input-tibkey) ; tsa
510 ("hl" quail-tibetan-input-tibkey) ; tsha
511 ("h;" quail-tibetan-input-tibkey) ; dza
512 ("h'" quail-tibetan-input-tibkey) ; wa
513 ("hz" quail-tibetan-input-tibkey) ; zha
514 ("hx" quail-tibetan-input-tibkey) ; za
515 ("hc" quail-tibetan-input-tibkey) ; 'a
516 ("hv" quail-tibetan-input-tibkey) ; ya
517 ("hb" quail-tibetan-input-tibkey) ; ra
518 ("hn" quail-tibetan-input-tibkey) ; la
519 ("hm" quail-tibetan-input-tibkey) ; sha
520 ("hM" quail-tibetan-input-tibkey) ; SHa
521 ("h," quail-tibetan-input-tibkey) ; sa
522 ("h." quail-tibetan-input-tibkey) ; ha
523 ("h/" quail-tibetan-input-tibkey) ; Aa
524 )
525
526;;; quail/tibetan.el ends here.
527
528
529