1 ;;; ids-util.el --- Utilities about ideographic-structure property
3 ;; Copyright (C) 2001 MORIOKA Tomohiko
5 ;; Author: MORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
6 ;; Keywords: ideographic-structure, UTF-2000, database
8 ;; This file is a part of Tomoyo Utilities.
10 ;; This program 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 ;; This program 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 this program; 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.
30 (defun ideographic-structure-convert-to-ucs (structure)
31 (let (dest cell ucs ret)
33 (setq cell (car structure))
36 (cond ((characterp cell)
37 (if (or (get-char-attribute cell 'ucs)
40 (or (get-char-attribute cell '=>ucs)
41 (get-char-attribute cell '->ucs)))))
43 (decode-char 'ucs ucs)))
47 ((setq ret (find-char cell))
48 (if (or (get-char-attribute ret 'ucs)
51 (or (get-char-attribute ret '=>ucs)
52 (get-char-attribute ret '->ucs)))))
54 (decode-char 'ucs ucs)))
55 ((setq ret (assq 'ideographic-structure cell))
56 (put-alist 'ideographic-structure
57 (ideographic-structure-convert-to-ucs
62 (setq structure (cdr structure)))
65 (defvar morohashi-char-replace-alist
67 (cons (decode-char 'chinese-big5-cdp #x8B42)
68 (decode-char 'chinese-big5-cdp #x8B42))
69 (cons (decode-char 'chinese-big5-cdp #x8AFC)
70 (decode-char 'chinese-big5-cdp #x8AFC))
71 (cons (decode-char 'ucs #x2EBE)
72 (decode-char 'ucs #x2EBF))
73 (cons ?δΊ½ (decode-char 'chinese-big5-cdp #x8AFC))
74 (cons (decode-char 'ucs #x5922)
75 (decode-char 'ideograph-daikanwa 05802))
76 (cons (decode-char 'ucs #x656C)
77 (decode-char 'ideograph-daikanwa 13303))
78 (cons (decode-char 'ucs #x8449)
79 (decode-char 'ideograph-daikanwa 31387))
80 (cons (decode-char 'ucs #x2EA4)
81 (decode-char 'ucs #x722B))
82 (cons (decode-char 'ucs #x5151)
83 (decode-char 'ideograph-daikanwa 01356))
84 (cons (decode-char 'ucs #x544A)
85 (decode-char 'ideograph-daikanwa 03381))
86 (cons (decode-char 'ucs #x5F66)
87 (decode-char 'ideograph-daikanwa 09980))
88 (cons (decode-char 'ucs #x8005)
89 (decode-char 'ideograph-daikanwa 28853))
90 (cons (decode-char 'ucs #x82E5)
91 (decode-char 'ideograph-daikanwa 30796))
92 (cons (decode-char 'ucs #x82F1)
93 (decode-char 'ideograph-daikanwa 30808))
94 (cons (decode-char 'ucs #x9063)
95 (decode-char 'ideograph-daikanwa 39052))
96 (cons (decode-char 'ucs #x4EA0)
97 (decode-char 'chinese-big5-cdp #x8B42))
98 (cons (decode-char 'ucs #x5154)
99 (decode-char 'ideograph-daikanwa 01368))
100 (cons (decode-char 'ucs #x53CA)
101 (decode-char 'ideograph-daikanwa 03118))
102 (cons (decode-char 'ucs #x5468)
103 (decode-char 'ideograph-daikanwa 03441))
104 (cons (decode-char 'ucs #x5C1A)
105 (decode-char 'ucs #x5C19))
106 (cons (decode-char 'ucs #x5D29)
107 (decode-char 'ideograph-daikanwa 08212))
108 (cons (decode-char 'ucs #x670B)
109 (decode-char 'ideograph-daikanwa 14340))
110 (cons (decode-char 'ucs #x7FBD)
111 (decode-char 'ideograph-daikanwa 28614))
112 (cons (decode-char 'ucs #x8096)
113 (decode-char 'ideograph-daikanwa 29263))
114 (cons (decode-char 'ucs #x8981)
115 (decode-char 'ideograph-daikanwa 34768))
116 (cons (decode-char 'ucs #x8AF8)
117 (decode-char 'ideograph-daikanwa 35743))
118 (cons (decode-char 'ucs #x9023)
119 (decode-char 'ideograph-daikanwa 38902))
120 (cons (decode-char 'ucs #x9752)
121 (decode-char 'ucs #x9751))
125 (defun ideographic-structure-convert-to-daikanwa (structure)
126 (let (dest cell morohashi ret)
128 (setq cell (car structure))
131 (cond ((characterp cell)
133 (assq cell morohashi-char-replace-alist))
135 ((get-char-attribute cell 'ideograph-daikanwa)
139 cell 'morohashi-daikanwa))
140 (cond ((null (cdr (cdr morohashi)))
142 ((= (nth 1 morohashi) 0)
143 (decode-char 'ideograph-daikanwa
146 (setq morohashi (list (car morohashi)
148 (or (map-char-attribute
150 (if (equal morohashi val)
157 (symbolp (car cell)))
159 ((setq ret (find-char cell))
160 (if (or (get-char-attribute ret 'ideograph-daikanwa)
164 ret 'morohashi-daikanwa)))
165 (null (cdr (cdr morohashi))))
167 (if (= (nth 1 morohashi) 0)
168 (decode-char 'ideograph-daikanwa (car morohashi))
170 ((setq ret (assq 'ideographic-structure cell))
171 (put-alist 'ideographic-structure
172 (ideographic-structure-convert-to-daikanwa
177 (setq structure (cdr structure)))
186 ;;; ids-util.el ends here