(M-16634): Separate U+6BB9.
[chise/xemacs-chise.git-] / lisp / utf-2000 / read-maps.el
index 5d00cf3..f75b965 100644 (file)
 
 ;;; Code:
 
-(with-temp-buffer
-  (buffer-disable-undo)
-  (dolist (file '("J90-to-UCS.txt" "JSP-to-UCS.txt"
-                 "JX1-to-UCS.txt" "JX2-to-UCS.txt"
-                 ;; "C3-to-UCS.txt" ; "C4-to-UCS.txt"
-                 "B-to-UCS.txt"))
-    (insert-file-contents (expand-file-name file "../etc/char-data/"))
+;;;###autoload
+(defun mapping-table-read-file (filename)
+  "Read mapping table." 
+  (interactive "fMapping table : ")
+  (with-temp-buffer
+    (buffer-disable-undo)
+    (insert-file-contents filename)
     (goto-char (point-min))
     (let (line ccs code ucs ucs-pat ucs-ccs ucs-code chr)
       (while (not (eobp))
                     ucs-ccs 'ucs-big5)
               (goto-char (match-end 0))
               )
+             ((looking-at "^JC3-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\)")
+              (setq ccs 'china3-jef
+                    code (string-to-int (match-string 1) 16)
+                    ucs-pat nil
+                    ucs-ccs nil)
+              (goto-char (match-end 0))
+              )
              (t
               (setq ccs nil
                     code nil
@@ -90,7 +97,8 @@
                     ucs-ccs nil)
               ))
        (setq ucs-code
-             (if (looking-at ucs-pat)
+             (if (and ucs-pat
+                      (looking-at ucs-pat))
                  (prog1
                      (string-to-int (match-string 1) 16)
                    (goto-char (match-end 0)))))
                   "[ \t]*U[+-]\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]+\\)")
                  (string-to-int (match-string 1) 16)))
        (when (setq chr (decode-char ccs code))
-         (unless (eq (get-char-attribute chr ccs) code)
+         (unless (eq (encode-char chr ccs 'defined-only)
+                     ;; (get-char-attribute chr ccs)
+                     code)
            (put-char-attribute chr ccs code))
          (when (and ucs-code
                     (not (eq (or (get-char-attribute chr ucs-ccs)
                                  (get-char-attribute chr 'ucs)
-                                 (get-char-attribute chr '=>ucs)
-                                 (get-char-attribute chr '->ucs))
+                                 (get-char-attribute chr '=>ucs))
                              ucs-code)))
            (put-char-attribute chr ucs-ccs ucs-code))
          (when (and ucs
                     (not (eq (or (get-char-attribute chr 'ucs)
-                                 (get-char-attribute chr '=>ucs)
-                                 (get-char-attribute chr '->ucs))
+                                 (get-char-attribute chr '=>ucs))
                              ucs)))
-           (put-char-attribute chr (if ucs-code
-                                       '=>ucs
-                                     ucs-ccs) ucs)))
-       (forward-line)))
-    (erase-buffer)))
+           (put-char-attribute chr
+                               (if ucs-code
+                                   '=>ucs
+                                 (or ucs-ccs
+                                     '=>ucs))
+                               ucs)))
+       (forward-line)))))
+
+
+(provide 'read-maps)
 
 ;;; read-maps.el ends here