;; vi-telex.mim -- Input method for Vietnames with TELEX key sequence ;; Copyright (C) 2003, 2004, 2005, 2006 ;; National Institute of Advanced Industrial Science and Technology (AIST) ;; Registration Number H15PRO112 ;; This file is part of the m17n database; a sub-part of the m17n ;; library. ;; The m17n library is free software; you can redistribute it and/or ;; modify it under the terms of the GNU Lesser General Public License ;; as published by the Free Software Foundation; either version 2.1 of ;; the License, or (at your option) any later version. ;; The m17n library is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;; Lesser General Public License for more details. ;; You should have received a copy of the GNU Lesser General Public ;; License along with the m17n library; if not, write to the Free ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. (input-method vi telex) (description "Vietnames input method using the TELEX key sequence. ") (title "ắ") (macro (handle-mark (cond (V-PREV (delete @-) (move M) (cond ((| LAST-SPECIAL (& (= V-PREV ?i) (= C ?g)) (& (= V-PREV ?u) (= C ?q))) (select SELECT)) (1 (move @-) (select SELECT))) (move @>)) (V-LAST (delete @-) (move M) (select SELECT) (move @>))))) (map (vowel ;; sfrxj ("a" ("aáàảãạ")) ("aa" ("âấầẩẫậ") (set SPECIAL 1)) ("aw" ("ăắằẳẵặ") (set SPECIAL 1)) ("e" ("eéèẻẽẹ")) ("ee" ("êếềểễệ") (set SPECIAL 1)) ("i" ("iíìỉĩị")) ("o" ("oóòỏõọ")) ("oo" ("ôốồổỗộ") (set SPECIAL 1)) ("ow" ("ơớờởỡợ") (set SPECIAL 1)) ("u" ("uúùủũụ")) ("uw" ("ưứừửữự") (set SPECIAL 1)) ("y" ("yýỳỷỹỵ")) ("A" ("AÁÀẢÃẠ")) ("AA" ("ÂẤẦẨẪẬ")) ("Aa" ("ÂẤẦẨẪẬ")) ("AW" ("ĂẮẰẲẴẶ")) ("Aw" ("ĂẮẰẲẴẶ")) ("E" ("EÉÈẺẼẸ")) ("EE" ("ÊẾỀỂỄỆ")) ("Ee" ("ÊẾỀỂỄỆ")) ("I" ("IÍÌỈĨỊ")) ("O" ("OÓÒỎÕỌ")) ("OO" ("ÔỐỒỔỖỘ")) ("Oo" ("ÔỐỒỔỖỘ")) ("OW" ("ƠỚỜỞỠỢ")) ("Ow" ("ƠỚỜỞỠỢ")) ("U" ("UÚÙỦŨỤ")) ("UW" ("ƯỨỪỬỮỰ")) ("Uw" ("ƯỨỪỬỮỰ")) ("Y" ("YÝỲỶỸỴ"))) (diacritical ("z" (set SELECT 0) ?z (handle-mark)) ("s" (set SELECT 1) ?s (handle-mark)) ("f" (set SELECT 2) ?f (handle-mark)) ("r" (set SELECT 3) ?r (handle-mark)) ("x" (set SELECT 4) ?x (handle-mark)) ("j" (set SELECT 5) ?j (handle-mark))) (double ("zz" (cond ((> V-LAST 0) (move M) (select 0) (move @>))) ?z) ("ss" (cond ((> V-LAST 0) (move M) (select 0) (move @>))) ?s) ("ff" (cond ((> V-LAST 0) (move M) (select 0) (move @>))) ?f) ("rr" (cond ((> V-LAST 0) (move M) (select 0) (move @>))) ?r) ("xx" (cond ((> V-LAST 0) (move M) (select 0) (move @>))) ?x) ("jj" (cond ((> V-LAST 0) (move M) (select 0) (move @>))) ?j)) (consonant ("b" ?b) ("c" ?c) ("d" ?d) ("g" ?g) ("h" ?h) ("k" ?k) ("l" ?l) ("m" ?m) ("n" ?n) ("p" ?p) ("q" ?q) ("t" ?t) ("v" ?v) ("dd" ?đ) ("DD" ?Đ) ("Dd" ?Đ)) (escape ("\\")) (backspace ((BackSpace)))) (state (init ;; Initialize variables. V-LAST is a vowel typed lastly. In the ;; case of double vowel, V-PREV is the first one. V-LAST being 0 ;; means that a vowel is not yet typed. (t (set C 0) (set V-LAST 0) (set V-PREV 0) (set SPECIAL 0)) ;; Remeber the initial consonant in C. (consonant (set C @-)) ;; Remember the preedit position after vowel in M. (vowel (mark M) (set V-LAST @-) (set SPECIAL-LAST SPECIAL) (shift after-v)) (escape (shift escape)) (backspace (undo))) ;; The state shifted to when the first vowel is typed. (after-v (t (set SPECIAL 0)) (consonant (shift after-vc)) (double (shift after-vc)) (vowel (mark M) (set V-PREV V-LAST) (set V-LAST @-) (set SPECIAL-LAST SPECIAL) (shift after-vv)) (diacritical) (backspace (undo 0))) ;; The state shifted to when the second vowel is typed. (after-vv (t (set SPECIAL 0)) (consonant (shift after-vc)) (double (shift after-vc)) (diacritical) (backspace (delete @-) (set V-LAST V-PREV) (set V-PREV 0) (shift after-v))) ;; The state shifted to when one or two vowels and consonant are ;; typed. (after-vc (t (set V-PREV-SAVE V-PREV) (set V-PREV 0) (set C-COUNT 1)) (double) (consonant (add C-COUNT 1)) (diacritical) (backspace (delete @-) (cond ((= C-COUNT 1) (set V-PREV V-PREV-SAVE) (cond ((> V-PREV 0) (shift after-vv)) (1 (shift after-v))))))) (escape "ESC" ;; Unhandle any characters. (nil (shift init) (unhandle)))) ;; Local Variables: ;; coding: utf-8 ;; mode: emacs-lisp ;; End: