1 ;;; ids-util.el --- Utilities about ideographic-structure -*- coding: utf-8 -*-
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 #x4EBD)
74 (decode-char 'chinese-big5-cdp #x8AFC))
75 (cons ?亼 (decode-char 'chinese-big5-cdp #x8AFC))
76 (cons (decode-char 'chinese-big5-cdp #x8AFC)
77 (decode-char 'chinese-big5-cdp #x8AFC))
79 (cons (decode-char 'ucs #x5922)
80 (decode-char 'ideograph-daikanwa 05802))
81 (cons (decode-char 'ucs #x656C)
82 (decode-char 'ideograph-daikanwa 13303))
83 (cons (decode-char 'ucs #x8449)
84 (decode-char 'ideograph-daikanwa 31387))
85 (cons (decode-char 'ucs #x2EA4)
86 (decode-char 'ucs #x722B))
87 (cons (decode-char 'ucs #x5151)
88 (decode-char 'ideograph-daikanwa 01356))
89 (cons (decode-char 'ucs #x544A)
90 (decode-char 'ideograph-daikanwa 03381))
91 (cons (decode-char 'ucs #x5F66)
92 (decode-char 'ideograph-daikanwa 09980))
93 (cons (decode-char 'ucs #x8005)
94 (decode-char 'ideograph-daikanwa 28853))
95 (cons (decode-char 'ucs #x82E5)
96 (decode-char 'ideograph-daikanwa 30796))
97 (cons (decode-char 'ucs #x82F1)
98 (decode-char 'ideograph-daikanwa 30808))
99 (cons (decode-char 'ucs #x9063)
100 (decode-char 'ideograph-daikanwa 39052))
101 (cons (decode-char 'ucs #x4EA0)
102 (decode-char 'chinese-big5-cdp #x8B42))
103 (cons (decode-char 'ucs #x5154)
104 (decode-char 'ideograph-daikanwa 01368))
105 (cons (decode-char 'ucs #x53CA)
106 (decode-char 'ideograph-daikanwa 03118))
107 (cons (decode-char 'ucs #x5468)
108 (decode-char 'ideograph-daikanwa 03441))
109 (cons (decode-char 'ucs #x5C1A)
110 (decode-char 'ucs #x5C19))
111 (cons (decode-char 'ucs #x5D29)
112 (decode-char 'ideograph-daikanwa 08212))
113 (cons (decode-char 'ucs #x670B)
114 (decode-char 'ideograph-daikanwa 14340))
115 (cons (decode-char 'ucs #x7FBD)
116 (decode-char 'ideograph-daikanwa 28614))
117 (cons (decode-char 'ucs #x8096)
118 (decode-char 'ideograph-daikanwa 29263))
119 (cons (decode-char 'ucs #x8981)
120 (decode-char 'ideograph-daikanwa 34768))
121 (cons (decode-char 'ucs #x8AF8)
122 (decode-char 'ideograph-daikanwa 35743))
123 (cons (decode-char 'ucs #x9023)
124 (decode-char 'ideograph-daikanwa 38902))
125 (cons (decode-char 'ucs #x9752)
126 (decode-char 'ucs #x9751))
127 (cons (decode-char 'japanese-jisx0213-2 #x2327)
128 (decode-char 'japanese-jisx0213-2 #x2327))
129 (cons (decode-char 'chinese-big5-cdp #x8BFA)
130 (decode-char 'japanese-jisx0213-2 #x2327))
134 (defun ideographic-structure-convert-to-daikanwa (structure)
135 (let (dest cell morohashi ret)
137 (setq cell (car structure))
140 (cond ((characterp cell)
142 (assq cell morohashi-char-replace-alist))
144 ((get-char-attribute cell 'ideograph-daikanwa)
148 cell 'morohashi-daikanwa))
149 (cond ((null (cdr (cdr morohashi)))
151 ((= (nth 1 morohashi) 0)
152 (decode-char 'ideograph-daikanwa
155 (setq morohashi (list (car morohashi)
157 (or (map-char-attribute
159 (if (equal morohashi val)
166 (symbolp (car cell)))
168 ((setq ret (find-char cell))
169 (if (or (get-char-attribute ret 'ideograph-daikanwa)
173 ret 'morohashi-daikanwa)))
174 (null (cdr (cdr morohashi))))
176 (if (= (nth 1 morohashi) 0)
177 (decode-char 'ideograph-daikanwa (car morohashi))
179 ((setq ret (assq 'ideographic-structure cell))
180 (put-alist 'ideographic-structure
181 (ideographic-structure-convert-to-daikanwa
186 (setq structure (cdr structure)))
195 ;;; ids-util.el ends here