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