]> code.delx.au - gnu-emacs/blobdiff - lisp/language/cyril-util.el
(indian-make-hash): Switch makehash -> make-hash-table.
[gnu-emacs] / lisp / language / cyril-util.el
index a13536ca990dc850293e787bbe644cdfc205d970..e35d45b5afe5f30beba618cf2ea7628ba8d85844 100644 (file)
@@ -1,7 +1,6 @@
-;;; cyril-util.el ---  utilities for Cyrillic scripts
+;;; cyril-util.el --- utilities for Cyrillic scripts
 
-;; Copyright (C) 1997 Electrotechnical Laboratory, JAPAN.
-;; Licensed to the Free Software Foundation.
+;; Copyright (C) 1997, 2001 Free Software Foundation, Inc.
 
 ;; Keywords: mule, multilingual, Cyrillic
 
 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 ;; Boston, MA 02111-1307, USA.
 
+;;; Commentary:
+
 ;;; Code:
 
 ;;;###autoload
-(defun setup-cyrillic-environment ()
-  "Setup multilingual environment (MULE) for Cyrillic users."
-  (interactive)
-  (setup-8-bit-environment "Cyrillic" 'cyrillic-iso8859-5 'cyrillic-iso-8bit
-                          "cyrillic-yawerty"))
-  (setq primary-language "Cyrillic"))
+(defun cyrillic-encode-koi8-r-char (char)
+  "Return KOI8-R external character code of CHAR if appropriate."
+  (aref (char-table-extra-slot
+        (get 'cyrillic-koi8-r-nonascii-translation-table 'translation-table)
+        0)
+       char))
+
+;;;###autoload
+(defun cyrillic-encode-alternativnyj-char (char)
+  "Return ALTERNATIVNYJ external character code of CHAR if appropriate."
+  (aref (char-table-extra-slot
+        (get 'cyrillic-alternativnyj-nonascii-translation-table
+             'translation-table)
+        0)
+       char))
+
+\f
+;; Display
+
+;; Written by Valery Alexeev <valery@math.uga.edu>.
+
+(defvar cyrillic-language-alist
+      (list '("Belorussian") '("Bulgarian") '("Macedonian")
+           '("Russian") '("Serbo-Croatian") '("Ukrainian"))
+      "List of known cyrillic languages.")
+
+;;;###autoload
+(defun standard-display-cyrillic-translit (&optional cyrillic-language)
+  "Display a cyrillic buffer using a transliteration.
+For readability, the table is slightly
+different from the one used for the input method `cyrillic-translit'.
+
+The argument is a string which specifies which language you are using;
+that affects the choice of transliterations slightly.
+Possible values are listed in `cyrillic-language-alist'.
+If the argument is t, we use the default cyrillic transliteration.
+If the argument is nil, we return the display table to its standard state."
+  (interactive
+   (list
+    (let* ((completion-ignore-case t))
+      (completing-read
+       "Cyrillic language (default nil): "
+       cyrillic-language-alist nil t nil nil nil))))
+
+  (or standard-display-table
+      (setq standard-display-table (make-display-table)))
+
+  (if (equal cyrillic-language "")
+      (setq cyrillic-language nil))
+
+  (if (null cyrillic-language)
+      (setq standard-display-table (make-display-table))
+    (aset standard-display-table ?\e,LP\e(B  [?a])
+    (aset standard-display-table ?\e,LQ\e(B  [?b])
+    (aset standard-display-table ?\e,LR\e(B  [?v])
+    (aset standard-display-table ?\e,LS\e(B  [?g])
+    (aset standard-display-table ?\e,LT\e(B  [?d])
+    (aset standard-display-table ?\e,LU\e(B  [?e])
+    (aset standard-display-table ?\e,Lq\e(B  [?y?o])
+    (aset standard-display-table ?\e,LV\e(B  [?z?h])
+    (aset standard-display-table ?\e,LW\e(B  [?z])
+    (aset standard-display-table ?\e,LX\e(B  [?i])
+    (aset standard-display-table ?\e,LY\e(B  [?j])
+    (aset standard-display-table ?\e,LZ\e(B  [?k])
+    (aset standard-display-table ?\e,L[\e(B  [?l])
+    (aset standard-display-table ?\e,L\\e(B  [?m])
+    (aset standard-display-table ?\e,L]\e(B  [?n])
+    (aset standard-display-table ?\e,L^\e(B  [?o])
+    (aset standard-display-table ?\e,L_\e(B  [?p])
+    (aset standard-display-table ?\e,L`\e(B  [?r])
+    (aset standard-display-table ?\e,La\e(B  [?s])
+    (aset standard-display-table ?\e,Lb\e(B  [?t])
+    (aset standard-display-table ?\e,Lc\e(B  [?u])
+    (aset standard-display-table ?\e,Ld\e(B  [?f])
+    (aset standard-display-table ?\e,Le\e(B  [?k?h])
+    (aset standard-display-table ?\e,Lf\e(B  [?t?s])
+    (aset standard-display-table ?\e,Lg\e(B  [?c?h])
+    (aset standard-display-table ?\e,Lh\e(B  [?s?h])
+    (aset standard-display-table ?\e,Li\e(B  [?s?c?h])
+    (aset standard-display-table ?\e,Lj\e(B  [?~])
+    (aset standard-display-table ?\e,Lk\e(B  [?y])
+    (aset standard-display-table ?\e,Ll\e(B  [?'])
+    (aset standard-display-table ?\e,Lm\e(B  [?e?'])
+    (aset standard-display-table ?\e,Ln\e(B  [?y?u])
+    (aset standard-display-table ?\e,Lo\e(B  [?y?a])
+    
+    (aset standard-display-table ?\e,L0\e(B  [?A])
+    (aset standard-display-table ?\e,L1\e(B  [?B])
+    (aset standard-display-table ?\e,L2\e(B  [?V])
+    (aset standard-display-table ?\e,L3\e(B  [?G])
+    (aset standard-display-table ?\e,L4\e(B  [?D])
+    (aset standard-display-table ?\e,L5\e(B  [?E])
+    (aset standard-display-table ?\e,L!\e(B  [?Y?o])
+    (aset standard-display-table ?\e,L6\e(B  [?Z?h])
+    (aset standard-display-table ?\e,L7\e(B  [?Z])
+    (aset standard-display-table ?\e,L8\e(B  [?I])
+    (aset standard-display-table ?\e,L9\e(B  [?J])
+    (aset standard-display-table ?\e,L:\e(B  [?K])
+    (aset standard-display-table ?\e,L;\e(B  [?L])
+    (aset standard-display-table ?\e,L<\e(B  [?M])
+    (aset standard-display-table ?\e,L=\e(B  [?N])
+    (aset standard-display-table ?\e,L>\e(B  [?O])
+    (aset standard-display-table ?\e,L?\e(B  [?P])
+    (aset standard-display-table ?\e,L@\e(B  [?R])
+    (aset standard-display-table ?\e,LA\e(B  [?S])
+    (aset standard-display-table ?\e,LB\e(B  [?T])
+    (aset standard-display-table ?\e,LC\e(B  [?U])
+    (aset standard-display-table ?\e,LD\e(B  [?F])
+    (aset standard-display-table ?\e,LE\e(B  [?K?h])
+    (aset standard-display-table ?\e,LF\e(B  [?T?s])
+    (aset standard-display-table ?\e,LG\e(B  [?C?h])
+    (aset standard-display-table ?\e,LH\e(B  [?S?h])
+    (aset standard-display-table ?\e,LI\e(B  [?S?c?h])
+    (aset standard-display-table ?\e,LJ\e(B  [?~])
+    (aset standard-display-table ?\e,LK\e(B  [?Y])
+    (aset standard-display-table ?\e,LL\e(B  [?'])
+    (aset standard-display-table ?\e,LM\e(B  [?E?'])
+    (aset standard-display-table ?\e,LN\e(B  [?Y?u])
+    (aset standard-display-table ?\e,LO\e(B  [?Y?a])
+
+    (aset standard-display-table ?\e,Lt\e(B  [?i?e])
+    (aset standard-display-table ?\e,Lw\e(B  [?i])
+    (aset standard-display-table ?\e,L~\e(B  [?u])
+    (aset standard-display-table ?\e,Lr\e(B  [?d?j])
+    (aset standard-display-table ?\e,L{\e(B  [?c?h?j])
+    (aset standard-display-table ?\e,Ls\e(B  [?g?j])
+    (aset standard-display-table ?\e,Lu\e(B  [?s])
+    (aset standard-display-table ?\e,L|\e(B  [?k])
+    (aset standard-display-table ?\e,Lv\e(B  [?i])
+    (aset standard-display-table ?\e,Lx\e(B  [?j])
+    (aset standard-display-table ?\e,Ly\e(B  [?l?j])
+    (aset standard-display-table ?\e,Lz\e(B  [?n?j])
+    (aset standard-display-table ?\e,L\7f\e(B  [?d?z])
+
+    (aset standard-display-table ?\e,L$\e(B  [?Y?e])
+    (aset standard-display-table ?\e,L'\e(B  [?Y?i])
+    (aset standard-display-table ?\e,L.\e(B  [?U])
+    (aset standard-display-table ?\e,L"\e(B  [?D?j])
+    (aset standard-display-table ?\e,L+\e(B  [?C?h?j])
+    (aset standard-display-table ?\e,L#\e(B  [?G?j])
+    (aset standard-display-table ?\e,L%\e(B  [?S])
+    (aset standard-display-table ?\e,L,\e(B  [?K])
+    (aset standard-display-table ?\e,L&\e(B  [?I])
+    (aset standard-display-table ?\e,L(\e(B  [?J])
+    (aset standard-display-table ?\e,L)\e(B  [?L?j])
+    (aset standard-display-table ?\e,L*\e(B  [?N?j])
+    (aset standard-display-table ?\e,L/\e(B  [?D?j])
+
+    ;; Unicode version:
+    (aset standard-display-table ?\e$,1(P\e(B  [?a])
+    (aset standard-display-table ?\e$,1(Q\e(B  [?b])
+    (aset standard-display-table ?\e$,1(R\e(B  [?v])
+    (aset standard-display-table ?\e$,1(S\e(B  [?g])
+    (aset standard-display-table ?\e$,1(T\e(B  [?d])
+    (aset standard-display-table ?\e$,1(U\e(B  [?e])
+    (aset standard-display-table ?\e$,1(q\e(B  [?y?o])
+    (aset standard-display-table ?\e$,1(V\e(B  [?z?h])
+    (aset standard-display-table ?\e$,1(W\e(B  [?z])
+    (aset standard-display-table ?\e$,1(X\e(B  [?i])
+    (aset standard-display-table ?\e$,1(Y\e(B  [?j])
+    (aset standard-display-table ?\e$,1(Z\e(B  [?k])
+    (aset standard-display-table ?\e$,1([\e(B  [?l])
+    (aset standard-display-table ?\e$,1(\\e(B  [?m])
+    (aset standard-display-table ?\e$,1(]\e(B  [?n])
+    (aset standard-display-table ?\e$,1(^\e(B  [?o])
+    (aset standard-display-table ?\e$,1(_\e(B  [?p])
+    (aset standard-display-table ?\e$,1(`\e(B  [?r])
+    (aset standard-display-table ?\e$,1(a\e(B  [?s])
+    (aset standard-display-table ?\e$,1(b\e(B  [?t])
+    (aset standard-display-table ?\e$,1(c\e(B  [?u])
+    (aset standard-display-table ?\e$,1(d\e(B  [?f])
+    (aset standard-display-table ?\e$,1(e\e(B  [?k?h])
+    (aset standard-display-table ?\e$,1(f\e(B  [?t?s])
+    (aset standard-display-table ?\e$,1(g\e(B  [?c?h])
+    (aset standard-display-table ?\e$,1(h\e(B  [?s?h])
+    (aset standard-display-table ?\e$,1(i\e(B  [?s?c?h])
+    (aset standard-display-table ?\e$,1(j\e(B  [?~])
+    (aset standard-display-table ?\e$,1(k\e(B  [?y])
+    (aset standard-display-table ?\e$,1(l\e(B  [?'])
+    (aset standard-display-table ?\e$,1(m\e(B  [?e?'])
+    (aset standard-display-table ?\e$,1(n\e(B  [?y?u])
+    (aset standard-display-table ?\e$,1(o\e(B  [?y?a])
+
+    (aset standard-display-table ?\e$,1(0\e(B  [?A])
+    (aset standard-display-table ?\e$,1(1\e(B  [?B])
+    (aset standard-display-table ?\e$,1(2\e(B  [?V])
+    (aset standard-display-table ?\e$,1(3\e(B  [?G])
+    (aset standard-display-table ?\e$,1(4\e(B  [?D])
+    (aset standard-display-table ?\e$,1(5\e(B  [?E])
+    (aset standard-display-table ?\e$,1(!\e(B  [?Y?o])
+    (aset standard-display-table ?\e$,1(6\e(B  [?Z?h])
+    (aset standard-display-table ?\e$,1(7\e(B  [?Z])
+    (aset standard-display-table ?\e$,1(8\e(B  [?I])
+    (aset standard-display-table ?\e$,1(9\e(B  [?J])
+    (aset standard-display-table ?\e$,1(:\e(B  [?K])
+    (aset standard-display-table ?\e$,1(;\e(B  [?L])
+    (aset standard-display-table ?\e$,1(<\e(B  [?M])
+    (aset standard-display-table ?\e$,1(=\e(B  [?N])
+    (aset standard-display-table ?\e$,1(>\e(B  [?O])
+    (aset standard-display-table ?\e$,1(?\e(B  [?P])
+    (aset standard-display-table ?\e$,1(@\e(B  [?R])
+    (aset standard-display-table ?\e$,1(A\e(B  [?S])
+    (aset standard-display-table ?\e$,1(B\e(B  [?T])
+    (aset standard-display-table ?\e$,1(C\e(B  [?U])
+    (aset standard-display-table ?\e$,1(D\e(B  [?F])
+    (aset standard-display-table ?\e$,1(E\e(B  [?K?h])
+    (aset standard-display-table ?\e$,1(F\e(B  [?T?s])
+    (aset standard-display-table ?\e$,1(G\e(B  [?C?h])
+    (aset standard-display-table ?\e$,1(H\e(B  [?S?h])
+    (aset standard-display-table ?\e$,1(I\e(B  [?S?c?h])
+    (aset standard-display-table ?\e$,1(J\e(B  [?~])
+    (aset standard-display-table ?\e$,1(K\e(B  [?Y])
+    (aset standard-display-table ?\e$,1(L\e(B  [?'])
+    (aset standard-display-table ?\e$,1(M\e(B  [?E?'])
+    (aset standard-display-table ?\e$,1(N\e(B  [?Y?u])
+    (aset standard-display-table ?\e$,1(O\e(B  [?Y?a])
+
+    (aset standard-display-table ?\e$,1(t\e(B  [?i?e])
+    (aset standard-display-table ?\e$,1(w\e(B  [?i])
+    (aset standard-display-table ?\e$,1(~\e(B  [?u])
+    (aset standard-display-table ?\e$,1(r\e(B  [?d?j])
+    (aset standard-display-table ?\e$,1({\e(B  [?c?h?j])
+    (aset standard-display-table ?\e$,1(s\e(B  [?g?j])
+    (aset standard-display-table ?\e$,1(u\e(B  [?s])
+    (aset standard-display-table ?\e$,1(|\e(B  [?k])
+    (aset standard-display-table ?\e$,1(v\e(B  [?i])
+    (aset standard-display-table ?\e$,1(x\e(B  [?j])
+    (aset standard-display-table ?\e$,1(y\e(B  [?l?j])
+    (aset standard-display-table ?\e$,1(z\e(B  [?n?j])
+    (aset standard-display-table ?\e$,1(\7f\e(B  [?d?z])
+
+    (aset standard-display-table ?\e$,1($\e(B  [?Y?e])
+    (aset standard-display-table ?\e$,1('\e(B  [?Y?i])
+    (aset standard-display-table ?\e$,1(.\e(B  [?U])
+    (aset standard-display-table ?\e$,1("\e(B  [?D?j])
+    (aset standard-display-table ?\e$,1(+\e(B  [?C?h?j])
+    (aset standard-display-table ?\e$,1(#\e(B  [?G?j])
+    (aset standard-display-table ?\e$,1(%\e(B  [?S])
+    (aset standard-display-table ?\e$,1(,\e(B  [?K])
+    (aset standard-display-table ?\e$,1(&\e(B  [?I])
+    (aset standard-display-table ?\e$,1((\e(B  [?J])
+    (aset standard-display-table ?\e$,1()\e(B  [?L?j])
+    (aset standard-display-table ?\e$,1(*\e(B  [?N?j])
+    (aset standard-display-table ?\e$,1(/\e(B  [?D?j])
+
+    (when (equal cyrillic-language "Bulgarian")
+      (aset standard-display-table ?\e,Li\e(B [?s?h?t])
+      (aset standard-display-table ?\e,LI\e(B [?S?h?t])
+      (aset standard-display-table ?\e,Ln\e(B [?i?u])
+      (aset standard-display-table ?\e,LN\e(B [?I?u])
+      (aset standard-display-table ?\e,Lo\e(B [?i?a])
+      (aset standard-display-table ?\e,LO\e(B [?I?a])
+      ;; Unicode version:
+      (aset standard-display-table ?\e$,1(i\e(B [?s?h?t])
+      (aset standard-display-table ?\e$,1(I\e(B [?S?h?t])
+      (aset standard-display-table ?\e$,1(n\e(B [?i?u])
+      (aset standard-display-table ?\e$,1(N\e(B [?I?u])
+      (aset standard-display-table ?\e$,1(o\e(B [?i?a])
+      (aset standard-display-table ?\e$,1(O\e(B [?I?a]))
+
+    (when (equal cyrillic-language "Ukrainian")        ; based on the official
+                                       ; transliteration table
+      (aset standard-display-table ?\e,LX\e(B [?y])
+      (aset standard-display-table ?\e,L8\e(B [?Y])
+      (aset standard-display-table ?\e,LY\e(B [?i])
+      (aset standard-display-table ?\e,L9\e(B [?Y])
+      (aset standard-display-table ?\e,Ln\e(B [?i?u])
+      (aset standard-display-table ?\e,Lo\e(B [?i?a])
+      ;; Unicode version:
+      (aset standard-display-table ?\e$,1(X\e(B [?y])
+      (aset standard-display-table ?\e$,1(8\e(B [?Y])
+      (aset standard-display-table ?\e$,1(Y\e(B [?i])
+      (aset standard-display-table ?\e$,1(9\e(B [?Y])
+      (aset standard-display-table ?\e$,1(n\e(B [?i?u])
+      (aset standard-display-table ?\e$,1(o\e(B [?i?a]))))
 
 ;;
 (provide 'cyril-util)
 
+;; Local Variables:
+;; coding: iso-2022-7bit
+;; End:
+
 ;;; cyril-util.el ends here