X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Ftarget-format.lisp;h=99cbb3f1723c0aba8b6da34860dbc153df349b8c;hb=d48e55084636a84d1b54f1f7370fa98c55f3ec6e;hp=bf267530f38f521a0bf69ae16e3e3f9c91892a44;hpb=9728093863d1ed201719d1f7ef61b9df29bb1d44;p=sbcl.git diff --git a/src/code/target-format.lisp b/src/code/target-format.lisp index bf26753..99cbb3f 100644 --- a/src/code/target-format.lisp +++ b/src/code/target-format.lisp @@ -74,15 +74,16 @@ (interpret-directive-list stream (cdr directives) orig-args args)) (format-directive (multiple-value-bind (new-directives new-args) - (let ((function - (svref *format-directive-interpreters* - (char-code (format-directive-character - directive)))) - (*default-format-error-offset* - (1- (format-directive-end directive)))) + (let* ((character (format-directive-character directive)) + (function + (svref *format-directive-interpreters* + (char-code character))) + (*default-format-error-offset* + (1- (format-directive-end directive)))) (unless function (error 'format-error - :complaint "unknown format directive")) + :complaint "unknown format directive ~@[(character: ~A)~]" + :args (list (char-name character)))) (multiple-value-bind (new-directives new-args) (funcall function stream directive (cdr directives) orig-args args) @@ -228,21 +229,14 @@ (let* ((name (char-name char))) (cond (name (write-string (string-capitalize name) stream)) - ((<= 0 (char-code char) 31) - ;; Print control characters as "^". (This seems to be - ;; old pre-ANSI behavior, but ANSI just says that the "#^" - ;; sequence is undefined and not reserved for the user, so - ;; this behavior should be ANSI-compliant.) - (write-char #\^ stream) - (write-char (code-char (+ 64 (char-code char))) stream)) (t (write-char char stream))))) (def-format-interpreter #\W (colonp atsignp params) (interpret-bind-defaults () params (let ((*print-pretty* (or colonp *print-pretty*)) - (*print-level* (and atsignp *print-level*)) - (*print-length* (and atsignp *print-length*))) + (*print-level* (unless atsignp *print-level*)) + (*print-length* (unless atsignp *print-length*))) (output-object (next-arg) stream)))) ;;;; format interpreters and support functions for integer output @@ -1067,7 +1061,7 @@ (interpret-format-logical-block stream orig-args args prefix per-line-p insides suffix atsignp)) - (let ((count (apply #'+ (mapcar (lambda (x) (count-if #'illegal-inside-justification-p x)) segments)))) + (let ((count (reduce #'+ (mapcar (lambda (x) (count-if #'illegal-inside-justification-p x)) segments)))) (when (> count 0) ;; ANSI specifies that "an error is signalled" in this ;; situation.