1 ;;; update-cdb.el --- Update and/or setup character attribute database
3 ;; Copyright (C) 2002,2003,2004 MORIOKA Tomohiko.
5 ;; Author: MORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
6 ;; Keywords: Character, Database, CHISE, Unicode, UCS-4, MULE.
8 ;; This file is part of XEmacs CHISE.
10 ;; XEmacs CHISE is free software; you can redistribute it and/or
11 ;; modify it under the terms of the GNU General Public License as
12 ;; published by the Free Software Foundation; either version 2, or (at
13 ;; your option) any later version.
15 ;; XEmacs CHISE is distributed in the hope that it will be useful, but
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ;; General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with XEmacs CHISE; see the file COPYING. If not, write to
22 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
27 (defun delete-file-with-children (filename)
28 (if (file-directory-p filename)
30 (directory-files filename 'full "^[^.]" 'so-sort)))
33 (delete-file-with-children file)))
34 (remove-directory filename))
35 (delete-file filename)))
39 (defvar system-char-database-directory
40 (expand-file-name "chise-db"
44 (defun file-name-char-attribute-name (filename)
47 (len (length filename))
50 (if (eq (setq chr (aref filename i)) ?%)
51 (setq dest (concat dest
52 (substring filename base i)
56 (substring filename (1+ i) (+ i 3)) 16))))
60 (concat dest (substring filename base len))))
63 ((or load-ignore-elc-files
64 (not (file-exists-p system-char-database-directory)))
65 (if (file-exists-p system-char-database-directory)
66 (delete-file-with-children system-char-database-directory))
68 (load "dumped-chars.el")
69 (dolist (file system-char-db-source-file-list)
72 (dolist (attribute (char-attribute-list))
73 (save-char-attribute-table attribute))
75 (dolist (ccs (charset-list))
76 (save-charset-mapping-table ccs))
81 "(setq next-defined-char-id #x%X)\n"
82 next-defined-char-id))
83 (write-region (point-min)(point-max)
84 "../lisp/utf-2000/cid-conf.el"))
87 (if (>= (function-max-args 'char-attribute-list) 1)
88 (char-attribute-list 'rehash)
89 (mapcar (lambda (file)
90 (mount-char-attribute-table
91 (intern (file-name-char-attribute-name file))))
93 (expand-file-name "system-char-id" ; "character/feature"
94 system-char-database-directory)
96 (dolist (ccs (charset-list))
97 (reset-charset-mapping-table ccs))
98 (load "../lisp/utf-2000/cid-conf.el")
101 (load "dumped-chars.el")
102 (dolist (file system-char-db-source-file-list)
106 (defun char-ref= (cr1 cr2 &optional tester)
107 (cond ((char-ref-p cr1)
109 (char-spec= (plist-get cr1 :char)
110 (plist-get cr2 :char) tester)
111 (char-spec= (plist-get cr1 :char) cr2 tester)))
115 (plist-get cr2 :char)
119 (defun char-spec= (cs1 cs2 &optional tester)
124 (funcall tester cs1 cs2)
125 (funcall tester cs1 (find-char cs2)))
127 (funcall tester (find-char cs1) cs2)
128 (funcall tester (find-char cs1) (find-char cs2)))))
136 (if (setq ret (find-char dc))
138 (when (characterp dc)
139 (setq ret (get-char-attribute dc '->uppercase))
141 (member* c ret :test #'char-ref=)
143 (put-case-table-pair c dc (standard-case-table))))
149 ;;; update-cdb.el ends here