diff options
Diffstat (limited to 'Lisp/utilities.lisp')
-rw-r--r-- | Lisp/utilities.lisp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Lisp/utilities.lisp b/Lisp/utilities.lisp index 29efb60..be6f8b4 100644 --- a/Lisp/utilities.lisp +++ b/Lisp/utilities.lisp @@ -90,3 +90,37 @@ (defmethod objc-equal ((x string) (y selector)) (equal x (selector-name y))) + + +;;; (@* "Object Representation") +(defmethod print-object ((object id) stream) + (print-unreadable-object (object stream) + (format stream "~A `~A' {~X}" + (objcl-class-name (primitive-invoke object "class" :id)) + (primitive-invoke (primitive-invoke object "description" :id) + "UTF8String" :string) + (primitive-invoke object "hash" :unsigned-int)))) + + +(defmethod print-object ((class objc-class) stream) + (print-unreadable-object (class stream) + (format stream "~S ~A {~X}" + 'objc-class + (objcl-class-name class) + (primitive-invoke class "hash" :unsigned-int)))) + + +(defmethod print-object ((selector selector) stream) + (print-unreadable-object (selector stream) + (format stream "~S `~A'" + 'selector + (selector-name selector)))) + + +(defmethod print-object ((exception exception) stream) + (print-unreadable-object (exception stream) + (format stream "~S ~A {~X}" + 'exception + (primitive-invoke (primitive-invoke exception "name" :id) + "UTF8String" :string) + (primitive-invoke exception "hash" :unsigned-int)))) |