On 4/14/26 16:34, Waldek Hebisch wrote:
> After recent changes most message identifiers serve no useful
> purpose for FriCAS itself. They are passes to 'ioHook' and
> in principle various interfaces can use them.
Oh, for jfricas we have in webspad.lisp the following.
(setf |$ioHook|
(lambda (x &optional args)
(cond
((eq x '|startAlgebraOutput|) (ws-fmt "BEG:Algebra"))
((eq x '|endOfAlgebraOutput|) (ws-fmt "END:Algebra"))
((eq x '|startPatternMsg|) (ws-fmt "BEG:ERROR"))
((eq x '|endPatternMsg|) (ws-fmt "END:ERROR"))
((eq x '|startKeyedMsg|)
(cond
((eq (car args) 'S2GL0012) (ws-fmt "BEG:Type"))
((eq (car args) 'S2GL0013) (ws-fmt "BEG:Time"))
((eq (car args) 'S2GL0014) (ws-fmt "BEG:TypeTime"))
((eq (car args) 'S2GL0016) (ws-fmt "BEG:Storage"))
('T (ws-fmt "BEG:KeyedMsg"))))
((eq x '|endOfKeyedMsg|)
(cond
((eq (car args) 'S2GL0012) (ws-fmt "END:Type"))
((eq (car args) 'S2GL0013) (ws-fmt "END:Time"))
((eq (car args) 'S2GL0014) (ws-fmt "END:TypeTime"))
((eq (car args) 'S2GL0016) (ws-fmt "END:Storage"))
('T (ws-fmt "END:KeyedMsg"))))
)))
If, instead of sub-conditioning |startKeyedMsg| we would simply get
|startTimeMsg|, |startTypeMsg|, |startStorageMsg|, and the respective
end tags, then changing jfricas would not be soo difficult.
However, I am not sure in which way you want to redesign these message
identifiers.
We anyway have to release a new jfricas with a new FriCAS release.
In that, we will take care of working for the older FriCAS code and the
newer code. We are just not yet sure what is the best way to distinguish
old-fricas from new-fricas. We cannot simply rely on the version string,
since it should also work for people who compile any intermediate
version from the git-repo. At the moment we are thinking about checking
existence of |mkOutputConsoleStream|.
So if it is easily recognizable for jfricas, what the underlying fricas
features are, we do not need backward compatibility wrt. message
identifiers.
Note that we currently (mis-)use the storage message to extract the
|$IOindex|, i.e., the step number, from the output.
If I can cat the message numbers from multiline input/multiline output
reliably, that would be cool.
Actually, I don't care much about what exact structure you find best for
FriCAS, the easier the better. I mostly care to be able to have jfricas
running with the same functionality (or even better). In other words, I
am interested in having begin/end ioHooks for any output, even error
messages.
I haven't thought about it, but jfricas will anyway be lost, if for some
weird reason ends up in the lisp debugger.
Ralf