(ccl-encode-windows-1251-font): Rearrange
[bpt/emacs.git] / lisp / language / cyrillic.el
CommitLineData
60370d40 1;;; cyrillic.el --- support for Cyrillic -*- coding: iso-2022-7bit; -*-
4ed46869 2
4ed46869 3;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
b79e7b7b 4;; Licensed to the Free Software Foundation.
76509389 5;; Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
4ed46869 6
6f27e0f9
DL
7;; Author: Kenichi Handa <handa@etl.go.jp>
8;; Keywords: multilingual, Cyrillic, i18n
4ed46869
KH
9
10;; This file is part of GNU Emacs.
11
12;; GNU Emacs is free software; you can redistribute it and/or modify
13;; it under the terms of the GNU General Public License as published by
14;; the Free Software Foundation; either version 2, or (at your option)
15;; any later version.
16
17;; GNU Emacs is distributed in the hope that it will be useful,
18;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;; GNU General Public License for more details.
21
22;; You should have received a copy of the GNU General Public License
369314dc
KH
23;; along with GNU Emacs; see the file COPYING. If not, write to the
24;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25;; Boston, MA 02111-1307, USA.
4ed46869
KH
26
27;;; Commentary:
28
6f27e0f9
DL
29;; The character set ISO8859-5 is supported. KOI-8 and ALTERNATIVNYJ
30;; are converted to Unicode internally. See
31;; <URL:http://www.ecma.ch/ecma1/STAND/ECMA-113.HTM>. For more info
32;; on Cyrillic charsets, see
33;; <URL:http://czyborra.com/charsets/cyrillic.html>. The KOI and
34;; Alternativnyj coding systems should live in code-pages.el, but
35;; they've always been preloaded and the coding system autoload
36;; mechanism didn't get accepted, so they have to stay here and
37;; duplicate code-pages stuff.
38
39;; Note that 8859-5 maps directly onto the Unicode Cyrillic block,
40;; apart from codepoints 160 (NBSP, c.f. U+0400), 173 (soft hyphen,
41;; c.f. U+04OD) and 253 (section sign, c.f U+045D). The KOI-8 and
42;; Alternativnyj coding systems encode both 8859-5 and Unicode.
43;; ucs-tables.el provides unification for cyrillic-iso-8bit.
44
d98276be 45;; Customizing `utf-fragment-on-decoding' allows decoding characters
6f27e0f9
DL
46;; from KOI and Alternativnyj into 8859-5 where that's possible.
47;; cyrillic-iso8859-5 characters take half as much space in the buffer
48;; as the mule-unicode-0100-24ff equivalents, though that's probably
49;; not normally a big deal.
4ed46869
KH
50
51;;; Code:
52
5f1d80c7
KH
53;; Cyrillic (general)
54
6f27e0f9 55;; ISO-8859-5 stuff
2b01336d 56
4ed46869 57(make-coding-system
efbc7e89 58 'cyrillic-iso-8bit 2 ?5
5ef35063 59 "ISO 2022 based 8-bit encoding for Cyrillic script (MIME:ISO-8859-5)."
11b77f14 60 '(ascii cyrillic-iso8859-5 nil nil
6de22aea 61 nil nil nil nil nil nil nil nil nil nil nil t)
11b77f14
KH
62 '((safe-charsets ascii cyrillic-iso8859-5)
63 (mime-charset . iso-8859-5)))
4ed46869 64
71eabd24 65(define-coding-system-alias 'iso-8859-5 'cyrillic-iso-8bit)
efbc7e89 66
5f1d80c7 67(set-language-info-alist
a564ccf9 68 "Cyrillic-ISO" '((charset cyrillic-iso8859-5)
11b77f14
KH
69 (coding-system cyrillic-iso-8bit)
70 (coding-priority cyrillic-iso-8bit)
6f27e0f9 71 (input-method . "cyrillic-yawerty") ; fixme
a564ccf9
KH
72 (nonascii-translation . cyrillic-iso8859-5)
73 (unibyte-display . cyrillic-iso-8bit)
74 (features cyril-util)
5f1d80c7 75 (sample-text . "Russian (\e,L@caaZXY\e(B) \e,L7T`PRabRcYbU\e(B!")
11b77f14
KH
76 (documentation . "Support for Cyrillic ISO-8859-5."))
77 '("Cyrillic"))
5f1d80c7 78
6f27e0f9 79;; KOI-8R stuff
2b01336d 80
6f27e0f9
DL
81;; The mule-unicode portion of this is from
82;; http://www.unicode.org/Public/MAPPINGS/VENDORS/MISC/KOI8-R.TXT,
83;; which references RFC 1489.
70c58a1f
KH
84(defvar cyrillic-koi8-r-decode-table
85 [
86 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
87 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
88 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
89 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
90 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
91 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
92 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
93 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
6f27e0f9
DL
94 ;; 8859-5 plus Unicode
95 ?\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
96 ?\e$,2!Q\e(B ?\e$,2!R\e(B ?\e$,2!S\e(B ?\e$,1{ \e(B ?\e$,2!`\e(B ?\e$,1s"\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
97 ?\e$,2 p\e(B ?\e$,2 q\e(B ?\e$,2 r\e(B ?\e,Lq\e(B ?\e$,2 s\e(B ?\e$,2 t\e(B ?\e$,2 u\e(B ?\e$,2 v\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$,2 |\e(B ?\e$,2 }\e(B ?\e$,2 ~\e(B
98 ?\e$,2 \7f\e(B ?\e$,2! \e(B ?\e$,2!!\e(B ?\e,L!\e(B ?\e$,2!"\e(B ?\e$,2!#\e(B ?\e$,2!$\e(B ?\e$,2!%\e(B ?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1(h\e(B ?\e$,1(m\e(B ?\e$,1(i\e(B ?\e$,1(g\e(B ?\e$,1(j\e(B
110;; ?\e$,1(N\e(B ?\e$,1(0\e(B ?\e$,1(1\e(B ?\e$,1(F\e(B ?\e$,1(4\e(B ?\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
111;; ?\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
112 ]
70c58a1f
KH
113 "Cyrillic KOI8-R decoding table.")
114
1f487ef8
KH
115(let ((table (make-translation-table-from-vector
116 cyrillic-koi8-r-decode-table)))
117 (define-translation-table 'cyrillic-koi8-r-nonascii-translation-table table)
118 (define-translation-table 'cyrillic-koi8-r-encode-table
119 (char-table-extra-slot table 0)))
70c58a1f 120
6f27e0f9
DL
121;; No point in keeping it around. (It can't be let-bound, since it's
122;; needed for macro expansion.)
123(makunbound 'cyrillic-koi8-r-decode-table)
124
2b01336d 125(define-ccl-program ccl-decode-koi8
6f27e0f9 126 `(4
1f487ef8
KH
127 ((loop
128 (r0 = 0)
129 (read r1)
130 (if (r1 < 128)
131 (write-repeat r1)
132 ((translate-character cyrillic-koi8-r-nonascii-translation-table r0 r1)
d98276be 133 (translate-character ucs-translation-table-for-decode r0 r1)
1f487ef8
KH
134 (write-multibyte-character r0 r1)
135 (repeat))))))
6f27e0f9 136 "CCL program to decode KOI8-R.")
2b01336d
KH
137
138(define-ccl-program ccl-encode-koi8
139 `(1
1f487ef8
KH
140 ((loop
141 (read-multibyte-character r0 r1)
6f27e0f9 142 (translate-character cyrillic-koi8-r-encode-table r0 r1)
58566dff
KH
143 (if (r0 != ,(charset-id 'ascii))
144 (if (r0 != ,(charset-id 'eight-bit-graphic))
145 (if (r0 != ,(charset-id 'eight-bit-control))
146 (r1 = ??))))
1f487ef8 147 (write-repeat r1))))
6f27e0f9
DL
148 "CCL program to encode KOI8-R.")
149
150(defun cyrillic-unify-encoding (table)
151 "Set up equivalent characters in the encoding TABLE.
d98276be 152This works whether or not the table is Unicode-based or
6f27e0f9
DL
1538859-5-based. (Only appropriate for Cyrillic.)"
154 (let ((table (get table 'translation-table)))
155 (dotimes (i 96)
156 (let* ((c (make-char 'cyrillic-iso8859-5 (+ i 32)))
157 (u ; equivalent Unicode char
158 (cond ((eq c ?\e,L \e(B) ?\e,A \e(B)
159 ((eq c ?\e,L-\e(B) ?\e,A-\e(B)
160 ((eq c ?\e,L}\e(B) ?\e,A'\e(B)
161 (t (decode-char 'ucs (+ #x400 i)))))
162 (ec (aref table c)) ; encoding of 8859-5
163 (uc (aref table u))) ; encoding of Unicode
164 (unless (memq c '(?\e,L \e(B ?\e,L-\e(B ?\e,L}\e(B)) ; 8859-5 exceptions
165 (unless uc
166 (aset table u ec))
167 (unless ec
168 (aset table c uc)))))))
169
170(cyrillic-unify-encoding 'cyrillic-koi8-r-encode-table)
171
2b01336d 172(make-coding-system
4b9121fc 173 'cyrillic-koi8 4
49716ecd
RS
174 ;; We used to use ?K. It is true that ?K is more strictly correct,
175 ;; but it is also used for Korean.
176 ;; So people who use koi8 for languages other than Russian
177 ;; will have to forgive us.
6f27e0f9 178 ?R "KOI8-R 8-bit encoding for Cyrillic (MIME: KOI8-R)."
7fbf766f 179 '(ccl-decode-koi8 . ccl-encode-koi8)
6f27e0f9 180 `((safe-chars . cyrillic-koi8-r-encode-table)
70c58a1f 181 (mime-charset . koi8-r)
d98276be
KH
182 (valid-codes (0 . 255))
183 (dependency unify-8859-on-encoding-mode unify-8859-on-decoding-mode)))
2b01336d 184
71eabd24
RS
185(define-coding-system-alias 'koi8-r 'cyrillic-koi8)
186(define-coding-system-alias 'koi8 'cyrillic-koi8)
6f27e0f9
DL
187(define-coding-system-alias 'cp878 'cyrillic-koi8)
188
189;; Allow displaying some of KOI & al with an 8859-5-encoded font. We
190;; won't bother about the exceptions when encoding the font, since
191;; NBSP will fall through below and work anyhow, and we'll have
192;; avoided setting the fontset for the other two to 8859-5 -- they're
193;; not in KOI and Alternativnyj anyhow.
194(define-ccl-program ccl-encode-8859-5-font
195 `(0
196 ((if (r0 == ,(charset-id 'cyrillic-iso8859-5))
197 (r1 += 128)
198 (if (r0 == ,(charset-id 'mule-unicode-0100-24ff))
199 (r1 = (r2 + 128))))))
200 "Encode ISO 8859-5 and Cyrillic Unicode chars to 8859-5 font.")
201
202(add-to-list 'font-ccl-encoder-alist '("iso8859-5" . ccl-encode-8859-5-font))
2b01336d 203
6f27e0f9 204;; The table is set up later to encode both Unicode and 8859-5.
2b01336d 205(define-ccl-program ccl-encode-koi8-font
70c58a1f 206 `(0
fd162724
KH
207 (if (r2 >= 0)
208 ((r1 <<= 7)
209 (r1 += r2)))
6f27e0f9 210 (translate-character cyrillic-koi8-r-encode-table r0 r1))
2b01336d
KH
211 "CCL program to encode Cyrillic chars to KOI font.")
212
6f27e0f9 213(add-to-list 'font-ccl-encoder-alist '("koi8" . ccl-encode-koi8-font))
70c58a1f 214
5f1d80c7 215(set-language-info-alist
a564ccf9
KH
216 "Cyrillic-KOI8" `((charset cyrillic-iso8859-5)
217 (nonascii-translation
1f487ef8
KH
218 . ,(get 'cyrillic-koi8-r-nonascii-translation-table
219 'translation-table))
11b77f14 220 (coding-system cyrillic-koi8)
6f27e0f9 221 (coding-priority cyrillic-koi8 cyrillic-iso-8bit)
76509389 222 (input-method . "russian-typewriter")
a564ccf9
KH
223 (features cyril-util)
224 (unibyte-display . cyrillic-koi8)
5f1d80c7 225 (sample-text . "Russian (\e,L@caaZXY\e(B) \e,L7T`PRabRcYbU\e(B!")
70c58a1f 226 (documentation . "Support for Cyrillic KOI8-R."))
11b77f14 227 '("Cyrillic"))
5f1d80c7 228
76509389
DL
229(set-language-info-alist
230 "Russian" `((charset cyrillic-iso8859-5)
231 (nonascii-translation
232 . ,(get 'cyrillic-koi8-r-nonascii-translation-table
233 'translation-table))
234 (coding-system cyrillic-koi8)
235 (coding-priority cyrillic-koi8 cyrillic-iso-8bit)
236 (input-method . "russian-computer")
237 (features cyril-util)
238 (unibyte-display . cyrillic-koi8)
239 (sample-text . "Russian (\e,L@caaZXY\e(B) \e,L7T`PRabRcYbU\e(B!")
240 (documentation . "\
241Support for Russian using koi8-r and the russian-computer input method.")
242 (tutorial . "TUTORIAL.ru"))
243 '("Cyrillic"))
244
6f27e0f9
DL
245
246(defvar cyrillic-koi8-u-decode-table
247 [
248 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
249 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
250 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
251 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
252 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
253 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
254 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
255 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
256 ;; All Unicode:
257;; ?\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
258;; ?\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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B ?\e$,2!!\e(B ?\e,L!\e(B ?\e,L$\e(B ?\e$,2!#\e(B ?\e,L&\e(B ?\e,L'\e(B ?\e$,2!&\e(B ?\e$,2!'\e(B ?\e$,2!(\e(B ?\e$,2!)\e(B ?\e$,2!*\e(B ?\e$,1)P\e(B ?\e$,2!,\e(B ?\e,A)\e(B
270 ?\e,Ln\e(B ?\e,LP\e(B ?\e,LQ\e(B ?\e,Lf\e(B ?\e,LT\e(B ?\e,LU\e(B ?\e,Ld\e(B ?\e,LS\e(B ?\e,Le\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
271 ?\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,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
272 ?\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
273 ?\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
274 ]
275 "Cyrillic KOI8-U decoding table.")
276
277(let ((table (make-translation-table-from-vector
278 cyrillic-koi8-u-decode-table)))
279 (define-translation-table 'cyrillic-koi8-u-nonascii-translation-table table)
280 (define-translation-table 'cyrillic-koi8-u-encode-table
281 (char-table-extra-slot table 0)))
282
283(makunbound 'cyrillic-koi8-u-decode-table)
284
285(define-ccl-program ccl-decode-koi8-u
286 `(4
287 ((loop
288 (r0 = 0)
289 (read r1)
290 (if (r1 < 128)
291 (write-repeat r1)
292 ((translate-character cyrillic-koi8-u-nonascii-translation-table r0 r1)
d98276be 293 (translate-character ucs-translation-table-for-decode r0 r1)
6f27e0f9
DL
294 (write-multibyte-character r0 r1)
295 (repeat))))))
296 "CCL program to decode KOI8-U.")
297
298(define-ccl-program ccl-encode-koi8-u
299 `(1
300 ((loop
301 (read-multibyte-character r0 r1)
302 (translate-character cyrillic-koi8-u-encode-table r0 r1)
58566dff
KH
303 (if (r0 != ,(charset-id 'ascii))
304 (if (r0 != ,(charset-id 'eight-bit-graphic))
305 (if (r0 != ,(charset-id 'eight-bit-control))
306 (r1 = ??))))
6f27e0f9
DL
307 (write-repeat r1))))
308 "CCL program to encode KOI8-U.")
309
310(cyrillic-unify-encoding 'cyrillic-koi8-u-encode-table)
311
312(make-coding-system
313 'koi8-u 4
314 ?U "KOI8-U 8-bit encoding for Cyrillic (MIME: KOI8-U)"
315 '(ccl-decode-koi8-u . ccl-encode-koi8-u)
316 `((safe-chars . cyrillic-koi8-u-encode-table)
317 (mime-charset . koi8-u)
d98276be
KH
318 (valid-codes (0 . 255))
319 (dependency unify-8859-on-encoding-mode unify-8859-on-decoding-mode)))
6f27e0f9
DL
320
321(define-ccl-program ccl-encode-koi8-u-font
322 `(0
323 (translate-character cyrillic-koi8-u-encode-table r0 r1))
324 "CCL program to encode Cyrillic chars to KOI-U font.")
325
326(add-to-list 'font-ccl-encoder-alist '("koi8-u" . ccl-encode-koi8-u-font))
327
328(set-language-info-alist
329 "Ukrainian" `((coding-system koi8-u)
d98276be 330 (coding-priority koi8-u)
6f27e0f9 331 (nonascii-translation
b9e98de5 332 . ,(get 'cyrillic-koi8-u-nonascii-translation-table
6f27e0f9
DL
333 'translation-table))
334 (input-method . "ukrainian-computer")
d98276be
KH
335 (documentation
336 . "Support for Ukrainian with KOI8-U character set."))
6f27e0f9
DL
337 '("Cyrillic"))
338
339;;; ALTERNATIVNYJ stuff
2b01336d 340
b9e98de5
DL
341;; Fixme: It's unclear what's the correct table. I've found
342;; statements both that it's the same as cp866 and somewhat different,
1d5f8bfc 343;; but nothing that looks really definitive.
70c58a1f
KH
344(defvar cyrillic-alternativnyj-decode-table
345 [
346 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
347 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
348 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
349 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
350 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
351 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
352 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
353 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
6f27e0f9
DL
354;; ?\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$,1(7\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 ?\e$,1(?\e(B
355;; ?\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 ?\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
356;; ?\e$,1(P\e(B ?\e$,1(Q\e(B ?\e$,1(R\e(B ?\e$,1(S\e(B ?\e$,1(T\e(B ?\e$,1(U\e(B ?\e$,1(V\e(B ?\e$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\e(B ?\e$,2 ~\e(B ?\e$,2 \7f\e(B ?\e$,2 z\e(B ?\e$,2 t\e(B ?\e$,2!)\e(B ?\e$,2!&\e(B ?\e$,2! \e(B ?\e$,2 p\e(B ?\e$,2!,\e(B ?\e$,2!'\e(B
368 ?\e$,2!(\e(B ?\e$,2!$\e(B ?\e$,2!%\e(B ?\e$,2 y\e(B ?\e$,2 x\e(B ?\e$,2 r\e(B ?\e$,2 s\e(B ?\e$,2!+\e(B ?\e$,2!*\e(B ?\e$,2 8\e(B ?\e$,2 ,\e(B ?\e$,2!H\e(B ?\e$,2!D\e(B ?\e$,2!L\e(B ?\e$,2!P\e(B ?\e$,2!@\e(B
70c58a1f 369 ?\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
1d5f8bfc
KH
370 ;; Taken from http://www.cyrillic.com/ref/cyrillic/koi-8alt.html
371 ;; with guesses for the Unicodes of the glyphs in the absence of a
372 ;; table.
373 ?\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]
70c58a1f
KH
374 "Cyrillic ALTERNATIVNYJ decoding table.")
375
1f487ef8
KH
376(let ((table (make-translation-table-from-vector
377 cyrillic-alternativnyj-decode-table)))
378 (define-translation-table 'cyrillic-alternativnyj-nonascii-translation-table
70c58a1f 379 table)
1f487ef8
KH
380 (define-translation-table 'cyrillic-alternativnyj-encode-table
381 (char-table-extra-slot table 0)))
70c58a1f 382
6f27e0f9 383(makunbound 'cyrillic-alternativnyj-decode-table)
70c58a1f 384
2b01336d 385(define-ccl-program ccl-decode-alternativnyj
6f27e0f9 386 `(4
1f487ef8
KH
387 ((loop
388 (r0 = 0)
389 (read r1)
390 (if (r1 < 128)
391 (write-repeat r1)
392 ((translate-character cyrillic-alternativnyj-nonascii-translation-table
393 r0 r1)
d98276be 394 (translate-character ucs-translation-table-for-decode r0 r1)
1f487ef8
KH
395 (write-multibyte-character r0 r1)
396 (repeat))))))
2b01336d
KH
397 "CCL program to decode Alternativnyj.")
398
399(define-ccl-program ccl-encode-alternativnyj
400 `(1
1f487ef8
KH
401 ((loop
402 (read-multibyte-character r0 r1)
53a1db80 403 (translate-character cyrillic-alternativnyj-encode-table r0 r1)
58566dff
KH
404 (if (r0 != ,(charset-id 'ascii))
405 (if (r0 != ,(charset-id 'eight-bit-graphic))
406 (if (r0 != ,(charset-id 'eight-bit-control))
407 (r1 = ??))))
1f487ef8 408 (write-repeat r1))))
2b01336d 409 "CCL program to encode Alternativnyj.")
6f27e0f9
DL
410
411(cyrillic-unify-encoding 'cyrillic-alternativnyj-encode-table)
412
2b01336d 413(make-coding-system
efbc7e89 414 'cyrillic-alternativnyj 4 ?A
1d5f8bfc 415 "ALTERNATIVNYJ 8-bit encoding for Cyrillic."
7fbf766f 416 '(ccl-decode-alternativnyj . ccl-encode-alternativnyj)
6f27e0f9
DL
417 `((safe-chars . cyrillic-alternativnyj-encode-table)
418 (valid-codes (0 . 255))
d98276be 419 (dependency unify-8859-on-encoding-mode unify-8859-on-decoding-mode)))
2b01336d 420
71eabd24 421(define-coding-system-alias 'alternativnyj 'cyrillic-alternativnyj)
efbc7e89 422
2b01336d 423(define-ccl-program ccl-encode-alternativnyj-font
6f27e0f9
DL
424 `(0
425 (translate-character cyrillic-alternativnyj-encode-table r0 r1))
2b01336d
KH
426 "CCL program to encode Cyrillic chars to Alternativnyj font.")
427
6f27e0f9
DL
428(add-to-list 'font-ccl-encoder-alist
429 '("alternativnyj" . ccl-encode-alternativnyj-font))
2b01336d 430
4ed46869 431(set-language-info-alist
a564ccf9
KH
432 "Cyrillic-ALT" `((charset cyrillic-iso8859-5)
433 (nonascii-translation
1f487ef8
KH
434 . ,(get 'cyrillic-alternativnyj-nonascii-translation-table
435 'translation-table))
11b77f14
KH
436 (coding-system cyrillic-alternativnyj)
437 (coding-priority cyrillic-alternativnyj)
6f27e0f9 438 (input-method . "russian-typewriter")
a564ccf9
KH
439 (features cyril-util)
440 (unibyte-display . cyrillic-alternativnyj)
5f1d80c7 441 (sample-text . "Russian (\e,L@caaZXY\e(B) \e,L7T`PRabRcYbU\e(B!")
11b77f14
KH
442 (documentation . "Support for Cyrillic ALTERNATIVNYJ."))
443 '("Cyrillic"))
4ed46869 444
6f27e0f9
DL
445(set-language-info-alist
446 "Tajik" `((coding-system cyrillic-koi8-t)
76509389
DL
447 (coding-priority cyrillic-koi8-t)
448 (nonascii-translation
449 . ,(get 'decode-koi8-t 'translation-table))
450 (input-method . "russian-typewriter") ; fixme?
451 (features code-pages)
452 (documentation . "Support for Tajik using KOI8-T."))
6f27e0f9
DL
453 '("Cyrillic"))
454
a9707ecc
DL
455(eval-and-compile
456 (setq
457 non-iso-charset-alist
458 (cp-make-coding-system
459 windows-1251
460 [?\\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
461 ?\\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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(B ?\\e$,1(U\e(B
466 ?\\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
467 ?\\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)))
468
9e4eea3d
DL
469(define-coding-system-alias 'cp1251 'windows-1251)
470
52d8246c
KH
471(let ((elt `("microsoft-cp1251" windows-1251 1
472 ,(get 'encode-windows-1251 'translation-table)))
473 (slot (assoc "microsoft-cp1251" ctext-non-standard-encodings-alist)))
474 (if slot
475 (setcdr slot (cdr elt))
476 (push elt ctext-non-standard-encodings-alist)))
477
fd162724 478(define-ccl-program ccl-encode-windows-1251-font
6a8b9ce4
KH
479 `(0
480 ((if (r0 == ,(charset-id 'mule-unicode-0100-24ff))
481 ((r1 <<= 7)
482 (r1 += r2)))
483 (translate-character encode-windows-1251 r0 r1))))
fd162724
KH
484
485(add-to-list 'font-ccl-encoder-alist
486 '("microsoft-cp1251" . ccl-encode-windows-1251-font))
487
6f27e0f9
DL
488(set-language-info-alist
489 "Bulgarian" `((coding-system windows-1251)
52d8246c
KH
490 (coding-priority windows-1251)
491 (ctext-non-standard-encodings "microsoft-cp1251")
fd162724
KH
492 (overriding-fontspec
493 (,(get 'encode-windows-1251 'translation-table)
494 . (nil . "microsoft-cp1251"))
495 (,(get 'cyrillic-koi8-r-encode-table 'translation-table)
496 . (nil . "koi8-r")))
6f27e0f9
DL
497 (nonascii-translation
498 . ,(get 'decode-windows-1251 'translation-table))
1d5f8bfc 499 (input-method . "bulgarian-bds")
6f27e0f9 500 (documentation
76509389
DL
501 . "Support for Bulgarian with windows-1251 character set.")
502 (tutorial . "TUTORIAL.bg"))
6f27e0f9
DL
503 '("Cyrillic"))
504
505(set-language-info-alist
506 "Belarusian" `((coding-system windows-1251)
507 (coding-priority windows-1251)
52d8246c 508 (ctext-non-standard-encodings "microsoft-cp1251")
fd162724
KH
509 (overriding-fontspec
510 (,(get 'encode-windows-1251 'translation-table)
511 . (nil . "microsoft-cp1251"))
512 (,(get 'cyrillic-koi8-r-encode-table 'translation-table)
513 . (nil . "koi8-r")))
6f27e0f9
DL
514 (nonascii-translation
515 . ,(get 'decode-windows-1251 'translation-table))
516 (input-method . "belarusian")
6f27e0f9
DL
517 (documentation
518 . "Support for Belarusian with windows-1251 character set.
519\(The name Belarusian replaced Byelorussian in the early 1990s.)"))
520 '("Cyrillic"))
521
41da80b1
DL
522(provide 'cyrillic)
523
ab5796a9 524;;; arch-tag: bda71ae0-ba41-4cb6-a6e0-1dff542313d3
4ed46869 525;;; cyrillic.el ends here