[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gcl, mformat and *error-output*
From: |
Leo Butler |
Subject: |
gcl, mformat and *error-output* |
Date: |
Fri, 08 Mar 2024 12:37:08 -0600 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
(I posted this to maxima-discuss yesterday, but have not had a reaction,
so I am re-posting here. This bug can be reproduced with the current
Maxima+GCL build in Debian testing.)
I am trying to figure out what is causing a vexing bug involving GCL,
MFORMAT and *ERROR-OUTPUT*.
Consider a stripped-down definition of MY-ERROR-FN:
MAXIMA> (defun my-error-fn (sstring &rest l)
(let ((*standard-output* *error-output*))
(mformat t "~a" sstring)
(fresh-line *standard-output*)))
The return value of MY-ERROR-FN is T if FRESH-LINE prints a newline and
NIL if not.
Here it is with the default value of *ERROR-OUTPUT*:
MAXIMA> (my-error-fn "An error occurred.")
An error occurred.
NIL
That is a bug, FRESH-LINE should have inserted a newline. What is weird
is that if MFORMAT is replaced by FORMAT, then FRESH-LINE works as
expected. I cannot figure out what MFORMAT is doing that tickles this
bug. Note that this is specific to GCL (tested with v2.6.14).
----
Here are two good cases, where FRESH-LINE works correctly.
MAXIMA> (setf *error-output* *standard-output* )
#<synonym stream to *TERMINAL-IO*>
MAXIMA> (my-error-fn "An error occurred.")
An error occurred.
T
MAXIMA> (setf *error-output* (make-string-output-stream ))
#<string-output stream 000000000257bc18>
MAXIMA> (my-error-fn "An error occurred.")
T
MAXIMA> (get-output-stream-string *error-output*)
"An error occurred.
"
TIA,
Leo
- gcl, mformat and *error-output*,
Leo Butler <=