wxMaxima-developers / wxmaxima

A gui for the computer algebra system Maxima built with wxWidgets
https://wxMaxima-developers.github.io/wxmaxima/
Other
460 stars 96 forks source link

Two tests from the testsuite of a current Maxima return XML code instead of the result. #1832

Closed daute closed 8 months ago

daute commented 8 months ago

Example 1:

(%i2)   (kill(n),printf(false,"~m",(n!)!));
(%o2)   "<math><mrow lisp="wxxml-paren"><p lisp="wxxml-paren"><mi lisp="*var-tag*">n</mi><mo>!</mo></p></mrow><mo>!</mo></math>"

Should return: (n!)! (from rtest9a.mac)

(%i3)   (S: make_string_output_stream (), 
    trace (atom),
     with_stdout (S, atom(1)),
     get_output_stream_string (S));
(%o3)   "<math> <mn>1</mn><st> Enter </st><mi lisp="*var-tag*">atom</mi><st> </st><mrow list="true"><t lisp="mlist" listdelim="true">[</t><mrow><mn>1</mn></mrow><t lisp="mlist" listdelim="true">]</t></mrow><st></st><st></st></math><math> <mn>1</mn><st> Exit  </st><mi lisp="*var-tag*">atom</mi><st> </st><t lisp="true">true</t><st></st><st></st></math>"

should return:

1 Enter atom [1]
1 Exit  atom true

(from rtest_trace.mac. Both when using a current Maxima.)

gunterkoenigsmann commented 8 months ago

Found it:

In the maxima-code repo doc/implementation/external-interface.txt tells, that maxima offers two variables that allow to tell maxima how to format text: *alt-display1d* and *alt-display2d*.

wxMaxima sets *alt-display2d* to a function that outputs 2D maths in a XML flavour. Maxima therefore talks XML and should also know that it does.

The question now is: Should these tests now look like:

block([result,oldDisplay2d:?\*alt\-display2d\*],
    ?\*alt\-display2d\*:false,
    result:(kill(n),printf(false,"~m",(n!)!)),
    ?\*alt\-display2d\*:oldDisplay2d,
result);

or should printf temporarily bind these variables to nil or (in maxima's wording) false? I believe the first of two options to be the Right One.

daute commented 8 months ago

Fixed by the following commit in the Maxima project: https://sourceforge.net/p/maxima/code/ci/02dfab390ca3f523d3547d70b8380122888576c5/