-
Notifications
You must be signed in to change notification settings - Fork 1
/
cmap.lisp
40 lines (27 loc) · 805 Bytes
/
cmap.lisp
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
;;cmapdb.py
(in-package :cmap)
(define-condition cmap-error (error) ())
(defparameter *cmap-debug* 0)
(defclass cmap ()
((code2cid :initarg code2cid)))
(defmethod initialize-instance :after ((self cmap) &rest args)
(declare (ignorable args))
(with-slots (code2cid) self
(unless code2cid
(setf code2cid (make-hash-table)))))
(defmethod is-vertical ((self cmap))
nil)
(defmethod use-cmap ((self cmap) cmap)
(assert (typep cmap 'cmap))
(labels ((copy (src dst)
(loop for k being the hash-keys of src
using (hash-value v)
when (hash-table-p v)
do
(let ((d (make-hash-table)))
(setf (gethash k dst) d)
(copy d v))
else
do (setf (gethash k dst) v))))
(copy (slot-value self 'code2cid)
(slot-value cmap 'code2cid))))