;;; read-maps.el --- Read mapping-tables.
-;; Copyright (C) 2002,2003 MORIOKA Tomohiko
+;; Copyright (C) 2002,2003,2004 MORIOKA Tomohiko
;; Author: MORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
-;; Keywords: UTF-2000, UCS-4, character, CCS, multiscript, multilingual
+;; Keywords: mapping table, character, CCS, multiscript, multilingual
-;; This file is part of XEmacs UTF-2000.
+;; This file is part of XEmacs CHISE.
-;; XEmacs UTF-2000 is free software; you can redistribute it and/or
+;; XEmacs CHISE is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation; either version 2, or (at
;; your option) any later version.
-;; XEmacs UTF-2000 is distributed in the hope that it will be useful,
+;; XEmacs CHISE is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with XEmacs UTF-2000; see the file COPYING. If not, write to
+;; along with XEmacs CHISE; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
(setq ccs '=jis-x0213-2-2000
code (string-to-int (match-string 1) 16)
ucs-pat "\tJU[+-]\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]+\\)"
- ucs-ccs 'ucs-jis)
+ ucs-ccs '=ucs@jis-2000)
+ (goto-char (match-end 0))
+ )
+ ((looking-at "^C1-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\)")
+ (setq ccs 'chinese-cns11643-1
+ code (string-to-int (match-string 1) 16)
+ ucs-pat "\tCU[+-]\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]+\\)"
+ ucs-ccs 'ucs-cns)
+ (goto-char (match-end 0))
+ )
+ ((looking-at "^C2-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\)")
+ (setq ccs 'chinese-cns11643-2
+ code (string-to-int (match-string 1) 16)
+ ucs-pat "\tCU[+-]\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]+\\)"
+ ucs-ccs 'ucs-cns)
(goto-char (match-end 0))
)
((looking-at "^C3-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\)")
(if (looking-at
"[ \t]*U[+-]\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]+\\)")
(string-to-int (match-string 1) 16)))
+ (if (and ucs-ccs ucs (not ucs-code))
+ (setq ucs-code ucs
+ ucs nil))
(when (setq chr (decode-char ccs code))
(unless (eq (encode-char chr ccs 'defined-only)
code)
(put-char-attribute chr ccs code))
(when (and ucs-code
(not (eq (or (encode-char chr ucs-ccs 'defined-only)
- (get-char-attribute chr '=>ucs))
+ (char-feature chr '=>ucs))
ucs-code)))
(put-char-attribute chr ucs-ccs ucs-code))
(when (and ucs
(not (eq (or (encode-char chr '=ucs 'defined-only)
- (and (not (eq ucs-ccs 'ucs-jis))
- (get-char-attribute chr '=>ucs)))
+ (and (not (memq ucs-ccs '(ucs-jis
+ =ucs-jis-1990
+ =ucs-jis-2000
+ ;; ucs-big5
+ )))
+ (char-feature chr '=>ucs)))
ucs)))
(if (or ucs-code (null ucs-ccs))
- (put-char-attribute chr '=>ucs ucs)
+ (unless (eq (char-feature chr '=>ucs) ucs)
+ (put-char-attribute chr '=>ucs ucs))
(unless (eq (encode-char chr ucs-ccs 'defined-only)
ucs)
(put-char-attribute chr ucs-ccs ucs)))))
(forward-line)))))
+(defun jp-jouyou-read-file (filename)
+ (interactive "fjp-jouyou file : ")
+ (with-temp-buffer
+ (buffer-disable-undo)
+ (insert-file-contents filename)
+ (goto-char (point-min))
+ (let (char tchars)
+ (while (re-search-forward "^[^\t\n ]+\t\\(.\\)\t*" nil t)
+ (setq char (aref (match-string 1) 0)
+ tchars (buffer-substring (match-end 0)
+ (point-at-eol)))
+ (when (> (length tchars) 0)
+ (setq tchars
+ (mapcar (lambda (c)
+ (aref c 0))
+ (split-string tchars " ")))
+ (unless (or (equal (char-feature char '<-simplified@JP/Jouyou)
+ tchars)
+ (and (equal (char-feature char '<-simplified)
+ tchars)
+ (memq 'JP/Jouyou
+ (char-feature char '<-simplified*sources))))
+ (put-char-attribute char
+ '<-simplified@JP/Jouyou
+ tchars)))
+ ;; (put-char-attribute
+ ;; char 'script (adjoin
+ ;; 'JP
+ ;; (adjoin
+ ;; 'Jouyou
+ ;; (adjoin
+ ;; 'Ideograph
+ ;; (get-char-attribute char 'script)))))
+ ))))
(provide 'read-maps)