(cvs-enabledp): Ignore errors.
[emacs.git] / leim / quail / thai.el
blobc6b5164707315c712a1f654653690ff57f01f8c5
1 ;;; quail/thai.el --- Quail package for inputting Thai characters
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
4 ;; Licensed to the Free Software Foundation.
6 ;; Keywords: multilingual, input method, Thai
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
25 ;;; Code:
27 (require 'quail)
28 (require 'thai-util)
30 (defun quail-thai-update-translation (control-flag)
31 (if (integerp control-flag)
32 ;; Non-composable character typed.
33 (setq quail-current-str
34 (buffer-substring (overlay-start quail-overlay)
35 (overlay-end quail-overlay))
36 unread-command-events
37 (string-to-list
38 (substring quail-current-key control-flag)))
39 (setq quail-current-str
40 (compose-string (quail-lookup-map-and-concat quail-current-key))))
41 control-flag)
43 (defun thai-generate-quail-map (translation-table)
44 (let ((i 0)
45 consonant vowel tone voweltone others)
46 ;; Categorize Thai characters into one of above.
47 (while (< i 128)
48 (let ((trans (aref translation-table i))
49 ptype)
50 (if (eq trans 0)
51 nil
52 (if (> (length trans) 1)
53 (setq ptype 'voweltone
54 trans (vector (compose-string trans)))
55 (setq ptype (get-char-code-property (aref trans 0) 'phonetic-type))
56 (cond ((memq ptype '(vowel-upper vowel-lower))
57 (setq ptype 'vowel))
58 ((not (memq ptype '(consonant tone)))
59 (setq ptype 'others))))
60 (set ptype (cons (cons (char-to-string i) trans)
61 (symbol-value ptype)))))
62 (setq i (1+ i)))
64 (quail-map-from-table
65 '((base-state (consonant . vt-state)
66 vowel tone voweltone others)
67 (vt-state (vowel . t-state)
68 voweltone tone)
69 (t-state tone)))))
71 ;; Thai Kesmanee keyboard support.
73 (quail-define-package
74 "thai-kesmanee" "Thai" "\e,T!!\e(B>" t
75 "Thai Kesmanee input method with TIS620 keyboard layout
77 The difference from the ordinal Thai keyboard:
78 '\e,T_\e(B' and '\e,To\e(B' are assigned to '\\' and '|' respectively,
79 '\e,T#\e(B' and '\e,T%\e(B' are assigned to '`' and '~' respectively,
80 Don't know where to assign characters '\e,Tz\e(B' and '\e,T{\e(B'."
81 nil t t t t nil nil nil 'quail-thai-update-translation nil t)
83 (quail-install-map
84 (thai-generate-quail-map
86 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; control codes
87 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; control codes
88 0 "#" "\e,TF\e(B" "\e,Tr\e(B" "\e,Ts\e(B" "\e,Tt\e(B" "\e,TQi\e(B" "\e,T'\e(B" ; SPC .. '
89 "\e,Tv\e(B" "\e,Tw\e(B" "\e,Tu\e(B" "\e,Ty\e(B" "\e,TA\e(B" "\e,T"\e(B" "\e,Tc\e(B" "\e,T=\e(B" ; ( .. /
90 "\e,T(\e(B" "\e,TE\e(B" "/" "_" "\e,T@\e(B" "\e,T6\e(B" "\e,TX\e(B" "\e,TV\e(B" ; 0 .. 7
91 "\e,T$\e(B" "\e,T5\e(B" "\e,T+\e(B" "\e,TG\e(B" "\e,T2\e(B" "\e,T*\e(B" "\e,TL\e(B" "\e,TF\e(B" ; 8 .. ?
92 "\e,Tq\e(B" "\e,TD\e(B" "\e,TZ\e(B" "\e,T)\e(B" "\e,T/\e(B" "\e,T.\e(B" "\e,Tb\e(B" "\e,T,\e(B" ; @ .. G
93 "\e,Tg\e(B" "\e,T3\e(B" "\e,Tk\e(B" "\e,TI\e(B" "\e,TH\e(B" "\e,Tn\e(B" "\e,Tl\e(B" "\e,TO\e(B" ; H .. O
94 "\e,T-\e(B" "\e,Tp\e(B" "\e,T1\e(B" "\e,T&\e(B" "\e,T8\e(B" "\e,Tj\e(B" "\e,TN\e(B" "\"" ; P .. W
95 ")" "\e,Tm\e(B" "(" "\e,T:\e(B" "\e,T_\e(B" "\e,TE\e(B" "\e,TY\e(B" "\e,Tx\e(B" ; X .. _
96 "\e,T#\e(B" "\e,T?\e(B" "\e,TT\e(B" "\e,Ta\e(B" "\e,T!\e(B" "\e,TS\e(B" "\e,T4\e(B" "\e,T`\e(B" ; ` .. g
97 "\e,Ti\e(B" "\e,TC\e(B" "\e,Th\e(B" "\e,TR\e(B" "\e,TJ\e(B" "\e,T7\e(B" "\e,TW\e(B" "\e,T9\e(B" ; h .. o
98 "\e,TB\e(B" "\e,Tf\e(B" "\e,T>\e(B" "\e,TK\e(B" "\e,TP\e(B" "\e,TU\e(B" "\e,TM\e(B" "\e,Td\e(B" ; p .. w
99 "\e,T;\e(B" "\e,TQ\e(B" "\e,T<\e(B" "\e,T0\e(B" "\e,To\e(B" "." "\e,T%\e(B" 0 ; x .. DEL
104 ;; Thai Pattachote keyboard support.
106 (quail-define-package
107 "thai-pattachote" "Thai" "\e,T!;\e(B>" t
108 "Thai Pattachote input method with TIS620 keyboard layout"
109 nil t t t t nil nil nil 'quail-thai-update-translation nil t)
111 (quail-install-map
112 (thai-generate-quail-map
113 [ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; control codes
114 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; control codes
115 0 "+" "\e,T1\e(B" "/" "," "?" "_" "\e,T"\e(B" ; SPC .. '
116 "(" ")" "." "%" "\e,TP\e(B" "\e,Tq\e(B" "\e,T(\e(B" "\e,T>\e(B" ; ( .. /
117 "\e,Tp\e(B" "=" "\e,Tr\e(B" "\e,Ts\e(B" "\e,Tt\e(B" "\e,Tu\e(B" "\e,TY\e(B" "\e,Tw\e(B" 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