1 ;; th-tis820.mim -- Thai input method with TIS-820.2538 keyboard layout
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., 51 Franklin St, Fifth Floor, Boston, MA
22 ;; Boston, MA 02110-1301, USA.
24 (input-method th tis820)
26 (description "Thai input method simulating the TIS-820.2538 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/>
131 (include (th kesmanee) macro)
140 ((= @-1 -2) (shift nst))
143 ;; no surrounding text
155 ((= ret 1) ;; CP(y,z) succeeded.
161 ((= ret 1) ;; AC(y,z) succeeded.
165 ;; WTT-based input sequence correction starts here.
203 ;; elif y is FV1 and z is TONE then
204 ((& (| (= y 0x0E30) (= y 0x0E32) (= y 0x0E33))
230 ;; CTRL, NON and CONS should not be replaced.
233 (& (>= y 0x0E30) (<= y 0x0E3A))
234 (& (>= y 0x0E40) (<= y 0x0E45))
235 (& (>= y 0x0E47) (<= y 0x0E4E)))
238 (& (>= z 0x0E30) (<= z 0x0E3A))
239 (& (>= z 0x0E40) (<= z 0x0E45))
240 (& (>= z 0x0E47) (<= z 0x0E4E))))
259 ;; Commit the preedit chars as soon as fixed.
262 ;; If the last char is CTRL or NON, we can commit everything.
263 ((| (& (>= w 0x0000) (<= w 0x0E00))
270 ;; If the last char is CONS, LV, FV2 or FV3, we can commit
271 ;; everything but the last.
272 ((| (& (>= w 0x0E01) (<= w 0x0E2E))
273 (& (>= w 0x0E40) (<= w 0x0E45)))
278 ;; If the last char is FV1 (excluding AM) and ...
279 ((| (= w 0x0E30) (= w 0x0E32))
284 ;; ... the before last is CONS, we can commit other than the
286 ((| (& (>= v 0x0E01) (<= v 0x0E23))
288 (& (>= v 0x0E27) (<= v 0x0E2E)))
294 ;; ... else if the before last is not CONS, we can commit
295 ;; everything but the last.
301 ;; with surrounding text
304 ;; z = next character
306 ;; y = previous character
308 ;; x = character previous to y
315 ((= ret 1)) ;; CP(y,z) succeeded.
319 ((= ret 1)) ;; AC(y,z) succeeded.
321 ;; WTT-based input sequence correction starts here.
357 ;; elif y is FV1 and z is TONE then
358 ((& (| (= y 0x0E30) (= y 0x0E32) (= y 0x0E33))
383 ;; CTRL, NON and CONS should not be replaced.
386 (& (>= y 0x0E30) (<= y 0x0E3A))
387 (& (>= y 0x0E40) (<= y 0x0E45))
388 (& (>= y 0x0E47) (<= y 0x0E4E)))
391 (& (>= z 0x0E30) (<= z 0x0E3A))
392 (& (>= z 0x0E40) (<= z 0x0E45))
393 (& (>= z 0x0E47) (<= z 0x0E4E))))