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
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 vi telex)
26 (description "Vietnames input method using the TELEX key sequence.
36 (cond ((| LAST-SPECIAL
37 (& (= V-PREV ?i) (= C ?g))
38 (& (= V-PREV ?u) (= C ?q)))
40 (1 (move @-) (select SELECT)))
52 ("aa" ("âấầẩẫậ") (set SPECIAL 1))
53 ("aw" ("ăắằẳẵặ") (set SPECIAL 1))
55 ("ee" ("êếềểễệ") (set SPECIAL 1))
58 ("oo" ("ôốồổỗộ") (set SPECIAL 1))
59 ("ow" ("ơớờởỡợ") (set SPECIAL 1))
61 ("uw" ("ưứừửữự") (set SPECIAL 1))
64 ("AA" ("ÂẤẦẨẪẬ")) ("Aa" ("ÂẤẦẨẪẬ"))
65 ("AW" ("ĂẮẰẲẴẶ")) ("Aw" ("ĂẮẰẲẴẶ"))
67 ("EE" ("ÊẾỀỂỄỆ")) ("Ee" ("ÊẾỀỂỄỆ"))
70 ("OO" ("ÔỐỒỔỖỘ")) ("Oo" ("ÔỐỒỔỖỘ"))
71 ("OW" ("ƠỚỜỞỠỢ")) ("Ow" ("ƠỚỜỞỠỢ"))
73 ("UW" ("ƯỨỪỬỮỰ")) ("Uw" ("ƯỨỪỬỮỰ"))
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)))
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))
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)
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))
111 ;; Remeber the initial consonant in C.
112 (consonant (set C @-))
114 ;; Remember the preedit position after vowel in M.
115 (vowel (mark M) (set V-LAST @-) (set SPECIAL-LAST SPECIAL) (shift after-v))
117 (escape (shift escape))
121 ;; The state shifted to when the first vowel is typed.
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))
129 (backspace (undo 0)))
131 ;; The state shifted to when the second vowel is typed.
134 (consonant (shift after-vc))
135 (double (shift after-vc))
137 (backspace (delete @-) (set V-LAST V-PREV) (set V-PREV 0) (shift after-v)))
139 ;; The state shifted to when one or two vowels and consonant are
142 (t (set V-PREV-SAVE V-PREV) (set V-PREV 0) (set C-COUNT 1))
144 (consonant (add C-COUNT 1))
146 (backspace (delete @-)
148 (set V-PREV V-PREV-SAVE)
149 (cond ((> V-PREV 0) (shift after-vv))
150 (1 (shift after-v)))))))
154 ;; Unhandle any characters.
155 (nil (shift init) (unhandle))))