1 ;;; cyrillic.el --- Support for Cyrillic -*- coding: iso-2022-7bit; -*-
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
4 ;; Licensed to the Free Software Foundation.
6 ;; Keywords: multilingual, Cyrillic
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
27 ;; The character set ISO8859-5 is supported. KOI-8 and ALTERNATIVNYJ
28 ;; are converted to ISO8859-5 internally.
37 'cyrillic-iso-8bit
2 ?
5
38 "ISO 2022 based 8-bit encoding for Cyrillic script (MIME:ISO-8859-5)"
39 '(ascii cyrillic-iso8859-5 nil nil
40 nil nil nil nil nil nil nil
)
41 '((safe-charsets ascii cyrillic-iso8859-5
)
42 (mime-charset . iso-8859-5
)))
44 (define-coding-system-alias 'iso-8859-5
'cyrillic-iso-8bit
)
46 (set-language-info-alist
47 "Cyrillic-ISO" '((charset cyrillic-iso8859-5
)
48 (coding-system cyrillic-iso-8bit
)
49 (coding-priority cyrillic-iso-8bit
)
50 (input-method .
"cyrillic-yawerty")
51 (nonascii-translation . cyrillic-iso8859-5
)
52 (unibyte-display . cyrillic-iso-8bit
)
54 (sample-text .
"Russian (\e,L@caaZXY\e(B) \e,L7T`PRabRcYbU\e(B!")
55 (documentation .
"Support for Cyrillic ISO-8859-5."))
62 (defvar cyrillic-koi8-r-decode-table
64 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
65 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
66 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
67 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
68 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
69 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
70 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
71 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
72 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
73 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
74 160 161 162 ?
\e,Lq
\e(B 164 165 166 167 168 169 170 171 172 173 174 175
75 176 177 178 ?
\e,L
!\e(B 180 181 182 183 184 185 186 187 188 189 190 191
76 ?
\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
77 ?
\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
78 ?
\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
79 ?
\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 ]
80 "Cyrillic KOI8-R decoding table.")
82 (defvar cyrillic-koi8-r-encode-table
83 (let ((table (make-vector 256 32))
86 (let* ((ch (aref cyrillic-koi8-r-decode-table i
))
87 (split (split-char ch
)))
88 (if (eq (car split
) 'cyrillic-iso8859-5
)
89 (aset table
(logior (nth 1 split
) 128) i
)
94 "Cyrillic KOI8-R encoding table.")
98 (define-ccl-program ccl-decode-koi8
102 (write-read-repeat r0
,cyrillic-koi8-r-decode-table
))))
103 "CCL program to decode KOI8.")
105 (define-ccl-program ccl-encode-koi8
109 (if (r0 != ,(charset-id 'cyrillic-iso8859-5
))
110 (write-read-repeat r0
)
112 (write-read-repeat r0
, cyrillic-koi8-r-encode-table
))))))
113 "CCL program to encode KOI8.")
117 ;; We used to use ?K. It is true that ?K is more strictly correct,
118 ;; but it is also used for Korean.
119 ;; So people who use koi8 for languages other than Russian
120 ;; will have to forgive us.
121 ?R
"KOI8 8-bit encoding for Cyrillic (MIME: KOI8-R)"
122 '(ccl-decode-koi8 . ccl-encode-koi8
)
123 '((safe-charsets ascii cyrillic-iso8859-5
)
124 (mime-charset . koi8-r
)
125 (valid-codes (0 .
127) 163 179 (192 .
255))
126 (charset-origin-alist (cyrillic-iso8859-5 "KOI8-R"
127 cyrillic-encode-koi8-r-char
))))
129 (define-coding-system-alias 'koi8-r
'cyrillic-koi8
)
130 (define-coding-system-alias 'koi8
'cyrillic-koi8
)
132 (define-ccl-program ccl-encode-koi8-font
135 (r1 = r1
,cyrillic-koi8-r-encode-table
)))
136 "CCL program to encode Cyrillic chars to KOI font.")
138 (setq font-ccl-encoder-alist
139 (cons (cons "koi8" ccl-encode-koi8-font
) font-ccl-encoder-alist
))
141 (defvar cyrillic-koi8-r-nonascii-translation-table
142 (make-translation-table-from-vector cyrillic-koi8-r-decode-table
)
143 "Value of `nonascii-translation-table' in Cyrillic-KOI8 language environment..")
145 (set-language-info-alist
146 "Cyrillic-KOI8" `((charset cyrillic-iso8859-5
)
147 (nonascii-translation
148 .
,cyrillic-koi8-r-nonascii-translation-table
)
149 (coding-system cyrillic-koi8
)
150 (coding-priority cyrillic-koi8
)
151 (input-method .
"cyrillic-jcuken")
152 (features cyril-util
)
153 (unibyte-display . cyrillic-koi8
)
154 (sample-text .
"Russian (\e,L@caaZXY\e(B) \e,L7T`PRabRcYbU\e(B!")
155 (documentation .
"Support for Cyrillic KOI8-R."))
158 ;;; ALTERNATIVNYJ staff
162 (defvar cyrillic-alternativnyj-decode-table
164 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
165 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
166 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
167 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
168 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
169 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
170 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
171 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
172 ?
\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
173 ?
\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
174 ?
\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
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
176 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
177 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
178 ?
\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
179 ?
\e,L
!\e(B ?
\e,Lq
\e(B 242 243 244 245 246 247 248 249 250 251 252 253 254 ?
\e,Lp
\e(B]
180 "Cyrillic ALTERNATIVNYJ decoding table.")
182 (defvar cyrillic-alternativnyj-encode-table
183 (let ((table (make-vector 256 32))
186 (let* ((ch (aref cyrillic-alternativnyj-decode-table i
))
187 (split (split-char ch
)))
188 (if (eq (car split
) 'cyrillic-iso8859-5
)
189 (aset table
(logior (nth 1 split
) 128) i
)
194 "Cyrillic ALTERNATIVNYJ encoding table.")
199 (define-ccl-program ccl-decode-alternativnyj
203 (write-read-repeat r0
,cyrillic-alternativnyj-decode-table
))))
204 "CCL program to decode Alternativnyj.")
206 (define-ccl-program ccl-encode-alternativnyj
210 (if (r0 != ,(charset-id 'cyrillic-iso8859-5
))
211 (write-read-repeat r0
)
213 (write-read-repeat r0
,cyrillic-alternativnyj-encode-table
))))))
214 "CCL program to encode Alternativnyj.")
217 'cyrillic-alternativnyj
4 ?A
218 "ALTERNATIVNYJ 8-bit encoding for Cyrillic"
219 '(ccl-decode-alternativnyj . ccl-encode-alternativnyj
)
220 '((safe-charsets ascii cyrillic-iso8859-5
)
221 (valid-codes (0 .
175) (224 .
241) 255)
222 (charset-origin-alist (cyrillic-iso8859-5 "ALTERNATIVNYJ"
223 cyrillic-encode-koi8-r-char
))))
226 (define-coding-system-alias 'alternativnyj
'cyrillic-alternativnyj
)
228 (define-ccl-program ccl-encode-alternativnyj-font
231 (r1 = r1
,cyrillic-alternativnyj-encode-table
)))
232 "CCL program to encode Cyrillic chars to Alternativnyj font.")
234 (setq font-ccl-encoder-alist
235 (cons (cons "alternativnyj" ccl-encode-alternativnyj-font
)
236 font-ccl-encoder-alist
))
238 (defvar cyrillic-alternativnyj-nonascii-translation-table
239 (make-translation-table-from-vector cyrillic-alternativnyj-decode-table
)
240 "Value of `nonascii-translation-table' in Cyrillic-ALT language environment.")
242 (set-language-info-alist
243 "Cyrillic-ALT" `((charset cyrillic-iso8859-5
)
244 (nonascii-translation
245 .
,cyrillic-alternativnyj-nonascii-translation-table
)
246 (coding-system cyrillic-alternativnyj
)
247 (coding-priority cyrillic-alternativnyj
)
248 (input-method .
"cyrillic-jcuken")
249 (features cyril-util
)
250 (unibyte-display . cyrillic-alternativnyj
)
251 (sample-text .
"Russian (\e,L@caaZXY\e(B) \e,L7T`PRabRcYbU\e(B!")
252 (documentation .
"Support for Cyrillic ALTERNATIVNYJ."))
255 ;;; cyrillic.el ends here