Initial Commit
[packages] / xemacs-packages / footnote / footnote-cyrillic.el
1 ;;; footnote-cyrillic.el --- Cyrillic lettering for footnote mode
2
3 ;; Copyright (C) 1997 by Free Software Foundation, Inc.
4
5 ;; Author: Steven L Baur <steve@xemacs.org>
6 ;; Keywords: mule, news, mail
7 ;; Version: 0.17
8
9 ;; This file is part of XEmacs.
10
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)
14 ;; any later version.
15
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.
20
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
24 ;; 02111-1307, USA.
25
26 ;;; Synched up with: Not in FSF
27
28 ;;; Commentary:
29
30 ;; This file provides support for Cyrillic lettering in footnote mode.
31 ;; It requires an Emacs or XEmacs with MULE internationalization.
32
33 ;;; Change Log:
34
35 ;; Apr-05-1997: Replicate letters when footnote numbers hit the end of
36 ;;              the alphabet.
37 ;; Apr-18-1997: Added regexp to the footnote style alist.
38
39 ;;; Code:
40
41 (require 'footnote)
42
43 (defconst footnote-cyrillic-lower "\e-LÐÑæÔÕäÓåØÙÚÛÜÝÞßïàáâãÖÒìë×èíéçê"\e-A
44   "Cyrillic lower case alphabet.")
45
46 (defconst footnote-cyrillic-lower-regexp
47   (concat "[" footnote-cyrillic-lower "]")
48   "Regexp for lower case cyrillic.")
49
50 (defconst footnote-cyrillic-upper "\e-L°±Æ´µÄ³Å¸¹º»¼½¾¿ÏÀÁÂö²ÌË·ÈÍÉÇÊ"\e-A
51   "Cyrillic upper case alphabet.")
52
53 (defconst footnote-cyrillic-upper-regexp
54   (concat "[" footnote-cyrillic-upper "]")
55   "Regexp for upper case cyrillic.")
56
57 (defun Footnote-cyrillic-lower (n)
58   "Return a Cyrillic lower case letter.
59 Wrapping around the alphabet implies successive repetitions of letters."
60   (let* ((ltr (mod (1- n) (length footnote-cyrillic-lower)))
61          (rep (/ (1- n) (length footnote-cyrillic-lower)))
62          (chr (char-to-string (aref footnote-cyrillic-lower ltr)))
63          rc)
64     (while (>= rep 0)
65       (setq rc (concat rc chr))
66       (setq rep (1- rep)))
67     rc))
68
69 (defun Footnote-cyrillic-upper (n)
70   "Return a Cyrillic upper case letter.
71 Wrapping around the alphabet implies successive repetitions of letters."
72   (let* ((ltr (mod (1- n) (length footnote-cyrillic-upper)))
73          (rep (/ (1- n) (length footnote-cyrillic-upper)))
74          (chr (char-to-string (aref footnote-cyrillic-upper ltr)))
75          rc)
76     (while (>= rep 0)
77       (setq rc (concat rc chr))
78       (setq rep (1- rep)))
79     rc))
80
81 (setq footnote-style-alist
82       (append (list `(cyrillic-lower
83                       Footnote-cyrillic-lower
84                       ,footnote-cyrillic-lower-regexp)) footnote-style-alist))
85
86 (setq footnote-style-alist
87       (append (list `(cyrillic-upper
88                       Footnote-cyrillic-upper
89                       ,footnote-cyrillic-upper-regexp)) footnote-style-alist))
90
91 (provide 'footnote-cyrillic)
92
93 ;;; footnote-cyrillic.el ends here