Sync up with r21-4-15-chise-0_21-30-ccs-props.
[chise/xemacs-chise.git-] / lisp / utf-2000 / update-cdb.el
index efae357..7998799 100644 (file)
@@ -1,29 +1,31 @@
 ;;; update-cdb.el --- Update and/or setup character attribute database
 
-;; Copyright (C) 2002 MORIOKA Tomohiko.
+;; Copyright (C) 2002,2003,2004 MORIOKA Tomohiko.
 
 ;; Author: MORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
-;; Keywords: Character, Database, UTF-2000, Unicode, UCS-4, MULE.
+;; Keywords: Character, Database, CHISE, Unicode, UCS-4, MULE.
 
-;; This file is part of XEmacs UTF-2000.
+;; This file is part of XEmacs CHISE.
 
-;; XEmacs UTF-2000 is free software; you can redistribute it and/or
+;; XEmacs CHISE is free software; you can redistribute it and/or
 ;; modify it under the terms of the GNU General Public License as
 ;; published by the Free Software Foundation; either version 2, or (at
 ;; your option) any later version.
 
-;; XEmacs UTF-2000 is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; XEmacs CHISE is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 ;; General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with XEmacs UTF-2000; see the file COPYING.  If not, write to
+;; along with XEmacs CHISE; see the file COPYING.  If not, write to
 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 ;; Boston, MA 02111-1307, USA.
 
 ;;; Code:
 
+(eval-when-compile (require 'cl))
+
 (defun delete-file-with-children (filename)
   (if (file-directory-p filename)
       (let ((files
@@ -37,9 +39,9 @@
 (cond
  ((featurep 'chise)
   (defvar system-char-database-directory
-    (expand-file-name "char-db"
-                     (or exec-directory
-                         "../lib-src/")))
+    (expand-file-name "chise-db"
+                     (or data-directory
+                         "../etc/")))
 
   (defun file-name-char-attribute-name (filename)
     (let ((i 0)
       (save-char-attribute-table attribute))
 
     (dolist (ccs (charset-list))
+      (save-charset-properties ccs)
       (save-charset-mapping-table ccs))
+
+    (with-temp-buffer
+      (insert
+       (format
+       "(setq next-defined-char-id #x%X)\n"
+       next-defined-char-id))
+      (write-region (point-min)(point-max)
+                   "../lisp/utf-2000/cid-conf.el"))
     )
    (t
-    (mapcar (lambda (file)
-             (mount-char-attribute-table
-              (intern (file-name-char-attribute-name file))))
-           (directory-files
-            (expand-file-name "system-char-id"
-                              system-char-database-directory)
-            nil nil t t))
+    (if (>= (function-max-args 'char-attribute-list) 1)
+       (char-attribute-list 'rehash)
+      (mapcar (lambda (file)
+               (mount-char-attribute-table
+                (intern (file-name-char-attribute-name file))))
+             (directory-files
+              (expand-file-name "system-char-id" ; "character/feature"
+                                system-char-database-directory)
+              nil nil t t)))
     (dolist (ccs (charset-list))
       (reset-charset-mapping-table ccs))
+    (load "../lisp/utf-2000/cid-conf.el")
     )))
  (t
   (load "dumped-chars.el")
   (dolist (file system-char-db-source-file-list)
     (pureload file))
+  (dolist (feature '(ideographic-structure))
+    (map-char-attribute
+     (lambda (c v)
+       (put-char-attribute
+       c feature (char-refs-simplify-char-specs v))
+       nil)
+     feature))
   ))
 
 (defun char-ref= (cr1 cr2 &optional tester)