Nitpicking change of format from ISBN-1882114-43-4 to ISBN 1-882114-43-4
[emacs.git] / lisp / language / vietnamese.el
blobc79c84e963182ee4818a494c897da0a614177190
1 ;;; vietnamese.el --- support for Vietnamese -*- coding: iso-2022-7bit; -*-
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
4 ;; Licensed to the Free Software Foundation.
6 ;; Keywords: multilingual, Vietnamese
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
25 ;;; Commentary:
27 ;; For Vietnames, the character sets VISCII and VSCII are supported.
29 ;;; Code:
31 (defvar viet-viscii-decode-table
32 [;; VISCII is a full 8-bit code.
33 0 1 ?\e,2F\e(B 3 4 ?\e,2G\e(B ?\e,2g\e(B 7 8 9 10 11 12 13 14 15
34 16 17 18 19 ?\e,2V\e(B 21 22 23 24 ?\e,2[\e(B 26 27 28 29 ?\e,2\\e(B 31
35 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
36 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
37 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
38 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
39 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
40 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
41 ?\e,2U\e(B ?\e,2!\e(B ?\e,2"\e(B ?\e,2#\e(B ?\e,2$\e(B ?\e,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?\e,1b\e(B ?\e,1c\e(B ?\e,1d\e(B ?\e,1e\e(B ?\e,1f\e(B ?\e,1g\e(B ?\e,1h\e(B ?\e,1i\e(B ?\e,1j\e(B ?\e,1k\e(B ?\e,1l\e(B ?\e,1m\e(B ?\e,1n\e(B ?\e,1o\e(B
48 ?\e,1p\e(B ?\e,1q\e(B ?\e,1r\e(B ?\e,1s\e(B ?\e,1t\e(B ?\e,1u\e(B ?\e,1v\e(B ?\e,1w\e(B ?\e,1x\e(B ?\e,1y\e(B ?\e,1z\e(B ?\e,1{\e(B ?\e,1|\e(B ?\e,1}\e(B ?\e,1~\e(B ?\e,2f\e(B ]
49 "Vietnamese VISCII decoding table.")
51 (let ((table (make-translation-table-from-vector viet-viscii-decode-table)))
52 (define-translation-table 'viet-viscii-nonascii-translation-table table)
53 (define-translation-table 'viet-viscii-encode-table
54 (char-table-extra-slot table 0)))
56 (defvar viet-vscii-decode-table
57 [;; VSCII is a full 8-bit code.
58 0 ?\e,2z\e(B ?\e,2x\e(B 3 ?\e,2W\e(B ?\e,2X\e(B ?\e,2f\e(B 7 8 9 10 11 12 13 14 15
59 16 ?\e,2Q\e(B ?\e,2_\e(B ?\e,2O\e(B ?\e,2V\e(B ?\e,2[\e(B ?\e,2}\e(B ?\e,2\\e(B 24 25 26 27 28 29 30 31
60 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
61 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
62 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
63 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
64 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
65 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
66 ?\e,2`\e(B ?\e,2d\e(B ?\e,2c\e(B ?\e,2a\e(B ?\e,2U\e(B ?\e,2#\e(B ?\e,2'\e(B ?\e,2h\e(B ?\e,2k\e(B ?\e,2(\e(B ?\e,2i\e(B ?\e,2)\e(B ?\e,2.\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e,1~\e(B ?\e,1y\e(B
73 ?\e,22\e(B ?\e,1|\e(B ?\e,1{\e(B ?\e,1z\e(B ?\e,1x\e(B ?\e,1W\e(B ?\e,1X\e(B ?\e,1f\e(B ?\e,1Q\e(B ?\e,1q\e(B ?\e,1O\e(B ?\e,1V\e(B ?\e,1[\e(B ?\e,1}\e(B ?\e,1\\e(B ?\e,2/\e(B]
74 "Vietnamese VSCII decoding table.")
76 (let ((table (make-translation-table-from-vector viet-vscii-decode-table)))
77 (define-translation-table 'viet-vscii-nonascii-translation-table table)
78 (define-translation-table 'viet-vscii-encode-table
79 (char-table-extra-slot table 0)))
81 (define-ccl-program ccl-decode-viscii
82 `(3
83 ((loop
84 (r0 = 0)
85 (read r1)
86 (translate-character viet-viscii-nonascii-translation-table r0 r1)
87 (write-multibyte-character r0 r1)
88 (repeat))))
89 "CCL program to decode VISCII 1.1")
91 (define-ccl-program ccl-encode-viscii
92 `(1
93 ((loop
94 (read-multibyte-character r0 r1)
95 (translate-character viet-viscii-encode-table r0 r1)
96 (write-repeat r1))))
97 "CCL program to encode VISCII 1.1")
99 (define-ccl-program ccl-encode-viscii-font
101 ;; In: R0:vietnamese-viscii-lower/vietnamese-viscii-upper
102 ;; R1:position code
103 ;; Out: R1:font code point
104 (translate-character viet-viscii-encode-table r0 r1))
105 "CCL program to encode Vietnamese chars to VISCII 1.1 font")
107 (define-ccl-program ccl-decode-vscii
109 ((loop
110 (r0 = 0)
111 (read r1)
112 (translate-character viet-vscii-nonascii-translation-table r0 r1)
113 (write-multibyte-character r0 r1)
114 (repeat))))
115 "CCL program to decode VSCII-1.")
117 (define-ccl-program ccl-encode-vscii
119 ((loop
120 (read-multibyte-character r0 r1)
121 (translate-character viet-vscii-encode-table r0 r1)
122 (write-repeat r1))))
123 "CCL program to encode VSCII-1.")
125 (define-ccl-program ccl-encode-vscii-font
127 ;; In: R0:vietnamese-viscii-lower/vietnamese-viscii-upper
128 ;; R1:position code
129 ;; Out: R1:font code point
130 (translate-character viet-vscii-encode-table r0 r1))
131 "CCL program to encode Vietnamese chars to VSCII-1 font.")
134 (make-coding-system
135 'vietnamese-viscii 4 ?V
136 "8-bit encoding for Vietnamese VISCII 1.1 (MIME:VISCII)."
137 '(ccl-decode-viscii . ccl-encode-viscii)
138 '((safe-charsets ascii vietnamese-viscii-lower vietnamese-viscii-upper)
139 (mime-charset . viscii)
140 (valid-codes (0 . 255))))
142 (define-coding-system-alias 'viscii 'vietnamese-viscii)
144 (make-coding-system
145 'vietnamese-vscii 4 ?v
146 "8-bit encoding for Vietnamese VSCII-1."
147 '(ccl-decode-vscii . ccl-encode-vscii)
148 '((safe-charsets ascii vietnamese-viscii-lower vietnamese-viscii-upper)
149 (valid-codes (0 . 255))))
151 (define-coding-system-alias 'vscii 'vietnamese-vscii)
153 (make-coding-system
154 'vietnamese-viqr 0 ?q
155 "Encoding for Vietnamese latin transcription (VIQR)."
157 '((safe-charsets ascii vietnamese-viscii-lower vietnamese-viscii-upper)
158 (post-read-conversion . viqr-post-read-conversion)
159 (pre-write-conversion . viqr-pre-write-conversion)
160 (charset-origin-alist
161 (vietnamese-viscii-lower "VISCII" viet-encode-viscii-char)
162 (vietnamese-viscii-upper "VISCII" viet-encode-viscii-char))))
165 (define-coding-system-alias 'viqr 'vietnamese-viqr)
167 (setq font-ccl-encoder-alist
168 (cons '("viscii" . ccl-encode-viscii-font) font-ccl-encoder-alist))
170 (setq font-ccl-encoder-alist
171 (cons '("vscii" . ccl-encode-vscii-font) font-ccl-encoder-alist))
173 (set-language-info-alist
174 "Vietnamese" `((charset vietnamese-viscii-lower vietnamese-viscii-upper)
175 (nonascii-translation
176 . ,(get 'viet-viscii-nonascii-translation-table
177 'translation-table))
178 (coding-system vietnamese-viscii vietnamese-vscii
179 vietnamese-viqr)
180 (coding-priority vietnamese-viscii)
181 (input-method . "vietnamese-viqr")
182 (unibyte-display . vietnamese-viscii)
183 (features viet-util)
184 (sample-text . "Vietnamese (Ti\e,1*\e(Bng Vi\e,1.\e(Bt) Ch\e,1`\e(Bo b\e,1U\e(Bn")
185 (documentation . "\
186 For Vietnamese, Emacs uses special character sets internally.
187 They can be decoded from and encoded to VISCII, VSCII, and VIQR.
188 Current setting put higher priority to the coding system VISCII than VSCII.
189 If you prefer VSCII, please do: (prefer-coding-system 'vietnamese-vscii)")
192 (provide 'vietnamese)
194 ;;; vietnamese.el ends here