-(defun insert-char-attributes (char &optional readable
- attributes ccs-attributes
- column)
- (let (atr-d ccs-d)
- (setq attributes
- (sort (if attributes
- (if (consp attributes)
- (progn
- (dolist (name attributes)
- (unless (memq name char-db-ignored-attributes)
- (push name atr-d)))
- atr-d))
- (dolist (name (char-attribute-list))
- (unless (memq name char-db-ignored-attributes)
- (if (find-charset name)
- (push name ccs-d)
- (push name atr-d))))
- atr-d)
- #'char-attribute-name<))
- (setq ccs-attributes
- (sort (if ccs-attributes
- (progn
- (setq ccs-d nil)
- (dolist (name ccs-attributes)
- (unless (memq name char-db-ignored-attributes)
- (push name ccs-d)))
- ccs-d)
- (or ccs-d
- (progn
- (dolist (name (charset-list))
- (unless (memq name char-db-ignored-attributes)
- (push name ccs-d)))
- ccs-d)))
- #'char-attribute-name<)))
+(defun char-db-insert-ccs-feature (name value line-breaking)
+ (insert
+ (format
+ (cond ((memq name '(=daikanwa
+ =daikanwa@rev1 =daikanwa@rev2
+ =gt =gt-k =cbeta =zinbun-oracle))
+ "(%-18s . %05d)\t; %c")
+ ((eq name 'mojikyo)
+ "(%-18s . %06d)\t; %c")
+ ((>= (charset-dimension name) 2)
+ "(%-18s . #x%04X)\t; %c")
+ (t
+ "(%-18s . #x%02X)\t; %c"))
+ name
+ (if (= (charset-iso-graphic-plane name) 1)
+ (logior value
+ (cond ((= (charset-dimension name) 1)
+ #x80)
+ ((= (charset-dimension name) 2)
+ #x8080)
+ ((= (charset-dimension name) 3)
+ #x808080)
+ (t 0)))
+ value)
+ (char-db-decode-isolated-char name value)))
+ (if (and (= (charset-chars name) 94)
+ (= (charset-dimension name) 2))
+ (insert (format " [%02d-%02d]"
+ (- (lsh value -8) 32)
+ (- (logand value 255) 32))))
+ (insert line-breaking))
+
+(defun char-db-insert-relation-feature (char name value line-breaking
+ ccss readable)
+ (insert (format "(%-18s%s " name line-breaking))
+ (let ((lbs (concat "\n" (make-string (current-column) ?\ )))
+ separator cell sources required-features
+ ret)
+ (while (consp value)
+ (setq cell (car value))
+ (if (integerp cell)
+ (setq cell (decode-char '=ucs cell)))
+ (cond
+ ((eq name '->subsumptive)
+ (when (or (not (some (lambda (atr)
+ (get-char-attribute cell atr))
+ char-db-ignored-attributes))
+ (some (lambda (ccs)
+ (encode-char cell ccs 'defined-only))
+ ccss))
+ (if separator
+ (insert lbs))
+ (let ((char-db-ignored-attributes
+ (cons '<-subsumptive
+ char-db-ignored-attributes)))
+ (insert-char-attributes cell readable))
+ (setq separator lbs))
+ )
+ ((characterp cell)
+ (setq sources
+ (get-char-attribute
+ char (intern (format "%s*sources" name))))
+ (setq required-features nil)
+ (dolist (source sources)
+ (cond
+ ((memq source '(JP JP/Jouyou shinjigen-1))
+ (setq required-features
+ (union required-features
+ '(=jis-x0208
+ =jis-x0208@1990
+ =jis-x0213-1-2000
+ =jis-x0213-2-2000
+ =jis-x0212
+ =jis-x0208@1983
+ =jis-x0208@1978))))
+ ((eq source 'CN)
+ (setq required-features
+ (union required-features
+ '(=gb2312
+ =gb12345
+ =iso-ir165)))))
+ (cond
+ ((find-charset (setq ret (intern (format "=%s" source))))
+ (setq required-features
+ (cons ret required-features)))
+ (t (setq required-features
+ (cons source required-features)))))
+ (cond ((string-match "@JP" (symbol-name name))
+ (setq required-features
+ (union required-features
+ '(=jis-x0208
+ =jis-x0208@1990
+ =jis-x0213-1-2000
+ =jis-x0213-2-2000
+ =jis-x0212
+ =jis-x0208@1983
+ =jis-x0208@1978))))
+ ((string-match "@CN" (symbol-name name))
+ (setq required-features
+ (union required-features
+ '(=gb2312
+ =gb12345
+ =iso-ir165)))))
+ (if separator
+ (insert lbs))
+ (if readable
+ (insert (format "%S" cell))
+ (char-db-insert-char-spec cell readable
+ nil
+ required-features))
+ (setq separator lbs))
+ ((consp cell)
+ (if separator
+ (insert lbs))
+ (if (consp (car cell))
+ (char-db-insert-char-spec cell readable)
+ (char-db-insert-char-reference cell readable))
+ (setq separator lbs))
+ (t
+ (if separator
+ (insert separator))
+ (insert (prin1-to-string cell))
+ (setq separator " ")))
+ (setq value (cdr value)))
+ (insert ")")
+ (insert line-breaking)))
+
+(defun insert-char-attributes (char &optional readable attributes column)