X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=dump-tables.el;h=0d4f798fa8b1f09d68d7b33bc8ae4393ea85c4b9;hb=98ba70ce2a2b9a5e7bf7ce06392328740cf1a0ae;hp=7abbd347ab93feb32a81c4bcaac008b77c8c10eb;hpb=c48cb4f231fa86728f4cdf3ad0da02af30c320da;p=chise%2Ftomoyo-tools.git diff --git a/dump-tables.el b/dump-tables.el index 7abbd34..0d4f798 100644 --- a/dump-tables.el +++ b/dump-tables.el @@ -1,6 +1,6 @@ ;;; dump-tables.el --- Dump utility of mapping tables -;; Copyright (C) 2002,2003 MORIOKA Tomohiko +;; Copyright (C) 2002,2003,2004,2005 MORIOKA Tomohiko ;; Author: MORIOKA Tomohiko ;; Keywords: Ideographs, Character Database, CHISE, UCS, Unicode @@ -26,11 +26,12 @@ (defun dump-94x94-ccs-to-ucs-table (filename default-file-name ccs ccs-prefix - ucs-ccs ucs-ccs-prefix) + ucs-domain ucs-ccs-prefix) (if (file-directory-p filename) (setq filename (expand-file-name default-file-name filename))) (with-temp-buffer - (let ((ucs-ccs-map (intern (format "=>%s" ucs-ccs))) + (let ((ucs-ccs (intern (format "=ucs@%s" ucs-domain))) + (ucs-ccs-map (intern (format "=>ucs@%s" ucs-domain))) (ccs-format (concat ccs-prefix "%02X%02X")) (ucs-ccs-format (concat "\t" ucs-ccs-prefix "%04X\t")) (row 33) @@ -40,9 +41,9 @@ (while (< cell 127) (when (and (setq chr (make-char ccs row cell)) (setq ucs (or (encode-char chr 'ucs 'defined-only) - (get-char-attribute chr '=>ucs)))) + (char-feature chr '=>ucs)))) (setq ucs-l (or (encode-char chr ucs-ccs 'defined-only) - (get-char-attribute chr ucs-ccs-map))) + (char-feature chr ucs-ccs-map))) (insert (format ccs-format row cell)) (if (and ucs-l (/= ucs-l ucs)) (insert (format ucs-ccs-format ucs-l)) @@ -60,14 +61,14 @@ (interactive "Fdump J90-to-UCS : ") (dump-94x94-ccs-to-ucs-table filename "J90-to-UCS.txt" - 'japanese-jisx0208-1990 "J90-" 'ucs-jis "JU+")) + 'japanese-jisx0208-1990 "J90-" 'jis "JU+")) ;;;###autoload (defun dump-jis-x0212-to-ucs-table (filename) (interactive "Fdump JSP-to-UCS : ") (dump-94x94-ccs-to-ucs-table filename "JSP-to-UCS.txt" - 'japanese-jisx0212 "JSP-" 'ucs-jis "JU+")) + 'japanese-jisx0212 "JSP-" 'jis "JU+")) ;;;###autoload (defun dump-jis-x0213-1-to-ucs-table (filename) @@ -87,7 +88,7 @@ (get-char-attribute chr '=>ucs)))) (when (setq ucs-j (or (encode-char chr '=ucs-jis-2000 'defined-only) - (get-char-attribute chr '=>ucs-jis))) + (get-char-attribute chr '=>ucs@jis))) (if (eq ucs-j ucs) (setq ucs-j nil))) (insert (format "JX1-%02X%02X" row cell)) @@ -107,21 +108,42 @@ (interactive "Fdump JX2-to-UCS : ") (dump-94x94-ccs-to-ucs-table filename "JX2-to-UCS.txt" - 'japanese-jisx0213-2 "JX2-" 'ucs-jis "JU+")) + 'japanese-jisx0213-2 "JX2-" 'jis "JU+")) + +;;;###autoload +(defun dump-ks-x1001-to-ucs-table (filename) + (interactive "Fdump K0-to-UCS : ") + (dump-94x94-ccs-to-ucs-table + filename "K0-to-UCS.txt" + '=ks-x1001 "K0-" 'ks "KU+")) + +;;;###autoload +(defun dump-cns-11643-1-to-ucs-table (filename) + (interactive "Fdump C1-to-UCS : ") + (dump-94x94-ccs-to-ucs-table + filename "C1-to-UCS.txt" + 'chinese-cns11643-1 "C1-" 'cns "CU+")) + +;;;###autoload +(defun dump-cns-11643-2-to-ucs-table (filename) + (interactive "Fdump C2-to-UCS : ") + (dump-94x94-ccs-to-ucs-table + filename "C2-to-UCS.txt" + 'chinese-cns11643-2 "C2-" 'cns "CU+")) ;;;###autoload (defun dump-cns-11643-3-to-ucs-table (filename) (interactive "Fdump C3-to-UCS : ") (dump-94x94-ccs-to-ucs-table filename "C3-to-UCS.txt" - 'chinese-cns11643-3 "C3-" 'ucs-cns "CU+")) + 'chinese-cns11643-3 "C3-" 'cns "CU+")) ;;;###autoload (defun dump-cns-11643-4-to-ucs-table (filename) (interactive "Fdump C4-to-UCS : ") (dump-94x94-ccs-to-ucs-table filename "C4-to-UCS.txt" - 'chinese-cns11643-4 "C4-" 'ucs-cns "CU+")) + 'chinese-cns11643-4 "C4-" 'cns "CU+")) ;;;###autoload (defun dump-big5-to-ucs-table (filename) @@ -138,7 +160,7 @@ (setq ucs (or (encode-char chr 'ucs 'defined-only) (get-char-attribute chr '=>ucs)))) (setq ucs-big5 (or (encode-char chr 'ucs-big5 'defined-only) - (get-char-attribute chr '=>ucs-big5))) + (get-char-attribute chr '=>ucs@big5))) (insert (format "B-%02X%02X" row cell)) (if ucs-big5 (insert (format "\tBU+%04X\t" ucs-big5)) @@ -194,6 +216,71 @@ (setq i (1+ i)))) (write-region (point-min)(point-max) filename))) +;;;###autoload +(defun dump-jis2ucsdkw (filename) + (interactive "Fdump jis2ucsdkw : ") + (if (file-directory-p filename) + (setq filename (expand-file-name "jis2ucsdkw.txt" filename))) + (with-temp-buffer + (let ((row 33) + cell chr ucs-j md) + (while (< row 127) + (setq cell 33) + (while (< cell 127) + (when (and (setq chr (make-char 'japanese-jisx0213-1 row cell)) + (setq ucs-j + (or (encode-char chr '=ucs@jis-2000 'defined-only) + (get-char-attribute chr '=>ucs@jis-2000) + (get-char-attribute chr '=>ucs@jis) + (get-char-attribute chr '=>ucs))) + (or (and (<= #x3400 ucs-j) (<= ucs-j #x9FA5)) + (and (<= #xF900 ucs-j) (<= ucs-j #xFA6F)) + (<= #x20000 ucs-j))) + (insert (format "J1-%02d%02d" (- row 32)(- cell 32))) + (if ucs-j + (insert (format " U+%05X" ucs-j)) + (insert " ")) + (setq md (char-daikanwa chr)) + (cond ((integerp md) + (insert (format " D%05d.0\n" md))) + ((eq (car md) 'ho) + (insert (format " DHo%03d\n" (nth 1 md)))) + (md + (insert (format " D%05d.%d\n" (car md)(nth 1 md)))) + (t + (insert "\n"))) + ) + (setq cell (1+ cell))) + (setq row (1+ row))) + (setq row 33) + (while (< row 127) + (setq cell 33) + (while (< cell 127) + (when (and (setq chr (make-char 'japanese-jisx0213-2 row cell)) + (setq ucs-j + (or (encode-char chr '=ucs@jis-2000 'defined-only) + (get-char-attribute chr '=>ucs@jis-2000) + (get-char-attribute chr '=>ucs@jis) + (get-char-attribute chr '=>ucs)))) + (insert (format "J2-%02d%02d" (- row 32)(- cell 32))) + (if ucs-j + (insert (format " U+%05X" ucs-j)) + (insert " ")) + (setq md (char-daikanwa chr)) + (cond ((integerp md) + (insert (format " D%05d.0\n" md))) + ((eq (car md) 'ho) + (insert (format " DHo%03d\n" (nth 1 md)))) + (md + (insert (format " D%05d.%d\n" (car md)(nth 1 md)))) + (t + (insert "\n"))) + ) + (setq cell (1+ cell))) + (setq row (1+ row))) + ) + (write-region (point-min)(point-max) filename))) + ;;; @ End. ;;;