annotate lisp/mule/chinese.el @ 357:4711e16a8e49 r21-1-8

Import from CVS: tag r21-1-8
author cvs
date Mon, 13 Aug 2007 10:57:04 +0200
parents 4f79e16b1112
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
333
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
1 ;;; chinese.el --- Support for Chinese
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
2
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
4 ;; Licensed to the Free Software Foundation.
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
5 ;; Copyright (C) 1997 MORIOKA Tomohiko
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
6
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
7 ;; Keywords: multilingual, Chinese
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
8
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
9 ;; This file is part of XEmacs.
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
10
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
11 ;; XEmacs is free software; you can redistribute it and/or modify it
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
12 ;; under the terms of the GNU General Public License as published by
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
14 ;; any later version.
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
15
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
16 ;; XEmacs is distributed in the hope that it will be useful, but
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
19 ;; General Public License for more details.
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
20
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
22 ;; along with XEmacs; see the file COPYING. If not, write to the Free
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
23 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
24 ;; 02111-1307, USA.
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
25
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
26 ;;; Commentary:
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
27
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
28 ;; For Chinese, three character sets GB2312, BIG5, and CNS11643 are
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
29 ;; supported.
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
30
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
31 ;;; Code:
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
32
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
33 ;; Syntax of Chinese characters.
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
34 (modify-syntax-entry 'chinese-gb2312 "w")
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
35 (loop for row in '(33 34 41)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
36 do (modify-syntax-entry `[chinese-gb2312 ,row] "."))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
37 ;;(loop for row from 35 to 40
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
38 ;; do (modify-syntax-entry `[chinese-gb2312 ,row] "w"))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
39 ;;(loop for row from 42 to 126
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
40 ;; do (modify-syntax-entry `[chinese-gb2312 ,row] "w"))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
41
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
42 (modify-syntax-entry 'chinese-cns11643-1 "w")
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
43 (modify-syntax-entry 'chinese-cns11643-2 "w")
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
44 (modify-syntax-entry 'chinese-big5-1 "w")
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
45 (modify-syntax-entry 'chinese-big5-2 "w")
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
46
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
47 ;; CNS11643 Plane3 thru Plane7
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
48 ;; These represent more and more obscure Chinese characters.
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
49 ;; By the time you get to Plane 7, we're talking about characters
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
50 ;; that appear once in some ancient manuscript and whose meaning
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
51 ;; is unknown.
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
52
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
53 (flet
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
54 ((make-chinese-cns11643-charset
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
55 (name plane final)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
56 (make-charset
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
57 name (concat "CNS 11643 Plane " plane " (Chinese traditional)")
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
58 `(registry
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
59 ,(concat "CNS11643[.-]\\(.*[.-]\\)?" plane "$")
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
60 dimension 2
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
61 chars 94
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
62 final ,final
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
63 graphic 0))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
64 (modify-syntax-entry name "w")
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
65 (modify-category-entry name ?t)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
66 ))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
67 (make-chinese-cns11643-charset 'chinese-cns11643-3 "3" ?I)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
68 (make-chinese-cns11643-charset 'chinese-cns11643-4 "4" ?J)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
69 (make-chinese-cns11643-charset 'chinese-cns11643-5 "5" ?K)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
70 (make-chinese-cns11643-charset 'chinese-cns11643-6 "6" ?L)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
71 (make-chinese-cns11643-charset 'chinese-cns11643-7 "7" ?M)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
72 )
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
73
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
74 ;; ISO-IR-165 (CCITT Extended GB)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
75 ;; It is based on CCITT Recommendation T.101, includes GB 2312-80 +
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
76 ;; GB 8565-88 table A4 + 293 characters.
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
77 (make-charset
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
78 'chinese-isoir165
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
79 "ISO-IR-165 (CCITT Extended GB; Chinese simplified)"
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
80 `(registry "isoir165"
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
81 dimension 2
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
82 chars 94
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
83 final ?E
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
84 graphic 0))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
85
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
86 ;; PinYin-ZhuYin
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
87 (make-charset 'sisheng "PinYin-ZhuYin"
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
88 '(registry "sisheng_cwnn\\|OMRON_UDC_ZH"
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
89 dimension 1
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
90 chars 94
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
91 final ?0
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
92 graphic 0
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
93 ))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
94
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
95 ;; If you prefer QUAIL to EGG, please modify below as you wish.
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
96 ;;(when (and (featurep 'egg) (featurep 'wnn))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
97 ;; (setq wnn-server-type 'cserver)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
98 ;; (load "pinyin")
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
99 ;; (setq its:*standard-modes*
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
100 ;; (cons (its:get-mode-map "PinYin") its:*standard-modes*)))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
101
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
102 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
103 ;;; Chinese (general)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
104 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
105
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
106 ;; (make-coding-system
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
107 ;; 'chinese-iso-7bit 2 ?C
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
108 ;; "ISO 2022 based 7bit encoding for Chinese GB and CNS (MIME:ISO-2022-CN)"
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
109 ;; '(ascii
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
110 ;; (nil chinese-gb2312 chinese-cns11643-1)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
111 ;; (nil chinese-cns11643-2)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
112 ;; (nil chinese-cns11643-3 chinese-cns11643-4 chinese-cns11643-5
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
113 ;; chinese-cns11643-6 chinese-cns11643-7)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
114 ;; nil ascii-eol ascii-cntl seven locking-shift single-shift nil nil nil
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
115 ;; init-bol))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
116
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
117 ;; (define-coding-system-alias 'iso-2022-cn 'chinese-iso-7bit)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
118 ;; (define-coding-system-alias 'iso-2022-cn-ext 'chinese-iso-7bit)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
119
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
120 ;; (define-prefix-command 'describe-chinese-environment-map)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
121 ;; (define-key-after describe-language-environment-map [Chinese]
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
122 ;; '("Chinese" . describe-chinese-environment-map)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
123 ;; t)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
124
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
125 ;; (define-prefix-command 'setup-chinese-environment-map)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
126 ;; (define-key-after setup-language-environment-map [Chinese]
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
127 ;; '("Chinese" . setup-chinese-environment-map)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
128 ;; t)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
129
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
130 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
131 ;;; Chinese GB2312 (simplified)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
132 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
133
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
134 ;; (make-coding-system
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
135 ;; 'chinese-iso-8bit 2 ?c
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
136 ;; "ISO 2022 based EUC encoding for Chinese GB2312 (MIME:CN-GB-2312)"
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
137 ;; '((ascii t) chinese-gb2312 chinese-sisheng nil
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
138 ;; nil ascii-eol ascii-cntl nil nil single-shift nil))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
139
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
140 (make-coding-system
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
141 'cn-gb-2312 'iso2022
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
142 "Coding-system of Chinese EUC (Extended Unix Code)."
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
143 '(charset-g0 ascii
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
144 charset-g1 chinese-gb2312
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
145 charset-g2 sisheng
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
146 charset-g3 t
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
147 mnemonic "Zh-GB/EUC"
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
148 ))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
149
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
150 ;; (define-coding-system-alias 'cn-gb-2312 'chinese-iso-8bit)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
151 ;; (define-coding-system-alias 'euc-china 'chinese-iso-8bit)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
152
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
153 (copy-coding-system 'cn-gb-2312 'gb2312)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
154 (copy-coding-system 'cn-gb-2312 'chinese-euc)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
155
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
156 ;; (make-coding-system
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
157 ;; 'chinese-hz 0 ?z
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
158 ;; "Hz/ZW 7-bit encoding for Chinese GB2312 (MIME:HZ-GB-2312)"
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
159 ;; nil)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
160 ;; (put 'chinese-hz 'post-read-conversion 'post-read-decode-hz)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
161 ;; (put 'chinese-hz 'pre-write-conversion 'pre-write-encode-hz)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
162
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
163 (make-coding-system
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
164 'hz-gb-2312 'no-conversion
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
165 "Coding-system of Hz/ZW used for Chinese."
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
166 '(mnemonic "Zh-GB/Hz"
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
167 eol-type lf
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
168 post-read-conversion post-read-decode-hz
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
169 pre-write-conversion pre-write-encode-hz))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
170
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
171 ;; (define-coding-system-alias 'hz-gb-2312 'chinese-hz)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
172 ;; (define-coding-system-alias 'hz 'chinese-hz)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
173
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
174 (copy-coding-system 'hz-gb-2312 'hz)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
175 (copy-coding-system 'hz-gb-2312 'chinese-hz)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
176
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
177 (defun post-read-decode-hz (len)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
178 (let ((pos (point)))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
179 (decode-hz-region pos (+ pos len))))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
180
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
181 (defun pre-write-encode-hz (from to)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
182 (let ((buf (current-buffer))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
183 (work (get-buffer-create " *pre-write-encoding-work*")))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
184 (set-buffer work)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
185 (erase-buffer)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
186 (if (stringp from)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
187 (insert from)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
188 (insert-buffer-substring buf from to))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
189 (encode-hz-region 1 (point-max))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
190 nil))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
191
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
192 (set-language-info-alist
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
193 "Chinese-GB" '((setup-function . (setup-chinese-gb-environment
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
194 . setup-chinese-environment-map))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
195 (charset . (chinese-gb2312 sisheng))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
196 (coding-system
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
197 . (cn-gb-2312 iso-2022-7bit hz-gb-2312))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
198 (sample-text . "Chinese ($AVPND(B,$AFUM(;0(B,$A::So(B) $ADc:C(B")
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
199 (documentation . ("Support for Chinese GB2312 character set."
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
200 . describe-chinese-environment-map))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
201 ))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
202
357
4711e16a8e49 Import from CVS: tag r21-1-8
cvs
parents: 333
diff changeset
203 (defun setup-chinese-gb-environment ()
4711e16a8e49 Import from CVS: tag r21-1-8
cvs
parents: 333
diff changeset
204 "Setup multilingual environment (MULE) for Chinese GB2312 users."
4711e16a8e49 Import from CVS: tag r21-1-8
cvs
parents: 333
diff changeset
205 (interactive)
4711e16a8e49 Import from CVS: tag r21-1-8
cvs
parents: 333
diff changeset
206 (setup-english-environment)
4711e16a8e49 Import from CVS: tag r21-1-8
cvs
parents: 333
diff changeset
207 (set-coding-category-system 'iso-8-2 'cn-gb-2312)
4711e16a8e49 Import from CVS: tag r21-1-8
cvs
parents: 333
diff changeset
208 (set-coding-category-system 'big5 'big5)
4711e16a8e49 Import from CVS: tag r21-1-8
cvs
parents: 333
diff changeset
209 (set-coding-category-system 'iso-7 'iso-2022-7bit)
4711e16a8e49 Import from CVS: tag r21-1-8
cvs
parents: 333
diff changeset
210 (set-coding-priority-list
4711e16a8e49 Import from CVS: tag r21-1-8
cvs
parents: 333
diff changeset
211 '(iso-8-2
4711e16a8e49 Import from CVS: tag r21-1-8
cvs
parents: 333
diff changeset
212 big5
4711e16a8e49 Import from CVS: tag r21-1-8
cvs
parents: 333
diff changeset
213 iso-7))
4711e16a8e49 Import from CVS: tag r21-1-8
cvs
parents: 333
diff changeset
214 (set-default-coding-systems 'cn-gb-2312))
4711e16a8e49 Import from CVS: tag r21-1-8
cvs
parents: 333
diff changeset
215
333
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
216 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
217 ;; Chinese BIG5 (traditional)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
218 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
219
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
220 ;; (make-coding-system
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
221 ;; 'chinese-big5 3 ?B "BIG5 8-bit encoding for Chinese (MIME:CN-BIG5)")
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
222
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
223 (make-coding-system
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
224 'big5 'big5
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
225 "Coding-system of BIG5."
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
226 '(mnemonic "Zh/Big5"))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
227
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
228 ;; (define-coding-system-alias 'big5 'chinese-big5)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
229 ;; (define-coding-system-alias 'cn-big5 'chinese-big5)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
230
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
231 (copy-coding-system 'big5 'cn-big5)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
232 (copy-coding-system 'big5 'chinese-big5)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
233
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
234 ;; Big5 font requires special encoding.
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
235 (define-ccl-program ccl-encode-big5-font
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
236 `(0
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
237 ;; In: R0:chinese-big5-1 or chinese-big5-2
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
238 ;; R1:position code 1
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
239 ;; R2:position code 2
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
240 ;; Out: R1:font code point 1
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
241 ;; R2:font code point 2
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
242 ((r2 = ((((r1 - ?\x21) * 94) + r2) - ?\x21))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
243 (if (r0 == ,(charset-id 'chinese-big5-2)) (r2 += 6280))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
244 (r1 = ((r2 / 157) + ?\xA1))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
245 (r2 %= 157)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
246 (if (r2 < ?\x3F) (r2 += ?\x40) (r2 += ?\x62))))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
247 "CCL program to encode a Big5 code to code point of Big5 font.")
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
248
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
249 ;; (setq font-ccl-encoder-alist
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
250 ;; (cons (cons "big5" ccl-encode-big5-font) font-ccl-encoder-alist))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
251
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
252 (set-charset-ccl-program 'chinese-big5-1 ccl-encode-big5-font)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
253 (set-charset-ccl-program 'chinese-big5-2 ccl-encode-big5-font)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
254
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
255 (set-language-info-alist
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
256 "Chinese-BIG5" '((setup-function . (setup-chinese-big5-environment
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
257 . setup-chinese-environment-map))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
258 (charset . (chinese-big5-1 chinese-big5-2))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
259 (coding-system . (big5 iso-2022-7bit))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
260 (sample-text . "Cantonese ($(0GnM$(B,$(0N]0*Hd(B) $(0*/=((B, $(0+$)p(B")
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
261 (documentation . ("Support for Chinese Big5 character set."
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
262 . describe-chinese-environment-map))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
263 ))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
264
357
4711e16a8e49 Import from CVS: tag r21-1-8
cvs
parents: 333
diff changeset
265 (defun setup-chinese-big5-environment ()
4711e16a8e49 Import from CVS: tag r21-1-8
cvs
parents: 333
diff changeset
266 "Setup multilingual environment (MULE) for Chinese Big5 users."
4711e16a8e49 Import from CVS: tag r21-1-8
cvs
parents: 333
diff changeset
267 (interactive)
4711e16a8e49 Import from CVS: tag r21-1-8
cvs
parents: 333
diff changeset
268 (setup-english-environment)
4711e16a8e49 Import from CVS: tag r21-1-8
cvs
parents: 333
diff changeset
269 (set-coding-category-system 'big5 'big5)
4711e16a8e49 Import from CVS: tag r21-1-8
cvs
parents: 333
diff changeset
270 (set-coding-category-system 'iso-8-2 'cn-gb-2312)
4711e16a8e49 Import from CVS: tag r21-1-8
cvs
parents: 333
diff changeset
271 (set-coding-category-system 'iso-7 'iso-2022-7bit)
4711e16a8e49 Import from CVS: tag r21-1-8
cvs
parents: 333
diff changeset
272 (set-coding-priority-list
4711e16a8e49 Import from CVS: tag r21-1-8
cvs
parents: 333
diff changeset
273 '(big5
4711e16a8e49 Import from CVS: tag r21-1-8
cvs
parents: 333
diff changeset
274 iso-8-2
4711e16a8e49 Import from CVS: tag r21-1-8
cvs
parents: 333
diff changeset
275 iso-7))
4711e16a8e49 Import from CVS: tag r21-1-8
cvs
parents: 333
diff changeset
276 (set-default-coding-systems 'big5))
4711e16a8e49 Import from CVS: tag r21-1-8
cvs
parents: 333
diff changeset
277
333
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
278 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
279 ;; Chinese CNS11643 (traditional)
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
280 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
281
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
282 ;; (set-language-info-alist
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
283 ;; "Chinese-CNS" '((setup-function . (setup-chinese-cns-environment
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
284 ;; . setup-chinese-environment-map))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
285 ;; (charset . (chinese-cns11643-1 chinese-cns11643-2
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
286 ;; chinese-cns11643-3 chinese-cns11643-4
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
287 ;; chinese-cns11643-5 chinese-cns11643-6
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
288 ;; chinese-cns11643-7))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
289 ;; (coding-system . (chinese-iso-7bit))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
290 ;; (documentation . ("Support for Chinese CNS character sets."
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
291 ;; . describe-chinese-environment-map))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
292 ;; ))
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
293
4f79e16b1112 Import from CVS: tag r21-0-64
cvs
parents:
diff changeset
294 ;;; chinese.el ends here