0.8.13.52:
authorChristophe Rhodes <csr21@cam.ac.uk>
Tue, 10 Aug 2004 14:25:38 +0000 (14:25 +0000)
committerChristophe Rhodes <csr21@cam.ac.uk>
Tue, 10 Aug 2004 14:25:38 +0000 (14:25 +0000)
Fix for PRINC-TO-STRING/*PRINT-READABLY* interaction

NEWS
src/code/print.lisp
tests/print.impure.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index 0a16ae5..026773d 100644 (file)
--- 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
index ce3e836..cff78d0 100644 (file)
   #!+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)
 
   #!+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)
 
   #!+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))))
index 4fd0a67..e3184bc 100644 (file)
 ;;; 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)
index ec151ff..13a29fa 100644 (file)
@@ -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"