comparison leim/quail/thai.el @ 60704:7c239dedaeea

(quail-thai-update-translation): Delete it. (thai-generate-quail-map): Generate is simple map. ("thai-kesmanee"): Don't use quail-thai-update-translation. (thai-generate-quail-map): Likewise.
author Kenichi Handa <handa@m17n.org>
date Fri, 18 Mar 2005 06:53:48 +0000
parents e7d3f2a9b84f
children 23a17af379b1 30ad2795fdab
comparison
equal deleted inserted replaced
60703:e3798cf289c0 60704:7c239dedaeea
1 ;;; thai.el --- Quail package for inputting Thai characters 1 ;;; thai.el --- Quail package for inputting Thai characters
2 2
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN. 3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
4 ;; Licensed to the Free Software Foundation. 4 ;; Licensed to the Free Software Foundation.
5 ;; Copyright (C) 2005
6 ;; National Institute of Advanced Industrial Science and Technology (AIST)
7 ;; Registration Number H14PRO021
5 8
6 ;; Keywords: multilingual, input method, Thai 9 ;; Keywords: multilingual, input method, Thai
7 10
8 ;; This file is part of GNU Emacs. 11 ;; This file is part of GNU Emacs.
9 12
27 ;;; Code: 30 ;;; Code:
28 31
29 (require 'quail) 32 (require 'quail)
30 (require 'thai-util) 33 (require 'thai-util)
31 34
32 (defun quail-thai-update-translation (control-flag) 35 (defmacro thai-generate-quail-map (translation-table)
33 (if (integerp control-flag) 36 (let (map)
34 ;; Non-composable character typed. 37 (dotimes (i (length translation-table))
35 (setq quail-current-str 38 (let ((trans (aref translation-table i)))
36 (buffer-substring (overlay-start quail-overlay) 39 (when (not (eq trans 0))
37 (overlay-end quail-overlay)) 40 (if (> (length trans) 1)
38 unread-command-events 41 (setq trans (vector trans))
39 (string-to-list 42 (setq trans (aref trans 0)))
40 (substring quail-current-key control-flag))) 43 (setq map (cons (list (char-to-string i) trans) map)))))
41 (setq quail-current-str 44 `(quail-define-rules ,@map)))
42 (compose-string (quail-lookup-map-and-concat quail-current-key))))
43 control-flag)
44
45 (defun thai-generate-quail-map (translation-table)
46 (let ((i 0)
47 consonant vowel tone voweltone others)
48 ;; Categorize Thai characters into one of above.
49 (while (< i 128)
50 (let ((trans (aref translation-table i))
51 ptype)
52 (if (eq trans 0)
53 nil
54 (if (> (length trans) 1)
55 (setq ptype 'voweltone
56 trans (vector (compose-string trans)))
57 (setq ptype (get-char-code-property (aref trans 0) 'phonetic-type))
58 (cond ((memq ptype '(vowel-upper vowel-lower))
59 (setq ptype 'vowel))
60 ((not (memq ptype '(consonant tone)))
61 (setq ptype 'others))))
62 (set ptype (cons (cons (char-to-string i) trans)
63 (symbol-value ptype)))))
64 (setq i (1+ i)))
65
66 (quail-map-from-table
67 '((base-state (consonant . vt-state)
68 vowel tone voweltone others)
69 (vt-state (vowel . t-state)
70 voweltone tone)
71 (t-state tone)))))
72 45
73 ;; Thai Kesmanee keyboard support. 46 ;; Thai Kesmanee keyboard support.
74 47
75 (quail-define-package 48 (quail-define-package
76 "thai-kesmanee" "Thai" ",T!!(B>" t 49 "thai-kesmanee" "Thai" ",T!!(B>" t
78 51
79 The difference from the ordinal Thai keyboard: 52 The difference from the ordinal Thai keyboard:
80 ',T_(B' and ',To(B' are assigned to '\\' and '|' respectively, 53 ',T_(B' and ',To(B' are assigned to '\\' and '|' respectively,
81 ',T#(B' and ',T%(B' are assigned to '`' and '~' respectively, 54 ',T#(B' and ',T%(B' are assigned to '`' and '~' respectively,
82 Don't know where to assign characters ',Tz(B' and ',T{(B'." 55 Don't know where to assign characters ',Tz(B' and ',T{(B'."
83 nil t t t t nil nil nil 'quail-thai-update-translation nil t) 56 nil t t t t nil nil nil nil nil t)
84 57
85 (quail-install-map 58 (quail-install-map
86 (thai-generate-quail-map 59 (thai-generate-quail-map
87 [ 60 [
88 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; control codes 61 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; control codes
120 ;; Thai Pattachote keyboard support. 93 ;; Thai Pattachote keyboard support.
121 94
122 (quail-define-package 95 (quail-define-package
123 "thai-pattachote" "Thai" ",T!;(B>" t 96 "thai-pattachote" "Thai" ",T!;(B>" t
124 "Thai Pattachote input method with TIS620 keyboard layout" 97 "Thai Pattachote input method with TIS620 keyboard layout"
125 nil t t t t nil nil nil 'quail-thai-update-translation nil t) 98 nil t t t t nil nil nil nil nil t)
126 99
127 (quail-install-map 100 (quail-install-map
128 (thai-generate-quail-map 101 (thai-generate-quail-map
129 [ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; control codes 102 [ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; control codes
130 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; control codes 103 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; control codes