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.
29 ;; KOI-8, Windows-1251, and ALTERNATIVNYJ are converted to ISO8859-5
35 (modify-syntax-entry 'cyrillic-iso8859-5 "w")
36 (modify-syntax-entry ?
\e,L-
\e(B ".")
37 (modify-syntax-entry ?
\e,Lp
\e(B ".")
38 (modify-syntax-entry ?
\e,L}
\e(B ".")
40 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
42 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
48 "ISO-8859-5 (ISO 2022 based 8-bit encoding for Cyrillic script)"
50 charset-g1 cyrillic-iso8859-5
56 (set-language-info-alist
57 "Cyrillic-ISO" '((charset cyrillic-iso8859-5)
58 (tutorial . "TUTORIAL.ru")
59 (coding-system iso-8859-5)
60 (coding-priority iso-8859-5)
61 (input-method . "cyrillic-yawerty")
63 (sample-text . "Russian (
\e,L@caaZXY
\e(B)
\e,L7T`PRabRcYbU
\e(B!")
64 (documentation . "Support for Cyrillic ISO-8859-5."))
71 (defvar cyrillic-koi8-r-decode-table
73 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
74 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
75 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
76 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
77 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
78 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
79 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
80 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
81 ?
\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
82 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
83 ?
\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
84 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
85 ?
\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
86 ?
\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
87 ?
\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
88 ?
\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 ]
89 "Cyrillic KOI8-R decoding table.")
91 (defvar cyrillic-koi8-r-encode-table
92 (let ((table (make-vector 256 32))
95 (let* ((ch (aref cyrillic-koi8-r-decode-table i))
96 (split (split-char ch)))
97 (cond ((eq (car split) 'cyrillic-iso8859-5)
98 (aset table (logior (nth 1 split) 128) i)
101 ((eq (car split) 'ascii)
106 "Cyrillic KOI8-R encoding table.")
110 (define-ccl-program ccl-decode-koi8
114 (write-read-repeat r0 ,cyrillic-koi8-r-decode-table))))
115 "CCL program to decode KOI8.")
117 (define-ccl-program ccl-encode-koi8
121 (if (r0 != ,(charset-id 'cyrillic-iso8859-5))
122 (write-read-repeat r0)
124 (write-read-repeat r0 , cyrillic-koi8-r-encode-table))))))
125 "CCL program to encode KOI8.")
127 ;; (define-coding-system-alias 'koi8-r 'cyrillic-koi8)
128 ;; (define-coding-system-alias 'koi8 'cyrillic-koi8)
132 "KOI8-R 8-bit encoding for Cyrillic."
133 '(decode ccl-decode-koi8
134 encode ccl-encode-koi8
137 ;; `iso-8-1' is not correct, but XEmacs doesn't have a `ccl' category
138 (coding-system-put 'koi8-r 'category 'iso-8-1)
140 (define-ccl-program ccl-encode-koi8-r-font
143 (r1 = r1 ,cyrillic-koi8-r-encode-table)))
144 "CCL program to encode Cyrillic chars to koi8-r font.")
146 ;; (setq font-ccl-encoder-alist
147 ;; (cons (cons "koi8" ccl-encode-koi8-font) font-ccl-encoder-alist))
149 ;; (defvar cyrillic-koi8-r-nonascii-translation-table
150 ;; (make-translation-table-from-vector cyrillic-koi8-r-decode-table)
151 ;; "Value of `nonascii-translation-table' in Cyrillic-KOI8 language environment..")
153 (set-language-info-alist
154 "Cyrillic-KOI8" '((charset cyrillic-iso8859-5)
155 (coding-system koi8-r)
156 (coding-priority koi8-r)
157 (input-method . "cyrillic-yawerty")
158 (features cyril-util)
159 (tutorial . "TUTORIAL.ru")
160 (sample-text . "Russian (
\e,L@caaZXY
\e(B)
\e,L7T`PRabRcYbU
\e(B!")
161 (documentation . "Support for Cyrillic KOI8-R."))
168 (defvar cyrillic-windows-1251-decode-table
170 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
171 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
172 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
173 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
174 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
175 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
176 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
177 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
178 ?
\e,L"
\e(B ?
\e,L#
\e(B 32 ?
\e,Ls
\e(B 32 32 32 32 32 32 ?
\e,L)
\e(B 32 ?
\e,L*
\e(B ?
\e,L,
\e(B ?
\e,L+
\e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(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
185 ?
\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 ]
186 "Cyrillic Windows-1251 decoding table.")
188 (defvar cyrillic-windows-1251-encode-table
189 (let ((table (make-vector 256 32))
192 (let* ((ch (aref cyrillic-windows-1251-decode-table i))
193 (split (split-char ch)))
194 (cond ((eq (car split) 'cyrillic-iso8859-5)
195 (aset table (logior (nth 1 split) 128) i)
198 ((eq (car split) 'ascii)
203 "Cyrillic Windows-1251 encoding table.")
207 (define-ccl-program ccl-decode-windows1251
211 (write-read-repeat r0 ,cyrillic-windows-1251-decode-table))))
212 "CCL program to decode Windows-1251.")
214 (define-ccl-program ccl-encode-windows1251
218 (if (r0 != ,(charset-id 'cyrillic-iso8859-5))
219 (write-read-repeat r0)
221 (write-read-repeat r0 , cyrillic-windows-1251-encode-table))))))
222 "CCL program to encode Windows-1251.")
226 "Coding-system used for Windows-1251."
227 '(decode ccl-decode-windows1251
228 encode ccl-encode-windows1251
231 ;; `iso-8-1' is not correct, but XEmacs doesn't have a `ccl' category
232 (coding-system-put 'windows-1251 'category 'iso-8-1)
234 (set-language-info-alist
235 "Cyrillic-Win" '((charset cyrillic-iso8859-5)
236 (coding-system windows-1251)
237 (coding-priority windows-1251)
238 (input-method . "cyrillic-yawerty")
239 (features cyril-util)
240 (tutorial . "TUTORIAL.ru")
241 (sample-text . "Russian (
\e,L@caaZXY
\e(B)
\e,L7T`PRabRcYbU
\e(B!")
242 (documentation . "Support for Cyrillic Windows-1251."))
249 (defvar cyrillic-alternativnyj-decode-table
251 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
252 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
253 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
254 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
255 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
256 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
257 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
258 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
259 ?
\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
260 ?
\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
261 ?
\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
262 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
263 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
264 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
265 ?
\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
266 ?
\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]
267 "Cyrillic ALTERNATIVNYJ decoding table.")
269 (defvar cyrillic-alternativnyj-encode-table
270 (let ((table (make-vector 256 32))
273 (let* ((ch (aref cyrillic-alternativnyj-decode-table i))
274 (split (split-char ch)))
275 (if (eq (car split) 'cyrillic-iso8859-5)
276 (aset table (logior (nth 1 split) 128) i)
281 "Cyrillic ALTERNATIVNYJ encoding table.")
286 (define-ccl-program ccl-decode-alternativnyj
290 (write-read-repeat r0 ,cyrillic-alternativnyj-decode-table))))
291 "CCL program to decode Alternativnyj.")
293 (define-ccl-program ccl-encode-alternativnyj
297 (if (r0 != ,(charset-id 'cyrillic-iso8859-5))
298 (write-read-repeat r0)
300 (write-read-repeat r0 ,cyrillic-alternativnyj-encode-table))))))
301 "CCL program to encode Alternativnyj.")
303 ;; (define-coding-system-alias 'alternativnyj 'cyrillic-alternativnyj)
307 "Coding-system used for Alternativnyj"
308 '(decode ccl-decode-alternativnyj
309 encode ccl-encode-alternativnyj
312 ;; `iso-8-1' is not correct, but XEmacs doesn't have `ccl' category
313 (coding-system-put 'alternativnyj 'category 'iso-8-1)
315 ;; (define-ccl-program ccl-encode-alternativnyj-font
318 ;; (r1 = r1 ,cyrillic-alternativnyj-encode-table)))
319 ;; "CCL program to encode Cyrillic chars to Alternativnyj font.")
321 ;; (setq font-ccl-encoder-alist
322 ;; (cons (cons "alternativnyj" ccl-encode-alternativnyj-font)
323 ;; font-ccl-encoder-alist))
325 ;; (defvar cyrillic-alternativnyj-nonascii-translation-table
326 ;; (make-translation-table-from-vector cyrillic-alternativnyj-decode-table)
327 ;; "Value of `nonascii-translation-table' in Cyrillic-ALT language environment.")
329 (set-language-info-alist
330 "Cyrillic-ALT" '((charset cyrillic-iso8859-5)
331 (coding-system alternativnyj)
332 (coding-priority alternativnyj)
333 (input-method . "cyrillic-yawerty")
334 (features cyril-util)
335 (tutorial . "TUTORIAL.ru")
336 (sample-text . "Russian (
\e,L@caaZXY
\e(B)
\e,L7T`PRabRcYbU
\e(B!")
337 (documentation . "Support for Cyrillic ALTERNATIVNYJ."))
344 ;; FIXME: this defun is cut-and-pasted from mule/latin.el
345 (defun setup-case-pairs (charset pairs)
346 (let ((tbl (standard-case-table)))
347 (loop for (uc lc) in pairs do
348 (put-case-table-pair (make-char charset uc) (make-char charset lc) tbl))))
353 (176 208) ;cyrillic letter a
354 (167 247) ;cyrillic letter yi
355 (205 237) ;cyrillic letter e
356 (174 254) ;cyrillic letter short u
357 (177 209) ;cyrillic letter be
358 (197 229) ;cyrillic letter ha
359 (184 216) ;cyrillic letter i
360 (180 212) ;cyrillic letter de
361 (198 230) ;cyrillic letter tse
362 (206 238) ;cyrillic letter yu
363 (190 222) ;cyrillic letter o
364 (168 248) ;cyrillic letter je
365 (202 234) ;cyrillic letter hard sign
366 (199 231) ;cyrillic letter che
367 (164 244) ;cyrillic letter ukrainian ie
368 (162 242) ;cyrillic letter dje
369 (179 211) ;cyrillic letter ghe
370 (195 227) ;cyrillic letter u
371 (191 223) ;cyrillic letter pe
372 (163 243) ;cyrillic letter gje
373 (194 226) ;cyrillic letter te
374 (172 252) ;cyrillic letter kje
375 (178 210) ;cyrillic letter ve
376 (169 249) ;cyrillic letter lje
377 (200 232) ;cyrillic letter sha
378 (170 250) ;cyrillic letter nje
379 (183 215) ;cyrillic letter ze
380 (165 245) ;cyrillic letter dze
381 (203 235) ;cyrillic letter yeru
382 (201 233) ;cyrillic letter shcha
383 (182 214) ;cyrillic letter zhe
384 (175 255) ;cyrillic letter dzhe
385 (196 228) ;cyrillic letter ef
386 (186 218) ;cyrillic letter ka
387 (204 236) ;cyrillic letter soft sign
388 (181 213) ;cyrillic letter ie
389 (187 219) ;cyrillic letter el
390 (188 220) ;cyrillic letter em
391 (189 221) ;cyrillic letter en
392 (171 251) ;cyrillic letter tshe
393 (192 224) ;cyrillic letter er
394 (161 241) ;cyrillic letter io
395 (166 246) ;cyrillic letter byelorussian-ukrainian i
396 (193 225) ;cyrillic letter es
397 (185 217) ;cyrillic letter short i
398 (207 239) ;cyrillic letter ya
401 ;; This is our utility function; we don't want it in the dumped XEmacs.
403 (fmakunbound 'setup-case-pairs)
405 ;;; cyrillic.el ends here