70
|
1 ;; Thai language specific setup for Mule
|
|
2 ;; Copyright (C) 1992 Free Software Foundation, Inc.
|
|
3
|
|
4 ;; This file is part of XEmacs.
|
|
5 ;; This file contains European characters
|
|
6
|
|
7 ;; XEmacs is free software; you can redistribute it and/or modify it
|
|
8 ;; under the terms of the GNU General Public License as published by
|
|
9 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
10 ;; any later version.
|
|
11
|
|
12 ;; XEmacs is distributed in the hope that it will be useful, but
|
|
13 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
15 ;; General Public License for more details.
|
|
16
|
|
17 ;; You should have received a copy of the GNU General Public License
|
|
18 ;; along with XEmacs; see the file COPYING. If not, write to the
|
|
19 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
20 ;; Boston, MA 02111-1307, USA.
|
|
21
|
|
22 ;;; 93.1.21 created for Mule Ver.0.9.7.1 by K.Handa <handa@etl.go.jp>
|
|
23
|
|
24 (defconst thai-character-alist
|
|
25 '((?,T!(B . consonant) ; 0xA1: LETTER KO KAI
|
|
26 (?,T"(B . consonant) ; 0xA2: LETTER KHO KHAI
|
|
27 (?,T#(B . consonant) ; 0xA3: LETTER KHO KHUAT (obsolete)
|
|
28 (?,T$(B . consonant) ; 0xA4: LETTER KHO KHWAI
|
|
29 (?,T%(B . consonant) ; 0xA5: LETTER KHO KHON (obsolete)
|
|
30 (?,T&(B . consonant) ; 0xA6: LETTER KHO RAKHANG
|
|
31 (?,T'(B . consonant) ; 0xA7: LETTER NGO NGU
|
|
32 (?,T((B . consonant) ; 0xA8: LETTER CHO CHAN
|
|
33 (?,T)(B . consonant) ; 0xA9: LETTER CHO CHING
|
|
34 (?,T*(B . consonant) ; 0xAA: LETTER CHO CHANG
|
|
35 (?,T+(B . consonant) ; 0xAB: LETTER SO SO
|
|
36 (?,T,(B . consonant) ; 0xAC: LETTER CHO CHOE
|
|
37 (?,T-(B . consonant) ; 0xAD: LETTER YO YING
|
|
38 (?,T.(B . consonant) ; 0xAE: LETTER DO CHADA
|
|
39 (?,T/(B . consonant) ; 0xAF: LETTER TO PATAK
|
|
40 (?,T0(B . consonant) ; 0xB0: LETTER THO THAN
|
|
41 (?,T1(B . consonant) ; 0xB1: LETTER THO NANGMONTHO
|
|
42 (?,T2(B . consonant) ; 0xB2: LETTER THO PHUTHAO
|
|
43 (?,T3(B . consonant) ; 0xB3: LETTER NO NEN
|
|
44 (?,T4(B . consonant) ; 0xB4: LETTER DO DEK
|
|
45 (?,T5(B . consonant) ; 0xB5: LETTER TO TAO
|
|
46 (?,T6(B . consonant) ; 0xB6: LETTER THO THUNG
|
|
47 (?,T7(B . consonant) ; 0xB7: LETTER THO THAHAN
|
|
48 (?,T8(B . consonant) ; 0xB8: LETTER THO THONG
|
|
49 (?,T9(B . consonant) ; 0xB9: LETTER NO NU
|
|
50 (?,T:(B . consonant) ; 0xBA: LETTER BO BAIMAI
|
|
51 (?,T;(B . consonant) ; 0xBB: LETTER PO PLA
|
|
52 (?,T<(B . consonant) ; 0xBC: LETTER PHO PHUNG
|
|
53 (?,T=(B . consonant) ; 0xBD: LETTER FO FA
|
|
54 (?,T>(B . consonant) ; 0xBE: LETTER PHO PHAN
|
|
55 (?,T?(B . consonant) ; 0xBF: LETTER FO FAN
|
|
56 (?,T@(B . consonant) ; 0xC0: LETTER PHO SAMPHAO
|
|
57 (?,TA(B . consonant) ; 0xC1: LETTER MO MA
|
|
58 (?,TB(B . consonant) ; 0xC2: LETTER YO YAK
|
|
59 (?,TC(B . consonant) ; 0xC3: LETTER RO RUA
|
|
60 (?,TD(B . vowel-base) ; 0xC4: LETTER RU (vowel letter used to write Pali)
|
|
61 (?,TE(B . consonant) ; 0xC5: LETTER LO LING
|
|
62 (?,TF(B . vowel-base) ; 0xC6: LETTER LU (vowel letter used to write Pali)
|
|
63 (?,TG(B . consonant) ; 0xC7: LETTER WO WAEN
|
|
64 (?,TH(B . consonant) ; 0xC8: LETTER SO SALA
|
|
65 (?,TI(B . consonant) ; 0xC9: LETTER SO RUSI
|
|
66 (?,TJ(B . consonant) ; 0xCA: LETTER SO SUA
|
|
67 (?,TK(B . consonant) ; 0xCB: LETTER HO HIP
|
|
68 (?,TL(B . consonant) ; 0xCC: LETTER LO CHULA
|
|
69 (?,TM(B . consonant) ; 0xCD: LETTER O ANG
|
|
70 (?,TN(B . consonant) ; 0xCE: LETTER HO NOK HUK
|
|
71 (?,TO(B . special) ; 0xCF: PAI YAN NOI (abbreviation)
|
|
72 (?,TP(B . vowel-base) ; 0xD0: VOWEL SIGN SARA A
|
|
73 (?,TQ(B . vowel-upper) ; 0xD1: VOWEL SIGN MAI HAN-AKAT N/S-T
|
|
74 (?,TR(B . vowel-base) ; 0xD2: VOWEL SIGN SARA AA
|
|
75 (?,TS(B . vowel-base) ; 0xD3: VOWEL SIGN SARA AM
|
|
76 (?,TT(B . vowel-upper) ; 0xD4: VOWEL SIGN SARA I N/S-T
|
|
77 (?,TU(B . vowel-upper) ; 0xD5: VOWEL SIGN SARA II N/S-T
|
|
78 (?,TV(B . vowel-upper) ; 0xD6: VOWEL SIGN SARA UE N/S-T
|
|
79 (?,TW(B . vowel-upper) ; 0xD7: VOWEL SIGN SARA UEE N/S-T
|
|
80 (?,TX(B . vowel-lower) ; 0xD8: VOWEL SIGN SARA U N/S-B
|
|
81 (?,TY(B . vowel-lower) ; 0xD9: VOWEL SIGN SARA UU N/S-B
|
|
82 (?,TZ(B . vowel-lower) ; 0xDA: VOWEL SIGN PHINTHU N/S-B (Pali virama)
|
|
83 (?,T[(B . not-used) ; 0xDA:
|
|
84 (?,T\(B . not-used) ; 0xDC:
|
|
85 (?,T](B . not-used) ; 0xDC:
|
|
86 (?,T^(B . not-used) ; 0xDC:
|
|
87 (?,T_(B . special) ; 0xDF: BAHT SIGN (currency symbol)
|
|
88 (?,T`(B . vowel-base) ; 0xE0: VOWEL SIGN SARA E
|
|
89 (?,Ta(B . vowel-base) ; 0xE1: VOWEL SIGN SARA AE
|
|
90 (?,Tb(B . vowel-base) ; 0xE2: VOWEL SIGN SARA O
|
|
91 (?,Tc(B . vowel-base) ; 0xE3: VOWEL SIGN SARA MAI MUAN
|
|
92 (?,Td(B . vowel-base) ; 0xE4: VOWEL SIGN SARA MAI MALAI
|
|
93 (?,Te(B . vowel-base) ; 0xE5: LAK KHANG YAO
|
|
94 (?,Tf(B . special) ; 0xE6: MAI YAMOK (repetion)
|
|
95 (?,Tg(B . vowel-upper) ; 0xE7: VOWEL SIGN MAI TAI KHU N/S-T
|
|
96 (?,Th(B . tone) ; 0xE8: TONE MAI EK N/S-T
|
|
97 (?,Ti(B . tone) ; 0xE9: TONE MAI THO N/S-T
|
|
98 (?,Tj(B . tone) ; 0xEA: TONE MAI TRI N/S-T
|
|
99 (?,Tk(B . tone) ; 0xEB: TONE MAI CHATTAWA N/S-T
|
|
100 (?,Tl(B . tone) ; 0xEC: THANTHAKHAT N/S-T (cancellation mark)
|
|
101 (?,Tm(B . tone) ; 0xED: NIKKHAHIT N/S-T (final nasal)
|
|
102 (?,Tn(B . vowel-upper) ; 0xEE: YAMAKKAN N/S-T
|
|
103 (?,To(B . special) ; 0xEF: FONRMAN
|
|
104 (?,Tp(B . special) ; 0xF0: DIGIT ZERO
|
|
105 (?,Tq(B . special) ; 0xF1: DIGIT ONE
|
|
106 (?,Tr(B . special) ; 0xF2: DIGIT TWO
|
|
107 (?,Ts(B . special) ; 0xF3: DIGIT THREE
|
|
108 (?,Tt(B . special) ; 0xF4: DIGIT FOUR
|
|
109 (?,Tu(B . special) ; 0xF5: DIGIT FIVE
|
|
110 (?,Tv(B . special) ; 0xF6: DIGIT SIX
|
|
111 (?,Tw(B . special) ; 0xF7: DIGIT SEVEN
|
|
112 (?,Tx(B . special) ; 0xF8: DIGIT EIGHT
|
|
113 (?,Ty(B . special) ; 0xF9: DIGIT NINE
|
|
114 (?,Tz(B . special) ; 0xFA: ANGKHANKHU (ellipsis)
|
|
115 (?,T{(B . special) ; 0xFB: KHOMUT (beginning of religious texts)
|
|
116 (?,T|(B . not-used) ; 0xFC:
|
|
117 (?,T}(B . not-used) ; 0xFD:
|
|
118 (?,T~(B . not-used) ; 0xFE:
|
|
119 )
|
|
120 "Association list of thai-character and property.")
|
|
121 (setq thai-character-alist
|
|
122 (cons (cons (string-to-char "0,TQi1(B") 'vowel-upper-tone) thai-character-alist))
|
|
123
|
|
124 (defconst thai-category-table
|
|
125 (copy-category-table (standard-category-table))
|
|
126 "Category table for Thai.")
|
|
127 (define-category-mnemonic ?0 "Thai consonants"
|
|
128 thai-category-table)
|
|
129 (define-category-mnemonic ?1 "Thai upper/lower vowel or tone mark."
|
|
130 thai-category-table)
|
|
131 (define-category-mnemonic ?2 "Thai base vowel or special characters."
|
|
132 thai-category-table)
|
|
133
|
|
134 (let ((chars thai-character-alist)
|
|
135 ch prop)
|
|
136 (while chars
|
|
137 (setq ch (car (car chars))
|
|
138 prop (cdr (car chars)))
|
|
139 (cond ((eq prop 'consonant)
|
|
140 (modify-category-entry ch ?0 thai-category-table))
|
|
141 ((or (eq prop 'vowel-upper)
|
|
142 (eq prop 'vowel-lower)
|
|
143 (eq prop 'tone))
|
|
144 (modify-category-entry ch ?1 thai-category-table))
|
|
145 ((null (eq prop 'vowel-upper-tone))
|
|
146 (modify-category-entry ch ?2 thai-category-table)))
|
|
147 (setq chars (cdr chars))))
|
|
148
|
|
149 ;;;###autoload
|
|
150 (defun thai-compose-buffer ()
|
|
151 "Compose Thai characters in the current buffer."
|
|
152 (interactive)
|
|
153 (thai-compose-region (point-min) (point-max)))
|
|
154
|
|
155 ;;;###autoload
|
|
156 (defun thai-compose-region (beg end)
|
|
157 "Compose Thai characters in the region."
|
|
158 (interactive "r")
|
|
159 (save-restriction
|
|
160 (narrow-to-region beg end)
|
|
161 (decompose-region (point-min) (point-max))
|
|
162 (goto-char (point-min))
|
|
163 (let ((ctbl (category-table))
|
|
164 str)
|
|
165 (unwind-protect
|
|
166 (progn
|
|
167 (set-category-table thai-category-table)
|
|
168 (while (re-search-forward "\\c0\\c1+" nil t)
|
|
169 (compose-region (match-beginning 0) (match-end 0))))
|
|
170 (set-category-table ctbl)))))
|
|
171
|
|
172 ;;;
|
|
173 (provide 'thai)
|