X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=contrib%2Fsb-aclrepl%2Finspect.lisp;h=852e1b35383ea343f7b9977d708cee2e8169a114;hb=1de341cf0652fb0eb8354f64d95acb0899811173;hp=13e4949b6ca764c501c30e082cf2418a793eff05;hpb=c117d67f59ebda806f168f31fb2c6b0962d997e6;p=sbcl.git diff --git a/contrib/sb-aclrepl/inspect.lisp b/contrib/sb-aclrepl/inspect.lisp index 13e4949..852e1b3 100644 --- a/contrib/sb-aclrepl/inspect.lisp +++ b/contrib/sb-aclrepl/inspect.lisp @@ -9,19 +9,24 @@ (cl:in-package :sb-aclrepl) +(eval-when (:compile-toplevel :load-toplevel :execute) + (defconstant +default-inspect-length+ 10)) + (defstruct inspect ;; stack of parents of inspected object object-stack ;; a stack of indices of parent object components - parent-stack - ;; number of components to display - (length 10)) + parent-stack) ;; FIXME - raw mode isn't currently used in object display (defparameter *current-inspect* nil "current inspect") (defparameter *inspect-raw* nil "Raw mode for object display.") +(defparameter *inspect-length* +default-inspect-length+ + "maximum number of components to print") +(defparameter *inspect-skip* 0 + "number of initial components to skip when displaying an object") (defvar *inspect-help* ":istep takes between 0 to 3 arguments. @@ -53,7 +58,9 @@ The commands are: ;; Setup binding for multithreading (let ((*current-inspect* nil) - (*inspect-raw* nil)) + (*inspect-raw* nil) + (*inspect-length* +default-inspect-length+) + (*inspect-skip* 0)) (defun inspector (object input-stream output-stream) (declare (ignore input-stream)) @@ -62,7 +69,8 @@ The commands are: (new-break :inspect *current-inspect*) (reset-stack) (setf (inspect-object-stack *current-inspect*) (list object)) - (setf (inspect-parent-stack *current-inspect*) (list "(inspect ...)")) + (setf (inspect-parent-stack *current-inspect*) + (list (format nil "(inspect ~S)" object))) (%inspect output-stream)) @@ -70,7 +78,7 @@ The commands are: (setq *current-inspect* inspect)) (defun istep (arg-string output-stream) - (%istep arg-string (string-to-list-skip-spaces arg-string) output-stream)) + (%istep arg-string output-stream)) (setq sb-impl::*inspect-fun* #'inspector) @@ -78,10 +86,11 @@ The commands are: (setf (inspect-object-stack *current-inspect*) nil) (setf (inspect-parent-stack *current-inspect*) nil)) -(defun %istep (arg-string args output-stream) +(defun %istep (arg-string output-stream) (unless *current-inspect* (setq *current-inspect* (make-inspect))) - (let* ((option (car args)) + (let* ((args (when arg-string (string-to-list-skip-spaces arg-string))) + (option (car args)) (option-read (when arg-string (read-from-string arg-string))) (stack (inspect-object-stack *current-inspect*))) @@ -185,7 +194,8 @@ The commands are: ((string-equal "skip" option) (let ((len (read-from-string (second args)))) (if (and (integerp len) (>= len 0)) - (%inspect output-stream len) + (let ((*inspect-skip* len)) + (%inspect output-stream)) (format output-stream "Skip missing or invalid~%")))) ;; Print stack tree ((string-equal "tree" option) @@ -210,7 +220,7 @@ The commands are: ((string-equal "print" option) (let ((len (read-from-string (second args)))) (if (and (integerp len) (plusp len)) - (setf (inspect-length *current-inspect*) len) + (setq *inspect-length* len) (format output-stream "Cannot set print limit to ~A~%" len)))) ;; Select numbered or named component ((or (symbolp option-read) @@ -225,7 +235,7 @@ The commands are: (cond ((eq value *inspect-unbound-object-marker*) (format output-stream "That slot is unbound~%")) (t - (push value stack) + (push value (inspect-object-stack *current-inspect*)) (push option-read (inspect-parent-stack *current-inspect*)) (%inspect output-stream))))) ((null elements) @@ -246,8 +256,10 @@ The commands are: ;; Default is to select eval'd form (t (reset-stack) - (setf (inspect-object-stack *current-inspect*) (list (eval option-read))) - (setf (inspect-parent-stack *current-inspect*) (list ":i