Improve index entries. Remove redundant/useless ones.
[emacs.git] / lisp / language / cyrillic.el
blob656f6b600963c75630340299148e32973e3fd4f5
1 ;;; cyrillic.el --- support for Cyrillic -*- coding: iso-2022-7bit; -*-
3 ;; Copyright (C) 1997, 1998, 2001, 2002, 2003, 2004, 2005, 2006, 2007
4 ;; Free Software Foundation, Inc.
5 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
6 ;; 2005, 2006, 2007
7 ;; National Institute of Advanced Industrial Science and Technology (AIST)
8 ;; Registration Number H14PRO021
10 ;; Author: Kenichi Handa <handa@etl.go.jp>
11 ;; Keywords: multilingual, Cyrillic, i18n
13 ;; This file is part of GNU Emacs.
15 ;; GNU Emacs is free software; you can redistribute it and/or modify
16 ;; it under the terms of the GNU General Public License as published by
17 ;; the Free Software Foundation; either version 2, or (at your option)
18 ;; any later version.
20 ;; GNU Emacs is distributed in the hope that it will be useful,
21 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;; GNU General Public License for more details.
25 ;; You should have received a copy of the GNU General Public License
26 ;; along with GNU Emacs; see the file COPYING. If not, write to the
27 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
28 ;; Boston, MA 02110-1301, USA.
30 ;;; Commentary:
32 ;; The character set ISO8859-5 is supported. KOI-8 and ALTERNATIVNYJ
33 ;; are converted to Unicode internally. See
34 ;; <URL:http://www.ecma.ch/ecma1/STAND/ECMA-113.HTM>. For more info
35 ;; on Cyrillic charsets, see
36 ;; <URL:http://czyborra.com/charsets/cyrillic.html>. The KOI and
37 ;; Alternativnyj coding systems should live in code-pages.el, but
38 ;; they've always been preloaded and the coding system autoload
39 ;; mechanism didn't get accepted, so they have to stay here and
40 ;; duplicate code-pages stuff.
42 ;; Note that 8859-5 maps directly onto the Unicode Cyrillic block,
43 ;; apart from codepoints 160 (NBSP, c.f. U+0400), 173 (soft hyphen,
44 ;; c.f. U+04OD) and 253 (section sign, c.f U+045D). The KOI-8 and
45 ;; Alternativnyj coding systems encode both 8859-5 and Unicode.
46 ;; ucs-tables.el provides unification for cyrillic-iso-8bit.
48 ;; Customizing `utf-fragment-on-decoding' allows decoding characters
49 ;; from KOI and Alternativnyj into 8859-5 where that's possible.
50 ;; cyrillic-iso8859-5 characters take half as much space in the buffer
51 ;; as the mule-unicode-0100-24ff equivalents, though that's probably
52 ;; not normally a big deal.
54 ;;; Code:
56 ;; Cyrillic (general)
58 ;; ISO-8859-5 stuff
60 (make-coding-system
61 'cyrillic-iso-8bit 2 ?5
62 "ISO 2022 based 8-bit encoding for Cyrillic script (MIME:ISO-8859-5)."
63 '(ascii cyrillic-iso8859-5 nil nil
64 nil nil nil nil nil nil nil nil nil nil nil t)
65 '((safe-charsets ascii cyrillic-iso8859-5)
66 (mime-charset . iso-8859-5)))
68 (define-coding-system-alias 'iso-8859-5 'cyrillic-iso-8bit)
70 (set-language-info-alist
71 "Cyrillic-ISO" '((charset cyrillic-iso8859-5)
72 (coding-system cyrillic-iso-8bit)
73 (coding-priority cyrillic-iso-8bit)
74 (input-method . "cyrillic-yawerty") ; fixme
75 (nonascii-translation . cyrillic-iso8859-5)
76 (unibyte-display . cyrillic-iso-8bit)
77 (features cyril-util)
78 (sample-text . "Russian (\e,L@caaZXY\e(B) \e,L7T`PRabRcYbU\e(B!")
79 (documentation . "Support for Cyrillic ISO-8859-5."))
80 '("Cyrillic"))
82 ;; KOI-8R stuff
84 ;; The mule-unicode portion of this is from
85 ;; http://www.unicode.org/Public/MAPPINGS/VENDORS/MISC/KOI8-R.TXT,
86 ;; which references RFC 1489.
87 (defvar cyrillic-koi8-r-decode-table
89 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
90 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
91 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
92 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
93 64 65 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?\e$,1(5\e(B ?\e$,1(D\e(B ?\e$,1(3\e(B ?\e$,1(E\e(B ?\e$,1(8\e(B ?\e$,1(9\e(B ?\e$,1(:\e(B ?\e$,1(;\e(B ?\e$,1(<\e(B ?\e$,1(=\e(B ?\e$,1(>\e(B
114 ;; ?\e$,1(?\e(B ?\e$,1(O\e(B ?\e$,1(@\e(B ?\e$,1(A\e(B ?\e$,1(B\e(B ?\e$,1(C\e(B ?\e$,1(6\e(B ?\e$,1(2\e(B ?\e$,1(L\e(B ?\e$,1(K\e(B ?\e$,1(7\e(B ?\e$,1(H\e(B ?\e$,1(M\e(B ?\e$,1(I\e(B ?\e$,1(G\e(B ?\e$,1(J\e(B
116 "Cyrillic KOI8-R decoding table.")
118 (let ((table (make-translation-table-from-vector
119 cyrillic-koi8-r-decode-table)))
120 (define-translation-table 'cyrillic-koi8-r-nonascii-translation-table table)
121 (define-translation-table 'cyrillic-koi8-r-encode-table
122 (char-table-extra-slot table 0)))
124 ;; No point in keeping it around. (It can't be let-bound, since it's
125 ;; needed for macro expansion.)
126 (makunbound 'cyrillic-koi8-r-decode-table)
128 (define-ccl-program ccl-decode-koi8
130 ((loop
131 (r0 = 0)
132 (read r1)
133 (if (r1 < 128)
134 (write-repeat r1)
135 ((translate-character cyrillic-koi8-r-nonascii-translation-table r0 r1)
136 (translate-character ucs-translation-table-for-decode r0 r1)
137 (write-multibyte-character r0 r1)
138 (repeat))))))
139 "CCL program to decode KOI8-R.")
141 (define-ccl-program ccl-encode-koi8
143 ((loop
144 (read-multibyte-character r0 r1)
145 (translate-character cyrillic-koi8-r-encode-table r0 r1)
146 (if (r0 != ,(charset-id 'ascii))
147 (if (r0 != ,(charset-id 'eight-bit-graphic))
148 (if (r0 != ,(charset-id 'eight-bit-control))
149 (r1 = ??))))
150 (write-repeat r1))))
151 "CCL program to encode KOI8-R.")
153 (defun cyrillic-unify-encoding (table)
154 "Set up equivalent characters in the encoding TABLE.
155 This works whether or not the table is Unicode-based or
156 8859-5-based. (Only appropriate for Cyrillic.)"
157 (let ((table (get table 'translation-table)))
158 (dotimes (i 96)
159 (let* ((c (make-char 'cyrillic-iso8859-5 (+ i 32)))
160 (u ; equivalent Unicode char
161 (cond ((eq c ?\e,L \e(B) ?\e,A \e(B)
162 ((eq c ?\e,L-\e(B) ?\e,A-\e(B)
163 ((eq c ?\e,L}\e(B) ?\e,A'\e(B)
164 (t (decode-char 'ucs (+ #x400 i)))))
165 (ec (aref table c)) ; encoding of 8859-5
166 (uc (aref table u))) ; encoding of Unicode
167 (unless (memq c '(?\e,L \e(B ?\e,L-\e(B ?\e,L}\e(B)) ; 8859-5 exceptions
168 (unless uc
169 (aset table u ec))
170 (unless ec
171 (aset table c uc)))))))
173 (cyrillic-unify-encoding 'cyrillic-koi8-r-encode-table)
175 (make-coding-system
176 'cyrillic-koi8 4
177 ;; We used to use ?K. It is true that ?K is more strictly correct,
178 ;; but it is also used for Korean.
179 ;; So people who use koi8 for languages other than Russian
180 ;; will have to forgive us.
181 ?R "KOI8-R 8-bit encoding for Cyrillic (MIME: KOI8-R)."
182 '(ccl-decode-koi8 . ccl-encode-koi8)
183 `((safe-chars . cyrillic-koi8-r-encode-table)
184 (mime-charset . koi8-r)
185 (valid-codes (0 . 255))
186 (dependency unify-8859-on-encoding-mode unify-8859-on-decoding-mode)))
188 (define-coding-system-alias 'koi8-r 'cyrillic-koi8)
189 (define-coding-system-alias 'koi8 'cyrillic-koi8)
190 (define-coding-system-alias 'cp878 'cyrillic-koi8)
192 (let ((elt `("koi8-r" koi8-r 1
193 ,(get 'cyrillic-koi8-r-encode-table 'translation-table)))
194 (slot (assoc "koi8-r" ctext-non-standard-encodings-alist)))
195 (if slot
196 (setcdr slot (cdr elt))
197 (push elt ctext-non-standard-encodings-alist)))
199 ;; Allow displaying some of KOI & al with an 8859-5-encoded font. We
200 ;; won't bother about the exceptions when encoding the font, since
201 ;; NBSP will fall through below and work anyhow, and we'll have
202 ;; avoided setting the fontset for the other two to 8859-5 -- they're
203 ;; not in KOI and Alternativnyj anyhow.
204 (define-ccl-program ccl-encode-8859-5-font
206 ((if (r0 == ,(charset-id 'cyrillic-iso8859-5))
207 (r1 += 128)
208 (if (r0 == ,(charset-id 'mule-unicode-0100-24ff))
209 (r1 = (r2 + 128))))))
210 "Encode ISO 8859-5 and Cyrillic Unicode chars to 8859-5 font.")
212 (add-to-list 'font-ccl-encoder-alist '("iso8859-5" . ccl-encode-8859-5-font))
214 ;; The table is set up later to encode both Unicode and 8859-5.
215 (define-ccl-program ccl-encode-koi8-font
217 (if (r2 >= 0)
218 ((r1 <<= 7)
219 (r1 += r2)))
220 (translate-character cyrillic-koi8-r-encode-table r0 r1))
221 "CCL program to encode Cyrillic chars to KOI font.")
223 (add-to-list 'font-ccl-encoder-alist '("koi8" . ccl-encode-koi8-font))
225 (set-language-info-alist
226 "Cyrillic-KOI8" `((charset cyrillic-iso8859-5)
227 (nonascii-translation
228 . ,(get 'cyrillic-koi8-r-nonascii-translation-table
229 'translation-table))
230 (coding-system cyrillic-koi8)
231 (coding-priority cyrillic-koi8 cyrillic-iso-8bit)
232 (ctext-non-standard-encodings "koi8-r")
233 (input-method . "russian-typewriter")
234 (features cyril-util)
235 (unibyte-display . cyrillic-koi8)
236 (sample-text . "Russian (\e,L@caaZXY\e(B) \e,L7T`PRabRcYbU\e(B!")
237 (documentation . "Support for Cyrillic KOI8-R."))
238 '("Cyrillic"))
240 (set-language-info-alist
241 "Russian" `((charset cyrillic-iso8859-5)
242 (nonascii-translation
243 . ,(get 'cyrillic-koi8-r-nonascii-translation-table
244 'translation-table))
245 (coding-system cyrillic-koi8)
246 (coding-priority cyrillic-koi8 cyrillic-iso-8bit)
247 (input-method . "russian-computer")
248 (features cyril-util)
249 (unibyte-display . cyrillic-koi8)
250 (sample-text . "Russian (\e,L@caaZXY\e(B) \e,L7T`PRabRcYbU\e(B!")
251 (documentation . "\
252 Support for Russian using koi8-r and the russian-computer input method.")
253 (tutorial . "TUTORIAL.ru"))
254 '("Cyrillic"))
257 (defvar cyrillic-koi8-u-decode-table
259 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
260 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
261 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
262 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
263 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
264 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
265 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
266 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
267 ;; All Unicode:
268 ;; ?\e$,2 \e(B ?\e$,2 "\e(B ?\e$,2 ,\e(B ?\e$,2 0\e(B ?\e$,2 4\e(B ?\e$,2 8\e(B ?\e$,2 <\e(B ?\e$,2 D\e(B ?\e$,2 L\e(B ?\e$,2 T\e(B ?\e$,2 \\e(B ?\e$,2!@\e(B ?\e$,2!D\e(B ?\e$,2!H\e(B ?\e$,2!L\e(B ?\e$,2!P\e(B
269 ;; ?\e$,2!Q\e(B ?\e$,2!R\e(B ?\e$,2!S\e(B ?\e$,1{ \e(B ?\e$,2!`\e(B ?\e$,1x9\e(B ?\e$,1x:\e(B ?\e$,1xh\e(B ?\e$,1y$\e(B ?\e$,1y%\e(B ?\e,L \e(B ?\e$,1{!\e(B ?\e,A0\e(B ?\e,A2\e(B ?\e,A7\e(B ?\e,Aw\e(B
270 ;; ?\e$,2 p\e(B ?\e$,2 q\e(B ?\e$,2 r\e(B ?\e$,1(q\e(B ?\e$,1(t\e(B ?\e$,2 t\e(B ?\e$,1(v\e(B ?\e$,1(w\e(B ?\e$,2 w\e(B ?\e$,2 x\e(B ?\e$,2 y\e(B ?\e$,2 z\e(B ?\e$,2 {\e(B ?\e$,1)Q\e(B ?\e$,2 }\e(B ?\e$,2 ~\e(B
271 ;; ?\e$,2 \x7f\e(B ?\e$,2! \e(B ?\e$,2!!\e(B ?\e$,1(!\e(B ?\e$,1($\e(B ?\e$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?\e,L`\e(B ?\e,La\e(B ?\e,Lb\e(B ?\e,Lc\e(B ?\e,LV\e(B ?\e,LR\e(B ?\e,Ll\e(B ?\e,Lk\e(B ?\e,LW\e(B ?\e,Lh\e(B ?\e,Lm\e(B ?\e,Li\e(B ?\e,Lg\e(B ?\e,Lj\e(B
283 ?\e,LN\e(B ?\e,L0\e(B ?\e,L1\e(B ?\e,LF\e(B ?\e,L4\e(B ?\e,L5\e(B ?\e,LD\e(B ?\e,L3\e(B ?\e,LE\e(B ?\e,L8\e(B ?\e,L9\e(B ?\e,L:\e(B ?\e,L;\e(B ?\e,L<\e(B ?\e,L=\e(B ?\e,L>\e(B
284 ?\e,L?\e(B ?\e,LO\e(B ?\e,L@\e(B ?\e,LA\e(B ?\e,LB\e(B ?\e,LC\e(B ?\e,L6\e(B ?\e,L2\e(B ?\e,LL\e(B ?\e,LK\e(B ?\e,L7\e(B ?\e,LH\e(B ?\e,LM\e(B ?\e,LI\e(B ?\e,LG\e(B ?\e,LJ\e(B
286 "Cyrillic KOI8-U decoding table.")
288 (let ((table (make-translation-table-from-vector
289 cyrillic-koi8-u-decode-table)))
290 (define-translation-table 'cyrillic-koi8-u-nonascii-translation-table table)
291 (define-translation-table 'cyrillic-koi8-u-encode-table
292 (char-table-extra-slot table 0)))
294 (makunbound 'cyrillic-koi8-u-decode-table)
296 (define-ccl-program ccl-decode-koi8-u
298 ((loop
299 (r0 = 0)
300 (read r1)
301 (if (r1 < 128)
302 (write-repeat r1)
303 ((translate-character cyrillic-koi8-u-nonascii-translation-table r0 r1)
304 (translate-character ucs-translation-table-for-decode r0 r1)
305 (write-multibyte-character r0 r1)
306 (repeat))))))
307 "CCL program to decode KOI8-U.")
309 (define-ccl-program ccl-encode-koi8-u
311 ((loop
312 (read-multibyte-character r0 r1)
313 (translate-character cyrillic-koi8-u-encode-table r0 r1)
314 (if (r0 != ,(charset-id 'ascii))
315 (if (r0 != ,(charset-id 'eight-bit-graphic))
316 (if (r0 != ,(charset-id 'eight-bit-control))
317 (r1 = ??))))
318 (write-repeat r1))))
319 "CCL program to encode KOI8-U.")
321 (cyrillic-unify-encoding 'cyrillic-koi8-u-encode-table)
323 (make-coding-system
324 'koi8-u 4
325 ?U "KOI8-U 8-bit encoding for Cyrillic (MIME: KOI8-U)"
326 '(ccl-decode-koi8-u . ccl-encode-koi8-u)
327 `((safe-chars . cyrillic-koi8-u-encode-table)
328 (mime-charset . koi8-u)
329 (valid-codes (0 . 255))
330 (dependency unify-8859-on-encoding-mode unify-8859-on-decoding-mode)))
332 (define-ccl-program ccl-encode-koi8-u-font
334 (translate-character cyrillic-koi8-u-encode-table r0 r1))
335 "CCL program to encode Cyrillic chars to KOI-U font.")
337 (add-to-list 'font-ccl-encoder-alist '("koi8-u" . ccl-encode-koi8-u-font))
339 (set-language-info-alist
340 "Ukrainian" `((coding-system koi8-u)
341 (coding-priority koi8-u)
342 (nonascii-translation
343 . ,(get 'cyrillic-koi8-u-nonascii-translation-table
344 'translation-table))
345 (input-method . "ukrainian-computer")
346 (documentation
347 . "Support for Ukrainian with KOI8-U character set."))
348 '("Cyrillic"))
350 ;;; ALTERNATIVNYJ stuff
352 ;; Fixme: It's unclear what's the correct table. I've found
353 ;; statements both that it's the same as cp866 and somewhat different,
354 ;; but nothing that looks really definitive.
355 (defvar cyrillic-alternativnyj-decode-table
357 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
358 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
359 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
360 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
361 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
362 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
363 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
364 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
365 ;; ?\e$,1(0\e(B ?\e$,1(1\e(B ?\e$,1(2\e(B ?\e$,1(3\e(B ?\e$,1(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with guesses for the Unicodes of the glyphs in the absence of a
383 ;; table.
384 ?\e,L!\e(B ?\e,Lq\e(B ?\e$,1ry\e(B ?\e$,1rx\e(B ?\e$,1%A\e(B ?\e$,1%@\e(B ?\e$,1s:\e(B ?\e$,1s9\e(B ?\e$,1vq\e(B ?\e$,1vs\e(B ?\e,A1\e(B ?\e,Aw\e(B ?\e,Lp\e(B ?\e,A$\e(B ?\e$,2!`\e(B ?\e,L \e(B]
385 "Cyrillic ALTERNATIVNYJ decoding table.")
387 (let ((table (make-translation-table-from-vector
388 cyrillic-alternativnyj-decode-table)))
389 (define-translation-table 'cyrillic-alternativnyj-nonascii-translation-table
390 table)
391 (define-translation-table 'cyrillic-alternativnyj-encode-table
392 (char-table-extra-slot table 0)))
394 (makunbound 'cyrillic-alternativnyj-decode-table)
396 (define-ccl-program ccl-decode-alternativnyj
398 ((loop
399 (r0 = 0)
400 (read r1)
401 (if (r1 < 128)
402 (write-repeat r1)
403 ((translate-character cyrillic-alternativnyj-nonascii-translation-table
404 r0 r1)
405 (translate-character ucs-translation-table-for-decode r0 r1)
406 (write-multibyte-character r0 r1)
407 (repeat))))))
408 "CCL program to decode Alternativnyj.")
410 (define-ccl-program ccl-encode-alternativnyj
412 ((loop
413 (read-multibyte-character r0 r1)
414 (translate-character cyrillic-alternativnyj-encode-table r0 r1)
415 (if (r0 != ,(charset-id 'ascii))
416 (if (r0 != ,(charset-id 'eight-bit-graphic))
417 (if (r0 != ,(charset-id 'eight-bit-control))
418 (r1 = ??))))
419 (write-repeat r1))))
420 "CCL program to encode Alternativnyj.")
422 (cyrillic-unify-encoding 'cyrillic-alternativnyj-encode-table)
424 (make-coding-system
425 'cyrillic-alternativnyj 4 ?A
426 "ALTERNATIVNYJ 8-bit encoding for Cyrillic."
427 '(ccl-decode-alternativnyj . ccl-encode-alternativnyj)
428 `((safe-chars . cyrillic-alternativnyj-encode-table)
429 (valid-codes (0 . 255))
430 (dependency unify-8859-on-encoding-mode unify-8859-on-decoding-mode)))
432 (define-coding-system-alias 'alternativnyj 'cyrillic-alternativnyj)
434 (define-ccl-program ccl-encode-alternativnyj-font
436 (translate-character cyrillic-alternativnyj-encode-table r0 r1))
437 "CCL program to encode Cyrillic chars to Alternativnyj font.")
439 (add-to-list 'font-ccl-encoder-alist
440 '("alternativnyj" . ccl-encode-alternativnyj-font))
442 (set-language-info-alist
443 "Cyrillic-ALT" `((charset cyrillic-iso8859-5)
444 (nonascii-translation
445 . ,(get 'cyrillic-alternativnyj-nonascii-translation-table
446 'translation-table))
447 (coding-system cyrillic-alternativnyj)
448 (coding-priority cyrillic-alternativnyj)
449 (input-method . "russian-typewriter")
450 (features cyril-util)
451 (unibyte-display . cyrillic-alternativnyj)
452 (sample-text . "Russian (\e,L@caaZXY\e(B) \e,L7T`PRabRcYbU\e(B!")
453 (documentation . "Support for Cyrillic ALTERNATIVNYJ."))
454 '("Cyrillic"))
456 (set-language-info-alist
457 "Tajik" `((coding-system cyrillic-koi8-t)
458 (coding-priority cyrillic-koi8-t)
459 (nonascii-translation
460 . ,(get 'decode-koi8-t 'translation-table))
461 (input-method . "russian-typewriter") ; fixme?
462 (features code-pages)
463 (documentation . "Support for Tajik using KOI8-T."))
464 '("Cyrillic"))
466 (eval-and-compile
467 (setq
468 non-iso-charset-alist
469 (cp-make-coding-system
470 windows-1251
471 [?\\e$,1("\e(B ?\\e$,1(#\e(B ?\\e$,1rz\e(B ?\\e$,1(s\e(B ?\\e$,1r~\e(B ?\\e$,1s&\e(B ?\\e$,1s \e(B ?\\e$,1s!\e(B ?\\e$,1tL\e(B ?\\e$,1s0\e(B ?\\e$,1()\e(B ?\\e$,1s9\e(B ?\\e$,1(*\e(B ?\\e$,1(,\e(B ?\\e$,1(+\e(B ?\\e$,1(/\e(B ?\\e$,1(r\e(B
472 ?\\e$,1rx\e(B ?\\e$,1ry\e(B ?\\e$,1r|\e(B ?\\e$,1r}\e(B ?\\e$,1s"\e(B ?\\e$,1rs\e(B ?\\e$,1rt\e(B nil ?\\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\e(B ?\\e$,1(T\e(B ?\\e$,1(U\e(B
477 ?\\e$,1(V\e(B ?\\e$,1(W\e(B ?\\e$,1(X\e(B ?\\e$,1(Y\e(B ?\\e$,1(Z\e(B ?\\e$,1([\e(B ?\\e$,1(\\e(B ?\\e$,1(]\e(B ?\\e$,1(^\e(B ?\\e$,1(_\e(B ?\\e$,1(`\e(B ?\\e$,1(a\e(B ?\\e$,1(b\e(B ?\\e$,1(c\e(B ?\\e$,1(d\e(B ?\\e$,1(e\e(B ?\\e$,1(f\e(B
478 ?\\e$,1(g\e(B ?\\e$,1(h\e(B ?\\e$,1(i\e(B ?\\e$,1(j\e(B ?\\e$,1(k\e(B ?\\e$,1(l\e(B ?\\e$,1(m\e(B ?\\e$,1(n\e(B ?\\e$,1(o\e(B] nil ?b)))
480 ;; Register cyrillic-iso8859-5 characters in the encode table of
481 ;; windows-1251.
482 (let ((table (get 'encode-windows-1251 'translation-table))
483 ;; Nth element is a cyrillic-iso8859-5 character encoded to a
484 ;; code (128 + N), or nil.
485 (vec [?\\e,L"\e(B ?\\e,L#\e(B nil ?\\e,Ls\e(B nil nil nil nil nil nil ?\\e,L)\e(B nil ?\\e,L*\e(B ?\\e,L,\e(B ?\\e,L+\e(B ?\\e,L/\e(B
486 ?\\e,Lr\e(B nil nil nil nil nil nil nil nil nil ?\\e,Ly\e(B nil ?\\e,Lz\e(B ?\\e,L|\e(B ?\\e,L{\e(B ?\\e,L\x7f\e(B
487 nil ?\\e,L.\e(B ?\\e,L~\e(B ?\\e,L(\e(B nil nil nil nil ?\\e,L!\e(B nil ?\\e,L$\e(B nil nil nil nil ?\\e,L'\e(B
488 nil nil ?\\e,L&\e(B ?\\e,Lv\e(B nil nil nil nil ?\\e,Lq\e(B ?\\e,Lp\e(B ?\\e,Lt\e(B nil ?\\e,Lx\e(B ?\\e,L%\e(B ?\\e,Lu\e(B ?\\e,Lw\e(B
489 ?\\e,L0\e(B ?\\e,L1\e(B ?\\e,L2\e(B ?\\e,L3\e(B ?\\e,L4\e(B ?\\e,L5\e(B ?\\e,L6\e(B ?\\e,L7\e(B ?\\e,L8\e(B ?\\e,L9\e(B ?\\e,L:\e(B ?\\e,L;\e(B ?\\e,L<\e(B ?\\e,L=\e(B ?\\e,L>\e(B ?\\e,L?\e(B
490 ?\\e,L@\e(B ?\\e,LA\e(B ?\\e,LB\e(B ?\\e,LC\e(B ?\\e,LD\e(B ?\\e,LE\e(B ?\\e,LF\e(B ?\\e,LG\e(B ?\\e,LH\e(B ?\\e,LI\e(B ?\\e,LJ\e(B ?\\e,LK\e(B ?\\e,LL\e(B ?\\e,LM\e(B ?\\e,LN\e(B ?\\e,LO\e(B
491 ?\\e,LP\e(B ?\\e,LQ\e(B ?\\e,LR\e(B ?\\e,LS\e(B ?\\e,LT\e(B ?\\e,LU\e(B ?\\e,LV\e(B ?\\e,LW\e(B ?\\e,LX\e(B ?\\e,LY\e(B ?\\e,LZ\e(B ?\\e,L[\e(B ?\\e,L\\e(B ?\\e,L]\e(B ?\\e,L^\e(B ?\\e,L_\e(B
492 ?\\e,L`\e(B ?\\e,La\e(B ?\\e,Lb\e(B ?\\e,Lc\e(B ?\\e,Ld\e(B ?\\e,Le\e(B ?\\e,Lf\e(B ?\\e,Lg\e(B ?\\e,Lh\e(B ?\\e,Li\e(B ?\\e,Lj\e(B ?\\e,Lk\e(B ?\\e,Ll\e(B ?\\e,Lm\e(B ?\\e,Ln\e(B ?\\e,Lo\e(B]))
493 (dotimes (i (length vec))
494 (if (aref vec i)
495 (aset table (aref vec i) (+ 128 i)))))
497 (define-coding-system-alias 'cp1251 'windows-1251)
499 (let ((elt `("microsoft-cp1251" windows-1251 1
500 ,(get 'encode-windows-1251 'translation-table)))
501 (slot (assoc "microsoft-cp1251" ctext-non-standard-encodings-alist)))
502 (if slot
503 (setcdr slot (cdr elt))
504 (push elt ctext-non-standard-encodings-alist)))
506 (define-ccl-program ccl-encode-windows-1251-font
508 ((if (r0 == ,(charset-id 'mule-unicode-0100-24ff))
509 ((r1 <<= 7)
510 (r1 += r2)))
511 (translate-character encode-windows-1251 r0 r1))))
513 (add-to-list 'font-ccl-encoder-alist
514 '("microsoft-cp1251" . ccl-encode-windows-1251-font))
516 (set-language-info-alist
517 "Bulgarian" `((coding-system windows-1251)
518 (coding-priority windows-1251)
519 (ctext-non-standard-encodings "microsoft-cp1251")
520 (overriding-fontspec
521 (,(get 'encode-windows-1251 'translation-table)
522 . (nil . "microsoft-cp1251"))
523 (,(get 'cyrillic-koi8-r-encode-table 'translation-table)
524 . (nil . "koi8-r")))
525 (nonascii-translation
526 . ,(get 'decode-windows-1251 'translation-table))
527 (input-method . "bulgarian-bds")
528 (documentation
529 . "Support for Bulgarian with windows-1251 character set.")
530 (tutorial . "TUTORIAL.bg"))
531 '("Cyrillic"))
533 (set-language-info-alist
534 "Belarusian" `((coding-system windows-1251)
535 (coding-priority windows-1251)
536 (ctext-non-standard-encodings "microsoft-cp1251")
537 (overriding-fontspec
538 (,(get 'encode-windows-1251 'translation-table)
539 . (nil . "microsoft-cp1251"))
540 (,(get 'cyrillic-koi8-r-encode-table 'translation-table)
541 . (nil . "koi8-r")))
542 (nonascii-translation
543 . ,(get 'decode-windows-1251 'translation-table))
544 (input-method . "belarusian")
545 (documentation
546 . "Support for Belarusian with windows-1251 character set.
547 \(The name Belarusian replaced Byelorussian in the early 1990s.)"))
548 '("Cyrillic"))
550 (provide 'cyrillic)
552 ;;; arch-tag: bda71ae0-ba41-4cb6-a6e0-1dff542313d3
553 ;;; cyrillic.el ends here