(M-13739): Unify GT-17371 and GT-K2303.
[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 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     =ucs@iso
160     =ucs@unicode
161     =>>ucs@unicode
162     =>>gt
163     =>>jis-x0208
164     =>>jis-x0213-1
165     =>>jis-x0213-1@2000
166     =>>jis-x0213-1@2004
167     =>>jis-x0213-2
168     =>>jis-x0208@1978
169     =>>big5-cdp
170     =>>gt-k
171     =>jis-x0208
172     =>jis-x0208@1997
173     =>jis-x0213-1
174     =>jis-x0213-1@2000
175     =>jis-x0213-1@2004
176     =>jis-x0213-2
177     =>gt
178     =>big5-cdp
179     =big5
180     =big5-eten
181     =zinbun-oracle
182     =>zinbun-oracle
183     =ruimoku-v6
184     =jef-china3
185     =shinjigen))
186
187
188 ;;; @ char-db formatters
189 ;;;
190
191 (defun char-db-make-char-spec (char)
192   (let (ret char-spec)
193     (cond ((characterp char)
194            (cond ((and (setq ret (encode-char char '=ucs 'defined-only))
195                        (not (and (<= #xE000 ret)(<= ret #xF8FF))))
196                   (setq char-spec (list (cons '=ucs ret)))
197                   (cond ((setq ret (get-char-attribute char 'name))
198                          (setq char-spec (cons (cons 'name ret) char-spec))
199                          )
200                         ((setq ret (get-char-attribute char 'name*))
201                          (setq char-spec (cons (cons 'name* ret) char-spec))
202                          ))
203                   )
204                  ((setq ret
205                         (catch 'tag
206                           (let ((rest char-db-coded-charset-priority-list)
207                                 ccs)
208                             (while rest
209                               (setq ccs (charset-name
210                                          (find-charset (car rest))))
211                               (if (setq ret
212                                         (encode-char char ccs
213                                                      'defined-only))
214                                   (throw 'tag (cons ccs ret)))
215                               (setq rest (cdr rest))))))
216                   (setq char-spec (list ret))
217                   (dolist (ccs (delq (car ret) (charset-list)))
218                     (if (and (or (charset-iso-final-char ccs)
219                                  (memq ccs
220                                        '(=daikanwa
221                                          =daikanwa@rev2
222                                          ;; =gt-k
223                                          =jis-x0208@1997
224                                          ))
225                                  (string-match "=ucs@" (symbol-name ccs)))
226                              (setq ccs (charset-name ccs))
227                              (null (assq ccs char-spec))
228                              (setq ret (encode-char char ccs 'defined-only)))
229                         (setq char-spec (cons (cons ccs ret) char-spec))))
230                   (if (null char-spec)
231                       (setq char-spec (split-char char)))
232                   (cond ((setq ret (get-char-attribute char 'name))
233                          (setq char-spec (cons (cons 'name ret) char-spec))
234                          )
235                         ((setq ret (get-char-attribute char 'name*))
236                          (setq char-spec (cons (cons 'name* ret) char-spec))
237                          ))
238                   )
239                  ((setq ret (get-char-attribute
240                              char 'ideographic-combination))
241                   (setq char-spec
242                         (cons (cons 'ideographic-combination ret)
243                               char-spec))
244                   ))
245            char-spec)
246           ((consp char)
247            char))))
248     
249 (defun char-db-insert-char-spec (char &optional readable column
250                                       required-features)
251   (unless column
252     (setq column (current-column)))
253   (let (char-spec temp-char)
254     (setq char-spec (char-db-make-char-spec char))
255     (unless (or (characterp char) ; char
256                 (condition-case nil
257                     (setq char (find-char char-spec))
258                   (error nil)))
259       ;; define temporary character
260       ;;   Current implementation is dirty.
261       (setq temp-char (define-char (cons '(ideograph-daikanwa . 0)
262                                          char-spec)))
263       (remove-char-attribute temp-char 'ideograph-daikanwa)
264       (setq char temp-char))
265     (insert-char-attributes char
266                             readable
267                             (union (mapcar #'car char-spec)
268                                    required-features))
269     (when temp-char
270       ;; undefine temporary character
271       ;;   Current implementation is dirty.
272       (setq char-spec (char-attribute-alist temp-char))
273       (while char-spec
274         (remove-char-attribute temp-char (car (car char-spec)))
275         (setq char-spec (cdr char-spec))))))
276
277 (defun char-db-insert-alist (alist &optional readable column)
278   (unless column
279     (setq column (current-column)))
280   (let ((line-breaking
281          (concat "\n" (make-string (1+ column) ?\ )))
282         name value
283         ret al ; cal
284         key
285         lbs cell rest separator)
286     (insert "(")
287     (while alist
288       (setq name (car (car alist))
289             value (cdr (car alist)))
290       (cond ((eq name 'char)
291              (insert "(char . ")
292              (if (setq ret (condition-case nil
293                                (find-char value)
294                              (error nil)))
295                  (progn
296                    (setq al nil
297                          ;; cal nil
298                          )
299                    (while value
300                      (setq key (car (car value)))
301                      ;; (if (find-charset key)
302                      ;;     (setq cal (cons key cal))
303                      (setq al (cons key al))
304                      ;; )
305                      (setq value (cdr value)))
306                    (insert-char-attributes ret
307                                            readable
308                                            (or al 'none) ; cal
309                                            ))
310                (insert (prin1-to-string value)))
311              (insert ")")
312              (insert line-breaking))
313             ((consp value)
314              (insert (format "(%-18s " name))
315              (setq lbs (concat "\n" (make-string (current-column) ?\ )))
316              (while (consp value)
317                (setq cell (car value))
318                (if (and (consp cell)
319                         (consp (car cell))
320                         (setq ret (condition-case nil
321                                       (find-char cell)
322                                     (error nil)))
323                         )
324                    (progn
325                      (setq rest cell
326                            al nil
327                            ;; cal nil
328                            )
329                      (while rest
330                        (setq key (car (car rest)))
331                        ;; (if (find-charset key)
332                        ;;     (setq cal (cons key cal))
333                        (setq al (cons key al))
334                        ;; )
335                        (setq rest (cdr rest)))
336                      (if separator
337                          (insert lbs))
338                      (insert-char-attributes ret
339                                              readable
340                                              al ; cal
341                                              )
342                      (setq separator lbs))
343                  (if separator
344                      (insert separator))
345                  (insert (prin1-to-string cell))
346                  (setq separator " "))
347                (setq value (cdr value)))
348              (insert ")")
349              (insert line-breaking))
350             (t
351              (insert (format "(%-18s . %S)%s"
352                              name value
353                              line-breaking))))
354       (setq alist (cdr alist))))
355   (insert ")"))
356
357 (defun char-db-insert-char-reference (plist &optional readable column)
358   (unless column
359     (setq column (current-column)))
360   (let ((line-breaking
361          (concat "\n" (make-string (1+ column) ?\ )))
362         (separator "")
363         name value)
364     (insert "(")
365     (while plist
366       (setq name (pop plist))
367       (setq value (pop plist))
368       (cond ((eq name :char)
369              (insert separator)
370              (insert ":char\t")
371              (cond ((numberp value)
372                     (setq value (decode-char '=ucs value)))
373                    ;; ((consp value)
374                    ;;  (setq value (or (find-char value)
375                    ;;                  value)))
376                    )
377              (char-db-insert-char-spec value readable)
378              (insert line-breaking)
379              (setq separator ""))
380             ((eq name :radical)
381              (insert (format "%s%s\t%d ; %c%s"
382                              separator
383                              name value
384                              (ideographic-radical value)
385                              line-breaking))
386              (setq separator ""))
387             (t
388              (insert (format "%s%s\t%S" separator name value))
389              (setq separator line-breaking)))
390       ))
391   (insert ")"))
392
393 (defun char-db-decode-isolated-char (ccs code-point)
394   (let (ret)
395     (setq ret
396           (cond ((eq ccs 'arabic-iso8859-6)
397                  (decode-char ccs code-point))
398                 ((and (memq ccs '(=gt-pj-1
399                                   =gt-pj-2
400                                   =gt-pj-3
401                                   =gt-pj-4
402                                   =gt-pj-5
403                                   =gt-pj-6
404                                   =gt-pj-7
405                                   =gt-pj-8
406                                   =gt-pj-9
407                                   =gt-pj-10
408                                   =gt-pj-11))
409                       (setq ret (decode-char ccs code-point))
410                       (setq ret (encode-char ret '=gt 'defined-only)))
411                  (decode-builtin-char '=gt ret))
412                 (t
413                  (decode-builtin-char ccs code-point))))
414     (cond ((and (<= 0 (char-int ret))
415                 (<= (char-int ret) #x1F))
416            (decode-char '=ucs (+ #x2400 (char-int ret))))
417           ((= (char-int ret) #x7F)
418            ?\u2421)
419           (t ret))))
420
421 (defvar char-db-convert-obsolete-format t)
422
423 (defun char-db-insert-ccs-feature (name value line-breaking)
424   (insert
425    (format
426     (cond ((memq name '(=shinjigen
427                         =shinjigen@1ed
428                         =shinjigen@rev =shinjigen/+p@rev))
429            "(%-18s .  %04d)\t; %c")
430           ((eq name '=shinjigen@1ed/24pr)
431            "(%-18s . %04d)\t; %c")
432           ((or (memq name '(=daikanwa
433                             =daikanwa@rev1 =daikanwa@rev2
434                             =gt =>>gt =>gt =gt-k =>>gt-k =cbeta
435                             =zinbun-oracle =>zinbun-oracle))
436                (string-match "^=adobe-" (symbol-name name)))
437            "(%-18s . %05d)\t; %c")
438           ((eq name 'mojikyo)
439            "(%-18s . %06d)\t; %c")
440           ((>= (charset-dimension name) 2)
441            "(%-18s . #x%04X)\t; %c")
442           (t
443            "(%-18s . #x%02X)\t; %c"))
444     name
445     (if (= (charset-iso-graphic-plane name) 1)
446         (logior value
447                 (cond ((= (charset-dimension name) 1)
448                        #x80)
449                       ((= (charset-dimension name) 2)
450                        #x8080)
451                       ((= (charset-dimension name) 3)
452                        #x808080)
453                       (t 0)))
454       value)
455     (char-db-decode-isolated-char name value)))
456   (if (and (= (charset-chars name) 94)
457            (= (charset-dimension name) 2))
458       (insert (format " [%02d-%02d]"
459                       (- (lsh value -8) 32)
460                       (- (logand value 255) 32))))
461   (insert line-breaking))
462
463 (defun char-db-insert-relation-feature (char name value line-breaking
464                                              ccss readable)
465   (insert (format "(%-18s%s " name line-breaking))
466   (let ((lbs (concat "\n" (make-string (current-column) ?\ )))
467         separator cell sources required-features
468         ret)
469     (while (consp value)
470       (setq cell (car value))
471       (if (integerp cell)
472           (setq cell (decode-char '=ucs cell)))
473       (cond
474        ((eq name '->subsumptive)
475         (when (or (not (some (lambda (atr)
476                                (get-char-attribute cell atr))
477                              char-db-ignored-attributes))
478                   (some (lambda (ccs)
479                           (encode-char cell ccs 'defined-only))
480                         ccss))
481           (if separator
482               (insert lbs))
483           (let ((char-db-ignored-attributes
484                  (cons '<-subsumptive
485                        char-db-ignored-attributes)))
486             (insert-char-attributes cell readable))
487           (setq separator lbs))
488         )
489        ((characterp cell)
490         (setq sources
491               (get-char-attribute
492                char (intern (format "%s*sources" name))))
493         (setq required-features nil)
494         (dolist (source sources)
495           (cond
496            ((memq source '(JP
497                            JP/Jouyou
498                            shinjigen shinjigen@1ed shinjigen@rev))
499             (setq required-features
500                   (union required-features
501                          '(=jis-x0208
502                            =jis-x0208@1990
503                            =jis-x0213-1-2000
504                            =jis-x0213-2-2000
505                            =jis-x0212
506                            =jis-x0208@1983
507                            =jis-x0208@1978
508                            =shinjigen))))
509            ((eq source 'CN)
510             (setq required-features
511                   (union required-features
512                          '(=gb2312
513                            =gb12345
514                            =iso-ir165)))))
515           (cond
516            ((find-charset (setq ret (intern (format "=%s" source))))
517             (setq required-features
518                   (cons ret required-features)))
519            (t (setq required-features
520                     (cons source required-features)))))
521         (cond ((string-match "@JP" (symbol-name name))
522                (setq required-features
523                      (union required-features
524                             '(=jis-x0208
525                               =jis-x0208@1990
526                               =jis-x0213-1-2000
527                               =jis-x0213-2-2000
528                               =jis-x0212
529                               =jis-x0208@1983
530                               =jis-x0208@1978))))
531               ((string-match "@CN" (symbol-name name))
532                (setq required-features
533                      (union required-features
534                             '(=gb2312
535                               =gb12345
536                               =iso-ir165)))))
537         (if separator
538             (insert lbs))
539         (if readable
540             (insert (format "%S" cell))
541           (char-db-insert-char-spec cell readable
542                                     nil
543                                     required-features))
544         (setq separator lbs))
545        ((consp cell)
546         (if separator
547             (insert lbs))
548         (if (consp (car cell))
549             (char-db-insert-char-spec cell readable)
550           (char-db-insert-char-reference cell readable))
551         (setq separator lbs))
552        (t
553         (if separator
554             (insert separator))
555         (insert (prin1-to-string cell))
556         (setq separator " ")))
557       (setq value (cdr value)))
558     (insert ")")
559     (insert line-breaking)))
560
561 (defun insert-char-attributes (char &optional readable attributes column)
562   (unless column
563     (setq column (current-column)))
564   (let (name value ; has-long-ccs-name
565         rest
566         radical strokes
567         (line-breaking
568          (concat "\n" (make-string (1+ column) ?\ )))
569         lbs cell separator ret
570         key al cal
571         dest-ccss ; sources required-features
572         ccss)
573     (let (atr-d)
574       (setq attributes
575             (sort (if attributes
576                       (if (consp attributes)
577                           (progn
578                             (dolist (name attributes)
579                               (unless (memq name char-db-ignored-attributes)
580                                 (if (find-charset name)
581                                     (push name ccss))
582                                 (push name atr-d)))
583                             atr-d))
584                     (dolist (name (char-attribute-list))
585                       (unless (memq name char-db-ignored-attributes)
586                         (if (find-charset name)
587                             (push name ccss))
588                         (push name atr-d)))
589                     atr-d)
590                   #'char-attribute-name<)))
591     (insert "(")
592     (when (memq '<-subsumptive attributes)
593       (when readable
594         (when (setq value (get-char-attribute char '<-subsumptive))
595           (char-db-insert-relation-feature char '<-subsumptive value
596                                            line-breaking
597                                            ccss readable)))
598       (setq attributes (delq '<-subsumptive attributes)))
599     (when (and (memq '<-denotational attributes)
600                (setq value (get-char-attribute char '<-denotational)))
601       (char-db-insert-relation-feature char '<-denotational value
602                                        line-breaking
603                                        ccss readable)
604       (setq attributes (delq '<-denotational attributes)))
605     (when (and (memq 'name attributes)
606                (setq value (get-char-attribute char 'name)))
607       (insert (format
608                (if (> (+ (current-column) (length value)) 48)
609                    "(name . %S)%s"
610                  "(name               . %S)%s")
611                value line-breaking))
612       (setq attributes (delq 'name attributes))
613       )
614     (when (and (memq 'name* attributes)
615                (setq value (get-char-attribute char 'name*)))
616       (insert (format
617                (if (> (+ (current-column) (length value)) 48)
618                    "(name* . %S)%s"
619                  "(name*              . %S)%s")
620                value line-breaking))
621       (setq attributes (delq 'name* attributes))
622       )
623     (when (and (memq 'script attributes)
624                (setq value (get-char-attribute char 'script)))
625       (insert (format "(script\t\t%s)%s"
626                       (mapconcat (function prin1-to-string)
627                                  value " ")
628                       line-breaking))
629       (setq attributes (delq 'script attributes))
630       )
631     (dolist (name '(=>ucs =>ucs*))
632       (when (and (memq name attributes)
633                  (setq value (get-char-attribute char name)))
634         (insert (format "(%-18s . #x%04X)\t; %c%s"
635                         name value (decode-char '=ucs value)
636                         line-breaking))
637         (setq attributes (delq name attributes))))
638     (dolist (name '(=>ucs@gb =>ucs@cns =>ucs@jis =>ucs@ks =>ucs@big5))
639       (when (and (memq name attributes)
640                  (setq value (get-char-attribute char name)))
641         (insert (format "(%-18s . #x%04X)\t; %c%s"
642                         name value
643                         (decode-char (intern
644                                       (concat "="
645                                               (substring
646                                                (symbol-name name) 2)))
647                                      value)
648                         line-breaking))
649         (setq attributes (delq name attributes))
650         ))
651     (dolist (name '(=>daikanwa))
652       (when (and (memq name attributes)
653                  (setq value (get-char-attribute char name)))
654         (insert
655          (if (integerp value)
656              (format "(%-18s . %05d)\t; %c%s"
657                      name value (decode-char '=daikanwa value)
658                      line-breaking)
659            (format "(%-18s %s)\t; %c%s"
660                    name
661                    (mapconcat (function prin1-to-string)
662                               value " ")
663                    (char-representative-of-daikanwa char)
664                    line-breaking)))
665         (setq attributes (delq name attributes))))
666     (when (and (memq 'general-category attributes)
667                (setq value (get-char-attribute char 'general-category)))
668       (insert (format
669                "(general-category\t%s) ; %s%s"
670                (mapconcat (lambda (cell)
671                             (format "%S" cell))
672                           value " ")
673                (cond ((rassoc value unidata-normative-category-alist)
674                       "Normative Category")
675                      ((rassoc value unidata-informative-category-alist)
676                       "Informative Category")
677                      (t
678                       "Unknown Category"))
679                line-breaking))
680       (setq attributes (delq 'general-category attributes))
681       )
682     (when (and (memq 'bidi-category attributes)
683                (setq value (get-char-attribute char 'bidi-category)))
684       (insert (format "(bidi-category\t. %S)%s"
685                       value
686                       line-breaking))
687       (setq attributes (delq 'bidi-category attributes))
688       )
689     (unless (or (not (memq 'mirrored attributes))
690                 (eq (setq value (get-char-attribute char 'mirrored 'empty))
691                     'empty))
692       (insert (format "(mirrored\t\t. %S)%s"
693                       value
694                       line-breaking))
695       (setq attributes (delq 'mirrored attributes))
696       )
697     (cond
698      ((and (memq 'decimal-digit-value attributes)
699            (setq value (get-char-attribute char 'decimal-digit-value)))
700       (insert (format "(decimal-digit-value . %S)%s"
701                       value
702                       line-breaking))
703       (setq attributes (delq 'decimal-digit-value attributes))
704       (when (and (memq 'digit-value attributes)
705                  (setq value (get-char-attribute char 'digit-value)))
706         (insert (format "(digit-value\t . %S)%s"
707                         value
708                         line-breaking))
709         (setq attributes (delq 'digit-value attributes))
710         )
711       (when (and (memq 'numeric-value attributes)
712                  (setq value (get-char-attribute char 'numeric-value)))
713         (insert (format "(numeric-value\t . %S)%s"
714                         value
715                         line-breaking))
716         (setq attributes (delq 'numeric-value attributes))
717         )
718       )
719      (t
720       (when (and (memq 'digit-value attributes)
721                  (setq value (get-char-attribute char 'digit-value)))
722         (insert (format "(digit-value\t. %S)%s"
723                         value
724                         line-breaking))
725         (setq attributes (delq 'digit-value attributes))
726         )
727       (when (and (memq 'numeric-value attributes)
728                  (setq value (get-char-attribute char 'numeric-value)))
729         (insert (format "(numeric-value\t. %S)%s"
730                         value
731                         line-breaking))
732         (setq attributes (delq 'numeric-value attributes))
733         )))
734     (when (and (memq 'iso-10646-comment attributes)
735                (setq value (get-char-attribute char 'iso-10646-comment)))
736       (insert (format "(iso-10646-comment\t. %S)%s"
737                       value
738                       line-breaking))
739       (setq attributes (delq 'iso-10646-comment attributes))
740       )
741     (when (and (memq 'morohashi-daikanwa attributes)
742                (setq value (get-char-attribute char 'morohashi-daikanwa)))
743       (insert (format "(morohashi-daikanwa\t%s)%s"
744                       (mapconcat (function prin1-to-string) value " ")
745                       line-breaking))
746       (setq attributes (delq 'morohashi-daikanwa attributes))
747       )
748     (setq radical nil
749           strokes nil)
750     (when (and (memq 'ideographic-radical attributes)
751                (setq value (get-char-attribute char 'ideographic-radical)))
752       (setq radical value)
753       (insert (format "(ideographic-radical . %S)\t; %c%s"
754                       radical
755                       (ideographic-radical radical)
756                       line-breaking))
757       (setq attributes (delq 'ideographic-radical attributes))
758       )
759     (when (and (memq 'shuowen-radical attributes)
760                (setq value (get-char-attribute char 'shuowen-radical)))
761       (insert (format "(shuowen-radical\t. %S)\t; %c%s"
762                       value
763                       (shuowen-radical value)
764                       line-breaking))
765       (setq attributes (delq 'shuowen-radical attributes))
766       )
767     (let (key)
768       (dolist (domain
769                (append
770                 char-db-feature-domains
771                 (let (dest domain)
772                   (dolist (feature (char-attribute-list))
773                     (setq feature (symbol-name feature))
774                     (when (string-match
775                            "\\(radical\\|strokes\\)@\\([^@*]+\\)\\(\\*\\|$\\)"
776                            feature)
777                       (setq domain (intern (match-string 2 feature)))
778                      (unless (memq domain dest)
779                        (setq dest (cons domain dest)))))
780                   (sort dest #'string<))))
781         (setq key (intern (format "%s@%s" 'ideographic-radical domain)))
782         (when (and (memq key attributes)
783                    (setq value (get-char-attribute char key)))
784           (setq radical value)
785           (insert (format "(%s . %S)\t; %c%s"
786                           key
787                           radical
788                           (ideographic-radical radical)
789                           line-breaking))
790           (setq attributes (delq key attributes))
791           )
792         (setq key (intern (format "%s@%s" 'ideographic-strokes domain)))
793         (when (and (memq key attributes)
794                    (setq value (get-char-attribute char key)))
795           (setq strokes value)
796           (insert (format "(%s . %S)%s"
797                           key
798                           strokes
799                           line-breaking))
800           (setq attributes (delq key attributes))
801           )
802         (setq key (intern (format "%s@%s" 'total-strokes domain)))
803         (when (and (memq key attributes)
804                    (setq value (get-char-attribute char key)))
805           (insert (format "(%s       . %S)%s"
806                           key
807                           value
808                           line-breaking))
809           (setq attributes (delq key attributes))
810           )
811         (dolist (feature '(ideographic-radical
812                            ideographic-strokes
813                            total-strokes))
814           (setq key (intern (format "%s@%s*sources" feature domain)))
815           (when (and (memq key attributes)
816                      (setq value (get-char-attribute char key)))
817             (insert (format "(%s%s" key line-breaking))
818             (dolist (cell value)
819               (insert (format " %s" cell)))
820             (insert ")")
821             (insert line-breaking)
822             (setq attributes (delq key attributes))
823             ))
824         ))
825     (when (and (memq 'ideographic-strokes attributes)
826                (setq value (get-char-attribute char 'ideographic-strokes)))
827       (setq strokes value)
828       (insert (format "(ideographic-strokes . %S)%s"
829                       strokes
830                       line-breaking))
831       (setq attributes (delq 'ideographic-strokes attributes))
832       )
833     (when (and (memq 'kangxi-radical attributes)
834                (setq value (get-char-attribute char 'kangxi-radical)))
835       (unless (eq value radical)
836         (insert (format "(kangxi-radical\t . %S)\t; %c%s"
837                         value
838                         (ideographic-radical value)
839                         line-breaking))
840         (or radical
841             (setq radical value)))
842       (setq attributes (delq 'kangxi-radical attributes))
843       )
844     (when (and (memq 'kangxi-strokes attributes)
845                (setq value (get-char-attribute char 'kangxi-strokes)))
846       (unless (eq value strokes)
847         (insert (format "(kangxi-strokes\t . %S)%s"
848                         value
849                         line-breaking))
850         (or strokes
851             (setq strokes value)))
852       (setq attributes (delq 'kangxi-strokes attributes))
853       )
854     (when (and (memq 'japanese-radical attributes)
855                (setq value (get-char-attribute char 'japanese-radical)))
856       (unless (eq value radical)
857         (insert (format "(japanese-radical\t . %S)\t; %c%s"
858                         value
859                         (ideographic-radical value)
860                         line-breaking))
861         (or radical
862             (setq radical value)))
863       (setq attributes (delq 'japanese-radical attributes))
864       )
865     (when (and (memq 'japanese-strokes attributes)
866                (setq value (get-char-attribute char 'japanese-strokes)))
867       (unless (eq value strokes)
868         (insert (format "(japanese-strokes\t . %S)%s"
869                         value
870                         line-breaking))
871         (or strokes
872             (setq strokes value)))
873       (setq attributes (delq 'japanese-strokes attributes))
874       )
875     (when (and (memq 'cns-radical attributes)
876                (setq value (get-char-attribute char 'cns-radical)))
877       (insert (format "(cns-radical\t . %S)\t; %c%s"
878                       value
879                       (ideographic-radical value)
880                       line-breaking))
881       (setq attributes (delq 'cns-radical attributes))
882       )
883     (when (and (memq 'cns-strokes attributes)
884                (setq value (get-char-attribute char 'cns-strokes)))
885       (unless (eq value strokes)
886         (insert (format "(cns-strokes\t . %S)%s"
887                         value
888                         line-breaking))
889         (or strokes
890             (setq strokes value)))
891       (setq attributes (delq 'cns-strokes attributes))
892       )
893     (when (and (memq 'shinjigen-1-radical attributes)
894                (setq value (get-char-attribute char 'shinjigen-1-radical)))
895       (unless (eq value radical)
896         (insert (format "(shinjigen-1-radical . %S)\t; %c%s"
897                         value
898                         (ideographic-radical value)
899                         line-breaking))
900         (or radical
901             (setq radical value)))
902       (setq attributes (delq 'shinjigen-1-radical attributes))
903       )
904     (when (and (memq 'ideographic- attributes)
905                (setq value (get-char-attribute char 'ideographic-)))
906       (insert "(ideographic-       ")
907       (setq lbs (concat "\n" (make-string (current-column) ?\ ))
908             separator nil)
909       (while (consp value)
910         (setq cell (car value))
911         (if (integerp cell)
912             (setq cell (decode-char '=ucs cell)))
913         (cond ((characterp cell)
914                (if separator
915                    (insert lbs))
916                (if readable
917                    (insert (format "%S" cell))
918                  (char-db-insert-char-spec cell readable))
919                (setq separator lbs))
920               ((consp cell)
921                (if separator
922                    (insert lbs))
923                (if (consp (car cell))
924                    (char-db-insert-char-spec cell readable)
925                  (char-db-insert-char-reference cell readable))
926                (setq separator lbs))
927               (t
928                (if separator
929                    (insert separator))
930                (insert (prin1-to-string cell))
931                (setq separator " ")))
932         (setq value (cdr value)))
933       (insert ")")
934       (insert line-breaking)
935       (setq attributes (delq 'ideographic- attributes)))
936     (when (and (memq 'total-strokes attributes)
937                (setq value (get-char-attribute char 'total-strokes)))
938       (insert (format "(total-strokes       . %S)%s"
939                       value
940                       line-breaking))
941       (setq attributes (delq 'total-strokes attributes))
942       )
943     (when (and (memq '->ideograph attributes)
944                (setq value (get-char-attribute char '->ideograph)))
945       (insert (format "(->ideograph\t%s)%s"
946                       (mapconcat (lambda (code)
947                                    (cond ((symbolp code)
948                                           (symbol-name code))
949                                          ((integerp code)
950                                           (format "#x%04X" code))
951                                          (t
952                                           (format "%s %S"
953                                                   line-breaking code))))
954                                  value " ")
955                       line-breaking))
956       (setq attributes (delq '->ideograph attributes))
957       )
958     ;; (when (and (memq '->decomposition attributes)
959     ;;            (setq value (get-char-attribute char '->decomposition)))
960     ;;   (insert (format "(->decomposition\t%s)%s"
961     ;;                   (mapconcat (lambda (code)
962     ;;                                (cond ((symbolp code)
963     ;;                                       (symbol-name code))
964     ;;                                      ((characterp code)
965     ;;                                       (if readable
966     ;;                                           (format "%S" code)
967     ;;                                         (format "#x%04X"
968     ;;                                                 (char-int code))
969     ;;                                         ))
970     ;;                                      ((integerp code)
971     ;;                                       (format "#x%04X" code))
972     ;;                                      (t
973     ;;                                       (format "%s%S" line-breaking code))))
974     ;;                              value " ")
975     ;;                   line-breaking))
976     ;;   (setq attributes (delq '->decomposition attributes))
977     ;;   )
978     (if (equal (get-char-attribute char '->titlecase)
979                (get-char-attribute char '->uppercase))
980         (setq attributes (delq '->titlecase attributes)))
981     (when (and (memq '->mojikyo attributes)
982                (setq value (get-char-attribute char '->mojikyo)))
983       (insert (format "(->mojikyo\t\t. %06d)\t; %c%s"
984                       value (decode-char 'mojikyo value)
985                       line-breaking))
986       (setq attributes (delq '->mojikyo attributes))
987       )
988     (when (and (memq 'hanyu-dazidian-vol attributes)
989                (setq value (get-char-attribute char 'hanyu-dazidian-vol)))
990       (insert (format "(hanyu-dazidian-vol  . %d)%s"
991                       value line-breaking))
992       (setq attributes (delq 'hanyu-dazidian-vol attributes))
993       )
994     (when (and (memq 'hanyu-dazidian-page attributes)
995                (setq value (get-char-attribute char 'hanyu-dazidian-page)))
996       (insert (format "(hanyu-dazidian-page . %d)%s"
997                       value line-breaking))
998       (setq attributes (delq 'hanyu-dazidian-page attributes))
999       )
1000     (when (and (memq 'hanyu-dazidian-char attributes)
1001                (setq value (get-char-attribute char 'hanyu-dazidian-char)))
1002       (insert (format "(hanyu-dazidian-char . %d)%s"
1003                       value line-breaking))
1004       (setq attributes (delq 'hanyu-dazidian-char attributes))
1005       )
1006     (unless readable
1007       (dolist (ignored '(composition
1008                          ->denotational <-subsumptive ->ucs-unified
1009                          ->ideographic-component-forms))
1010         (setq attributes (delq ignored attributes))))
1011     (while attributes
1012       (setq name (car attributes))
1013       (if (setq value (get-char-attribute char name))
1014           (cond ((setq ret (find-charset name))
1015                  (setq name (charset-name ret))
1016                  (if (and (not (memq name dest-ccss))
1017                           (prog1
1018                               (setq value (get-char-attribute char name))
1019                             (setq dest-ccss (cons name dest-ccss))))
1020                      (char-db-insert-ccs-feature name value line-breaking))
1021                  )
1022                 ((string-match "^=>ucs@" (symbol-name name))
1023                  (insert (format "(%-18s . #x%04X)\t; %c%s"
1024                                  name value (decode-char '=ucs value)
1025                                  line-breaking))
1026                  )
1027                 ((eq name 'jisx0208-1978/4X)
1028                  (insert (format "(%-18s . #x%04X)%s"
1029                                  name value
1030                                  line-breaking))
1031                  )
1032                 ((and
1033                   (not readable)
1034                   (not (eq name '->subsumptive))
1035                   (not (eq name '->uppercase))
1036                   (not (eq name '->lowercase))
1037                   (not (eq name '->titlecase))
1038                   (not (eq name '->canonical))
1039                   (not (eq name '->Bopomofo))
1040                   (not (eq name '->mistakable))
1041                   (not (eq name '->ideographic-variants))
1042                   (null (get-char-attribute
1043                          char (intern (format "%s*sources" name))))
1044                   (not (string-match "\\*sources$" (symbol-name name)))
1045                   (null (get-char-attribute
1046                          char (intern (format "%s*note" name))))
1047                   (not (string-match "\\*note$" (symbol-name name)))
1048                   (or (eq name '<-identical)
1049                       (eq name '<-uppercase)
1050                       (eq name '<-lowercase)
1051                       (eq name '<-titlecase)
1052                       (eq name '<-canonical)
1053                       (eq name '<-ideographic-variants)
1054                       ;; (eq name '<-synonyms)
1055                       (string-match "^<-synonyms" (symbol-name name))
1056                       (eq name '<-mistakable)
1057                       (when (string-match "^->" (symbol-name name))
1058                         (cond
1059                          ((string-match "^->fullwidth" (symbol-name name))
1060                           (not (and (consp value)
1061                                     (characterp (car value))
1062                                     (encode-char
1063                                      (car value) '=ucs 'defined-only)))
1064                           )
1065                          (t)))
1066                       ))
1067                  )
1068                 ((or (eq name 'ideographic-structure)
1069                      (eq name 'ideographic-combination)
1070                      (eq name 'ideographic-)
1071                      (eq name '=decomposition)
1072                      (string-match "^=>decomposition" (symbol-name name))
1073                      (string-match "^\\(->\\|<-\\)[^*]*$" (symbol-name name))
1074                      (string-match "^\\(->\\|<-\\)[^*]*\\*sources$"
1075                                    (symbol-name name))
1076                      )
1077                  (char-db-insert-relation-feature char name value
1078                                                   line-breaking
1079                                                   ccss readable))
1080                 ((memq name '(ideograph=
1081                               original-ideograph-of
1082                               ancient-ideograph-of
1083                               vulgar-ideograph-of
1084                               wrong-ideograph-of
1085                               ;; simplified-ideograph-of
1086                               ideographic-variants
1087                               ;; ideographic-different-form-of
1088                               ))
1089                  (insert (format "(%-18s%s " name line-breaking))
1090                  (setq lbs (concat "\n" (make-string (current-column) ?\ ))
1091                        separator nil)
1092                  (while (consp value)
1093                    (setq cell (car value))
1094                    (if (and (consp cell)
1095                             (consp (car cell)))
1096                        (progn
1097                          (if separator
1098                              (insert lbs))
1099                          (char-db-insert-alist cell readable)
1100                          (setq separator lbs))
1101                      (if separator
1102                          (insert separator))
1103                      (insert (prin1-to-string cell))
1104                      (setq separator " "))
1105                    (setq value (cdr value)))
1106                  (insert ")")
1107                  (insert line-breaking))
1108                 ((consp value)
1109                  (insert (format "(%-18s " name))
1110                  (setq lbs (concat "\n" (make-string (current-column) ?\ ))
1111                        separator nil)
1112                  (while (consp value)
1113                    (setq cell (car value))
1114                    (if (and (consp cell)
1115                             (consp (car cell))
1116                             (setq ret (condition-case nil
1117                                           (find-char cell)
1118                                         (error nil))))
1119                        (progn
1120                          (setq rest cell
1121                                al nil
1122                                cal nil)
1123                          (while rest
1124                            (setq key (car (car rest)))
1125                            (if (find-charset key)
1126                                (setq cal (cons key cal))
1127                              (setq al (cons key al)))
1128                            (setq rest (cdr rest)))
1129                          (if separator
1130                              (insert lbs))
1131                          (insert-char-attributes ret
1132                                                  readable
1133                                                  al cal)
1134                          (setq separator lbs))
1135                      (setq ret (prin1-to-string cell))
1136                      (if separator
1137                          (if (< (+ (current-column)
1138                                    (length ret)
1139                                    (length separator))
1140                                 76)
1141                              (insert separator)
1142                            (insert lbs)))
1143                      (insert ret)
1144                      (setq separator " "))
1145                    (setq value (cdr value)))
1146                  (insert ")")
1147                  (insert line-breaking))
1148                 (t
1149                  (insert (format "(%-18s" name))
1150                  (setq ret (prin1-to-string value))
1151                  (unless (< (+ (current-column)
1152                                (length ret)
1153                                3)
1154                             76)
1155                    (insert line-breaking))
1156                  (insert " . " ret ")" line-breaking)
1157                  ;; (insert (format "(%-18s . %S)%s"
1158                  ;;                 name value
1159                  ;;                 line-breaking))
1160                  )
1161                 ))
1162       (setq attributes (cdr attributes)))
1163     (insert ")")))
1164
1165 (defun insert-char-data (char &optional readable
1166                               attributes)
1167   (save-restriction
1168     (narrow-to-region (point)(point))
1169     (insert "(define-char
1170   '")
1171     (insert-char-attributes char readable attributes)
1172     (insert ")\n")
1173     (goto-char (point-min))
1174     (while (re-search-forward "[ \t]+$" nil t)
1175       (replace-match ""))
1176     ;; from tabify.
1177     (goto-char (point-min))
1178     (while (re-search-forward "[ \t][ \t][ \t]*" nil t)
1179       (let ((column (current-column))
1180             (indent-tabs-mode t))
1181         (delete-region (match-beginning 0) (point))
1182         (indent-to column)))
1183     (goto-char (point-max))
1184     ;; (tabify (point-min)(point-max))
1185     ))
1186
1187 (defun insert-char-data-with-variant (char &optional printable
1188                                            no-ucs-unified
1189                                            script excluded-script)
1190   (insert-char-data char printable)
1191   (let ((variants (char-variants char))
1192         rest
1193         variant vs ret)
1194     (setq variants (sort variants #'<))
1195     (setq rest variants)
1196     (setq variants (cons char variants))
1197     (while rest
1198       (setq variant (car rest))
1199       (unless (get-char-attribute variant '<-subsumptive)
1200         (if (and (or (null script)
1201                      (null (setq vs (get-char-attribute variant 'script)))
1202                      (memq script vs))
1203                  (or (null excluded-script)
1204                      (null (setq vs (get-char-attribute variant 'script)))
1205                      (not (memq excluded-script vs))))
1206             (unless (and no-ucs-unified (get-char-attribute variant '=ucs))
1207               (insert-char-data variant printable)
1208               (if (setq ret (char-variants variant))
1209                   (while ret
1210                     (or (memq (car ret) variants)
1211                         ;; (get-char-attribute (car ret) '<-subsumptive)
1212                         (setq rest (nconc rest (list (car ret)))))
1213                     (setq ret (cdr ret)))))))
1214       (setq rest (cdr rest)))))
1215
1216 (defun insert-char-range-data (min max &optional script excluded-script)
1217   (let ((code min)
1218         char)
1219     (while (<= code max)
1220       (setq char (decode-char '=ucs code))
1221       (if (encode-char char '=ucs 'defined-only)
1222           (insert-char-data-with-variant char nil 'no-ucs-unified
1223                                          script excluded-script))
1224       (setq code (1+ code)))))
1225
1226 (defun write-char-range-data-to-file (min max file
1227                                           &optional script excluded-script)
1228   (let ((coding-system-for-write char-db-file-coding-system))
1229     (with-temp-buffer
1230       (insert (format ";; -*- coding: %s -*-\n"
1231                       char-db-file-coding-system))
1232       (insert-char-range-data min max script excluded-script)
1233       (write-region (point-min)(point-max) file))))
1234
1235 (defvar what-character-original-window-configuration)
1236
1237 ;;;###autoload
1238 (defun what-char-definition (char)
1239   (interactive (list (char-after)))
1240   (let ((buf (get-buffer-create "*Character Description*"))
1241         (the-buf (current-buffer))
1242         (win-conf (current-window-configuration)))
1243     (pop-to-buffer buf)
1244     (make-local-variable 'what-character-original-window-configuration)
1245     (setq what-character-original-window-configuration win-conf)
1246     (setq buffer-read-only nil)
1247     (erase-buffer)
1248     (condition-case err
1249         (progn
1250           (insert-char-data-with-variant char 'printable)
1251           (unless (char-attribute-alist char)
1252             (insert (format ";; = %c\n"
1253                             (let* ((rest (split-char char))
1254                                    (ccs (pop rest))
1255                                    (code (pop rest)))
1256                               (while rest
1257                                 (setq code (logior (lsh code 8)
1258                                                    (pop rest))))
1259                               (decode-char ccs code)))))
1260           ;; (char-db-update-comment)
1261           (set-buffer-modified-p nil)
1262           (view-mode the-buf (lambda (buf)
1263                                (set-window-configuration
1264                                 what-character-original-window-configuration)
1265                                ))
1266           (goto-char (point-min)))
1267       (error (progn
1268                (set-window-configuration
1269                 what-character-original-window-configuration)
1270                (signal (car err) (cdr err)))))))
1271
1272
1273 ;;; @ end
1274 ;;;
1275
1276 (provide 'char-db-util)
1277
1278 ;;; char-db-util.el ends here