333
|
1 ;;; cyrillic.el --- Support for languages which use Cyrillic characters
|
|
2
|
|
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
|
|
4 ;; Licensed to the Free Software Foundation.
|
|
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-prefix-command 'describe-cyrillic-environment-map)
|
|
44 ;; (define-key-after describe-language-environment-map [Cyrillic]
|
|
45 ;; '("Cyrillic" . describe-cyrillic-environment-map)
|
|
46 ;; t)
|
|
47
|
|
48 ;; (define-prefix-command 'setup-cyrillic-environment-map)
|
|
49 ;; (define-key-after setup-language-environment-map [Cyrillic]
|
|
50 ;; '("Cyrillic" . setup-cyrillic-environment-map)
|
|
51 ;; t)
|
|
52
|
|
53
|
|
54 ;; ISO-8859-5 staff
|
|
55
|
|
56 ;; (make-coding-system
|
|
57 ;; 'cyrillic-iso-8bit 2 ?5
|
|
58 ;; "ISO 2022 based 8-bit encoding for Cyrillic script (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 ;; (define-coding-system-alias 'iso-8859-5 'cyrillic-iso-8bit)
|
|
63
|
|
64 (make-coding-system
|
|
65 'iso-8859-5 'iso2022
|
|
66 "MIME ISO-8859-5"
|
|
67 '(charset-g0 ascii
|
|
68 charset-g1 cyrillic-iso8859-5
|
|
69 charset-g2 t
|
|
70 charset-g3 t
|
|
71 mnemonic "ISO8/Cyr"
|
|
72 ))
|
|
73
|
|
74 (set-language-info-alist
|
|
75 "Cyrillic-ISO" '((setup-function . (setup-cyrillic-iso-environment
|
|
76 . setup-cyrillic-environment-map))
|
|
77 (charset . (cyrillic-iso8859-5))
|
|
78 (tutorial . "TUTORIAL.ru")
|
|
79 (coding-system . (iso-8859-5))
|
|
80 (sample-text . "Russian (,L@caaZXY(B) ,L7T`PRabRcYbU(B!")
|
|
81 (documentation . ("Support for Cyrillic ISO-8859-5."
|
|
82 . describe-cyrillic-environment-map))))
|
|
83
|
357
|
84 (defun setup-cyrillic-iso-environment ()
|
|
85 "Setup multilingual environment (MULE) for Cyrillic ISO-8859-5 users."
|
|
86 (interactive)
|
|
87 (setup-english-environment)
|
|
88 (set-coding-category-system 'iso-8-1 'iso-8859-5)
|
|
89 (set-coding-priority-list
|
|
90 '(iso-8-1))
|
|
91 (set-default-coding-systems 'iso-8859-5))
|
|
92
|
333
|
93 ;; KOI-8 staff
|
|
94
|
|
95 (define-ccl-program ccl-decode-koi8
|
|
96 '(3
|
|
97 ((read r0)
|
|
98 (loop
|
|
99 (write-read-repeat
|
|
100 r0
|
|
101 [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
|
102 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
|
103 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
|
104 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
|
105 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
|
106 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
|
107 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
|
|
108 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
|
|
109 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
|
|
110 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
|
|
111 32 32 32 ?,Lq(B 32 32 32 32 32 32 32 32 32 32 32 32
|
|
112 32 32 32 ?,L!(B 32 32 32 32 32 32 32 32 32 32 32 32
|
|
113 ?,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
|
|
114 ?,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
|
|
115 ?,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
|
|
116 ?,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 ]))))
|
|
117 "CCL program to decode KOI8.")
|
|
118
|
|
119 (define-ccl-program ccl-encode-koi8
|
|
120 `(1
|
|
121 ((read r0)
|
|
122 (loop
|
|
123 (if (r0 != ,(charset-id 'cyrillic-iso8859-5))
|
|
124 (write-read-repeat r0)
|
|
125 ((read r0)
|
|
126 (r0 -= 160)
|
|
127 (write-read-repeat
|
|
128 r0
|
|
129 [ 32 179 32 32 32 32 32 32 32 32 32 32 32 32 32 32
|
|
130 225 226 247 231 228 229 246 250 233 234 235 236 237 238 239 240
|
|
131 242 243 244 245 230 232 227 254 251 253 255 249 248 252 224 241
|
|
132 193 194 215 199 196 197 214 218 201 202 203 204 205 206 207 208
|
|
133 210 211 212 213 198 200 195 222 219 221 223 217 216 220 192 209
|
|
134 32 163 32 32 32 32 32 32 32 32 32 32 32 32 32 32])
|
|
135 )))))
|
|
136 "CCL program to encode KOI8.")
|
|
137
|
|
138 ;(make-coding-system
|
|
139 ; 'cyrillic-koi8 4
|
|
140 ; ;; We used to use ?K. It is true that ?K is more strictly correct,
|
|
141 ; ;; but it is also used for Korean.
|
|
142 ; ;; So people who use koi8 for languages other than Russian
|
|
143 ; ;; will have to forgive us.
|
|
144 ; ?R "KOI8 8-bit encoding for Cyrillic (MIME: KOI8-R)"
|
|
145 ; (cons ccl-decode-koi8 ccl-encode-koi8))
|
|
146
|
|
147 ;(define-coding-system-alias 'koi8-r 'cyrillic-koi8)
|
|
148 ;(define-coding-system-alias 'koi8 'cyrillic-koi8)
|
|
149
|
|
150 (make-coding-system
|
|
151 'koi8-r 'ccl
|
|
152 "Coding-system used for KOI8-R."
|
|
153 `(decode ,ccl-decode-koi8
|
|
154 encode ,ccl-encode-koi8
|
|
155 mnemonic "KOI8"))
|
|
156
|
|
157 ;(define-coding-system-alias 'koi8-r 'koi8)
|
|
158
|
|
159 ;; (define-ccl-program ccl-encode-koi8-font
|
|
160 ;; '(0
|
|
161 ;; ((r1 -= 160)
|
|
162 ;; (r1 = r1
|
|
163 ;; [ 32 179 32 32 32 32 32 32 32 32 32 32 32 32 32 32
|
|
164 ;; 225 226 247 231 228 229 246 250 233 234 235 236 237 238 239 240
|
|
165 ;; 242 243 244 245 230 232 227 254 251 253 255 249 248 252 224 241
|
|
166 ;; 193 194 215 199 196 197 214 218 201 202 203 204 205 206 207 208
|
|
167 ;; 210 211 212 213 198 200 195 222 219 221 223 217 216 220 192 209
|
|
168 ;; 32 163 32 32 32 32 32 32 32 32 32 32 32 32 32 32])
|
|
169 ;; ))
|
|
170 ;; "CCL program to encode Cyrillic chars to KOI font.")
|
|
171
|
|
172 ;; (setq font-ccl-encoder-alist
|
|
173 ;; (cons (cons "koi8" ccl-encode-koi8-font) font-ccl-encoder-alist))
|
|
174
|
|
175 (set-language-info-alist
|
|
176 "Cyrillic-KOI8" '((setup-function . (setup-cyrillic-koi8-environment
|
|
177 . setup-cyrillic-environment-map))
|
|
178 (charset . (cyrillic-iso8859-5))
|
|
179 (coding-system . (koi8-r))
|
|
180 (tutorial . "TUTORIAL.ru")
|
|
181 (sample-text . "Russian (,L@caaZXY(B) ,L7T`PRabRcYbU(B!")
|
|
182 (documentation . ("Support for Cyrillic KOI-8."
|
|
183 . describe-cyrillic-environment-map))))
|
|
184
|
357
|
185 (defun setup-cyrillic-koi8-environment ()
|
|
186 "Setup multilingual environment (MULE) for Cyrillic KOI8 users."
|
|
187 (interactive)
|
|
188 (setup-english-environment)
|
|
189 (set-coding-category-system 'iso-8-1 'koi8-r)
|
|
190 (set-coding-priority-list
|
|
191 '(iso-8-1))
|
|
192 (set-default-coding-systems 'koi8-r))
|
|
193
|
333
|
194 ;;; ALTERNATIVNYJ staff
|
|
195
|
|
196 (define-ccl-program ccl-decode-alternativnyj
|
|
197 '(3
|
|
198 ((read r0)
|
|
199 (loop
|
|
200 (write-read-repeat
|
|
201 r0
|
|
202 [ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
|
203 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
|
204 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
|
205 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
|
206 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
|
207 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
|
208 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
|
|
209 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
|
|
210 ?,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
|
|
211 ?,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
|
|
212 ?,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
|
|
213 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
|
|
214 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
|
|
215 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
|
|
216 ?,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
|
|
217 ?,L!(B ?,Lq(B 32 32 32 32 32 32 32 32 32 32 32 32 32 ?,Lp(B]))))
|
|
218 "CCL program to decode Alternativnyj.")
|
|
219
|
|
220 (define-ccl-program ccl-encode-alternativnyj
|
|
221 `(1
|
|
222 ((read r0)
|
|
223 (loop
|
|
224 (if (r0 != ,(charset-id 'cyrillic-iso8859-5))
|
|
225 (write-read-repeat r0)
|
|
226 ((read r0)
|
|
227 (r0 -= 160)
|
|
228 (write-read-repeat
|
|
229 r0
|
|
230 [ 32 240 32 32 32 32 32 32 32 32 32 32 32 32 32 32
|
|
231 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
|
|
232 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
|
|
233 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
|
|
234 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
|
|
235 255 241 32 32 32 32 32 32 32 32 32 32 32 32 32 32])
|
|
236 )))))
|
|
237 "CCL program to encode Alternativnyj.")
|
|
238
|
|
239 ;; (make-coding-system
|
|
240 ;; 'alternativnyj 4
|
|
241 ;; ?A "Coding-system used for Alternativnyj"
|
|
242 ;; (cons ccl-decode-alternativnyj ccl-encode-alternativnyj))
|
|
243
|
|
244 (make-coding-system
|
|
245 'alternativnyj 'ccl
|
|
246 "Coding-system used for Alternativnyj"
|
|
247 `(decode ,ccl-decode-alternativnyj
|
|
248 encode ,ccl-encode-alternativnyj
|
|
249 mnemonic "Cy.Alt"))
|
|
250
|
|
251 ;; (define-ccl-program ccl-encode-alternativnyj-font
|
|
252 ;; '(0
|
|
253 ;; ((r1 -= 160)
|
|
254 ;; (r1 = r1
|
|
255 ;; [ 32 240 32 32 32 32 32 32 32 32 32 32 32 32 32 32
|
|
256 ;; 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
|
|
257 ;; 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
|
|
258 ;; 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
|
|
259 ;; 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
|
|
260 ;; 255 241 32 32 32 32 32 32 32 32 32 32 32 32 32 32])
|
|
261 ;; ))
|
|
262 ;; "CCL program to encode Cyrillic chars to Alternativnyj font.")
|
|
263
|
|
264 ;; (setq font-ccl-encoder-alist
|
|
265 ;; (cons (cons "alternativnyj" ccl-encode-alternativnyj-font)
|
|
266 ;; font-ccl-encoder-alist))
|
|
267
|
|
268 (set-language-info-alist
|
|
269 "Cyrillic-ALT" '((setup-function . (setup-cyrillic-alternativnyj-environment
|
|
270 . setup-cyrillic-environment-map))
|
|
271 (charset . (cyrillic-iso8859-5))
|
|
272 (coding-system . (alternativnyj))
|
|
273 (tutorial . "TUTORIAL.ru")
|
|
274 (sample-text . "Russian (,L@caaZXY(B) ,L7T`PRabRcYbU(B!")
|
|
275 (documentation . ("Support for Cyrillic ALTERNATIVNYJ."
|
|
276 . describe-cyrillic-environment-map))))
|
|
277
|
357
|
278 (defun setup-cyrillic-alternativnyj-environment ()
|
|
279 "Setup multilingual environment (MULE) for Cyrillic ALTERNATIVNYJ users."
|
|
280 (interactive)
|
|
281 (setup-english-environment)
|
|
282 (set-coding-category-system 'iso-8-1 'alternativnyj)
|
|
283 (set-coding-priority-list
|
|
284 '(iso-8-1))
|
|
285 (set-default-coding-systems 'alternativnyj))
|
|
286
|
333
|
287 ;;; GENERAL
|
|
288
|
|
289 (defun setup-cyrillic-environment ()
|
|
290 "Setup multilingual environment for Cyrillic users."
|
|
291 (interactive)
|
357
|
292 (set-coding-category-system 'iso-8-1 'iso-8859-5)
|
|
293 (set-coding-priority-list
|
|
294 '(iso-8-1))
|
333
|
295
|
357
|
296 (set-default-coding-systems 'iso-8859-5)
|
333
|
297
|
357
|
298 (setq default-input-method 'cyrillic-yawerty)
|
333
|
299 )
|
|
300
|
|
301 (set-language-info-alist
|
|
302 "Cyrillic" '((setup-function . setup-cyrillic-environment)
|
|
303 (charset . (cyrillic-iso8859-5))
|
|
304 (tutorial . "TUTORIAL.ru")
|
|
305 (coding-system . (iso-8859-5 koi8-r alternativnyj))
|
|
306 (sample-text . "Russian (,L@caaZXY(B) ,L7T`PRabRcYbU(B!")
|
|
307 (documentation . nil)))
|
|
308
|
|
309 ;;; cyrillic.el ends here
|