(decode-builtin-char): Use `charset-name'.
[chise/xemacs-chise.git-] / lisp / utf-2000 / char-db-util.el
index a7f4e37..acbc639 100644 (file)
          )
        (when (setq cell (assq '->ucs data))
          (setq cell (cdr cell))
-         (insert (format "(->ucs\t\t. #x%04X)
+         (insert (format "(->ucs\t\t. #x%04X)\t; %c
     "
-                         cell))
+                         cell (decode-char 'ucs cell)))
          (setq data (del-alist '->ucs data))
          )
        (when (setq cell (assq 'general-category data))
                 (insert
                  (format
                   (if has-long-ccs-name
-                      "(%-26s . %X)
+                      (if (eq ret (find-charset 'ideograph-daikanwa))
+                          "(%-26s . %05d)\t; %c
+    "
+                        "(%-26s . #x%X)\t; %c
     "
-                    "(%-18s . %X)
+                        )
+                    (if (eq ret (find-charset 'ideograph-daikanwa))
+                        "(%-18s . %05d)\t; %c
     "
-                    )
+                      "(%-18s . #x%X)\t; %c
+    "
+                      ))
                   (charset-name ret)
                   (if (= (charset-iso-graphic-plane ret) 1)
                       (logior (cdr cell)
                                     ((= (charset-dimension ret) 3)
                                      #x808080)
                                     (t 0)))
-                    (cdr cell)))))
+                    (cdr cell))
+                  (decode-builtin-char ret (cdr cell)))))
                ((string-match "^->" (symbol-name (car cell)))
                 (insert
                  (format "(%-18s %s)
        (tabify (point-min)(point-max))
        ))))
 
+(defun decode-builtin-char (charset code-point)
+  (setq charset (get-charset charset))
+  (if (and (not (eq (charset-name charset) 'ideograph-daikanwa))
+          (or (memq (charset-name charset)
+                    '(ascii latin-viscii-upper
+                            latin-viscii-lower
+                            arabic-iso8859-6
+                            japanese-jisx0213-1
+                            japanese-jisx0213-2))
+              (= (char-int (charset-iso-final-char charset)) 0)))
+      (decode-char charset code-point)
+    (let ((table (charset-mapping-table charset)))
+      (if table
+         (prog2
+             (set-charset-mapping-table charset nil)
+             (decode-char charset code-point)
+           (set-charset-mapping-table charset table))
+       (decode-char charset code-point)))))
+
 ;;;###autoload
 (defun char-db-update-comment ()
   (interactive)
       )))
 
 (defun write-char-range-data-to-file (min max file)
-  (with-temp-buffer
-    (insert-char-range-data min max)
-    (write-region (point-min)(point-max) file)))
+  (let ((coding-system-for-write 'utf-8))
+    (with-temp-buffer
+      (insert-char-range-data min max)
+      (write-region (point-min)(point-max) file))))
 
 (defvar what-character-original-window-configuration)
 
     (condition-case err
        (progn
          (insert-char-data-with-variant char)
-         (char-db-update-comment)
+          ;; (char-db-update-comment)
          (set-buffer-modified-p nil)
          (view-mode the-buf (lambda (buf)
                               (set-window-configuration