;; hi-typewriter.mim -- Devanagari input method with typewriter method
;; Copyright (C) 2005
;;   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 hi typewriter)

(description "Hindi input method with `typewriter' method.
Still experimental.
")

(title "क")

(map
 (consonant
  ("!" ?ऍ)
  ("+" ?ऋ)
  ("Q" ?औ)
  ("W" ?ऐ)
  ("E" ?आ)
  ("R" ?ई)
  ("T" ?ऊ)
  ("Y" ?भ)
  ("y" ?ब)
  ("U" ?ङ)
  ("u" ?ह)
  ("I" ?घ)
  ("i" ?ग)
  ("O" ?ध)
  ("o" ?द)
  ("P" ?झ)
  ("p" ?ज)
  ("{" ?ढ)
  ("[" ?ड)
  ("}" ?ञ)
  ("A" ?ओ)
  ("S" ?ए)
  ("D" ?अ)
  ("F" ?इ)
  ("G" ?उ)
  ("H" ?फ)
  ("h" ?प)
  ("J" ?ऱ)
  ("j" ?र)
  ("K" ?ख)
  ("k" ?क)
  ("L" ?थ)
  ("l" ?त)
  (":" ?छ)
  (";" ?च)
  ("\"" ?ठ)
  ("'" ?ट)
  ("|" ?ऑ)
  ("~" ?ऒ)
  ("Z" ?ऎ)
  ("C" ?ण)
  ("c" ?म)
  ("V" ?ऩ)
  ("v" ?न)
  ("B" ?ऴ)
  ("b" ?व)
  ("N" ?ळ)
  ("n" ?ल)
  ("M" ?श)
  ("m" ?स)
  ("<" ?ष)
  ("/" ?य))
 (halant
  ("d" ?्))
 (vowel-I
  ("f" ?ि))
 (else
  ("1" ?१)
  ("@" ?ॅ)
  ("2" ?२)
  ("#" ?#)
  ("3" ?३)
  ("$" ?$)
  ("4" ?४)
  ("5" ?५)
  ("6" ?६)
  ("7" ?७)
  ("8" ?८)
  ("(" ?\()
  ("9" ?९)
  (")" ?\))
  ("0" ?०)
  ("_" ?ः)
  ("-" ?-)
  ("=" ?ृ)
  ("q" ?ौ)
  ("w" ?ै)
  ("e" ?ा)
  ("r" ?ी)
  ("t" ?ू)
  ("]" ?़)
  ("a" ?ो)
  ("s" ?े)
  ("g" ?ु)
  ("\\" ?ॉ)
  ("`" ?ॊ)
  ("z" ?ॆ)
  ("X" ?ँ)
  ("x" ?ं)
  ("," ?,)
  (">" ?।)
  ("." ?.)
  ("?" ?य़)))

(state
 (init
  (consonant)
  (halant)
  (else)
  (vowel-I (shift after-vowel-I)))

 (after-vowel-I
  (consonant
   ;; The current preedit is "IC".  Reorder it to "CI".
   (move @<) (delete @+) (move @>) (insert "ि")
   ;; Keep on reading the following [HC]* sequence.
   (shift after-consonant))
  (vowel-I
   ;; Delete the lastly inserted I and rehandle it in `init' state.
   (delete @-) (pushback 1) (shift init))
  (nil (shift init)))

 (after-consonant
  (halant
   ;; The current preedit is "C[HC]*IH".  Reorder it to "C[HC]*HI".
   (move @-) (delete @-) (move @>) (insert "ि")
   ;; Keep on reading the following C[HC]* sequence.
   (shift after-consonant-halant)))

 (after-consonant-halant
  (consonant
   ;; The current preedit is "C[HC]*HIC".  Reorder it to "C[HC]+I".
   (move @-) (delete @-) (move @>) (insert "ि")
   ;; Keep on reading the following [HC]* sequence.
   (shift after-consonant))))
