1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
We have added a user extensible feature to the common lisp
function format.
For some applications, for example in maxima, it is very desirable
to be able to define a new control character, so that
(format t "~%The polynomial ~m is not zero" polynomial)
would work. It is desirable to extend format itself, since then
calls to the error and other functions which use format will work
correctly. For example:
(error "~%The polynomial ~m is not zero" polynomial)
For an application to do this we would evaluate the following:
(setf (get 'si::*indent-formatted-output* (char-code #\m)) 'maxima-print)
(defun maxima-print (item stream colon atsign &rest l)
colon atsign l ;ignoring these
(internal-maxima-print item stream))
Note this extension is case sensitive, so that to have this apply to
capital M as well, the property for (char-code #\M) must be added as
well.
A call with "~:m" would make colon=1 and atsign=0.
A call with "~@m" would make colon=0 and atsign=1.
To Do:
The &rest l is currently unused, a future addition will probably
store into l the current column of the format output stream.
This also implies that new print functions should return what they think is
the new column. Since I believe that 98% of the current calls to format
do not use column information in an important way, this is probably not worth
the additional hair involved.
Numeric args are not passed.
|