forked from chise/ids
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-ids.el
159 lines (128 loc) · 4.67 KB
/
install-ids.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
;;; install-ids.el --- installer of IDS files.
;;; Code:
(setq load-ids-simplify nil)
(defun install-ids-read-file (file simplify soft)
(princ "Loading ")
(princ file)
(princ "...")
(ids-read-file file simplify soft)
(princ "done.\n"))
;; (mount-char-attribute-table 'ideographic-products)
;; (map-char-attribute
;; (lambda (c v)
;; (remove-char-attribute c 'ideographic-products)
;; nil)
;; 'ideographic-products)
(install-ids-read-file "IDS-JIS-X0208-1990.txt" load-ids-simplify t)
(install-ids-read-file "IDS-UCS-Basic.txt" load-ids-simplify t)
(install-ids-read-file "IDS-UCS-Ext-A.txt" load-ids-simplify t)
(let ((i 1))
(while (<= i 6)
(install-ids-read-file (format "IDS-UCS-Ext-B-%d.txt" i)
load-ids-simplify t)
(setq i (1+ i))))
(install-ids-read-file "IDS-UCS-Ext-C.txt" load-ids-simplify t)
(install-ids-read-file "IDS-UCS-Ext-D.txt" load-ids-simplify t)
(install-ids-read-file "IDS-UCS-Ext-E.txt" load-ids-simplify t)
(install-ids-read-file "IDS-UCS-Ext-F.txt" load-ids-simplify t)
(install-ids-read-file "IDS-UCS-Ext-G.txt" load-ids-simplify t)
(install-ids-read-file "IDS-UCS-Compat.txt" load-ids-simplify t)
(install-ids-read-file "IDS-UCS-Compat-Supplement.txt" load-ids-simplify t)
(let ((i 1))
(while (<= i 3)
(install-ids-read-file (format "IDS-CNS-%d.txt" i)
load-ids-simplify t)
(setq i (1+ i))))
(let ((i 1))
(while (<= i 12)
(install-ids-read-file (format "IDS-Daikanwa-%02d.txt" i)
load-ids-simplify t)
(setq i (1+ i))))
(install-ids-read-file "IDS-Daikanwa-dx.txt" load-ids-simplify t)
(install-ids-read-file "IDS-Daikanwa-ho.txt" load-ids-simplify t)
(install-ids-read-file "IDS-CBETA.txt" load-ids-simplify t)
(install-ids-read-file "IDS-CDP.txt" load-ids-simplify t)
;; (let ((i 1))
;; (while (<= i 12)
;; (install-ids-read-file (format "IDS-HZK%02d.txt" i)
;; load-ids-simplify t)
;; (setq i (1+ i))))
(install-ids-read-file "IDS-SW-JIGUGE.txt" load-ids-simplify t)
(princ "Generating apparent-structure...")
(let* ((terminal-coding-system 'utf-8-mcs-er)
(feature-dir
(expand-file-name
"feature"
(expand-file-name
"character" chise-system-db-directory)))
(p-file
(expand-file-name "ideographic-products" feature-dir))
old-p-file
a-str ret)
(when (file-exists-p p-file)
(setq old-p-file (make-temp-name p-file))
(rename-file p-file old-p-file))
(ids-update-index 'in-memory)
(map-char-attribute
(lambda (c v)
(unless (equal (setq ret (ideographic-structure-compact v)) v)
(princ (format "Compact %04X (%c) : %s -> %s\n"
(char-int c)
c
(ideographic-structure-to-ids v)
(ideographic-structure-to-ids ret)))
(put-char-attribute c 'ideographic-structure ret)
(setq v ret))
(unless (setq a-str (get-char-attribute c 'ideographic-structure@apparent))
(when (setq a-str (functional-ideographic-structure-to-apparent-structure v))
(put-char-attribute c 'ideographic-structure@apparent
(ideographic-structure-compact a-str))))
nil)
'ideographic-structure)
(map-char-attribute
(lambda (c v)
(unless (equal (setq ret (ideographic-structure-compact v)) v)
(princ (format "Compact %04X (%c) : [apparent] %s -> %s\n"
(char-int c)
c
(ideographic-structure-to-ids v)
(ideographic-structure-to-ids ret)))
(put-char-attribute c 'ideographic-structure@apparent ret)
(setq v ret))
nil)
'ideographic-structure@apparent)
(map-char-attribute
(lambda (c v)
(unless (equal (setq ret (ideographic-structure-compact v)) v)
(princ (format "Compact %04X (%c) : %s -> %s\n"
(char-int c)
c
(ideographic-structure-to-ids v)
(ideographic-structure-to-ids ret)))
(put-char-attribute c 'ideographic-structure ret)
(setq v ret))
nil)
'ideographic-structure)
(map-char-attribute
(lambda (c v)
(unless (equal (setq ret (ideographic-structure-compact v)) v)
(princ (format "Compact %04X (%c) : [apparent] %s -> %s\n"
(char-int c)
c
(ideographic-structure-to-ids v)
(ideographic-structure-to-ids ret)))
(put-char-attribute c 'ideographic-structure@apparent ret)
(setq v ret))
nil)
'ideographic-structure@apparent)
(princ "done.\n")
(princ "Updating char-feature `ideographic-structure'...")
(save-char-attribute-table 'ideographic-structure)
(save-char-attribute-table 'ideographic-structure@apparent)
(princ "done.\n")
(princ "Updating char-feature `ideographic-products'...")
(ids-update-index)
(when old-p-file
(delete-file old-p-file)))
(princ "done.\n")
;;; install-ids.el ends hear