comparison lisp/quail/quail-thai.el @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents
children
comparison
equal deleted inserted replaced
69:804d1389bcd6 70:131b0175ea99
1 ;; Quail packages for inputting Thai characters.
2 ;; Copyright (C) 1992 Free Software Foundation, Inc.
3 ;; This file is part of Mule (MULtilingual Enhancement of GNU Emacs).
4
5 ;; Mule is free software distributed in the form of patches to GNU Emacs.
6 ;; You can redistribute it and/or modify
7 ;; it under the terms of the GNU General Public License as published by
8 ;; the Free Software Foundation; either version 1, or (at your option)
9 ;; any later version.
10
11 ;; Mule is distributed in the hope that it will be useful,
12 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;; GNU General Public License for more details.
15
16 ;; You should have received a copy of the GNU General Public License
17 ;; along with GNU Emacs; see the file COPYING. If not, write to
18 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19
20 ;;; 93.2.15 modified for Mule Ver.0.9.7.1 by K.Handa <handa@etl.go.jp>
21 ;;; Completely re-written.
22 ;;; 93.8.5 modified for Mule Ver.1.1 by K.Handa <handa@etl.go.jp>
23 ;;; Bug in handling '0,TQi1(B' fixed.
24
25 (require 'quail)
26 (require 'thai)
27
28 (quail-define-package "thai" "Thai" t "TSCII encoding
29 ,TE(B# /,Tq(B _,Tr(B ,T@s(B ,T6t(B ,TXY(B ,TV0Qi1(B ,T$u(B ,T5v(B ,T(w(B ,T"x(B ,T*y(B ,T_o(B ,T#%(B
30 ,Tfp(B ,Td(B\" ,TS.(B ,T>1(B ,TP8(B ,TQm(B ,TUj(B ,TC3(B ,T9O(B ,TB-(B ,T:0(B ,TE(B,
31 ,T?D(B ,TK&(B ,T!/(B ,T4b(B ,T`,(B ,Tig(B ,Thk(B ,TRI(B ,TJH(B ,TG+(B ,T'F(B
32 ,T<(B( ,T;(B) ,Ta)(B ,TMN(B ,TTZ(B ,TWl(B 0,T7n1(B ,TA2(B ,TcL(B ,T=(B?
33
34 The difference from the ordinal Thai keyboard:
35 ',T_(B' and ',To(B' are assigned to '\\' and '|' respectively,
36 ',T#(B' and ',T%(B' are assigned to '`' and '~' respectively,
37 Don't know where to assign characters ',Tz(B' and ',T{(B'." nil t t)
38
39 (eval-when-compile
40
41 (defconst quail-thai-C-map (list 'keymap (vector 'quail-thai-exact-char)))
42 (defconst quail-thai-CV-map (list 'keymap (vector 'quail-thai-compose)))
43 (defconst quail-thai-T-map (list 'keymap (vector 'quail-thai-compose)))
44
45 )
46
47 (defun quail-fetch-thai-map (ch)
48 (aref (lookup-key (quail-map) "\0") ch))
49
50 (defun quail-thai-compose ()
51 (interactive)
52 (compose-string
53 (mapconcat 'quail-fetch-thai-map quail-current-key "")))
54
55 (defun quail-thai-exact-char ()
56 (interactive)
57 (quail-fetch-thai-map quail-last-char))
58
59 (eval-when-compile
60
61 (defun quail-defrule-thai (ch str)
62 (let ((vector-map (lookup-key (quail-map) "\0")))
63 (if (null vector-map)
64 (progn
65 (setq vector-map (make-vector 127 0))
66 (define-key (quail-map) "\0" vector-map)))
67 (aset vector-map ch str))
68 (let* ((chstr (char-to-string ch))
69 (ch-thai (string-to-char str))
70 (prop (cdr (assq ch-thai *thai-characters*)))) ;93.8.5 by K.Handa
71 (cond ((eq prop 'consonant)
72 (quail-defrule chstr 'quail-thai-C-prefix))
73 ((or (eq prop 'vowel-upper) (eq prop 'vowel-lower))
74 (quail-defrule chstr str)
75 (define-key quail-thai-C-map chstr 'quail-thai-CV-prefix))
76 ((eq prop 'tone)
77 (quail-defrule chstr str)
78 (define-key quail-thai-C-map chstr 'quail-thai-T-prefix)
79 (define-key quail-thai-CV-map chstr 'quail-thai-T-prefix))
80 ((eq prop 'vowel-upper-tone)
81 (quail-defrule chstr str)
82 (define-key quail-thai-C-map chstr 'quail-thai-T-prefix))
83 (t
84 (quail-defrule chstr str))))
85 nil)
86
87 (put 'quail-defrule-thai 'byte-hunk-handler 'eval)
88
89 (defun quail-setup-constant (sym val))
90 (defun quail-setup-constant-handler (form)
91 (list 'defconst
92 (eval (nth 1 form))
93 (list 'quote (symbol-value (eval (nth 1 form))))))
94 (put 'quail-setup-constant 'byte-hunk-handler 'quail-setup-constant-handler)
95
96 )
97
98 (quail-defrule-thai ?1 ",TE(B")
99 (quail-defrule-thai ?! "#")
100 (quail-defrule-thai ?2 "/")
101 (quail-defrule-thai ?@ ",Tq(B")
102 (quail-defrule-thai ?3 "_")
103 (quail-defrule-thai ?# ",Tr(B")
104 (quail-defrule-thai ?4 ",T@(B")
105 (quail-defrule-thai ?$ ",Ts(B")
106 (quail-defrule-thai ?5 ",T6(B")
107 (quail-defrule-thai ?% ",Tt(B")
108 (quail-defrule-thai ?6 ",TX(B")
109 (quail-defrule-thai ?^ ",TY(B")
110 (quail-defrule-thai ?7 ",TV(B")
111 (quail-defrule-thai ?& "0,TQi1(B")
112 (quail-defrule-thai ?8 ",T$(B")
113 (quail-defrule-thai ?* ",Tu(B")
114 (quail-defrule-thai ?9 ",T5(B")
115 (quail-defrule-thai ?\( ",Tv(B")
116 (quail-defrule-thai ?0 ",T((B")
117 (quail-defrule-thai ?\) ",Tw(B")
118 (quail-defrule-thai ?- ",T"(B")
119 (quail-defrule-thai ?_ ",Tx(B")
120 (quail-defrule-thai ?= ",T*(B")
121 (quail-defrule-thai ?+ ",Ty(B")
122 (quail-defrule-thai ?\\ ",T_(B")
123 (quail-defrule-thai ?| ",To(B")
124 (quail-defrule-thai ?` ",T#(B")
125 (quail-defrule-thai ?~ ",T%(B")
126
127 (quail-defrule-thai ?q ",Tf(B")
128 (quail-defrule-thai ?Q ",Tp(B")
129 (quail-defrule-thai ?w ",Td(B")
130 (quail-defrule-thai ?W "\"")
131 (quail-defrule-thai ?e ",TS(B")
132 (quail-defrule-thai ?E ",T.(B")
133 (quail-defrule-thai ?r ",T>(B")
134 (quail-defrule-thai ?R ",T1(B")
135 (quail-defrule-thai ?t ",TP(B")
136 (quail-defrule-thai ?T ",T8(B")
137 (quail-defrule-thai ?y ",TQ(B")
138 (quail-defrule-thai ?Y ",Tm(B")
139 (quail-defrule-thai ?u ",TU(B")
140 (quail-defrule-thai ?U ",Tj(B")
141 (quail-defrule-thai ?i ",TC(B")
142 (quail-defrule-thai ?I ",T3(B")
143 (quail-defrule-thai ?o ",T9(B")
144 (quail-defrule-thai ?O ",TO(B")
145 (quail-defrule-thai ?p ",TB(B")
146 (quail-defrule-thai ?P ",T-(B")
147 (quail-defrule-thai ?[ ",T:(B")
148 (quail-defrule-thai ?{ ",T0(B")
149 (quail-defrule-thai ?] ",TE(B")
150 (quail-defrule-thai ?} ",")
151
152 (quail-defrule-thai ?a ",T?(B")
153 (quail-defrule-thai ?A ",TD(B")
154 (quail-defrule-thai ?s ",TK(B")
155 (quail-defrule-thai ?S ",T&(B")
156 (quail-defrule-thai ?d ",T!(B")
157 (quail-defrule-thai ?D ",T/(B")
158 (quail-defrule-thai ?f ",T4(B")
159 (quail-defrule-thai ?F ",Tb(B")
160 (quail-defrule-thai ?g ",T`(B")
161 (quail-defrule-thai ?G ",T,(B")
162 (quail-defrule-thai ?h ",Ti(B")
163 (quail-defrule-thai ?H ",Tg(B")
164 (quail-defrule-thai ?j ",Th(B")
165 (quail-defrule-thai ?J ",Tk(B")
166 (quail-defrule-thai ?k ",TR(B")
167 (quail-defrule-thai ?K ",TI(B")
168 (quail-defrule-thai ?l ",TJ(B")
169 (quail-defrule-thai ?L ",TH(B")
170 (quail-defrule-thai ?\; ",TG(B")
171 (quail-defrule-thai ?: ",T+(B")
172 (quail-defrule-thai ?' ",T'(B")
173 (quail-defrule-thai ?\" ".")
174
175 (quail-defrule-thai ?z ",T<(B")
176 (quail-defrule-thai ?Z "(")
177 (quail-defrule-thai ?x ",T;(B")
178 (quail-defrule-thai ?X ")")
179 (quail-defrule-thai ?c ",Ta(B")
180 (quail-defrule-thai ?C ",T)(B")
181 (quail-defrule-thai ?v ",TM(B")
182 (quail-defrule-thai ?V ",TN(B")
183 (quail-defrule-thai ?b ",TT(B")
184 (quail-defrule-thai ?B ",TZ(B")
185 (quail-defrule-thai ?n ",TW(B")
186 (quail-defrule-thai ?N ",Tl(B")
187 (quail-defrule-thai ?m ",T7(B")
188 (quail-defrule-thai ?M ",Tn(B")
189 (quail-defrule-thai ?, ",TA(B")
190 (quail-defrule-thai ?< ",T2(B")
191 (quail-defrule-thai ?. ",Tc(B")
192 (quail-defrule-thai ?> ",TL(B")
193 (quail-defrule-thai ?/ ",T=(B")
194 (quail-defrule-thai ?\" ",TF(B")
195
196 (quail-setup-current-package)
197
198 (quail-setup-constant 'quail-thai-C-map quail-thai-C-map)
199 (quail-setup-constant 'quail-thai-CV-map quail-thai-CV-map)
200 (quail-setup-constant 'quail-thai-T-map quail-thai-T-map)
201
202 (fset 'quail-thai-C-prefix quail-thai-C-map)
203 (fset 'quail-thai-CV-prefix quail-thai-CV-map)
204 (fset 'quail-thai-T-prefix quail-thai-T-map)