fix sb-posix tests on OpenBSD
[sbcl.git] / src / code / pprint.lisp
index d0f7b57..08e25e9 100644 (file)
@@ -1003,14 +1003,20 @@ line break."
 ;;;; standard pretty-printing routines
 
 (defun pprint-array (stream array)
-  (cond ((or (and (null *print-array*) (null *print-readably*))
-             (stringp array)
-             (bit-vector-p array))
+  (cond ((and (null *print-array*) (null *print-readably*))
          (output-ugly-object array stream))
         ((and *print-readably*
               (not (array-readably-printable-p array)))
-         (let ((*print-readably* nil))
-           (error 'print-not-readable :object array)))
+         (restart-case
+             (error 'print-not-readable :object array)
+           (print-unreadably ()
+             :report "Print unreadably."
+             (let ((*print-readably* nil))
+               (pprint-array stream array)))
+           (use-value (o)
+             :report "Supply an object to be printed instead."
+             :interactive read-unreadable-replacement
+             (write o :stream stream))))
         ((vectorp array)
          (pprint-vector stream array))
         (t
@@ -1139,7 +1145,9 @@ line break."
   (declare (ignore noise))
   (if (and (consp list)
            (consp (cdr list))
-           (cddr list))
+           (cddr list)
+           ;; Filter out (FLET FOO :IN BAR) names.
+           (not (eq :in (third list))))
       (funcall (formatter
                 "~:<~^~W~^ ~@_~:<~@{~:<~^~W~^~3I ~:_~/SB!PRETTY:PPRINT-LAMBDA-LIST/~1I~:@_~@{~W~^ ~_~}~:>~^ ~_~}~:>~1I~@:_~@{~W~^ ~_~}~:>")
                stream
@@ -1261,6 +1269,15 @@ line break."
            stream
            list))
 
+(defun pprint-defmethod (stream list &rest noise)
+  (declare (ignore noise))
+  (if (consp (third list))
+      (pprint-defun stream list)
+      (funcall (formatter
+                "~:<~^~W~^ ~@_~:I~W~^ ~W~^ ~:_~/SB!PRETTY:PPRINT-LAMBDA-LIST/~1I~@{ ~_~W~}~:>")
+               stream
+               list)))
+
 (defun pprint-defpackage (stream list &rest noise)
   (declare (ignore noise))
   (funcall  (formatter
@@ -1471,7 +1488,7 @@ line break."
   (let ((*print-pprint-dispatch* *initial-pprint-dispatch-table*)
         (*building-initial-table* t))
     (/show0 "doing SET-PPRINT-DISPATCH for regular types")
-    (set-pprint-dispatch 'array #'pprint-array)
+    (set-pprint-dispatch '(and array (not (or string bit-vector))) #'pprint-array)
     (set-pprint-dispatch '(cons (and symbol (satisfies mboundp)))
                          #'pprint-macro-call -1)
     (set-pprint-dispatch '(cons (and symbol (satisfies fboundp)))
@@ -1518,6 +1535,7 @@ line break."
                           (define-modify-macro pprint-defun)
                           (define-setf-expander pprint-defun)
                           (defmacro pprint-defun)
+                          (defmethod pprint-defmethod)
                           (defpackage pprint-defpackage)
                           (defparameter pprint-block)
                           (defsetf pprint-defun)
@@ -1581,5 +1599,6 @@ line break."
 
   (setf *standard-pprint-dispatch-table*
         (copy-pprint-dispatch *initial-pprint-dispatch-table*))
-  (setf *print-pprint-dispatch* *initial-pprint-dispatch-table*)
+  (setf *print-pprint-dispatch*
+        (copy-pprint-dispatch *initial-pprint-dispatch-table*))
   (setf *print-pretty* t))