From: tomo Date: Fri, 6 Sep 2002 08:35:30 +0000 (+0000) Subject: New file. X-Git-Tag: chise-base-0_23~74 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3578e474bb3d1004cef40eedd8eb9f1096f70bb8;p=chise%2Ftomoyo-tools.git New file. --- diff --git a/dump-tables.el b/dump-tables.el new file mode 100644 index 0000000..2852a08 --- /dev/null +++ b/dump-tables.el @@ -0,0 +1,195 @@ +(defun dump-jis-x0208-1990-to-ucs-table (filename) + (interactive "Fdump J90-to-UCS : ") + (if (file-directory-p filename) + (setq filename (expand-file-name "J90-to-UCS.txt" filename))) + (with-temp-buffer + (let ((row 33) + cell chr ucs ucs-j) + (while (< row 127) + (setq cell 33) + (while (< cell 127) + (when (and (setq chr (make-char 'japanese-jisx0208-1990 row cell)) + (setq ucs (or (get-char-attribute chr 'ucs) + (get-char-attribute chr '=>ucs) + (get-char-attribute chr '->ucs)))) + (setq ucs-j (or (get-char-attribute chr 'ucs-jis) + (get-char-attribute chr '=>ucs-jis))) + (insert (format "J90-%02X%02X" row cell)) + (if ucs-j + (insert (format "\tJU+%04X\t" ucs-j)) + (insert "\t ")) + (insert (format (if (<= ucs #xFFFF) + "U+%04X\n" + "U-%08X\n") + ucs))) + (setq cell (1+ cell))) + (setq row (1+ row)))) + (write-region (point-min)(point-max) filename))) + +(defun dump-jis-x0212-to-ucs-table (filename) + (interactive "Fdump JSP-to-UCS : ") + (if (file-directory-p filename) + (setq filename (expand-file-name "JSP-to-UCS.txt" filename))) + (with-temp-buffer + (let ((row 33) + cell chr ucs ucs-j) + (while (< row 127) + (setq cell 33) + (while (< cell 127) + (when (and (setq chr (make-char 'japanese-jisx0212 row cell)) + (setq ucs (or (get-char-attribute chr 'ucs) + (get-char-attribute chr '=>ucs) + (get-char-attribute chr '->ucs)))) + (setq ucs-j (or (get-char-attribute chr 'ucs-jis) + (get-char-attribute chr '=>ucs-jis))) + (insert (format "JSP-%02X%02X" row cell)) + (if ucs-j + (insert (format "\tJU+%04X\t" ucs-j)) + (insert "\t ")) + (insert (format (if (<= ucs #xFFFF) + "U+%04X\n" + "U-%08X\n") + ucs))) + (setq cell (1+ cell))) + (setq row (1+ row)))) + (write-region (point-min)(point-max) filename))) + +(defun dump-jis-x0213-1-to-ucs-table (filename) + (interactive "Fdump JX1-to-UCS : ") + (if (file-directory-p filename) + (setq filename (expand-file-name "JX1-to-UCS.txt" filename))) + (with-temp-buffer + (let ((row 33) + cell chr ucs ucs-j) + (while (< row 127) + (setq cell 33) + (while (< cell 127) + (when (and (setq chr (make-char 'japanese-jisx0213-1 row cell)) + (setq ucs (or (get-char-attribute chr 'ucs) + (get-char-attribute chr '=>ucs) + (get-char-attribute chr '->ucs)))) + (setq ucs-j (or (get-char-attribute chr 'ucs-jis) + (get-char-attribute chr '=>ucs-jis))) + (insert (format "JX1-%02X%02X" row cell)) + (if ucs-j + (insert (format "\tJU+%04X\t" ucs-j)) + (insert "\t ")) + (insert (format (if (<= ucs #xFFFF) + "U+%04X\n" + "U-%08X\n") + ucs))) + (setq cell (1+ cell))) + (setq row (1+ row)))) + (write-region (point-min)(point-max) filename))) + +(defun dump-jis-x0213-2-to-ucs-table (filename) + (interactive "Fdump JX2-to-UCS : ") + (if (file-directory-p filename) + (setq filename (expand-file-name "JX2-to-UCS.txt" filename))) + (with-temp-buffer + (let ((row 33) + cell chr ucs ucs-j) + (while (< row 127) + (setq cell 33) + (while (< cell 127) + (when (and (setq chr (make-char 'japanese-jisx0213-2 row cell)) + (setq ucs (or (get-char-attribute chr 'ucs) + (get-char-attribute chr '=>ucs) + (get-char-attribute chr '->ucs)))) + (setq ucs-j (or (get-char-attribute chr 'ucs-jis) + (get-char-attribute chr '=>ucs-jis))) + (insert (format "JX2-%02X%02X" row cell)) + (if ucs-j + (insert (format "\tJU+%04X\t" ucs-j)) + (insert "\t ")) + (insert (format (if (<= ucs #xFFFF) + "U+%04X\n" + "U-%08X\n") + ucs))) + (setq cell (1+ cell))) + (setq row (1+ row)))) + (write-region (point-min)(point-max) filename))) + +(defun dump-cns-11643-3-to-ucs-table (filename) + (interactive "Fdump C3-to-UCS : ") + (if (file-directory-p filename) + (setq filename (expand-file-name "C3-to-UCS.txt" filename))) + (with-temp-buffer + (let ((row 33) + cell chr ucs ucs-cns) + (while (< row 127) + (setq cell 33) + (while (< cell 127) + (when (and (setq chr (make-char 'chinese-cns11643-3 row cell)) + (setq ucs (or (get-char-attribute chr 'ucs) + (get-char-attribute chr '=>ucs) + (get-char-attribute chr '->ucs)))) + (setq ucs-cns (or (get-char-attribute chr 'ucs-cns) + (get-char-attribute chr '=>ucs-cns))) + (insert (format "C3-%02X%02X" row cell)) + (if ucs-cns + (insert (format "\tCU+%04X\t" ucs-cns)) + (insert "\t ")) + (insert (format (if (<= ucs #xFFFF) + "U+%04X\n" + "U-%08X\n") + ucs))) + (setq cell (1+ cell))) + (setq row (1+ row)))) + (write-region (point-min)(point-max) filename))) + +(defun dump-cns-11643-4-to-ucs-table (filename) + (interactive "Fdump C4-to-UCS : ") + (if (file-directory-p filename) + (setq filename (expand-file-name "C4-to-UCS.txt" filename))) + (with-temp-buffer + (let ((row 33) + cell chr ucs ucs-cns) + (while (< row 127) + (setq cell 33) + (while (< cell 127) + (when (and (setq chr (make-char 'chinese-cns11643-4 row cell)) + (setq ucs (or (get-char-attribute chr 'ucs) + (get-char-attribute chr '=>ucs) + (get-char-attribute chr '->ucs)))) + (setq ucs-cns (or (get-char-attribute chr 'ucs-cns) + (get-char-attribute chr '=>ucs-cns))) + (insert (format "C4-%02X%02X" row cell)) + (if ucs-cns + (insert (format "\tCU+%04X\t" ucs-cns)) + (insert "\t ")) + (insert (format (if (<= ucs #xFFFF) + "U+%04X\n" + "U-%08X\n") + ucs))) + (setq cell (1+ cell))) + (setq row (1+ row)))) + (write-region (point-min)(point-max) filename))) + +(defun dump-big5-to-ucs-table (filename) + (interactive "Fdump B-to-UCS : ") + (if (file-directory-p filename) + (setq filename (expand-file-name "B-to-UCS.txt" filename))) + (with-temp-buffer + (let ((row #xA1) + cell chr ucs ucs-big5) + (while (<= row #xFE) + (setq cell #x40) + (while (< cell #xFE) + (when (and (setq chr (make-char 'chinese-big5 row cell)) + (setq ucs (or (get-char-attribute chr 'ucs) + (get-char-attribute chr '=>ucs) + (get-char-attribute chr '->ucs)))) + (setq ucs-big5 (or (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)) + (insert "\t ")) + (insert (format (if (<= ucs #xFFFF) + "U+%04X\n" + "U-%08X\n") + ucs))) + (setq cell (1+ cell))) + (setq row (1+ row)))) + (write-region (point-min)(point-max) filename)))