*** empty log message ***
[m17n/m17n-db.git] / vi-telex.mim
1 ;; vi-telex.mim -- Input method for Vietnames with TELEX key sequence
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., 51 Franklin Street, Fifth Floor,
22 ;; Boston, MA 02110-1301, USA.
23
24 (input-method vi telex)
25
26 (description "Vietnames input method using the TELEX key sequence.
27 ")
28
29 (title "ắ")
30
31 (macro
32  (handle-mark
33   (cond (V-PREV
34          (delete @-)
35          (move M)
36          (cond ((| LAST-SPECIAL
37                    (& (= V-PREV ?i) (= C ?g))
38                    (& (= V-PREV ?u) (= C ?q)))
39                 (select SELECT))
40                (1 (move @-) (select SELECT)))
41          (move @>))
42         (V-LAST
43          (delete @-)
44          (move M)
45          (select SELECT)
46          (move @>)))))
47
48 (map
49  (vowel
50   ;;       sfrxj
51   ("a"  ("aáàảãạ"))
52   ("aa" ("âấầẩẫậ") (set SPECIAL 1))
53   ("aw" ("ăắằẳẵặ") (set SPECIAL 1))
54   ("e"  ("eéèẻẽẹ"))
55   ("ee" ("êếềểễệ") (set SPECIAL 1))
56   ("i"  ("iíìỉĩị"))
57   ("o"  ("oóòỏõọ"))
58   ("oo" ("ôốồổỗộ") (set SPECIAL 1))
59   ("ow" ("ơớờởỡợ") (set SPECIAL 1))
60   ("u"  ("uúùủũụ"))
61   ("uw" ("ưứừửữự") (set SPECIAL 1))
62   ("y"  ("yýỳỷỹỵ"))
63   ("A"  ("AÁÀẢÃẠ"))
64   ("AA" ("ÂẤẦẨẪẬ")) ("Aa" ("ÂẤẦẨẪẬ"))
65   ("AW" ("ĂẮẰẲẴẶ")) ("Aw" ("ĂẮẰẲẴẶ"))
66   ("E"  ("EÉÈẺẼẸ"))
67   ("EE" ("ÊẾỀỂỄỆ")) ("Ee" ("ÊẾỀỂỄỆ"))
68   ("I"  ("IÍÌỈĨỊ"))
69   ("O"  ("OÓÒỎÕỌ"))
70   ("OO" ("ÔỐỒỔỖỘ")) ("Oo" ("ÔỐỒỔỖỘ"))
71   ("OW" ("ƠỚỜỞỠỢ")) ("Ow" ("ƠỚỜỞỠỢ"))
72   ("U"  ("UÚÙỦŨỤ"))
73   ("UW" ("ƯỨỪỬỮỰ")) ("Uw" ("ƯỨỪỬỮỰ"))
74   ("Y"  ("YÝỲỶỸỴ")))
75
76  (diacritical
77   ("z" (set SELECT 0) ?z (handle-mark))
78   ("s" (set SELECT 1) ?s (handle-mark))
79   ("f" (set SELECT 2) ?f (handle-mark))
80   ("r" (set SELECT 3) ?r (handle-mark))
81   ("x" (set SELECT 4) ?x (handle-mark))
82   ("j" (set SELECT 5) ?j (handle-mark)))
83
84  (double
85   ("zz" (cond ((> V-LAST 0) (move M) (select 0) (move @>))) ?z)
86   ("ss" (cond ((> V-LAST 0) (move M) (select 0) (move @>))) ?s)
87   ("ff" (cond ((> V-LAST 0) (move M) (select 0) (move @>))) ?f)
88   ("rr" (cond ((> V-LAST 0) (move M) (select 0) (move @>))) ?r)
89   ("xx" (cond ((> V-LAST 0) (move M) (select 0) (move @>))) ?x)
90   ("jj" (cond ((> V-LAST 0) (move M) (select 0) (move @>))) ?j))
91
92  (consonant
93   ("b" ?b) ("c" ?c) ("d" ?d) ("g" ?g) ("h" ?h) ("k" ?k) ("l" ?l) ("m" ?m)
94   ("n" ?n) ("p" ?p) ("q" ?q) ("t" ?t) ("v" ?v)
95   ("dd" ?đ)
96   ("DD" ?Đ) ("Dd" ?Đ))
97
98  (escape
99   ("\\"))
100
101  (backspace
102   ((BackSpace))))
103
104 (state
105  (init
106   ;; Initialize variables.  V-LAST is a vowel typed lastly.  In the
107   ;; case of double vowel, V-PREV is the first one.  V-LAST being 0
108   ;; means that a vowel is not yet typed.
109   (t (set C 0) (set V-LAST 0) (set V-PREV 0) (set SPECIAL 0))
110
111   ;; Remeber the initial consonant in C.
112   (consonant (set C @-))
113
114   ;; Remember the preedit position after vowel in M.
115   (vowel (mark M) (set V-LAST @-) (set SPECIAL-LAST SPECIAL) (shift after-v))
116
117   (escape (shift escape))
118
119   (backspace (undo)))
120
121  ;; The state shifted to when the first vowel is typed.
122  (after-v
123   (t (set SPECIAL 0))
124   (consonant (shift after-vc))
125   (double (shift after-vc))
126   (vowel (mark M) (set V-PREV V-LAST) (set V-LAST @-)
127          (set SPECIAL-LAST SPECIAL) (shift after-vv))
128   (diacritical)
129   (backspace (undo 0)))
130
131  ;; The state shifted to when the second vowel is typed.
132  (after-vv
133   (t (set SPECIAL 0))
134   (consonant (shift after-vc))
135   (double (shift after-vc))
136   (diacritical)
137   (backspace (delete @-) (set V-LAST V-PREV) (set V-PREV 0) (shift after-v)))
138
139  ;; The state shifted to when one or two vowels and consonant are
140  ;; typed.
141  (after-vc
142   (t (set V-PREV-SAVE V-PREV) (set V-PREV 0) (set C-COUNT 1))
143   (double)
144   (consonant (add C-COUNT 1))
145   (diacritical)
146   (backspace (delete @-)
147              (cond ((= C-COUNT 1)
148                     (set V-PREV V-PREV-SAVE)
149                     (cond ((> V-PREV 0) (shift after-vv))
150                           (1 (shift after-v)))))))
151
152  (escape
153   "ESC"
154   ;; Unhandle any characters.
155   (nil (shift init) (unhandle))))
156
157 ;; Local Variables:
158 ;; coding: utf-8
159 ;; mode: emacs-lisp
160 ;; End: