1;;; cyril-util.el --- utilities for Cyrillic scripts 2 3;; Copyright (C) 1997, 1998, 2001, 2002, 2003, 2004, 2005, 4;; 2006, 2007 Free Software Foundation, Inc. 5 6;; Keywords: mule, multilingual, Cyrillic 7 8;; This file is part of GNU Emacs. 9 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. 14 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. 19 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., 51 Franklin Street, Fifth Floor, 23;; Boston, MA 02110-1301, USA. 24 25;;; Commentary: 26 27;;; Code: 28 29;; Fixme: are the next two useful? 30 31;;;###autoload 32(defun cyrillic-encode-koi8-r-char (char) 33 "Return KOI8-R external character code of CHAR if appropriate." 34 (aref (char-table-extra-slot 35 (get 'cyrillic-koi8-r-nonascii-translation-table 'translation-table) 36 0) 37 char)) 38 39;;;###autoload 40(defun cyrillic-encode-alternativnyj-char (char) 41 "Return ALTERNATIVNYJ external character code of CHAR if appropriate." 42 (aref (char-table-extra-slot 43 (get 'cyrillic-alternativnyj-nonascii-translation-table 44 'translation-table) 45 0) 46 char)) 47 48 49;; Display 50 51;; Written by Valery Alexeev <valery@math.uga.edu>. 52 53(defvar cyrillic-language-alist 54 (list '("Belorussian") '("Bulgarian") '("Macedonian") 55 '("Russian") '("Serbo-Croatian") '("Ukrainian")) 56 "List of known cyrillic languages.") 57 58;;;###autoload 59(defun standard-display-cyrillic-translit (&optional cyrillic-language) 60 "Display a cyrillic buffer using a transliteration. 61For readability, the table is slightly 62different from the one used for the input method `cyrillic-translit'. 63 64The argument is a string which specifies which language you are using; 65that affects the choice of transliterations slightly. 66Possible values are listed in `cyrillic-language-alist'. 67If the argument is t, we use the default cyrillic transliteration. 68If the argument is nil, we return the display table to its standard state." 69 (interactive 70 (list 71 (let* ((completion-ignore-case t)) 72 (completing-read 73 "Cyrillic language (default nil): " 74 cyrillic-language-alist nil t nil nil nil)))) 75 76 (or standard-display-table 77 (setq standard-display-table (make-display-table))) 78 79 (if (equal cyrillic-language "") 80 (setq cyrillic-language nil)) 81 82 (if (null cyrillic-language) 83 (setq standard-display-table (make-display-table)) 84 (aset standard-display-table ?,LP(B [?a]) 85 (aset standard-display-table ?,LQ(B [?b]) 86 (aset standard-display-table ?,LR(B [?v]) 87 (aset standard-display-table ?,LS(B [?g]) 88 (aset standard-display-table ?,LT(B [?d]) 89 (aset standard-display-table ?,LU(B [?e]) 90 (aset standard-display-table ?,Lq(B [?y ?o]) 91 (aset standard-display-table ?,LV(B [?z ?h]) 92 (aset standard-display-table ?,LW(B [?z]) 93 (aset standard-display-table ?,LX(B [?i]) 94 (aset standard-display-table ?,LY(B [?j]) 95 (aset standard-display-table ?,LZ(B [?k]) 96 (aset standard-display-table ?,L[(B [?l]) 97 (aset standard-display-table ?,L\(B [?m]) 98 (aset standard-display-table ?,L](B [?n]) 99 (aset standard-display-table ?,L^(B [?o]) 100 (aset standard-display-table ?,L_(B [?p]) 101 (aset standard-display-table ?,L`(B [?r]) 102 (aset standard-display-table ?,La(B [?s]) 103 (aset standard-display-table ?,Lb(B [?t]) 104 (aset standard-display-table ?,Lc(B [?u]) 105 (aset standard-display-table ?,Ld(B [?f]) 106 (aset standard-display-table ?,Le(B [?k ?h]) 107 (aset standard-display-table ?,Lf(B [?t ?s]) 108 (aset standard-display-table ?,Lg(B [?c ?h]) 109 (aset standard-display-table ?,Lh(B [?s ?h]) 110 (aset standard-display-table ?,Li(B [?s ?c ?h]) 111 (aset standard-display-table ?,Lj(B [?~]) 112 (aset standard-display-table ?,Lk(B [?y]) 113 (aset standard-display-table ?,Ll(B [?']) 114 (aset standard-display-table ?,Lm(B [?e ?']) 115 (aset standard-display-table ?,Ln(B [?y ?u]) 116 (aset standard-display-table ?,Lo(B [?y ?a]) 117 118 (aset standard-display-table ?,L0(B [?A]) 119 (aset standard-display-table ?,L1(B [?B]) 120 (aset standard-display-table ?,L2(B [?V]) 121 (aset standard-display-table ?,L3(B [?G]) 122 (aset standard-display-table ?,L4(B [?D]) 123 (aset standard-display-table ?,L5(B [?E]) 124 (aset standard-display-table ?,L!(B [?Y ?o]) 125 (aset standard-display-table ?,L6(B [?Z ?h]) 126 (aset standard-display-table ?,L7(B [?Z]) 127 (aset standard-display-table ?,L8(B [?I]) 128 (aset standard-display-table ?,L9(B [?J]) 129 (aset standard-display-table ?,L:(B [?K]) 130 (aset standard-display-table ?,L;(B [?L]) 131 (aset standard-display-table ?,L<(B [?M]) 132 (aset standard-display-table ?,L=(B [?N]) 133 (aset standard-display-table ?,L>(B [?O]) 134 (aset standard-display-table ?,L?(B [?P]) 135 (aset standard-display-table ?,L@(B [?R]) 136 (aset standard-display-table ?,LA(B [?S]) 137 (aset standard-display-table ?,LB(B [?T]) 138 (aset standard-display-table ?,LC(B [?U]) 139 (aset standard-display-table ?,LD(B [?F]) 140 (aset standard-display-table ?,LE(B [?K ?h]) 141 (aset standard-display-table ?,LF(B [?T ?s]) 142 (aset standard-display-table ?,LG(B [?C ?h]) 143 (aset standard-display-table ?,LH(B [?S ?h]) 144 (aset standard-display-table ?,LI(B [?S ?c ?h]) 145 (aset standard-display-table ?,LJ(B [?~]) 146 (aset standard-display-table ?,LK(B [?Y]) 147 (aset standard-display-table ?,LL(B [?']) 148 (aset standard-display-table ?,LM(B [?E ?']) 149 (aset standard-display-table ?,LN(B [?Y ?u]) 150 (aset standard-display-table ?,LO(B [?Y ?a]) 151 152 (aset standard-display-table ?,Lt(B [?i ?e]) 153 (aset standard-display-table ?,Lw(B [?i]) 154 (aset standard-display-table ?,L~(B [?u]) 155 (aset standard-display-table ?,Lr(B [?d ?j]) 156 (aset standard-display-table ?,L{(B [?c ?h ?j]) 157 (aset standard-display-table ?,Ls(B [?g ?j]) 158 (aset standard-display-table ?,Lu(B [?s]) 159 (aset standard-display-table ?,L|(B [?k]) 160 (aset standard-display-table ?,Lv(B [?i]) 161 (aset standard-display-table ?,Lx(B [?j]) 162 (aset standard-display-table ?,Ly(B [?l ?j]) 163 (aset standard-display-table ?,Lz(B [?n ?j]) 164 (aset standard-display-table ?,L(B [?d ?z]) 165 166 (aset standard-display-table ?,L$(B [?Y ?e]) 167 (aset standard-display-table ?,L'(B [?Y ?i]) 168 (aset standard-display-table ?,L.(B [?U]) 169 (aset standard-display-table ?,L"(B [?D ?j]) 170 (aset standard-display-table ?,L+(B [?C ?h ?j]) 171 (aset standard-display-table ?,L#(B [?G ?j]) 172 (aset standard-display-table ?,L%(B [?S]) 173 (aset standard-display-table ?,L,(B [?K]) 174 (aset standard-display-table ?,L&(B [?I]) 175 (aset standard-display-table ?,L((B [?J]) 176 (aset standard-display-table ?,L)(B [?L ?j]) 177 (aset standard-display-table ?,L*(B [?N ?j]) 178 (aset standard-display-table ?,L/(B [?D ?j]) 179 180 ;; Unicode version: 181 (aset standard-display-table ?$,1(P(B [?a]) 182 (aset standard-display-table ?$,1(Q(B [?b]) 183 (aset standard-display-table ?$,1(R(B [?v]) 184 (aset standard-display-table ?$,1(S(B [?g]) 185 (aset standard-display-table ?$,1(T(B [?d]) 186 (aset standard-display-table ?$,1(U(B [?e]) 187 (aset standard-display-table ?$,1(q(B [?y ?o]) 188 (aset standard-display-table ?$,1(V(B [?z ?h]) 189 (aset standard-display-table ?$,1(W(B [?z]) 190 (aset standard-display-table ?$,1(X(B [?i]) 191 (aset standard-display-table ?$,1(Y(B [?j]) 192 (aset standard-display-table ?$,1(Z(B [?k]) 193 (aset standard-display-table ?$,1([(B [?l]) 194 (aset standard-display-table ?$,1(\(B [?m]) 195 (aset standard-display-table ?$,1(](B [?n]) 196 (aset standard-display-table ?$,1(^(B [?o]) 197 (aset standard-display-table ?$,1(_(B [?p]) 198 (aset standard-display-table ?$,1(`(B [?r]) 199 (aset standard-display-table ?$,1(a(B [?s]) 200 (aset standard-display-table ?$,1(b(B [?t]) 201 (aset standard-display-table ?$,1(c(B [?u]) 202 (aset standard-display-table ?$,1(d(B [?f]) 203 (aset standard-display-table ?$,1(e(B [?k ?h]) 204 (aset standard-display-table ?$,1(f(B [?t ?s]) 205 (aset standard-display-table ?$,1(g(B [?c ?h]) 206 (aset standard-display-table ?$,1(h(B [?s ?h]) 207 (aset standard-display-table ?$,1(i(B [?s ?c ?h]) 208 (aset standard-display-table ?$,1(j(B [?~]) 209 (aset standard-display-table ?$,1(k(B [?y]) 210 (aset standard-display-table ?$,1(l(B [?']) 211 (aset standard-display-table ?$,1(m(B [?e ?']) 212 (aset standard-display-table ?$,1(n(B [?y ?u]) 213 (aset standard-display-table ?$,1(o(B [?y ?a]) 214 215 (aset standard-display-table ?$,1(0(B [?A]) 216 (aset standard-display-table ?$,1(1(B [?B]) 217 (aset standard-display-table ?$,1(2(B [?V]) 218 (aset standard-display-table ?$,1(3(B [?G]) 219 (aset standard-display-table ?$,1(4(B [?D]) 220 (aset standard-display-table ?$,1(5(B [?E]) 221 (aset standard-display-table ?$,1(!(B [?Y ?o]) 222 (aset standard-display-table ?$,1(6(B [?Z ?h]) 223 (aset standard-display-table ?$,1(7(B [?Z]) 224 (aset standard-display-table ?$,1(8(B [?I]) 225 (aset standard-display-table ?$,1(9(B [?J]) 226 (aset standard-display-table ?$,1(:(B [?K]) 227 (aset standard-display-table ?$,1(;(B [?L]) 228 (aset standard-display-table ?$,1(<(B [?M]) 229 (aset standard-display-table ?$,1(=(B [?N]) 230 (aset standard-display-table ?$,1(>(B [?O]) 231 (aset standard-display-table ?$,1(?(B [?P]) 232 (aset standard-display-table ?$,1(@(B [?R]) 233 (aset standard-display-table ?$,1(A(B [?S]) 234 (aset standard-display-table ?$,1(B(B [?T]) 235 (aset standard-display-table ?$,1(C(B [?U]) 236 (aset standard-display-table ?$,1(D(B [?F]) 237 (aset standard-display-table ?$,1(E(B [?K ?h]) 238 (aset standard-display-table ?$,1(F(B [?T ?s]) 239 (aset standard-display-table ?$,1(G(B [?C ?h]) 240 (aset standard-display-table ?$,1(H(B [?S ?h]) 241 (aset standard-display-table ?$,1(I(B [?S ?c ?h]) 242 (aset standard-display-table ?$,1(J(B [?~]) 243 (aset standard-display-table ?$,1(K(B [?Y]) 244 (aset standard-display-table ?$,1(L(B [?']) 245 (aset standard-display-table ?$,1(M(B [?E ?']) 246 (aset standard-display-table ?$,1(N(B [?Y ?u]) 247 (aset standard-display-table ?$,1(O(B [?Y ?a]) 248 249 (aset standard-display-table ?$,1(t(B [?i ?e]) 250 (aset standard-display-table ?$,1(w(B [?i]) 251 (aset standard-display-table ?$,1(~(B [?u]) 252 (aset standard-display-table ?$,1(r(B [?d ?j]) 253 (aset standard-display-table ?$,1({(B [?c ?h ?j]) 254 (aset standard-display-table ?$,1(s(B [?g ?j]) 255 (aset standard-display-table ?$,1(u(B [?s]) 256 (aset standard-display-table ?$,1(|(B [?k]) 257 (aset standard-display-table ?$,1(v(B [?i]) 258 (aset standard-display-table ?$,1(x(B [?j]) 259 (aset standard-display-table ?$,1(y(B [?l ?j]) 260 (aset standard-display-table ?$,1(z(B [?n ?j]) 261 (aset standard-display-table ?$,1((B [?d ?z]) 262 263 (aset standard-display-table ?$,1($(B [?Y ?e]) 264 (aset standard-display-table ?$,1('(B [?Y ?i]) 265 (aset standard-display-table ?$,1(.(B [?U]) 266 (aset standard-display-table ?$,1("(B [?D ?j]) 267 (aset standard-display-table ?$,1(+(B [?C ?h ?j]) 268 (aset standard-display-table ?$,1(#(B [?G ?j]) 269 (aset standard-display-table ?$,1(%(B [?S]) 270 (aset standard-display-table ?$,1(,(B [?K]) 271 (aset standard-display-table ?$,1(&(B [?I]) 272 (aset standard-display-table ?$,1(((B [?J]) 273 (aset standard-display-table ?$,1()(B [?L ?j]) 274 (aset standard-display-table ?$,1(*(B [?N ?j]) 275 (aset standard-display-table ?$,1(/(B [?D ?j]) 276 277 (when (equal cyrillic-language "Bulgarian") 278 (aset standard-display-table ?,Li(B [?s ?h ?t]) 279 (aset standard-display-table ?,LI(B [?S ?h ?t]) 280 (aset standard-display-table ?,Ln(B [?i ?u]) 281 (aset standard-display-table ?,LN(B [?I ?u]) 282 (aset standard-display-table ?,Lo(B [?i ?a]) 283 (aset standard-display-table ?,LO(B [?I ?a]) 284 ;; Unicode version: 285 (aset standard-display-table ?$,1(i(B [?s ?h ?t]) 286 (aset standard-display-table ?$,1(I(B [?S ?h ?t]) 287 (aset standard-display-table ?$,1(n(B [?i ?u]) 288 (aset standard-display-table ?$,1(N(B [?I ?u]) 289 (aset standard-display-table ?$,1(o(B [?i ?a]) 290 (aset standard-display-table ?$,1(O(B [?I ?a])) 291 292 (when (equal cyrillic-language "Ukrainian") ; based on the official 293 ; transliteration table 294 (aset standard-display-table ?,LX(B [?y]) 295 (aset standard-display-table ?,L8(B [?Y]) 296 (aset standard-display-table ?,LY(B [?i]) 297 (aset standard-display-table ?,L9(B [?Y]) 298 (aset standard-display-table ?,Ln(B [?i ?u]) 299 (aset standard-display-table ?,Lo(B [?i ?a]) 300 ;; Unicode version: 301 (aset standard-display-table ?$,1(X(B [?y]) 302 (aset standard-display-table ?$,1(8(B [?Y]) 303 (aset standard-display-table ?$,1(Y(B [?i]) 304 (aset standard-display-table ?$,1(9(B [?Y]) 305 (aset standard-display-table ?$,1(n(B [?i ?u]) 306 (aset standard-display-table ?$,1(o(B [?i ?a])))) 307 308;; 309(provide 'cyril-util) 310 311;; Local Variables: 312;; coding: iso-2022-7bit 313;; End: 314 315;;; arch-tag: f6d9dd5d-685c-45d6-a5d8-1e2178228b7e 316;;; cyril-util.el ends here 317