Mercurial > emacs
comparison leim/quail/lrt.el @ 19260:2d94069b1e81
Change title string of input method "lao-lrt".
(lrt-single-consonant-table): Several key sequence changed.
(lrt-composing-pattern-double-c): Handle a consonant with
semi-vowel-lower correctly.
(lrt-handle-maa-sakod): Do not reset quail-current-key.
(lrt-handle-tone-mark): Check the existence of double consonant
correctly.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Sun, 10 Aug 1997 04:04:35 +0000 |
parents | 48e05cca9d7b |
children | 314fa41f0155 |
comparison
equal
deleted
inserted
replaced
19259:4a2b7dc8a86f | 19260:2d94069b1e81 |
---|---|
34 (eval-and-compile | 34 (eval-and-compile |
35 | 35 |
36 ;; Upper vowels and tone-marks are put on the letter. | 36 ;; Upper vowels and tone-marks are put on the letter. |
37 ;; Semi-vowel-sign-lo and lower vowels are put under the letter. | 37 ;; Semi-vowel-sign-lo and lower vowels are put under the letter. |
38 (defconst lrt-single-consonant-table | 38 (defconst lrt-single-consonant-table |
39 '(("k" . ?(1!(B) | 39 `(("k" . ?(1!(B) |
40 ("kh" . ?(1"(B) | 40 ("kh" . ?(1"(B) |
41 ("qh" . ?(1$(B) | 41 ("qh" . ?(1$(B) |
42 ("ng" . ?(1'(B) | 42 ("ng" . ?(1'(B) |
43 ("j" . ?(1((B) | 43 ("j" . ?(1((B) |
44 ("s" . ?(1J(B) | 44 ("s" . ?(1J(B) |
64 ("hh" . ?(1K(B) | 64 ("hh" . ?(1K(B) |
65 ("O" . ?(1M(B) | 65 ("O" . ?(1M(B) |
66 ("h" . ?(1N(B) | 66 ("h" . ?(1N(B) |
67 ("nh" . ?(1|(B) | 67 ("nh" . ?(1|(B) |
68 ("mh" . ?(1}(B) | 68 ("mh" . ?(1}(B) |
69 ("lh" . ?0(1K\1(B) | 69 ("lh" . "0(1K\1(B") |
70 )) | 70 )) |
71 | 71 |
72 ;; Semi-vowel-sign-lo is put under the first letter. | 72 ;; Semi-vowel-sign-lo is put under the first letter. |
73 ;; Lower vowels are put under the last letter. | 73 ;; Lower vowels are put under the last letter. |
74 ;; Upper vowels and tone-marks are put on the last letter. | 74 ;; Upper vowels and tone-marks are put on the last letter. |
102 ("oo" "(1b(B" (?(1b(B 0)) | 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)) | 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)) | 104 ("or" "(1m(B" (0 ?(1m(B) (0 ?(1M(B)) |
105 ("er" "(1`(B (1T(B" (?(1`(B 0 ?(1T(B)) | 105 ("er" "(1`(B (1T(B" (?(1`(B 0 ?(1T(B)) |
106 ("ir" "(1`(B (1U(B" (?(1`(B 0 ?(1U(B)) | 106 ("ir" "(1`(B (1U(B" (?(1`(B 0 ?(1U(B)) |
107 ("oua" "(1[GP(B" (0 ?(1[(B ?(1G(B ?(1P(B) (0 ?(1Q(B ?(1G(B)) | 107 ("ua" "(1[GP(B" (0 ?(1[(B ?(1G(B ?(1P(B) (0 ?(1Q(B ?(1G(B)) |
108 ("ua" "(1[G(B" (0 ?(1[(B ?(1G(B) (0 ?(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)) | 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)) | 110 ("ia" "(1`Q](B" (?(1`(B 0 ?(1Q(B ?(1](B) (0 ?(1](B)) |
111 ("eua" "(1`VM(B" (?(1`(B 0 ?(1V(B ?(1M(B)) | 111 ("ea" "(1`VM(B" (?(1`(B 0 ?(1V(B ?(1M(B)) |
112 ("ea" "(1`WM(B" (?(1`(B 0 ?(1W(B ?(1M(B)) | 112 ("eaa" "(1`WM(B" (?(1`(B 0 ?(1W(B ?(1M(B)) |
113 ("ai" "(1d(B" (?(1d(B 0)) | 113 ("ai" "(1d(B" (?(1d(B 0)) |
114 ("ei" "(1c(B" (?(1c(B 0)) | 114 ("ei" "(1c(B" (?(1c(B 0)) |
115 ("ao" "(1`[R(B" (?(1`(B 0 ?(1[(B ?(1R(B)) | 115 ("ao" "(1`[R(B" (?(1`(B 0 ?(1[(B ?(1R(B)) |
116 ("arm" "(1S(B" (?(1S(B 0)))) | 116 ("aM" "(1S(B" (?(1S(B 0)))) |
117 | 117 |
118 ;; Maa-sakod is put at the tail. | 118 ;; Maa-sakod is put at the tail. |
119 (defconst lrt-maa-sakod-table | 119 (defconst lrt-maa-sakod-table |
120 '((?k . ?(1!(B) | 120 '((?k . ?(1!(B) |
121 (?g . ?(1'(B) | 121 (?g . ?(1'(B) |
158 ;; key sequence and with-maa-sakod key sequence starting with double | 158 ;; key sequence and with-maa-sakod key sequence starting with double |
159 ;; consonant STR and optional SEMI-VOWEL. | 159 ;; consonant STR and optional SEMI-VOWEL. |
160 (defun lrt-composing-pattern-double-c (str semi-vowel vowel-pattern) | 160 (defun lrt-composing-pattern-double-c (str semi-vowel vowel-pattern) |
161 (let* ((patterns (copy-sequence vowel-pattern)) | 161 (let* ((patterns (copy-sequence vowel-pattern)) |
162 (tail patterns) | 162 (tail patterns) |
163 (chars (string-to-list str)) | 163 (chars (string-to-list |
164 (if (= (chars-in-string str) 1) | |
165 (decompose-string str) | |
166 str))) | |
164 place) | 167 place) |
165 ;; Embed C and SEMI-VOWEL (if any) at the place of 0. | 168 ;; Embed C and SEMI-VOWEL (if any) at the place of 0. |
166 (while tail | 169 (while tail |
167 ;; At first, make a copy. | 170 ;; At first, make a copy. |
168 (setcar tail (copy-sequence (car tail))) | 171 (setcar tail (copy-sequence (car tail))) |
233 (nth 1 quail-current-data)) | 236 (nth 1 quail-current-data)) |
234 (list maa-sakod)))) | 237 (list maa-sakod)))) |
235 (quail-delete-region) | 238 (quail-delete-region) |
236 (setq quail-current-str (lrt-compose-string maa-sakod-pattern)) | 239 (setq quail-current-str (lrt-compose-string maa-sakod-pattern)) |
237 (insert quail-current-str) | 240 (insert quail-current-str) |
238 (setq quail-current-key " ") | |
239 (quail-show-translations) | 241 (quail-show-translations) |
240 (setq quail-current-data (list nil maa-sakod-pattern)))))) | 242 (setq quail-current-data (list nil maa-sakod-pattern)))))) |
241 | 243 |
242 (defun lrt-handle-tone-mark () | 244 (defun lrt-handle-tone-mark () |
243 (interactive) | 245 (interactive) |
257 (copy-sequence (nth 1 quail-current-data)) | 259 (copy-sequence (nth 1 quail-current-data)) |
258 ;; No need of copy because lrt-handle-maa-sakod should | 260 ;; No need of copy because lrt-handle-maa-sakod should |
259 ;; have already done it. | 261 ;; have already done it. |
260 (nth 1 quail-current-data))) | 262 (nth 1 quail-current-data))) |
261 (tail tone-mark-pattern) | 263 (tail tone-mark-pattern) |
262 (double-consonant-tail '(?(1'(B ?(1](B ?(1G(B ?(1E(B ?(1-(B ?(19(B ?(1A(B)) | 264 (double-consonant-keys lrt-double-consonant-table) |
265 (double-consonant-flag nil) | |
263 place) | 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 | |
264 ;; Find a place to embed TONE-MARK. It should be after a | 277 ;; Find a place to embed TONE-MARK. It should be after a |
265 ;; single or double consonant and following vowels. | 278 ;; single or double consonant and following upper or lower vowels. |
266 (while (and tail (not place)) | 279 (while (and tail (not place)) |
267 (if (and | 280 (if (and |
268 (eq (get-char-code-property (car tail) 'phonetic-type) | 281 (eq (get-char-code-property (car tail) 'phonetic-type) |
269 'consonant) | 282 'consonant) |
270 ;; Skip `(1K(B' if it is the first letter of double consonant. | 283 ;; Skip `(1K(B' if it is the first letter of double consonant. |
271 (or (/= (car tail) ?(1K(B) | 284 (or (not double-consonant-flag) |
272 (not (cdr tail)) | 285 (/= (car tail) ?(1K(B))) |
273 (not | |
274 (if (= (car (cdr tail)) ?(1\(B) | |
275 (and (cdr (cdr tail)) | |
276 (memq (car (cdr (cdr tail))) double-consonant-tail)) | |
277 (memq (car (cdr tail)) double-consonant-tail))))) | |
278 (progn | 286 (progn |
279 (setq place tail) | 287 (setq place tail) |
280 (setq tail (cdr tail)) | 288 (setq tail (cdr tail)) |
281 (while (and tail | 289 (while (and tail |
282 (memq (get-char-code-property (car tail) | 290 (memq (get-char-code-property (car tail) |
299 l1 e1 l2 e2 pattern key) | 307 l1 e1 l2 e2 pattern key) |
300 ;; Single consonants. | 308 ;; Single consonants. |
301 (setq l1 lrt-single-consonant-table) | 309 (setq l1 lrt-single-consonant-table) |
302 (while l1 | 310 (while l1 |
303 (setq e1 (car l1)) | 311 (setq e1 (car l1)) |
304 (quail-defrule-internal (car e1) (cdr e1) map) | 312 (quail-defrule-internal (car e1) (vector (cdr e1)) map) |
305 (quail-defrule-internal | 313 (quail-defrule-internal |
306 (concat (car e1) semi-vowel-key) | 314 (concat (car e1) semi-vowel-key) |
307 (compose-string (format "%c%c" (cdr e1) semi-vowel-char)) | 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))) | |
308 map) | 318 map) |
309 (setq l2 lrt-vowel-table) | 319 (setq l2 lrt-vowel-table) |
310 (while l2 | 320 (while l2 |
311 (setq e2 (car l2)) | 321 (setq e2 (car l2)) |
312 (setq key (concat (car e1) (car e2)) | 322 (setq key (concat (car e1) (car e2)) |
368 (quail-defrule-internal (car e1) (cdr e1) map)) | 378 (quail-defrule-internal (car e1) (cdr e1) map)) |
369 | 379 |
370 map))) | 380 map))) |
371 | 381 |
372 (quail-define-package | 382 (quail-define-package |
373 "lao-lrt" "Lao" "(1"(BR" t | 383 "lao-lrt" "Lao" "(1E(BR" t |
374 "Lao input method using LRT (Lao Roman Transcription)" | 384 "Lao input method using LRT (Lao Roman Transcription)" |
375 '(("k" . lrt-handle-maa-sakod) | 385 '(("k" . lrt-handle-maa-sakod) |
376 ("g" . lrt-handle-maa-sakod) | 386 ("g" . lrt-handle-maa-sakod) |
377 ("y" . lrt-handle-maa-sakod) | 387 ("y" . lrt-handle-maa-sakod) |
378 ("d" . lrt-handle-maa-sakod) | 388 ("d" . lrt-handle-maa-sakod) |
387 ("+" . lrt-handle-tone-mark) | 397 ("+" . lrt-handle-tone-mark) |
388 ("~" . lrt-handle-tone-mark)) | 398 ("~" . lrt-handle-tone-mark)) |
389 'forget-last-selection 'deterministic 'kbd-translate 'show-layout) | 399 'forget-last-selection 'deterministic 'kbd-translate 'show-layout) |
390 | 400 |
391 (lrt-generate-quail-map) | 401 (lrt-generate-quail-map) |
402 | |
403 ;; Additional key definitions for Lao digits. | |
404 | |
405 (quail-defrule "\\0" ?(1p(B) | |
406 (quail-defrule "\\1" ?(1q(B) | |
407 (quail-defrule "\\2" ?(1r(B) | |
408 (quail-defrule "\\3" ?(1s(B) | |
409 (quail-defrule "\\4" ?(1t(B) | |
410 (quail-defrule "\\5" ?(1u(B) | |
411 (quail-defrule "\\6" ?(1v(B) | |
412 (quail-defrule "\\7" ?(1w(B) | |
413 (quail-defrule "\\8" ?(1x(B) | |
414 (quail-defrule "\\9" ?(1y(B) | |
415 | |
416 ;;; quail/lrt.el ends here |