24 |
|
|
25 |
;;; Commentary: |
;;; Commentary: |
26 |
|
|
27 |
;; For Vietnames, the character sets VISCII and VSCII are supported. |
;; For Vietnames, the character sets VISCII, VSCII and TCVN-5712 are |
28 |
|
;; supported. |
29 |
|
|
30 |
;;; Code: |
;;; Code: |
31 |
|
|
54 |
(define-translation-table 'viet-viscii-encode-table |
(define-translation-table 'viet-viscii-encode-table |
55 |
(char-table-extra-slot table 0))) |
(char-table-extra-slot table 0))) |
56 |
|
|
57 |
|
;;; |
58 |
|
;;; VSCII is a pre-version of TCVN-5712 and deprecated |
59 |
|
;;; |
60 |
(defvar viet-vscii-decode-table |
(defvar viet-vscii-decode-table |
61 |
[;; VSCII is a full 8-bit code. |
[;; VSCII is a full 8-bit code. |
62 |
0 ?,2z(B ?,2x(B 3 ?,2W(B ?,2X(B ?,2f(B 7 8 9 10 11 12 13 14 15 |
0 ?,2z(B ?,2x(B 3 ?,2W(B ?,2X(B ?,2f(B 7 8 9 10 11 12 13 14 15 |
82 |
(define-translation-table 'viet-vscii-encode-table |
(define-translation-table 'viet-vscii-encode-table |
83 |
(char-table-extra-slot table 0))) |
(char-table-extra-slot table 0))) |
84 |
|
|
85 |
|
;; Does not support combining characters in the range [176, 180] |
86 |
|
(defvar viet-tcvn-decode-table |
87 |
|
[;; TCVN is a full 8-bit code. |
88 |
|
0 ?,2z(B ?,2x(B 3 ?,2W(B ?,2X(B ?,2f(B 7 8 9 10 11 12 13 14 15 |
89 |
|
16 ?,2Q(B ?,2q(B ?,2O(B ?,2V(B ?,2[(B ?,2}(B ?,2\(B 24 25 26 27 28 29 30 31 |
90 |
|
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
91 |
|
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
92 |
|
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
93 |
|
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
94 |
|
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
95 |
|
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
96 |
|
?,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 |
97 |
|
?,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 |
98 |
|
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 ?,1_(B ?,1p(B ?,2"(B |
99 |
|
176 177 178 179 180 ?,1`(B ?,1d(B ?,1c(B ?,1a(B ?,1U(B ?,2F(B ?,1"(B ?,1F(B ?,1G(B ?,1!(B ?,2G(B |
100 |
|
?,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 |
101 |
|
?,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 |
102 |
|
?,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 |
103 |
|
?,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] |
104 |
|
"Vietnamese TCVN-5712 decoding table.") |
105 |
|
|
106 |
|
(let ((table (make-translation-table-from-vector viet-tcvn-decode-table))) |
107 |
|
(define-translation-table 'viet-tcvn-nonascii-translation-table table) |
108 |
|
(define-translation-table 'viet-tcvn-encode-table |
109 |
|
(char-table-extra-slot table 0))) |
110 |
|
|
111 |
|
;; (defvar viet-vps-decode-table |
112 |
|
;; [;; VPS is a full 8-bit code. |
113 |
|
;; 0 1 ?,2U(B ?,2'(B ?,2#(B ?,2)(B ?,2.(B 7 8 9 10 11 12 13 14 15 |
114 |
|
;; ?,28(B ?,2w(B ?,25(B ?,2~(B ?,2x(B ?,2q(B 22 23 24 ?,2\(B 26 27 ?,2g(B ?,2f(B 30 31 |
115 |
|
;; 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
116 |
|
;; 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
117 |
|
;; 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
118 |
|
;; 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
119 |
|
;; 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
120 |
|
;; 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
121 |
|
;; ?,2`(B ?,2d(B ?,2c(B ?,2$(B ?,2%(B ?,2&(B ?,1w(B ?,12(B ?,2e(B ?,1*(B ?,1+(B ?,1,(B ?,1.(B ?,2!(B ?,2"(B ?,2F(B |
122 |
|
;; ?,2*(B 145 146 ?,2+(B ?,2,(B ?,2-(B ?,2/(B ?,20(B ?,21(B ?,22(B ?,1}(B ?,1V(B ?,1\(B ?,2>(B ?,26(B ?,27(B |
123 |
|
;; 160 ?,1!(B ?,1"(B ?,1F(B ?,1G(B ?,1#(B ?,2^(B ?,1>(B ?,2y(B ?,16(B ?,17(B ?,1^(B ?,2{(B ?,2Q(B ?,1~(B ?,2W(B |
124 |
|
;; ?,11(B ?,2X(B ?,2O(B ?,2[(B ?,2m(B ?,2l(B ?,15(B ?,2o(B ?,2n(B ?,2s(B ?,1X(B ?,1f(B ?,2r(B ?,2v(B ?,2u(B ?,1q(B |
125 |
|
;; ?,1%(B ?,2a(B ?,2b(B ?,1$(B ?,1&(B ?,1g(B ?,1'(B ?,1p(B ?,1k(B ?,2i(B ?,2j(B ?,1)(B ?,1o(B ?,1-(B ?,18(B ?,1[(B |
126 |
|
;; ?,2_(B ?,2|(B ?,10(B ?,1/(B ?,2t(B ?,1v(B ?,1=(B ?,2h(B ?,1W(B ?,1Q(B ?,2z(B ?,1{(B ?,1_(B ?,2}(B ?,2k(B 223 |
127 |
|
;; ?,1`(B ?,1a(B ?,1b(B ?,1c(B ?,1d(B ?,1U(B ?,1e(B 231 ?,1h(B ?,1i(B ?,1j(B ?,1((B ?,1l(B ?,1m(B 238 ?,1n(B |
128 |
|
;; ?,2G(B ?,2p(B ?,1r(B ?,1s(B ?,1t(B ?,1u(B 246 ?,2=(B ?,1x(B ?,1y(B ?,1z(B ?,1|(B 252 ?,2V(B ?,2((B ?,1O(B] |
129 |
|
;; "Vietnamese VPS decoding table.") |
130 |
|
;; |
131 |
|
;; (let ((table (make-translation-table-from-vector viet-vps-decode-table))) |
132 |
|
;; (define-translation-table 'viet-vps-nonascii-translation-table table) |
133 |
|
;; (define-translation-table 'viet-vps-encode-table |
134 |
|
;; (char-table-extra-slot table 0))) |
135 |
|
|
136 |
(define-ccl-program ccl-decode-viscii |
(define-ccl-program ccl-decode-viscii |
137 |
`(3 |
`(3 |
138 |
((loop |
((loop |
185 |
(translate-character viet-vscii-encode-table r0 r1)) |
(translate-character viet-vscii-encode-table r0 r1)) |
186 |
"CCL program to encode Vietnamese chars to VSCII-1 font.") |
"CCL program to encode Vietnamese chars to VSCII-1 font.") |
187 |
|
|
188 |
|
(define-ccl-program ccl-decode-tcvn |
189 |
|
`(3 |
190 |
|
((loop |
191 |
|
(r0 = 0) |
192 |
|
(read r1) |
193 |
|
(translate-character viet-tcvn-nonascii-translation-table r0 r1) |
194 |
|
(write-multibyte-character r0 r1) |
195 |
|
(repeat)))) |
196 |
|
"CCL program to decode TCVN-5712.") |
197 |
|
|
198 |
|
(define-ccl-program ccl-encode-tcvn |
199 |
|
`(1 |
200 |
|
((loop |
201 |
|
(read-multibyte-character r0 r1) |
202 |
|
(translate-character viet-tcvn-encode-table r0 r1) |
203 |
|
(write-repeat r1)))) |
204 |
|
"CCL program to encode TCVN-5712.") |
205 |
|
|
206 |
|
(define-ccl-program ccl-encode-tcvn-font |
207 |
|
`(0 |
208 |
|
;; In: R0:vietnamese-viscii-lower/vietnamese-viscii-upper |
209 |
|
;; R1:position code |
210 |
|
;; Out: R1:font code point |
211 |
|
(translate-character viet-tcvn-encode-table r0 r1)) |
212 |
|
"CCL program to encode Vietnamese chars to TCVN-5712 font.") |
213 |
|
|
214 |
|
;; (define-ccl-program ccl-decode-vps |
215 |
|
;; `(3 |
216 |
|
;; ((loop |
217 |
|
;; (r0 = 0) |
218 |
|
;; (read r1) |
219 |
|
;; (translate-character viet-vps-nonascii-translation-table r0 r1) |
220 |
|
;; (write-multibyte-character r0 r1) |
221 |
|
;; (repeat)))) |
222 |
|
;; "CCL program to decode VPS.") |
223 |
|
;; |
224 |
|
;; (define-ccl-program ccl-encode-vps |
225 |
|
;; `(1 |
226 |
|
;; ((loop |
227 |
|
;; (read-multibyte-character r0 r1) |
228 |
|
;; (translate-character viet-vps-encode-table r0 r1) |
229 |
|
;; (write-repeat r1)))) |
230 |
|
;; "CCL program to encode VPS.") |
231 |
|
;; |
232 |
|
;; (define-ccl-program ccl-encode-vps-font |
233 |
|
;; `(0 |
234 |
|
;; ;; In: R0:vietnamese-viscii-lower/vietnamese-viscii-upper |
235 |
|
;; ;; R1:position code |
236 |
|
;; ;; Out: R1:font code point |
237 |
|
;; (translate-character viet-vps-encode-table r0 r1)) |
238 |
|
;; "CCL program to encode Vietnamese chars to VPS font.") |
239 |
|
|
240 |
(make-coding-system |
(make-coding-system |
241 |
'vietnamese-viscii 4 ?V |
'vietnamese-viscii 4 ?V |
242 |
"8-bit encoding for Vietnamese VISCII 1.1 (MIME:VISCII)." |
"8-bit encoding for Vietnamese VISCII 1.1 (MIME:VISCII)" |
243 |
'(ccl-decode-viscii . ccl-encode-viscii) |
'(ccl-decode-viscii . ccl-encode-viscii) |
244 |
'((safe-charsets ascii vietnamese-viscii-lower vietnamese-viscii-upper) |
'((safe-charsets ascii vietnamese-viscii-lower vietnamese-viscii-upper) |
245 |
(mime-charset . viscii) |
(mime-charset . viscii) |
249 |
|
|
250 |
(make-coding-system |
(make-coding-system |
251 |
'vietnamese-vscii 4 ?v |
'vietnamese-vscii 4 ?v |
252 |
"8-bit encoding for Vietnamese VSCII-1." |
"8-bit encoding for Vietnamese VSCII-1" |
253 |
'(ccl-decode-vscii . ccl-encode-vscii) |
'(ccl-decode-vscii . ccl-encode-vscii) |
254 |
'((safe-charsets ascii vietnamese-viscii-lower vietnamese-viscii-upper) |
'((safe-charsets ascii vietnamese-viscii-lower vietnamese-viscii-upper) |
255 |
(valid-codes (0 . 255)))) |
(valid-codes (0 . 255)))) |
257 |
(define-coding-system-alias 'vscii 'vietnamese-vscii) |
(define-coding-system-alias 'vscii 'vietnamese-vscii) |
258 |
|
|
259 |
(make-coding-system |
(make-coding-system |
260 |
|
'vietnamese-tcvn 4 ?t |
261 |
|
"8-bit encoding for Vietnamese TCVN-5712" |
262 |
|
'(ccl-decode-tcvn . ccl-encode-tcvn) |
263 |
|
'((safe-charsets ascii vietnamese-viscii-lower vietnamese-viscii-upper) |
264 |
|
(valid-codes (0 . 255)))) |
265 |
|
|
266 |
|
(define-coding-system-alias 'tcvn 'vietnamese-tcvn) |
267 |
|
|
268 |
|
;; (make-coding-system |
269 |
|
;; 'vietnamese-vps 4 ?p |
270 |
|
;; "8-bit encoding for Vietnamese VPS" |
271 |
|
;; '(ccl-decode-vps . ccl-encode-vps) |
272 |
|
;; '((safe-charsets ascii vietnamese-viscii-lower vietnamese-viscii-upper) |
273 |
|
;; (valid-codes (0 . 255)))) |
274 |
|
;; |
275 |
|
;; (define-coding-system-alias 'vps 'vietnamese-vps) |
276 |
|
|
277 |
|
(make-coding-system |
278 |
'vietnamese-viqr 0 ?q |
'vietnamese-viqr 0 ?q |
279 |
"Encoding for Vietnamese latin transcription (VIQR)." |
"Vietnamese latin transcription (VIQR)" |
280 |
nil |
nil |
281 |
'((safe-charsets ascii vietnamese-viscii-lower vietnamese-viscii-upper) |
'((safe-charsets ascii vietnamese-viscii-lower vietnamese-viscii-upper) |
282 |
(post-read-conversion . viqr-post-read-conversion) |
(post-read-conversion . viqr-post-read-conversion) |
294 |
(setq font-ccl-encoder-alist |
(setq font-ccl-encoder-alist |
295 |
(cons '("vscii" . ccl-encode-vscii-font) font-ccl-encoder-alist)) |
(cons '("vscii" . ccl-encode-vscii-font) font-ccl-encoder-alist)) |
296 |
|
|
297 |
|
(setq font-ccl-encoder-alist |
298 |
|
(cons '("tcvn" . ccl-encode-tcvn-font) font-ccl-encoder-alist)) |
299 |
|
|
300 |
(set-language-info-alist |
(set-language-info-alist |
301 |
"Vietnamese" `((charset vietnamese-viscii-lower vietnamese-viscii-upper) |
"Vietnamese" `((charset vietnamese-viscii-lower vietnamese-viscii-upper) |
302 |
(nonascii-translation |
(nonascii-translation |
303 |
. ,(get 'viet-viscii-nonascii-translation-table |
. ,(get 'viet-viscii-nonascii-translation-table |
304 |
'translation-table)) |
'translation-table)) |
305 |
(coding-system vietnamese-viscii vietnamese-vscii |
(coding-system vietnamese-viscii vietnamese-vscii vietnamese-tcvn |
306 |
vietnamese-viqr) |
vietnamese-viqr) |
307 |
(coding-priority vietnamese-viscii) |
(coding-priority vietnamese-viscii) |
308 |
(input-method . "vietnamese-viqr") |
(input-method . "vietnamese-viqr") |
310 |
(features viet-util) |
(features viet-util) |
311 |
(sample-text . "Vietnamese (Ti,1*(Bng Vi,1.(Bt) Ch,1`(Bo b,1U(Bn") |
(sample-text . "Vietnamese (Ti,1*(Bng Vi,1.(Bt) Ch,1`(Bo b,1U(Bn") |
312 |
(documentation . "\ |
(documentation . "\ |
313 |
For Vietnamese, Emacs uses special character sets internally. |
For Vietnamese, Emacs uses special charasets internally. |
314 |
They can be decoded from and encoded to VISCII, VSCII, and VIQR. |
They can be decoded from and encoded to VISCII, VSCII, TCVN-5712, and |
315 |
Current setting put higher priority to the coding system VISCII than VSCII. |
VIQR. VSCII is deprecated in favour of TCVN-5712. Current setting |
316 |
If you prefer VSCII, please do: (prefer-coding-system 'vietnamese-vscii)") |
put higher priority to the coding system VISCII than TCVN-5712. If |
317 |
|
you prefer TCVN-5712, please do: (prefer-coding-system 'vietnamese-tcvn). |
318 |
|
There are two Vietnamese input methods: VIQR and Telex, VIQR is the |
319 |
|
default setting.") |
320 |
)) |
)) |
321 |
|
|
322 |
(provide 'vietnamese) |
(provide 'vietnamese) |