projects
/
sbcl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
0.pre7.14.flaky4.2:
[sbcl.git]
/
src
/
code
/
pprint.lisp
diff --git
a/src/code/pprint.lisp
b/src/code/pprint.lisp
index
bbfa315
..
ec285d7
100644
(file)
--- a/
src/code/pprint.lisp
+++ b/
src/code/pprint.lisp
@@
-32,7
+32,8
@@
(:out #'pretty-out)
(:sout #'pretty-sout)
(:misc #'pretty-misc))
(:out #'pretty-out)
(:sout #'pretty-sout)
(:misc #'pretty-misc))
- (:constructor make-pretty-stream (target)))
+ (:constructor make-pretty-stream (target))
+ (:copier nil))
;; Where the output is going to finally go.
(target (required-argument) :type stream)
;; Line length we should format to. Cached here so we don't have to keep
;; Where the output is going to finally go.
(target (required-argument) :type stream)
;; Line length we should format to. Cached here so we don't have to keep
@@
-97,6
+98,11
@@
(declare (type posn posn) (type pretty-stream stream)
(values posn))
(index-column (posn-index posn stream) stream))
(declare (type posn posn) (type pretty-stream stream)
(values posn))
(index-column (posn-index posn stream) stream))
+
+;;; Is it OK to do pretty printing on this stream at this time?
+(defun print-pretty-on-stream-p (stream)
+ (and (pretty-stream-p stream)
+ *print-pretty*))
\f
;;;; stream interface routines
\f
;;;; stream interface routines
@@
-147,7
+153,7
@@
\f
;;;; logical blocks
\f
;;;; logical blocks
-(defstruct logical-block
+(defstruct (logical-block (:copier nil))
;; The column this logical block started in.
(start-column 0 :type column)
;; The column the current section started in.
;; The column this logical block started in.
(start-column 0 :type column)
;; The column the current section started in.
@@
-235,7
+241,8
@@
\f
;;;; the pending operation queue
\f
;;;; the pending operation queue
-(defstruct (queued-op (:constructor nil))
+(defstruct (queued-op (:constructor nil)
+ (:copier nil))
(posn 0 :type posn))
(defmacro enqueue (stream type &rest args)
(posn 0 :type posn))
(defmacro enqueue (stream type &rest args)
@@
-257,12
+264,13
@@
,entry))))
(defstruct (section-start (:include queued-op)
,entry))))
(defstruct (section-start (:include queued-op)
- (:constructor nil))
+ (:constructor nil)
+ (:copier nil))
(depth 0 :type index)
(section-end nil :type (or null newline block-end)))
(depth 0 :type index)
(section-end nil :type (or null newline block-end)))
-(defstruct (newline
- (:include section-start))
+(defstruct (newline (:include section-start)
+ (:copier nil))
(kind (required-argument)
:type (member :linear :fill :miser :literal :mandatory)))
(kind (required-argument)
:type (member :linear :fill :miser :literal :mandatory)))
@@
-277,16
+285,16
@@
(setf (section-start-section-end entry) newline))))
(maybe-output stream (or (eq kind :literal) (eq kind :mandatory))))
(setf (section-start-section-end entry) newline))))
(maybe-output stream (or (eq kind :literal) (eq kind :mandatory))))
-(defstruct (indentation
- (:include queued-op))
+(defstruct (indentation (:include queued-op)
+ (:copier nil))
(kind (required-argument) :type (member :block :current))
(amount 0 :type fixnum))
(defun enqueue-indent (stream kind amount)
(enqueue stream indentation :kind kind :amount amount))
(kind (required-argument) :type (member :block :current))
(amount 0 :type fixnum))
(defun enqueue-indent (stream kind amount)
(enqueue stream indentation :kind kind :amount amount))
-(defstruct (block-start
- (:include section-start))
+(defstruct (block-start (:include section-start)
+ (:copier nil))
(block-end nil :type (or null block-end))
(prefix nil :type (or null simple-string))
(suffix nil :type (or null simple-string)))
(block-end nil :type (or null block-end))
(prefix nil :type (or null simple-string))
(suffix nil :type (or null simple-string)))
@@
-309,8
+317,8
@@
(setf (pretty-stream-pending-blocks stream)
(cons start pending-blocks))))
(setf (pretty-stream-pending-blocks stream)
(cons start pending-blocks))))
-(defstruct (block-end
- (:include queued-op))
+(defstruct (block-end (:include queued-op)
+ (:copier nil))
(suffix nil :type (or null simple-string)))
(defun end-logical-block (stream)
(suffix nil :type (or null simple-string)))
(defun end-logical-block (stream)
@@
-321,8
+329,8
@@
(pretty-sout stream suffix 0 (length suffix)))
(setf (block-start-block-end start) end)))
(pretty-sout stream suffix 0 (length suffix)))
(setf (block-start-block-end start) end)))
-(defstruct (tab
- (:include queued-op))
+(defstruct (tab (:include queued-op)
+ (:copier nil))
(sectionp nil :type (member t nil))
(relativep nil :type (member t nil))
(colnum 0 :type column)
(sectionp nil :type (member t nil))
(relativep nil :type (member t nil))
(colnum 0 :type column)
@@
-655,7
+663,7
@@
((t) *terminal-io*)
((nil) *standard-output*)
(t stream))))
((t) *terminal-io*)
((nil) *standard-output*)
(t stream))))
- (when (pretty-stream-p stream)
+ (when (print-pretty-on-stream-p stream)
(enqueue-newline stream kind)))
nil)
(enqueue-newline stream kind)))
nil)
@@
-678,7
+686,7
@@
((t) *terminal-io*)
((nil) *standard-output*)
(t stream))))
((t) *terminal-io*)
((nil) *standard-output*)
(t stream))))
- (when (pretty-stream-p stream)
+ (when (print-pretty-on-stream-p stream)
(enqueue-indent stream relative-to n)))
nil)
(enqueue-indent stream relative-to n)))
nil)
@@
-703,7
+711,7
@@
((t) *terminal-io*)
((nil) *standard-output*)
(t stream))))
((t) *terminal-io*)
((nil) *standard-output*)
(t stream))))
- (when (pretty-stream-p stream)
+ (when (print-pretty-on-stream-p stream)
(enqueue-tab stream kind colnum colinc)))
nil)
(enqueue-tab stream kind colnum colinc)))
nil)
@@
-766,7
+774,7
@@
(defvar *initial-pprint-dispatch*)
(defvar *building-initial-table* nil)
(defvar *initial-pprint-dispatch*)
(defvar *building-initial-table* nil)
-(defstruct pprint-dispatch-entry
+(defstruct (pprint-dispatch-entry (:copier nil))
;; The type specifier for this entry.
(type (required-argument) :type t)
;; A function to test to see whether an object is of this time. Pretty must
;; The type specifier for this entry.
(type (required-argument) :type t)
;; A function to test to see whether an object is of this time. Pretty must
@@
-788,7
+796,7
@@
(pprint-dispatch-entry-priority entry)
(pprint-dispatch-entry-initial-p entry))))
(pprint-dispatch-entry-priority entry)
(pprint-dispatch-entry-initial-p entry))))
-(defstruct pprint-dispatch-table
+(defstruct (pprint-dispatch-table (:copier nil))
;; A list of all the entries (except for CONS entries below) in highest
;; to lowest priority.
(entries nil :type list)
;; A list of all the entries (except for CONS entries below) in highest
;; to lowest priority.
(entries nil :type list)
@@
-867,15
+875,8
@@
(let ((expr (compute-test-expr type 'object)))
(cond ((cdr (assoc expr *precompiled-pprint-dispatch-funs*
:test #'equal)))
(let ((expr (compute-test-expr type 'object)))
(cond ((cdr (assoc expr *precompiled-pprint-dispatch-funs*
:test #'equal)))
- ((fboundp 'compile)
- (compile nil `(lambda (object) ,expr)))
- (was-cons
- (warn "CONS PPRINT dispatch ignored w/o compiler loaded:~% ~S"
- type)
- #'(lambda (object) (declare (ignore object)) nil))
(t
(t
- (let ((ttype (sb!kernel:specifier-type type)))
- #'(lambda (object) (sb!kernel:%typep object ttype)))))))))
+ (compile nil `(lambda (object) ,expr))))))))
(defun copy-pprint-dispatch (&optional (table *print-pprint-dispatch*))
(declare (type (or pprint-dispatch-table null) table))
(defun copy-pprint-dispatch (&optional (table *print-pprint-dispatch*))
(declare (type (or pprint-dispatch-table null) table))
@@
-953,7
+954,7
@@
(stringp array)
(bit-vector-p array))
(output-ugly-object array stream))
(stringp array)
(bit-vector-p array))
(output-ugly-object array stream))
- ((and *print-readably* (not (eq (array-element-type array) 't)))
+ ((and *print-readably* (not (eq (array-element-type array) t)))
(let ((*print-readably* nil))
(error 'print-not-readable :object array)))
((vectorp array)
(let ((*print-readably* nil))
(error 'print-not-readable :object array)))
((vectorp array)