-(declaim (ftype (function ((or symbol cons) stream t)) %describe-function-name))
-(defun %describe-function-name (name s type-spec)
- (multiple-value-bind (type where)
- (if (or (symbolp name) (and (listp name) (eq (car name) 'setf)))
- (values (type-specifier (info :function :type name))
- (info :function :where-from name))
- (values type-spec :defined))
- (when (consp type)
- (format s "~@:_Its ~(~A~) argument types are:~@:_ ~S"
- where (second type))
- (format s "~@:_Its result type is:~@:_ ~S" (third type))))
- (let ((inlinep (info :function :inlinep name)))
- (when inlinep
- (format s "~@:_It is currently declared ~(~A~);~
- ~:[no~;~] expansion is available."
- inlinep (info :function :inline-expansion name)))))
-
-;;; Interpreted function describing; handles both closure and
-;;; non-closure functions. Instead of printing the compiled-from info,
-;;; we print the definition.
-(defun %describe-function-interpreted (x s kind name)
- (declare (type stream s))
- (multiple-value-bind (exp closure-p dname)
- (sb-eval:interpreted-function-lambda-expression x)
- (let ((args (sb-eval:interpreted-function-arglist x)))
- (format s "~@:_~@(~@[~A ~]arguments:~@:_~)" kind)
- (if args
- (format s " ~<~S~:>" args)
- (write-string " There are no arguments." s)))
- (let ((name (or name dname)))
- (%describe-doc name s 'function kind)
- (unless (eq kind :macro)
- (%describe-function-name
- name
- s
- (type-specifier (sb-eval:interpreted-function-type x)))))
- (when closure-p
- (format s "~@:_Its closure environment is:")
- (pprint-logical-block (s nil)
- (pprint-indent :current 2)
- (let ((clos (sb-eval:interpreted-function-closure x)))
- (dotimes (i (length clos))
- (format s "~@:_~S: ~S" i (svref clos i))))))
- (format s "~@:_Its definition is:~@:_ ~S" exp)))
+(declaim (ftype (function (t stream t)) %describe-fun-name))
+(defun %describe-fun-name (name s type-spec)
+ (when (and name (typep name '(or symbol cons)))
+ (multiple-value-bind (type where)
+ (if (legal-fun-name-p name)
+ (values (type-specifier (info :function :type name))
+ (info :function :where-from name))
+ (values type-spec :defined))
+ (when (consp type)
+ (format s "~&Its ~(~A~) argument types are:~% ~S"
+ where (second type))
+ (format s "~&Its result type is:~% ~S" (third type))))
+ (let ((inlinep (info :function :inlinep name)))
+ (when inlinep
+ (format s
+ "~&It is currently declared ~(~A~);~
+ ~:[no~;~] expansion is available."
+ inlinep (info :function :inline-expansion-designator name))))))