X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=ids-dump.el;h=c2e07988991fdef85331f6a286e7fa154ca6d676;hb=e13313e9957cb236f3823732cfa4cf36457f03fa;hp=03ada62d6033657959b12710f760fdc5c18afb69;hpb=233186c37f770a4f1b4c42d12cdbdf7f12519fd1;p=chise%2Fids.git diff --git a/ids-dump.el b/ids-dump.el index 03ada62..c2e0798 100644 --- a/ids-dump.el +++ b/ids-dump.el @@ -1,6 +1,6 @@ ;;; ids-dump.el --- Dump utility of IDS-* files -;; Copyright (C) 2002,2003 MORIOKA Tomohiko +;; Copyright (C) 2002,2003,2004,2005,2009,2011,2019 MORIOKA Tomohiko ;; Author: MORIOKA Tomohiko ;; Keywords: IDS, IDC, Ideographs, UCS, Unicode @@ -26,6 +26,20 @@ (require 'ids) +(defun ids-dump-format-list (ids-list) + (if ids-list + (let (ucs) + (mapconcat + (lambda (c) + (char-to-string + (if (setq ucs + (unless (encode-char c '=ucs 'defined-only) + (or (get-char-attribute c '=ucs@unicode) + (get-char-attribute c '=ucs@iso)))) + (decode-char '=ucs ucs) + c))) + (ids-format-list ids-list) "")))) + (defun ids-dump-insert-line (ccs line-spec code) (let ((chr (decode-char ccs code)) id-list) @@ -34,7 +48,7 @@ (insert (format line-spec code (decode-builtin-char ccs code) (if id-list - (ids-format-list id-list) + (ids-dump-format-list id-list) (char-to-string chr))))))) (defun ids-dump-insert-ccs-ranges (ccs line-spec &rest ranges) @@ -88,7 +102,7 @@ (insert (format "M-%05d \t%c\t%s\n" i (decode-builtin-char 'ideograph-daikanwa i) - (or (ids-format-list + (or (ids-dump-format-list (get-char-attribute chr 'ideographic-structure)) "")))) (when (setq sal (assq i mdh-alist)) @@ -98,7 +112,7 @@ (insert (format "M-%05d'\t%c\t%s\n" i chr - (or (ids-format-list + (or (ids-dump-format-list (get-char-attribute chr 'ideographic-structure)) "")))) (when (setq chr (assq 2 sal)) @@ -106,7 +120,7 @@ (insert (format "M-%05d\"\t%c\t%s\n" i chr - (ids-format-list + (ids-dump-format-list (get-char-attribute chr 'ideographic-structure))))) ) (setq i (1+ i))))) @@ -127,7 +141,7 @@ (format "MH-%04d \t%c\t%s\n" (car cell) chr - (or (ids-format-list + (or (ids-dump-format-list (get-char-attribute chr 'ideographic-structure)) "")))))) @@ -145,7 +159,7 @@ h l (decode-builtin-char 'japanese-jisx0208-1990 (logior (lsh h 8) l)) - (or (ids-format-list + (or (ideographic-structure-to-ids (get-char-attribute chr 'ideographic-structure)) ""))) (setq cell (1+ cell))) @@ -160,7 +174,7 @@ h l (decode-builtin-char 'japanese-jisx0208-1990 (logior (lsh h 8) l)) - (or (ids-format-list + (or (ideographic-structure-to-ids (get-char-attribute chr 'ideographic-structure)) ""))) (setq cell (1+ cell))))) @@ -201,6 +215,48 @@ (setq l (1+ l))) (setq h (1+ h))))) +(defun ids-dump-insert-big5-pua (ccs prefix) + (let ((line-spec (concat prefix "%04X\t%c\t%s\n")) + (h #x81) + l) + (while (<= h #xA0) + (setq l #x40) + (while (<= l #x7E) + (ids-dump-insert-line ccs line-spec (logior (lsh h 8) l)) + (setq l (1+ l))) + (setq l #xA1) + (while (<= l #xFE) + (ids-dump-insert-line ccs line-spec (logior (lsh h 8) l)) + (setq l (1+ l))) + (setq h (1+ h))) + (setq h #xC6) + (setq l #xDE) + (while (<= l #xFE) + (ids-dump-insert-line ccs line-spec (logior (lsh h 8) l)) + (setq l (1+ l))) + (setq h #xC7) + (while (<= h #xC8) + (setq l #x40) + (while (<= l #x7E) + (ids-dump-insert-line ccs line-spec (logior (lsh h 8) l)) + (setq l (1+ l))) + (setq l #xA1) + (while (<= l #xFE) + (ids-dump-insert-line ccs line-spec (logior (lsh h 8) l)) + (setq l (1+ l))) + (setq h (1+ h))) + (setq h #xFA) + (while (<= h #xFE) + (setq l #x40) + (while (<= l #x7E) + (ids-dump-insert-line ccs line-spec (logior (lsh h 8) l)) + (setq l (1+ l))) + (setq l #xA1) + (while (<= l #xFE) + (ids-dump-insert-line ccs line-spec (logior (lsh h 8) l)) + (setq l (1+ l))) + (setq h (1+ h))))) + (defun ids-dump-range (file path func &rest args) (with-temp-buffer (let* ((coding-system-for-write 'utf-8-mcs-er)) @@ -215,6 +271,14 @@ (interactive "Fdump IDS-UCS-Basic : ") (ids-dump-range "IDS-UCS-Basic.txt" filename #'ids-dump-insert-ccs-ranges 'ucs "U+%04X\t%c\t%s\n" + '(#x4E00 . #x9FEA))) + +;;;###autoload +(defun ids-dump-ucs-basic@unicode (filename) + (interactive "Fdump IDS-UCS-Basic : ") + (ids-dump-range "IDS-UCS-Basic_u.txt" filename + #'ids-dump-insert-ccs-ranges '=ucs@unicode + "UU+%04X\t%c\t%s\n" '(#x4E00 . #x9FA5))) ;;;###autoload @@ -406,7 +470,7 @@ (defun ids-dump-big5-cdp (filename) (interactive "Fdump IDS-CDP : ") (ids-dump-range "IDS-CDP.txt" filename - #'ids-dump-insert-big5 + #'ids-dump-insert-big5-pua '=big5-cdp "CDP-"))