New file.
[m17n/m17n-db.git] / th-kesmanee-2.mim
1 ;; th-kesmanee-2.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
5
6 ;; This file is part of the m17n database; a sub-part of the m17n
7 ;; library.
8
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.
13
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.
18
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
22 ;; 02111-1307, USA.
23
24 (input-method th kesmanee-2)
25
26 (description "Thai input method simulating the Kesmanee keyboard
27 with WTT 2.0 level 2 input sequence correction.
28 The correction algorithm follows the one shown in the following 
29   <http://linux.thai.net/~thep/th-xim/>
30 ")
31
32 (title "ท")
33
34 (include (th kesmanee) map)
35
36 (macro
37
38  ;; input global variable : arg1, arg2
39  ;; output global variable : ret
40  (cp
41   (set ret 0)
42   (cond
43
44    ;; next = BV1|BV2|BD|AD3|AV1|AV2|AV3, previous = CONS
45    ((| (= arg2 0x0E31)
46        (& (>= arg2 0x0E34) (<= arg2 0x0E3A))
47        (= arg2 0x0E4E))
48     (cond
49      ((| (& (>= arg1 0x0E01) (<= arg1 0x0E23))
50          (= arg1 0x0E25)
51          (& (>= arg1 0x0E27) (<= arg1 0x0E2E)))
52       (set ret 1))))
53
54    ;; next = TONE, previous = CONS|BV1|BV2|AV1|AV2|AV3
55    ((& (>= arg2 0x0E48) (<= arg2 0x0E4B))
56     (cond
57      ((| (& (>= arg1 0x0E01) (<= arg1 0x0E23))
58          (= arg1 0x0E25)
59          (& (>= arg1 0x0E27) (<= arg1 0x0E2E))
60          (= arg1 0x0E31)
61          (& (>= arg1 0x0E34) (<= arg1 0x0E39)))
62       (set ret 1))))
63
64    ;; next = AD1, previous = CONS|BV1|AV1
65    ((& (>= arg2 0x0E4C) (<= arg2 0x0E4D))
66     (cond
67      ((| (& (>= arg1 0x0E01) (<= arg1 0x0E23))
68          (= arg1 0x0E25)
69          (& (>= arg1 0x0E27) (<= arg1 0x0E2E))
70          (= arg1 0x0E38)
71          (= arg1 0x0E34))
72       (set ret 1))))
73
74    ;; next = AD2, previous = TONE| AV3
75    ((= arg2 0x0E47)
76     (cond
77      ((| (& (>= arg1 0x0E01) (<= arg1 0x0E23))
78          (= arg1 0x0E25)
79          (& (>= arg1 0x0E27) (<= arg1 0x0E2E))
80          (= arg1 0x0E35)
81          (= arg1 0x0E37))
82       (set ret 1))))))
83
84  ;; input global variable : arg1, arg2
85  ;; output global variable : ret
86  ;; This is Level 2 acceptance.
87  (ac
88   (set ret 0)
89   (cond
90
91    ;; next = CTRL|CONS, previous = *
92    ((| (<= arg2 0x001F)
93        (& (>= arg2 0x0080) (<= arg2 0x009F))
94        (& (>= arg2 0x0E01) (<= arg2 0x0E23))
95        (= arg2 0x0E25)
96        (& (>= arg2 0x0E27) (<= arg2 0x0E2E)))
97     (set ret 1))
98
99    ;; next = NON|LV, previous = ~LV, 
100    ((| (& (>= arg2 0x0020) (<= arg2 0x007E))
101        (& (>= arg2 0x00A0) (<= arg2 0x0E00))
102        (= arg2 0x0E2F)
103        (& (>= arg2 0x0E3F) (<= arg2 0x0E44))
104        (= arg2 0x0E46)
105        (> arg2 0x0E4E))
106     (cond
107      ((| (< arg1 0x0E40) (> arg1 0x0E44))
108       (set ret 1))))
109
110    ;; next = FV1, previous = CONS|FV1|FV2|BV1|TONE
111    ((| (= arg2 0x0E30) (= arg2 0x0E32) (= arg2 0x0E33))
112     (cond
113      ((| (& (>= arg1 0x0E01) (<= arg1 0x0E23))
114          (= arg1 0x0E25)
115          (& (>= arg1 0x0E27) (<= arg1 0x0E2E))
116          (= arg1 0x0E30)
117          (= arg1 0x0E32)
118          (= arg1 0x0E33)
119          (= arg1 0x0E45)
120          (= arg1 0x0E38)
121          (& (>= arg1 0x0E48) (<= arg1 0x0E4B)))
122       (set ret 1))))
123    
124    ;; next = FV2, previous = FV3|TONE
125    ((= arg2 0x0E45)
126     (cond
127      ((| (= arg1 0x0E24)
128          (= arg1 0x0E26)
129          (& (>= arg1 0x0E48) (<= arg1 0x0E4B)))
130       (set ret 1))))
131
132    ;; next = FV3, previous = ~LV~FV3
133    ((| (= arg2 0x0E24) (= arg2 0x0E26))
134     (cond
135      ((& (| (< arg1 0x0E40) (> arg1 0x0E44))
136          (! (= arg1 0x0E24))
137          (! (= arg1 0x0E26)))
138       (set ret 1)))))))
139
140 (include (th kesmanee) state)
141
142 ;; Local Variables:
143 ;; coding: utf-8
144 ;; mode: emacs-lisp
145 ;; End: