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 'ucs #x5922)
74 (decode-char 'ideograph-daikanwa 05802))
75 (cons (decode-char 'ucs #x656C)
76 (decode-char 'ideograph-daikanwa 13303))
77 (cons (decode-char 'ucs #x8449)
78 (decode-char 'ideograph-daikanwa 31387))
79 (cons (decode-char 'ucs #x2EA4)
80 (decode-char 'ucs #x722B))
81 (cons (decode-char 'ucs #x5151)
82 (decode-char 'ideograph-daikanwa 01356))
83 (cons (decode-char 'ucs #x544A)
84 (decode-char 'ideograph-daikanwa 03381))
85 (cons (decode-char 'ucs #x5F66)
86 (decode-char 'ideograph-daikanwa 09980))
87 (cons (decode-char 'ucs #x8005)
88 (decode-char 'ideograph-daikanwa 28853))
89 (cons (decode-char 'ucs #x82E5)
90 (decode-char 'ideograph-daikanwa 30796))
91 (cons (decode-char 'ucs #x82F1)
92 (decode-char 'ideograph-daikanwa 30808))
93 (cons (decode-char 'ucs #x9063)
94 (decode-char 'ideograph-daikanwa 39052))
95 (cons (decode-char 'ucs #x4EA0)
96 (decode-char 'chinese-big5-cdp #x8B42))
97 (cons (decode-char 'ucs #x5154)
98 (decode-char 'ideograph-daikanwa 01368))
99 (cons (decode-char 'ucs #x53CA)
100 (decode-char 'ideograph-daikanwa 03118))
101 (cons (decode-char 'ucs #x5468)
102 (decode-char 'ideograph-daikanwa 03441))
103 (cons (decode-char 'ucs #x5C1A)
104 (decode-char 'ucs #x5C19))
105 (cons (decode-char 'ucs #x5D29)
106 (decode-char 'ideograph-daikanwa 08212))
107 (cons (decode-char 'ucs #x670B)
108 (decode-char 'ideograph-daikanwa 14340))
109 (cons (decode-char 'ucs #x7FBD)
110 (decode-char 'ideograph-daikanwa 28614))
111 (cons (decode-char 'ucs #x8096)
112 (decode-char 'ideograph-daikanwa 29263))
113 (cons (decode-char 'ucs #x8981)
114 (decode-char 'ideograph-daikanwa 34768))
115 (cons (decode-char 'ucs #x8AF8)
116 (decode-char 'ideograph-daikanwa 35743))
117 (cons (decode-char 'ucs #x9023)
118 (decode-char 'ideograph-daikanwa 38902))
119 (cons (decode-char 'ucs #x9752)
120 (decode-char 'ucs #x9751))
124 (defun ideographic-structure-convert-to-daikanwa (structure)
125 (let (dest cell morohashi ret)
127 (setq cell (car structure))
130 (cond ((characterp cell)
132 (assq cell morohashi-char-replace-alist))
134 ((get-char-attribute cell 'ideograph-daikanwa)
138 cell 'morohashi-daikanwa))
139 (cond ((null (cdr (cdr morohashi)))
141 ((= (nth 1 morohashi) 0)
142 (decode-char 'ideograph-daikanwa
145 (setq morohashi (list (car morohashi)
147 (or (map-char-attribute
149 (if (equal morohashi val)
156 (symbolp (car cell)))
158 ((setq ret (find-char cell))
159 (if (or (get-char-attribute ret 'ideograph-daikanwa)
163 ret 'morohashi-daikanwa)))
164 (null (cdr (cdr morohashi))))
166 (if (= (nth 1 morohashi) 0)
167 (decode-char 'ideograph-daikanwa (car morohashi))
169 ((setq ret (assq 'ideographic-structure cell))
170 (put-alist 'ideographic-structure
171 (ideographic-structure-convert-to-daikanwa
176 (setq structure (cdr structure)))
185 ;;; ids-util.el ends here