comparison lisp/mule/cyrillic.el @ 398:74fd4e045ea6 r21-2-29

Import from CVS: tag r21-2-29
author cvs
date Mon, 13 Aug 2007 11:13:30 +0200
parents 4f79e16b1112
children 697ef44129c6
comparison
equal deleted inserted replaced
397:f4aeb21a5bad 398:74fd4e045ea6
1 ;;; cyrillic.el --- Support for languages which use Cyrillic characters 1 ;;; cyrillic.el --- Support for Cyrillic -*- coding: iso-2022-7bit; -*-
2 2
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN. 3 ;; Copyright (C) 1995,1999 Electrotechnical Laboratory, JAPAN.
4 ;; Licensed to the Free Software Foundation. 4 ;; Licensed to the Free Software Foundation.
5 ;; Copyright (C) 1997 MORIOKA Tomohiko 5 ;; Copyright (C) 1997 MORIOKA Tomohiko
6 6
7 ;; Keywords: multilingual, Cyrillic 7 ;; Keywords: multilingual, Cyrillic
8 8
38 38
39 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 39 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
40 ;;; CYRILLIC 40 ;;; CYRILLIC
41 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 41 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
42 42
43 ;; (define-prefix-command 'describe-cyrillic-environment-map)
44 ;; (define-key-after describe-language-environment-map [Cyrillic]
45 ;; '("Cyrillic" . describe-cyrillic-environment-map)
46 ;; t)
47
48 ;; (define-prefix-command 'setup-cyrillic-environment-map)
49 ;; (define-key-after setup-language-environment-map [Cyrillic]
50 ;; '("Cyrillic" . setup-cyrillic-environment-map)
51 ;; t)
52
53
54 ;; ISO-8859-5 staff 43 ;; ISO-8859-5 staff
55 44
56 ;; (make-coding-system 45 ;; (make-coding-system
57 ;; 'cyrillic-iso-8bit 2 ?5 46 ;; 'cyrillic-iso-8bit 2 ?5
58 ;; "ISO 2022 based 8-bit encoding for Cyrillic script (MIME:ISO-8859-5)" 47 ;; "ISO 2022 based 8-bit encoding for Cyrillic script (MIME:ISO-8859-5)"
59 ;; '((ascii t) (cyrillic-iso8859-5 t) nil nil 48 ;; '(ascii cyrillic-iso8859-5 nil nil
60 ;; nil ascii-eol ascii-cntl nil nil nil nil)) 49 ;; nil nil nil nil nil nil nil)
50 ;; '((safe-charsets ascii cyrillic-iso8859-5)
51 ;; (mime-charset . iso-8859-5)))
61 52
62 ;; (define-coding-system-alias 'iso-8859-5 'cyrillic-iso-8bit) 53 ;; (define-coding-system-alias 'iso-8859-5 'cyrillic-iso-8bit)
63 54
64 (make-coding-system 55 (make-coding-system
65 'iso-8859-5 'iso2022 56 'iso-8859-5 'iso2022
70 charset-g3 t 61 charset-g3 t
71 mnemonic "ISO8/Cyr" 62 mnemonic "ISO8/Cyr"
72 )) 63 ))
73 64
74 (set-language-info-alist 65 (set-language-info-alist
75 "Cyrillic-ISO" '((setup-function . (setup-cyrillic-iso-environment 66 "Cyrillic-ISO" '((charset cyrillic-iso8859-5)
76 . setup-cyrillic-environment-map))
77 (charset . (cyrillic-iso8859-5))
78 (tutorial . "TUTORIAL.ru") 67 (tutorial . "TUTORIAL.ru")
79 (coding-system . (iso-8859-5)) 68 (coding-system iso-8859-5)
69 (coding-priority iso-8859-5)
70 (input-method . "cyrillic-yawerty")
71 (features cyril-util)
80 (sample-text . "Russian (,L@caaZXY(B) ,L7T`PRabRcYbU(B!") 72 (sample-text . "Russian (,L@caaZXY(B) ,L7T`PRabRcYbU(B!")
81 (documentation . ("Support for Cyrillic ISO-8859-5." 73 (documentation . "Support for Cyrillic ISO-8859-5."))
82 . describe-cyrillic-environment-map)))) 74 '("Cyrillic"))
83 75
84 ;; KOI-8 staff 76 ;; KOI-8 staff
85 77
78 (eval-and-compile
79
80 (defvar cyrillic-koi8-r-decode-table
81 [
82 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
83 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
84 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
85 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
86 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
87 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
88 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
89 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
90 ?$B(!(B ?$B("(B ?$B(#(B ?$B($(B ?$B(&(B ?$B(%(B ?$B('(B ?$B()(B ?$B(((B ?$B(*(B ?$B(+(B 32 ?$(G#'(B ?$(G#+(B ?$(G#/(B 32
91 32 ?$(C"F(B 32 32 ?$B"#(B 32 ?$B"e(B ?$A!V(B ?$A!\(B ?$A!](B ?,L (B 32 ?,A0(B ?,A2(B ?,A7(B ?,Aw(B
92 ?$(G#D(B 32 32 ?,Lq(B 32 32 32 32 32 32 32 32 32 32 32 ?$(G#E(B
93 32 32 ?$(G#G(B ?,L!(B 32 32 32 32 32 32 32 32 ?$(G#F(B 32 32 ?,A)(B
94 ?,Ln(B ?,LP(B ?,LQ(B ?,Lf(B ?,LT(B ?,LU(B ?,Ld(B ?,LS(B ?,Le(B ?,LX(B ?,LY(B ?,LZ(B ?,L[(B ?,L\(B ?,L](B ?,L^(B
95 ?,L_(B ?,Lo(B ?,L`(B ?,La(B ?,Lb(B ?,Lc(B ?,LV(B ?,LR(B ?,Ll(B ?,Lk(B ?,LW(B ?,Lh(B ?,Lm(B ?,Li(B ?,Lg(B ?,Lj(B
96 ?,LN(B ?,L0(B ?,L1(B ?,LF(B ?,L4(B ?,L5(B ?,LD(B ?,L3(B ?,LE(B ?,L8(B ?,L9(B ?,L:(B ?,L;(B ?,L<(B ?,L=(B ?,L>(B
97 ?,L?(B ?,LO(B ?,L@(B ?,LA(B ?,LB(B ?,LC(B ?,L6(B ?,L2(B ?,LL(B ?,LK(B ?,L7(B ?,LH(B ?,LM(B ?,LI(B ?,LG(B ?,LJ(B ]
98 "Cyrillic KOI8-R decoding table.")
99
100 (defvar cyrillic-koi8-r-encode-table
101 (let ((table (make-vector 256 32))
102 (i 0))
103 (while (< i 256)
104 (let* ((ch (aref cyrillic-koi8-r-decode-table i))
105 (split (split-char ch)))
106 (cond ((eq (car split) 'cyrillic-iso8859-5)
107 (aset table (logior (nth 1 split) 128) i)
108 )
109 ((eq ch 32))
110 ((eq (car split) 'ascii)
111 (aset table ch i)
112 )))
113 (setq i (1+ i)))
114 table)
115 "Cyrillic KOI8-R encoding table.")
116
117 )
118
86 (define-ccl-program ccl-decode-koi8 119 (define-ccl-program ccl-decode-koi8
87 '(3 120 `(3
88 ((read r0) 121 ((read r0)
89 (loop 122 (loop
90 (write-read-repeat 123 (write-read-repeat r0 ,cyrillic-koi8-r-decode-table))))
91 r0
92 [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
93 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
94 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
95 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
96 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
97 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
98 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
99 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
100 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
101 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
102 32 32 32 ?,Lq(B 32 32 32 32 32 32 32 32 32 32 32 32
103 32 32 32 ?,L!(B 32 32 32 32 32 32 32 32 32 32 32 32
104 ?,Ln(B ?,LP(B ?,LQ(B ?,Lf(B ?,LT(B ?,LU(B ?,Ld(B ?,LS(B ?,Le(B ?,LX(B ?,LY(B ?,LZ(B ?,L[(B ?,L\(B ?,L](B ?,L^(B
105 ?,L_(B ?,Lo(B ?,L`(B ?,La(B ?,Lb(B ?,Lc(B ?,LV(B ?,LR(B ?,Ll(B ?,Lk(B ?,LW(B ?,Lh(B ?,Lm(B ?,Li(B ?,Lg(B ?,Lj(B
106 ?,LN(B ?,L0(B ?,L1(B ?,LF(B ?,L4(B ?,L5(B ?,LD(B ?,L3(B ?,LE(B ?,L8(B ?,L9(B ?,L:(B ?,L;(B ?,L<(B ?,L=(B ?,L>(B
107 ?,L?(B ?,LO(B ?,L@(B ?,LA(B ?,LB(B ?,LC(B ?,L6(B ?,L2(B ?,LL(B ?,LK(B ?,L7(B ?,LH(B ?,LM(B ?,LI(B ?,LG(B ?,LJ(B ]))))
108 "CCL program to decode KOI8.") 124 "CCL program to decode KOI8.")
109 125
110 (define-ccl-program ccl-encode-koi8 126 (define-ccl-program ccl-encode-koi8
111 `(1 127 `(1
112 ((read r0) 128 ((read r0)
113 (loop 129 (loop
114 (if (r0 != ,(charset-id 'cyrillic-iso8859-5)) 130 (if (r0 != ,(charset-id 'cyrillic-iso8859-5))
115 (write-read-repeat r0) 131 (write-read-repeat r0)
116 ((read r0) 132 ((read r0)
117 (r0 -= 160) 133 (write-read-repeat r0 , cyrillic-koi8-r-encode-table))))))
118 (write-read-repeat
119 r0
120 [ 32 179 32 32 32 32 32 32 32 32 32 32 32 32 32 32
121 225 226 247 231 228 229 246 250 233 234 235 236 237 238 239 240
122 242 243 244 245 230 232 227 254 251 253 255 249 248 252 224 241
123 193 194 215 199 196 197 214 218 201 202 203 204 205 206 207 208
124 210 211 212 213 198 200 195 222 219 221 223 217 216 220 192 209
125 32 163 32 32 32 32 32 32 32 32 32 32 32 32 32 32])
126 )))))
127 "CCL program to encode KOI8.") 134 "CCL program to encode KOI8.")
128 135
129 ;(make-coding-system 136 ;; (make-coding-system
130 ; 'cyrillic-koi8 4 137 ;; 'cyrillic-koi8 4
131 ; ;; We used to use ?K. It is true that ?K is more strictly correct, 138 ;; ;; We used to use ?K. It is true that ?K is more strictly correct,
132 ; ;; but it is also used for Korean. 139 ;; ;; but it is also used for Korean.
133 ; ;; So people who use koi8 for languages other than Russian 140 ;; ;; So people who use koi8 for languages other than Russian
134 ; ;; will have to forgive us. 141 ;; ;; will have to forgive us.
135 ; ?R "KOI8 8-bit encoding for Cyrillic (MIME: KOI8-R)" 142 ;; ?R "KOI8 8-bit encoding for Cyrillic (MIME: KOI8-R)"
136 ; (cons ccl-decode-koi8 ccl-encode-koi8)) 143 ;; '(ccl-decode-koi8 . ccl-encode-koi8)
137 144 ;; '((safe-charsets ascii cyrillic-iso8859-5)
138 ;(define-coding-system-alias 'koi8-r 'cyrillic-koi8) 145 ;; (mime-charset . koi8-r)
139 ;(define-coding-system-alias 'koi8 'cyrillic-koi8) 146 ;; (valid-codes (0 . 127) 163 179 (192 . 255))
147 ;; (charset-origin-alist (cyrillic-iso8859-5 "KOI8-R"
148 ;; cyrillic-encode-koi8-r-char))))
149
150 ;; (define-coding-system-alias 'koi8-r 'cyrillic-koi8)
151 ;; (define-coding-system-alias 'koi8 'cyrillic-koi8)
140 152
141 (make-coding-system 153 (make-coding-system
142 'koi8-r 'ccl 154 'koi8-r 'ccl
143 "Coding-system used for KOI8-R." 155 "Coding-system used for KOI8-R."
144 `(decode ,ccl-decode-koi8 156 `(decode ,ccl-decode-koi8
145 encode ,ccl-encode-koi8 157 encode ,ccl-encode-koi8
146 mnemonic "KOI8")) 158 mnemonic "KOI8"))
147 159
148 ;(define-coding-system-alias 'koi8-r 'koi8) 160 ;; it is not correct, but XEmacs doesn't have `ccl' category...
161 (coding-system-put 'koi8-r 'category 'iso-8-1)
149 162
150 ;; (define-ccl-program ccl-encode-koi8-font 163 ;; (define-ccl-program ccl-encode-koi8-font
151 ;; '(0 164 ;; `(0
152 ;; ((r1 -= 160) 165 ;; ((r1 |= 128)
153 ;; (r1 = r1 166 ;; (r1 = r1 ,cyrillic-koi8-r-encode-table)))
154 ;; [ 32 179 32 32 32 32 32 32 32 32 32 32 32 32 32 32
155 ;; 225 226 247 231 228 229 246 250 233 234 235 236 237 238 239 240
156 ;; 242 243 244 245 230 232 227 254 251 253 255 249 248 252 224 241
157 ;; 193 194 215 199 196 197 214 218 201 202 203 204 205 206 207 208
158 ;; 210 211 212 213 198 200 195 222 219 221 223 217 216 220 192 209
159 ;; 32 163 32 32 32 32 32 32 32 32 32 32 32 32 32 32])
160 ;; ))
161 ;; "CCL program to encode Cyrillic chars to KOI font.") 167 ;; "CCL program to encode Cyrillic chars to KOI font.")
162 168
163 ;; (setq font-ccl-encoder-alist 169 ;; (setq font-ccl-encoder-alist
164 ;; (cons (cons "koi8" ccl-encode-koi8-font) font-ccl-encoder-alist)) 170 ;; (cons (cons "koi8" ccl-encode-koi8-font) font-ccl-encoder-alist))
165 171
172 ;; (defvar cyrillic-koi8-r-nonascii-translation-table
173 ;; (make-translation-table-from-vector cyrillic-koi8-r-decode-table)
174 ;; "Value of `nonascii-translation-table' in Cyrillic-KOI8 language environment..")
175
166 (set-language-info-alist 176 (set-language-info-alist
167 "Cyrillic-KOI8" '((setup-function . (setup-cyrillic-koi8-environment 177 "Cyrillic-KOI8" '((charset cyrillic-iso8859-5)
168 . setup-cyrillic-environment-map)) 178 (coding-system koi8-r)
169 (charset . (cyrillic-iso8859-5)) 179 (coding-priority koi8-r)
170 (coding-system . (koi8-r)) 180 (input-method . "cyrillic-yawerty")
181 (features cyril-util)
171 (tutorial . "TUTORIAL.ru") 182 (tutorial . "TUTORIAL.ru")
172 (sample-text . "Russian (,L@caaZXY(B) ,L7T`PRabRcYbU(B!") 183 (sample-text . "Russian (,L@caaZXY(B) ,L7T`PRabRcYbU(B!")
173 (documentation . ("Support for Cyrillic KOI-8." 184 (documentation . "Support for Cyrillic KOI8-R."))
174 . describe-cyrillic-environment-map)))) 185 '("Cyrillic"))
175 186
176 ;;; ALTERNATIVNYJ staff 187 ;;; ALTERNATIVNYJ staff
177 188
189 (eval-and-compile
190
191 (defvar cyrillic-alternativnyj-decode-table
192 [
193 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
194 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
195 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
196 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
197 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
198 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
199 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
200 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
201 ?,L0(B ?,L1(B ?,L2(B ?,L3(B ?,L4(B ?,L5(B ?,L6(B ?,L7(B ?,L8(B ?,L9(B ?,L:(B ?,L;(B ?,L<(B ?,L=(B ?,L>(B ?,L?(B
202 ?,L@(B ?,LA(B ?,LB(B ?,LC(B ?,LD(B ?,LE(B ?,LF(B ?,LG(B ?,LH(B ?,LI(B ?,LJ(B ?,LK(B ?,LL(B ?,LM(B ?,LN(B ?,LO(B
203 ?,LP(B ?,LQ(B ?,LR(B ?,LS(B ?,LT(B ?,LU(B ?,LV(B ?,LW(B ?,LX(B ?,LY(B ?,LZ(B ?,L[(B ?,L\(B ?,L](B ?,L^(B ?,L_(B
204 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
205 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
206 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
207 ?,L`(B ?,La(B ?,Lb(B ?,Lc(B ?,Ld(B ?,Le(B ?,Lf(B ?,Lg(B ?,Lh(B ?,Li(B ?,Lj(B ?,Lk(B ?,Ll(B ?,Lm(B ?,Ln(B ?,Lo(B
208 ?,L!(B ?,Lq(B 32 32 32 32 32 32 32 32 32 32 32 32 32 ?,Lp(B]
209 "Cyrillic ALTERNATIVNYJ decoding table.")
210
211 (defvar cyrillic-alternativnyj-encode-table
212 (let ((table (make-vector 256 32))
213 (i 0))
214 (while (< i 256)
215 (let* ((ch (aref cyrillic-alternativnyj-decode-table i))
216 (split (split-char ch)))
217 (if (eq (car split) 'cyrillic-iso8859-5)
218 (aset table (logior (nth 1 split) 128) i)
219 (if (/= ch 32)
220 (aset table ch i))))
221 (setq i (1+ i)))
222 table)
223 "Cyrillic ALTERNATIVNYJ encoding table.")
224
225 )
226
227
178 (define-ccl-program ccl-decode-alternativnyj 228 (define-ccl-program ccl-decode-alternativnyj
179 '(3 229 `(3
180 ((read r0) 230 ((read r0)
181 (loop 231 (loop
182 (write-read-repeat 232 (write-read-repeat r0 ,cyrillic-alternativnyj-decode-table))))
183 r0
184 [ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
185 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
186 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
187 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
188 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
189 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
190 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
191 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
192 ?,L0(B ?,L1(B ?,L2(B ?,L3(B ?,L4(B ?,L5(B ?,L6(B ?,L7(B ?,L8(B ?,L9(B ?,L:(B ?,L;(B ?,L<(B ?,L=(B ?,L>(B ?,L?(B
193 ?,L@(B ?,LA(B ?,LB(B ?,LC(B ?,LD(B ?,LE(B ?,LF(B ?,LG(B ?,LH(B ?,LI(B ?,LJ(B ?,LK(B ?,LL(B ?,LM(B ?,LN(B ?,LO(B
194 ?,LP(B ?,LQ(B ?,LR(B ?,LS(B ?,LT(B ?,LU(B ?,LV(B ?,LW(B ?,LX(B ?,LY(B ?,LZ(B ?,L[(B ?,L\(B ?,L](B ?,L^(B ?,L_(B
195 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
196 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
197 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
198 ?,L`(B ?,La(B ?,Lb(B ?,Lc(B ?,Ld(B ?,Le(B ?,Lf(B ?,Lg(B ?,Lh(B ?,Li(B ?,Lj(B ?,Lk(B ?,Ll(B ?,Lm(B ?,Ln(B ?,Lo(B
199 ?,L!(B ?,Lq(B 32 32 32 32 32 32 32 32 32 32 32 32 32 ?,Lp(B]))))
200 "CCL program to decode Alternativnyj.") 233 "CCL program to decode Alternativnyj.")
201 234
202 (define-ccl-program ccl-encode-alternativnyj 235 (define-ccl-program ccl-encode-alternativnyj
203 `(1 236 `(1
204 ((read r0) 237 ((read r0)
205 (loop 238 (loop
206 (if (r0 != ,(charset-id 'cyrillic-iso8859-5)) 239 (if (r0 != ,(charset-id 'cyrillic-iso8859-5))
207 (write-read-repeat r0) 240 (write-read-repeat r0)
208 ((read r0) 241 ((read r0)
209 (r0 -= 160) 242 (write-read-repeat r0 ,cyrillic-alternativnyj-encode-table))))))
210 (write-read-repeat
211 r0
212 [ 32 240 32 32 32 32 32 32 32 32 32 32 32 32 32 32
213 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
214 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
215 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
216 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
217 255 241 32 32 32 32 32 32 32 32 32 32 32 32 32 32])
218 )))))
219 "CCL program to encode Alternativnyj.") 243 "CCL program to encode Alternativnyj.")
220 244
221 ;; (make-coding-system 245 ;; (make-coding-system
222 ;; 'alternativnyj 4 246 ;; 'cyrillic-alternativnyj 4 ?A
223 ;; ?A "Coding-system used for Alternativnyj" 247 ;; "ALTERNATIVNYJ 8-bit encoding for Cyrillic"
224 ;; (cons ccl-decode-alternativnyj ccl-encode-alternativnyj)) 248 ;; '(ccl-decode-alternativnyj . ccl-encode-alternativnyj)
249 ;; '((safe-charsets ascii cyrillic-iso8859-5)
250 ;; (valid-codes (0 . 175) (224 . 241) 255)
251 ;; (charset-origin-alist (cyrillic-iso8859-5 "ALTERNATIVNYJ"
252 ;; cyrillic-encode-koi8-r-char))))
253
254
255 ;; (define-coding-system-alias 'alternativnyj 'cyrillic-alternativnyj)
225 256
226 (make-coding-system 257 (make-coding-system
227 'alternativnyj 'ccl 258 'alternativnyj 'ccl
228 "Coding-system used for Alternativnyj" 259 "Coding-system used for Alternativnyj"
229 `(decode ,ccl-decode-alternativnyj 260 `(decode ,ccl-decode-alternativnyj
230 encode ,ccl-encode-alternativnyj 261 encode ,ccl-encode-alternativnyj
231 mnemonic "Cy.Alt")) 262 mnemonic "Cy.Alt"))
232 263
264 ;; it is not correct, but XEmacs doesn't have `ccl' category...
265 (coding-system-put 'alternativnyj 'category 'iso-8-1)
266
233 ;; (define-ccl-program ccl-encode-alternativnyj-font 267 ;; (define-ccl-program ccl-encode-alternativnyj-font
234 ;; '(0 268 ;; '(0
235 ;; ((r1 -= 160) 269 ;; ((r1 |= 128)
236 ;; (r1 = r1 270 ;; (r1 = r1 ,cyrillic-alternativnyj-encode-table)))
237 ;; [ 32 240 32 32 32 32 32 32 32 32 32 32 32 32 32 32
238 ;; 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
239 ;; 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
240 ;; 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
241 ;; 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
242 ;; 255 241 32 32 32 32 32 32 32 32 32 32 32 32 32 32])
243 ;; ))
244 ;; "CCL program to encode Cyrillic chars to Alternativnyj font.") 271 ;; "CCL program to encode Cyrillic chars to Alternativnyj font.")
245 272
246 ;; (setq font-ccl-encoder-alist 273 ;; (setq font-ccl-encoder-alist
247 ;; (cons (cons "alternativnyj" ccl-encode-alternativnyj-font) 274 ;; (cons (cons "alternativnyj" ccl-encode-alternativnyj-font)
248 ;; font-ccl-encoder-alist)) 275 ;; font-ccl-encoder-alist))
249 276
277 ;; (defvar cyrillic-alternativnyj-nonascii-translation-table
278 ;; (make-translation-table-from-vector cyrillic-alternativnyj-decode-table)
279 ;; "Value of `nonascii-translation-table' in Cyrillic-ALT language environment.")
280
250 (set-language-info-alist 281 (set-language-info-alist
251 "Cyrillic-ALT" '((setup-function . (setup-cyrillic-alternativnyj-environment 282 "Cyrillic-ALT" '((charset cyrillic-iso8859-5)
252 . setup-cyrillic-environment-map)) 283 (coding-system alternativnyj)
253 (charset . (cyrillic-iso8859-5)) 284 (coding-priority alternativnyj)
254 (coding-system . (alternativnyj)) 285 (input-method . "cyrillic-yawerty")
286 (features cyril-util)
255 (tutorial . "TUTORIAL.ru") 287 (tutorial . "TUTORIAL.ru")
256 (sample-text . "Russian (,L@caaZXY(B) ,L7T`PRabRcYbU(B!") 288 (sample-text . "Russian (,L@caaZXY(B) ,L7T`PRabRcYbU(B!")
257 (documentation . ("Support for Cyrillic ALTERNATIVNYJ." 289 (documentation . "Support for Cyrillic ALTERNATIVNYJ."))
258 . describe-cyrillic-environment-map)))) 290 '("Cyrillic"))
259
260 ;;; GENERAL
261
262 (defun setup-cyrillic-environment ()
263 "Setup multilingual environment for Cyrillic users."
264 (interactive)
265 (setq primary-language "Cyrillic")
266
267 (setq coding-category-iso-8-1 'iso-8859-5)
268
269 (set-coding-priority
270 '(coding-category-iso-7
271 coding-category-iso-8-1))
272
273 (setq-default buffer-file-coding-system 'iso-8859-5)
274 (set-terminal-coding-system 'iso-8859-5)
275 (set-keyboard-coding-system 'iso-8859-5)
276
277 (setq default-input-method '("Cyrillic" . "quail-yawerty"))
278 )
279
280 (defun describe-cyrillic-support ()
281 "Describe how Emacs support Cyrillic."
282 (interactive)
283 (describe-language-support-internal "Cyrillic"))
284
285 (set-language-info-alist
286 "Cyrillic" '((setup-function . setup-cyrillic-environment)
287 (describe-function . describe-cyrillic-support)
288 (charset . (cyrillic-iso8859-5))
289 (tutorial . "TUTORIAL.ru")
290 (coding-system . (iso-8859-5 koi8-r alternativnyj))
291 (sample-text . "Russian (,L@caaZXY(B) ,L7T`PRabRcYbU(B!")
292 (documentation . nil)))
293 291
294 ;;; cyrillic.el ends here 292 ;;; cyrillic.el ends here