X-Git-Url: http://git.chise.org/gitweb/?p=elisp%2Fegg.git;a=blobdiff_plain;f=its%2Fthai.el;fp=its%2Fthai.el;h=3b41d18970fa361d5c7c4ae23a6ffb3a8744b794;hp=0000000000000000000000000000000000000000;hb=76732e6a1bda6c43729b2c8e356a717b2c7b1043;hpb=9a41be0e7710d1d2238431123fd5e12cd4bcf77e diff --git a/its/thai.el b/its/thai.el new file mode 100644 index 0000000..3b41d18 --- /dev/null +++ b/its/thai.el @@ -0,0 +1,150 @@ +;;; its/thai.el --- Inputting Thai characters in Egg Input Method Architecture + +;; Copyright (C) 1998 Mule Project, +;; Powered by Electrotechnical Laboratory, JAPAN. +;; Project Leader: Satoru Tomura + +;; Author: KATAYAMA Yoshio + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; GNU Emacs 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 General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + + +;;; Code: + +(eval-when-compile + (require 'its) + (require 'cl) + + (defmacro define-its-thai-keymap (&rest rule) + (let (input output type list) + (while rule + (setq input (car (car rule)) + output (nth 1 (car rule)) + type (nth 2 (car rule)) + rule (cdr rule) + list (cons `(its-defrule ,input ,output) list)) + (if type + (setq list (cons `(setq ,type (cons (cons ,input ,output) ,type)) + list)))) + `(let (consonant vowel tone) + ,@list + (its-define-thai-composit consonant vowel tone)))) + + (defun its-define-thai-composit (consonant vowel tone) + (let (pair state) + (while consonant + (setq pair (car consonant) + consonant (cdr consonant)) + (setq state (its-goto-state (car pair))) + (its-make-next-state state -1 (aref (cdr pair) 0) (cdr pair)) + (its-define-thai-add-vowel state (car pair) (cdr pair) vowel tone) + (its-define-thai-add-tone state (car pair) (cdr pair) tone) + (its-defrule-otherwise state (cdr pair))))) + + (defun its-define-thai-add-vowel (state keyseq output vowel tone) + (let (next-state next-key next-keyseq next-output composed-output) + (while vowel + (setq next-key (car (car vowel)) + next-keyseq (concat keyseq next-key) + next-output (concat output (cdr (car vowel))) + composed-output (compose-string next-output) + vowel (cdr vowel)) + (setq next-state (its-make-next-state state + (aref next-key 0) + next-keyseq + composed-output)) + (its-make-next-state next-state -1 next-keyseq composed-output) + (its-define-thai-add-tone next-state next-keyseq next-output tone) + (its-defrule-otherwise next-state composed-output)))) + + (defun its-define-thai-add-tone (state keyseq output tone) + (let (next-state next-key next-keyseq next-output composed-output) + (while tone + (setq next-key (car (car tone)) + next-keyseq (concat keyseq next-key) + next-output (concat output (cdr (car tone))) + composed-output (compose-string next-output) + tone (cdr tone)) + (setq next-state (its-make-next-state state + (aref next-key 0) + next-keyseq + composed-output)))))) + +;; Thai Kesmanee keyboard support. + +(define-its-state-machine its-thai-kesmanee-map + "kesmanee" ",T!!(B" 'Thai + "Map for Thai Kesmanee input method with TIS620 keyboard. (Thai)" + + (define-its-thai-keymap + ("1" ",TE(B" consonant) ("!" "#") + ("2" "/") ("@" ",Tq(B") + ("3" "_") ("#" ",Tr(B") + ("4" ",T@(B" consonant) ("$" ",Ts(B") + ("5" ",T6(B" consonant) ("%" ",Tt(B") + ("6" ",TX(B" vowel) ("^" ",TY(B" vowel) + ("7" ",TV(B" vowel) ("&" "0,TQi1(B" vowel) + ("8" ",T$(B" consonant) ("*" ",Tu(B") + ("9" ",T5(B" consonant) ("(" ",Tv(B") + ("0" ",T((B" consonant) (")" ",Tw(B") + ("-" ",T"(B" consonant) ("_" ",Tx(B") + ("=" ",T*(B" consonant) ("+" ",Ty(B") + ("\\" ",T_(B") ("|" ",To(B") + ("`" ",T#(B" consonant) ("~" ",T%(B" consonant) + + ("q" ",Tf(B") ("Q" ",Tp(B") + ("w" ",Td(B") ("W" "\"") + ("e" ",TS(B") ("E" ",T.(B" consonant) + ("r" ",T>(B" consonant) ("R" ",T1(B" consonant) + ("T" ",T8(B" consonant) ("t" ",TP(B") + ("y" ",TQ(B" vowel) ("Y" ",Tm(B" tone) + ("u" ",TU(B" vowel) ("U" ",Tj(B" tone) + ("i" ",TC(B" consonant) ("I" ",T3(B" consonant) + ("o" ",T9(B" consonant) ("O" ",TO(B") + ("p" ",TB(B" consonant) ("P" ",T-(B" consonant) + ("[" ",T:(B" consonant) ("{" ",T0(B" consonant) + ("]" ",TE(B" consonant) ("}" ",") + + ("a" ",T?(B" consonant) ("A" ",TD(B") + ("s" ",TK(B" consonant) ("S" ",T&(B" consonant) + ("d" ",T!(B" consonant) ("D" ",T/(B" consonant) + ("f" ",T4(B" consonant) ("F" ",Tb(B") + ("g" ",T`(B") ("G" ",T,(B" consonant) + ("h" ",Ti(B" tone) ("H" ",Tg(B" vowel) + ("j" ",Th(B" tone) ("J" ",Tk(B" tone) + ("k" ",TR(B") ("K" ",TI(B" consonant) + ("l" ",TJ(B" consonant) ("L" ",TH(B" consonant) + (";" ",TG(B" consonant) (":" ",T+(B" consonant) + ("'" ",T'(B" consonant) ("\"" ",TF(B") + + ("z" ",T<(B" consonant) ("Z" "(") + ("x" ",T;(B" consonant) ("X" ")") + ("c" ",Ta(B") ("C" ",T)(B" consonant) + ("v" ",TM(B" consonant) ("V" ",TN(B" consonant) + ("b" ",TT(B" vowel) ("B" ",TZ(B" vowel) + ("n" ",TW(B" vowel) ("N" ",Tl(B" tone) + ("m" ",T7(B" consonant) ("M" ",Tn(B" vowel) + ("," ",TA(B" consonant) ("<" ",T2(B" consonant) + ("." ",Tc(B") (">" ",TL(B" consonant) + ("/" ",T=(B" consonant) ("?" "?"))) + +(provide 'its/thai) + +;;; its/thai.el ends here