1 ;;; cyrillic.el --- Support for Cyrillic -*- coding: iso-2022-7bit; -*-
3 ;; Copyright (C) 1995,1999 Electrotechnical Laboratory, JAPAN.
4 ;; Licensed to the Free Software Foundation.
5 ;; Copyright (C) 1997 MORIOKA Tomohiko
7 ;; Keywords: multilingual, Cyrillic
9 ;; This file is part of XEmacs.
11 ;; XEmacs is free software; you can redistribute it and/or modify it
12 ;; under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; XEmacs is distributed in the hope that it will be useful, but
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ;; General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with XEmacs; see the file COPYING. If not, write to the Free
23 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
28 ;; The character set ISO8859-5 is supported. KOI-8 and ALTERNATIVNYJ
29 ;; are converted to ISO8859-5 internally.
33 ;; For syntax of Cyrillic
34 (modify-syntax-entry 'cyrillic-iso8859-5 "w")
35 (modify-syntax-entry ?
\e,L-
\e(B ".")
36 (modify-syntax-entry ?
\e,Lp
\e(B ".")
37 (modify-syntax-entry ?
\e,L}
\e(B ".")
39 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
41 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
45 ;; (make-coding-system
46 ;; 'cyrillic-iso-8bit 2 ?5
47 ;; "ISO 2022 based 8-bit encoding for Cyrillic script (MIME:ISO-8859-5)"
48 ;; '(ascii cyrillic-iso8859-5 nil nil
49 ;; nil nil nil nil nil nil nil)
50 ;; '((safe-charsets ascii cyrillic-iso8859-5)
51 ;; (mime-charset . iso-8859-5)))
53 ;; (define-coding-system-alias 'iso-8859-5 'cyrillic-iso-8bit)
59 charset-g1 cyrillic-iso8859-5
65 (set-language-info-alist
66 "Cyrillic-ISO" '((charset cyrillic-iso8859-5)
67 (tutorial . "TUTORIAL.ru")
68 (coding-system iso-8859-5)
69 (coding-priority iso-8859-5)
70 (input-method . "cyrillic-yawerty")
72 (sample-text . "Russian (
\e,L@caaZXY
\e(B)
\e,L7T`PRabRcYbU
\e(B!")
73 (documentation . "Support for Cyrillic ISO-8859-5."))
80 (defvar cyrillic-koi8-r-decode-table
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 ?
\e$B(!
\e(B ?
\e$B("
\e(B ?
\e$B(#
\e(B ?
\e$B($
\e(B ?
\e$B(&
\e(B ?
\e$B(%
\e(B ?
\e$B('
\e(B ?
\e$B()
\e(B ?
\e$B((
\e(B ?
\e$B(*
\e(B ?
\e$B(+
\e(B 32 ?
\e$(G#'
\e(B ?
\e$(G#+
\e(B ?
\e$(G#/
\e(B 32
91 32 ?
\e$(C"F
\e(B 32 32 ?
\e$B"#
\e(B 32 ?
\e$B"e
\e(B ?
\e$A!V
\e(B ?
\e$A!\
\e(B ?
\e$A!]
\e(B ?
\e,L
\e(B 32 ?
\e,A0
\e(B ?
\e,A2
\e(B ?
\e,A7
\e(B ?
\e,Aw
\e(B
92 ?
\e$(G#D
\e(B 32 32 ?
\e,Lq
\e(B 32 32 32 32 32 32 32 32 32 32 32 ?
\e$(G#E
\e(B
93 32 32 ?
\e$(G#G
\e(B ?
\e,L!
\e(B 32 32 32 32 32 32 32 32 ?
\e$(G#F
\e(B 32 32 ?
\e,A)
\e(B
94 ?
\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
95 ?
\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
96 ?
\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
97 ?
\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 ]
98 "Cyrillic KOI8-R decoding table.")
100 (defvar cyrillic-koi8-r-encode-table
101 (let ((table (make-vector 256 32))
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)
110 ((eq (car split) 'ascii)
115 "Cyrillic KOI8-R encoding table.")
119 (define-ccl-program ccl-decode-koi8
123 (write-read-repeat r0 ,cyrillic-koi8-r-decode-table))))
124 "CCL program to decode KOI8.")
126 (define-ccl-program ccl-encode-koi8
130 (if (r0 != ,(charset-id 'cyrillic-iso8859-5))
131 (write-read-repeat r0)
133 (write-read-repeat r0 , cyrillic-koi8-r-encode-table))))))
134 "CCL program to encode KOI8.")
136 ;; (make-coding-system
138 ;; ;; We used to use ?K. It is true that ?K is more strictly correct,
139 ;; ;; but it is also used for Korean.
140 ;; ;; So people who use koi8 for languages other than Russian
141 ;; ;; will have to forgive us.
142 ;; ?R "KOI8 8-bit encoding for Cyrillic (MIME: KOI8-R)"
143 ;; '(ccl-decode-koi8 . ccl-encode-koi8)
144 ;; '((safe-charsets ascii cyrillic-iso8859-5)
145 ;; (mime-charset . koi8-r)
146 ;; (valid-codes (0 . 127) 163 179 (192 . 255))
147 ;; (charset-origin-alist (cyrillic-iso8859-5 "KOI8-R"
148 ;; cyrillic-encode-koi8-r-char))))
150 ;; (define-coding-system-alias 'koi8-r 'cyrillic-koi8)
151 ;; (define-coding-system-alias 'koi8 'cyrillic-koi8)
155 "Coding-system used for KOI8-R."
156 `(decode ,ccl-decode-koi8
157 encode ,ccl-encode-koi8
160 ;; it is not correct, but XEmacs doesn't have `ccl' category...
161 (coding-system-put 'koi8-r 'category 'iso-8-1)
163 ;; (define-ccl-program ccl-encode-koi8-font
166 ;; (r1 = r1 ,cyrillic-koi8-r-encode-table)))
167 ;; "CCL program to encode Cyrillic chars to KOI font.")
169 ;; (setq font-ccl-encoder-alist
170 ;; (cons (cons "koi8" ccl-encode-koi8-font) font-ccl-encoder-alist))
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..")
176 (set-language-info-alist
177 "Cyrillic-KOI8" '((charset cyrillic-iso8859-5)
178 (coding-system koi8-r)
179 (coding-priority koi8-r)
180 (input-method . "cyrillic-yawerty")
181 (features cyril-util)
182 (tutorial . "TUTORIAL.ru")
183 (sample-text . "Russian (
\e,L@caaZXY
\e(B)
\e,L7T`PRabRcYbU
\e(B!")
184 (documentation . "Support for Cyrillic KOI8-R."))
187 ;;; ALTERNATIVNYJ staff
191 (defvar cyrillic-alternativnyj-decode-table
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 ?
\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
202 ?
\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
203 ?
\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
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 ?
\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
208 ?
\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]
209 "Cyrillic ALTERNATIVNYJ decoding table.")
211 (defvar cyrillic-alternativnyj-encode-table
212 (let ((table (make-vector 256 32))
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)
223 "Cyrillic ALTERNATIVNYJ encoding table.")
228 (define-ccl-program ccl-decode-alternativnyj
232 (write-read-repeat r0 ,cyrillic-alternativnyj-decode-table))))
233 "CCL program to decode Alternativnyj.")
235 (define-ccl-program ccl-encode-alternativnyj
239 (if (r0 != ,(charset-id 'cyrillic-iso8859-5))
240 (write-read-repeat r0)
242 (write-read-repeat r0 ,cyrillic-alternativnyj-encode-table))))))
243 "CCL program to encode Alternativnyj.")
245 ;; (make-coding-system
246 ;; 'cyrillic-alternativnyj 4 ?A
247 ;; "ALTERNATIVNYJ 8-bit encoding for Cyrillic"
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))))
255 ;; (define-coding-system-alias 'alternativnyj 'cyrillic-alternativnyj)
259 "Coding-system used for Alternativnyj"
260 `(decode ,ccl-decode-alternativnyj
261 encode ,ccl-encode-alternativnyj
264 ;; it is not correct, but XEmacs doesn't have `ccl' category...
265 (coding-system-put 'alternativnyj 'category 'iso-8-1)
267 ;; (define-ccl-program ccl-encode-alternativnyj-font
270 ;; (r1 = r1 ,cyrillic-alternativnyj-encode-table)))
271 ;; "CCL program to encode Cyrillic chars to Alternativnyj font.")
273 ;; (setq font-ccl-encoder-alist
274 ;; (cons (cons "alternativnyj" ccl-encode-alternativnyj-font)
275 ;; font-ccl-encoder-alist))
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.")
281 (set-language-info-alist
282 "Cyrillic-ALT" '((charset cyrillic-iso8859-5)
283 (coding-system alternativnyj)
284 (coding-priority alternativnyj)
285 (input-method . "cyrillic-yawerty")
286 (features cyril-util)
287 (tutorial . "TUTORIAL.ru")
288 (sample-text . "Russian (
\e,L@caaZXY
\e(B)
\e,L7T`PRabRcYbU
\e(B!")
289 (documentation . "Support for Cyrillic ALTERNATIVNYJ."))
292 ;;; cyrillic.el ends here