(require 'ids)
;;;###autoload
-(defun ids-read-buffer (buffer)
- (interactive "bBuffer = ")
+(defun ids-read-buffer (buffer &optional simplify)
+ (interactive "bBuffer = \nP")
(save-excursion
(set-buffer buffer)
(goto-char (point-min))
- (let (line chs ids char structure)
+ (let (line chs ids code char structure)
(while (not (eobp))
(unless (looking-at ";")
(setq line
((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 "M-\\([0-9]+\\)'" chs)
+ (setq code (string-to-int (match-string 1 chs)))
+ (map-char-attribute
+ (lambda (key val)
+ (if (and (eq (car val) code)
+ (eq (nth 1 val) 1)
+ (null (nthcdr 2 val)))
+ key))
+ 'morohashi-daikanwa))
+ ((string-match "M-\\([0-9]+\\)\"" chs)
+ (setq code (string-to-int (match-string 1 chs)))
+ (map-char-attribute
+ (lambda (key val)
+ (if (and (eq (car val) code)
+ (eq (nth 1 val) 2)
+ (null (nthcdr 2 val)))
+ key))
+ 'morohashi-daikanwa))
((string-match "M-\\([0-9]+\\)" chs)
(decode-char 'ideograph-daikanwa
(string-to-int (match-string 1 chs))))
+ ((string-match "MH-\\([0-9]+\\)" chs)
+ (setq code (string-to-int (match-string 1 chs)))
+ (map-char-attribute
+ (lambda (key val)
+ (if (and (eq (car val) 'ho)
+ (eq (nth 1 val) code)
+ (null (nthcdr 2 val)))
+ key))
+ 'morohashi-daikanwa))
+ ((string-match "CB\\([0-9]+\\)" chs)
+ (decode-char 'ideograph-cbeta
+ (string-to-int (match-string 1 chs))))
))
(when (and char
(>= (length ids) 3)
(not (string-match "\\?" ids))
- (consp (setq structure (ids-parse-string ids))))
+ (consp (setq structure (ids-parse-string ids simplify))))
(put-char-attribute char
'ideographic-structure
(cdr (car structure))))
))))
;;;###autoload
-(defun ids-read-file (file)
- (interactive "fIDS file = ")
+(defun ids-read-file (file &optional simplify)
+ (interactive "fIDS file = \nP")
(with-temp-buffer
(insert-file-contents file)
- (ids-read-buffer (current-buffer))))
+ (ids-read-buffer (current-buffer) simplify)))
;;; @ End.