42 |
;; Alternativnyj coding systems encode both 8859-5 and Unicode. |
;; Alternativnyj coding systems encode both 8859-5 and Unicode. |
43 |
;; ucs-tables.el provides unification for cyrillic-iso-8bit. |
;; ucs-tables.el provides unification for cyrillic-iso-8bit. |
44 |
|
|
45 |
;; Customizing `utf-8-fragment-on-decoding' allows decoding characters |
;; Customizing `utf-fragment-on-decoding' allows decoding characters |
46 |
;; from KOI and Alternativnyj into 8859-5 where that's possible. |
;; from KOI and Alternativnyj into 8859-5 where that's possible. |
47 |
;; cyrillic-iso8859-5 characters take half as much space in the buffer |
;; cyrillic-iso8859-5 characters take half as much space in the buffer |
48 |
;; as the mule-unicode-0100-24ff equivalents, though that's probably |
;; as the mule-unicode-0100-24ff equivalents, though that's probably |
130 |
(if (r1 < 128) |
(if (r1 < 128) |
131 |
(write-repeat r1) |
(write-repeat r1) |
132 |
((translate-character cyrillic-koi8-r-nonascii-translation-table r0 r1) |
((translate-character cyrillic-koi8-r-nonascii-translation-table r0 r1) |
133 |
(translate-character utf-8-translation-table-for-decode r0 r1) |
(translate-character ucs-translation-table-for-decode r0 r1) |
134 |
(write-multibyte-character r0 r1) |
(write-multibyte-character r0 r1) |
135 |
(repeat)))))) |
(repeat)))))) |
136 |
"CCL program to decode KOI8-R.") |
"CCL program to decode KOI8-R.") |
145 |
|
|
146 |
(defun cyrillic-unify-encoding (table) |
(defun cyrillic-unify-encoding (table) |
147 |
"Set up equivalent characters in the encoding TABLE. |
"Set up equivalent characters in the encoding TABLE. |
148 |
This works wheher or not the table is is Unicode-based or |
This works whether or not the table is Unicode-based or |
149 |
8859-5-based. (Only appropriate for Cyrillic.)" |
8859-5-based. (Only appropriate for Cyrillic.)" |
150 |
(let ((table (get table 'translation-table))) |
(let ((table (get table 'translation-table))) |
151 |
(dotimes (i 96) |
(dotimes (i 96) |
175 |
'(ccl-decode-koi8 . ccl-encode-koi8) |
'(ccl-decode-koi8 . ccl-encode-koi8) |
176 |
`((safe-chars . cyrillic-koi8-r-encode-table) |
`((safe-chars . cyrillic-koi8-r-encode-table) |
177 |
(mime-charset . koi8-r) |
(mime-charset . koi8-r) |
178 |
(valid-codes (0 . 255)))) |
(valid-codes (0 . 255)) |
179 |
|
(dependency unify-8859-on-encoding-mode unify-8859-on-decoding-mode))) |
180 |
|
|
181 |
(define-coding-system-alias 'koi8-r 'cyrillic-koi8) |
(define-coding-system-alias 'koi8-r 'cyrillic-koi8) |
182 |
(define-coding-system-alias 'koi8 'cyrillic-koi8) |
(define-coding-system-alias 'koi8 'cyrillic-koi8) |
267 |
(if (r1 < 128) |
(if (r1 < 128) |
268 |
(write-repeat r1) |
(write-repeat r1) |
269 |
((translate-character cyrillic-koi8-u-nonascii-translation-table r0 r1) |
((translate-character cyrillic-koi8-u-nonascii-translation-table r0 r1) |
270 |
(translate-character utf-8-translation-table-for-decode r0 r1) |
(translate-character ucs-translation-table-for-decode r0 r1) |
271 |
(write-multibyte-character r0 r1) |
(write-multibyte-character r0 r1) |
272 |
(repeat)))))) |
(repeat)))))) |
273 |
"CCL program to decode KOI8-U.") |
"CCL program to decode KOI8-U.") |
288 |
'(ccl-decode-koi8-u . ccl-encode-koi8-u) |
'(ccl-decode-koi8-u . ccl-encode-koi8-u) |
289 |
`((safe-chars . cyrillic-koi8-u-encode-table) |
`((safe-chars . cyrillic-koi8-u-encode-table) |
290 |
(mime-charset . koi8-u) |
(mime-charset . koi8-u) |
291 |
(valid-codes (0 . 255)))) |
(valid-codes (0 . 255)) |
292 |
|
(dependency unify-8859-on-encoding-mode unify-8859-on-decoding-mode))) |
293 |
|
|
294 |
(define-ccl-program ccl-encode-koi8-u-font |
(define-ccl-program ccl-encode-koi8-u-font |
295 |
`(0 |
`(0 |
300 |
|
|
301 |
(set-language-info-alist |
(set-language-info-alist |
302 |
"Ukrainian" `((coding-system koi8-u) |
"Ukrainian" `((coding-system koi8-u) |
303 |
(coding-priority koi8-u) |
(coding-priority koi8-u) |
304 |
(nonascii-translation |
(nonascii-translation |
305 |
. ,(get 'cyrillic-koi8-u-nonascii-translation-table |
. ,(get 'cyrillic-koi8-u-nonascii-translation-table |
306 |
'translation-table)) |
'translation-table)) |
307 |
(input-method . "ukrainian-computer") |
(input-method . "ukrainian-computer") |
308 |
(features code-pages) |
(features code-pages) |
309 |
(documentation |
(documentation |
310 |
. "Support for Ukrainian with KOI8-U character set.")) |
. "Support for Ukrainian with KOI8-U character set.")) |
311 |
'("Cyrillic")) |
'("Cyrillic")) |
312 |
|
|
313 |
;;; ALTERNATIVNYJ stuff |
;;; ALTERNATIVNYJ stuff |
362 |
(write-repeat r1) |
(write-repeat r1) |
363 |
((translate-character cyrillic-alternativnyj-nonascii-translation-table |
((translate-character cyrillic-alternativnyj-nonascii-translation-table |
364 |
r0 r1) |
r0 r1) |
365 |
(translate-character utf-8-translation-table-for-decode r0 r1) |
(translate-character ucs-translation-table-for-decode r0 r1) |
366 |
(write-multibyte-character r0 r1) |
(write-multibyte-character r0 r1) |
367 |
(repeat)))))) |
(repeat)))))) |
368 |
"CCL program to decode Alternativnyj.") |
"CCL program to decode Alternativnyj.") |
385 |
'(ccl-decode-alternativnyj . ccl-encode-alternativnyj) |
'(ccl-decode-alternativnyj . ccl-encode-alternativnyj) |
386 |
`((safe-chars . cyrillic-alternativnyj-encode-table) |
`((safe-chars . cyrillic-alternativnyj-encode-table) |
387 |
(valid-codes (0 . 255)) |
(valid-codes (0 . 255)) |
388 |
(mime-charset . cp866))) |
(mime-charset . cp866) |
389 |
|
(dependency unify-8859-on-encoding-mode unify-8859-on-decoding-mode))) |
390 |
|
|
391 |
(define-coding-system-alias 'alternativnyj 'cyrillic-alternativnyj) |
(define-coding-system-alias 'alternativnyj 'cyrillic-alternativnyj) |
392 |
(define-coding-system-alias 'cp866 'cyrillic-alternativnyj) |
(define-coding-system-alias 'cp866 'cyrillic-alternativnyj) |