Mercurial > hg > xemacs-beta
comparison lisp/mule/chinese.el @ 412:697ef44129c6 r21-2-14
Import from CVS: tag r21-2-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:20:41 +0200 |
parents | 74fd4e045ea6 |
children | 95016f13131a |
comparison
equal
deleted
inserted
replaced
411:12e008d41344 | 412:697ef44129c6 |
---|---|
1 ;;; chinese.el --- Support for Chinese -*- coding: iso-2022-7bit; -*- | 1 ;;; chinese.el --- Support for Chinese |
2 | 2 |
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN. | 3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN. |
4 ;; Licensed to the Free Software Foundation. | 4 ;; Licensed to the Free Software Foundation. |
5 ;; Copyright (C) 1997 MORIOKA Tomohiko | 5 ;; Copyright (C) 1997 MORIOKA Tomohiko |
6 | 6 |
102 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 102 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
103 ;;; Chinese (general) | 103 ;;; Chinese (general) |
104 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 104 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
105 | 105 |
106 ;; (make-coding-system | 106 ;; (make-coding-system |
107 ;; 'iso-2022-cn 2 ?C | 107 ;; 'chinese-iso-7bit 2 ?C |
108 ;; "ISO 2022 based 7bit encoding for Chinese GB and CNS (MIME:ISO-2022-CN)" | 108 ;; "ISO 2022 based 7bit encoding for Chinese GB and CNS (MIME:ISO-2022-CN)" |
109 ;; '(ascii | |
110 ;; (nil chinese-gb2312 chinese-cns11643-1) | |
111 ;; (nil chinese-cns11643-2) | |
112 ;; nil | |
113 ;; nil ascii-eol ascii-cntl seven locking-shift single-shift nil nil nil | |
114 ;; init-bol) | |
115 ;; '((safe-charsets ascii chinese-gb2312 chinese-cns11643-1 chinese-cns11643-2) | |
116 ;; (mime-charset . iso-2022-cn))) | |
117 | |
118 ;; (define-coding-system-alias 'chinese-iso-7bit 'iso-2022-cn) | |
119 | |
120 ;; (make-coding-system | |
121 ;; 'iso-2022-cn-ext 2 ?C | |
122 ;; "ISO 2022 based 7bit encoding for Chinese GB and CNS (MIME:ISO-2022-CN-EXT)" | |
123 ;; '(ascii | 109 ;; '(ascii |
124 ;; (nil chinese-gb2312 chinese-cns11643-1) | 110 ;; (nil chinese-gb2312 chinese-cns11643-1) |
125 ;; (nil chinese-cns11643-2) | 111 ;; (nil chinese-cns11643-2) |
126 ;; (nil chinese-cns11643-3 chinese-cns11643-4 chinese-cns11643-5 | 112 ;; (nil chinese-cns11643-3 chinese-cns11643-4 chinese-cns11643-5 |
127 ;; chinese-cns11643-6 chinese-cns11643-7) | 113 ;; chinese-cns11643-6 chinese-cns11643-7) |
128 ;; nil ascii-eol ascii-cntl seven locking-shift single-shift nil nil nil | 114 ;; nil ascii-eol ascii-cntl seven locking-shift single-shift nil nil nil |
129 ;; init-bol) | 115 ;; init-bol)) |
130 ;; '((safe-charsets ascii chinese-gb2312 chinese-cns11643-1 chinese-cns11643-2 | 116 |
131 ;; chinese-cns11643-3 chinese-cns11643-4 chinese-cns11643-5 | 117 ;; (define-coding-system-alias 'iso-2022-cn 'chinese-iso-7bit) |
132 ;; chinese-cns11643-6 chinese-cns11643-7) | 118 ;; (define-coding-system-alias 'iso-2022-cn-ext 'chinese-iso-7bit) |
133 ;; (mime-charset . iso-2022-cn-ext))) | 119 |
134 | 120 ;; (define-prefix-command 'describe-chinese-environment-map) |
121 ;; (define-key-after describe-language-environment-map [Chinese] | |
122 ;; '("Chinese" . describe-chinese-environment-map) | |
123 ;; t) | |
124 | |
125 ;; (define-prefix-command 'setup-chinese-environment-map) | |
126 ;; (define-key-after setup-language-environment-map [Chinese] | |
127 ;; '("Chinese" . setup-chinese-environment-map) | |
128 ;; t) | |
135 | 129 |
136 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 130 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
137 ;;; Chinese GB2312 (simplified) | 131 ;;; Chinese GB2312 (simplified) |
138 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 132 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
139 | 133 |
140 ;; (make-coding-system | 134 ;; (make-coding-system |
141 ;; 'chinese-iso-8bit 2 ?c | 135 ;; 'chinese-iso-8bit 2 ?c |
142 ;; "ISO 2022 based EUC encoding for Chinese GB2312 (MIME:CN-GB-2312)" | 136 ;; "ISO 2022 based EUC encoding for Chinese GB2312 (MIME:CN-GB-2312)" |
143 ;; '(ascii chinese-gb2312 nil nil | 137 ;; '((ascii t) chinese-gb2312 chinese-sisheng nil |
144 ;; nil ascii-eol ascii-cntl nil nil nil nil) | 138 ;; nil ascii-eol ascii-cntl nil nil single-shift nil)) |
145 ;; '((safe-charsets ascii chinese-gb2312) | |
146 ;; (mime-charset . cn-gb-2312))) | |
147 | 139 |
148 (make-coding-system | 140 (make-coding-system |
149 'cn-gb-2312 'iso2022 | 141 'cn-gb-2312 'iso2022 |
150 "Coding-system of Chinese EUC (Extended Unix Code)." | 142 "Coding-system of Chinese EUC (Extended Unix Code)." |
151 '(charset-g0 ascii | 143 '(charset-g0 ascii |
155 mnemonic "Zh-GB/EUC" | 147 mnemonic "Zh-GB/EUC" |
156 )) | 148 )) |
157 | 149 |
158 ;; (define-coding-system-alias 'cn-gb-2312 'chinese-iso-8bit) | 150 ;; (define-coding-system-alias 'cn-gb-2312 'chinese-iso-8bit) |
159 ;; (define-coding-system-alias 'euc-china 'chinese-iso-8bit) | 151 ;; (define-coding-system-alias 'euc-china 'chinese-iso-8bit) |
160 ;; (define-coding-system-alias 'euc-cn 'chinese-iso-8bit) | 152 |
161 | 153 (copy-coding-system 'cn-gb-2312 'gb2312) |
162 (define-coding-system-alias 'gb2312 'cn-gb-2312) | 154 (copy-coding-system 'cn-gb-2312 'chinese-euc) |
163 (define-coding-system-alias 'chinese-euc 'cn-gb-2312) | |
164 | 155 |
165 ;; (make-coding-system | 156 ;; (make-coding-system |
166 ;; 'chinese-hz 0 ?z | 157 ;; 'chinese-hz 0 ?z |
167 ;; "Hz/ZW 7-bit encoding for Chinese GB2312 (MIME:HZ-GB-2312)" | 158 ;; "Hz/ZW 7-bit encoding for Chinese GB2312 (MIME:HZ-GB-2312)" |
168 ;; nil | 159 ;; nil) |
169 ;; '((safe-charsets ascii chinese-gb2312) | |
170 ;; (mime-charset . hz-gb-2312) | |
171 ;; (post-read-conversion . post-read-decode-hz) | |
172 ;; (pre-write-conversion . pre-write-encode-hz))) | |
173 ;; (put 'chinese-hz 'post-read-conversion 'post-read-decode-hz) | 160 ;; (put 'chinese-hz 'post-read-conversion 'post-read-decode-hz) |
174 ;; (put 'chinese-hz 'pre-write-conversion 'pre-write-encode-hz) | 161 ;; (put 'chinese-hz 'pre-write-conversion 'pre-write-encode-hz) |
175 | 162 |
176 (make-coding-system | 163 (make-coding-system |
177 'hz-gb-2312 'no-conversion | 164 'hz-gb-2312 'no-conversion |
182 pre-write-conversion pre-write-encode-hz)) | 169 pre-write-conversion pre-write-encode-hz)) |
183 | 170 |
184 ;; (define-coding-system-alias 'hz-gb-2312 'chinese-hz) | 171 ;; (define-coding-system-alias 'hz-gb-2312 'chinese-hz) |
185 ;; (define-coding-system-alias 'hz 'chinese-hz) | 172 ;; (define-coding-system-alias 'hz 'chinese-hz) |
186 | 173 |
187 (define-coding-system-alias 'hz 'hz-gb-2312) | 174 (copy-coding-system 'hz-gb-2312 'hz) |
175 (copy-coding-system 'hz-gb-2312 'chinese-hz) | |
188 | 176 |
189 (defun post-read-decode-hz (len) | 177 (defun post-read-decode-hz (len) |
190 (let ((pos (point)) | 178 (let ((pos (point))) |
191 (buffer-modified-p (buffer-modified-p)) | 179 (decode-hz-region pos (+ pos len)))) |
192 last-coding-system-used) | |
193 (prog1 | |
194 (decode-hz-region pos (+ pos len)) | |
195 (set-buffer-modified-p buffer-modified-p)))) | |
196 | 180 |
197 (defun pre-write-encode-hz (from to) | 181 (defun pre-write-encode-hz (from to) |
198 (let ((buf (current-buffer))) | 182 (let ((buf (current-buffer)) |
199 (set-buffer (generate-new-buffer " *temp*")) | 183 (work (get-buffer-create " *pre-write-encoding-work*"))) |
184 (set-buffer work) | |
185 (erase-buffer) | |
200 (if (stringp from) | 186 (if (stringp from) |
201 (insert from) | 187 (insert from) |
202 (insert-buffer-substring buf from to)) | 188 (insert-buffer-substring buf from to)) |
203 (let (last-coding-system-used) | 189 (encode-hz-region 1 (point-max)) |
204 (encode-hz-region 1 (point-max))) | |
205 nil)) | 190 nil)) |
206 | 191 |
207 (set-language-info-alist | 192 (set-language-info-alist |
208 "Chinese-GB" '((setup-function . setup-chinese-gb-environment-internal) | 193 "Chinese-GB" '((setup-function . (setup-chinese-gb-environment |
209 (charset chinese-gb2312 sisheng) | 194 . setup-chinese-environment-map)) |
210 (coding-system cn-gb-2312 iso-2022-7bit hz-gb-2312) | 195 (charset . (chinese-gb2312 sisheng)) |
211 (coding-priority cn-gb-2312 big5 iso-2022-7bit) | 196 (coding-system |
212 (input-method . "chinese-py-punct") | 197 . (cn-gb-2312 iso-2022-7bit hz-gb-2312)) |
213 (features china-util) | |
214 (sample-text . "Chinese ($AVPND(B,$AFUM(;0(B,$A::So(B) $ADc:C(B") | 198 (sample-text . "Chinese ($AVPND(B,$AFUM(;0(B,$A::So(B) $ADc:C(B") |
215 (documentation . "Support for Chinese GB2312 character set.")) | 199 (documentation . ("Support for Chinese GB2312 character set." |
216 '("Chinese")) | 200 . describe-chinese-environment-map)) |
201 )) | |
217 | 202 |
218 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 203 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
219 ;; Chinese BIG5 (traditional) | 204 ;; Chinese BIG5 (traditional) |
220 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 205 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
221 | 206 |
222 ;; (make-coding-system | 207 ;; (make-coding-system |
223 ;; 'chinese-big5 3 ?B "BIG5 8-bit encoding for Chinese (MIME:CN-BIG5)" | 208 ;; 'chinese-big5 3 ?B "BIG5 8-bit encoding for Chinese (MIME:CN-BIG5)") |
224 ;; nil | |
225 ;; '((safe-charsets ascii chinese-big5-1 chinese-big5-2) | |
226 ;; (mime-charset . cn-big5) | |
227 ;; (charset-origin-alist (chinese-big5-1 "BIG5" encode-big5-char) | |
228 ;; (chinese-big5-2 "BIG5" encode-big5-char)))) | |
229 | 209 |
230 (make-coding-system | 210 (make-coding-system |
231 'big5 'big5 | 211 'big5 'big5 |
232 "Coding-system of BIG5." | 212 "Coding-system of BIG5." |
233 '(mnemonic "Zh/Big5")) | 213 '(mnemonic "Zh/Big5")) |
234 | 214 |
235 ;; (define-coding-system-alias 'big5 'chinese-big5) | 215 ;; (define-coding-system-alias 'big5 'chinese-big5) |
236 ;; (define-coding-system-alias 'cn-big5 'chinese-big5) | 216 ;; (define-coding-system-alias 'cn-big5 'chinese-big5) |
237 | 217 |
238 (define-coding-system-alias 'cn-big5 'big5) | 218 (copy-coding-system 'big5 'cn-big5) |
219 (copy-coding-system 'big5 'chinese-big5) | |
239 | 220 |
240 ;; Big5 font requires special encoding. | 221 ;; Big5 font requires special encoding. |
241 (define-ccl-program ccl-encode-big5-font | 222 (define-ccl-program ccl-encode-big5-font |
242 `(0 | 223 `(0 |
243 ;; In: R0:chinese-big5-1 or chinese-big5-2 | 224 ;; In: R0:chinese-big5-1 or chinese-big5-2 |
257 | 238 |
258 (set-charset-ccl-program 'chinese-big5-1 ccl-encode-big5-font) | 239 (set-charset-ccl-program 'chinese-big5-1 ccl-encode-big5-font) |
259 (set-charset-ccl-program 'chinese-big5-2 ccl-encode-big5-font) | 240 (set-charset-ccl-program 'chinese-big5-2 ccl-encode-big5-font) |
260 | 241 |
261 (set-language-info-alist | 242 (set-language-info-alist |
262 "Chinese-BIG5" '((charset chinese-big5-1 chinese-big5-2) | 243 "Chinese-BIG5" '((setup-function . (setup-chinese-big5-environment |
263 (coding-system big5 iso-2022-7bit) | 244 . setup-chinese-environment-map)) |
264 (coding-priority big5 cn-gb-2312 iso-2022-7bit) | 245 (charset . (chinese-big5-1 chinese-big5-2)) |
265 (input-method . "chinese-py-punct-b5") | 246 (coding-system . (big5 iso-2022-7bit)) |
266 (features china-util) | |
267 (sample-text . "Cantonese ($(0GnM$(B,$(0N]0*Hd(B) $(0*/=((B, $(0+$)p(B") | 247 (sample-text . "Cantonese ($(0GnM$(B,$(0N]0*Hd(B) $(0*/=((B, $(0+$)p(B") |
268 (documentation . "Support for Chinese Big5 character set.")) | 248 (documentation . ("Support for Chinese Big5 character set." |
269 '("Chinese")) | 249 . describe-chinese-environment-map)) |
250 )) | |
270 | 251 |
271 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 252 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
272 ;; Chinese CNS11643 (traditional) | 253 ;; Chinese CNS11643 (traditional) |
273 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 254 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
274 | 255 |
275 ;; (set-language-info-alist | 256 ;; (set-language-info-alist |
276 ;; "Chinese-CNS" '((charset chinese-cns11643-1 chinese-cns11643-2 | 257 ;; "Chinese-CNS" '((setup-function . (setup-chinese-cns-environment |
277 ;; chinese-cns11643-3 chinese-cns11643-4 | 258 ;; . setup-chinese-environment-map)) |
278 ;; chinese-cns11643-5 chinese-cns11643-6 | 259 ;; (charset . (chinese-cns11643-1 chinese-cns11643-2 |
279 ;; chinese-cns11643-7) | 260 ;; chinese-cns11643-3 chinese-cns11643-4 |
280 ;; (coding-system iso-2022-cn) | 261 ;; chinese-cns11643-5 chinese-cns11643-6 |
281 ;; (coding-priority iso-2022-cn chinese-big5 chinese-iso-8bit) | 262 ;; chinese-cns11643-7)) |
282 ;; (features china-util) | 263 ;; (coding-system . (chinese-iso-7bit)) |
283 ;; (input-method . "chinese-cns-quick") | 264 ;; (documentation . ("Support for Chinese CNS character sets." |
284 ;; (documentation . "Support for Chinese CNS character sets.")) | 265 ;; . describe-chinese-environment-map)) |
285 ;; '("Chinese")) | 266 ;; )) |
286 | 267 |
287 ;;; chinese.el ends here | 268 ;;; chinese.el ends here |