Commit | Line | Data |
---|---|---|
4ed46869 KH |
1 | ;;; cyrillic.el --- Support for languages which use Cyrillic characters |
2 | ||
4ed46869 | 3 | ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN. |
b79e7b7b | 4 | ;; Licensed to the Free Software Foundation. |
4ed46869 KH |
5 | |
6 | ;; Keywords: multilingual, Cyrillic | |
7 | ||
8 | ;; This file is part of GNU Emacs. | |
9 | ||
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) | |
13 | ;; any later version. | |
14 | ||
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. | |
19 | ||
20 | ;; You should have received a copy of the GNU General Public License | |
369314dc KH |
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. | |
4ed46869 KH |
24 | |
25 | ;;; Commentary: | |
26 | ||
2b01336d KH |
27 | ;; The character set ISO8859-5 is supported. KOI-8 and ALTERNATIVNYJ |
28 | ;; are converted to ISO8859-5 internally. | |
4ed46869 KH |
29 | |
30 | ;;; Code: | |
31 | ||
5f1d80c7 KH |
32 | ;; Cyrillic (general) |
33 | ||
34 | (define-prefix-command 'describe-cyrillic-environment-map) | |
35 | (define-key-after describe-language-environment-map [Cyrillic] | |
36 | '("Cyrillic" . describe-cyrillic-environment-map) | |
37 | t) | |
38 | ||
39 | (define-prefix-command 'setup-cyrillic-environment-map) | |
40 | (define-key-after setup-language-environment-map [Cyrillic] | |
41 | '("Cyrillic" . setup-cyrillic-environment-map) | |
42 | t) | |
43 | ||
2b01336d KH |
44 | ;; ISO-8859-5 staff |
45 | ||
4ed46869 | 46 | (make-coding-system |
efbc7e89 KH |
47 | 'cyrillic-iso-8bit 2 ?5 |
48 | "ISO 2022 based 8-bit encoding for Cyrillic script (MIME:ISO-8859-5)" | |
4ed46869 | 49 | '((ascii t) (cyrillic-iso8859-5 t) nil nil |
6def6186 KH |
50 | nil ascii-eol ascii-cntl nil nil nil nil) |
51 | '(ascii cyrillic-iso8859-5)) | |
4ed46869 | 52 | |
71eabd24 | 53 | (define-coding-system-alias 'iso-8859-5 'cyrillic-iso-8bit) |
efbc7e89 | 54 | |
5f1d80c7 KH |
55 | (set-language-info-alist |
56 | "Cyrillic-ISO" '((setup-function . (setup-cyrillic-iso-environment | |
57 | . setup-cyrillic-environment-map)) | |
58 | (charset . (cyrillic-iso8859-5)) | |
59 | (coding-system . (cyrillic-iso-8bit)) | |
60 | (sample-text . "Russian (\e,L@caaZXY\e(B) \e,L7T`PRabRcYbU\e(B!") | |
61 | (documentation . ("Support for Cyrillic ISO-8859-5." | |
62 | . describe-cyrillic-environment-map)))) | |
63 | ||
2b01336d KH |
64 | ;; KOI-8 staff |
65 | ||
66 | (define-ccl-program ccl-decode-koi8 | |
67 | '(3 | |
68 | ((read r0) | |
69 | (loop | |
70 | (write-read-repeat | |
71 | r0 | |
72 | [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
73 | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | |
74 | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |
75 | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
76 | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |
77 | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | |
78 | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
79 | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | |
80 | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
81 | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
82 | 32 32 32 ?\e,Lq\e(B 32 32 32 32 32 32 32 32 32 32 32 32 | |
83 | 32 32 32 ?\e,L!\e(B 32 32 32 32 32 32 32 32 32 32 32 32 | |
84 | ?\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 | |
85 | ?\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 | |
86 | ?\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 | |
87 | ?\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 ])))) | |
88 | "CCL program to decode KOI8.") | |
89 | ||
90 | (define-ccl-program ccl-encode-koi8 | |
91 | `(1 | |
92 | ((read r0) | |
93 | (loop | |
94 | (if (r0 != ,(charset-id 'cyrillic-iso8859-5)) | |
95 | (write-read-repeat r0) | |
96 | ((read r0) | |
97 | (r0 -= 160) | |
98 | (write-read-repeat | |
99 | r0 | |
100 | [ 32 179 32 32 32 32 32 32 32 32 32 32 32 32 32 32 | |
101 | 225 226 247 231 228 229 246 250 233 234 235 236 237 238 239 240 | |
102 | 242 243 244 245 230 232 227 254 251 253 255 249 248 252 224 241 | |
103 | 193 194 215 199 196 197 214 218 201 202 203 204 205 206 207 208 | |
104 | 210 211 212 213 198 200 195 222 219 221 223 217 216 220 192 209 | |
105 | 32 163 32 32 32 32 32 32 32 32 32 32 32 32 32 32]) | |
106 | ))))) | |
107 | "CCL program to encode KOI8.") | |
108 | ||
109 | (make-coding-system | |
4b9121fc | 110 | 'cyrillic-koi8 4 |
49716ecd RS |
111 | ;; We used to use ?K. It is true that ?K is more strictly correct, |
112 | ;; but it is also used for Korean. | |
113 | ;; So people who use koi8 for languages other than Russian | |
114 | ;; will have to forgive us. | |
efbc7e89 | 115 | ?R "KOI8 8-bit encoding for Cyrillic (MIME: KOI8-R)" |
6def6186 KH |
116 | (cons ccl-decode-koi8 ccl-encode-koi8) |
117 | '(ascii cyrillic-iso8859-5)) | |
2b01336d | 118 | |
71eabd24 RS |
119 | (define-coding-system-alias 'koi8-r 'cyrillic-koi8) |
120 | (define-coding-system-alias 'koi8 'cyrillic-koi8) | |
2b01336d KH |
121 | |
122 | (define-ccl-program ccl-encode-koi8-font | |
123 | '(0 | |
c6965ddb | 124 | ((r1 -= 32) |
2b01336d KH |
125 | (r1 = r1 |
126 | [ 32 179 32 32 32 32 32 32 32 32 32 32 32 32 32 32 | |
127 | 225 226 247 231 228 229 246 250 233 234 235 236 237 238 239 240 | |
128 | 242 243 244 245 230 232 227 254 251 253 255 249 248 252 224 241 | |
129 | 193 194 215 199 196 197 214 218 201 202 203 204 205 206 207 208 | |
130 | 210 211 212 213 198 200 195 222 219 221 223 217 216 220 192 209 | |
131 | 32 163 32 32 32 32 32 32 32 32 32 32 32 32 32 32]) | |
132 | )) | |
133 | "CCL program to encode Cyrillic chars to KOI font.") | |
134 | ||
135 | (setq font-ccl-encoder-alist | |
136 | (cons (cons "koi8" ccl-encode-koi8-font) font-ccl-encoder-alist)) | |
137 | ||
5f1d80c7 KH |
138 | (set-language-info-alist |
139 | "Cyrillic-KOI8" '((setup-function . (setup-cyrillic-koi8-environment | |
140 | . setup-cyrillic-environment-map)) | |
141 | (charset . (cyrillic-iso8859-5)) | |
142 | (coding-system . (cyrillic-koi8)) | |
143 | (sample-text . "Russian (\e,L@caaZXY\e(B) \e,L7T`PRabRcYbU\e(B!") | |
144 | (documentation . ("Support for Cyrillic KOI-8." | |
145 | . describe-cyrillic-environment-map)))) | |
146 | ||
2b01336d KH |
147 | ;;; ALTERNATIVNYJ staff |
148 | ||
149 | (define-ccl-program ccl-decode-alternativnyj | |
150 | '(3 | |
151 | ((read r0) | |
152 | (loop | |
153 | (write-read-repeat | |
154 | r0 | |
155 | [ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
156 | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | |
157 | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |
158 | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
159 | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |
160 | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | |
161 | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
162 | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | |
163 | ?\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 | |
164 | ?\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 | |
165 | ?\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 | |
166 | 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 | |
167 | 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 | |
168 | 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 | |
169 | ?\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 | |
170 | ?\e,L!\e(B ?\e,Lq\e(B 32 32 32 32 32 32 32 32 32 32 32 32 32 ?\e,Lp\e(B])))) | |
171 | "CCL program to decode Alternativnyj.") | |
172 | ||
173 | (define-ccl-program ccl-encode-alternativnyj | |
174 | `(1 | |
175 | ((read r0) | |
176 | (loop | |
177 | (if (r0 != ,(charset-id 'cyrillic-iso8859-5)) | |
178 | (write-read-repeat r0) | |
179 | ((read r0) | |
180 | (r0 -= 160) | |
181 | (write-read-repeat | |
182 | r0 | |
183 | [ 32 240 32 32 32 32 32 32 32 32 32 32 32 32 32 32 | |
184 | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
185 | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
186 | 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | |
187 | 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | |
188 | 255 241 32 32 32 32 32 32 32 32 32 32 32 32 32 32]) | |
189 | ))))) | |
190 | "CCL program to encode Alternativnyj.") | |
191 | ||
192 | (make-coding-system | |
efbc7e89 KH |
193 | 'cyrillic-alternativnyj 4 ?A |
194 | "ALTERNATIVNYJ 8-bit encoding for Cyrillic" | |
6def6186 KH |
195 | (cons ccl-decode-alternativnyj ccl-encode-alternativnyj) |
196 | '(ascii cyrillic-iso8859-5)) | |
2b01336d | 197 | |
71eabd24 | 198 | (define-coding-system-alias 'alternativnyj 'cyrillic-alternativnyj) |
efbc7e89 | 199 | |
2b01336d KH |
200 | (define-ccl-program ccl-encode-alternativnyj-font |
201 | '(0 | |
c6965ddb | 202 | ((r1 -= 32) |
2b01336d KH |
203 | (r1 = r1 |
204 | [ 32 240 32 32 32 32 32 32 32 32 32 32 32 32 32 32 | |
205 | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
206 | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
207 | 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | |
208 | 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | |
209 | 255 241 32 32 32 32 32 32 32 32 32 32 32 32 32 32]) | |
210 | )) | |
211 | "CCL program to encode Cyrillic chars to Alternativnyj font.") | |
212 | ||
213 | (setq font-ccl-encoder-alist | |
214 | (cons (cons "alternativnyj" ccl-encode-alternativnyj-font) | |
215 | font-ccl-encoder-alist)) | |
216 | ||
4ed46869 | 217 | (set-language-info-alist |
5f1d80c7 KH |
218 | "Cyrillic-ALT" '((setup-function . (setup-cyrillic-alternativnyj-environment |
219 | . setup-cyrillic-environment-map)) | |
220 | (charset . (cyrillic-iso8859-5)) | |
221 | (coding-system . (cyrillic-alternativnyj)) | |
222 | (sample-text . "Russian (\e,L@caaZXY\e(B) \e,L7T`PRabRcYbU\e(B!") | |
223 | (documentation . ("Support for Cyrillic ALTERNATIVNYJ." | |
224 | . describe-cyrillic-environment-map)))) | |
4ed46869 KH |
225 | |
226 | ;;; cyrillic.el ends here |