From: Christophe Rhodes Date: Mon, 27 Mar 2006 08:22:21 +0000 (+0000) Subject: 0.9.11.3: X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=01d3afd8254db54a95552d6e4d09f54a9c970449;p=sbcl.git 0.9.11.3: FORMAT ~:C and printing characters. (PFD ansi-tests) --- diff --git a/NEWS b/NEWS index 467a261..ea6333f 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,8 @@ changes in sbcl-0.9.12 relative to sbcl-0.9.11: the method is not one of the generic functions' methods. ** objects declared as MEMBER types can be admissible arguments to structure accessors. + ** printing characters should simply be printed by the FORMAT ~:C + directive. changes in sbcl-0.9.11 relative to sbcl-0.9.10: * new platform: experimental support for SBCL x86/Darwin, including diff --git a/src/code/target-format.lisp b/src/code/target-format.lisp index 91b8309..5a29fba 100644 --- a/src/code/target-format.lisp +++ b/src/code/target-format.lisp @@ -228,12 +228,16 @@ (prin1 (next-arg) stream) (write-char (next-arg) stream))))) +;;; "printing" as defined in the ANSI CL glossary, which is normative. +(defun char-printing-p (char) + (and (not (eql char #\Space)) + (graphic-char-p char))) + (defun format-print-named-character (char stream) - (let* ((name (char-name char))) - (cond (name - (write-string (string-capitalize name) stream)) - (t - (write-char char stream))))) + (cond ((not (char-printing-p char)) + (write-string (string-capitalize (char-name char)) stream)) + (t + (write-char char stream)))) (def-format-interpreter #\W (colonp atsignp params) (interpret-bind-defaults () params diff --git a/tests/print.impure.lisp b/tests/print.impure.lisp index 5aca94f..6a18d72 100644 --- a/tests/print.impure.lisp +++ b/tests/print.impure.lisp @@ -410,4 +410,6 @@ (with-test (:name (:print-readable :character :iso-8859-1)) (test-readable-character (code-char #xfffe) :iso-8859-1)) +(assert (string= (eval '(format nil "~:C" #\a)) "a")) +(assert (string= (format nil (formatter "~:C") #\a) "a")) ;;; success diff --git a/version.lisp-expr b/version.lisp-expr index 49019a0..18b84a1 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.9.11.2" +"0.9.11.3"