(char-db-coded-charset-priority-list): Add `=>>ruimoku-v6'.
[chise/xemacs-chise.git.1] / lisp / utf-2000 / char-db-util.el
1 ;;; char-db-util.el --- Character Database utility -*- coding: utf-8-er; -*-
2
3 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
4 ;;   2007, 2008, 2009, 2010, 2011 MORIOKA Tomohiko.
5
6 ;; Author: MORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
7 ;; Keywords: CHISE, Character Database, ISO/IEC 10646, UCS, Unicode, MULE.
8
9 ;; This file is part of XEmacs CHISE.
10
11 ;; XEmacs CHISE is free software; you can redistribute it and/or
12 ;; modify it under the terms of the GNU General Public License as
13 ;; published by the Free Software Foundation; either version 2, or (at
14 ;; your option) any later version.
15
16 ;; XEmacs CHISE is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19 ;; General Public License for more details.
20
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with XEmacs CHISE; see the file COPYING.  If not, write to
23 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
25
26 ;;; Code:
27
28 (require 'chise-subr)
29 (require 'ideograph-subr)
30
31 (defconst unidata-normative-category-alist
32   '(("Lu" letter        uppercase)
33     ("Ll" letter        lowercase)
34     ("Lt" letter        titlecase)
35     ("Mn" mark          non-spacing)
36     ("Mc" mark          spacing-combining)
37     ("Me" mark          enclosing)
38     ("Nd" number        decimal-digit)
39     ("Nl" number        letter)
40     ("No" number        other)
41     ("Zs" separator     space)
42     ("Zl" separator     line)
43     ("Zp" separator     paragraph)
44     ("Cc" other         control)
45     ("Cf" other         format)
46     ("Cs" other         surrogate)
47     ("Co" other         private-use)
48     ("Cn" other         not-assigned)))
49
50 (defconst unidata-informative-category-alist
51   '(("Lm" letter        modifier)
52     ("Lo" letter        other)
53     ("Pc" punctuation   connector)
54     ("Pd" punctuation   dash)
55     ("Ps" punctuation   open)
56     ("Pe" punctuation   close)
57     ("Pi" punctuation   initial-quote)
58     ("Pf" punctuation   final-quote)
59     ("Po" punctuation   other)
60     ("Sm" symbol        math)
61     ("Sc" symbol        currency)
62     ("Sk" symbol        modifier)
63     ("So" symbol        other)
64     ))
65
66 (defconst shuowen-radicals
67   [?一 ?上 ?示 ?三 ?王 ?玉 ?玨 ?气 ?士 ?丨 ; 010
68    ?屮 ?艸 ?蓐 ?茻 ?小 ?八 ?釆 ?半 ?牛 ?犛 ; 020
69    ?告 ?口 ?凵 ?吅 ?哭 ?走 ?止 ?癶 ?步 ?此 ; 030
70    ?正 ?是 ?辵 ?彳 ?廴 ?㢟 ?行 ?齒 ?牙 ?足 ; 040
71    ?疋 ?品 ?龠 ?冊 ?㗊 ?舌 ?干 ?谷 ?只 ?㕯 ; 050
72    ?句 ?丩 ?古 ?十 ?卅 ?言 ?誩 ?音 ?䇂 ?丵 ; 060
73    ?菐 ?𠬞 ?廾 ?共 ?異 ?舁 ?𦥑 ?䢅 ?爨 ?革 ; 070
74    ?鬲 ?䰜 ?爪 ?𠃨 ?鬥 ?又 ?𠂇 ?㕜 ?支 ?𦘒 ; 080
75    ?聿 ?畫 ?隶 ?臤 ?臣 ?殳 ?殺 ?𠘧 ?寸 ?皮 ; 090
76    ?㼱 ?攴 ?敎 ?卜 ?用 ?爻 ?㸚 ?𥄎 ?目 ?䀠 ; 100
77    ?眉 ?盾 ?自 ?白 ?鼻 ?皕 ?習 ?羽 ?隹 ?奞 ; 110
78    ?萑 ?𦫳 ?苜 ?羊 ?羴 ?瞿 ?雔 ?雥 ?鳥 ?烏 ; 120
79    ?𠦒 ?冓 ?幺 ?𢆶 ?叀 ?玄 ?予 ?放 ?𠬪 ?𣦼 ; 130
80    ?歺 ?死 ?冎 ?骨 ?肉 ?筋 ?刀 ?刃 ?㓞 ?丰 ; 140
81    ?耒 ?𧢲 ?竹 ?箕 ?丌 ?左 ?工 ?㠭 ?巫 ?甘 ; 150
82    ?曰 ?乃 ?丂 ?可 ?兮 ?号 ?亏 ?旨 ?喜 ?壴 ; 160
83    ?鼓 ?豈 ?豆 ?豊 ?豐 ?䖒 ?虍 ?虎 ?虤 ?皿 ; 170
84    ?𠙴 ?去 ?血 ?丶 ?丹 ?青 ?井 ?皀 ?鬯 ?食 ; 180
85    ?亼 ?會 ?倉 ?入 ?缶 ?矢 ?高 ?冂 ?𩫏 ?京 ; 190
86    ?亯 ?𣆪 ?畗 ?㐭 ?嗇 ?來 ?麥 ?夊 ?舛 ?䑞 ; 200
87    ?韋 ?弟 ?夂 ?久 ?桀 ?木 ?東 ?林 ?才 ?叒 ; 210
88    ?之 ?帀 ?出 ?𣎵 ?生 ?乇 ?𠂹 ?𠌶 ?華 ?𥝌 ; 220
89    ?稽 ?巢 ?桼 ?束 ?㯻 ?囗 ?員 ?貝 ?邑 ?𨛜 ; 230
90    ?日 ?旦 ?倝 ?㫃 ?冥 ?晶 ?月 ?有 ?明 ?囧 ; 240
91    ?夕 ?多 ?毌 ?𢎘 ?𣐺 ?卣 ?齊 ?朿 ?片 ?鼎 ; 250
92    ?克 ?彔 ?禾 ?秝 ?黍 ?香 ?米 ?毇 ?臼 ?凶 ; 260
93    ?𣎳 ?林 ?麻 ?尗 ?耑 ?韭 ?瓜 ?瓠 ?宀 ?宮 ; 270
94    ?呂 ?穴 ?㝱 ?𤕫 ?冖 ?𠔼 ?冃 ?㒳 ?网 ?襾 ; 280
95    ?巾 ?巿 ?帛 ?白 ?㡀 ?黹 ?人 ?𠤎 ?匕 ?从 ; 290
96    ])
97
98 (defun shuowen-radical (number)
99   (aref shuowen-radicals (1- number)))
100
101 (defvar char-db-file-coding-system 'utf-8-mcs-er)
102
103 (defvar char-db-ignored-attributes '(ideographic-products))
104
105 (defvar char-db-coded-charset-priority-list
106   '(ascii
107     control-1
108     latin-iso8859-1
109     latin-iso8859-2
110     latin-iso8859-3
111     latin-iso8859-4
112     latin-iso8859-9
113     latin-jisx0201
114     cyrillic-iso8859-5
115     greek-iso8859-7
116     thai-tis620
117     =jis-x0208
118     =jis-x0208@1978
119     =jis-x0208@1983
120     japanese-jisx0212
121     chinese-gb2312
122     =jis-x0208@1990
123     chinese-cns11643-1
124     chinese-cns11643-2
125     chinese-cns11643-3
126     chinese-cns11643-4
127     chinese-cns11643-5
128     chinese-cns11643-6
129     chinese-cns11643-7
130     =jis-x0213-1
131     =jis-x0213-1@2000
132     =jis-x0213-1@2004
133     =jis-x0213-2
134     korean-ksc5601
135     chinese-isoir165
136     katakana-jisx0201
137     hebrew-iso8859-8
138     chinese-gb12345
139     latin-viscii
140     ethiopic-ucs
141     =big5-cdp
142     =gt
143     ideograph-daikanwa-2
144     ideograph-daikanwa
145     =cbeta
146     =gt-k
147     ideograph-hanziku-1
148     ideograph-hanziku-2
149     ideograph-hanziku-3
150     ideograph-hanziku-4
151     ideograph-hanziku-5
152     ideograph-hanziku-6
153     ideograph-hanziku-7
154     ideograph-hanziku-8
155     ideograph-hanziku-9
156     ideograph-hanziku-10
157     ideograph-hanziku-11
158     ideograph-hanziku-12
159     =>>jis-x0208
160     =>>jis-x0213-1
161     =>>jis-x0213-1@2000
162     =>>jis-x0213-1@2004
163     =>>jis-x0213-2
164     =>>jis-x0208@1978
165     =>>gt
166     =>jis-x0208@usual
167     =>jis-x0208
168     =>jis-x0208@1997
169     =>jis-x0213-1
170     =>jis-x0213-1@2000
171     =>jis-x0213-1@2004
172     =>jis-x0213-2@usual
173     =>jis-x0213-2
174     ==>ucs@bucs
175     =>ucs@iso
176     =>ucs@unicode
177     =>ucs@jis
178     =>ucs@JP
179     =>ucs@cns
180     =>ucs@ks
181     =>>ucs@unicode
182     =>>ucs@jis
183     =>>ucs@cns
184     =ucs@iso
185     =ucs@unicode
186     =>>big5-cdp
187     =>>gt-k
188     =>gt
189     =>big5-cdp
190     =>daikanwa
191     =big5
192     =big5-eten
193     =zinbun-oracle
194     =>zinbun-oracle
195     =ruimoku-v6
196     =>>ruimoku-v6
197     =jef-china3
198     =shinjigen))
199
200
201 ;;; @ char-db formatters
202 ;;;
203
204 (defun char-db-make-char-spec (char)
205   (let (ret char-spec)
206     (cond ((characterp char)
207            (cond ((and (setq ret (encode-char char '=ucs 'defined-only))
208                        (not (and (<= #xE000 ret)(<= ret #xF8FF))))
209                   (setq char-spec (list (cons '=ucs ret)))
210                   (cond ((setq ret (get-char-attribute char 'name))
211                          (setq char-spec (cons (cons 'name ret) char-spec))
212                          )
213                         ((setq ret (get-char-attribute char 'name*))
214                          (setq char-spec (cons (cons 'name* ret) char-spec))
215                          ))
216                   )
217                  ((setq ret
218                         (catch 'tag
219                           (let ((rest char-db-coded-charset-priority-list)
220                                 ccs)
221                             (while rest
222                               (setq ccs (charset-name
223                                          (find-charset (car rest))))
224                               (if (setq ret
225                                         (encode-char char ccs
226                                                      'defined-only))
227                                   (throw 'tag (cons ccs ret)))
228                               (setq rest (cdr rest))))))
229                   (setq char-spec (list ret))
230                   (dolist (ccs (delq (car ret) (charset-list)))
231                     (if (and (or (charset-iso-final-char ccs)
232                                  (memq ccs
233                                        '(=daikanwa
234                                          =daikanwa@rev2
235                                          ;; =gt-k
236                                          =jis-x0208@1997
237                                          ))
238                                  (string-match "=ucs@" (symbol-name ccs)))
239                              (setq ccs (charset-name ccs))
240                              (null (assq ccs char-spec))
241                              (setq ret (encode-char char ccs 'defined-only)))
242                         (setq char-spec (cons (cons ccs ret) char-spec))))
243                   (if (null char-spec)
244                       (setq char-spec (split-char char)))
245                   (cond ((setq ret (get-char-attribute char 'name))
246                          (setq char-spec (cons (cons 'name ret) char-spec))
247                          )
248                         ((setq ret (get-char-attribute char 'name*))
249                          (setq char-spec (cons (cons 'name* ret) char-spec))
250                          ))
251                   )
252                  ((setq ret (get-char-attribute
253                              char 'ideographic-combination))
254                   (setq char-spec
255                         (cons (cons 'ideographic-combination ret)
256                               char-spec))
257                   ))
258            char-spec)
259           ((consp char)
260            char))))
261     
262 (defun char-db-insert-char-spec (char &optional readable column
263                                       required-features)
264   (unless column
265     (setq column (current-column)))
266   (let (char-spec temp-char)
267     (setq char-spec (char-db-make-char-spec char))
268     (unless (or (characterp char) ; char
269                 (condition-case nil
270                     (setq char (find-char char-spec))
271                   (error nil)))
272       ;; define temporary character
273       ;;   Current implementation is dirty.
274       (setq temp-char (define-char (cons '(ideograph-daikanwa . 0)
275                                          char-spec)))
276       (remove-char-attribute temp-char 'ideograph-daikanwa)
277       (setq char temp-char))
278     (insert-char-attributes char
279                             readable
280                             (union (mapcar #'car char-spec)
281                                    required-features))
282     (when temp-char
283       ;; undefine temporary character
284       ;;   Current implementation is dirty.
285       (setq char-spec (char-attribute-alist temp-char))
286       (while char-spec
287         (remove-char-attribute temp-char (car (car char-spec)))
288         (setq char-spec (cdr char-spec))))))
289
290 (defun char-db-insert-alist (alist &optional readable column)
291   (unless column
292     (setq column (current-column)))
293   (let ((line-breaking
294          (concat "\n" (make-string (1+ column) ?\ )))
295         name value
296         ret al ; cal
297         key
298         lbs cell rest separator)
299     (insert "(")
300     (while alist
301       (setq name (car (car alist))
302             value (cdr (car alist)))
303       (cond ((eq name 'char)
304              (insert "(char . ")
305              (if (setq ret (condition-case nil
306                                (find-char value)
307                              (error nil)))
308                  (progn
309                    (setq al nil
310                          ;; cal nil
311                          )
312                    (while value
313                      (setq key (car (car value)))
314                      ;; (if (find-charset key)
315                      ;;     (setq cal (cons key cal))
316                      (setq al (cons key al))
317                      ;; )
318                      (setq value (cdr value)))
319                    (insert-char-attributes ret
320                                            readable
321                                            (or al 'none) ; cal
322                                            ))
323                (insert (prin1-to-string value)))
324              (insert ")")
325              (insert line-breaking))
326             ((consp value)
327              (insert (format "(%-18s " name))
328              (setq lbs (concat "\n" (make-string (current-column) ?\ )))
329              (while (consp value)
330                (setq cell (car value))
331                (if (and (consp cell)
332                         (consp (car cell))
333                         (setq ret (condition-case nil
334                                       (find-char cell)
335                                     (error nil)))
336                         )
337                    (progn
338                      (setq rest cell
339                            al nil
340                            ;; cal nil
341                            )
342                      (while rest
343                        (setq key (car (car rest)))
344                        ;; (if (find-charset key)
345                        ;;     (setq cal (cons key cal))
346                        (setq al (cons key al))
347                        ;; )
348                        (setq rest (cdr rest)))
349                      (if separator
350                          (insert lbs))
351                      (insert-char-attributes ret
352                                              readable
353                                              al ; cal
354                                              )
355                      (setq separator lbs))
356                  (if separator
357                      (insert separator))
358                  (insert (prin1-to-string cell))
359                  (setq separator " "))
360                (setq value (cdr value)))
361              (insert ")")
362              (insert line-breaking))
363             (t
364              (insert (format "(%-18s . %S)%s"
365                              name value
366                              line-breaking))))
367       (setq alist (cdr alist))))
368   (insert ")"))
369
370 (defun char-db-insert-char-reference (plist &optional readable column)
371   (unless column
372     (setq column (current-column)))
373   (let ((line-breaking
374          (concat "\n" (make-string (1+ column) ?\ )))
375         (separator "")
376         name value)
377     (insert "(")
378     (while plist
379       (setq name (pop plist))
380       (setq value (pop plist))
381       (cond ((eq name :char)
382              (insert separator)
383              (insert ":char\t")
384              (cond ((numberp value)
385                     (setq value (decode-char '=ucs value)))
386                    ;; ((consp value)
387                    ;;  (setq value (or (find-char value)
388                    ;;                  value)))
389                    )
390              (char-db-insert-char-spec value readable)
391              (insert line-breaking)
392              (setq separator ""))
393             ((eq name :radical)
394              (insert (format "%s%s\t%d ; %c%s"
395                              separator
396                              name value
397                              (ideographic-radical value)
398                              line-breaking))
399              (setq separator ""))
400             (t
401              (insert (format "%s%s\t%S" separator name value))
402              (setq separator line-breaking)))
403       ))
404   (insert ")"))
405
406 (defun char-db-decode-isolated-char (ccs code-point)
407   (let (ret)
408     (setq ret
409           (cond ((eq ccs 'arabic-iso8859-6)
410                  (decode-char ccs code-point))
411                 ((and (memq ccs '(=gt-pj-1
412                                   =gt-pj-2
413                                   =gt-pj-3
414                                   =gt-pj-4
415                                   =gt-pj-5
416                                   =gt-pj-6
417                                   =gt-pj-7
418                                   =gt-pj-8
419                                   =gt-pj-9
420                                   =gt-pj-10
421                                   =gt-pj-11))
422                       (setq ret (decode-char ccs code-point))
423                       (setq ret (encode-char ret '=gt 'defined-only)))
424                  (decode-builtin-char '=gt ret))
425                 (t
426                  (decode-builtin-char ccs code-point))))
427     (cond ((and (<= 0 (char-int ret))
428                 (<= (char-int ret) #x1F))
429            (decode-char '=ucs (+ #x2400 (char-int ret))))
430           ((= (char-int ret) #x7F)
431            ?\u2421)
432           (t ret))))
433
434 (defvar char-db-convert-obsolete-format t)
435
436 (defun char-db-insert-ccs-feature (name value line-breaking)
437   (insert
438    (format
439     (cond ((memq name '(=shinjigen
440                         =shinjigen@1ed
441                         =shinjigen@rev =shinjigen/+p@rev))
442            "(%-18s .  %04d)\t; %c")
443           ((eq name '=shinjigen@1ed/24pr)
444            "(%-18s . %04d)\t; %c")
445           ((or (memq name '(=daikanwa
446                             =daikanwa@rev1 =daikanwa@rev2
447                             =>>daikanwa =>daikanwa
448                             =gt =>>gt =>gt =gt-k =>>gt-k =cbeta
449                             =zinbun-oracle =>zinbun-oracle))
450                (string-match "^=adobe-" (symbol-name name)))
451            "(%-18s . %05d)\t; %c")
452           ((eq name 'mojikyo)
453            "(%-18s . %06d)\t; %c")
454           ((>= (charset-dimension name) 2)
455            "(%-18s . #x%04X)\t; %c")
456           (t
457            "(%-18s . #x%02X)\t; %c"))
458     name
459     (if (= (charset-iso-graphic-plane name) 1)
460         (logior value
461                 (cond ((= (charset-dimension name) 1)
462                        #x80)
463                       ((= (charset-dimension name) 2)
464                        #x8080)
465                       ((= (charset-dimension name) 3)
466                        #x808080)
467                       (t 0)))
468       value)
469     (char-db-decode-isolated-char name value)))
470   (if (and (= (charset-chars name) 94)
471            (= (charset-dimension name) 2))
472       (insert (format " [%02d-%02d]"
473                       (- (lsh value -8) 32)
474                       (- (logand value 255) 32))))
475   (insert line-breaking))
476
477 (defun char-db-insert-relation-feature (char name value line-breaking
478                                              ccss readable)
479   (insert (format "(%-18s%s " name line-breaking))
480   (let ((lbs (concat "\n" (make-string (current-column) ?\ )))
481         separator cell sources required-features
482         ret)
483     (while (consp value)
484       (setq cell (car value))
485       (if (integerp cell)
486           (setq cell (decode-char '=ucs cell)))
487       (cond
488        ((eq name '->subsumptive)
489         (when (or (not (some (lambda (atr)
490                                (get-char-attribute cell atr))
491                              char-db-ignored-attributes))
492                   (some (lambda (ccs)
493                           (encode-char cell ccs 'defined-only))
494                         ccss))
495           (if separator
496               (insert lbs))
497           (let ((char-db-ignored-attributes
498                  (cons '<-subsumptive
499                        char-db-ignored-attributes)))
500             (insert-char-attributes cell readable))
501           (setq separator lbs))
502         )
503        ((characterp cell)
504         (setq sources
505               (get-char-attribute
506                char (intern (format "%s*sources" name))))
507         (setq required-features nil)
508         (dolist (source sources)
509           (cond
510            ((memq source '(JP
511                            JP/Jouyou
512                            shinjigen shinjigen@1ed shinjigen@rev))
513             (setq required-features
514                   (union required-features
515                          '(=jis-x0208
516                            =jis-x0208@1990
517                            =jis-x0213-1@2000
518                            =jis-x0213-1@2004
519                            =jis-x0213-2
520                            =jis-x0212
521                            =jis-x0208@1983
522                            =jis-x0208@1978
523                            =shinjigen))))
524            ((eq source 'CN)
525             (setq required-features
526                   (union required-features
527                          '(=gb2312
528                            =gb12345
529                            =iso-ir165)))))
530           (cond
531            ((find-charset (setq ret (intern (format "=%s" source))))
532             (setq required-features
533                   (cons ret required-features)))
534            (t (setq required-features
535                     (cons source required-features)))))
536         (cond ((string-match "@JP" (symbol-name name))
537                (setq required-features
538                      (union required-features
539                             '(=jis-x0208
540                               =jis-x0208@1990
541                               =jis-x0213-1-2000
542                               =jis-x0213-2-2000
543                               =jis-x0212
544                               =jis-x0208@1983
545                               =jis-x0208@1978))))
546               ((string-match "@CN" (symbol-name name))
547                (setq required-features
548                      (union required-features
549                             '(=gb2312
550                               =gb12345
551                               =iso-ir165)))))
552         (if separator
553             (insert lbs))
554         (if readable
555             (insert (format "%S" cell))
556           (char-db-insert-char-spec cell readable
557                                     nil
558                                     required-features))
559         (setq separator lbs))
560        ((consp cell)
561         (if separator
562             (insert lbs))
563         (if (consp (car cell))
564             (char-db-insert-char-spec cell readable)
565           (char-db-insert-char-reference cell readable))
566         (setq separator lbs))
567        (t
568         (if separator
569             (insert separator))
570         (insert (prin1-to-string cell))
571         (setq separator " ")))
572       (setq value (cdr value)))
573     (insert ")")
574     (insert line-breaking)))
575
576 (defun insert-char-attributes (char &optional readable attributes column)
577   (unless column
578     (setq column (current-column)))
579   (let (name value ; has-long-ccs-name
580         rest
581         radical strokes
582         (line-breaking
583          (concat "\n" (make-string (1+ column) ?\ )))
584         lbs cell separator ret
585         key al cal
586         dest-ccss ; sources required-features
587         ccss)
588     (let (atr-d)
589       (setq attributes
590             (sort (if attributes
591                       (if (consp attributes)
592                           (progn
593                             (dolist (name attributes)
594                               (unless (memq name char-db-ignored-attributes)
595                                 (if (find-charset name)
596                                     (push name ccss))
597                                 (push name atr-d)))
598                             atr-d))
599                     (dolist (name (char-attribute-list))
600                       (unless (memq name char-db-ignored-attributes)
601                         (if (find-charset name)
602                             (push name ccss))
603                         (push name atr-d)))
604                     atr-d)
605                   #'char-attribute-name<)))
606     (insert "(")
607     (when (memq '<-subsumptive attributes)
608       (when readable
609         (when (setq value (get-char-attribute char '<-subsumptive))
610           (char-db-insert-relation-feature char '<-subsumptive value
611                                            line-breaking
612                                            ccss readable)))
613       (setq attributes (delq '<-subsumptive attributes)))
614     (when (and (memq '<-denotational attributes)
615                (setq value (get-char-attribute char '<-denotational)))
616       (char-db-insert-relation-feature char '<-denotational value
617                                        line-breaking
618                                        ccss readable)
619       (setq attributes (delq '<-denotational attributes)))
620     (when (and (memq 'name attributes)
621                (setq value (get-char-attribute char 'name)))
622       (insert (format
623                (if (> (+ (current-column) (length value)) 48)
624                    "(name . %S)%s"
625                  "(name               . %S)%s")
626                value line-breaking))
627       (setq attributes (delq 'name attributes))
628       )
629     (when (and (memq 'name* attributes)
630                (setq value (get-char-attribute char 'name*)))
631       (insert (format
632                (if (> (+ (current-column) (length value)) 48)
633                    "(name* . %S)%s"
634                  "(name*              . %S)%s")
635                value line-breaking))
636       (setq attributes (delq 'name* attributes))
637       )
638     (when (and (memq 'script attributes)
639                (setq value (get-char-attribute char 'script)))
640       (insert (format "(script\t\t%s)%s"
641                       (mapconcat (function prin1-to-string)
642                                  value " ")
643                       line-breaking))
644       (setq attributes (delq 'script attributes))
645       )
646     (dolist (name '(=>ucs =>ucs*))
647       (when (and (memq name attributes)
648                  (setq value (get-char-attribute char name)))
649         (insert (format "(%-18s . #x%04X)\t; %c%s"
650                         name value (decode-char '=ucs value)
651                         line-breaking))
652         (setq attributes (delq name attributes))))
653     (dolist (name '(=>ucs@gb =>ucs@big5))
654       (when (and (memq name attributes)
655                  (setq value (get-char-attribute char name)))
656         (insert (format "(%-18s . #x%04X)\t; %c%s"
657                         name value
658                         (decode-char (intern
659                                       (concat "="
660                                               (substring
661                                                (symbol-name name) 2)))
662                                      value)
663                         line-breaking))
664         (setq attributes (delq name attributes))
665         ))
666     ;; (dolist (name '(=>daikanwa))
667     ;;   (when (and (memq name attributes)
668     ;;              (setq value (get-char-attribute char name)))
669     ;;     (insert
670     ;;      (if (integerp value)
671     ;;          (format "(%-18s . %05d)\t; %c%s"
672     ;;                  name value (decode-char '=daikanwa value)
673     ;;                  line-breaking)
674     ;;        (format "(%-18s %s)\t; %c%s"
675     ;;                name
676     ;;                (mapconcat (function prin1-to-string)
677     ;;                           value " ")
678     ;;                (char-representative-of-daikanwa char)
679     ;;                line-breaking)))
680     ;;     (setq attributes (delq name attributes))))
681     (when (and (memq 'general-category attributes)
682                (setq value (get-char-attribute char 'general-category)))
683       (insert (format
684                "(general-category\t%s) ; %s%s"
685                (mapconcat (lambda (cell)
686                             (format "%S" cell))
687                           value " ")
688                (cond ((rassoc value unidata-normative-category-alist)
689                       "Normative Category")
690                      ((rassoc value unidata-informative-category-alist)
691                       "Informative Category")
692                      (t
693                       "Unknown Category"))
694                line-breaking))
695       (setq attributes (delq 'general-category attributes))
696       )
697     (when (and (memq 'bidi-category attributes)
698                (setq value (get-char-attribute char 'bidi-category)))
699       (insert (format "(bidi-category\t. %S)%s"
700                       value
701                       line-breaking))
702       (setq attributes (delq 'bidi-category attributes))
703       )
704     (unless (or (not (memq 'mirrored attributes))
705                 (eq (setq value (get-char-attribute char 'mirrored 'empty))
706                     'empty))
707       (insert (format "(mirrored\t\t. %S)%s"
708                       value
709                       line-breaking))
710       (setq attributes (delq 'mirrored attributes))
711       )
712     (cond
713      ((and (memq 'decimal-digit-value attributes)
714            (setq value (get-char-attribute char 'decimal-digit-value)))
715       (insert (format "(decimal-digit-value . %S)%s"
716                       value
717                       line-breaking))
718       (setq attributes (delq 'decimal-digit-value attributes))
719       (when (and (memq 'digit-value attributes)
720                  (setq value (get-char-attribute char 'digit-value)))
721         (insert (format "(digit-value\t . %S)%s"
722                         value
723                         line-breaking))
724         (setq attributes (delq 'digit-value attributes))
725         )
726       (when (and (memq 'numeric-value attributes)
727                  (setq value (get-char-attribute char 'numeric-value)))
728         (insert (format "(numeric-value\t . %S)%s"
729                         value
730                         line-breaking))
731         (setq attributes (delq 'numeric-value attributes))
732         )
733       )
734      (t
735       (when (and (memq 'digit-value attributes)
736                  (setq value (get-char-attribute char 'digit-value)))
737         (insert (format "(digit-value\t. %S)%s"
738                         value
739                         line-breaking))
740         (setq attributes (delq 'digit-value attributes))
741         )
742       (when (and (memq 'numeric-value attributes)
743                  (setq value (get-char-attribute char 'numeric-value)))
744         (insert (format "(numeric-value\t. %S)%s"
745                         value
746                         line-breaking))
747         (setq attributes (delq 'numeric-value attributes))
748         )))
749     (when (and (memq 'iso-10646-comment attributes)
750                (setq value (get-char-attribute char 'iso-10646-comment)))
751       (insert (format "(iso-10646-comment\t. %S)%s"
752                       value
753                       line-breaking))
754       (setq attributes (delq 'iso-10646-comment attributes))
755       )
756     (when (and (memq 'morohashi-daikanwa attributes)
757                (setq value (get-char-attribute char 'morohashi-daikanwa)))
758       (insert (format "(morohashi-daikanwa\t%s)%s"
759                       (mapconcat (function prin1-to-string) value " ")
760                       line-breaking))
761       (setq attributes (delq 'morohashi-daikanwa attributes))
762       )
763     (setq radical nil
764           strokes nil)
765     (when (and (memq 'ideographic-radical attributes)
766                (setq value (get-char-attribute char 'ideographic-radical)))
767       (setq radical value)
768       (insert (format "(ideographic-radical . %S)\t; %c%s"
769                       radical
770                       (ideographic-radical radical)
771                       line-breaking))
772       (setq attributes (delq 'ideographic-radical attributes))
773       )
774     (when (and (memq 'shuowen-radical attributes)
775                (setq value (get-char-attribute char 'shuowen-radical)))
776       (insert (format "(shuowen-radical\t. %S)\t; %c%s"
777                       value
778                       (shuowen-radical value)
779                       line-breaking))
780       (setq attributes (delq 'shuowen-radical attributes))
781       )
782     (let (key)
783       (dolist (domain
784                (append
785                 char-db-feature-domains
786                 (let (dest domain)
787                   (dolist (feature (char-attribute-list))
788                     (setq feature (symbol-name feature))
789                     (when (string-match
790                            "\\(radical\\|strokes\\)@\\([^@*]+\\)\\(\\*\\|$\\)"
791                            feature)
792                       (setq domain (intern (match-string 2 feature)))
793                      (unless (memq domain dest)
794                        (setq dest (cons domain dest)))))
795                   (sort dest #'string<))))
796         (setq key (intern (format "%s@%s" 'ideographic-radical domain)))
797         (when (and (memq key attributes)
798                    (setq value (get-char-attribute char key)))
799           (setq radical value)
800           (insert (format "(%s . %S)\t; %c%s"
801                           key
802                           radical
803                           (ideographic-radical radical)
804                           line-breaking))
805           (setq attributes (delq key attributes))
806           )
807         (setq key (intern (format "%s@%s" 'ideographic-strokes domain)))
808         (when (and (memq key attributes)
809                    (setq value (get-char-attribute char key)))
810           (setq strokes value)
811           (insert (format "(%s . %S)%s"
812                           key
813                           strokes
814                           line-breaking))
815           (setq attributes (delq key attributes))
816           )
817         (setq key (intern (format "%s@%s" 'total-strokes domain)))
818         (when (and (memq key attributes)
819                    (setq value (get-char-attribute char key)))
820           (insert (format "(%s       . %S)%s"
821                           key
822                           value
823                           line-breaking))
824           (setq attributes (delq key attributes))
825           )
826         (dolist (feature '(ideographic-radical
827                            ideographic-strokes
828                            total-strokes))
829           (setq key (intern (format "%s@%s*sources" feature domain)))
830           (when (and (memq key attributes)
831                      (setq value (get-char-attribute char key)))
832             (insert (format "(%s%s" key line-breaking))
833             (dolist (cell value)
834               (insert (format " %s" cell)))
835             (insert ")")
836             (insert line-breaking)
837             (setq attributes (delq key attributes))
838             ))
839         ))
840     (when (and (memq 'ideographic-strokes attributes)
841                (setq value (get-char-attribute char 'ideographic-strokes)))
842       (setq strokes value)
843       (insert (format "(ideographic-strokes . %S)%s"
844                       strokes
845                       line-breaking))
846       (setq attributes (delq 'ideographic-strokes attributes))
847       )
848     (when (and (memq 'kangxi-radical attributes)
849                (setq value (get-char-attribute char 'kangxi-radical)))
850       (unless (eq value radical)
851         (insert (format "(kangxi-radical\t . %S)\t; %c%s"
852                         value
853                         (ideographic-radical value)
854                         line-breaking))
855         (or radical
856             (setq radical value)))
857       (setq attributes (delq 'kangxi-radical attributes))
858       )
859     (when (and (memq 'kangxi-strokes attributes)
860                (setq value (get-char-attribute char 'kangxi-strokes)))
861       (unless (eq value strokes)
862         (insert (format "(kangxi-strokes\t . %S)%s"
863                         value
864                         line-breaking))
865         (or strokes
866             (setq strokes value)))
867       (setq attributes (delq 'kangxi-strokes attributes))
868       )
869     (when (and (memq 'japanese-radical attributes)
870                (setq value (get-char-attribute char 'japanese-radical)))
871       (unless (eq value radical)
872         (insert (format "(japanese-radical\t . %S)\t; %c%s"
873                         value
874                         (ideographic-radical value)
875                         line-breaking))
876         (or radical
877             (setq radical value)))
878       (setq attributes (delq 'japanese-radical attributes))
879       )
880     (when (and (memq 'japanese-strokes attributes)
881                (setq value (get-char-attribute char 'japanese-strokes)))
882       (unless (eq value strokes)
883         (insert (format "(japanese-strokes\t . %S)%s"
884                         value
885                         line-breaking))
886         (or strokes
887             (setq strokes value)))
888       (setq attributes (delq 'japanese-strokes attributes))
889       )
890     (when (and (memq 'cns-radical attributes)
891                (setq value (get-char-attribute char 'cns-radical)))
892       (insert (format "(cns-radical\t . %S)\t; %c%s"
893                       value
894                       (ideographic-radical value)
895                       line-breaking))
896       (setq attributes (delq 'cns-radical attributes))
897       )
898     (when (and (memq 'cns-strokes attributes)
899                (setq value (get-char-attribute char 'cns-strokes)))
900       (unless (eq value strokes)
901         (insert (format "(cns-strokes\t . %S)%s"
902                         value
903                         line-breaking))
904         (or strokes
905             (setq strokes value)))
906       (setq attributes (delq 'cns-strokes attributes))
907       )
908     (when (and (memq 'shinjigen-1-radical attributes)
909                (setq value (get-char-attribute char 'shinjigen-1-radical)))
910       (unless (eq value radical)
911         (insert (format "(shinjigen-1-radical . %S)\t; %c%s"
912                         value
913                         (ideographic-radical value)
914                         line-breaking))
915         (or radical
916             (setq radical value)))
917       (setq attributes (delq 'shinjigen-1-radical attributes))
918       )
919     (when (and (memq 'ideographic- attributes)
920                (setq value (get-char-attribute char 'ideographic-)))
921       (insert "(ideographic-       ")
922       (setq lbs (concat "\n" (make-string (current-column) ?\ ))
923             separator nil)
924       (while (consp value)
925         (setq cell (car value))
926         (if (integerp cell)
927             (setq cell (decode-char '=ucs cell)))
928         (cond ((characterp cell)
929                (if separator
930                    (insert lbs))
931                (if readable
932                    (insert (format "%S" cell))
933                  (char-db-insert-char-spec cell readable))
934                (setq separator lbs))
935               ((consp cell)
936                (if separator
937                    (insert lbs))
938                (if (consp (car cell))
939                    (char-db-insert-char-spec cell readable)
940                  (char-db-insert-char-reference cell readable))
941                (setq separator lbs))
942               (t
943                (if separator
944                    (insert separator))
945                (insert (prin1-to-string cell))
946                (setq separator " ")))
947         (setq value (cdr value)))
948       (insert ")")
949       (insert line-breaking)
950       (setq attributes (delq 'ideographic- attributes)))
951     (when (and (memq 'total-strokes attributes)
952                (setq value (get-char-attribute char 'total-strokes)))
953       (insert (format "(total-strokes       . %S)%s"
954                       value
955                       line-breaking))
956       (setq attributes (delq 'total-strokes attributes))
957       )
958     (when (and (memq '->ideograph attributes)
959                (setq value (get-char-attribute char '->ideograph)))
960       (insert (format "(->ideograph\t%s)%s"
961                       (mapconcat (lambda (code)
962                                    (cond ((symbolp code)
963                                           (symbol-name code))
964                                          ((integerp code)
965                                           (format "#x%04X" code))
966                                          (t
967                                           (format "%s %S"
968                                                   line-breaking code))))
969                                  value " ")
970                       line-breaking))
971       (setq attributes (delq '->ideograph attributes))
972       )
973     ;; (when (and (memq '->decomposition attributes)
974     ;;            (setq value (get-char-attribute char '->decomposition)))
975     ;;   (insert (format "(->decomposition\t%s)%s"
976     ;;                   (mapconcat (lambda (code)
977     ;;                                (cond ((symbolp code)
978     ;;                                       (symbol-name code))
979     ;;                                      ((characterp code)
980     ;;                                       (if readable
981     ;;                                           (format "%S" code)
982     ;;                                         (format "#x%04X"
983     ;;                                                 (char-int code))
984     ;;                                         ))
985     ;;                                      ((integerp code)
986     ;;                                       (format "#x%04X" code))
987     ;;                                      (t
988     ;;                                       (format "%s%S" line-breaking code))))
989     ;;                              value " ")
990     ;;                   line-breaking))
991     ;;   (setq attributes (delq '->decomposition attributes))
992     ;;   )
993     (if (equal (get-char-attribute char '->titlecase)
994                (get-char-attribute char '->uppercase))
995         (setq attributes (delq '->titlecase attributes)))
996     (when (and (memq '->mojikyo attributes)
997                (setq value (get-char-attribute char '->mojikyo)))
998       (insert (format "(->mojikyo\t\t. %06d)\t; %c%s"
999                       value (decode-char 'mojikyo value)
1000                       line-breaking))
1001       (setq attributes (delq '->mojikyo attributes))
1002       )
1003     (when (and (memq 'hanyu-dazidian-vol attributes)
1004                (setq value (get-char-attribute char 'hanyu-dazidian-vol)))
1005       (insert (format "(hanyu-dazidian-vol  . %d)%s"
1006                       value line-breaking))
1007       (setq attributes (delq 'hanyu-dazidian-vol attributes))
1008       )
1009     (when (and (memq 'hanyu-dazidian-page attributes)
1010                (setq value (get-char-attribute char 'hanyu-dazidian-page)))
1011       (insert (format "(hanyu-dazidian-page . %d)%s"
1012                       value line-breaking))
1013       (setq attributes (delq 'hanyu-dazidian-page attributes))
1014       )
1015     (when (and (memq 'hanyu-dazidian-char attributes)
1016                (setq value (get-char-attribute char 'hanyu-dazidian-char)))
1017       (insert (format "(hanyu-dazidian-char . %d)%s"
1018                       value line-breaking))
1019       (setq attributes (delq 'hanyu-dazidian-char attributes))
1020       )
1021     (unless readable
1022       (dolist (ignored '(composition
1023                          ->denotational <-subsumptive ->ucs-unified
1024                          ->ideographic-component-forms))
1025         (setq attributes (delq ignored attributes))))
1026     (while attributes
1027       (setq name (car attributes))
1028       (if (setq value (get-char-attribute char name))
1029           (cond ((setq ret (find-charset name))
1030                  (setq name (charset-name ret))
1031                  (if (and (not (memq name dest-ccss))
1032                           (prog1
1033                               (setq value (get-char-attribute char name))
1034                             (setq dest-ccss (cons name dest-ccss))))
1035                      (char-db-insert-ccs-feature name value line-breaking))
1036                  )
1037                 ((string-match "^=>ucs@" (symbol-name name))
1038                  (insert (format "(%-18s . #x%04X)\t; %c%s"
1039                                  name value (decode-char '=ucs value)
1040                                  line-breaking))
1041                  )
1042                 ((eq name 'jisx0208-1978/4X)
1043                  (insert (format "(%-18s . #x%04X)%s"
1044                                  name value
1045                                  line-breaking))
1046                  )
1047                 ((and
1048                   (not readable)
1049                   (not (eq name '->subsumptive))
1050                   (not (eq name '->uppercase))
1051                   (not (eq name '->lowercase))
1052                   (not (eq name '->titlecase))
1053                   (not (eq name '->canonical))
1054                   (not (eq name '->Bopomofo))
1055                   (not (eq name '->mistakable))
1056                   (not (eq name '->ideographic-variants))
1057                   (null (get-char-attribute
1058                          char (intern (format "%s*sources" name))))
1059                   (not (string-match "\\*sources$" (symbol-name name)))
1060                   (null (get-char-attribute
1061                          char (intern (format "%s*note" name))))
1062                   (not (string-match "\\*note$" (symbol-name name)))
1063                   (or (eq name '<-identical)
1064                       (eq name '<-uppercase)
1065                       (eq name '<-lowercase)
1066                       (eq name '<-titlecase)
1067                       (eq name '<-canonical)
1068                       (eq name '<-ideographic-variants)
1069                       ;; (eq name '<-synonyms)
1070                       (string-match "^<-synonyms" (symbol-name name))
1071                       (eq name '<-mistakable)
1072                       (when (string-match "^->" (symbol-name name))
1073                         (cond
1074                          ((string-match "^->fullwidth" (symbol-name name))
1075                           (not (and (consp value)
1076                                     (characterp (car value))
1077                                     (encode-char
1078                                      (car value) '=ucs 'defined-only)))
1079                           )
1080                          (t)))
1081                       ))
1082                  )
1083                 ((or (eq name 'ideographic-structure)
1084                      (eq name 'ideographic-combination)
1085                      (eq name 'ideographic-)
1086                      (eq name '=decomposition)
1087                      (string-match "^=>decomposition" (symbol-name name))
1088                      (string-match "^\\(->\\|<-\\)[^*]*$" (symbol-name name))
1089                      (string-match "^\\(->\\|<-\\)[^*]*\\*sources$"
1090                                    (symbol-name name))
1091                      )
1092                  (char-db-insert-relation-feature char name value
1093                                                   line-breaking
1094                                                   ccss readable))
1095                 ((memq name '(ideograph=
1096                               original-ideograph-of
1097                               ancient-ideograph-of
1098                               vulgar-ideograph-of
1099                               wrong-ideograph-of
1100                               ;; simplified-ideograph-of
1101                               ideographic-variants
1102                               ;; ideographic-different-form-of
1103                               ))
1104                  (insert (format "(%-18s%s " name line-breaking))
1105                  (setq lbs (concat "\n" (make-string (current-column) ?\ ))
1106                        separator nil)
1107                  (while (consp value)
1108                    (setq cell (car value))
1109                    (if (and (consp cell)
1110                             (consp (car cell)))
1111                        (progn
1112                          (if separator
1113                              (insert lbs))
1114                          (char-db-insert-alist cell readable)
1115                          (setq separator lbs))
1116                      (if separator
1117                          (insert separator))
1118                      (insert (prin1-to-string cell))
1119                      (setq separator " "))
1120                    (setq value (cdr value)))
1121                  (insert ")")
1122                  (insert line-breaking))
1123                 ((consp value)
1124                  (insert (format "(%-18s " name))
1125                  (setq lbs (concat "\n" (make-string (current-column) ?\ ))
1126                        separator nil)
1127                  (while (consp value)
1128                    (setq cell (car value))
1129                    (if (and (consp cell)
1130                             (consp (car cell))
1131                             (setq ret (condition-case nil
1132                                           (find-char cell)
1133                                         (error nil))))
1134                        (progn
1135                          (setq rest cell
1136                                al nil
1137                                cal nil)
1138                          (while rest
1139                            (setq key (car (car rest)))
1140                            (if (find-charset key)
1141                                (setq cal (cons key cal))
1142                              (setq al (cons key al)))
1143                            (setq rest (cdr rest)))
1144                          (if separator
1145                              (insert lbs))
1146                          (insert-char-attributes ret
1147                                                  readable
1148                                                  al cal)
1149                          (setq separator lbs))
1150                      (setq ret (prin1-to-string cell))
1151                      (if separator
1152                          (if (< (+ (current-column)
1153                                    (length ret)
1154                                    (length separator))
1155                                 76)
1156                              (insert separator)
1157                            (insert lbs)))
1158                      (insert ret)
1159                      (setq separator " "))
1160                    (setq value (cdr value)))
1161                  (insert ")")
1162                  (insert line-breaking))
1163                 (t
1164                  (insert (format "(%-18s" name))
1165                  (setq ret (prin1-to-string value))
1166                  (unless (< (+ (current-column)
1167                                (length ret)
1168                                3)
1169                             76)
1170                    (insert line-breaking))
1171                  (insert " . " ret ")" line-breaking)
1172                  ;; (insert (format "(%-18s . %S)%s"
1173                  ;;                 name value
1174                  ;;                 line-breaking))
1175                  )
1176                 ))
1177       (setq attributes (cdr attributes)))
1178     (insert ")")))
1179
1180 (defun insert-char-data (char &optional readable
1181                               attributes)
1182   (save-restriction
1183     (narrow-to-region (point)(point))
1184     (insert "(define-char
1185   '")
1186     (insert-char-attributes char readable attributes)
1187     (insert ")\n")
1188     (goto-char (point-min))
1189     (while (re-search-forward "[ \t]+$" nil t)
1190       (replace-match ""))
1191     ;; from tabify.
1192     (goto-char (point-min))
1193     (while (re-search-forward "[ \t][ \t][ \t]*" nil t)
1194       (let ((column (current-column))
1195             (indent-tabs-mode t))
1196         (delete-region (match-beginning 0) (point))
1197         (indent-to column)))
1198     (goto-char (point-max))
1199     ;; (tabify (point-min)(point-max))
1200     ))
1201
1202 (defun insert-char-data-with-variant (char &optional printable
1203                                            no-ucs-unified
1204                                            script excluded-script)
1205   (insert-char-data char printable)
1206   (let ((variants (char-variants char))
1207         rest
1208         variant vs ret)
1209     (setq variants (sort variants #'<))
1210     (setq rest variants)
1211     (setq variants (cons char variants))
1212     (while rest
1213       (setq variant (car rest))
1214       (unless (get-char-attribute variant '<-subsumptive)
1215         (if (and (or (null script)
1216                      (null (setq vs (get-char-attribute variant 'script)))
1217                      (memq script vs))
1218                  (or (null excluded-script)
1219                      (null (setq vs (get-char-attribute variant 'script)))
1220                      (not (memq excluded-script vs))))
1221             (unless (and no-ucs-unified (get-char-attribute variant '=ucs))
1222               (insert-char-data variant printable)
1223               (if (setq ret (char-variants variant))
1224                   (while ret
1225                     (or (memq (car ret) variants)
1226                         ;; (get-char-attribute (car ret) '<-subsumptive)
1227                         (setq rest (nconc rest (list (car ret)))))
1228                     (setq ret (cdr ret)))))))
1229       (setq rest (cdr rest)))))
1230
1231 (defun insert-char-range-data (min max &optional script excluded-script)
1232   (let ((code min)
1233         char)
1234     (while (<= code max)
1235       (setq char (decode-char '=ucs code))
1236       (if (encode-char char '=ucs 'defined-only)
1237           (insert-char-data-with-variant char nil 'no-ucs-unified
1238                                          script excluded-script))
1239       (setq code (1+ code)))))
1240
1241 (defun write-char-range-data-to-file (min max file
1242                                           &optional script excluded-script)
1243   (let ((coding-system-for-write char-db-file-coding-system))
1244     (with-temp-buffer
1245       (insert (format ";; -*- coding: %s -*-\n"
1246                       char-db-file-coding-system))
1247       (insert-char-range-data min max script excluded-script)
1248       (write-region (point-min)(point-max) file))))
1249
1250 (defvar what-character-original-window-configuration)
1251
1252 ;;;###autoload
1253 (defun what-char-definition (char)
1254   (interactive (list (char-after)))
1255   (let ((buf (get-buffer-create "*Character Description*"))
1256         (the-buf (current-buffer))
1257         (win-conf (current-window-configuration)))
1258     (pop-to-buffer buf)
1259     (make-local-variable 'what-character-original-window-configuration)
1260     (setq what-character-original-window-configuration win-conf)
1261     (setq buffer-read-only nil)
1262     (erase-buffer)
1263     (condition-case err
1264         (progn
1265           (insert-char-data-with-variant char 'printable)
1266           (unless (char-attribute-alist char)
1267             (insert (format ";; = %c\n"
1268                             (let* ((rest (split-char char))
1269                                    (ccs (pop rest))
1270                                    (code (pop rest)))
1271                               (while rest
1272                                 (setq code (logior (lsh code 8)
1273                                                    (pop rest))))
1274                               (decode-char ccs code)))))
1275           ;; (char-db-update-comment)
1276           (set-buffer-modified-p nil)
1277           (view-mode the-buf (lambda (buf)
1278                                (set-window-configuration
1279                                 what-character-original-window-configuration)
1280                                ))
1281           (goto-char (point-min)))
1282       (error (progn
1283                (set-window-configuration
1284                 what-character-original-window-configuration)
1285                (signal (car err) (cdr err)))))))
1286
1287
1288 ;;; @ end
1289 ;;;
1290
1291 (provide 'char-db-util)
1292
1293 ;;; char-db-util.el ends here