1 ;; th-kesmanee.mim -- Thai input method with Kesmanee keyboard layout
2 ;; Copyright (C) 2003, 2004, 2005, 2006
3 ;; National Institute of Advanced Industrial Science and Technology (AIST)
4 ;; Registration Number H15PRO112
6 ;; This file is part of the m17n database; a sub-part of the m17n
9 ;; The m17n library is free software; you can redistribute it and/or
10 ;; modify it under the terms of the GNU Lesser General Public License
11 ;; as published by the Free Software Foundation; either version 2.1 of
12 ;; the License, or (at your option) any later version.
14 ;; The m17n library is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 ;; Lesser General Public License for more details.
19 ;; You should have received a copy of the GNU Lesser General Public
20 ;; License along with the m17n library; if not, write to the Free
21 ;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
24 (input-method th kesmanee)
26 (description "Thai input method simulating the Kesmanee keyboard
27 with WTT 2.0 level 1 input sequence correction.
28 The correction algorithm follows the one shown in the following
29 <http://linux.thai.net/~thep/th-xim/>
133 ;; input global variable : arg1, arg2
134 ;; output global variable : ret
139 ;; next = BV1|BV2|BD|AD3|AV1|AV2|AV3, previous = CONS
141 (& (>= arg2 0x0E34) (<= arg2 0x0E3A))
144 ((| (& (>= arg1 0x0E01) (<= arg1 0x0E23))
146 (& (>= arg1 0x0E27) (<= arg1 0x0E2E)))
149 ;; next = TONE, previous = CONS|BV1|BV2|AV1|AV2|AV3
150 ((& (>= arg2 0x0E48) (<= arg2 0x0E4B))
152 ((| (& (>= arg1 0x0E01) (<= arg1 0x0E23))
154 (& (>= arg1 0x0E27) (<= arg1 0x0E2E))
156 (& (>= arg1 0x0E34) (<= arg1 0x0E39)))
159 ;; next = AD1, previous = CONS|BV1|AV1
160 ((& (>= arg2 0x0E4C) (<= arg2 0x0E4D))
162 ((| (& (>= arg1 0x0E01) (<= arg1 0x0E23))
164 (& (>= arg1 0x0E27) (<= arg1 0x0E2E))
169 ;; next = AD2, previous = TONE| AV3
172 ((| (& (>= arg1 0x0E01) (<= arg1 0x0E23))
174 (& (>= arg1 0x0E27) (<= arg1 0x0E2E))
179 ;; input global variable : arg1, arg2
180 ;; output global variable : ret
181 ;; This is Level 1 acceptance.
186 (& (>= arg2 0x0E34) (<= arg2 0x0E3A))
187 (& (>= arg2 0x0E47) (<= arg2 0x0E4E)))
208 ((= ret 1)) ;; CP(y,z) succeeded.
212 ((= ret 1)) ;; AC(y,z) succeeded.
214 ;; WTT-based input sequence correction starts here.
248 ;; elif y is FV1 and z is TONE then
249 ((& (| (= y 0x0E30) (= y 0x0E32) (= y 0x0E33))
273 ;; Only Thai characters should be replaced.
274 (& (>= y 0x0E01) (<= y 0x0E5B))
275 (& (>= z 0x0E01) (<= z 0x0E5B)))
292 ;; Commit the preedit chars that are fixed.
295 ;; If surrounding text is supported, commit the only char in preedit.
299 ;; If the last char is CTRL or NON, we can commit everything.
300 ((| (& (>= w 0x0000) (<= w 0x0E00))
307 ;; If the last char is CONS, LV, FV2 or FV3, we can commit
308 ;; everything but the last.
309 ((| (& (>= w 0x0E01) (<= w 0x0E2E))
310 (& (>= w 0x0E40) (<= w 0x0E45)))
315 ;; If the last char is FV1 (excluding AM) and ...
316 ((| (= w 0x0E30) (= w 0x0E32))
321 ;; ... the before last is CONS, we can commit other than the
323 ((| (& (>= v 0x0E01) (<= v 0x0E23))
325 (& (>= v 0x0E27) (<= v 0x0E2E)))
331 ;; ... else if the before last is not CONS, we can commit
332 ;; everything but the last.