chiark / gitweb /
Updated to work with CLISP
authorespen <espen>
Wed, 6 Sep 2006 11:07:36 +0000 (11:07 +0000)
committerespen <espen>
Wed, 6 Sep 2006 11:07:36 +0000 (11:07 +0000)
examples/ginspect.lisp

index 7abdd8a9e68cfd0fb4ed0add007ccf754d2b758e..d4e8f234d916d0c533f1578176051aca0afb654a 100644 (file)
 ;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 ;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-;; $Id: ginspect.lisp,v 1.11 2006-09-05 13:12:50 espen Exp $
+;; $Id: ginspect.lisp,v 1.12 2006-09-06 11:07:36 espen Exp $
 
 #+sbcl(require :gtk)
 #+cmu(asdf:oos 'asdf:load-op :gtk)
 
 (defpackage "GINSPECT"
-  (:use "COMMON-LISP" "GFFI" "GLIB" "GTK" #+cmu"PCL" #+sbcl"SB-PCL")
+  (:use "COMMON-LISP" "GFFI" "GLIB" "GTK" #+cmu"PCL" #+sbcl"SB-PCL" #+clisp"MOP")
+  #+clisp(:shadowing-import-from "MOP" "SLOT-DEFINITION-TYPE")
   (:export "GINSPECT" "GINSPECT-TOPLEVELS"))
 
 (in-package "GINSPECT")
 
 (defvar *ginspect-unbound-object-marker* 
-  #+cmu (gensym "UNBOUND-OBJECT-")
+  #+(or cmu clisp)(gensym "UNBOUND-OBJECT-")
   #+sbcl sb-impl::*inspect-unbound-object-marker*)
 
 
@@ -94,7 +95,8 @@ (defmethod decompose-describe-object ((object t))
     (if (equal parts (list object))
        (values description nil nil)
       (values description named-p parts)))
-  #+sbcl(sb-impl::inspected-parts object))
+  #+sbcl(sb-impl::inspected-parts object)
+  #+clisp(values (format nil "The object is an ATOM of type ~A" (type-of object) nil nil)))
 
 (defmethod decompose-describe-object ((object (eql t)))
   (values (call-next-method) nil nil))
@@ -110,6 +112,7 @@ (defmethod decompose-describe-object ((object cons))
       (values (call-next-method) nil object)
     (values "The object is a CONS." nil (list (car object) (cdr object)))))
 
+#+(or cmu sbcl)
 (defmethod decompose-describe-object ((object #+cmu alien:system-area-pointer
                                              #+sbcl sb-alien:system-area-pointer))
   (values "The object is a SYSTEM-AREA-POINTER" nil nil))
@@ -117,7 +120,7 @@ (defmethod decompose-describe-object ((object #+cmu alien:system-area-pointer
 (defmethod decompose-describe-object ((object (eql *ginspect-unbound-object-marker*)))
   (values "The slot is unbound" nil nil))
 
-#+cmu
+#+(or cmu clisp)
 (defmethod decompose-describe-object ((object symbol))
   (values 
    (call-next-method) t
@@ -134,7 +137,7 @@ (defmethod decompose-describe-object ((object symbol))
 
 (defmethod decompose-describe-object ((object standard-object))
   (values 
-   (format nil "The instance is an object of type ~A.
+   (format nil "The instance is an object of type ~A" 
     (class-name (class-of object)))
    t
    (loop
@@ -146,6 +149,13 @@ (defmethod decompose-describe-object ((object standard-object))
                                 *ginspect-unbound-object-marker*)))
              (cons (string slot-name) slot-value)))))
 
+#+clisp
+(defmethod decompose-describe-object ((object vector))
+  (values   
+   (format nil "The object is a ~A of length ~A" (type-of object) (length object))
+   nil
+   (coerce object 'list)))
+
 
 (defmethod object-has-parts-p ((object t))
   (nth-value 2 (decompose-describe-object object)))