Mercurial > hg > xemacs-beta
comparison lisp/mule/chinese-hooks.el @ 70:131b0175ea99 r20-0b30
Import from CVS: tag r20-0b30
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:02:59 +0200 |
parents | |
children | 54cc21c15cbb |
comparison
equal
deleted
inserted
replaced
69:804d1389bcd6 | 70:131b0175ea99 |
---|---|
1 ;;; chinese-hooks.el --- pre-loaded support for Chinese. | |
2 | |
3 ;; Copyright (C) 1992,93,94,95 Free Software Foundation, Inc. | |
4 ;; Copyright (C) 1995 Amdahl Corporation. | |
5 ;; Copyright (C) 1996 Sun Microsystems. | |
6 | |
7 ;; This file is part of XEmacs. | |
8 | |
9 ;; XEmacs is free software; you can redistribute it and/or modify it | |
10 ;; under the terms of the GNU General Public License as published by | |
11 ;; the Free Software Foundation; either version 2, or (at your option) | |
12 ;; any later version. | |
13 | |
14 ;; XEmacs is distributed in the hope that it will be useful, but | |
15 ;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 ;; General Public License for more details. | |
18 | |
19 ;; You should have received a copy of the GNU General Public License | |
20 ;; along with XEmacs; see the file COPYING. If not, write to the | |
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
22 ;; Boston, MA 02111-1307, USA. | |
23 | |
24 ;;; Synched up with: Mule 2.3. | |
25 | |
26 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
27 ;;; CHINESE | |
28 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
29 | |
30 ;; Syntax of Chinese characters. | |
31 (loop for row in '(33 34 41) do (modify-syntax-entry `[chinese-gb ,row] ".")) | |
32 (loop for row from 35 to 40 do (modify-syntax-entry `[chinese-gb ,row] "w")) | |
33 (loop for row from 42 to 126 do (modify-syntax-entry `[chinese-gb ,row] "w")) | |
34 | |
35 (modify-syntax-entry 'chinese-cns11643-1 "w") | |
36 (modify-syntax-entry 'chinese-cns11643-2 "w") | |
37 (modify-syntax-entry 'chinese-big5-1 "w") | |
38 (modify-syntax-entry 'chinese-big5-2 "w") | |
39 | |
40 ;; CNS11643 Plane3 thru Plane7 | |
41 ;; These represent more and more obscure Chinese characters. | |
42 ;; By the time you get to Plane 7, we're talking about characters | |
43 ;; that appear once in some ancient manuscript and whose meaning | |
44 ;; is unknown. | |
45 | |
46 (flet | |
47 ((make-chinese-cns11643-charset | |
48 (name plane final) | |
49 (make-charset | |
50 name (concat "Chinese CNS Plane " plane) | |
51 `(registry | |
52 ,(concat "CNS11643[.-]\\(.*[.-]\\)?" plane "$") | |
53 dimension 2 | |
54 chars 94 | |
55 final ,final | |
56 graphic 0)) | |
57 (modify-syntax-entry name "w") | |
58 (modify-category-entry name ?t) | |
59 )) | |
60 (make-chinese-cns11643-charset 'chinese-cns11643-3 "3" ?I) | |
61 (make-chinese-cns11643-charset 'chinese-cns11643-4 "4" ?J) | |
62 (make-chinese-cns11643-charset 'chinese-cns11643-5 "5" ?K) | |
63 (make-chinese-cns11643-charset 'chinese-cns11643-6 "6" ?L) | |
64 (make-chinese-cns11643-charset 'chinese-cns11643-7 "7" ?M) | |
65 ) | |
66 | |
67 ;; PinYin-ZhuYin | |
68 (make-charset 'sisheng "PinYin-ZhuYin" | |
69 '(registry "sisheng_cwnn\\|OMRON_UDC_ZH" | |
70 dimension 1 | |
71 chars 94 | |
72 final ?0 | |
73 graphic 0 | |
74 )) | |
75 | |
76 (make-coding-system | |
77 'euc-china 'iso2022 | |
78 "Coding-system of Chinese EUC (Extended Unix Code)." | |
79 '(charset-g0 ascii | |
80 charset-g1 chinese-gb | |
81 charset-g2 sisheng | |
82 charset-g3 t | |
83 mnemonic "EUC/China" | |
84 )) | |
85 | |
86 (make-coding-system | |
87 'hz 'no-conversion | |
88 "Coding-system of Hz/ZW used for Chinese." | |
89 '(mnemonic "Hz/ZW" | |
90 eol-type lf | |
91 post-read-conversion hz2gb-region | |
92 pre-write-conversion gb2hz-region)) | |
93 | |
94 (make-coding-system | |
95 'big5 'big5 | |
96 "Coding-system of BIG5." | |
97 '(mnemonic "Big5")) | |
98 | |
99 (copy-coding-system 'big5 'big5-eten) | |
100 | |
101 ;; If you prefer QUAIL to EGG, please modify below as you wish. | |
102 (when (and (featurep 'egg) (featurep 'wnn)) | |
103 (setq wnn-server-type 'cserver) | |
104 (load "its/pinyin") | |
105 (setq its:*standard-modes* | |
106 (cons (its:get-mode-map "PinYin") its:*standard-modes*))) | |
107 | |
108 ;; For QUAIL | |
109 ;; Please add your own quail package if any. | |
110 | |
111 ;; For GB character input | |
112 (add-hook 'quail-package-alist '("py" "quail/py")) | |
113 (add-hook 'quail-package-alist '("qj" "quail/qj")) | |
114 (add-hook 'quail-package-alist '("punct" "quail/punct")) | |
115 (add-hook 'quail-package-alist '("sw" "quail/sw")) | |
116 (add-hook 'quail-package-alist '("tonepy" "quail/tonepy")) | |
117 (add-hook 'quail-package-alist '("ccdospy" "quail/ccdospy")) | |
118 (add-hook 'quail-package-alist '("ctlau" "quail/ctlau")) | |
119 | |
120 ;; For BIG5 character input | |
121 (add-hook 'quail-package-alist '("py-b5" "quail/py-b5")) | |
122 (add-hook 'quail-package-alist '("qj-b5" "quail/qj-b5")) | |
123 (add-hook 'quail-package-alist '("punct-b5" "quail/punct-b5")) | |
124 (add-hook 'quail-package-alist '("ctlaub" "quail/ctlaub")) | |
125 (add-hook 'quail-package-alist '("zozy" "quail/zozy")) | |
126 (add-hook 'quail-package-alist '("etzy" "quail/etzy")) | |
127 | |
128 ;; For Big5 handling | |
129 | |
130 (define-ccl-program ccl-internal-to-big5-1 | |
131 '(((r1 = ((((r0 - #x21) * 94) + r1) - #x21)) | |
132 (r0 = ((r1 / 157) + #xA1)) | |
133 (r1 %= 157) | |
134 (if (r1 < #x3F) (r1 += #x40) (r1 += #x62)))) | |
135 "CCL program to convert internal Big5 code (level1) to code point of Big5 font.") | |
136 | |
137 ;; 6280 is the number of characters that got shoved into `chinese-big5-1'. | |
138 (define-ccl-program ccl-internal-to-big5-2 | |
139 '(((r1 = (((((r0 - #x21) * 94) + r1) - #x21) + 6280)) | |
140 (r0 = ((r1 / 157) + #xA1)) | |
141 (r1 %= 157) | |
142 (if (r1 < #x3F) (r1 += #x40) (r1 += #x62)))) | |
143 "CCL program to convert internal Big5 code (level2) to code point of Big5 font.") | |
144 | |
145 (set-charset-ccl-program 'chinese-big5-1 ccl-internal-to-big5-1) | |
146 (set-charset-ccl-program 'chinese-big5-2 ccl-internal-to-big5-2) | |
147 | |
148 ;; This isn't used and doesn't work yet because CCL doesn't know | |
149 ;; how to handle things like 'chinese-big5-1 currently. The | |
150 ;; original of this program had 152 (the leading byte) in place of | |
151 ;; chinese-big5-1, etc., but that will never do. No exposing of | |
152 ;; leading bytes to the Lisp level! | |
153 ;(define-ccl-program ccl-big5-to-internal | |
154 ; '(0 | |
155 ; ((if (r0 < #xC9) | |
156 ; ((r2 = (((r0 - #xA1) * 157) + r1)) | |
157 ; (r0 = chinese-big5-1)) | |
158 ; ((r2 = (((r0 - #xC9) * 157) + r1)) | |
159 ; (r0 = chinese-big5-2))) | |
160 ; (if (r1 < #x7F) (r2 -= #x40) (r2 -= #x62)) | |
161 ; (r1 = ((r2 / 94) + #x21)) | |
162 ; (r2 = ((r2 % 94) + #x21)) | |
163 ; )) | |
164 ; "CCL program to convert Big5 code to internal code.") | |
165 | |
166 (define-language-environment 'chinese | |
167 "Chinese (includes GB, Big5, and CNS)" | |
168 (lambda () | |
169 (require 'chinese) | |
170 (set-coding-category-system 'iso-8-2 'euc-china) | |
171 (set-coding-priority-list '(iso-8-2 big5 iso-8-designate)) | |
172 (set-default-file-coding-system 'euc-china) ; GB encoding | |
173 (setq terminal-coding-system 'euc-china) | |
174 (setq keyboard-coding-system 'euc-china) | |
175 (when (featurep 'egg) | |
176 (setq-default its:*current-map* (its:get-mode-map "PinYin"))) | |
177 (setq-default quail-current-package (assoc "py" quail-package-alist)))) | |
178 | |
179 (set-coding-category-system 'big5 'big5) |