update.
[chise/ids.git] / ids-util.el
index bb92955..b1b96f1 100644 (file)
@@ -1,9 +1,9 @@
 ;;; ids-util.el --- Utilities about ideographic-structure -*- coding: utf-8 -*-
 
-;; Copyright (C) 2001,2002 MORIOKA Tomohiko
+;; Copyright (C) 2001,2002,2003,2004 MORIOKA Tomohiko
 
 ;; Author: MORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
-;; Keywords: ideographic-structure, UTF-2000, database
+;; Keywords: ideographic-structure, CHISE, IDS, IDC, UCS, database
 
 ;; This file is a part of Tomoyo Utilities.
 
 ;;; Code:
 
 ;;;###autoload
+(defun ideographic-structure-convert-to-domain (structure domain)
+  (let (dest cell ret)
+    (while structure
+      (setq cell (car structure))
+      (setq dest
+           (cons
+            (cond ((characterp cell)
+                   (char-representative-of-domain cell domain))
+                  ((and (consp cell)
+                        (symbolp (car cell)))
+                   cell)
+                  ((setq ret (find-char cell))
+                   (char-representative-of-domain cell domain))
+                  ((setq ret (assq 'ideographic-structure cell))
+                   (put-alist 'ideographic-structure
+                              (ideographic-structure-convert-to-domain
+                               (cdr ret) domain)
+                              (copy-alist cell)))
+                  (t cell))
+            dest))
+      (setq structure (cdr structure)))
+    (nreverse dest)))
+
+;;;###autoload
 (defun ideographic-structure-convert-to-ucs (structure)
   (let (dest cell ucs ret)
     (while structure