Mercurial > emacs
annotate lisp/language/chinese.el @ 17692:426dde653028 gnumach-release-1-1 gnumach-release-1-1-1 libc-970508 libc-970509 libc-970510 libc-970511 libc-970512 libc-970513 libc-970514 libc-970515 libc-970516 libc-970517 libc-970518 libc-970519 libc-970520 libc-970521 libc-970522 libc-970523 libc-970524 libc-970525 libc-970526 libc-970527 libc-970528 libc-970529 libc-970530 libc-970531 libc-970601 libc-970602 libc-970603 libc-970604 libc-970605
Recognize either / or - as a machine/suptype separator from uname -m
to cope with older systems that have the older uname.
author | Thomas Bushnell, BSG <thomas@gnu.org> |
---|---|
date | Wed, 07 May 1997 19:19:04 +0000 |
parents | 07f0a1e07d1e |
children | 9c4845e8101d |
rev | line source |
---|---|
17052 | 1 ;;; chinese.el --- Support for Chinese |
2 | |
3 ;; Copyright (C) 1995 Free Software Foundation, Inc. | |
4 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN. | |
5 | |
6 ;; Keywords: multilingual, Chinese | |
7 | |
8 ;; This file is part of GNU Emacs. | |
9 | |
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. | |
14 | |
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. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
17071 | 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. | |
17052 | 24 |
25 ;;; Commentary: | |
26 | |
27 ;; For Chinese, three character sets GB2312, BIG5, and CNS11643 are | |
28 ;; supported. | |
29 | |
30 ;;; Code: | |
31 | |
32 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
33 ;;; Chinese (general) | |
34 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
35 | |
36 (make-coding-system | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
37 'iso-2022-cn 2 ?C |
17052 | 38 "Coding system ISO-2022-CN for Chinese (GB and CNS character sets)." |
39 '(ascii | |
40 (nil chinese-gb2312 chinese-cns11643-1) | |
41 (nil chinese-cns11643-2) | |
42 (nil chinese-cns11643-3 chinese-cns11643-4 chinese-cns11643-5 | |
43 chinese-cns11643-6 chinese-cns11643-7) | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
44 nil ascii-eol ascii-cntl seven locking-shift single-shift nil nil nil |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
45 init-bol)) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
46 |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
47 (define-coding-system-alias 'iso-2022-cn 'iso-2022-cn-ext) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
48 |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
49 (set-language-info |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
50 "Chinese" 'documentation |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
51 "Emacs provides three kinds of Chinese support: Chinese-GB, |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
52 Chinese-BIG5, and Chinese-CNS. Please specify one of them to get more |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
53 information.") |
17052 | 54 |
55 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
56 ;;; Chinese GB2312 (simplified) | |
57 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
58 | |
59 (make-coding-system | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
60 'cn-gb-2312 2 ?C |
17052 | 61 "Coding-system of Chinese EUC (so called GB Encoding)." |
62 '((ascii t) chinese-gb2312 chinese-sisheng nil | |
63 nil ascii-eol ascii-cntl nil nil single-shift nil)) | |
64 | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
65 (define-coding-system-alias 'cn-gb-2312 'euc-china) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
66 |
17052 | 67 (make-coding-system |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
68 'hz-gb-2312 0 ?z |
17052 | 69 "Codins-system of Hz/ZW used for Chinese (GB)." |
70 nil) | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
71 (put 'hz-gb-2312 'post-read-conversion 'post-read-decode-hz) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
72 (put 'hz-gb-2312 'pre-write-conversion 'pre-write-encode-hz) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
73 |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
74 (define-coding-system-alias 'hz-gb-2312 'hz) |
17052 | 75 |
76 (defun post-read-decode-hz (len) | |
77 (let ((pos (point))) | |
78 (decode-hz-region pos (+ pos len)))) | |
79 | |
80 (defun pre-write-encode-hz (from to) | |
81 (let ((buf (current-buffer)) | |
82 (work (get-buffer-create " *pre-write-encoding-work*"))) | |
83 (set-buffer work) | |
84 (widen) | |
85 (erase-buffer) | |
86 (insert-buffer-substring buf from to) | |
87 (encode-hz-region 1 (point-max)) | |
88 nil)) | |
89 | |
90 (register-input-method | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
91 "Chinese-GB" '("cxterm-gb" encoded-kbd-select-terminal cn-gb-2312)) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
92 (register-input-method |
17052 | 93 "Chinese-GB" '("quail-ccdospy" quail-use-package "quail/ccdospy")) |
94 (register-input-method | |
95 "Chinese-GB" '("quail-ctlau" quail-use-package "quail/ctlau")) | |
96 (register-input-method | |
97 "Chinese-GB" '("quail-punct" quail-use-package "quail/punct")) | |
98 (register-input-method | |
99 "Chinese-GB" '("quail-qj" quail-use-package "quail/qj")) | |
100 (register-input-method | |
101 "Chinese-GB" '("quail-sw" quail-use-package "quail/sw")) | |
102 (register-input-method | |
103 "Chinese-GB" '("quail-ziranma" quail-use-package "quail/ziranma")) | |
104 (register-input-method | |
105 "Chinese-GB" '("quail-tonepy" quail-use-package "quail/tonepy")) | |
106 (register-input-method | |
107 "Chinese-GB" '("quail-py" quail-use-package "quail/py")) | |
108 | |
109 (defun setup-chinese-gb-environment () | |
110 (setq primary-language "Chinese-GB") | |
111 | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
112 (setq coding-category-iso-8-2 'cn-gb-2312) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
113 (setq coding-category-iso-else 'iso-2022-cn) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
114 (setq coding-category-big5 'cn-big5) |
17052 | 115 |
116 (set-coding-priority | |
117 '(coding-category-iso-7 | |
118 coding-category-iso-else | |
119 coding-category-iso-8-2 | |
120 coding-category-big5 | |
121 coding-category-iso-8-1 | |
122 coding-category-internal | |
123 )) | |
124 | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
125 (setq-default buffer-file-coding-system 'cn-gb-2312) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
126 (set-terminal-coding-system 'cn-gb-2312) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
127 (set-keyboard-coding-system 'cn-gb-2312) |
17052 | 128 |
129 (setq default-input-method '("Chinese-GB" . "quail-py")) | |
130 ) | |
131 | |
132 (set-language-info-alist | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
133 "Chinese-GB" '((documentation . t) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
134 (setup-function . setup-chinese-gb-environment) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
135 (charset . (chinese-gb2312 chinese-sisheng)) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
136 (coding-system . (cn-gb-2312 hz-gb-2312 iso-2022-cn)) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
137 (documentation . t) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
138 (sample-text . "Chinese ($AVPND(B,$AFUM(;0(B,$A::So(B) $ADc:C(B"))) |
17052 | 139 |
140 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
141 ;; Chinese BIG5 (traditional) | |
142 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
143 | |
144 (make-coding-system | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
145 'big5 3 ?B |
17052 | 146 "Coding-system of BIG5.") |
147 | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
148 (define-coding-system-alias 'big5 'cn-big5) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
149 |
17052 | 150 ;; Big5 font requires special encoding. |
151 (define-ccl-program ccl-encode-big5-font | |
152 `(0 | |
153 ;; In: R0:chinese-big5-1 or chinese-big5-2 | |
154 ;; R1:position code 1 | |
155 ;; R2:position code 2 | |
156 ;; Out: R1:font code point 1 | |
157 ;; R2:font code point 2 | |
158 ((r2 = ((((r1 - ?\x21) * 94) + r2) - ?\x21)) | |
159 (if (r0 == ,(charset-id 'chinese-big5-2)) (r2 += 6280)) | |
160 (r1 = ((r2 / 157) + ?\xA1)) | |
161 (r2 %= 157) | |
162 (if (r2 < ?\x3F) (r2 += ?\x40) (r2 += ?\x62)))) | |
163 "CCL program to encode a Big5 code to code point of Big5 font.") | |
164 | |
165 (setq font-ccl-encoder-alist | |
166 (cons (cons "big5" ccl-encode-big5-font) font-ccl-encoder-alist)) | |
167 | |
168 (register-input-method | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
169 "Chinese-BIG5" '("cxterm-big5" encoded-kbd-select-terminal big5)) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
170 (register-input-method |
17052 | 171 "Chinese-BIG5" '("quail-qj-b5" quail-use-package "quail/qj-b5")) |
172 (register-input-method | |
173 "Chinese-BIG5" '("quail-zozy" quail-use-package "quail/zozy")) | |
174 (register-input-method | |
175 "Chinese-BIG5" '("quail-tsangchi-b5" quail-use-package "quail/tsangchi-b5")) | |
176 (register-input-method | |
177 "Chinese-BIG5" '("quail-py-b5" quail-use-package "quail/py-b5")) | |
178 (register-input-method | |
179 "Chinese-BIG5" '("quail-quick-b5" quail-use-package "quail/quick-bt")) | |
180 (register-input-method | |
181 "Chinese-BIG5" '("quail-etzy" quail-use-package "quail/etzy")) | |
182 (register-input-method | |
183 "Chinese-BIG5" '("quail-ecdict" quail-use-package "quail/ecdict")) | |
184 (register-input-method | |
185 "Chinese-BIG5" '("quail-ctlaub" quail-use-package "quail/ctlaub")) | |
186 (register-input-method | |
187 "Chinese-BIG5" '("quail-array30" quail-use-package "quail/array30")) | |
188 (register-input-method | |
189 "Chinese-BIG5" '("quail-4corner" quail-use-package "quail/4corner")) | |
190 | |
191 (defun setup-chinese-big5-environment () | |
192 (setq primary-language "Chinese-BIG5") | |
193 | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
194 (setq coding-category-big5 'cn-big5) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
195 (setq coding-category-iso-else 'iso-2022-cn) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
196 (setq coding-category-iso-8-2 'cn-gb-2312) |
17052 | 197 |
198 (set-coding-priority | |
199 '(coding-category-iso-7 | |
200 coding-category-iso-else | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
201 coding-category-big5 |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
202 coding-category-iso-8-2)) |
17052 | 203 |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
204 (setq-default buffer-file-coding-system 'cn-big5) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
205 (set-terminal-coding-system 'cn-big5) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
206 (set-keyboard-coding-system 'cn-big5) |
17052 | 207 |
208 (setq default-input-method '("Chinese-BIG5" . "quail-py-b5")) | |
209 ) | |
210 | |
211 (set-language-info-alist | |
212 "Chinese-BIG5" '((setup-function . setup-chinese-big5-environment) | |
213 (charset . (chinese-big5-1 chinese-big5-2)) | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
214 (coding-system . (cn-big5 iso-2022-cn)) |
17052 | 215 (documentation . t) |
216 (sample-text . "Cantonese ($(0GnM$(B,$(0N]0*Hd(B) $(0*/=((B, $(0+$)p(B"))) | |
217 | |
218 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
219 ;; Chinese CNS11643 (traditional) | |
220 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
221 | |
222 (register-input-method | |
223 "Chinese-CNS" '("quail-quick-cns" quail-use-package "quail/quick-cns")) | |
224 (register-input-method | |
225 "Chinese-CNS" '("quail-tsangchi-cns" quail-use-package "quail/tsangchi-cns")) | |
226 | |
227 (defun setup-chinese-cns-environment () | |
228 (setq primary-language "Chinese-CNS") | |
229 | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
230 (setq coding-category-iso-else 'iso-2022-cn) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
231 (setq coding-category-big5 'cn-big5) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
232 (setq coding-category-iso-8-2 'cn-gb-2312) |
17052 | 233 |
234 (set-coding-priority | |
235 '(coding-category-iso-7 | |
236 coding-category-iso-else | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
237 coding-category-iso-8-2 |
17052 | 238 coding-category-big5)) |
239 | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
240 (setq-default buffer-file-coding-system 'iso-2022-cn) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
241 (set-terminal-coding-system 'iso-2022-cn) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
242 (set-keyboard-coding-system 'iso-2022-cn) |
17052 | 243 |
244 (setq default-input-method '("Chinese-CNS" . "quail-py-cns")) | |
245 ) | |
246 | |
247 (set-language-info-alist | |
248 "Chinese-CNS" '((setup-function . setup-chinese-cns-environment) | |
249 (charset . (chinese-cns11643-1 chinese-cns11643-2 | |
250 chinese-cns11643-3 chinese-cns11643-4 | |
251 chinese-cns11643-5 chinese-cns11643-6 | |
252 chinese-cns11643-7)) | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
253 (coding-system . (iso-2022-cn)) |
17052 | 254 (documentation . t))) |
255 | |
256 ;;; chinese.el ends here |