Coverage report: /home/ellis/comp/core/lib/obj/id.lisp

KindCoveredAll%
expression426 15.4
branch00nil
Key
Not instrumented
Conditionalized out
Executed
Not executed
 
Both branches taken
One branch taken
Neither branch taken
1
 ;;; lib/obj/id.lisp --- IDs
2
 
3
 ;;
4
 
5
 ;;; Code:
6
 (in-package :obj/id)
7
 
8
 (defclass id ()
9
   ((id :initarg :id :initform 0 :accessor id :type fixnum)))
10
 
11
 (defmethod id (self) (hash-object-address self))
12
 
13
 (defgeneric reset-id (obj)
14
   (:documentation "Reset the id slot of SELF to 0.")
15
   (:method ((obj standard-object)) (setf (id obj) 0))
16
   (:method ((obj t)) 0))
17
 
18
 (defgeneric update-id (obj)
19
   (:documentation "Update the id slot of SELF.")
20
   (:method ((obj standard-object)) (setf (id obj) (hash-object obj)))
21
   (:method ((obj t)) (hash-object obj)))
22
 
23
 (defgeneric make-id (kind)
24
   (:documentation "Allocate a new ID object of a specified KIND.")
25
   (:method ((kind (eql nil)))
26
     (declare (ignore kind))
27
     (make-instance 'id))
28
   (:method ((kind (eql t)))
29
     (declare (ignore kind))
30
     (make-instance 'id :id most-positive-fixnum)))
31
 
32
 (defmethod print-object ((obj id) stream)
33
   (print-unreadable-object (obj stream :type "ID")
34
     (format stream "~A" (id obj))))
35
 
36
 (defclass id-factory () ())
37
 
38
 (defgeneric identify (self)
39
   (:documentation "Return the identity of object SELF - usually meant for objects which don't
40
 specialize on ID but should still sometimes return an ID."))