Menu

#336 confusing format error report, cause fill-stream

lisp error
closed-fixed
clisp (524)
5
2006-12-27
2006-05-05
No

Tin Daly reported on 2006-03-31 in clisp-list:
(format t " ~a ~a,~a~ ~a~%" 1 2 3 4)
gives the error:
*** - Non-existent format directive
Current point in control string:
~a ~a,~a~ ~a~%
|
The bar indicator should have been
here: |

It turns out this format error is caused by a feature
interaction with the fill-stream that's now used to
report the error. Error reporting of FORMAT strings
broke in CLISP when the FILL-STREAM was used in error
reporting.

Here are snippets from the source:
(progn (princ "foo") (sys::pretty-print-condition foo
*standard-output*))
(defun pretty-print-condition (condition stream &key
(text-indent 6))
(with-fill-stream (out stream :text-indent text-
indent)
(print-condition condition out)))
(defun report-error (condition)
(write-string "*** - " *error-output*)
(pretty-print-condition condition *error-output*)

And this is a stand-alone "testcase"
(progn (princ "abc")
(with-fill-stream (out *standard-output* :text-
indent 6)
(format out "bar~%grr~%~VT|" 20)))
abcbar
grr
|
The bar is at the leftmost position, not indented by
20 spaces, as the format bar code expects.

Alas, I have not yet understood whether it is FILL-
STREAM's specification to remove prefix whitespace,
nor do I know how to avoid it.

The confusing for me about fill-stream's behaviour
arises from impnotes saying:
"When FORMAT writes an S-expression to a EXT:FILL-
STREAM ... it is printed on separate lines, ignoring
the prescribed text indentation and preserving
spacing."
So FILL-STREAM preserves spacing?

BTW, I find the coagulating of spaces that FILL-STREAM
performs really confusing:
[4]> (describe "foo bar")[4 spaces]
"foo bar"[1space] is a simple 1 dimensional array
(vector) of CHARACTERs, of size 10
(a ISO-8859-1 string).
When I first saw this, I wondered how CLISP managed to
display two different strings. Was the heap
corrupted? How could that happen?

Discussion

  • Sam Steingold

    Sam Steingold - 2006-12-27

    Logged In: YES
    user_id=5735
    Originator: NO

    thank you for your bug report.
    the bug has been fixed in the CVS tree.
    you can either wait for the next release (recommended)
    or check out the current CVS tree (see http://clisp.cons.org\)
    and build CLISP from the sources (be advised that between
    releases the CVS tree is very unstable and may not even build
    on your platform).

     
  • Sam Steingold

    Sam Steingold - 2006-12-27
    • assigned_to: haible --> sds
    • status: open --> closed-fixed
     

Log in to post a comment.