(function
(typecase character
(base-char
- (svref *format-directive-interpreters*
- (char-code character)))
+ (svref *format-directive-interpreters* (char-code character)))
(character nil)))
(*default-format-error-offset*
(1- (format-directive-end directive))))
(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
(defun format-print-cardinal-aux (stream n period err)
(multiple-value-bind (beyond here) (truncate n 1000)
- (unless (<= period 20)
+ (unless (<= period 21)
(error "number too large to print in English: ~:D" err))
(unless (zerop beyond)
(format-print-cardinal-aux stream beyond (1+ period) err))