X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/clg/blobdiff_plain/c3940f41bf87cf0b02835b4a96a51c81a5a8df1e..7d2f9e31f958431da7dc2ab4ce7091747ad96510:/examples/ginspect.lisp diff --git a/examples/ginspect.lisp b/examples/ginspect.lisp index 7abdd8a..2e5d9a1 100644 --- a/examples/ginspect.lisp +++ b/examples/ginspect.lisp @@ -20,19 +20,20 @@ ;; 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.14 2006-09-15 12:46:30 espen Exp $ #+sbcl(require :gtk) -#+cmu(asdf:oos 'asdf:load-op :gtk) +#+(or cmu clisp)(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*) @@ -59,9 +60,9 @@ (defun ginspect (object) (object (make-instance 'cell-renderer-text))) (tree-view-append-column view column) (cell-layout-pack column name :expand nil) - (cell-layout-add-attribute column name 'text (column-index store 'name)) + (cell-layout-add-attribute column name :text (tree-model-column-index store 'name)) (cell-layout-pack column object :expand t) - (cell-layout-add-attribute column object 'text (column-index store 'pprinted))) + (cell-layout-add-attribute column object :text (tree-model-column-index store 'pprinted))) (insert-object object store nil) @@ -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)))