eb02062b526913b54436929e47616fec235de49b
[chise/ids.git] / install-ids.el
1 ;;; install-ids.el --- installer of IDS files.
2
3 ;;; Code:
4
5 (setq load-ids-simplify nil)
6
7 (defun install-ids-read-file (file simplify soft)
8   (princ "Loading ")
9   (princ file)
10   (princ "...")
11   (ids-read-file file simplify soft)
12   (princ "done.\n"))
13
14
15 ;; (mount-char-attribute-table 'ideographic-products)
16 ;; (map-char-attribute
17 ;;  (lambda (c v)
18 ;;    (remove-char-attribute c 'ideographic-products)
19 ;;    nil)
20 ;;  'ideographic-products)
21
22
23 (install-ids-read-file "IDS-JIS-X0208-1990.txt" load-ids-simplify t)
24
25 (install-ids-read-file "IDS-UCS-Basic.txt" load-ids-simplify t)
26
27 (install-ids-read-file "IDS-UCS-Ext-A.txt" load-ids-simplify t)
28
29 (let ((i 1))
30   (while (<= i 6)
31     (install-ids-read-file (format "IDS-UCS-Ext-B-%d.txt" i)
32                            load-ids-simplify t)
33     (setq i (1+ i))))
34
35 (install-ids-read-file "IDS-UCS-Ext-C.txt" load-ids-simplify t)
36
37 (install-ids-read-file "IDS-UCS-Ext-D.txt" load-ids-simplify t)
38
39 (install-ids-read-file "IDS-UCS-Ext-E.txt" load-ids-simplify t)
40
41 (install-ids-read-file "IDS-UCS-Ext-F.txt" load-ids-simplify t)
42
43 (install-ids-read-file "IDS-UCS-Ext-G.txt" load-ids-simplify t)
44
45 (install-ids-read-file "IDS-UCS-Compat.txt" load-ids-simplify t)
46
47 (let ((i 1))
48   (while (<= i 3)
49     (install-ids-read-file (format "IDS-CNS-%d.txt" i)
50                            load-ids-simplify t)
51     (setq i (1+ i))))
52
53 (let ((i 1))
54   (while (<= i 12)
55     (install-ids-read-file (format "IDS-Daikanwa-%02d.txt" i)
56                            load-ids-simplify t)
57     (setq i (1+ i))))
58
59 (install-ids-read-file "IDS-Daikanwa-dx.txt" load-ids-simplify t)
60
61 (install-ids-read-file "IDS-Daikanwa-ho.txt" load-ids-simplify t)
62
63 (install-ids-read-file "IDS-CBETA.txt" load-ids-simplify t)
64
65 (install-ids-read-file "IDS-CDP.txt" load-ids-simplify t)
66 ;; (let ((i 1))
67 ;;   (while (<= i 12)
68 ;;     (install-ids-read-file (format "IDS-HZK%02d.txt" i)
69 ;;                            load-ids-simplify t)
70 ;;     (setq i (1+ i))))
71
72 (princ "Generating apparent-structure...")
73 (let* ((feature-dir
74         (expand-file-name
75          "feature"
76          (expand-file-name
77           "character" chise-system-db-directory)))
78        (p-file
79         (expand-file-name "ideographic-products" feature-dir))
80        old-p-file
81        a-str)
82   (when (file-exists-p p-file)
83     (setq old-p-file (make-temp-name p-file))
84     (rename-file p-file old-p-file))
85   (ids-update-index 'in-memory)
86
87   (map-char-attribute
88    (lambda (c v)
89      (unless (setq a-str (get-char-attribute c 'ideographic-structure@apparent))
90        (when (setq a-str (functional-ideographic-structure-to-apparent-structure v))
91          (put-char-attribute c 'ideographic-structure@apparent
92                              (ideographic-structure-compact a-str))))
93      nil)
94    'ideographic-structure)
95   (princ "done.\n")
96
97   (princ "Updating char-feature `ideographic-structure'...")
98   (save-char-attribute-table 'ideographic-structure)
99   (save-char-attribute-table 'ideographic-structure@apparent)
100   (princ "done.\n")
101
102   (princ "Updating char-feature `ideographic-products'...")
103   (ids-update-index)
104   (when old-p-file
105     (delete-file old-p-file)))
106 (princ "done.\n")
107
108 ;;; install-ids.el ends hear