comparison lisp/mule/chinese.el @ 771:943eaba38521

[xemacs-hg @ 2002-03-13 08:51:24 by ben] The big ben-mule-21-5 check-in! Various files were added and deleted. See CHANGES-ben-mule. There are still some test suite failures. No crashes, though. Many of the failures have to do with problems in the test suite itself rather than in the actual code. I'll be addressing these in the next day or so -- none of the test suite failures are at all critical. Meanwhile I'll be trying to address the biggest issues -- i.e. build or run failures, which will almost certainly happen on various platforms. All comments should be sent to ben@xemacs.org -- use a Cc: if necessary when sending to mailing lists. There will be pre- and post- tags, something like pre-ben-mule-21-5-merge-in, and post-ben-mule-21-5-merge-in.
author ben
date Wed, 13 Mar 2002 08:54:06 +0000
parents 576fb035e263
children 79940b592197
comparison
equal deleted inserted replaced
770:336a418893b5 771:943eaba38521
1 ;;; chinese.el --- Support for Chinese -*- coding: iso-2022-7bit; -*- 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 ;; Copyright (C) 2000, 2001 Ben Wing.
6 7
7 ;; Keywords: multilingual, Chinese 8 ;; Keywords: multilingual, Chinese
8 9
9 ;; This file is part of XEmacs. 10 ;; This file is part of XEmacs.
10 11
145 ;; '((safe-charsets ascii chinese-gb2312) 146 ;; '((safe-charsets ascii chinese-gb2312)
146 ;; (mime-charset . cn-gb-2312))) 147 ;; (mime-charset . cn-gb-2312)))
147 148
148 (make-coding-system 149 (make-coding-system
149 'cn-gb-2312 'iso2022 150 'cn-gb-2312 'iso2022
150 "Coding-system of Chinese EUC (Extended Unix Code)." 151 "Chinese EUC"
151 '(charset-g0 ascii 152 '(charset-g0 ascii
152 charset-g1 chinese-gb2312 153 charset-g1 chinese-gb2312
153 charset-g2 sisheng 154 charset-g2 sisheng
154 charset-g3 t 155 charset-g3 t
155 mnemonic "Zh-GB/EUC" 156 mnemonic "Zh-GB/EUC"
157 documentation
158 "Chinese EUC (Extended Unix Code), the standard Chinese encoding on Unix.
159 This follows the same overall EUC principles as Japanese EUC (see the
160 description under Japanese EUC), but specifies different character sets:
161
162 G0: ASCII
163 G1: Chinese-GB2312
164 G2: Sisheng (PinYin - ZhuYin)"
156 )) 165 ))
157 166
158 ;; (define-coding-system-alias 'cn-gb-2312 'chinese-iso-8bit) 167 ;; (define-coding-system-alias 'cn-gb-2312 'chinese-iso-8bit)
159 ;; (define-coding-system-alias 'euc-china 'chinese-iso-8bit) 168 ;; (define-coding-system-alias 'euc-china 'chinese-iso-8bit)
160 ;; (define-coding-system-alias 'euc-cn 'chinese-iso-8bit) 169 ;; (define-coding-system-alias 'euc-cn 'chinese-iso-8bit)
173 ;; (put 'chinese-hz 'post-read-conversion 'post-read-decode-hz) 182 ;; (put 'chinese-hz 'post-read-conversion 'post-read-decode-hz)
174 ;; (put 'chinese-hz 'pre-write-conversion 'pre-write-encode-hz) 183 ;; (put 'chinese-hz 'pre-write-conversion 'pre-write-encode-hz)
175 184
176 (make-coding-system 185 (make-coding-system
177 'hz-gb-2312 'no-conversion 186 'hz-gb-2312 'no-conversion
178 "Coding-system of Hz/ZW used for Chinese." 187 "Hz/ZW (Chinese)"
179 '(mnemonic "Zh-GB/Hz" 188 '(mnemonic "Zh-GB/Hz"
180 eol-type lf 189 eol-type lf
181 post-read-conversion post-read-decode-hz 190 post-read-conversion post-read-decode-hz
182 pre-write-conversion pre-write-encode-hz)) 191 pre-write-conversion pre-write-encode-hz
192 documentation "Hz/ZW 7-bit encoding for Chinese GB2312 (MIME:HZ-GB-2312)"
193 ))
183 194
184 ;; (define-coding-system-alias 'hz-gb-2312 'chinese-hz) 195 ;; (define-coding-system-alias 'hz-gb-2312 'chinese-hz)
185 ;; (define-coding-system-alias 'hz 'chinese-hz) 196 ;; (define-coding-system-alias 'hz 'chinese-hz)
186 197
187 (define-coding-system-alias 'hz 'hz-gb-2312) 198 (define-coding-system-alias 'hz 'hz-gb-2312)
201 (insert from) 212 (insert from)
202 (insert-buffer-substring buf from to)) 213 (insert-buffer-substring buf from to))
203 (let (last-coding-system-used) 214 (let (last-coding-system-used)
204 (encode-hz-region 1 (point-max))) 215 (encode-hz-region 1 (point-max)))
205 nil)) 216 nil))
206 217
207 (set-language-info-alist 218 (set-language-info-alist
208 "Chinese-GB" '((setup-function . setup-chinese-gb-environment-internal) 219 "Chinese-GB" '((setup-function . setup-chinese-gb-environment-internal)
209 (charset chinese-gb2312 sisheng) 220 (charset chinese-gb2312 sisheng)
210 (coding-system cn-gb-2312 iso-2022-7bit hz-gb-2312) 221 (coding-system cn-gb-2312 iso-2022-7bit hz-gb-2312)
211 (coding-priority cn-gb-2312 big5 iso-2022-7bit) 222 (coding-priority cn-gb-2312 big5 iso-2022-7bit)
223 (cygwin-locale "zh")
224 (locale "zh_CN.eucCN" "zh_CN.EUC" "zh_CN"
225 "chinese-s" "zh"
226 #'(lambda (arg)
227 (and arg (let ((case-fold-search t))
228 (string-match "^zh_.*.GB.*" arg)))))
229 (mswindows-locale ("CHINESE" . "CHINESE_SIMPLIFIED"))
230 (native-coding-system cn-gb-2312)
212 (input-method . "chinese-py-punct") 231 (input-method . "chinese-py-punct")
213 (features china-util) 232 (features china-util)
214 (sample-text . "Chinese ($AVPND(B,$AFUM(;0(B,$A::So(B) $ADc:C(B") 233 (sample-text . "Chinese ($AVPND(B,$AFUM(;0(B,$A::So(B) $ADc:C(B")
215 (documentation . "Support for Chinese GB2312 character set.")) 234 (documentation .
235 "Supports Simplified Chinese, used in mainland China.
236 Uses the GB2312 character set."))
216 '("Chinese")) 237 '("Chinese"))
217 238
218 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 239 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
219 ;; Chinese BIG5 (traditional) 240 ;; Chinese BIG5 (traditional)
220 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 241 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
227 ;; (charset-origin-alist (chinese-big5-1 "BIG5" encode-big5-char) 248 ;; (charset-origin-alist (chinese-big5-1 "BIG5" encode-big5-char)
228 ;; (chinese-big5-2 "BIG5" encode-big5-char)))) 249 ;; (chinese-big5-2 "BIG5" encode-big5-char))))
229 250
230 (make-coding-system 251 (make-coding-system
231 'big5 'big5 252 'big5 'big5
232 "Coding-system of BIG5." 253 "Big5"
233 '(mnemonic "Zh/Big5")) 254 '(mnemonic "Zh/Big5"
255 documentation
256 "A non-modal encoding formed by five large Taiwanese companies
257 \(hence \"Big5\") to produce a character set and encoding for
258 traditional Chinese writing. Big5 encodes some 13,000+ characters.
259 ASCII is encoded as normal, and Chinese characters as two bytes, but
260 Chinese characters do not exclusively use the high half. The first
261 byte is in the high half standard position A1-FE, but the second byte
262 is in either low 40-7E or high A1-FE. Thus Big5 suffers from the
263 classic \"it might look like a slash, but it's really the second byte
264 of a Chinese character\"."))
234 265
235 ;; (define-coding-system-alias 'big5 'chinese-big5) 266 ;; (define-coding-system-alias 'big5 'chinese-big5)
236 ;; (define-coding-system-alias 'cn-big5 'chinese-big5) 267 ;; (define-coding-system-alias 'cn-big5 'chinese-big5)
237 268
238 (define-coding-system-alias 'cn-big5 'big5) 269 (define-coding-system-alias 'cn-big5 'big5)
260 291
261 (set-language-info-alist 292 (set-language-info-alist
262 "Chinese-BIG5" '((charset chinese-big5-1 chinese-big5-2) 293 "Chinese-BIG5" '((charset chinese-big5-1 chinese-big5-2)
263 (coding-system big5 iso-2022-7bit) 294 (coding-system big5 iso-2022-7bit)
264 (coding-priority big5 cn-gb-2312 iso-2022-7bit) 295 (coding-priority big5 cn-gb-2312 iso-2022-7bit)
296 (cygwin-locale "zh_TW")
297 (locale "zh_TW.Big5" "zh_TW.big5" "zh_CN.big5" "zh_TW"
298 "chinese-t"
299 #'(lambda (arg)
300 (and arg (let ((case-fold-search t))
301 (string-match "^zh_.*.BIG5.*" arg)))))
302 (mswindows-locale ("CHINESE" . "CHINESE_TRADITIONAL"))
303 (native-coding-system big5)
265 (input-method . "chinese-py-punct-b5") 304 (input-method . "chinese-py-punct-b5")
266 (features china-util) 305 (features china-util)
267 (sample-text . "Cantonese ($(0GnM$(B,$(0N]0*Hd(B) $(0*/=((B, $(0+$)p(B") 306 (sample-text . "Cantonese ($(0GnM$(B,$(0N]0*Hd(B) $(0*/=((B, $(0+$)p(B")
268 (documentation . "Support for Chinese Big5 character set.")) 307 (documentation .
308 "Supports Traditional Chinese, used in Taiwan, Hong Kong, and Singapore.
309 Uses the Chinese Big5 character set."
310 ))
269 '("Chinese")) 311 '("Chinese"))
270 312
271 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 313 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
272 ;; Chinese CNS11643 (traditional) 314 ;; Chinese CNS11643 (traditional)
273 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 315 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;