X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fpprint.lisp;h=24e7d9794f59d625174c899c515153d2ae6afcfb;hb=7a3dd48161181e84c2dae473586781c2c55d27d7;hp=f938d30bb370c9677a4996fad7525e165f1677a7;hpb=2db542f484283726e64dd4606e7a0f74b9b228ee;p=sbcl.git diff --git a/src/code/pprint.lisp b/src/code/pprint.lisp index f938d30..24e7d97 100644 --- a/src/code/pprint.lisp +++ b/src/code/pprint.lisp @@ -75,12 +75,12 @@ ;; Buffer holding the per-line prefix active at the buffer start. ;; Indentation is included in this. The length of this is stored ;; in the logical block stack. - (prefix (make-string initial-buffer-size) :type simple-string) + (prefix (make-string initial-buffer-size) :type (simple-array character (*))) ;; Buffer holding the total remaining suffix active at the buffer start. ;; The characters are right-justified in the buffer to make it easier ;; to output the buffer. The length is stored in the logical block ;; stack. - (suffix (make-string initial-buffer-size) :type simple-string) + (suffix (make-string initial-buffer-size) :type (simple-array character (*))) ;; Queue of pending operations. When empty, HEAD=TAIL=NIL. Otherwise, ;; TAIL holds the first (oldest) cons and HEAD holds the last (newest) ;; cons. Adding things to the queue is basically (setf (cdr head) (list @@ -1003,14 +1003,15 @@ 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))) + (if *read-eval* + (if (vectorp array) + (sb!impl::output-unreadable-vector-readably array stream) + (sb!impl::output-unreadable-array-readably array stream)) + (print-not-readable-error array stream))) ((vectorp array) (pprint-vector stream array)) (t @@ -1139,7 +1140,10 @@ line break." (declare (ignore noise)) (if (and (consp list) (consp (cdr list)) - (cddr list)) + (cddr list) + ;; Filter out (FLET FOO :IN BAR) names. + (and (consp (cddr list)) + (not (eq :in (third list))))) (funcall (formatter "~:<~^~W~^ ~@_~:<~@{~:<~^~W~^~3I ~:_~/SB!PRETTY:PPRINT-LAMBDA-LIST/~1I~:@_~@{~W~^ ~_~}~:>~^ ~_~}~:>~1I~@:_~@{~W~^ ~_~}~:>") stream @@ -1214,6 +1218,8 @@ line break." (output-object (pprint-pop) stream) (pprint-exit-if-list-exhausted) (write-char #\space stream) + (unless (listp (cdr list)) + (write-string ". " stream)) (pprint-newline :miser stream) (pprint-logical-block (stream (cdr list) :prefix "" :suffix "") (loop @@ -1263,7 +1269,9 @@ line break." (defun pprint-defmethod (stream list &rest noise) (declare (ignore noise)) - (if (consp (third list)) + (if (and (consp (cdr list)) + (consp (cddr list)) + (consp (third list))) (pprint-defun stream list) (funcall (formatter "~:<~^~W~^ ~@_~:I~W~^ ~W~^ ~:_~/SB!PRETTY:PPRINT-LAMBDA-LIST/~1I~@{ ~_~W~}~:>") @@ -1370,7 +1378,7 @@ line break." (declare (ignore noise)) (destructuring-bind (loop-symbol . clauses) list (declare (ignore loop-symbol)) - (if (or (null clauses) (consp (car clauses))) + (if (or (atom clauses) (consp (car clauses))) (pprint-spread-fun-call stream list) (pprint-extended-loop stream list)))) @@ -1480,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))) @@ -1591,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))