From: Christophe Rhodes Date: Tue, 10 Aug 2004 14:25:38 +0000 (+0000) Subject: 0.8.13.52: X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=5c0190fbca4852096b30b4ed53394e762b9e6cd4;p=sbcl.git 0.8.13.52: Fix for PRINC-TO-STRING/*PRINT-READABLY* interaction --- diff --git a/NEWS b/NEWS index 0a16ae5..026773d 100644 --- a/NEWS +++ b/NEWS @@ -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 diff --git a/src/code/print.lisp b/src/code/print.lisp index ce3e836..cff78d0 100644 --- a/src/code/print.lisp +++ b/src/code/print.lisp @@ -158,7 +158,7 @@ #!+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) @@ -166,8 +166,8 @@ #!+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) @@ -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)))) diff --git a/tests/print.impure.lisp b/tests/print.impure.lisp index 4fd0a67..e3184bc 100644 --- a/tests/print.impure.lisp +++ b/tests/print.impure.lisp @@ -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) diff --git a/version.lisp-expr b/version.lisp-expr index ec151ff..13a29fa 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -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"