slatec error message surpression?



On Fri, Oct 7, 2011 at 8:49 AM, Raymond Toy <toy.raymond at gmail.com> wrote:

>
>
> I will look into suppressing the slatec messages.
>

Stick the following in, say, j4save.lisp:

(in-package :maxima)

 (defun quad-j4save (parameter &optional new-value)
  (values (slatec::j4save (case parameter
                ($current_error 1)
                ($control 2)
                ($max_message 4))
              (or new-value 0)
              (if new-value t nil))))

(defun $quad_j4save (parameter &optional new-value)
  (quad-j4save parameter new-value))

And then :lisp (load "j4save.lisp").  Here is an example:

(%i15) quad_qags((x-2)^2*sin(4000*x),x,2,3);
 ***MESSAGE FROM ROUTINE DQAGS IN LIBRARY SLATEC.
 ***INFORMATIVE MESSAGE, PROG CONTINUES, TRACEBACK REQUESTED
 *  ABNORMAL RETURN
 *  ERROR NUMBER = 1
 *
 ***END OF MESSAGE

(%o15)      [- 1.6023580453445135e-4, .005299669215071409, 8379, 1]
(%i16) quad_j4save('control, 0);
(%o16)                                 2
(%i17) quad_qags((x-2)^2*sin(4000*x),x,2,3);
(%o17)      [- 1.6023580453445135e-4, .005299669215071409, 8379, 1]
(%i18) quad_j4save('current_error);
(%o18)                                 1
(%i19) quad_j4save('control);
(%o19)                                 0

So setting 'control to 0 suppresses the output, and quad_j4save returns the
previous value of the 'control flag.  'current_error returns the current
error number.

This is not the greatest interface, but it works.  Suggestions welcome on a
better interface (and name).

Ray