1 ;;; read-maps.el --- Read mapping-tables.
3 ;; Copyright (C) 2002 MORIOKA Tomohiko
5 ;; Author: MORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
6 ;; Keywords: UTF-2000, UCS-4, character, CCS, multiscript, multilingual
8 ;; This file is part of XEmacs UTF-2000.
10 ;; XEmacs UTF-2000 is free software; you can redistribute it and/or
11 ;; modify it under the terms of the GNU General Public License as
12 ;; published by the Free Software Foundation; either version 2, or (at
13 ;; your option) any later version.
15 ;; XEmacs UTF-2000 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 GNU
18 ;; General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with XEmacs UTF-2000; see the file COPYING. If not, write to
22 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
28 (defun mapping-table-read-file (filename)
30 (interactive "fMapping table : ")
33 (insert-file-contents filename)
34 (goto-char (point-min))
35 (let (line ccs code ucs ucs-pat ucs-ccs ucs-code chr)
37 (cond ((looking-at "^J90-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\)")
38 (setq ccs 'japanese-jisx0208-1990
39 code (string-to-int (match-string 1) 16)
40 ucs-pat "\tJU[+-]\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]+\\)"
42 (goto-char (match-end 0))
44 ((looking-at "^JSP-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\)")
45 (setq ccs 'japanese-jisx0212
46 code (string-to-int (match-string 1) 16)
47 ucs-pat "\tJU[+-]\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]+\\)"
49 (goto-char (match-end 0))
51 ((looking-at "^JX1-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\)")
52 (setq ccs 'japanese-jisx0213-1
53 code (string-to-int (match-string 1) 16)
54 ucs-pat "\tJU[+-]\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]+\\)"
56 (goto-char (match-end 0))
58 ((looking-at "^JX2-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\)")
59 (setq ccs 'japanese-jisx0213-2
60 code (string-to-int (match-string 1) 16)
61 ucs-pat "\tJU[+-]\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]+\\)"
63 (goto-char (match-end 0))
65 ((looking-at "^C3-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\)")
66 (setq ccs 'chinese-cns11643-3
67 code (string-to-int (match-string 1) 16)
68 ucs-pat "\tCU[+-]\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]+\\)"
70 (goto-char (match-end 0))
72 ((looking-at "^C4-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\)")
73 (setq ccs 'chinese-cns11643-4
74 code (string-to-int (match-string 1) 16)
75 ucs-pat "\tCU[+-]\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]+\\)"
77 (goto-char (match-end 0))
79 ((looking-at "^B-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\)")
80 (setq ccs 'chinese-big5
81 code (string-to-int (match-string 1) 16)
82 ucs-pat "\tBU[+-]\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]+\\)"
84 (goto-char (match-end 0))
86 ((looking-at "^JC3-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\)")
88 code (string-to-int (match-string 1) 16)
91 (goto-char (match-end 0))
101 (looking-at ucs-pat))
103 (string-to-int (match-string 1) 16)
104 (goto-char (match-end 0)))))
107 "[ \t]*U[+-]\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]+\\)")
108 (string-to-int (match-string 1) 16)))
109 (when (setq chr (decode-char ccs code))
110 (unless (eq (encode-char chr ccs 'defined-only)
111 ;; (get-char-attribute chr ccs)
113 (put-char-attribute chr ccs code))
115 (not (eq (or (get-char-attribute chr ucs-ccs)
116 (get-char-attribute chr 'ucs)
117 (get-char-attribute chr '=>ucs))
119 (put-char-attribute chr ucs-ccs ucs-code))
121 (not (eq (or (get-char-attribute chr 'ucs)
122 (get-char-attribute chr '=>ucs))
124 (put-char-attribute chr
135 ;;; read-maps.el ends here