771
|
1 ;;; cyril-util.el --- utilities for Cyrillic scripts -*- coding: iso-2022-7bit; -*-
|
|
2
|
|
3 ;; Copyright (C) 1997 Free Software Foundation, Inc.
|
788
|
4 ;; Copyright (C) 2002 Ben Wing.
|
771
|
5
|
|
6 ;; Keywords: mule, multilingual, Cyrillic
|
|
7
|
|
8 ;; This file is part of XEmacs.
|
|
9
|
|
10 ;; XEmacs is free software; you can redistribute it and/or modify it
|
|
11 ;; 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 ;; XEmacs is distributed in the hope that it will be useful, but
|
|
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
18 ;; General Public License for more details.
|
|
19
|
|
20 ;; You should have received a copy of the GNU General Public License
|
|
21 ;; along with XEmacs; see the file COPYING. If not, write to the Free
|
|
22 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
23 ;; 02111-1307, USA.
|
|
24
|
778
|
25 ;;; Synched up with: Emacs 21.1 (language/cyril-util.el).
|
|
26
|
|
27 ;;; Commentary:
|
771
|
28
|
|
29 ;;; Code:
|
|
30
|
|
31 ;;;###autoload
|
|
32 (defun cyrillic-encode-koi8-r-char (char)
|
|
33 "Return KOI8-R external character code of CHAR if appropriate."
|
788
|
34 (get-char-table char cyrillic-koi8-r-to-external-code-table))
|
771
|
35
|
|
36 ;;;###autoload
|
|
37 (defun cyrillic-encode-alternativnyj-char (char)
|
|
38 "Return ALTERNATIVNYJ external character code of CHAR if appropriate."
|
788
|
39 (get-char-table char cyrillic-alternativnyj-to-external-code-table))
|
771
|
40
|
|
41
|
|
42 ;; Display
|
|
43
|
|
44 ;; Written by Valery Alexeev <valery@math.uga.edu>.
|
|
45
|
|
46 (defvar cyrillic-language-alist
|
|
47 (list '("Belorussian") '("Bulgarian") '("Macedonian")
|
|
48 '("Russian") '("Serbo-Croatian") '("Ukrainian"))
|
|
49 "*List of known cyrillic languages")
|
|
50
|
|
51 ;;;###autoload
|
|
52 (defun standard-display-cyrillic-translit (&optional cyrillic-language)
|
|
53 "Display a cyrillic buffer using a transliteration.
|
|
54 For readability, the table is slightly
|
|
55 different from the one used for the input method `cyrillic-translit'.
|
|
56
|
|
57 The argument is a string which specifies which language you are using;
|
|
58 that affects the choice of transliterations slightly.
|
|
59 Possible values are listed in 'cyrillic-language-alist'.
|
|
60 If the argument is t, we use the default cyrillic transliteration.
|
|
61 If the argument is nil, we return the display table to its standard state."
|
|
62 (interactive
|
|
63 (list
|
|
64 (let* ((completion-ignore-case t))
|
|
65 (completing-read
|
|
66 "Cyrillic language (default nil): "
|
|
67 cyrillic-language-alist nil t nil nil nil))))
|
|
68
|
|
69 (or standard-display-table
|
|
70 (setq standard-display-table (make-display-table)))
|
|
71
|
|
72 (if (equal cyrillic-language "")
|
|
73 (setq cyrillic-language nil))
|
|
74
|
|
75 (if (null cyrillic-language)
|
|
76 (setq standard-display-table (make-display-table))
|
|
77 (aset standard-display-table ?,LP(B [?a])
|
|
78 (aset standard-display-table ?,LQ(B [?b])
|
|
79 (aset standard-display-table ?,LR(B [?v])
|
|
80 (aset standard-display-table ?,LS(B [?g])
|
|
81 (aset standard-display-table ?,LT(B [?d])
|
|
82 (aset standard-display-table ?,LU(B [?e])
|
|
83 (aset standard-display-table ?,Lq(B [?y?o])
|
|
84 (aset standard-display-table ?,LV(B [?z?h])
|
|
85 (aset standard-display-table ?,LW(B [?z])
|
|
86 (aset standard-display-table ?,LX(B [?i])
|
|
87 (aset standard-display-table ?,LY(B [?j])
|
|
88 (aset standard-display-table ?,LZ(B [?k])
|
|
89 (aset standard-display-table ?,L[(B [?l])
|
|
90 (aset standard-display-table ?,L\(B [?m])
|
|
91 (aset standard-display-table ?,L](B [?n])
|
|
92 (aset standard-display-table ?,L^(B [?o])
|
|
93 (aset standard-display-table ?,L_(B [?p])
|
|
94 (aset standard-display-table ?,L`(B [?r])
|
|
95 (aset standard-display-table ?,La(B [?s])
|
|
96 (aset standard-display-table ?,Lb(B [?t])
|
|
97 (aset standard-display-table ?,Lc(B [?u])
|
|
98 (aset standard-display-table ?,Ld(B [?f])
|
|
99 (aset standard-display-table ?,Le(B [?k?h])
|
|
100 (aset standard-display-table ?,Lf(B [?t?s])
|
|
101 (aset standard-display-table ?,Lg(B [?c?h])
|
|
102 (aset standard-display-table ?,Lh(B [?s?h])
|
|
103 (aset standard-display-table ?,Li(B [?s?c?h])
|
|
104 (aset standard-display-table ?,Lj(B [?~])
|
|
105 (aset standard-display-table ?,Lk(B [?y])
|
|
106 (aset standard-display-table ?,Ll(B [?'])
|
|
107 (aset standard-display-table ?,Lm(B [?e?'])
|
|
108 (aset standard-display-table ?,Ln(B [?y?u])
|
|
109 (aset standard-display-table ?,Lo(B [?y?a])
|
|
110
|
|
111 (aset standard-display-table ?,L0(B [?A])
|
|
112 (aset standard-display-table ?,L1(B [?B])
|
|
113 (aset standard-display-table ?,L2(B [?V])
|
|
114 (aset standard-display-table ?,L3(B [?G])
|
|
115 (aset standard-display-table ?,L4(B [?D])
|
|
116 (aset standard-display-table ?,L5(B [?E])
|
|
117 (aset standard-display-table ?,L!(B [?Y?o])
|
|
118 (aset standard-display-table ?,L6(B [?Z?h])
|
|
119 (aset standard-display-table ?,L7(B [?Z])
|
|
120 (aset standard-display-table ?,L8(B [?I])
|
|
121 (aset standard-display-table ?,L9(B [?J])
|
|
122 (aset standard-display-table ?,L:(B [?K])
|
|
123 (aset standard-display-table ?,L;(B [?L])
|
|
124 (aset standard-display-table ?,L<(B [?M])
|
|
125 (aset standard-display-table ?,L=(B [?N])
|
|
126 (aset standard-display-table ?,L>(B [?O])
|
|
127 (aset standard-display-table ?,L?(B [?P])
|
|
128 (aset standard-display-table ?,L@(B [?R])
|
|
129 (aset standard-display-table ?,LA(B [?S])
|
|
130 (aset standard-display-table ?,LB(B [?T])
|
|
131 (aset standard-display-table ?,LC(B [?U])
|
|
132 (aset standard-display-table ?,LD(B [?F])
|
|
133 (aset standard-display-table ?,LE(B [?K?h])
|
|
134 (aset standard-display-table ?,LF(B [?T?s])
|
|
135 (aset standard-display-table ?,LG(B [?C?h])
|
|
136 (aset standard-display-table ?,LH(B [?S?h])
|
|
137 (aset standard-display-table ?,LI(B [?S?c?h])
|
|
138 (aset standard-display-table ?,LJ(B [?~])
|
|
139 (aset standard-display-table ?,LK(B [?Y])
|
|
140 (aset standard-display-table ?,LL(B [?'])
|
|
141 (aset standard-display-table ?,LM(B [?E?'])
|
|
142 (aset standard-display-table ?,LN(B [?Y?u])
|
|
143 (aset standard-display-table ?,LO(B [?Y?a])
|
|
144
|
|
145 (aset standard-display-table ?,Lt(B [?i?e])
|
|
146 (aset standard-display-table ?,Lw(B [?i])
|
|
147 (aset standard-display-table ?,L~(B [?u])
|
|
148 (aset standard-display-table ?,Lr(B [?d?j])
|
|
149 (aset standard-display-table ?,L{(B [?c?h?j])
|
|
150 (aset standard-display-table ?,Ls(B [?g?j])
|
|
151 (aset standard-display-table ?,Lu(B [?s])
|
|
152 (aset standard-display-table ?,L|(B [?k])
|
|
153 (aset standard-display-table ?,Lv(B [?i])
|
|
154 (aset standard-display-table ?,Lx(B [?j])
|
|
155 (aset standard-display-table ?,Ly(B [?l?j])
|
|
156 (aset standard-display-table ?,Lz(B [?n?j])
|
|
157 (aset standard-display-table ?,L(B [?d?z])
|
|
158
|
|
159 (aset standard-display-table ?,L$(B [?Y?e])
|
|
160 (aset standard-display-table ?,L'(B [?Y?i])
|
|
161 (aset standard-display-table ?,L.(B [?U])
|
|
162 (aset standard-display-table ?,L"(B [?D?j])
|
|
163 (aset standard-display-table ?,L+(B [?C?h?j])
|
|
164 (aset standard-display-table ?,L#(B [?G?j])
|
|
165 (aset standard-display-table ?,L%(B [?S])
|
|
166 (aset standard-display-table ?,L,(B [?K])
|
|
167 (aset standard-display-table ?,L&(B [?I])
|
|
168 (aset standard-display-table ?,L((B [?J])
|
|
169 (aset standard-display-table ?,L)(B [?L?j])
|
|
170 (aset standard-display-table ?,L*(B [?N?j])
|
|
171 (aset standard-display-table ?,L/(B [?D?j])
|
|
172
|
|
173 (when (equal cyrillic-language "Bulgarian")
|
|
174 (aset standard-display-table ?,Li(B [?s?h?t])
|
|
175 (aset standard-display-table ?,LI(B [?S?h?t])
|
|
176 (aset standard-display-table ?,Ln(B [?i?u])
|
|
177 (aset standard-display-table ?,LN(B [?I?u])
|
|
178 (aset standard-display-table ?,Lo(B [?i?a])
|
|
179 (aset standard-display-table ?,LO(B [?I?a]))
|
|
180
|
|
181 (when (equal cyrillic-language "Ukrainian") ; based on the official
|
|
182 ; transliteration table
|
|
183 (aset standard-display-table ?,LX(B [?y])
|
|
184 (aset standard-display-table ?,L8(B [?Y])
|
|
185 (aset standard-display-table ?,LY(B [?i])
|
|
186 (aset standard-display-table ?,L9(B [?Y])
|
|
187 (aset standard-display-table ?,Ln(B [?i?u])
|
|
188 (aset standard-display-table ?,Lo(B [?i?a]))))
|
|
189
|
|
190
|
|
191 ;;
|
|
192 (provide 'cyril-util)
|
|
193
|
|
194 ;; Local Variables:
|
|
195 ;; coding: iso-2022-7bit
|
|
196 ;; End:
|
778
|
197
|
|
198 ;;; cyril-util.el ends here
|