Mercurial > emacs
annotate lisp/language/chinese.el @ 18137:985e47a14cab
(Info-tagify): Don't set Info-tag-table-marker if not in Info mode.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 04 Jun 1997 04:09:28 +0000 |
parents | 73869115ae0a |
children | f7296dc03177 |
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 |
17993
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17841
diff
changeset
|
49 (define-prefix-command 'describe-chinese-support-map) |
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17841
diff
changeset
|
50 (define-key-after describe-language-support-map [Chinese] |
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17841
diff
changeset
|
51 '("Chinese" . describe-chinese-support-map) |
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17841
diff
changeset
|
52 t) |
17052 | 53 |
17993
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17841
diff
changeset
|
54 (define-prefix-command 'setup-chinese-environment-map) |
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17841
diff
changeset
|
55 (define-key-after setup-language-environment-map [Chinese] |
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17841
diff
changeset
|
56 '("Chinese" . setup-chinese-environment-map) |
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17841
diff
changeset
|
57 t) |
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17841
diff
changeset
|
58 |
17052 | 59 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
60 ;;; Chinese GB2312 (simplified) | |
61 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
62 | |
63 (make-coding-system | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
64 'cn-gb-2312 2 ?C |
17052 | 65 "Coding-system of Chinese EUC (so called GB Encoding)." |
66 '((ascii t) chinese-gb2312 chinese-sisheng nil | |
67 nil ascii-eol ascii-cntl nil nil single-shift nil)) | |
68 | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
69 (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
|
70 |
17052 | 71 (make-coding-system |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
72 'hz-gb-2312 0 ?z |
17052 | 73 "Codins-system of Hz/ZW used for Chinese (GB)." |
74 nil) | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
75 (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
|
76 (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
|
77 |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
78 (define-coding-system-alias 'hz-gb-2312 'hz) |
17052 | 79 |
80 (defun post-read-decode-hz (len) | |
81 (let ((pos (point))) | |
82 (decode-hz-region pos (+ pos len)))) | |
83 | |
84 (defun pre-write-encode-hz (from to) | |
85 (let ((buf (current-buffer)) | |
86 (work (get-buffer-create " *pre-write-encoding-work*"))) | |
87 (set-buffer work) | |
88 (erase-buffer) | |
17765
9c4845e8101d
Make functions setup-LANGUAGE-environment
Kenichi Handa <handa@m17n.org>
parents:
17084
diff
changeset
|
89 (if (stringp from) |
9c4845e8101d
Make functions setup-LANGUAGE-environment
Kenichi Handa <handa@m17n.org>
parents:
17084
diff
changeset
|
90 (insert from) |
9c4845e8101d
Make functions setup-LANGUAGE-environment
Kenichi Handa <handa@m17n.org>
parents:
17084
diff
changeset
|
91 (insert-buffer-substring buf from to)) |
17052 | 92 (encode-hz-region 1 (point-max)) |
93 nil)) | |
94 | |
95 (register-input-method | |
96 "Chinese-GB" '("quail-ccdospy" quail-use-package "quail/ccdospy")) | |
97 (register-input-method | |
98 "Chinese-GB" '("quail-ctlau" quail-use-package "quail/ctlau")) | |
99 (register-input-method | |
100 "Chinese-GB" '("quail-punct" quail-use-package "quail/punct")) | |
101 (register-input-method | |
102 "Chinese-GB" '("quail-qj" quail-use-package "quail/qj")) | |
103 (register-input-method | |
104 "Chinese-GB" '("quail-sw" quail-use-package "quail/sw")) | |
105 (register-input-method | |
106 "Chinese-GB" '("quail-ziranma" quail-use-package "quail/ziranma")) | |
107 (register-input-method | |
108 "Chinese-GB" '("quail-tonepy" quail-use-package "quail/tonepy")) | |
109 (register-input-method | |
110 "Chinese-GB" '("quail-py" quail-use-package "quail/py")) | |
111 | |
112 (set-language-info-alist | |
17993
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17841
diff
changeset
|
113 "Chinese-GB" '((setup-function . (setup-chinese-gb-environment |
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17841
diff
changeset
|
114 . setup-chinese-environment-map)) |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
115 (charset . (chinese-gb2312 chinese-sisheng)) |
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
116 (coding-system . (cn-gb-2312 hz-gb-2312 iso-2022-cn)) |
17765
9c4845e8101d
Make functions setup-LANGUAGE-environment
Kenichi Handa <handa@m17n.org>
parents:
17084
diff
changeset
|
117 (sample-text . "Chinese ($AVPND(B,$AFUM(;0(B,$A::So(B) $ADc:C(B") |
17993
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17841
diff
changeset
|
118 (documentation . ("Support for Chinese GB2312 character set." |
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17841
diff
changeset
|
119 . describe-chinese-support-map)) |
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17841
diff
changeset
|
120 )) |
17052 | 121 |
122 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
123 ;; Chinese BIG5 (traditional) | |
124 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
125 | |
126 (make-coding-system | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
127 'big5 3 ?B |
17052 | 128 "Coding-system of BIG5.") |
129 | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
130 (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
|
131 |
17052 | 132 ;; Big5 font requires special encoding. |
133 (define-ccl-program ccl-encode-big5-font | |
134 `(0 | |
135 ;; In: R0:chinese-big5-1 or chinese-big5-2 | |
136 ;; R1:position code 1 | |
137 ;; R2:position code 2 | |
138 ;; Out: R1:font code point 1 | |
139 ;; R2:font code point 2 | |
140 ((r2 = ((((r1 - ?\x21) * 94) + r2) - ?\x21)) | |
141 (if (r0 == ,(charset-id 'chinese-big5-2)) (r2 += 6280)) | |
142 (r1 = ((r2 / 157) + ?\xA1)) | |
143 (r2 %= 157) | |
144 (if (r2 < ?\x3F) (r2 += ?\x40) (r2 += ?\x62)))) | |
145 "CCL program to encode a Big5 code to code point of Big5 font.") | |
146 | |
147 (setq font-ccl-encoder-alist | |
148 (cons (cons "big5" ccl-encode-big5-font) font-ccl-encoder-alist)) | |
149 | |
150 (register-input-method | |
151 "Chinese-BIG5" '("quail-qj-b5" quail-use-package "quail/qj-b5")) | |
152 (register-input-method | |
153 "Chinese-BIG5" '("quail-zozy" quail-use-package "quail/zozy")) | |
154 (register-input-method | |
155 "Chinese-BIG5" '("quail-tsangchi-b5" quail-use-package "quail/tsangchi-b5")) | |
156 (register-input-method | |
157 "Chinese-BIG5" '("quail-py-b5" quail-use-package "quail/py-b5")) | |
158 (register-input-method | |
159 "Chinese-BIG5" '("quail-quick-b5" quail-use-package "quail/quick-bt")) | |
160 (register-input-method | |
161 "Chinese-BIG5" '("quail-etzy" quail-use-package "quail/etzy")) | |
162 (register-input-method | |
163 "Chinese-BIG5" '("quail-ecdict" quail-use-package "quail/ecdict")) | |
164 (register-input-method | |
165 "Chinese-BIG5" '("quail-ctlaub" quail-use-package "quail/ctlaub")) | |
166 (register-input-method | |
167 "Chinese-BIG5" '("quail-array30" quail-use-package "quail/array30")) | |
168 (register-input-method | |
169 "Chinese-BIG5" '("quail-4corner" quail-use-package "quail/4corner")) | |
170 | |
171 (set-language-info-alist | |
17993
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17841
diff
changeset
|
172 "Chinese-BIG5" '((setup-function . (setup-chinese-big5-environment |
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17841
diff
changeset
|
173 . setup-chinese-environment-map)) |
17052 | 174 (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
|
175 (coding-system . (cn-big5 iso-2022-cn)) |
17765
9c4845e8101d
Make functions setup-LANGUAGE-environment
Kenichi Handa <handa@m17n.org>
parents:
17084
diff
changeset
|
176 (sample-text . "Cantonese ($(0GnM$(B,$(0N]0*Hd(B) $(0*/=((B, $(0+$)p(B") |
17993
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17841
diff
changeset
|
177 (documentation . ("Support for Chinese Big5 character set." |
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17841
diff
changeset
|
178 . describe-chinese-support-map)) |
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17841
diff
changeset
|
179 )) |
17052 | 180 |
181 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
182 ;; Chinese CNS11643 (traditional) | |
183 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
184 | |
185 (register-input-method | |
186 "Chinese-CNS" '("quail-quick-cns" quail-use-package "quail/quick-cns")) | |
187 (register-input-method | |
188 "Chinese-CNS" '("quail-tsangchi-cns" quail-use-package "quail/tsangchi-cns")) | |
189 | |
190 (set-language-info-alist | |
17993
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17841
diff
changeset
|
191 "Chinese-CNS" '((setup-function . (setup-chinese-cns-environment |
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17841
diff
changeset
|
192 . setup-chinese-environment-map)) |
17052 | 193 (charset . (chinese-cns11643-1 chinese-cns11643-2 |
194 chinese-cns11643-3 chinese-cns11643-4 | |
195 chinese-cns11643-5 chinese-cns11643-6 | |
196 chinese-cns11643-7)) | |
17084
07f0a1e07d1e
Add INIT-BOL to coding system iso-2022-cn.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
197 (coding-system . (iso-2022-cn)) |
17993
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17841
diff
changeset
|
198 (documentation . ("Support for Chinese CNS character sets." |
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17841
diff
changeset
|
199 . describe-chinese-support-map)) |
73869115ae0a
Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents:
17841
diff
changeset
|
200 )) |
17052 | 201 |
202 ;;; chinese.el ends here |