Commit 8142ddb9 authored by Dave Cooper's avatar Dave Cooper
Browse files

assign unique id to object and use in print-object method

parent 471701d8
Loading
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -522,3 +522,9 @@ set to nil to improve memory performance.")
  allows list-of-numbers function to return nil instead of error
  when num1 is greater than num2 with positive increment or vice-versa. 
  Default is nil.")

(defparameter *track-object-lifecycles?* nil)
(defparameter *object-weak-hash* (glisp:make-weak-hash-table
				  :size 10000
				  :weakness :value))
+9 −2
Original line number Diff line number Diff line
@@ -127,7 +127,11 @@ sequence." strings-for-display (format


  :computed-slots
  ((%corners% nil)
  ((object-unique-id (let ((id (glisp:increment-object-counter)))
		       (when *track-object-lifecycles?*
			 (setf (gethash id *object-weak-hash*) self))
		       id))
   (%corners% nil)
   (%vertex-array% nil)
   
   (null-part? (typep self 'null-part))
@@ -1250,6 +1254,9 @@ object as a toplevel input at the time of object instantiation.</li></ol>"
   ))
   

(defmethod print-object ((object vanilla-mixin) stream)
  (print-unreadable-object (object stream :type t)
    (format stream "~a" (theo object object-unique-id))))
  

(define-object vanilla-mixin (vanilla-mixin* gdl-basis)
+3 −0
Original line number Diff line number Diff line
@@ -540,3 +540,6 @@
                 (funcall #'gdl::*restart-init-function*))) sb-ext:*init-hooks*))
                           

(defun increment-object-counter ()
  (when (integerp gdl::*object-counter*)
    (incf gdl::*object-counter*)))
+3 −2
Original line number Diff line number Diff line
@@ -460,6 +460,7 @@ If you are interested in this effort we would love to hear from you at open-sour
   #:send-letter
   #:copy-file

   #:increment-object-counter

   ))

+1 −0
Original line number Diff line number Diff line
@@ -226,5 +226,6 @@ values are a color indicator for the default foreground and background of graphi

(defparameter *message-list-hashes* (make-hash-table :size 100))

(defparameter *object-counter* 0)

Loading