Mercurial > hg > xemacs-beta
annotate lisp/mule/thai-xtis.el @ 5235:9058351b0236
Fix up very old FSF address in three Lisp files.
author | Stephen J. Turnbull <stephen@xemacs.org> |
---|---|
date | Sun, 13 Jun 2010 21:39:00 +0900 |
parents | 257b468bf2ca |
children | 308d34e9f07d |
rev | line source |
---|---|
398 | 1 ;;; thai-xtis.el --- Support for Thai (XTIS) -*- coding: iso-2022-7bit; -*- |
2 | |
3 ;; Copyright (C) 1999 Electrotechnical Laboratory, JAPAN. | |
4 ;; Licensed to the Free Software Foundation. | |
5 | |
6 ;; Author: TAKAHASHI Naoto <ntakahas@etl.go.jp> | |
7 ;; MORIOKA Tomohiko <tomo@etl.go.jp> | |
8 ;; Created: 1998-03-27 for Emacs-20.3 by TAKAHASHI Naoto | |
9 ;; 1999-03-29 imported and modified for XEmacs by MORIOKA Tomohiko | |
10 | |
11 ;; Keywords: mule, multilingual, Thai, XTIS | |
12 | |
13 ;; This file is part of XEmacs. | |
14 | |
15 ;; XEmacs is free software; you can redistribute it and/or modify it | |
16 ;; under the terms of the GNU General Public License as published by | |
17 ;; the Free Software Foundation; either version 2, or (at your option) | |
18 ;; any later version. | |
19 | |
20 ;; XEmacs is distributed in the hope that it will be useful, but | |
21 ;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
23 ;; General Public License for more details. | |
24 | |
25 ;; You should have received a copy of the GNU General Public License | |
26 ;; along with XEmacs; see the file COPYING. If not, write to the Free | |
27 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
28 ;; 02111-1307, USA. | |
29 | |
30 ;;; Commentary: | |
31 | |
32 ;; For Thai, the pre-composed character set proposed by | |
33 ;; Virach Sornlertlamvanich <virach@links.nectec.or.th> is supported. | |
34 | |
35 ;;; Code: | |
36 | |
780 | 37 (make-charset 'thai-xtis "Precomposed Thai (XTIS by Virach)." |
3659 | 38 '(registries ["xtis-0"] |
39 dimension 2 | |
40 columns 1 | |
41 chars 94 | |
42 final ?? | |
43 graphic 0)) | |
780 | 44 |
45 (define-category ?x "Precomposed Thai character.") | |
46 (modify-category-entry 'thai-xtis ?x) | |
47 | |
398 | 48 (when (featurep 'xemacs) |
49 (let ((deflist '(;; chars syntax | |
50 ("$(?!0(B-$(?NxP0R0S0`0(B-$(?e0(B" "w") | |
51 ("$(?p0(B-$(?y0(B" "w") | |
52 ("$(?O0f0_0o0z0{0(B" "_") | |
53 )) | |
54 elm chars len syntax to ch i) | |
55 (while deflist | |
56 (setq elm (car deflist)) | |
57 (setq chars (car elm) | |
58 len (length chars) | |
59 syntax (nth 1 elm) | |
60 i 0) | |
61 (while (< i len) | |
62 (if (= (aref chars i) ?-) | |
63 (setq i (1+ i) | |
64 to (nth 1 (split-char (aref chars i)))) | |
65 (setq ch (nth 1 (split-char (aref chars i))) | |
66 to ch)) | |
67 (while (<= ch to) | |
68 (modify-syntax-entry (vector 'thai-xtis ch) syntax) | |
69 (setq ch (1+ ch))) | |
70 (setq i (1+ i))) | |
71 (setq deflist (cdr deflist)))) | |
72 | |
73 (put-charset-property 'thai-xtis 'preferred-coding-system 'tis-620) | |
74 ) | |
75 | |
76 ;; This is the ccl-decode-thai-xtis automaton. | |
77 ;; | |
78 ;; "WRITE x y" == (insert (make-char 'thai-xtis x y)) | |
79 ;; "write x" == (insert x) | |
80 ;; rx' == (tis620-to-thai-xtis-second-byte-bitpattern rx) | |
81 ;; r3 == "no vower nor tone" | |
82 ;; r4 == (charset-id 'thai-xtis) | |
83 ;; | |
84 ;; | input (= r0) | |
85 ;; state |-------------------------------------------- | |
86 ;; | consonant | vowel | tone | |
87 ;; ---------+-------------+-------------+---------------- | |
88 ;; r1 == 0 | r1 = r0 | WRITE r0,r3 | WRITE r0,r3 | |
89 ;; r2 == 0 | | | | |
90 ;; ---------+-------------+-------------+---------------- | |
91 ;; r1 == C | WRITE r1,r3 | r2 = r0' | WRITE r1,r3|r0' | |
92 ;; r2 == 0 | r1 = r0 | | r1 = 0 | |
93 ;; ---------+-------------+-------------+---------------- | |
94 ;; r1 == C | WRITE r1,r2 | WRITE r1,r2 | WRITE r1,r2|r0' | |
95 ;; r2 == V | r1 = r0 | WRITE r0,r3 | r1 = r2 = 0 | |
96 ;; | r2 = 0 | r1 = r2 = 0 | | |
97 ;; | |
98 ;; | |
99 ;; | input (= r0) | |
100 ;; state |----------------------------------------- | |
101 ;; | symbol | ASCII | EOF | |
102 ;; ---------+-------------+-------------+------------- | |
103 ;; r1 == 0 | WRITE r0,r3 | write r0 | | |
104 ;; r2 == 0 | | | | |
105 ;; ---------+-------------+-------------+------------- | |
106 ;; r1 == C | WRITE r1,r3 | WRITE r1,r3 | WRITE r1,r3 | |
107 ;; r2 == 0 | WRITE r0,r3 | write r0 | | |
108 ;; | r1 = 0 | r1 = 0 | | |
109 ;; ---------+-------------+-------------+------------- | |
110 ;; r1 == C | WRITE r1,r2 | WRITE r1,r2 | WRITE r1,r2 | |
111 ;; r2 == V | WRITE r0,r3 | write r0 | | |
112 ;; | r1 = r2 = 0 | r1 = r2 = 0 | | |
113 | |
114 | |
115 (eval-and-compile | |
116 | |
117 ;; input : r5 = 1st byte, r6 = 2nd byte | |
118 ;; Their values will be destroyed. | |
119 (define-ccl-program ccl-thai-xtis-write | |
120 '(0 | |
121 ((r5 = ((r5 & #x7F) << 7)) | |
122 (r6 = ((r6 & #x7F) | r5)) | |
123 (write-multibyte-character r4 r6)))) | |
124 | |
125 (define-ccl-program ccl-thai-xtis-consonant | |
126 '(0 | |
127 (if (r1 == 0) | |
128 (r1 = r0) | |
129 (if (r2 == 0) | |
130 ((r5 = r1) (r6 = r3) (call ccl-thai-xtis-write) | |
131 (r1 = r0)) | |
132 ((r5 = r1) (r6 = r2) (call ccl-thai-xtis-write) | |
133 (r1 = r0) | |
134 (r2 = 0)))))) | |
135 | |
136 (define-ccl-program ccl-thai-xtis-vowel | |
137 '(0 | |
138 ((if (r1 == 0) | |
139 ((r5 = r0) (r6 = r3) (call ccl-thai-xtis-write)) | |
140 ((if (r2 == 0) | |
141 (r2 = ((r0 - 204) << 3)) | |
142 ((r5 = r1) (r6 = r2) (call ccl-thai-xtis-write) | |
143 (r5 = r0) (r6 = r3) (call ccl-thai-xtis-write) | |
144 (r1 = 0) | |
145 (r2 = 0)))))))) | |
146 | |
147 (define-ccl-program ccl-thai-xtis-vowel-d1 | |
148 '(0 | |
149 ((if (r1 == 0) | |
150 ((r5 = r0) (r6 = r3) (call ccl-thai-xtis-write)) | |
151 ((if (r2 == 0) | |
152 (r2 = #x38) | |
153 ((r5 = r1) (r6 = r2) (call ccl-thai-xtis-write) | |
154 (r5 = r0) (r6 = r3) (call ccl-thai-xtis-write) | |
155 (r1 = 0) | |
156 (r2 = 0)))))))) | |
157 | |
158 (define-ccl-program ccl-thai-xtis-vowel-ee | |
159 '(0 | |
160 ((if (r1 == 0) | |
161 ((r5 = r0) (r6 = r3) (call ccl-thai-xtis-write)) | |
162 ((if (r2 == 0) | |
163 (r2 = #x78) | |
164 ((r5 = r1) (r6 = r2) (call ccl-thai-xtis-write) | |
165 (r5 = r0) (r6 = r3) (call ccl-thai-xtis-write) | |
166 (r1 = 0) | |
167 (r2 = 0)))))))) | |
168 | |
169 (define-ccl-program ccl-thai-xtis-tone | |
170 '(0 | |
171 (if (r1 == 0) | |
172 ((r5 = r0) (r6 = r3) (call ccl-thai-xtis-write)) | |
173 (if (r2 == 0) | |
174 ((r5 = r1) (r6 = ((r0 - #xE6) | r3)) (call ccl-thai-xtis-write) | |
175 (r1 = 0)) | |
176 ((r5 = r1) (r6 = ((r0 - #xE6) | r2)) (call ccl-thai-xtis-write) | |
177 (r1 = 0) | |
178 (r2 = 0)))))) | |
179 | |
180 (define-ccl-program ccl-thai-xtis-symbol | |
181 '(0 | |
182 (if (r1 == 0) | |
183 ((r5 = r0) (r6 = r3) (call ccl-thai-xtis-write)) | |
184 (if (r2 == 0) | |
185 ((r5 = r1) (r6 = r3) (call ccl-thai-xtis-write) | |
186 (r5 = r0) (r6 = r3) (call ccl-thai-xtis-write) | |
187 (r1 = 0)) | |
188 ((r5 = r1) (r6 = r2) (call ccl-thai-xtis-write) | |
189 (r5 = r0) (r6 = r3) (call ccl-thai-xtis-write) | |
190 (r1 = 0) | |
191 (r2 = 0)))))) | |
192 | |
193 (define-ccl-program ccl-thai-xtis-ascii | |
194 '(0 | |
195 (if (r1 == 0) | |
196 (write r0) | |
197 (if (r2 == 0) | |
198 ((r5 = r1) (r6 = r3) (call ccl-thai-xtis-write) | |
199 (write r0) | |
200 (r1 = 0)) | |
201 ((r5 = r1) (r6 = r2) (call ccl-thai-xtis-write) | |
202 (write r0) | |
203 (r1 = 0) | |
204 (r2 = 0)))))) | |
205 | |
206 (define-ccl-program ccl-thai-xtis-eof | |
207 '(0 | |
208 (if (r1 != 0) | |
209 (if (r2 == 0) | |
210 ((r5 = r1) (r6 = r3) (call ccl-thai-xtis-write)) | |
211 ((r5 = r1) (r6 = r2) (call ccl-thai-xtis-write)))))) | |
212 | |
213 (define-ccl-program ccl-decode-thai-xtis | |
214 `(4 | |
215 ((read r0) | |
216 (r1 = 0) | |
217 (r2 = 0) | |
218 (r3 = #x30) | |
219 (r4 = ,(charset-id 'thai-xtis)) | |
220 (loop | |
221 (if (r0 < 161) | |
222 (call ccl-thai-xtis-ascii) | |
223 (branch (r0 - 161) | |
224 (call ccl-thai-xtis-consonant) | |
225 (call ccl-thai-xtis-consonant) | |
226 (call ccl-thai-xtis-consonant) | |
227 (call ccl-thai-xtis-consonant) | |
228 (call ccl-thai-xtis-consonant) | |
229 (call ccl-thai-xtis-consonant) | |
230 (call ccl-thai-xtis-consonant) | |
231 (call ccl-thai-xtis-consonant) | |
232 (call ccl-thai-xtis-consonant) | |
233 (call ccl-thai-xtis-consonant) | |
234 (call ccl-thai-xtis-consonant) | |
235 (call ccl-thai-xtis-consonant) | |
236 (call ccl-thai-xtis-consonant) | |
237 (call ccl-thai-xtis-consonant) | |
238 (call ccl-thai-xtis-consonant) | |
239 (call ccl-thai-xtis-consonant) | |
240 (call ccl-thai-xtis-consonant) | |
241 (call ccl-thai-xtis-consonant) | |
242 (call ccl-thai-xtis-consonant) | |
243 (call ccl-thai-xtis-consonant) | |
244 (call ccl-thai-xtis-consonant) | |
245 (call ccl-thai-xtis-consonant) | |
246 (call ccl-thai-xtis-consonant) | |
247 (call ccl-thai-xtis-consonant) | |
248 (call ccl-thai-xtis-consonant) | |
249 (call ccl-thai-xtis-consonant) | |
250 (call ccl-thai-xtis-consonant) | |
251 (call ccl-thai-xtis-consonant) | |
252 (call ccl-thai-xtis-consonant) | |
253 (call ccl-thai-xtis-consonant) | |
254 (call ccl-thai-xtis-consonant) | |
255 (call ccl-thai-xtis-consonant) | |
256 (call ccl-thai-xtis-consonant) | |
257 (call ccl-thai-xtis-consonant) | |
258 (call ccl-thai-xtis-consonant) | |
259 (call ccl-thai-xtis-symbol) | |
260 (call ccl-thai-xtis-consonant) | |
261 (call ccl-thai-xtis-symbol) | |
262 (call ccl-thai-xtis-consonant) | |
263 (call ccl-thai-xtis-consonant) | |
264 (call ccl-thai-xtis-consonant) | |
265 (call ccl-thai-xtis-consonant) | |
266 (call ccl-thai-xtis-consonant) | |
267 (call ccl-thai-xtis-consonant) | |
268 (call ccl-thai-xtis-consonant) | |
269 (call ccl-thai-xtis-consonant) | |
270 (call ccl-thai-xtis-symbol) | |
271 (call ccl-thai-xtis-symbol) | |
272 (call ccl-thai-xtis-vowel-d1) | |
273 (call ccl-thai-xtis-symbol) | |
274 (call ccl-thai-xtis-symbol) | |
275 (call ccl-thai-xtis-vowel) | |
276 (call ccl-thai-xtis-vowel) | |
277 (call ccl-thai-xtis-vowel) | |
278 (call ccl-thai-xtis-vowel) | |
279 (call ccl-thai-xtis-vowel) | |
280 (call ccl-thai-xtis-vowel) | |
281 (call ccl-thai-xtis-vowel) | |
282 nil | |
283 nil | |
284 nil | |
285 nil | |
286 (call ccl-thai-xtis-symbol) | |
287 (call ccl-thai-xtis-symbol) | |
288 (call ccl-thai-xtis-symbol) | |
289 (call ccl-thai-xtis-symbol) | |
290 (call ccl-thai-xtis-symbol) | |
291 (call ccl-thai-xtis-symbol) | |
292 (call ccl-thai-xtis-symbol) | |
293 (call ccl-thai-xtis-symbol) | |
294 (call ccl-thai-xtis-tone) | |
295 (call ccl-thai-xtis-tone) | |
296 (call ccl-thai-xtis-tone) | |
297 (call ccl-thai-xtis-tone) | |
298 (call ccl-thai-xtis-tone) | |
299 (call ccl-thai-xtis-tone) | |
300 (call ccl-thai-xtis-tone) | |
301 (call ccl-thai-xtis-vowel-ee) | |
302 (call ccl-thai-xtis-symbol) | |
303 (call ccl-thai-xtis-symbol) | |
304 (call ccl-thai-xtis-symbol) | |
305 (call ccl-thai-xtis-symbol) | |
306 (call ccl-thai-xtis-symbol) | |
307 (call ccl-thai-xtis-symbol) | |
308 (call ccl-thai-xtis-symbol) | |
309 (call ccl-thai-xtis-symbol) | |
310 (call ccl-thai-xtis-symbol) | |
311 (call ccl-thai-xtis-symbol) | |
312 (call ccl-thai-xtis-symbol) | |
313 (call ccl-thai-xtis-symbol) | |
314 (call ccl-thai-xtis-symbol) | |
315 nil | |
316 nil | |
317 nil)) | |
318 (read r0) | |
319 (repeat))) | |
320 | |
321 (call ccl-thai-xtis-eof))) | |
322 | |
323 ) | |
324 | |
325 (defconst leading-code-private-21 #x9F) | |
326 | |
327 (define-ccl-program ccl-encode-thai-xtis | |
328 `(1 | |
329 ((read r0) | |
330 (loop | |
331 (if (r0 == ,leading-code-private-21) | |
332 ((read r1) | |
333 (if (r1 == ,(charset-id 'thai-xtis)) | |
334 ((read r0) | |
335 (write r0) | |
336 (read r0) | |
337 (r1 = (r0 & 7)) | |
338 (r0 = ((r0 - #xB0) >> 3)) | |
339 (if (r0 != 0) | |
340 (write r0 [0 209 212 213 214 215 216 217 218 238])) | |
341 (if (r1 != 0) | |
342 (write r1 [0 231 232 233 234 235 236 237])) | |
343 (read r0) | |
344 (repeat)) | |
345 ((write r0 r1) | |
346 (read r0) | |
347 (repeat)))) | |
348 (write-read-repeat r0)))))) | |
349 | |
4690
257b468bf2ca
Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4568
diff
changeset
|
350 (make-coding-system |
257b468bf2ca
Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4568
diff
changeset
|
351 'tis-620 'ccl |
257b468bf2ca
Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4568
diff
changeset
|
352 "TIS620 (Thai)" |
257b468bf2ca
Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4568
diff
changeset
|
353 `(mnemonic "TIS620" |
257b468bf2ca
Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4568
diff
changeset
|
354 decode ccl-decode-thai-xtis |
257b468bf2ca
Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4568
diff
changeset
|
355 encode ccl-encode-thai-xtis |
257b468bf2ca
Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4568
diff
changeset
|
356 safe-charsets (ascii thai-xtis) |
257b468bf2ca
Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4568
diff
changeset
|
357 documentation "external=tis620, internal=thai-xtis")) |
257b468bf2ca
Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4568
diff
changeset
|
358 (coding-system-put 'tis-620 'category 'iso-8-1) |
398 | 359 |
360 (set-language-info-alist | |
361 "Thai-XTIS" | |
362 '((charset thai-xtis) | |
363 (coding-system tis-620 iso-2022-7bit) | |
364 (tutorial . "TUTORIAL.th") | |
365 (tutorial-coding-system . tis-620) | |
366 (coding-priority tis-620 iso-2022-7bit) | |
367 (sample-text . "$(?!:(B") | |
368 (documentation . t))) | |
369 | |
370 ;; thai-xtis.el ends here. |