diff options
| author | Pavel Janík | 2002-04-29 09:02:12 +0000 |
|---|---|---|
| committer | Pavel Janík | 2002-04-29 09:02:12 +0000 |
| commit | bd465aec994f8d0aeb74489b2231af17911ee0ae (patch) | |
| tree | 50e5f700ac63b8616f012f8c1dea1bd4a3978bae | |
| parent | 942110715561afb982e3c98b94b9c44ddbeac7e6 (diff) | |
| download | emacs-bd465aec994f8d0aeb74489b2231af17911ee0ae.tar.gz emacs-bd465aec994f8d0aeb74489b2231af17911ee0ae.zip | |
(viet-tcvn-decode-table, ccl-decode-tcvn)
(ccl-encode-tcvn, ccl-encode-tcvn-font, vietnamese-tcvn): New Vietnamese
coding system.
| -rw-r--r-- | lisp/language/vietnamese.el | 148 |
1 files changed, 139 insertions, 9 deletions
diff --git a/lisp/language/vietnamese.el b/lisp/language/vietnamese.el index c79c84e9631..aa1c71a8191 100644 --- a/lisp/language/vietnamese.el +++ b/lisp/language/vietnamese.el | |||
| @@ -24,7 +24,8 @@ | |||
| 24 | 24 | ||
| 25 | ;;; Commentary: | 25 | ;;; Commentary: |
| 26 | 26 | ||
| 27 | ;; For Vietnames, the character sets VISCII and VSCII are supported. | 27 | ;; For Vietnames, the character sets VISCII, VSCII and TCVN-5712 are |
| 28 | ;; supported. | ||
| 28 | 29 | ||
| 29 | ;;; Code: | 30 | ;;; Code: |
| 30 | 31 | ||
| @@ -53,6 +54,9 @@ | |||
| 53 | (define-translation-table 'viet-viscii-encode-table | 54 | (define-translation-table 'viet-viscii-encode-table |
| 54 | (char-table-extra-slot table 0))) | 55 | (char-table-extra-slot table 0))) |
| 55 | 56 | ||
| 57 | ;;; | ||
| 58 | ;;; VSCII is a pre-version of TCVN-5712 and deprecated | ||
| 59 | ;;; | ||
| 56 | (defvar viet-vscii-decode-table | 60 | (defvar viet-vscii-decode-table |
| 57 | [;; VSCII is a full 8-bit code. | 61 | [;; VSCII is a full 8-bit code. |
| 58 | 0 ?,2z(B ?,2x(B 3 ?,2W(B ?,2X(B ?,2f(B 7 8 9 10 11 12 13 14 15 | 62 | 0 ?,2z(B ?,2x(B 3 ?,2W(B ?,2X(B ?,2f(B 7 8 9 10 11 12 13 14 15 |
| @@ -78,6 +82,57 @@ | |||
| 78 | (define-translation-table 'viet-vscii-encode-table | 82 | (define-translation-table 'viet-vscii-encode-table |
| 79 | (char-table-extra-slot table 0))) | 83 | (char-table-extra-slot table 0))) |
| 80 | 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 | |||
| 81 | (define-ccl-program ccl-decode-viscii | 136 | (define-ccl-program ccl-decode-viscii |
| 82 | `(3 | 137 | `(3 |
| 83 | ((loop | 138 | ((loop |
| @@ -130,10 +185,61 @@ | |||
| 130 | (translate-character viet-vscii-encode-table r0 r1)) | 185 | (translate-character viet-vscii-encode-table r0 r1)) |
| 131 | "CCL program to encode Vietnamese chars to VSCII-1 font.") | 186 | "CCL program to encode Vietnamese chars to VSCII-1 font.") |
| 132 | 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.") | ||
| 133 | 239 | ||
| 134 | (make-coding-system | 240 | (make-coding-system |
| 135 | 'vietnamese-viscii 4 ?V | 241 | 'vietnamese-viscii 4 ?V |
| 136 | "8-bit encoding for Vietnamese VISCII 1.1 (MIME:VISCII)." | 242 | "8-bit encoding for Vietnamese VISCII 1.1 (MIME:VISCII)" |
| 137 | '(ccl-decode-viscii . ccl-encode-viscii) | 243 | '(ccl-decode-viscii . ccl-encode-viscii) |
| 138 | '((safe-charsets ascii vietnamese-viscii-lower vietnamese-viscii-upper) | 244 | '((safe-charsets ascii vietnamese-viscii-lower vietnamese-viscii-upper) |
| 139 | (mime-charset . viscii) | 245 | (mime-charset . viscii) |
| @@ -143,7 +249,7 @@ | |||
| 143 | 249 | ||
| 144 | (make-coding-system | 250 | (make-coding-system |
| 145 | 'vietnamese-vscii 4 ?v | 251 | 'vietnamese-vscii 4 ?v |
| 146 | "8-bit encoding for Vietnamese VSCII-1." | 252 | "8-bit encoding for Vietnamese VSCII-1" |
| 147 | '(ccl-decode-vscii . ccl-encode-vscii) | 253 | '(ccl-decode-vscii . ccl-encode-vscii) |
| 148 | '((safe-charsets ascii vietnamese-viscii-lower vietnamese-viscii-upper) | 254 | '((safe-charsets ascii vietnamese-viscii-lower vietnamese-viscii-upper) |
| 149 | (valid-codes (0 . 255)))) | 255 | (valid-codes (0 . 255)))) |
| @@ -151,8 +257,26 @@ | |||
| 151 | (define-coding-system-alias 'vscii 'vietnamese-vscii) | 257 | (define-coding-system-alias 'vscii 'vietnamese-vscii) |
| 152 | 258 | ||
| 153 | (make-coding-system | 259 | (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 | ||
| 154 | 'vietnamese-viqr 0 ?q | 278 | 'vietnamese-viqr 0 ?q |
| 155 | "Encoding for Vietnamese latin transcription (VIQR)." | 279 | "Vietnamese latin transcription (VIQR)" |
| 156 | nil | 280 | nil |
| 157 | '((safe-charsets ascii vietnamese-viscii-lower vietnamese-viscii-upper) | 281 | '((safe-charsets ascii vietnamese-viscii-lower vietnamese-viscii-upper) |
| 158 | (post-read-conversion . viqr-post-read-conversion) | 282 | (post-read-conversion . viqr-post-read-conversion) |
| @@ -170,12 +294,15 @@ | |||
| 170 | (setq font-ccl-encoder-alist | 294 | (setq font-ccl-encoder-alist |
| 171 | (cons '("vscii" . ccl-encode-vscii-font) font-ccl-encoder-alist)) | 295 | (cons '("vscii" . ccl-encode-vscii-font) font-ccl-encoder-alist)) |
| 172 | 296 | ||
| 297 | (setq font-ccl-encoder-alist | ||
| 298 | (cons '("tcvn" . ccl-encode-tcvn-font) font-ccl-encoder-alist)) | ||
| 299 | |||
| 173 | (set-language-info-alist | 300 | (set-language-info-alist |
| 174 | "Vietnamese" `((charset vietnamese-viscii-lower vietnamese-viscii-upper) | 301 | "Vietnamese" `((charset vietnamese-viscii-lower vietnamese-viscii-upper) |
| 175 | (nonascii-translation | 302 | (nonascii-translation |
| 176 | . ,(get 'viet-viscii-nonascii-translation-table | 303 | . ,(get 'viet-viscii-nonascii-translation-table |
| 177 | 'translation-table)) | 304 | 'translation-table)) |
| 178 | (coding-system vietnamese-viscii vietnamese-vscii | 305 | (coding-system vietnamese-viscii vietnamese-vscii vietnamese-tcvn |
| 179 | vietnamese-viqr) | 306 | vietnamese-viqr) |
| 180 | (coding-priority vietnamese-viscii) | 307 | (coding-priority vietnamese-viscii) |
| 181 | (input-method . "vietnamese-viqr") | 308 | (input-method . "vietnamese-viqr") |
| @@ -183,10 +310,13 @@ | |||
| 183 | (features viet-util) | 310 | (features viet-util) |
| 184 | (sample-text . "Vietnamese (Ti,1*(Bng Vi,1.(Bt) Ch,1`(Bo b,1U(Bn") | 311 | (sample-text . "Vietnamese (Ti,1*(Bng Vi,1.(Bt) Ch,1`(Bo b,1U(Bn") |
| 185 | (documentation . "\ | 312 | (documentation . "\ |
| 186 | For Vietnamese, Emacs uses special character sets internally. | 313 | For Vietnamese, Emacs uses special charasets internally. |
| 187 | They can be decoded from and encoded to VISCII, VSCII, and VIQR. | 314 | They can be decoded from and encoded to VISCII, VSCII, TCVN-5712, and |
| 188 | Current setting put higher priority to the coding system VISCII than VSCII. | 315 | VIQR. VSCII is deprecated in favour of TCVN-5712. Current setting |
| 189 | If you prefer VSCII, please do: (prefer-coding-system 'vietnamese-vscii)") | 316 | 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.") | ||
| 190 | )) | 320 | )) |
| 191 | 321 | ||
| 192 | (provide 'vietnamese) | 322 | (provide 'vietnamese) |