Skip to content

Commit

Permalink
0.8.13.52:
Browse files Browse the repository at this point in the history
	Fix for PRINC-TO-STRING/*PRINT-READABLY* interaction
  • Loading branch information
csrhodes committed Aug 10, 2004
1 parent 83764e0 commit 5c0190f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ changes in sbcl-0.8.14 relative to sbcl-0.8.13:
conditional newlines.
** PRINT-UNREADABLE-OBJECT inserts spaces as specified (and only
as specified: it no longer includes conditional newlines).
** PRINC-TO-STRING binds *PRINT-READABLY* to NIL (as well as
*PRINT-ESCAPE*).

changes in sbcl-0.8.13 relative to sbcl-0.8.12:
* new feature: SB-PACKAGE-LOCKS. See the "Package Locks" section of
Expand Down
15 changes: 9 additions & 6 deletions src/code/print.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,16 @@
#!+sb-doc
"Output a mostly READable printed representation of OBJECT on the specified
STREAM."
(let ((*print-escape* T))
(let ((*print-escape* t))
(output-object object (out-synonym-of stream)))
object)

(defun princ (object &optional stream)
#!+sb-doc
"Output an aesthetic but not necessarily READable printed representation
of OBJECT on the specified STREAM."
(let ((*print-escape* NIL)
(*print-readably* NIL))
(let ((*print-escape* nil)
(*print-readably* nil))
(output-object object (out-synonym-of stream)))
object)

Expand Down Expand Up @@ -217,18 +217,21 @@
#!+sb-doc
"Return the printed representation of OBJECT as a string with
slashification on."
(stringify-object object t))
(let ((*print-escape* t))
(stringify-object object)))

(defun princ-to-string (object)
#!+sb-doc
"Return the printed representation of OBJECT as a string with
slashification off."
(stringify-object object nil))
(let ((*print-escape* nil)
(*print-readably* nil))
(stringify-object object)))

;;; This produces the printed representation of an object as a string.
;;; The few ...-TO-STRING functions above call this.
(defvar *string-output-streams* ())
(defun stringify-object (object &optional (*print-escape* *print-escape*))
(defun stringify-object (object)
(let ((stream (if *string-output-streams*
(pop *string-output-streams*)
(make-string-output-stream))))
Expand Down
5 changes: 5 additions & 0 deletions tests/print.impure.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -242,5 +242,10 @@
;;; NIL parameters to "interpreted" FORMAT directives
(assert (string= (format nil "~v%" nil) (string #\Newline)))

;;; PRINC-TO-STRING should bind print-readably
(let ((*print-readably* t))
(assert (string= (princ-to-string #\7)
(write-to-string #\7 :escape nil :readably nil))))

;;; success
(quit :unix-status 104)
2 changes: 1 addition & 1 deletion version.lisp-expr
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
;;; checkins which aren't released. (And occasionally for internal
;;; versions, especially for internal versions off the main CVS
;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
"0.8.13.51"
"0.8.13.52"

0 comments on commit 5c0190f

Please sign in to comment.