summaryrefslogtreecommitdiff
path: root/lisp/calc
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2019-12-26 19:37:10 +0100
committerMattias EngdegÄrd <mattiase@acm.org>2019-12-26 19:37:10 +0100
commitcd559841537726315d72a303447140f71e34f635 (patch)
tree144f2d9569876ecadc816192ea5b24ed599ca5b2 /lisp/calc
parente8aa6f19e99e5de9a3953fef8ae50e2363531b3d (diff)
downloademacs-cd559841537726315d72a303447140f71e34f635.tar.gz
Calc: add missing dynamic variable declarations
* lisp/calc/calc-alg.el (math-simplify-only, calc-simplify-mode) (math-expand-formulas, calc-poly-div-remainder) (math-living-dangerously, math-simplifying, calc-angle-mode) (calc-prefer-frac, math-poly-base-variable): Declare dynamic variables. * test/lisp/calc/calc-tests.el (calc-poly-div): Add test for at least one bug caused by missing declarations.
Diffstat (limited to 'lisp/calc')
-rw-r--r--lisp/calc/calc-alg.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/lisp/calc/calc-alg.el b/lisp/calc/calc-alg.el
index c3efeeeb62c..4905a455aba 100644
--- a/lisp/calc/calc-alg.el
+++ b/lisp/calc/calc-alg.el
@@ -30,6 +30,8 @@
;;; Algebra commands.
+(defvar math-simplify-only)
+
(defun calc-alg-evaluate (arg)
(interactive "p")
(calc-slow-wrapper
@@ -38,6 +40,8 @@
(calc-modify-simplify-mode arg)
(calc-enter-result 1 "dsmp" (calc-top 1))))))
+(defvar calc-simplify-mode)
+
(defun calc-modify-simplify-mode (arg)
(if (= (math-abs arg) 2)
(setq calc-simplify-mode 'alg)
@@ -67,6 +71,8 @@
(calc-with-default-simplification
(calc-enter-result 1 "esmp" (math-simplify-extended (calc-top-n 1))))))
+(defvar math-expand-formulas)
+
(defun calc-expand-formula (arg)
(interactive "p")
(calc-slow-wrapper
@@ -160,6 +166,8 @@
(calc-binary-op "pgcd" 'calcFunc-pgcd arg)))
+(defvar calc-poly-div-remainder)
+
(defun calc-poly-div (arg)
(interactive "P")
(calc-slow-wrapper
@@ -303,6 +311,7 @@
(math-beforep (car a) (car b)))))
(t (string-lessp (car a) (car b)))))
+(defvar math-living-dangerously)
(defsubst math-simplify-extended (a)
(let ((math-living-dangerously t))
@@ -363,6 +372,9 @@
;; math-normalize-error is declared in calc.el.
(defvar math-normalize-error)
+(defvar math-simplifying)
+(defvar calc-angle-mode)
+
(defun math-simplify (top-expr)
(let ((math-simplifying t)
(calc-angle-mode (if (calc-input-angle-units top-expr)
@@ -677,6 +689,8 @@ and should return the simplified expression to use (or nil)."
(math-make-frac (math-gcd (nth 1 a) (nth 1 b))
(math-gcd (nth 2 a) (nth 2 b)))))))
+(defvar calc-prefer-frac)
+
(math-defsimplify %
(and (Math-realp (nth 2 expr))
(Math-posp (nth 2 expr))
@@ -1671,6 +1685,7 @@ and should return the simplified expression to use (or nil)."
(defvar math-is-poly-degree)
(defvar math-is-poly-loose)
(defvar math-var)
+(defvar math-poly-base-variable)
(defun math-is-polynomial (expr var &optional degree loose)
(let* ((math-poly-base-variable (if loose