Commit 0f038852 authored by MORIOKA Tomohiko's avatar MORIOKA Tomohiko
Browse files

(chise-json-other-spec-get-radical-strokes): Use

`kangxi-radical-source', `kangxi-strokes-source' and
`total-strokes-source' instead of `sources'; sort the result.
(chise-json-char-get-info): Don't use `del-alist' for
`radical-strokes-spec' to avoid side effect.
parent 9725451b
......@@ -1366,80 +1366,92 @@
(defun chise-json-other-spec-get-radical-strokes (other-spec)
(let (domain-rs-alist
radical
rest ret domain)
rest ret domain sources)
(dolist (cell other-spec)
(cond
((eq (caar cell) 'ideographic-radical)
(setq domain (cdar cell)
radical (cdr (assq 'body (cdr cell))))
radical (cdr (assq 'body (cdr cell)))
sources (cdr (assq 'sources (cdr cell))))
(if (setq ret (assq domain domain-rs-alist))
(setcdr ret (nconc (list* (cons 'kangxi-radical-number radical)
;; (cons 'kangxi-radical
;; (char-to-string (ideographic-radical radical)))
;; (cons 'domain domain)
(del-alist 'body (cdr cell)))
(if sources
(cons
(cons 'kangxi-radical-source sources)
(del-alist 'sources
(del-alist 'body (cdr cell))))
(del-alist 'body (cdr cell))))
(cdr ret)))
(setq domain-rs-alist
(cons (cons domain
(list* (cons 'kangxi-radical-number radical)
;; (cons 'kangxi-radical
;; (char-to-string (ideographic-radical radical)))
;; (cons 'domain domain)
(del-alist 'body (cdr cell))))
(if sources
(cons
(cons 'kangxi-radical-source sources)
(del-alist 'sources
(del-alist 'body (cdr cell))))
(del-alist 'body (cdr cell)))))
domain-rs-alist)))
)
((eq (caar cell) 'ideographic-strokes)
(setq domain (cdar cell))
(setq domain (cdar cell)
sources (cdr (assq 'sources (cdr cell))))
(if (setq ret (assq domain domain-rs-alist))
(setcdr ret (nconc (list* (cons 'kangxi-strokes
(cdr (assq 'body (cdr cell))))
;; (cons 'domain domain)
(del-alist 'body (cdr cell)))
(if sources
(cons
(cons 'kangxi-strokes-source sources)
(del-alist 'sources
(del-alist 'body (cdr cell))))
(del-alist 'body (cdr cell))))
(cdr ret)))
(setq domain-rs-alist
(cons (cons domain
(list* (cons 'kangxi-strokes
(cdr (assq 'body (cdr cell))))
;; (cons 'domain domain)
(del-alist 'body (cdr cell))))
(if sources
(cons
(cons 'kangxi-strokes-source sources)
(del-alist 'sources
(del-alist 'body (cdr cell))))
(del-alist 'body (cdr cell)))))
domain-rs-alist)))
)
((eq (caar cell) 'total-strokes)
(setq domain (cdar cell))
(setq domain (cdar cell)
sources (cdr (assq 'sources (cdr cell))))
(if (setq ret (assq domain domain-rs-alist))
(setcdr ret (nconc (list* (cons 'total-strokes
(cdr (assq 'body (cdr cell))))
;; (cons 'domain domain)
(del-alist 'body (cdr cell)))
(if sources
(cons
(cons 'total-strokes-source sources)
(del-alist 'sources
(del-alist 'body (cdr cell))))
(del-alist 'body (cdr cell))))
(cdr ret)))
(setq domain-rs-alist
(cons (cons domain
(list* (cons 'total-strokes
(cdr (assq 'body (cdr cell))))
;; (cons 'domain domain)
(del-alist 'body (cdr cell))))
(if sources
(cons
(cons 'total-strokes-source sources)
(del-alist 'sources
(del-alist 'body (cdr cell))))
(del-alist 'body (cdr cell)))))
domain-rs-alist)))
)
(t
(setq rest (cons cell rest))
)))
(cons domain-rs-alist
;; (sort (mapcar (lambda (cell)
;; (when (car cell)
;; (unless (setq radical (cdr (assq 'kangxi-radical (cdr cell))))
;; (when (setq radical
;; (cdr (assq 'kangxi-radical
;; (cdr (assq nil domain-rs-alist)))))
;;
;;
;; (cons (car cell)
;; (sort (cdr cell)
;; (lambda (a b)
;; (char-attribute-name< (car a)(car b))))))
;; domain-rs-alist)
;; (lambda (a b)
;; (string< (car a)(car b))))
;;
(cons (mapcar (lambda (dspec)
(cons (car dspec)
(sort (cdr dspec)
(lambda (a b)
(string< (car a)(car b))))))
domain-rs-alist)
rest)))
(defun chise-json-make-ja-romaji-spec (romaji)
......@@ -2238,7 +2250,7 @@
anno-id
domain code
kangxi-radical kangxi-strokes total-strokes
dest)
dest rest)
(setq char-info (chise-json-separate-normalized-spec
(chise-json-char-get-normalized-spec char subnode char-spec)
subnode)
......@@ -2457,22 +2469,38 @@
(intern
(format "chise:domain/%s" (or (car cell) 'common))))
(setq cell (cdr cell))
(setq kangxi-radical
(or (assq 'kangxi-radical-number cell)
(assq 'kangxi-radical-number
(cdr (assq nil radical-strokes-spec)))))
(setq kangxi-strokes
(or (assq 'kangxi-strokes cell)
(assq 'kangxi-strokes
(cdr (assq nil radical-strokes-spec)))))
(setq total-strokes
(or (assq 'total-strokes cell)
(assq 'total-strokes
(cdr (assq nil radical-strokes-spec)))))
(setq cell
(del-alist 'kangxi-radical-number
(del-alist 'kangxi-strokes
(del-alist 'total-strokes cell))))
(setq kangxi-radical nil
kangxi-strokes nil
total-strokes nil)
(setq rest
(mapcan
(lambda (pair)
(cond
((eq (car pair) 'kangxi-radical-number)
(setq kangxi-radical pair)
nil)
((eq (car pair) 'kangxi-strokes)
(setq kangxi-strokes pair)
nil)
((eq (car pair) 'total-strokes)
(setq total-strokes pair)
nil)
(t
(list pair))))
cell))
(unless kangxi-radical
(setq kangxi-radical
(assq 'kangxi-radical-number
(cdr (assq nil radical-strokes-spec)))))
(unless kangxi-strokes
(setq kangxi-strokes
(assq 'kangxi-strokes
(cdr (assq nil radical-strokes-spec)))))
(unless total-strokes
(setq total-strokes
(assq 'total-strokes
(cdr (assq nil radical-strokes-spec)))))
(setq cell rest)
(if total-strokes
(setq cell (cons total-strokes cell)))
(if kangxi-strokes
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment