comparison lisp/language/cyrillic.el @ 159:3bb7ccffb0c0 r20-3b6

Import from CVS: tag r20-3b6
author cvs
date Mon, 13 Aug 2007 09:41:43 +0200
parents
children 5a88923fcbfe
comparison
equal deleted inserted replaced
158:558dfa75ffb3 159:3bb7ccffb0c0
1 ;;; cyrillic.el --- Support for languages which use Cyrillic characters
2
3 ;; Copyright (C) 1995 Free Software Foundation, Inc.
4 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
5 ;; Copyright (C) 1997 MORIOKA Tomohiko
6
7 ;; Keywords: multilingual, Cyrillic
8
9 ;; This file is part of XEmacs.
10
11 ;; XEmacs is free software; you can redistribute it and/or modify it
12 ;; under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; any later version.
15
16 ;; XEmacs is distributed in the hope that it will be useful, but
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ;; General Public License for more details.
20
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with XEmacs; see the file COPYING. If not, write to the Free
23 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24 ;; 02111-1307, USA.
25
26 ;;; Commentary:
27
28 ;; The character set ISO8859-5 is supported. KOI-8 and ALTERNATIVNYJ
29 ;; are converted to ISO8859-5 internally.
30
31 ;;; Code:
32
33 ;; For syntax of Cyrillic
34 (modify-syntax-entry 'cyrillic-iso8859-5 "w")
35 (modify-syntax-entry ?,L-(B ".")
36 (modify-syntax-entry ?,Lp(B ".")
37 (modify-syntax-entry ?,L}(B ".")
38
39 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
40 ;;; CYRILLIC
41 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
42
43 (define-language-environment 'cyrillic
44 "Cyrillic"
45 (lambda ()
46 (set-coding-category-system 'iso-8-designate 'iso-8859-5)
47 (set-coding-priority-list '(iso-8-designate iso-8-1))
48 (set-default-buffer-file-coding-system 'iso-8859-5)
49 (setq terminal-coding-system 'iso-8859-5)
50 (setq keyboard-coding-system 'iso-8859-5)
51 ;; (setq-default quail-current-package
52 ;; (assoc "yawerty" quail-package-alist))
53 ))
54
55 ;; ISO-8859-5 staff
56
57 ;; (make-coding-system
58 ;; 'iso-8859-5 2 ?5 "MIME ISO-8859-5"
59 ;; '((ascii t) (cyrillic-iso8859-5 t) nil nil
60 ;; nil ascii-eol ascii-cntl nil nil nil nil))
61
62 (make-coding-system
63 'iso-8859-5 'iso2022
64 "MIME ISO-8859-5"
65 '(charset-g0 ascii
66 charset-g1 cyrillic-iso8859-5
67 charset-g2 t
68 charset-g3 t
69 mnemonic "ISO8/Cyr"
70 ))
71
72 ;; KOI-8 staff
73
74 (define-ccl-program ccl-decode-koi8
75 '(((read r0)
76 (loop
77 (write-read-repeat
78 r0
79 [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
80 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
81 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
82 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
83 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
84 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
85 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
86 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
87 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
88 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
89 32 32 32 ?,Lq(B 32 32 32 32 32 32 32 32 32 32 32 32
90 32 32 32 ?,L!(B 32 32 32 32 32 32 32 32 32 32 32 32
91 ?,Ln(B ?,LP(B ?,LQ(B ?,Lf(B ?,LT(B ?,LU(B ?,Ld(B ?,LS(B ?,Le(B ?,LX(B ?,LY(B ?,LZ(B ?,L[(B ?,L\(B ?,L](B ?,L^(B
92 ?,L_(B ?,Lo(B ?,L`(B ?,La(B ?,Lb(B ?,Lc(B ?,LV(B ?,LR(B ?,Ll(B ?,Lk(B ?,LW(B ?,Lh(B ?,Lm(B ?,Li(B ?,Lg(B ?,Lj(B
93 ?,LN(B ?,L0(B ?,L1(B ?,LF(B ?,L4(B ?,L5(B ?,LD(B ?,L3(B ?,LE(B ?,L8(B ?,L9(B ?,L:(B ?,L;(B ?,L<(B ?,L=(B ?,L>(B
94 ?,L?(B ?,LO(B ?,L@(B ?,LA(B ?,LB(B ?,LC(B ?,L6(B ?,L2(B ?,LL(B ?,LK(B ?,L7(B ?,LH(B ?,LM(B ?,LI(B ?,LG(B ?,LJ(B ]))))
95 "CCL program to decode KOI8.")
96
97 (define-ccl-program ccl-encode-koi8
98 '(((read r0)
99 (loop
100 (if (r0 != 140) ; lc-crl == 140
101 (write-read-repeat r0)
102 ((read r0)
103 (r0 -= 160)
104 (write-read-repeat
105 r0
106 [ 32 179 32 32 32 32 32 32 32 32 32 32 32 32 32 32
107 225 226 247 231 228 229 246 250 233 234 235 236 237 238 239 240
108 242 243 244 245 230 232 227 254 251 253 255 249 248 252 224 241
109 193 194 215 199 196 197 214 218 201 202 203 204 205 206 207 208
110 210 211 212 213 198 200 195 222 219 221 223 217 216 220 192 209
111 32 163 32 32 32 32 32 32 32 32 32 32 32 32 32 32])
112 )))))
113 "CCL program to encode KOI8.")
114
115 ;; (make-coding-system
116 ;; 'koi8-r 4
117 ;; ?K "Coding-system used for KOI8."
118 ;; (cons ccl-decode-koi8 ccl-encode-koi8))
119
120 (make-coding-system
121 'koi8-r 'ccl
122 "Coding-system used for KOI8."
123 `(decode ,ccl-decode-koi8
124 encode ,ccl-encode-koi8
125 mnemonic "KOI8"))
126
127 ;;(define-coding-system-alias 'koi8-r 'koi8)
128
129 (define-ccl-program ccl-encode-koi8-font
130 '(((r1 -= 160)
131 (r1 = r1
132 [ 32 179 32 32 32 32 32 32 32 32 32 32 32 32 32 32
133 225 226 247 231 228 229 246 250 233 234 235 236 237 238 239 240
134 242 243 244 245 230 232 227 254 251 253 255 249 248 252 224 241
135 193 194 215 199 196 197 214 218 201 202 203 204 205 206 207 208
136 210 211 212 213 198 200 195 222 219 221 223 217 216 220 192 209
137 32 163 32 32 32 32 32 32 32 32 32 32 32 32 32 32])
138 ))
139 "CCL program to encode Cyrillic chars to KOI font.")
140
141 ;; (setq font-ccl-encoder-alist
142 ;; (cons (cons "koi8" ccl-encode-koi8-font) font-ccl-encoder-alist))
143
144 ;;; ALTERNATIVNYJ staff
145
146 (define-ccl-program ccl-decode-alternativnyj
147 '(((read r0)
148 (loop
149 (write-read-repeat
150 r0
151 [ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
152 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
153 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
154 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
155 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
156 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
157 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
158 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
159 ?,L0(B ?,L1(B ?,L2(B ?,L3(B ?,L4(B ?,L5(B ?,L6(B ?,L7(B ?,L8(B ?,L9(B ?,L:(B ?,L;(B ?,L<(B ?,L=(B ?,L>(B ?,L?(B
160 ?,L@(B ?,LA(B ?,LB(B ?,LC(B ?,LD(B ?,LE(B ?,LF(B ?,LG(B ?,LH(B ?,LI(B ?,LJ(B ?,LK(B ?,LL(B ?,LM(B ?,LN(B ?,LO(B
161 ?,LP(B ?,LQ(B ?,LR(B ?,LS(B ?,LT(B ?,LU(B ?,LV(B ?,LW(B ?,LX(B ?,LY(B ?,LZ(B ?,L[(B ?,L\(B ?,L](B ?,L^(B ?,L_(B
162 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
163 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
164 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
165 ?,L`(B ?,La(B ?,Lb(B ?,Lc(B ?,Ld(B ?,Le(B ?,Lf(B ?,Lg(B ?,Lh(B ?,Li(B ?,Lj(B ?,Lk(B ?,Ll(B ?,Lm(B ?,Ln(B ?,Lo(B
166 ?,L!(B ?,Lq(B 32 32 32 32 32 32 32 32 32 32 32 32 32 ?,Lp(B]))))
167 "CCL program to decode Alternativnyj.")
168
169 (define-ccl-program ccl-encode-alternativnyj
170 '(((read r0)
171 (loop
172 (if (r0 != 140) ; lc-crl == 140
173 (write-read-repeat r0)
174 ((read r0)
175 (r0 -= 160)
176 (write-read-repeat
177 r0
178 [ 32 240 32 32 32 32 32 32 32 32 32 32 32 32 32 32
179 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
180 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
181 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
182 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
183 255 241 32 32 32 32 32 32 32 32 32 32 32 32 32 32])
184 )))))
185 "CCL program to encode Alternativnyj.")
186
187 ;; (make-coding-system
188 ;; 'alternativnyj 4
189 ;; ?A "Coding-system used for Alternativnyj"
190 ;; (cons ccl-decode-alternativnyj ccl-encode-alternativnyj))
191
192 (make-coding-system
193 'alternativnyj 'ccl
194 "Coding-system used for Alternativnyj"
195 `(decode ,ccl-decode-alternativnyj
196 encode ,ccl-encode-alternativnyj
197 mnemonic "Cy.Alt"))
198
199 (define-ccl-program ccl-encode-alternativnyj-font
200 '(((r1 -= 160)
201 (r1 = r1
202 [ 32 240 32 32 32 32 32 32 32 32 32 32 32 32 32 32
203 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
204 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
205 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
206 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
207 255 241 32 32 32 32 32 32 32 32 32 32 32 32 32 32])
208 ))
209 "CCL program to encode Cyrillic chars to Alternativnyj font.")
210
211 ;; (setq font-ccl-encoder-alist
212 ;; (cons (cons "alternativnyj" ccl-encode-alternativnyj-font)
213 ;; font-ccl-encoder-alist))
214
215 ;;; GENERAL
216
217 (register-input-method
218 "Cyrillic" '("quail-jcuken" quail-use-package "quail/cyrillic"))
219 (register-input-method
220 "Cyrillic" '("quail-macedonian" quail-use-package "quail/cyrillic"))
221 (register-input-method
222 "Cyrillic" '("quail-serbian" quail-use-package "quail/cyrillic"))
223 (register-input-method
224 "Cyrillic" '("quail-beylorussian" quail-use-package "quail/cyrillic"))
225 (register-input-method
226 "Cyrillic" '("quail-ukrainian" quail-use-package "quail/cyrillic"))
227 (register-input-method
228 "Cyrillic" '("quail-yawerty" quail-use-package "quail/cyrillic"))
229
230 (defun setup-cyrillic-environment ()
231 "Setup multilingual environment for Cyrillic users."
232 (interactive)
233 (setq primary-language "Cyrillic")
234
235 (setq coding-category-iso-8-1 'iso-8859-5)
236
237 (set-coding-priority
238 '(coding-category-iso-7
239 coding-category-iso-8-1))
240
241 (setq-default buffer-file-coding-system 'iso-8859-5)
242 (set-terminal-coding-system 'iso-8859-5)
243 (set-keyboard-coding-system 'iso-8859-5)
244
245 (setq default-input-method '("Cyrillic" . "quail-yawerty"))
246 )
247
248 (defun describe-cyrillic-support ()
249 "Describe how Emacs support Cyrillic."
250 (interactive)
251 (describe-language-support-internal "Cyrillic"))
252
253 (set-language-info-alist
254 "Cyrillic" '((setup-function . setup-cyrillic-environment)
255 (describe-function . describe-cyrillic-support)
256 (charset . (cyrillic-iso8859-5))
257 (coding-system . (iso-8859-5 koi8 alternativnyj))
258 (sample-text . "Russian (,L@caaZXY(B) ,L7T`PRabRcYbU(B!")
259 (documentation . nil)))
260
261 ;;; cyrillic.el ends here