This is the commit for a fiz of the WxMaxima debug issue.
[maxima.git] / share / contrib / smath / smath.lisp
blob2b49735bc2e840aeeea254efaa41da610dec1e19
1 ;; -*- mode: lisp -*-
2 ;; Copyright Leo Butler (leo.butler@member.fsf.org) 2013
3 ;; Released under the terms of GPLv2
5 (in-package :maxima)
7 (defvar *displa* (symbol-function 'displa))
8 (defvar *maxima-outchar* $outchar)
9 (defvar *smath-outchar* '$%s)
10 (defvar $sm_rules)
12 (defun $smath_displa (form &optional (sm-rules (if (boundp '$sm_rules) $sm_rules)))
13 "Display FORM by APPLY1-ing the rules in SM-RULES to the EXPR in FORM."
14 (declare (special $sm_rules *alt-display1d*))
15 (cond (sm-rules
16 (let ((rules (cdr sm-rules))
17 (*alt-display1d* nil)
18 (expr (third form)))
19 (funcall *displa*
20 (list (first form) (second form)
21 (dolist (rule rules expr)
22 (setf expr (mfuncall '$apply1 expr rule)))))))
24 ($to_mx_display)
25 (funcall *displa* form))))
27 (defun $to_sm_display ()
28 "Set-up Maxima to use SMATH_DISPLA to display output."
29 (declare (special *alt-display1d* $outchar *smath-outchar*))
30 (setf *alt-display1d* (symbol-function '$smath_displa)
31 $outchar *smath-outchar*))
33 (defun $to_mx_display ()
34 "Return Maxima to use standard DISPLA for 1d output."
35 (declare (special *alt-display1d* $outchar *maxima-outchar*))
36 (setf *alt-display1d* nil
37 $outchar *maxima-outchar*))
39 (defun $smkill (&optional s)
40 "Execute KILL(S), then re-LOAD smath and set display."
41 (mfuncall '$kill s)
42 (mfuncall '$load "smath.mac")
43 ($to_sm_display))
45 ; end of smath.lisp