annotate lisp/mule/vietnamese.el @ 418:e804706bfb8c r21-2-17

Import from CVS: tag r21-2-17
author cvs
date Mon, 13 Aug 2007 11:23:13 +0200
parents 697ef44129c6
children 95016f13131a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
1 ;;; vietnamese.el --- Support for Vietnamese
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
2
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
4 ;; Licensed to the Free Software Foundation.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
5 ;; Copyright (C) 1997 MORIOKA Tomohiko
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
6
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
7 ;; Keywords: multilingual, Vietnamese
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
8
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
9 ;; This file is part of XEmacs.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
10
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
11 ;; XEmacs is free software; you can redistribute it and/or modify it
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
12 ;; under the terms of the GNU General Public License as published by
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
14 ;; any later version.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
15
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
16 ;; XEmacs is distributed in the hope that it will be useful, but
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
19 ;; General Public License for more details.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
20
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
22 ;; along with XEmacs; see the file COPYING. If not, write to the Free
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
23 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
24 ;; 02111-1307, USA.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
25
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
26 ;;; Commentary:
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
27
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
28 ;; For Vietnames, the character sets VISCII and VSCII are supported.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
29
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
30 ;;; Code:
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
31
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
32 (eval-and-compile
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
33
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
34 (defvar viet-viscii-decode-table
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
35 [;; VISCII is a full 8-bit code.
418
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
36 0 1 ?,2F(B 3 4 ?,2G(B ?,2g(B 7 8 9 10 11 12 13 14 15
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
37 16 17 18 19 ?,2V(B 21 22 23 24 ?,2[(B 26 27 28 29 ?,2\(B 31
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
38 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
39 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
40 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
41 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
42 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
43 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
418
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
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
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
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
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
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
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
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
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
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
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
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
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
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
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
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 ]
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
52 "Vietnamese VISCII decoding table.")
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
53
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
54 (defvar viet-viscii-encode-table
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
55 (let ((table-lower (make-vector 128 0))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
56 (table-upper (make-vector 128 0))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
57 (i 0)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
58 char-component)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
59 (while (< i 256)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
60 (setq char-component
418
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
61 (split-char (aref viet-viscii-decode-table i)))
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
62 (cond ((eq (car char-component) 'vietnamese-viscii-lower)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
63 (aset table-lower (nth 1 char-component) i))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
64 ((eq (car char-component) 'vietnamese-viscii-upper)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
65 (aset table-upper (nth 1 char-component) i)))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
66 (setq i (1+ i)))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
67 (cons table-lower table-upper))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
68 "Vietnamese VISCII encoding table.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
69 Cons of tables for encoding lower-case chars and upper-case characters.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
70 Both tables are indexed by the position code of Vietnamese characters.")
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
71
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
72 (defvar viet-vscii-decode-table
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
73 [;; VSCII is a full 8-bit code.
418
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
74 0 ?,2z(B ?,2x(B 3 ?,2W(B ?,2X(B ?,2f(B 7 8 9 10 11 12 13 14 15
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
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
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
76 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
77 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
78 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
80 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
81 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
418
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
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
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
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
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
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
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
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
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
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
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
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
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
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
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
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]
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
90 "Vietnamese VSCII decoding table.")
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
91
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
92 (defvar viet-vscii-encode-table
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
93 (let ((table-lower (make-vector 128 0))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
94 (table-upper (make-vector 128 0))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
95 (i 0)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
96 char-component)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
97 (while (< i 256)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
98 (setq char-component
418
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
99 (split-char (aref viet-vscii-decode-table i)))
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
100 (cond ((eq (car char-component) 'vietnamese-viscii-lower)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
101 (aset table-lower (nth 1 char-component) i))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
102 ((eq (car char-component) 'vietnamese-viscii-upper)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
103 (aset table-upper (nth 1 char-component) i)))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
104 (setq i (1+ i)))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
105 (cons table-lower table-upper))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
106 "Vietnamese VSCII encoding table.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
107 Cons of tables for encoding lower-case chars and upper-case characters.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
108 Both tables are indexed by the position code of Vietnamese characters.")
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
109
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
110 )
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
111
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
112 (define-ccl-program ccl-decode-viscii
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
113 `(3
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
114 ((read r0)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
115 (loop
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
116 (write-read-repeat r0 ,viet-viscii-decode-table))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
117 ))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
118 "CCL program to decode VISCII 1.1")
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
119
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
120 ;; Multibyte form of a Vietnamese character is as follows (3-byte):
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
121 ;; LEADING-CODE-PRIVATE-11 LEADING-CODE-EXTENDED-11 POSITION-CODE
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
122 ;; where LEADING-CODE-EXTENDED-11 for Vietnamese is
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
123 ;; `vietnamese-viscii-lower' or `vietnamese-viscii-upper'.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
124
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
125 (defvar leading-code-private-11 #x9E)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
126
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
127 (define-ccl-program ccl-encode-viscii
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
128 `(1
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
129 ((read r0)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
130 (loop
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
131 (if (r0 < 128)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
132 ;; ASCII
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
133 (write-read-repeat r0)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
134 ;; not ASCII
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
135 (if (r0 != ,leading-code-private-11)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
136 ;; not Vietnamese
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
137 (write-read-repeat r0)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
138 ((read-if (r0 == ,(charset-id 'vietnamese-viscii-lower))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
139 (;; Vietnamese lower
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
140 (read r0)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
141 (r0 -= 128)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
142 (write-read-repeat r0 ,(car viet-viscii-encode-table)))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
143 (if (r0 == ,(charset-id 'vietnamese-viscii-upper))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
144 (;; Vietnamese upper
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
145 (read r0)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
146 (r0 -= 128)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
147 (write-read-repeat r0 ,(cdr viet-viscii-encode-table)))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
148 ;; not Vietnamese
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
149 (write-read-repeat r0)))))))))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
150 "CCL program to encode VISCII 1.1")
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
151
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
152 (define-ccl-program ccl-encode-viscii-font
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
153 `(0
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
154 ;; In: R0:vietnamese-viscii-lower/vietnamese-viscii-upper
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
155 ;; R1:position code
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
156 ;; Out: R1:font code point
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
157 (if (r0 == ,(charset-id 'vietnamese-viscii-lower))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
158 (r1 = r1 ,(car viet-viscii-encode-table))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
159 (r1 = r1 ,(cdr viet-viscii-encode-table)))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
160 )
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
161 "CCL program to encode Vietnamese chars to VISCII 1.1 font")
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
162
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
163 (define-ccl-program ccl-decode-vscii
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
164 `(3
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
165 ((read r0)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
166 (loop
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
167 (write-read-repeat r0 ,viet-vscii-decode-table))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
168 ))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
169 "CCL program to decode VSCII-1.")
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
170
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
171 (define-ccl-program ccl-encode-vscii
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
172 `(1
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
173 ((read r0)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
174 (loop
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
175 (if (r0 < 128)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
176 ;; ASCII
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
177 (write-read-repeat r0)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
178 ;; not ASCII
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
179 (if (r0 != ,leading-code-private-11)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
180 ;; not Vietnamese
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
181 (write-read-repeat r0)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
182 (read-if (r0 == ,(charset-id 'vietnamese-viscii-lower))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
183 (;; Vietnamese lower
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
184 (read r0)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
185 (r0 -= 128)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
186 (write-read-repeat r0 ,(car viet-vscii-encode-table)))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
187 (if (r0 == ,(charset-id 'vietnamese-viscii-upper))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
188 (;; Vietnamese upper
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
189 (read r0)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
190 (r0 -= 128)
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
191 (write-read-repeat r0 ,(cdr viet-viscii-encode-table)))
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
192 ;; not Vietnamese
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
193 (write-read-repeat r0))))))))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
194 "CCL program to encode VSCII-1.")
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
195
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
196 (define-ccl-program ccl-encode-vscii-font
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
197 `(0
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
198 ;; In: R0:vietnamese-viscii-lower/vietnamese-viscii-upper
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
199 ;; R1:position code
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
200 ;; Out: R1:font code point
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
201 (if (r0 == ,(charset-id 'vietnamese-viscii-lower))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
202 (r1 = r1 ,(car viet-vscii-encode-table))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
203 (r1 = r1 ,(cdr viet-vscii-encode-table)))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
204 )
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
205 "CCL program to encode Vietnamese chars to VSCII-1 font.")
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
206
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
207
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
208 (make-coding-system
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
209 'viscii 'ccl
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
210 "Coding-system used for VISCII 1.1."
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
211 `(mnemonic "VISCII"
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
212 decode ,ccl-decode-viscii
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
213 encode ,ccl-encode-viscii))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
214
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
215 ;; (make-coding-system
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
216 ;; 'vietnamese-viscii 4 ?V
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
217 ;; "8-bit encoding for Vietnamese VISCII 1.1 (MIME:VISCII)"
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
218 ;; (cons ccl-decode-viscii ccl-encode-viscii))
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
219
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
220 ;; (define-coding-system-alias 'viscii 'vietnamese-viscii)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
221
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
222 (make-coding-system
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
223 'vscii 'ccl
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
224 "Coding-system used for VSCII 1.1."
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
225 `(mnemonic "VSCII"
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
226 decode ,ccl-decode-vscii
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
227 encode ,ccl-encode-vscii))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
228
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
229 ;; (make-coding-system
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
230 ;; 'vietnamese-vscii 4 ?v
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
231 ;; "8-bit encoding for Vietnamese VSCII-1"
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
232 ;; (cons ccl-decode-vscii ccl-encode-vscii))
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
233
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
234 ;; (define-coding-system-alias 'vscii 'vietnamese-vscii)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
235
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
236 (make-coding-system
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
237 'viqr 'no-conversion
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
238 "Coding-system used for VIQR."
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
239 '(mnemonic "VIQR"
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
240 eol-type lf
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
241 post-read-conversion viqr-post-read-conversion
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
242 pre-write-conversion viqr-pre-write-conversion))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
243
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
244 ;; (make-coding-system
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
245 ;; 'vietnamese-viqr 0 ?q
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
246 ;; "Vietnamese latin transcription (VIQR)"
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
247 ;; nil)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
248 ;; (put 'vietnamese-viqr 'post-read-conversion 'viqr-post-read-conversion)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
249 ;; (put 'vietnamese-viqr 'pre-write-conversion 'viqr-pre-write-conversion)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
250
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
251 ;; (define-coding-system-alias 'viqr 'vietnamese-viqr)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
252
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
253 ;; For VISCII users
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
254 (set-charset-ccl-program 'vietnamese-viscii-lower
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
255 ccl-encode-viscii-font)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
256 (set-charset-ccl-program 'vietnamese-viscii-upper
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
257 ccl-encode-viscii-font)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
258 ;; For VSCII users
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
259 (set-charset-ccl-program 'vietnamese-viscii-lower ccl-encode-vscii-font)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
260 (set-charset-ccl-program 'vietnamese-viscii-upper ccl-encode-vscii-font)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
261
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
262 ;; (setq font-ccl-encoder-alist
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
263 ;; (cons (cons "viscii" ccl-encode-viscii-font) font-ccl-encoder-alist))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
264
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
265 ;; (setq font-ccl-encoder-alist
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
266 ;; (cons (cons "vscii" ccl-encode-vscii-font) font-ccl-encoder-alist))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
267
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
268 (set-language-info-alist
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
269 "Vietnamese" '((setup-function . setup-vietnamese-environment)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
270 (charset . (vietnamese-viscii-lower
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
271 vietnamese-viscii-upper))
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
272 (coding-system . (viscii vscii viqr))
418
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
273 (sample-text . "Vietnamese (Ti,1*(Bng Vi,1.(Bt) Ch,1`(Bo b,1U(Bn")
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
274 (documentation . "\
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
275 For Vietnamese, Emacs uses special charasets internally.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 398
diff changeset
276 They can be decoded from and encoded to VISCC, VSCII, and VIQR.")
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
277 ))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
278
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
279 ;;; vietnamese.el ends here