aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Belanger2004-11-27 04:07:22 +0000
committerJay Belanger2004-11-27 04:07:22 +0000
commitd37f2979c6e5307ff17d9986cc644b1178e0ee06 (patch)
treea001954f767d082492378364f6f31ee1273cde1a
parente281182817bc5db0bc276861e19081254c2ddf51 (diff)
downloademacs-d37f2979c6e5307ff17d9986cc644b1178e0ee06.tar.gz
emacs-d37f2979c6e5307ff17d9986cc644b1178e0ee06.zip
(calc-eval-error): Declare and initialize the variable.
(calc-eval-error): Don't check if the variable calc-eval-error is bound. (calc-buffer, calc-digit-value, math-expr-data): Declare them. (math-alg-inequalities): Move declaration to earlier in the file.
-rw-r--r--lisp/calc/calc-aent.el27
1 files changed, 19 insertions, 8 deletions
diff --git a/lisp/calc/calc-aent.el b/lisp/calc/calc-aent.el
index a615ec50623..da4fab5b830 100644
--- a/lisp/calc/calc-aent.el
+++ b/lisp/calc/calc-aent.el
@@ -240,9 +240,14 @@
240 res (cdr res))) 240 res (cdr res)))
241 buf))))))))) 241 buf)))))))))
242 242
243(defvar calc-eval-error nil
244 "Determines how calc handles errors.
245NIL means return a list containing the character position of error.
246STRING means return error message as string rather than list.
247T means abort and give an error message.")
248
243(defun calc-eval-error (msg) 249(defun calc-eval-error (msg)
244 (if (and (boundp 'calc-eval-error) 250 (if calc-eval-error
245 calc-eval-error)
246 (if (eq calc-eval-error 'string) 251 (if (eq calc-eval-error 'string)
247 (nth 1 msg) 252 (nth 1 msg)
248 (error "%s" (nth 1 msg))) 253 (error "%s" (nth 1 msg)))
@@ -385,6 +390,8 @@
385 (and (> (length calc-alg-exp) 0) (setq calc-previous-alg-entry calc-alg-exp)) 390 (and (> (length calc-alg-exp) 0) (setq calc-previous-alg-entry calc-alg-exp))
386 (exit-minibuffer))) 391 (exit-minibuffer)))
387 392
393(defvar calc-buffer)
394
388(defun calcAlg-enter () 395(defun calcAlg-enter ()
389 (interactive) 396 (interactive)
390 (let* ((str (minibuffer-contents)) 397 (let* ((str (minibuffer-contents))
@@ -442,6 +449,10 @@
442 ((eq last-command-char ?@) "0@ ") 449 ((eq last-command-char ?@) "0@ ")
443 (t (char-to-string last-command-char))))) 450 (t (char-to-string last-command-char)))))
444 451
452;; The variable calc-digit-value is initially declared in calc.el,
453;; but can be set by calcDigit-algebraic and calcDigit-edit.
454(defvar calc-digit-value)
455
445(defun calcDigit-algebraic () 456(defun calcDigit-algebraic ()
446 (interactive) 457 (interactive)
447 (if (calc-minibuffer-contains ".*[@oh] *[^'m ]+[^'m]*\\'") 458 (if (calc-minibuffer-contains ".*[@oh] *[^'m ]+[^'m]*\\'")
@@ -458,14 +469,15 @@
458 469
459;;; Algebraic expression parsing. [Public] 470;;; Algebraic expression parsing. [Public]
460 471
461;;; The next few variables are local to math-read-exprs (and math-read-expr) 472;; The next few variables are local to math-read-exprs (and math-read-expr
462;;; but are set in functions they call. 473;; in calc-ext.el), but are set in functions they call.
463 474
464(defvar math-exp-pos) 475(defvar math-exp-pos)
465(defvar math-exp-str) 476(defvar math-exp-str)
466(defvar math-exp-old-pos) 477(defvar math-exp-old-pos)
467(defvar math-exp-token) 478(defvar math-exp-token)
468(defvar math-exp-keep-spaces) 479(defvar math-exp-keep-spaces)
480(defvar math-expr-data)
469 481
470(defun math-read-exprs (math-exp-str) 482(defun math-read-exprs (math-exp-str)
471 (let ((math-exp-pos 0) 483 (let ((math-exp-pos 0)
@@ -727,6 +739,9 @@
727 math-expr-data (char-to-string ch) 739 math-expr-data (char-to-string ch)
728 math-exp-pos (1+ math-exp-pos))))))) 740 math-exp-pos (1+ math-exp-pos)))))))
729 741
742(defconst math-alg-inequalities
743 '(calcFunc-lt calcFunc-gt calcFunc-leq calcFunc-geq
744 calcFunc-eq calcFunc-neq))
730 745
731(defun math-read-expr-level (exp-prec &optional exp-term) 746(defun math-read-expr-level (exp-prec &optional exp-term)
732 (let* ((x (math-read-factor)) (first t) op op2) 747 (let* ((x (math-read-factor)) (first t) op op2)
@@ -941,10 +956,6 @@
941 matches "Failed")) 956 matches "Failed"))
942 matches)) 957 matches))
943 958
944(defconst math-alg-inequalities
945 '(calcFunc-lt calcFunc-gt calcFunc-leq calcFunc-geq
946 calcFunc-eq calcFunc-neq))
947
948(defun math-remove-dashes (x) 959(defun math-remove-dashes (x)
949 (if (string-match "\\`\\(.*\\)-\\(.*\\)\\'" x) 960 (if (string-match "\\`\\(.*\\)-\\(.*\\)\\'" x)
950 (math-remove-dashes 961 (math-remove-dashes