1 (defun concord-object-p (object)
2 (eq (aref object 0) :concord))
4 (defun concord-object-type (object)
5 (and (concord-object-p object)
8 (defun concord-object-id (object)
9 (and (concord-object-p object)
12 (defun concord-define-object (type spec &optional id)
13 (concord-el-define-object type spec id))
15 (defun concord-object-get-value (object feature)
16 (concord-el-object-get-value object feature))
18 (defun concord-object-spec (object)
19 (concord-el-object-spec object))
21 (defun concord-feature-list (type)
22 (concord-el-feature-list type))
24 (defun concord-map-objects (function type)
25 (concord-el-map-objects function type))
27 (defun concord-map-feature (function feature type)
28 (concord-el-map-feature function feature type))
31 (defvar concord-el-type-list-table
34 (defun concord-el-get-type-table (type)
35 (gethash type concord-el-type-list-table))
37 (defun concord-el-get-type-table-create (type)
38 (let ((type-table (gethash type concord-el-type-list-table)))
40 (setq type-table (make-hash-table))
41 (puthash type type-table concord-el-type-list-table))
44 (defun concord-el-type-table-get-feature-table (type-table feature)
45 (gethash feature type-table))
47 (defun concord-el-type-table-get-feature-table-create (type-table feature)
48 (let ((feature-table (gethash feature type-table)))
50 (setq feature-table (make-hash-table))
51 (puthash feature feature-table type-table))
55 (defun concord-el-type-table-get-object-feature (type-table object-id feature)
57 (concord-el-type-table-get-feature-table type-table feature)))
59 (gethash object-id feature-table))))
61 (defun concord-el-type-table-put-object-feature (type-table object-id
64 (concord-el-type-table-get-feature-table-create type-table feature)))
66 ((eq '->subsumptive feature)
68 (concord-el-type-table-put-object type-table spec))))
69 (puthash object-id value feature-table)))
72 (defun concord-el-type-table-put-object (type-table spec &optional id)
75 (setq id (cdr (assq '=id spec))))
77 (dolist (feature spec)
78 (concord-el-type-table-put-object-feature
79 type-table id (car feature)(cdr feature)))
80 (setq self (vector :concord type id))
81 (concord-el-type-table-put-object-feature
82 type-table id '=self self)
85 (defun concord-el-define-object (type spec &optional id)
86 (let ((type-table (concord-el-get-type-table-create type)))
88 (concord-el-type-table-put-object type-table spec id))))
90 (defun concord-el-object-get-value (object feature)
91 (let ((type (concord-object-type object))
93 (when (and (setq type-table (concord-el-get-type-table type))
94 (setq id (concord-object-id object)))
95 (concord-el-type-table-get-object-feature type-table id feature))))
97 (defun concord-el-object-spec (object)
98 (let ((type (concord-object-type object))
100 (dolist (feature (concord-el-feature-list type))
101 (when (setq ret (concord-el-object-get-value object feature))
102 (setq dest (cons (cons feature ret) dest))))
105 (defun concord-el-map-feature (function feature type)
106 (let ((type-table (concord-el-get-type-table type))
109 (if (setq feature-table
110 (concord-el-type-table-get-feature-table
112 (maphash (lambda (id val)
114 (concord-el-type-table-get-object-feature
115 type-table id '=self))
116 (funcall function self val))
119 (defun concord-el-map-objects (function type)
120 (let ((type-table (concord-el-get-type-table type))
123 (if (setq feature-table
124 (concord-el-type-table-get-feature-table
126 (maphash (lambda (id self)
127 (funcall function self))
130 (defun concord-el-feature-list (type)
132 (maphash (lambda (key val)
133 (setq dest (cons key dest))
135 (concord-el-get-type-table type))