1 ;;; conv-util.el --- Dump utility of mapping tables
3 ;; Copyright (C) 2004 MORIOKA Tomohiko
5 ;; Author: MORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
6 ;; Keywords: Ideographs, Character Database, CHISE, UCS, Unicode
8 ;; This file is a part of tomoyo-tools.
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.
27 (require 'ideograph-util)
30 (defun conv-u-convert-char (c &optional v)
31 (setq v (get-char-attribute c '->ucs-unified))
32 (let (ufs ifs ucs m ret)
34 (setq m (get-char-attribute c 'morohashi-daikanwa))
35 (setq m (if (eq (nth 1 m) 0)
37 (list (car m)(nth 1 m)))))
38 (setq m (encode-char c '=daikanwa 'defined-only)))
39 (setq ufs (char-attribute-alist c)
42 (setq ifs (intersection
44 (char-attribute-alist vc)
46 (if (setq ucs (encode-char c '=ucs 'defined-only))
48 (remove-char-attribute c '=ucs)
50 (put-char-attribute c '=ucs@unicode ucs)
51 (put-char-attribute c '=ucs@iso ucs))
52 (remove-char-attribute c '->ucs-unified))
53 (setq ucs (char-ucs c)))
54 (setq v (sort (cons c v)
55 (function ideograph-char<)))
56 (setq ret (define-char
57 (cons (cons '->subsumptive v)
59 (put-char-attribute ret '=ucs ucs)
62 (remove-char-attribute vc (car isf)))
63 (when (and (setq m (get-char-attribute vc 'morohashi-daikanwa))
66 (remove-char-attribute vc 'morohashi-daikanwa))
67 (if (eq ucs (get-char-attribute vc '=>ucs))
68 (remove-char-attribute vc '=>ucs)))
71 (defun conv-u-convert-char-fullwidth (c &optional v)
72 (when (setq v (get-char-attribute c '->ucs-unified))
73 (let (ufs ifs ucs name ret)
74 (when (get-char-attribute c '->fullwidth)
75 (setq ufs (char-attribute-alist c)
78 (setq ifs (intersection
80 (char-attribute-alist vc)
83 (cond ((eq (car cell) 'name)
84 (setq name (cdr cell)))
85 ((eq (car cell) '->decomposition))
86 ((eq (car cell) 'composition))
87 ((eq (car cell) '->lowercase))
88 ((eq (car cell) '->uppercase))
89 ((eq (car cell) '->titlecase))
90 ((eq (car cell) '=ucs)
93 (cons (cons (if (<= ucs #xFFFF)
99 ((eq (car cell) '->ucs-unified)
100 (remove-char-attribute c '->ucs-unified))
102 (remove-char-attribute c (car cell))
103 (setq ret (cons cell ret)))))
105 (put-char-attribute c '->denotational
106 (cons (define-char ufs) v))
109 (remove-char-attribute vc (car isf)))
110 (if (eq ucs (get-char-attribute vc '=>ucs))
111 (remove-char-attribute vc '=>ucs))
112 (if (setq ret (get-char-attribute vc '<-fullwidth))
113 (put-char-attribute vc '<-fullwidth (delq c ret)))
115 (string= (concat "fullwidth " (downcase name))
116 (get-char-attribute vc 'name)))
117 (remove-char-attribute vc 'name))
127 ;;; conv-util.el ends here