(dump-94x94-ccs-to-ucs-table): Use `encode-char' with `defined-only'
[chise/tomoyo-tools.git] / ideo-trans.el
1 ;;; ideo-trans.el --- Translation utility for Ideographic Strings
2
3 ;; Copyright (C) 2003 MORIOKA Tomohiko
4
5 ;; Author: MORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
6 ;; Keywords: Ideographs, Character Database, Chaon, CHISE
7
8 ;; This file is a part of tomoyo-tools.
9
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.
14
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.
19
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.
24
25 ;;; Code:
26
27 ;;;###autoload
28 (defun ideo-trans-simplify-chinese-string (string)
29   "Simplify Chinese traditional characters in STRING."
30   (let (uchr ret)
31     (mapconcat
32      (lambda (chr)
33        (setq uchr
34              (if (setq ret (or (char-ucs chr)
35                                (get-char-attribute chr '=>ucs@gb)))
36                  (decode-char '=ucs ret)
37                chr))
38        (char-to-string
39         (if (setq ret (encode-char uchr 'chinese-gb12345))
40             (decode-char 'chinese-gb2312 ret)
41           chr)))
42      string "")))
43
44
45 ;;; @ End.
46 ;;;
47
48 (provide 'ideo-trans)
49
50 ;;; ideo-trans.el ends here