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