- ;; currently-undocumented feature: EOF is handled as Q.
- ;; If there's ever consensus that this is *the* right
- ;; thing to do (as opposed to e.g. handling it as U), we
- ;; could document it. Meanwhile, it seems more Unix-y to
- ;; do this than to signal an error.
- (/show0 "THROWing QUIT-INSPECT for EOF")
- (throw 'quit-inspect nil))
- (typecase command
- (integer
- (let ((elements-length (length elements)))
- (cond ((< -1 command elements-length)
- (let* ((element (nth command elements))
- (value (if named-p (cdr element) element)))
- (cond ((eq value *inspect-unbound-object-marker*)
- (format s "~%That slot is unbound.~%")
- (return-from %inspect (reread)))
- (t
- (%inspect value s)
- ;; If we ever return, then we should be
- ;; looking at *INSPECTED* again.
- (return-from %inspect (redisplay))))))
- ((zerop elements-length)
- (format s "~%The object contains nothing to inspect.~%")
- (return-from %inspect (reread)))
- (t
- (format s "~%Enter a valid index (~:[0-~W~;0~]).~%"
- (= elements-length 1) (1- elements-length))
- (return-from %inspect (reread))))))
- (symbol
- (case (find-symbol (symbol-name command) *keyword-package*)
- ((:q :e)
- (/show0 "THROWing QUIT-INSPECT for :Q or :E")
- (throw 'quit-inspect nil))
- (:u
- (return-from %inspect))
- (:r
- (return-from %inspect (redisplay)))
- ((:h :? :help)
- (write-string *help-for-inspect* s)
- (return-from %inspect (reread)))
- (t
- (eval-for-inspect command s)
- (return-from %inspect (reread)))))
- (t
- (eval-for-inspect command s)
- (return-from %inspect (reread)))))))))
+ ;; currently-undocumented feature: EOF is handled as Q.
+ ;; If there's ever consensus that this is *the* right
+ ;; thing to do (as opposed to e.g. handling it as U), we
+ ;; could document it. Meanwhile, it seems more Unix-y to
+ ;; do this than to signal an error.
+ (/show0 "THROWing QUIT-INSPECT for EOF")
+ (throw 'quit-inspect nil))
+ (typecase command
+ (integer
+ (let ((elements-length (length elements)))
+ (cond ((< -1 command elements-length)
+ (let* ((element (nth command elements))
+ (value (if named-p (cdr element) element)))
+ (cond ((eq value *inspect-unbound-object-marker*)
+ (format s "~%That slot is unbound.~%")
+ (return-from %inspect (reread)))
+ (t
+ (%inspect value s)
+ ;; If we ever return, then we should be
+ ;; looking at *INSPECTED* again.
+ (return-from %inspect (redisplay))))))
+ ((zerop elements-length)
+ (format s "~%The object contains nothing to inspect.~%")
+ (return-from %inspect (reread)))
+ (t
+ (format s "~%Enter a valid index (~:[0-~W~;0~]).~%"
+ (= elements-length 1) (1- elements-length))
+ (return-from %inspect (reread))))))
+ (symbol
+ (case (find-symbol (symbol-name command) *keyword-package*)
+ ((:q :e)
+ (/show0 "THROWing QUIT-INSPECT for :Q or :E")
+ (throw 'quit-inspect nil))
+ (:u
+ (return-from %inspect))
+ (:r
+ (return-from %inspect (redisplay)))
+ ((:h :? :help)
+ (write-string *help-for-inspect* s)
+ (return-from %inspect (reread)))
+ (t
+ (eval-for-inspect command s)
+ (return-from %inspect (reread)))))
+ (t
+ (eval-for-inspect command s)
+ (return-from %inspect (reread)))))))))
- (let ((result-list (restart-case (multiple-value-list (eval command))
- (nil () :report "Return to the inspector."
- (format stream "~%returning to the inspector~%")
- (return-from eval-for-inspect nil)))))
- ;; FIXME: Much of this interactive-EVAL logic is shared with
- ;; the main REPL EVAL and with the debugger EVAL. The code should
- ;; be shared explicitly.
- (setf /// // // / / result-list)
- (setf +++ ++ ++ + + - - command)
- (setf *** ** ** * * (car /))
- (format stream "~&~{~S~%~}" /)))
+ (let ((result-list (restart-case
+ (multiple-value-list (interactive-eval command))
+ (nil () :report "Return to the inspector."
+ (format stream "~%returning to the inspector~%")
+ (return-from eval-for-inspect nil)))))
+ (format stream "~&~{~S~%~}" result-list)))
- t
- (list (cons "Name" (symbol-name object))
- (cons "Package" (symbol-package object))
- (cons "Value" (if (boundp object)
- (symbol-value object)
- *inspect-unbound-object-marker*))
- (cons "Function" (if (fboundp object)
- (symbol-function object)
- *inspect-unbound-object-marker*))
- (cons "Plist" (symbol-plist object)))))
+ t
+ (list (cons "Name" (symbol-name object))
+ (cons "Package" (symbol-package object))
+ (cons "Value" (if (boundp object)
+ (symbol-value object)
+ *inspect-unbound-object-marker*))
+ (cons "Function" (if (fboundp object)
+ (symbol-function object)
+ *inspect-unbound-object-marker*))
+ (cons "Plist" (symbol-plist object)))))
- (let* ((type (sb-kernel:widetag-of object))
- (object (if (= type sb-vm:closure-header-widetag)
- (sb-kernel:%closure-fun object)
- object)))
- (values (format nil "FUNCTION ~S.~@[~%Argument List: ~A~]." object
- (sb-kernel:%simple-fun-arglist object)
- ;; Defined-from stuff used to be here. Someone took
- ;; it out. FIXME: We should make it easy to get
- ;; to DESCRIBE from the inspector.
- )
- t
- nil)))
+ (values (format nil "The object is a ~A named ~S.~%"
+ (if (closurep object) 'closure 'function)
+ (nth-value 2 (function-lambda-expression object)))
+ t
+ ;; Defined-from stuff used to be here. Someone took
+ ;; it out. FIXME: We should make it easy to get
+ ;; to DESCRIBE from the inspector.
+ (list*
+ (cons "Lambda-list" (%fun-lambda-list object))
+ (cons "Ftype" (%fun-type object))
+ (when (closurep object)
+ (list
+ (cons "Closed over values" (%closure-values object)))))))
+
+#+sb-eval
+(defmethod inspected-parts ((object sb-eval:interpreted-function))
+ (values (format nil "The object is an interpreted function named ~S.~%"
+ (nth-value 2 (function-lambda-expression object)))
+ t
+ ;; Defined-from stuff used to be here. Someone took
+ ;; it out. FIXME: We should make it easy to get
+ ;; to DESCRIBE from the inspector.
+ (list
+ (cons "Lambda-list" (sb-eval:interpreted-function-lambda-list object))
+ (cons "Definition" (function-lambda-expression object))
+ (cons "Documentation" (sb-eval:interpreted-function-documentation object)))))
- "The object is a ~:[~;displaced ~]VECTOR of length ~W.~%"
- (and (array-header-p object)
- (%array-displaced-p object))
- (length object))
- nil
- ;; FIXME: Should we respect *INSPECT-LENGTH* here? If not, what
- ;; does *INSPECT-LENGTH* mean?
- (coerce object 'list)))
+ "The object is a ~:[~;displaced ~]VECTOR of length ~W.~%"
+ (and (array-header-p object)
+ (%array-displaced-p object))
+ (length object))
+ nil
+ ;; FIXME: Should we respect *INSPECT-LENGTH* here? If not, what
+ ;; does *INSPECT-LENGTH* mean?
+ (coerce object 'list)))
- (done "The object is a proper list of length ~S.~%"))
- ((>= length *inspect-length*)
- (push (cons 'rest in-list) reversed-elements)
- (done "The object is a long list (more than ~S elements).~%"))
- ((consp in-list)
- (push (cons length (pop in-list)) reversed-elements)
- (incf length))
- (t
- (push (cons 'rest in-list) reversed-elements)
- (done "The object is an improper list of length ~S.~%")))))))
+ (done "The object is a proper list of length ~S.~%"))
+ ((>= length *inspect-length*)
+ (push (cons 'rest in-list) reversed-elements)
+ (done "The object is a long list (more than ~S elements).~%"))
+ ((consp in-list)
+ (push (cons length (pop in-list)) reversed-elements)
+ (incf length))
+ (t
+ (push (cons 'rest in-list) reversed-elements)
+ (done "The object is an improper list of length ~S.~%")))))))