]> code.delx.au - gnu-emacs/blob - admin/charsets/mule-charsets.el
Remove duplicate binding
[gnu-emacs] / admin / charsets / mule-charsets.el
1 ;; mule-charsets.el -- Generate Mule-original charset maps.
2 ;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
3 ;; National Institute of Advanced Industrial Science and Technology (AIST)
4 ;; Registration Number H13PRO009
5
6 ;; This file is part of GNU Emacs.
7
8 ;; GNU Emacs is free software: you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation, either version 3 of the License, or
11 ;; (at your option) any later version.
12
13 ;; GNU Emacs is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
17
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
20
21
22 ;; For the record: the old, pre-v23 code was this:
23 ;; (if (not (or (and (= emacs-major-version 21) (= emacs-minor-version 4))
24 ;; (= emacs-major-version 22)))
25 ;; (error "Use Emacs of version 21.4 or any of version 22"))
26 ;;
27 ;; (defun func (start end)
28 ;; (while (<= start end)
29 ;; (let ((split (split-char start))
30 ;; (unicode (encode-char start 'ucs)))
31 ;; (if unicode
32 ;; (if (nth 2 split)
33 ;; (insert (format "0x%02X%02X 0x%04X\n"
34 ;; (nth 1 split) (nth 2 split) unicode))
35 ;; (insert (format "0x%02X 0x%04X\n" (nth 1 split) unicode)))))
36 ;; (setq start (1+ start))))
37
38 (defun func (range charset)
39 (let ((start (car range))
40 (end (cdr range)))
41 (while (and (<= start end) (<= start #x10ffff))
42 (let ((ch (encode-char start charset)))
43 (if ch
44 (if (> ch 256)
45 (insert (format "0x%04X 0x%04X\n" ch start))
46 (insert (format "0x%02X 0x%04X\n" ch start)))))
47 (setq start (1+ start)))))
48
49 (defconst charset-alist
50 '(("MULE-ethiopic.map" . ethiopic)
51 ("MULE-ipa.map" . ipa)
52 ("MULE-is13194.map" . indian-is13194)
53 ("MULE-sisheng.map" . chinese-sisheng)
54 ("MULE-tibetan.map" . tibetan)
55 ("MULE-lviscii.map" . vietnamese-viscii-lower)
56 ("MULE-uviscii.map" . vietnamese-viscii-upper)))
57
58 (defconst header
59 (format
60 "# Generated by running admin/charsets/mule-charsets.el in Emacs %d.%d.\n"
61 emacs-major-version emacs-minor-version))
62
63 (dolist (elt charset-alist)
64 (with-temp-buffer
65 (insert header)
66 (map-charset-chars 'func (cdr elt) (cdr elt))
67 (sort-lines nil (point-min) (point-max))
68 (let ((coding-system-for-write 'unix))
69 (write-file (car elt)))))
70