annotate lisp/language/chinese.el @ 219:262b8bb4a523 r20-4b8

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