/[emacs]/emacs/leim/quail/thai.el
ViewVC logotype

Diff of /emacs/leim/quail/thai.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.11 by lektu, Tue Feb 4 14:43:11 2003 UTC revision 1.11.6.1 by handa, Mon Sep 8 12:45:39 2003 UTC
# Line 1  Line 1 
1  ;;; thai.el --- Quail package for inputting Thai characters  ;;; thai.el --- Quail package for inputting Thai characters -*-coding: iso-2022-7bit;-*-
2    
3  ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.  ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
4  ;; Licensed to the Free Software Foundation.  ;; Licensed to the Free Software Foundation.
# Line 27  Line 27 
27  ;;; Code:  ;;; Code:
28    
29  (require 'quail)  (require 'quail)
 (require 'thai-util)  
30    
31  (defun quail-thai-update-translation (control-flag)  (defmacro thai-generate-quail-map (translation-table)
32    (if (integerp control-flag)    (let (map)
33        ;; Non-composable character typed.       (dotimes (i (length translation-table))
34        (setq quail-current-str         (let ((trans (aref translation-table i)))
35              (buffer-substring (overlay-start quail-overlay)           (when (not (eq trans 0))
36                                (overlay-end quail-overlay))             (if (> (length trans) 1)
37              unread-command-events                 (setq trans (vector trans))
38              (string-to-list               (setq trans (aref trans 0)))
39               (substring quail-current-key control-flag)))             (setq map (cons (list (char-to-string i) trans) map)))))
40      (setq quail-current-str       `(quail-define-rules ,@map)))
           (compose-string (quail-lookup-map-and-concat quail-current-key))))  
   control-flag)  
   
 (defun thai-generate-quail-map (translation-table)  
   (let ((i 0)  
         consonant vowel tone voweltone others)  
     ;; Categorize Thai characters into one of above.  
     (while (< i 128)  
       (let ((trans (aref translation-table i))  
             ptype)  
         (if (eq trans 0)  
             nil  
           (if (> (length trans) 1)  
               (setq ptype 'voweltone  
                     trans (vector (compose-string trans)))  
             (setq ptype (get-char-code-property (aref trans 0) 'phonetic-type))  
             (cond ((memq ptype '(vowel-upper vowel-lower))  
                    (setq ptype 'vowel))  
                   ((not (memq ptype '(consonant tone)))  
                    (setq ptype 'others))))  
           (set ptype (cons (cons (char-to-string i) trans)  
                            (symbol-value ptype)))))  
       (setq i (1+ i)))  
   
     (quail-map-from-table  
      '((base-state (consonant . vt-state)  
                    vowel tone voweltone others)  
        (vt-state (vowel . t-state)  
                  voweltone tone)  
        (t-state tone)))))  
41    
42  ;; Thai Kesmanee keyboard support.  ;; Thai Kesmanee keyboard support.
43    
# Line 80  The difference from the ordinal Thai key Line 49  The difference from the ordinal Thai key
49      ',T_(B' and ',To(B' are assigned to '\\' and '|' respectively,      ',T_(B' and ',To(B' are assigned to '\\' and '|' respectively,
50      ',T#(B' and ',T%(B' are assigned to '`' and '~' respectively,      ',T#(B' and ',T%(B' are assigned to '`' and '~' respectively,
51      Don't know where to assign characters ',Tz(B' and ',T{(B'."      Don't know where to assign characters ',Tz(B' and ',T{(B'."
52   nil t t t t nil nil nil 'quail-thai-update-translation nil t)   nil t t t t nil nil nil nil nil t)
   
 (quail-install-map  
  (thai-generate-quail-map  
   [  
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0      ; control codes  
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0      ; control codes  
    0   "#" "." ",Tr(B" ",Ts(B" ",Tt(B" ",TQi(B" ",T'(B"       ; SPC .. '  
    ",Tv(B" ",Tw(B" ",Tu(B" ",Ty(B" ",TA(B" ",T"(B" ",Tc(B" ",T=(B"      ; ( .. /  
    ",T((B" ",TE(B" "/" "_" ",T@(B" ",T6(B" ",TX(B" ",TV(B"  ; 0 .. 7  
    ",T$(B" ",T5(B" ",T+(B" ",TG(B" ",T2(B" ",T*(B" ",TL(B" ",TF(B"      ; 8 .. ?  
    ",Tq(B" ",TD(B" ",TZ(B" ",T)(B" ",T/(B" ",T.(B" ",Tb(B" ",T,(B"      ; @ .. G  
    ",Tg(B" ",T3(B" ",Tk(B" ",TI(B" ",TH(B" ",Tn(B" ",Tl(B" ",TO(B"      ; H .. O  
    ",T-(B" ",Tp(B" ",T1(B" ",T&(B" ",T8(B" ",Tj(B" ",TN(B" "\""   ; P .. W  
    ")" ",Tm(B" "(" ",T:(B" ",T_(B" ",TE(B" ",TY(B" ",Tx(B"  ; X .. _  
    ",T#(B" ",T?(B" ",TT(B" ",Ta(B" ",T!(B" ",TS(B" ",T4(B" ",T`(B"      ; ` .. g  
    ",Ti(B" ",TC(B" ",Th(B" ",TR(B" ",TJ(B" ",T7(B" ",TW(B" ",T9(B"      ; h .. o  
    ",TB(B" ",Tf(B" ",T>(B" ",TK(B" ",TP(B" ",TU(B" ",TM(B" ",Td(B"      ; p .. w  
    ",T;(B" ",TQ(B" ",T<(B" ",T0(B" ",To(B" "," ",T%(B" 0    ; x .. DEL  
    ]))  
53    
54    (thai-generate-quail-map
55     [
56      0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0       ; control codes
57      0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0       ; control codes
58      0   "#" "." ",Tr(B" ",Ts(B" ",Tt(B" ",TQi(B" ",T'(B"        ; SPC .. '
59      ",Tv(B" ",Tw(B" ",Tu(B" ",Ty(B" ",TA(B" ",T"(B" ",Tc(B" ",T=(B"       ; ( .. /
60      ",T((B" ",TE(B" "/" "_" ",T@(B" ",T6(B" ",TX(B" ",TV(B"   ; 0 .. 7
61      ",T$(B" ",T5(B" ",T+(B" ",TG(B" ",T2(B" ",T*(B" ",TL(B" ",TF(B"       ; 8 .. ?
62      ",Tq(B" ",TD(B" ",TZ(B" ",T)(B" ",T/(B" ",T.(B" ",Tb(B" ",T,(B"       ; @ .. G
63      ",Tg(B" ",T3(B" ",Tk(B" ",TI(B" ",TH(B" ",Tn(B" ",Tl(B" ",TO(B"       ; H .. O
64      ",T-(B" ",Tp(B" ",T1(B" ",T&(B" ",T8(B" ",Tj(B" ",TN(B" "\""    ; P .. W
65      ")" ",Tm(B" "(" ",T:(B" ",T_(B" ",TE(B" ",TY(B" ",Tx(B"   ; X .. _
66      ",T#(B" ",T?(B" ",TT(B" ",Ta(B" ",T!(B" ",TS(B" ",T4(B" ",T`(B"       ; ` .. g
67      ",Ti(B" ",TC(B" ",Th(B" ",TR(B" ",TJ(B" ",T7(B" ",TW(B" ",T9(B"       ; h .. o
68      ",TB(B" ",Tf(B" ",T>(B" ",TK(B" ",TP(B" ",TU(B" ",TM(B" ",Td(B"       ; p .. w
69      ",T;(B" ",TQ(B" ",T<(B" ",T0(B" ",To(B" "," ",T%(B" 0             ; x .. DEL
70      ])
71    
72    
73  ;; Thai Pattachote keyboard support.  ;; Thai Pattachote keyboard support.
# Line 108  The difference from the ordinal Thai key Line 75  The difference from the ordinal Thai key
75  (quail-define-package  (quail-define-package
76   "thai-pattachote" "Thai" ",T!;(B>" t   "thai-pattachote" "Thai" ",T!;(B>" t
77   "Thai Pattachote input method with TIS620 keyboard layout"   "Thai Pattachote input method with TIS620 keyboard layout"
78   nil t t t t nil nil nil 'quail-thai-update-translation nil t)   nil t t t t nil nil nil nil nil t)
79    
80  (quail-install-map  (thai-generate-quail-map
81   (thai-generate-quail-map   [
82    [ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0     ; control codes    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0       ; control codes
83      0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0     ; control codes    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0       ; control codes
84      0 "+" ",T1(B" "/" "," "?" "_" ",T"(B"   ; SPC .. '    0 "+" ",T1(B" "/" "," "?" "_" ",T"(B"             ; SPC .. '
85      "(" ")" "." "%" ",TP(B" ",Tq(B" ",T((B" ",T>(B"     ; ( .. /    "(" ")" "." "%" ",TP(B" ",Tq(B" ",T((B" ",T>(B"       ; ( .. /
86      ",Tp(B" "=" ",Tr(B" ",Ts(B" ",Tt(B" ",Tu(B" ",TY(B" ",Tw(B"   ; 0 .. 7    ",Tp(B" "=" ",Tr(B" ",Ts(B" ",Tt(B" ",Tu(B" ",TY(B" ",Tw(B"     ; 0 .. 7
87      ",Tx(B" ",Ty(B" ",T&(B" ",Td(B" ",T?(B" ",Tv(B" ",T2(B" ",TL(B"     ; 8 .. ?    ",Tx(B" ",Ty(B" ",T&(B" ",Td(B" ",T?(B" ",Tv(B" ",T2(B" ",TL(B"       ; 8 .. ?
88      "\"" ",Tk(B" ",TQ(B" ",T0(B" ",TS(B" ",Tf(B" ",T3(B" ",Tl(B"  ; @ .. G    "\"" ",Tk(B" ",TQ(B" ",T0(B" ",TS(B" ",Tf(B" ",T3(B" ",Tl(B"    ; @ .. G
89      ",TW(B" ",T+(B" ",T<(B" ",T*(B" ",Tb(B" ",TN(B" ",TH(B" ",T6(B"     ; H .. O    ",TW(B" ",T+(B" ",T<(B" ",T*(B" ",Tb(B" ",TN(B" ",TH(B" ",T6(B"       ; H .. O
90      ",T2(B" ",Tj(B" ",T-(B" ",T8(B" ",TI(B" ",T=(B" ",T@(B" ",TD(B"     ; P .. W    ",T2(B" ",Tj(B" ",T-(B" ",T8(B" ",TI(B" ",T=(B" ",T@(B" ",TD(B"       ; P .. W
91      ",T.(B" ",TV(B" ",T.(B" ",Tc(B" ",TZ(B" ",T2(B" ",TX(B" "-"   ; X .. _    ",T.(B" ",TV(B" ",T.(B" ",Tc(B" ",TZ(B" ",T2(B" ",TX(B" "-"     ; X .. _
92      ",T#(B" ",Ti(B" ",TT(B" ",TE(B" ",T'(B" ",TB(B" ",T!(B" ",TQ(B"     ; ` .. g    ",T#(B" ",Ti(B" ",TT(B" ",TE(B" ",T'(B" ",TB(B" ",T!(B" ",TQ(B"       ; ` .. g
93      ",TU(B" ",TA(B" ",TR(B" ",T9(B" ",T`(B" ",TJ(B" ",T$(B" ",TG(B"     ; h .. o    ",TU(B" ",TA(B" ",TR(B" ",T9(B" ",T`(B" ",TJ(B" ",T$(B" ",TG(B"       ; h .. o
94      ",Ta(B" ",Tg(B" ",TM(B" ",T7(B" ",TC(B" ",T4(B" ",TK(B" ",T5(B"     ; p .. w    ",Ta(B" ",Tg(B" ",TM(B" ",T7(B" ",TC(B" ",T4(B" ",TK(B" ",T5(B"       ; p .. w
95      ",T;(B" ",Th(B" ",T:(B" ",TO(B" ",Tm(B" ",TF(B" ",T%(B" 0     ; x .. DEL    ",T;(B" ",Th(B" ",T:(B" ",TO(B" ",Tm(B" ",TF(B" ",T%(B" 0               ; x .. DEL
96      ]))    ])
97    
98  ;;; thai.el ends here  ;;; thai.el ends here

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.11.6.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26