1;; cmc-kdb.mim -- Cham input method based on Cham keyboard 2;; Copyright (C) 2008, 2009 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 cmc kbd (version "1.6.0")) 25 26(description (_"Cham input method simulating Cham keyboard. 27Cham characters are encoded in logical order in memory and in files. 28But, you can type Cham text in visual order with this input method. 29Backspace and Delete also work in the manner of visual order.")) 30 31(title "ꨌꩌk") 32 33(map 34 ;; Independent vowels and consonants 35 (independent 36 ;; Vowels 37 ("a" "ꨀ") 38 ("I" "ꨁ") 39 ("u" "ꨂ") 40 ("e" "ꨃ") 41 ("i" "ꨄ") 42 ("o" "ꨅ") 43 ;; Cosonants 44 ("k" "ꨆ") 45 ("A" "ꨇ") 46 ("g" "ꨈ") 47 ("G" "ꨉ") 48 ("z" "ꨊ") 49 ("Z" "ꨋ") 50 ("c" "ꨌ") 51 ("S" "ꨍ") 52 ("j" "ꨄ") 53 ("J" "ꨏ") 54 ("v" "ꨐ") 55 ("V" "ꨑ") 56 ("W" "ꨒ") 57 ("t" "ꨓ") 58 ("E" "ꨔ") 59 ("d" "ꨕ") 60 ("D" "ꨖ") 61 ("n" "ꨗ") 62 ("q" "ꨘ") 63 ("Q" "ꨙ") 64 ("p" "ꨚ") 65 ("F" "ꨛ") 66 ("f" "ꨜ") 67 ("b" "ꨝ") 68 ("B" "ꨞ") 69 ("m" "ꨟ") 70 ("M" "ꨠ") 71 ("O" "ꨡ") 72 ("y" "ꨢ") 73 ("r" "ꨣ") 74 ("l" "ꨤ") 75 ("w" "ꨥ") 76 ("x" "ꨦ") 77 ("s" "ꨧ") 78 ("h" "ꨨ")) 79 ;; Dependent vowels 80 (post-vowel 81 ("%" "ꨩ") 82 ("^" "ꨩꨮ") 83 ("{" "ꨪ") 84 ("[" "ꨪꩌ") 85 ("}" "ꨫ") 86 ("]" "ꨬ") 87 ("`" "ꨭ") 88 ("@" "ꨮ") 89 ("$" "ꨮꩃ") 90 ("#" "ꨮꩌ") 91 ("<" "ꨱ") 92 ("\"" "ꨱꨮ") 93 (">" "ꨱꩌ") 94 ("," "ꨲ")) 95 (pre-vowel 96 ("-" "ꨯ") 97 ("=" "ꨰ")) 98 99 ;; Medials 100 (post-medial 101 ("~" "ꨳ") 102 ("*" "ꨵ") 103 (")" "ꨵꨭ") 104 ("(" "ꨵꨶ") 105 ("&" "ꨶ")) 106 107 (pre-medial 108 ("\\" "ꨴ")) 109 110 ;; (";" ",") 111 112 ;; Final consonants. 113 (final 114 ("K" "ꩀ") 115 ;; ꩁ 116 ("U" "ꩂ") 117 ("/" "ꩃ") 118 ("C" "ꩄ") 119 ("T" "ꩅ") 120 ("N" "ꩆ") 121 ("P" "ꩇ") 122 ("Y" "ꩈ") 123 ("R" "ꩉ") 124 ("L" "ꩊ") 125 ("X" "ꩋ") 126 ("'" "ꩌ") 127 ("H" "ꩍ")) 128 129 (misc 130 ;; Digits 131 ("0" "꩐") 132 ("1" "꩑") 133 ("2" "꩒") 134 ("3" "꩓") 135 ("4" "꩔") 136 ("5" "꩕") 137 ("6" "꩖") 138 ("7" "꩗") 139 ("8" "꩘") 140 ("9" "꩙") 141 142 ;; Traditional punctuations. 143 ("_" "꩜") 144 ("|" "꩝") 145 ("||" "꩞") 146 ("|||" "꩟") 147 148 ;; ASCII remapping. 149 (";" ",")) 150 151 (edit 152 ((BackSpace) 153 (set PREV @-1) 154 (cond ((= PREV PM) 155 (set PREV @-2) 156 (cond ((& (>= PREV 0xAA00) (<= PREV 0xAA28)) 157 (delete @-2) (insert PM)) 158 (1 (unhandle)))) 159 ((| (= PREV PV1) (= PREV PV2)) 160 (cond ((= @-2 PM) 161 (cond ((& (>= @-3 0xAA00) (<= @-3 0xAA28)) 162 (delete @-4) 163 (insert PREV) (insert PM)) 164 (1 (unhandle)))) 165 ((& (>= @-2 0xAA00) (<= @-2 0xAA28)) 166 (delete @-2) 167 (insert PREV)) 168 (1 (unhandle)))) 169 (1 (unhandle)))) 170 171 ((Delete) 172 (set NEXT @+0) 173 (cond ((& (>= NEXT 0xAA00) (<= NEXT 0xAA28)) 174 (set N2 @+1) 175 (cond ((= N2 PM) 176 (set N3 @+2) 177 (cond ((| (= N3 PV1) (= N3 PV2)) 178 (delete @+3) (insert NEXT) (insert N2)) 179 (1 (delete @+2) (insert NEXT)))) 180 ((| (= N2 PV1) (= N2 PV2)) 181 (delete @+2) (insert NEXT)) 182 (1 (unhandle)))) 183 (1 (unhandle))))) 184 ) 185 186(state 187 (init 188 (t (set PM 0xAA34) ; PRE-MEDIAL 189 (set PV1 0xAA2F) ; PRE-VOWEL-1 190 (set PV2 0xAA30) ; PRE-VOWEL-2 191 ) 192 193 (independent 194 (set C @-1) (set PREV @-2) 195 (cond ((= PREV PM) 196 (set PREV @-3) 197 (cond ((| (= PREV PV1) (= PREV PV2)) 198 (delete @-3) (insert C) (insert PM) (insert PREV)) 199 ((| (< PREV 0xAA00) (> PREV 0xAA28)) 200 (delete @-2) (insert C) (insert PM)))) 201 ((| (= PREV PV1) (= PREV PV2)) 202 (cond ((= @-3 PM)) 203 ((| (< @-3 0xAA00) (> @-3 0xAA28)) 204 (delete @-2) (insert C) (insert PREV)))))) 205 206 (pre-vowel 207 (set C @-1) (set NEXT @+0) 208 (cond ((& (>= NEXT 0xAA00) (<= NEXT 0xAA28)) 209 (delete @-1) (delete @+1) (insert NEXT) (insert C) (set NEXT @+0))) 210 (cond ((& (>= NEXT 0xAA33) (<= NEXT 0xAA36)) 211 (delete @-1) (delete @+1) (insert NEXT) (insert C)))) 212 213 (pre-medial 214 (set C @-1) (set NEXT @+0) 215 (cond ((& (>= NEXT 0xAA00) (<= NEXT 0xAA28)) 216 (delete @-1) (delete @+1) (insert NEXT) (insert C)))) 217 218 (post-medial) 219 (post-vowel) 220 (final) 221 (misc) 222 (edit))) 223 224;; Local Variables: 225;; coding: utf-8 226;; mode: emacs-lisp 227;; End: 228