X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fdescribe.lisp;h=b89842fd1eb2c8a2e0805bbbc329f4b946075b3a;hb=f578dd10fa6d9a8d7c3d15d3100406976f6a273c;hp=5033aa113f24d0d80d8eea6f9488d9d88b3407a2;hpb=27155202e7a3c0e997a4fad7ba2aa01fa1a2b7a9;p=sbcl.git diff --git a/src/code/describe.lisp b/src/code/describe.lisp index 5033aa1..b89842f 100644 --- a/src/code/describe.lisp +++ b/src/code/describe.lisp @@ -12,21 +12,17 @@ (in-package "SB-IMPL") ;(SB-IMPL, not SB!IMPL, since we're built in warm load.) -(defvar *describe-indentation-step* 3 - #+sb-doc - "the number of spaces that sets off each line of a recursive description") - (declaim (ftype (function (t stream)) describe-object)) -(defgeneric describe-object ((x t) stream)) +(defgeneric describe-object (x stream)) (defun describe (x &optional (stream-designator *standard-output*)) #+sb-doc "Print a description of the object X." (let ((stream (out-synonym-of stream-designator))) + (fresh-line stream) (pprint-logical-block (stream nil) - (fresh-line stream) (describe-object x stream) - (fresh-line stream))) + (pprint-newline :mandatory stream))) (values)) ;;;; miscellaneous DESCRIBE-OBJECT methods @@ -47,18 +43,18 @@ (defmethod describe-object ((x array) s) (let ((rank (array-rank x))) - (cond ((> rank 1) - (format s "~S ~_is " x) - (write-string (if (%array-displaced-p x) "a displaced" "an") s) - (format s " array of rank ~S." rank) - (format s "~@:_Its dimensions are ~S." (array-dimensions x))) - (t + (cond ((= rank 1) (format s "~@:_~S is a ~:[~;displaced ~]vector of length ~S." x (and (array-header-p x) (%array-displaced-p x)) (length x)) (when (array-has-fill-pointer-p x) (format s "~@:_It has a fill pointer, currently ~S." - (fill-pointer x)))))) + (fill-pointer x)))) + (t + (format s "~S ~_is " x) + (write-string (if (%array-displaced-p x) "a displaced" "an") s) + (format s " array of rank ~S." rank) + (format s "~@:_Its dimensions are ~S." (array-dimensions x))))) (let ((array-element-type (array-element-type x))) (unless (eq array-element-type t) (format s @@ -189,7 +185,7 @@ (:function (if name (format s "Function: ~S" x) (format s "~S is a function." x)))) - (format s "~@:_Its associated name (as in ~S) is ~S." + (format s "~@:_~@" 'function-lambda-expression (%fun-name x)) (case (widetag-of x) @@ -213,7 +209,7 @@ (defmethod describe-object ((x function) s) (%describe-fun x s :function)) -(defgeneric describe-symbol-fdefinition (function stream &key (name nil) )) +(defgeneric describe-symbol-fdefinition (function stream &key name)) (defmethod describe-symbol-fdefinition ((fun function) stream &key name) (%describe-fun fun stream :function name)) @@ -245,6 +241,7 @@ (let* ((kind (info :variable :kind x)) (wot (ecase kind (:special "special variable") + (:macro "symbol macro") (:constant "constant") (:global "undefined variable") (:alien nil)))) @@ -257,6 +254,9 @@ (sb-alien::heap-alien-info-type info))) (format s "~@" (eval x)))) + ((eq kind :macro) + (let ((expansion (info :variable :macro-expansion x))) + (format s "~@:_It is a ~A with expansion ~S." wot expansion))) ((boundp x) (format s "~@:_~@" wot (symbol-value x)))