-(defun ideograph-char< (a b)
- (let ((a-m-m (get-char-attribute a 'ideograph-daikanwa))
- (b-m-m (get-char-attribute b 'ideograph-daikanwa))
- a-m-r b-m-r
- a-s b-s
- a-u b-u m)
- (if a-m-m
- (setq a-s (char-ideographic-strokes a))
- (setq a-m-r (get-char-attribute a 'morohashi-daikanwa))
- (if a-m-r
- (progn
- (setq a-m-m (car a-m-r)
- a-m-r (cdr a-m-r))
- (if (= (car a-m-r) 0)
- (setq a-s (char-ideographic-strokes
- (decode-char 'ideograph-daikanwa a-m-m)))
- (if (setq m (get-char-attribute a '->mojikyo))
- (setq a-s (char-ideographic-strokes
- (decode-char 'mojikyo m)))
- (setq a-s (char-ideographic-strokes a)))))
- (setq a-s (char-ideographic-strokes a))))
- (if b-m-m
- (setq b-s (char-ideographic-strokes b))
- (setq b-m-r (get-char-attribute b 'morohashi-daikanwa))
- (if b-m-r
- (progn
- (setq b-m-m (car b-m-r)
- b-m-r (cdr b-m-r))
- (if (= (car b-m-r) 0)
- (setq b-s (char-ideographic-strokes
- (decode-char 'ideograph-daikanwa b-m-m)))
- (if (setq m (get-char-attribute b '->mojikyo))
- (setq b-s (char-ideographic-strokes
- (decode-char 'mojikyo m)))
- (setq b-s (char-ideographic-strokes b)))))
- (setq b-s (char-ideographic-strokes b))))
- (if a-s
- (if b-s
- (if (= a-s b-s)
- (if a-m-m
- (if b-m-m
- (int-list< (cons a-m-m a-m-r)
- (cons b-m-m b-m-r))
- t)
- (if b-m-m
- nil
- (setq a-u (get-char-attribute a 'ucs)
- b-u (get-char-attribute b 'ucs))
- (if a-u
- (if b-u
- (< a-u b-u)
- (setq b-u (get-char-attribute b '->ucs))
- (if b-u
- (<= a-u b-u)
- t))
- (setq a-u (get-char-attribute a '->ucs))
- (if a-u
- (if b-u
- (< a-u b-u)
- (setq b-u (get-char-attribute b '->ucs))
- (if b-u
- (< a-u b-u)
- t))
- (if (or b-u (get-char-attribute b '->ucs))
- nil
- (< (char-int a)(char-int b)))))))
- (< a-s b-s))
- t))))
+(defun morohashi-daikanwa< (a b)
+ (if (integerp a)
+ (setq a (list a)))
+ (if (integerp b)
+ (setq b (list b)))
+ (cond ((eq (car a) 'ho)
+ (if (eq (car b) 'ho)
+ (int-list< (cdr a)(cdr b))
+ nil))
+ ((numberp (car a))
+ (if (eq (car b) 'ho)
+ t
+ (int-list< a b)))
+ (t
+ (if (eq (car b) 'ho)
+ t
+ (int-list< a b)))))
+
+;; (defun nil=-int< (a b)
+;; (cond ((null a) nil)
+;; ((null b) nil)
+;; (t (< a b))))
+
+;; (defun nil>-int< (a b)
+;; (cond ((null a) nil)
+;; ((null b) t)
+;; (t (< a b))))
+
+(defun char-representative-of-daikanwa (char)
+ (if (get-char-attribute char 'ideograph-daikanwa)
+ char
+ (let ((m (get-char-attribute char 'morohashi-daikanwa))
+ m-m m-s pat)
+ (or (when m
+ (setq m-m (pop m))
+ (setq m-s (pop m))
+ (if (= m-s 0)
+ (decode-char 'ideograph-daikanwa m-m)
+ (when m
+ (setq pat (list m-m m-s))
+ (map-char-attribute (lambda (c v)
+ (if (equal pat v)
+ c))
+ 'morohashi-daikanwa))))
+ char))))
+
+(defun char-attributes-poly< (c1 c2 accessors testers defaulters)
+ (catch 'tag
+ (let (a1 a2 accessor tester dm)
+ (while (and accessors testers)
+ (setq accessor (car accessors)
+ tester (car testers)
+ dm (car defaulters))
+ (when (and accessor tester)
+ (setq a1 (funcall accessor c1)
+ a2 (funcall accessor c2))
+ (cond ((null a1)
+ (if a2
+ (cond ((eq dm '<)
+ (throw 'tag t))
+ ((eq dm '>)
+ (throw 'tag nil)))))
+ ((null a2)
+ (cond ((eq dm '<)
+ (throw 'tag nil))
+ ((eq dm '>)
+ (throw 'tag t))))
+ (t
+ (cond ((funcall tester a1 a2)
+ (throw 'tag t))
+ ((funcall tester a2 a1)
+ (throw 'tag nil))))))
+ (setq accessors (cdr accessors)
+ testers (cdr testers)
+ defaulters (cdr defaulters))))))
+
+(defvar ideographic-radical nil)
+
+(defun char-daikanwa-strokes (char &optional radical)
+ (unless radical
+ (setq radical ideographic-radical))
+ (let ((drc (char-representative-of-daikanwa char)))
+ (char-ideographic-strokes
+ (if (= (char-ideographic-radical drc radical)
+ (char-ideographic-radical char radical))
+ drc
+ char)
+ radical)))