(latexenc-find-file-coding-system): Don't inherit the EOL part of the
[emacs.git] / lisp / language / cyrillic.el
blobea7f6b0624bfcdaab99dfd8597d081918daac44b
1 ;;; cyrillic.el --- support for Cyrillic -*- coding: iso-2022-7bit; -*-
3 ;; Copyright (C) 1997, 1998, 2001, 2002, 2003 Free Software Foundation, Inc.
4 ;; Copyright (C) 1995, 1997, 1998, 1999, 2000, 2002, 2003, 2004
5 ;; National Institute of Advanced Industrial Science and Technology (AIST)
6 ;; Registration Number H14PRO021
8 ;; Author: Kenichi Handa <handa@etl.go.jp>
9 ;; Keywords: multilingual, Cyrillic, i18n
11 ;; This file is part of GNU Emacs.
13 ;; GNU Emacs is free software; you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by
15 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; any later version.
18 ;; GNU Emacs is distributed in the hope that it will be useful,
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;; GNU General Public License for more details.
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
26 ;; Boston, MA 02111-1307, USA.
28 ;;; Commentary:
30 ;; The character set ISO8859-5 is supported. KOI-8 and ALTERNATIVNYJ
31 ;; are converted to Unicode internally. See
32 ;; <URL:http://www.ecma.ch/ecma1/STAND/ECMA-113.HTM>. For more info
33 ;; on Cyrillic charsets, see
34 ;; <URL:http://czyborra.com/charsets/cyrillic.html>. The KOI and
35 ;; Alternativnyj coding systems should live in code-pages.el, but
36 ;; they've always been preloaded and the coding system autoload
37 ;; mechanism didn't get accepted, so they have to stay here and
38 ;; duplicate code-pages stuff.
40 ;; Note that 8859-5 maps directly onto the Unicode Cyrillic block,
41 ;; apart from codepoints 160 (NBSP, c.f. U+0400), 173 (soft hyphen,
42 ;; c.f. U+04OD) and 253 (section sign, c.f U+045D). The KOI-8 and
43 ;; Alternativnyj coding systems encode both 8859-5 and Unicode.
44 ;; ucs-tables.el provides unification for cyrillic-iso-8bit.
46 ;; Customizing `utf-fragment-on-decoding' allows decoding characters
47 ;; from KOI and Alternativnyj into 8859-5 where that's possible.
48 ;; cyrillic-iso8859-5 characters take half as much space in the buffer
49 ;; as the mule-unicode-0100-24ff equivalents, though that's probably
50 ;; not normally a big deal.
52 ;;; Code:
54 ;; Cyrillic (general)
56 ;; ISO-8859-5 stuff
58 (make-coding-system
59 'cyrillic-iso-8bit 2 ?5
60 "ISO 2022 based 8-bit encoding for Cyrillic script (MIME:ISO-8859-5)."
61 '(ascii cyrillic-iso8859-5 nil nil
62 nil nil nil nil nil nil nil nil nil nil nil t)
63 '((safe-charsets ascii cyrillic-iso8859-5)
64 (mime-charset . iso-8859-5)))
66 (define-coding-system-alias 'iso-8859-5 'cyrillic-iso-8bit)
68 (set-language-info-alist
69 "Cyrillic-ISO" '((charset cyrillic-iso8859-5)
70 (coding-system cyrillic-iso-8bit)
71 (coding-priority cyrillic-iso-8bit)
72 (input-method . "cyrillic-yawerty") ; fixme
73 (nonascii-translation . cyrillic-iso8859-5)
74 (unibyte-display . cyrillic-iso-8bit)
75 (features cyril-util)
76 (sample-text . "Russian (\e,L@caaZXY\e(B) \e,L7T`PRabRcYbU\e(B!")
77 (documentation . "Support for Cyrillic ISO-8859-5."))
78 '("Cyrillic"))
80 ;; KOI-8R stuff
82 ;; The mule-unicode portion of this is from
83 ;; http://www.unicode.org/Public/MAPPINGS/VENDORS/MISC/KOI8-R.TXT,
84 ;; which references RFC 1489.
85 (defvar cyrillic-koi8-r-decode-table
87 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
88 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
89 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
90 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
91 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
92 80 81 82 83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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
112 ;; ?\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
114 "Cyrillic KOI8-R decoding table.")
116 (let ((table (make-translation-table-from-vector
117 cyrillic-koi8-r-decode-table)))
118 (define-translation-table 'cyrillic-koi8-r-nonascii-translation-table table)
119 (define-translation-table 'cyrillic-koi8-r-encode-table
120 (char-table-extra-slot table 0)))
122 ;; No point in keeping it around. (It can't be let-bound, since it's
123 ;; needed for macro expansion.)
124 (makunbound 'cyrillic-koi8-r-decode-table)
126 (define-ccl-program ccl-decode-koi8
128 ((loop
129 (r0 = 0)
130 (read r1)
131 (if (r1 < 128)
132 (write-repeat r1)
133 ((translate-character cyrillic-koi8-r-nonascii-translation-table r0 r1)
134 (translate-character ucs-translation-table-for-decode r0 r1)
135 (write-multibyte-character r0 r1)
136 (repeat))))))
137 "CCL program to decode KOI8-R.")
139 (define-ccl-program ccl-encode-koi8
141 ((loop
142 (read-multibyte-character r0 r1)
143 (translate-character cyrillic-koi8-r-encode-table r0 r1)
144 (if (r0 != ,(charset-id 'ascii))
145 (if (r0 != ,(charset-id 'eight-bit-graphic))
146 (if (r0 != ,(charset-id 'eight-bit-control))
147 (r1 = ??))))
148 (write-repeat r1))))
149 "CCL program to encode KOI8-R.")
151 (defun cyrillic-unify-encoding (table)
152 "Set up equivalent characters in the encoding TABLE.
153 This works whether or not the table is Unicode-based or
154 8859-5-based. (Only appropriate for Cyrillic.)"
155 (let ((table (get table 'translation-table)))
156 (dotimes (i 96)
157 (let* ((c (make-char 'cyrillic-iso8859-5 (+ i 32)))
158 (u ; equivalent Unicode char
159 (cond ((eq c ?\e,L \e(B) ?\e,A \e(B)
160 ((eq c ?\e,L-\e(B) ?\e,A-\e(B)
161 ((eq c ?\e,L}\e(B) ?\e,A'\e(B)
162 (t (decode-char 'ucs (+ #x400 i)))))
163 (ec (aref table c)) ; encoding of 8859-5
164 (uc (aref table u))) ; encoding of Unicode
165 (unless (memq c '(?\e,L \e(B ?\e,L-\e(B ?\e,L}\e(B)) ; 8859-5 exceptions
166 (unless uc
167 (aset table u ec))
168 (unless ec
169 (aset table c uc)))))))
171 (cyrillic-unify-encoding 'cyrillic-koi8-r-encode-table)
173 (make-coding-system
174 'cyrillic-koi8 4
175 ;; We used to use ?K. It is true that ?K is more strictly correct,
176 ;; but it is also used for Korean.
177 ;; So people who use koi8 for languages other than Russian
178 ;; will have to forgive us.
179 ?R "KOI8-R 8-bit encoding for Cyrillic (MIME: KOI8-R)."
180 '(ccl-decode-koi8 . ccl-encode-koi8)
181 `((safe-chars . cyrillic-koi8-r-encode-table)
182 (mime-charset . koi8-r)
183 (valid-codes (0 . 255))
184 (dependency unify-8859-on-encoding-mode unify-8859-on-decoding-mode)))
186 (define-coding-system-alias 'koi8-r 'cyrillic-koi8)
187 (define-coding-system-alias 'koi8 'cyrillic-koi8)
188 (define-coding-system-alias 'cp878 'cyrillic-koi8)
190 (let ((elt `("koi8-r" koi8-r 1
191 ,(get 'cyrillic-koi8-r-encode-table 'translation-table)))
192 (slot (assoc "koi8-r" ctext-non-standard-encodings-alist)))
193 (if slot
194 (setcdr slot (cdr elt))
195 (push elt ctext-non-standard-encodings-alist)))
197 ;; Allow displaying some of KOI & al with an 8859-5-encoded font. We
198 ;; won't bother about the exceptions when encoding the font, since
199 ;; NBSP will fall through below and work anyhow, and we'll have
200 ;; avoided setting the fontset for the other two to 8859-5 -- they're
201 ;; not in KOI and Alternativnyj anyhow.
202 (define-ccl-program ccl-encode-8859-5-font
204 ((if (r0 == ,(charset-id 'cyrillic-iso8859-5))
205 (r1 += 128)
206 (if (r0 == ,(charset-id 'mule-unicode-0100-24ff))
207 (r1 = (r2 + 128))))))
208 "Encode ISO 8859-5 and Cyrillic Unicode chars to 8859-5 font.")
210 (add-to-list 'font-ccl-encoder-alist '("iso8859-5" . ccl-encode-8859-5-font))
212 ;; The table is set up later to encode both Unicode and 8859-5.
213 (define-ccl-program ccl-encode-koi8-font
215 (if (r2 >= 0)
216 ((r1 <<= 7)
217 (r1 += r2)))
218 (translate-character cyrillic-koi8-r-encode-table r0 r1))
219 "CCL program to encode Cyrillic chars to KOI font.")
221 (add-to-list 'font-ccl-encoder-alist '("koi8" . ccl-encode-koi8-font))
223 (set-language-info-alist
224 "Cyrillic-KOI8" `((charset cyrillic-iso8859-5)
225 (nonascii-translation
226 . ,(get 'cyrillic-koi8-r-nonascii-translation-table
227 'translation-table))
228 (coding-system cyrillic-koi8)
229 (coding-priority cyrillic-koi8 cyrillic-iso-8bit)
230 (ctext-non-standard-encodings "koi8-r")
231 (input-method . "russian-typewriter")
232 (features cyril-util)
233 (unibyte-display . cyrillic-koi8)
234 (sample-text . "Russian (\e,L@caaZXY\e(B) \e,L7T`PRabRcYbU\e(B!")
235 (documentation . "Support for Cyrillic KOI8-R."))
236 '("Cyrillic"))
238 (set-language-info-alist
239 "Russian" `((charset cyrillic-iso8859-5)
240 (nonascii-translation
241 . ,(get 'cyrillic-koi8-r-nonascii-translation-table
242 'translation-table))
243 (coding-system cyrillic-koi8)
244 (coding-priority cyrillic-koi8 cyrillic-iso-8bit)
245 (input-method . "russian-computer")
246 (features cyril-util)
247 (unibyte-display . cyrillic-koi8)
248 (sample-text . "Russian (\e,L@caaZXY\e(B) \e,L7T`PRabRcYbU\e(B!")
249 (documentation . "\
250 Support for Russian using koi8-r and the russian-computer input method.")
251 (tutorial . "TUTORIAL.ru"))
252 '("Cyrillic"))
255 (defvar cyrillic-koi8-u-decode-table
257 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
258 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
259 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
260 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
261 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
262 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
263 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
264 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
265 ;; All Unicode:
266 ;; ?\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
267 ;; ?\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
268 ;; ?\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
269 ;; ?\e$,2 \x7f\e(B ?\e$,2! \e(B ?\e$,2!!\e(B ?\e$,1(!\e(B ?\e$,1($\e(B ?\e$,2!#\e(B ?\e$,1(&\e(B ?\e$,1('\e(B ?\e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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
281 ?\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
282 ?\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
284 "Cyrillic KOI8-U decoding table.")
286 (let ((table (make-translation-table-from-vector
287 cyrillic-koi8-u-decode-table)))
288 (define-translation-table 'cyrillic-koi8-u-nonascii-translation-table table)
289 (define-translation-table 'cyrillic-koi8-u-encode-table
290 (char-table-extra-slot table 0)))
292 (makunbound 'cyrillic-koi8-u-decode-table)
294 (define-ccl-program ccl-decode-koi8-u
296 ((loop
297 (r0 = 0)
298 (read r1)
299 (if (r1 < 128)
300 (write-repeat r1)
301 ((translate-character cyrillic-koi8-u-nonascii-translation-table r0 r1)
302 (translate-character ucs-translation-table-for-decode r0 r1)
303 (write-multibyte-character r0 r1)
304 (repeat))))))
305 "CCL program to decode KOI8-U.")
307 (define-ccl-program ccl-encode-koi8-u
309 ((loop
310 (read-multibyte-character r0 r1)
311 (translate-character cyrillic-koi8-u-encode-table r0 r1)
312 (if (r0 != ,(charset-id 'ascii))
313 (if (r0 != ,(charset-id 'eight-bit-graphic))
314 (if (r0 != ,(charset-id 'eight-bit-control))
315 (r1 = ??))))
316 (write-repeat r1))))
317 "CCL program to encode KOI8-U.")
319 (cyrillic-unify-encoding 'cyrillic-koi8-u-encode-table)
321 (make-coding-system
322 'koi8-u 4
323 ?U "KOI8-U 8-bit encoding for Cyrillic (MIME: KOI8-U)"
324 '(ccl-decode-koi8-u . ccl-encode-koi8-u)
325 `((safe-chars . cyrillic-koi8-u-encode-table)
326 (mime-charset . koi8-u)
327 (valid-codes (0 . 255))
328 (dependency unify-8859-on-encoding-mode unify-8859-on-decoding-mode)))
330 (define-ccl-program ccl-encode-koi8-u-font
332 (translate-character cyrillic-koi8-u-encode-table r0 r1))
333 "CCL program to encode Cyrillic chars to KOI-U font.")
335 (add-to-list 'font-ccl-encoder-alist '("koi8-u" . ccl-encode-koi8-u-font))
337 (set-language-info-alist
338 "Ukrainian" `((coding-system koi8-u)
339 (coding-priority koi8-u)
340 (nonascii-translation
341 . ,(get 'cyrillic-koi8-u-nonascii-translation-table
342 'translation-table))
343 (input-method . "ukrainian-computer")
344 (documentation
345 . "Support for Ukrainian with KOI8-U character set."))
346 '("Cyrillic"))
348 ;;; ALTERNATIVNYJ stuff
350 ;; Fixme: It's unclear what's the correct table. I've found
351 ;; statements both that it's the same as cp866 and somewhat different,
352 ;; but nothing that looks really definitive.
353 (defvar cyrillic-alternativnyj-decode-table
355 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
356 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
357 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
358 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
359 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
360 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
361 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
362 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
363 ;; ?\e$,1(0\e(B ?\e$,1(1\e(B ?\e$,1(2\e(B ?\e$,1(3\e(B ?\e$,1(4\e(B ?\e$,1(5\e(B ?\e$,1(6\e(B ?\e$,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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]
383 "Cyrillic ALTERNATIVNYJ decoding table.")
385 (let ((table (make-translation-table-from-vector
386 cyrillic-alternativnyj-decode-table)))
387 (define-translation-table 'cyrillic-alternativnyj-nonascii-translation-table
388 table)
389 (define-translation-table 'cyrillic-alternativnyj-encode-table
390 (char-table-extra-slot table 0)))
392 (makunbound 'cyrillic-alternativnyj-decode-table)
394 (define-ccl-program ccl-decode-alternativnyj
396 ((loop
397 (r0 = 0)
398 (read r1)
399 (if (r1 < 128)
400 (write-repeat r1)
401 ((translate-character cyrillic-alternativnyj-nonascii-translation-table
402 r0 r1)
403 (translate-character ucs-translation-table-for-decode r0 r1)
404 (write-multibyte-character r0 r1)
405 (repeat))))))
406 "CCL program to decode Alternativnyj.")
408 (define-ccl-program ccl-encode-alternativnyj
410 ((loop
411 (read-multibyte-character r0 r1)
412 (translate-character cyrillic-alternativnyj-encode-table r0 r1)
413 (if (r0 != ,(charset-id 'ascii))
414 (if (r0 != ,(charset-id 'eight-bit-graphic))
415 (if (r0 != ,(charset-id 'eight-bit-control))
416 (r1 = ??))))
417 (write-repeat r1))))
418 "CCL program to encode Alternativnyj.")
420 (cyrillic-unify-encoding 'cyrillic-alternativnyj-encode-table)
422 (make-coding-system
423 'cyrillic-alternativnyj 4 ?A
424 "ALTERNATIVNYJ 8-bit encoding for Cyrillic."
425 '(ccl-decode-alternativnyj . ccl-encode-alternativnyj)
426 `((safe-chars . cyrillic-alternativnyj-encode-table)
427 (valid-codes (0 . 255))
428 (dependency unify-8859-on-encoding-mode unify-8859-on-decoding-mode)))
430 (define-coding-system-alias 'alternativnyj 'cyrillic-alternativnyj)
432 (define-ccl-program ccl-encode-alternativnyj-font
434 (translate-character cyrillic-alternativnyj-encode-table r0 r1))
435 "CCL program to encode Cyrillic chars to Alternativnyj font.")
437 (add-to-list 'font-ccl-encoder-alist
438 '("alternativnyj" . ccl-encode-alternativnyj-font))
440 (set-language-info-alist
441 "Cyrillic-ALT" `((charset cyrillic-iso8859-5)
442 (nonascii-translation
443 . ,(get 'cyrillic-alternativnyj-nonascii-translation-table
444 'translation-table))
445 (coding-system cyrillic-alternativnyj)
446 (coding-priority cyrillic-alternativnyj)
447 (input-method . "russian-typewriter")
448 (features cyril-util)
449 (unibyte-display . cyrillic-alternativnyj)
450 (sample-text . "Russian (\e,L@caaZXY\e(B) \e,L7T`PRabRcYbU\e(B!")
451 (documentation . "Support for Cyrillic ALTERNATIVNYJ."))
452 '("Cyrillic"))
454 (set-language-info-alist
455 "Tajik" `((coding-system cyrillic-koi8-t)
456 (coding-priority cyrillic-koi8-t)
457 (nonascii-translation
458 . ,(get 'decode-koi8-t 'translation-table))
459 (input-method . "russian-typewriter") ; fixme?
460 (features code-pages)
461 (documentation . "Support for Tajik using KOI8-T."))
462 '("Cyrillic"))
464 (eval-and-compile
465 (setq
466 non-iso-charset-alist
467 (cp-make-coding-system
468 windows-1251
469 [?\\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
470 ?\\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 ?\\e$,1ub\e(B ?\\e$,1(y\e(B ?\\e$,1s:\e(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\\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
476 ?\\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)))
478 ;; Register cyrillic-iso8859-5 characters in the encode table of
479 ;; windows-1251.
480 (let ((table (get 'encode-windows-1251 'translation-table))
481 ;; Nth element is a cyrillic-iso8859-5 character encoded to a
482 ;; code (128 + N), or nil.
483 (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
484 ?\\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
485 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
486 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
487 ?\\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
488 ?\\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
489 ?\\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
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 (dotimes (i (length vec))
492 (if (aref vec i)
493 (aset table (aref vec i) (+ 128 i)))))
495 (define-coding-system-alias 'cp1251 'windows-1251)
497 (let ((elt `("microsoft-cp1251" windows-1251 1
498 ,(get 'encode-windows-1251 'translation-table)))
499 (slot (assoc "microsoft-cp1251" ctext-non-standard-encodings-alist)))
500 (if slot
501 (setcdr slot (cdr elt))
502 (push elt ctext-non-standard-encodings-alist)))
504 (define-ccl-program ccl-encode-windows-1251-font
506 ((if (r0 == ,(charset-id 'mule-unicode-0100-24ff))
507 ((r1 <<= 7)
508 (r1 += r2)))
509 (translate-character encode-windows-1251 r0 r1))))
511 (add-to-list 'font-ccl-encoder-alist
512 '("microsoft-cp1251" . ccl-encode-windows-1251-font))
514 (set-language-info-alist
515 "Bulgarian" `((coding-system windows-1251)
516 (coding-priority windows-1251)
517 (ctext-non-standard-encodings "microsoft-cp1251")
518 (overriding-fontspec
519 (,(get 'encode-windows-1251 'translation-table)
520 . (nil . "microsoft-cp1251"))
521 (,(get 'cyrillic-koi8-r-encode-table 'translation-table)
522 . (nil . "koi8-r")))
523 (nonascii-translation
524 . ,(get 'decode-windows-1251 'translation-table))
525 (input-method . "bulgarian-bds")
526 (documentation
527 . "Support for Bulgarian with windows-1251 character set.")
528 (tutorial . "TUTORIAL.bg"))
529 '("Cyrillic"))
531 (set-language-info-alist
532 "Belarusian" `((coding-system windows-1251)
533 (coding-priority windows-1251)
534 (ctext-non-standard-encodings "microsoft-cp1251")
535 (overriding-fontspec
536 (,(get 'encode-windows-1251 'translation-table)
537 . (nil . "microsoft-cp1251"))
538 (,(get 'cyrillic-koi8-r-encode-table 'translation-table)
539 . (nil . "koi8-r")))
540 (nonascii-translation
541 . ,(get 'decode-windows-1251 'translation-table))
542 (input-method . "belarusian")
543 (documentation
544 . "Support for Belarusian with windows-1251 character set.
545 \(The name Belarusian replaced Byelorussian in the early 1990s.)"))
546 '("Cyrillic"))
548 (provide 'cyrillic)
550 ;;; arch-tag: bda71ae0-ba41-4cb6-a6e0-1dff542313d3
551 ;;; cyrillic.el ends here