;;; ids-read.el --- Reader for IDS-* files
-;; Copyright (C) 2002 MORIOKA Tomohiko
+;; Copyright (C) 2002,2003 MORIOKA Tomohiko
;; Author: MORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
;; Keywords: IDS, IDC, Ideographs, UCS, Unicode
(require 'ids)
;;;###autoload
-(defun ids-read-buffer (buffer &optional simplify)
+(defun ids-read-buffer (buffer &optional simplify soft)
(interactive "bBuffer = \nP")
(save-excursion
(set-buffer buffer)
((string-match "U[-+]\\([0-9A-F]+\\)" chs)
(decode-char 'ucs
(string-to-int (match-string 1 chs) 16)))
+ ((string-match "J90-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\)"
+ chs)
+ (decode-char 'japanese-jisx0208-1990
+ (string-to-int (match-string 1 chs) 16)))
+ ((string-match
+ "C\\([1-7]\\)-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\)"
+ chs)
+ (decode-char
+ (intern
+ (concat "chinese-cns11643-" (match-string 1 chs)))
+ (string-to-int (match-string 2 chs) 16)))
+ ((string-match "CDP-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\)"
+ chs)
+ (decode-char '=big5-cdp
+ (string-to-int (match-string 1 chs) 16)))
+ ((string-match
+ "HZK\\([0-9][0-9]\\)-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\)"
+ chs)
+ (decode-char (intern
+ (format "=hanziku-%d"
+ (string-to-int (match-string 1 chs))))
+ (string-to-int (match-string 2 chs) 16)))
((string-match "M-\\([0-9]+\\)'" chs)
(setq code (string-to-int (match-string 1 chs)))
(map-char-attribute
(string-to-int (match-string 1 chs))))
))
(when (and char
+ (or (not soft)
+ (null
+ (get-char-attribute char 'ideographic-structure)))
(>= (length ids) 3)
(not (string-match "\\?" ids))
(consp (setq structure (ids-parse-string ids simplify))))
))))
;;;###autoload
-(defun ids-read-file (file &optional simplify)
+(defun ids-read-file (file &optional simplify soft)
(interactive "fIDS file = \nP")
(with-temp-buffer
(insert-file-contents file)
- (ids-read-buffer (current-buffer) simplify)))
+ (ids-read-buffer (current-buffer) simplify soft)))
;;; @ End.