annotate lisp/mule/vietnamese.el @ 771:943eaba38521

[xemacs-hg @ 2002-03-13 08:51:24 by ben] The big ben-mule-21-5 check-in! Various files were added and deleted. See CHANGES-ben-mule. There are still some test suite failures. No crashes, though. Many of the failures have to do with problems in the test suite itself rather than in the actual code. I'll be addressing these in the next day or so -- none of the test suite failures are at all critical. Meanwhile I'll be trying to address the biggest issues -- i.e. build or run failures, which will almost certainly happen on various platforms. All comments should be sent to ben@xemacs.org -- use a Cc: if necessary when sending to mailing lists. There will be pre- and post- tags, something like pre-ben-mule-21-5-merge-in, and post-ben-mule-21-5-merge-in.
author ben
date Wed, 13 Mar 2002 08:54:06 +0000
parents 576fb035e263
children 2923009caf47
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 ;;; vietnamese.el --- Support for Vietnamese -*- coding: iso-2022-7bit; -*-
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 ;; Licensed to the Free Software Foundation.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 ;; Copyright (C) 1997 MORIOKA Tomohiko
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 ;; Keywords: multilingual, Vietnamese
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 ;; This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 ;; XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 ;; under the terms of the GNU General Public License as published by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 ;; any later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 ;; XEmacs is distributed in the hope that it will be useful, but
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 ;; General Public License for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 ;; along with XEmacs; see the file COPYING. If not, write to the Free
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 ;; 02111-1307, USA.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 ;;; Commentary:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 ;; For Vietnames, the character sets VISCII and VSCII are supported.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 ;;; Code:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 (eval-and-compile
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 (defvar viet-viscii-decode-table
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 [;; VISCII is a full 8-bit code.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 0 1 ?,2F(B 3 4 ?,2G(B ?,2g(B 7 8 9 10 11 12 13 14 15
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 16 17 18 19 ?,2V(B 21 22 23 24 ?,2[(B 26 27 28 29 ?,2\(B 31
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 ?,2U(B ?,2!(B ?,2"(B ?,2#(B ?,2$(B ?,2%(B ?,2&(B ?,2'(B ?,2((B ?,2)(B ?,2*(B ?,2+(B ?,2,(B ?,2-(B ?,2.(B ?,2/(B
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 ?,20(B ?,21(B ?,22(B ?,25(B ?,2~(B ?,2>(B ?,26(B ?,27(B ?,28(B ?,2v(B ?,2w(B ?,2o(B ?,2|(B ?,2{(B ?,2x(B ?,2O(B
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 ?,2u(B ?,1!(B ?,1"(B ?,1#(B ?,1$(B ?,1%(B ?,1&(B ?,1'(B ?,1((B ?,1)(B ?,1*(B ?,1+(B ?,1,(B ?,1-(B ?,1.(B ?,1/(B
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 ?,10(B ?,11(B ?,12(B ?,2^(B ?,2=(B ?,15(B ?,16(B ?,17(B ?,18(B ?,2q(B ?,2Q(B ?,2W(B ?,2X(B ?,1=(B ?,1>(B ?,2_(B
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 ?,2`(B ?,2a(B ?,2b(B ?,2c(B ?,2d(B ?,2e(B ?,1F(B ?,1G(B ?,2h(B ?,2i(B ?,2j(B ?,2k(B ?,2l(B ?,2m(B ?,2n(B ?,1O(B
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 ?,2p(B ?,1Q(B ?,2r(B ?,2s(B ?,2t(B ?,1U(B ?,1V(B ?,1W(B ?,1X(B ?,2y(B ?,2z(B ?,1[(B ?,1\(B ?,2}(B ?,1^(B ?,1_(B
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 ?,1`(B ?,1a(B ?,1b(B ?,1c(B ?,1d(B ?,1e(B ?,1f(B ?,1g(B ?,1h(B ?,1i(B ?,1j(B ?,1k(B ?,1l(B ?,1m(B ?,1n(B ?,1o(B
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 ?,1p(B ?,1q(B ?,1r(B ?,1s(B ?,1t(B ?,1u(B ?,1v(B ?,1w(B ?,1x(B ?,1y(B ?,1z(B ?,1{(B ?,1|(B ?,1}(B ?,1~(B ?,2f(B ]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 "Vietnamese VISCII decoding table.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 (defvar viet-viscii-encode-table
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 (let ((table-lower (make-vector 128 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 (table-upper (make-vector 128 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 (i 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 char-component)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 (while (< i 256)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 (setq char-component
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 (split-char (aref viet-viscii-decode-table i)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 (cond ((eq (car char-component) 'vietnamese-viscii-lower)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 (aset table-lower (nth 1 char-component) i))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 ((eq (car char-component) 'vietnamese-viscii-upper)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 (aset table-upper (nth 1 char-component) i)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 (setq i (1+ i)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 (cons table-lower table-upper))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 "Vietnamese VISCII encoding table.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 Cons of tables for encoding lower-case chars and upper-case characters.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 Both tables are indexed by the position code of Vietnamese characters.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 (defvar viet-vscii-decode-table
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 [;; VSCII is a full 8-bit code.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 0 ?,2z(B ?,2x(B 3 ?,2W(B ?,2X(B ?,2f(B 7 8 9 10 11 12 13 14 15
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 16 ?,2Q(B ?,2_(B ?,2O(B ?,2V(B ?,2[(B ?,2}(B ?,2\(B 24 25 26 27 28 29 30 31
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 ?,2`(B ?,2d(B ?,2c(B ?,2a(B ?,2U(B ?,2#(B ?,2'(B ?,2h(B ?,2k(B ?,2((B ?,2i(B ?,2)(B ?,2.(B ?,2l(B ?,2o(B ?,2n(B
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 ?,2m(B ?,28(B ?,2r(B ?,2v(B ?,2u(B ?,2s(B ?,2w(B ?,25(B ?,26(B ?,27(B ?,2^(B ?,2>(B ?,2~(B ?,2y(B ?,2|(B ?,2{(B
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 160 ?,2e(B ?,2b(B ?,2j(B ?,2t(B ?,2=(B ?,2_(B ?,2p(B ?,1e(B ?,1b(B ?,1j(B ?,1t(B ?,1>(B ?,1y(B ?,1p(B ?,2"(B
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 192 193 194 195 196 ?,1`(B ?,1d(B ?,1c(B ?,1a(B ?,1U(B ?,2F(B ?,1"(B ?,1F(B ?,1G(B ?,1!(B ?,2G(B
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 ?,2!(B ?,2%(B ?,2&(B ?,2g(B ?,2%(B ?,2+(B ?,1#(B ?,1%(B ?,1&(B ?,1g(B ?,1$(B ?,1'(B ?,1h(B ?,2,(B ?,1k(B ?,1((B
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 ?,1i(B ?,1)(B ?,1+(B ?,1,(B ?,1-(B ?,1*(B ?,1.(B ?,1l(B ?,1o(B ?,2-(B ?,2*(B ?,20(B ?,1n(B ?,1m(B ?,18(B ?,1r(B
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 ?,21(B ?,1v(B ?,1u(B ?,1s(B ?,1w(B ?,10(B ?,11(B ?,12(B ?,1/(B ?,15(B ?,16(B ?,17(B ?,1^(B ?,1>(B ?,1~(B ?,1y(B
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 ?,22(B ?,1|(B ?,1{(B ?,1z(B ?,1x(B ?,1W(B ?,1X(B ?,1f(B ?,1Q(B ?,1q(B ?,1O(B ?,1V(B ?,1[(B ?,1}(B ?,1\(B ?,2/(B]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 "Vietnamese VSCII decoding table.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 (defvar viet-vscii-encode-table
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 (let ((table-lower (make-vector 128 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 (table-upper (make-vector 128 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 (i 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 char-component)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 (while (< i 256)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 (setq char-component
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 (split-char (aref viet-vscii-decode-table i)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 (cond ((eq (car char-component) 'vietnamese-viscii-lower)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 (aset table-lower (nth 1 char-component) i))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 ((eq (car char-component) 'vietnamese-viscii-upper)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 (aset table-upper (nth 1 char-component) i)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 (setq i (1+ i)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 (cons table-lower table-upper))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 "Vietnamese VSCII encoding table.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 Cons of tables for encoding lower-case chars and upper-case characters.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 Both tables are indexed by the position code of Vietnamese characters.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 (define-ccl-program ccl-decode-viscii
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 `(3
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 ((read r0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 (loop
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 (write-read-repeat r0 ,viet-viscii-decode-table))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 ))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 "CCL program to decode VISCII 1.1")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 ;; Multibyte form of a Vietnamese character is as follows (3-byte):
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 ;; LEADING-CODE-PRIVATE-11 LEADING-CODE-EXTENDED-11 POSITION-CODE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 ;; where LEADING-CODE-EXTENDED-11 for Vietnamese is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 ;; `vietnamese-viscii-lower' or `vietnamese-viscii-upper'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 (defvar leading-code-private-11 #x9E)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 (define-ccl-program ccl-encode-viscii
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 `(1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 ((read r0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 (loop
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 (if (r0 < 128)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 ;; ASCII
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 (write-read-repeat r0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 ;; not ASCII
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 (if (r0 != ,leading-code-private-11)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 ;; not Vietnamese
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 (write-read-repeat r0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 ((read-if (r0 == ,(charset-id 'vietnamese-viscii-lower))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 (;; Vietnamese lower
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 (read r0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 (r0 -= 128)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 (write-read-repeat r0 ,(car viet-viscii-encode-table)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 (if (r0 == ,(charset-id 'vietnamese-viscii-upper))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 (;; Vietnamese upper
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 (read r0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 (r0 -= 128)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 (write-read-repeat r0 ,(cdr viet-viscii-encode-table)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 ;; not Vietnamese
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 (write-read-repeat r0)))))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 "CCL program to encode VISCII 1.1")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 (define-ccl-program ccl-encode-viscii-font
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 `(0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 ;; In: R0:vietnamese-viscii-lower/vietnamese-viscii-upper
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 ;; R1:position code
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 ;; Out: R1:font code point
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 (if (r0 == ,(charset-id 'vietnamese-viscii-lower))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 (r1 = r1 ,(car viet-viscii-encode-table))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 (r1 = r1 ,(cdr viet-viscii-encode-table)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 "CCL program to encode Vietnamese chars to VISCII 1.1 font")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 (define-ccl-program ccl-decode-vscii
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 `(3
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 ((read r0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 (loop
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 (write-read-repeat r0 ,viet-vscii-decode-table))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 ))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 "CCL program to decode VSCII-1.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 (define-ccl-program ccl-encode-vscii
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 `(1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 ((read r0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 (loop
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 (if (r0 < 128)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 ;; ASCII
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 (write-read-repeat r0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 ;; not ASCII
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 (if (r0 != ,leading-code-private-11)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 ;; not Vietnamese
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 (write-read-repeat r0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 (read-if (r0 == ,(charset-id 'vietnamese-viscii-lower))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 (;; Vietnamese lower
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 (read r0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 (r0 -= 128)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 (write-read-repeat r0 ,(car viet-vscii-encode-table)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 (if (r0 == ,(charset-id 'vietnamese-viscii-upper))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 (;; Vietnamese upper
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 (read r0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 (r0 -= 128)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 (write-read-repeat r0 ,(cdr viet-vscii-encode-table)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 ;; not Vietnamese
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 (write-read-repeat r0))))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 "CCL program to encode VSCII-1.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 (define-ccl-program ccl-encode-vscii-font
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 `(0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 ;; In: R0:vietnamese-viscii-lower/vietnamese-viscii-upper
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 ;; R1:position code
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 ;; Out: R1:font code point
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 (if (r0 == ,(charset-id 'vietnamese-viscii-lower))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 (r1 = r1 ,(car viet-vscii-encode-table))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 (r1 = r1 ,(cdr viet-vscii-encode-table)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 "CCL program to encode Vietnamese chars to VSCII-1 font.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 (make-coding-system
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 'viscii 'ccl
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 444
diff changeset
210 "VISCII 1.1 (Vietnamese)"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 `(mnemonic "VISCII"
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
212 decode ccl-decode-viscii
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
213 encode ccl-encode-viscii))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 ;; it is not correct, but XEmacs doesn't have `ccl' category...
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 (coding-system-put 'viscii 'category 'iso-8-1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 ;; (make-coding-system
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 ;; 'vietnamese-viscii 4 ?V
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 ;; "8-bit encoding for Vietnamese VISCII 1.1 (MIME:VISCII)"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 ;; '(ccl-decode-viscii . ccl-encode-viscii)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 ;; '((safe-charsets ascii vietnamese-viscii-lower vietnamese-viscii-upper)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 ;; (mime-charset . viscii)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 ;; (valid-codes (0 . 255))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 ;; (define-coding-system-alias 'viscii 'vietnamese-viscii)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 (make-coding-system
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 'vscii 'ccl
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 444
diff changeset
230 "VSCII 1.1 (Vietnamese)"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 `(mnemonic "VSCII"
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
232 decode ccl-decode-vscii
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
233 encode ccl-encode-vscii))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 ;; (make-coding-system
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 ;; 'vietnamese-vscii 4 ?v
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 ;; "8-bit encoding for Vietnamese VSCII-1"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 ;; '(ccl-decode-vscii . ccl-encode-vscii)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 ;; '((safe-charsets ascii vietnamese-viscii-lower vietnamese-viscii-upper)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 ;; (valid-codes (0 . 255))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 ;; (define-coding-system-alias 'vscii 'vietnamese-vscii)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 (make-coding-system
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 'viqr 'no-conversion
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 444
diff changeset
246 "VIQR (Vietnamese)"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 '(mnemonic "VIQR"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 eol-type lf
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 post-read-conversion viqr-post-read-conversion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 pre-write-conversion viqr-pre-write-conversion))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 ;; (make-coding-system
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 ;; 'vietnamese-viqr 0 ?q
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 ;; "Vietnamese latin transcription (VIQR)"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 ;; nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 ;; '((safe-charsets ascii vietnamese-viscii-lower vietnamese-viscii-upper)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 ;; (post-read-conversion . viqr-post-read-conversion)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 ;; (pre-write-conversion . viqr-pre-write-conversion)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 ;; (charset-origin-alist
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 ;; (vietnamese-viscii-lower "VISCII" viet-encode-viscii-char)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261 ;; (vietnamese-viscii-upper "VISCII" viet-encode-viscii-char))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 ;; (define-coding-system-alias 'viqr 'vietnamese-viqr)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265 ;; For VISCII users
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266 (set-charset-ccl-program 'vietnamese-viscii-lower
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
267 'ccl-encode-viscii-font)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 (set-charset-ccl-program 'vietnamese-viscii-upper
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
269 'ccl-encode-viscii-font)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 ;; For VSCII users
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
271 (set-charset-ccl-program 'vietnamese-viscii-lower 'ccl-encode-vscii-font)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 440
diff changeset
272 (set-charset-ccl-program 'vietnamese-viscii-upper 'ccl-encode-vscii-font)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274 ;; (setq font-ccl-encoder-alist
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 ;; (cons (cons "viscii" ccl-encode-viscii-font) font-ccl-encoder-alist))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277 ;; (setq font-ccl-encoder-alist
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 ;; (cons (cons "vscii" ccl-encode-vscii-font) font-ccl-encoder-alist))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 ;; (defvar viet-viscii-nonascii-translation-table
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281 ;; (make-translation-table-from-vector viet-viscii-decode-table)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282 ;; "Value of `nonascii-translation-table' in Vietnamese language environment.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 (set-language-info-alist
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 "Vietnamese" '((charset vietnamese-viscii-lower vietnamese-viscii-upper)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 (coding-system viscii vscii viqr)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 (coding-priority viscii)
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 444
diff changeset
288 (locale "vietnamese" "vi")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 (input-method . "vietnamese-viqr")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 (features viet-util)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291 (sample-text . "Vietnamese (Ti,1*(Bng Vi,1.(Bt) Ch,1`(Bo b,1U(Bn")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292 (documentation . "\
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
293 For Vietnamese, Emacs uses special charsets internally.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 They can be decoded from and encoded to VISCC, VSCII, and VIQR.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 Current setting put higher priority to the coding system VISCII than VSCII.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 If you prefer VSCII, please do: (prefer-coding-system 'vietnamese-vscii)")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 ))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 ;;; vietnamese.el ends here