# HG changeset patch # User Jay Belanger # Date 1101528442 0 # Node ID cddffb5e15f3e412eb141989dde0cf4777164e2b # Parent f93cbf2ac53cec75438977e51b80a66f82487579 (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. diff -r f93cbf2ac53c -r cddffb5e15f3 lisp/calc/calc-aent.el --- a/lisp/calc/calc-aent.el Sat Nov 27 01:09:08 2004 +0000 +++ b/lisp/calc/calc-aent.el Sat Nov 27 04:07:22 2004 +0000 @@ -240,9 +240,14 @@ res (cdr res))) buf))))))))) +(defvar calc-eval-error nil + "Determines how calc handles errors. +NIL means return a list containing the character position of error. +STRING means return error message as string rather than list. +T means abort and give an error message.") + (defun calc-eval-error (msg) - (if (and (boundp 'calc-eval-error) - calc-eval-error) + (if calc-eval-error (if (eq calc-eval-error 'string) (nth 1 msg) (error "%s" (nth 1 msg))) @@ -385,6 +390,8 @@ (and (> (length calc-alg-exp) 0) (setq calc-previous-alg-entry calc-alg-exp)) (exit-minibuffer))) +(defvar calc-buffer) + (defun calcAlg-enter () (interactive) (let* ((str (minibuffer-contents)) @@ -442,6 +449,10 @@ ((eq last-command-char ?@) "0@ ") (t (char-to-string last-command-char))))) +;; The variable calc-digit-value is initially declared in calc.el, +;; but can be set by calcDigit-algebraic and calcDigit-edit. +(defvar calc-digit-value) + (defun calcDigit-algebraic () (interactive) (if (calc-minibuffer-contains ".*[@oh] *[^'m ]+[^'m]*\\'") @@ -458,14 +469,15 @@ ;;; Algebraic expression parsing. [Public] -;;; The next few variables are local to math-read-exprs (and math-read-expr) -;;; but are set in functions they call. +;; The next few variables are local to math-read-exprs (and math-read-expr +;; in calc-ext.el), but are set in functions they call. (defvar math-exp-pos) (defvar math-exp-str) (defvar math-exp-old-pos) (defvar math-exp-token) (defvar math-exp-keep-spaces) +(defvar math-expr-data) (defun math-read-exprs (math-exp-str) (let ((math-exp-pos 0) @@ -727,6 +739,9 @@ math-expr-data (char-to-string ch) math-exp-pos (1+ math-exp-pos))))))) +(defconst math-alg-inequalities + '(calcFunc-lt calcFunc-gt calcFunc-leq calcFunc-geq + calcFunc-eq calcFunc-neq)) (defun math-read-expr-level (exp-prec &optional exp-term) (let* ((x (math-read-factor)) (first t) op op2) @@ -941,10 +956,6 @@ matches "Failed")) matches)) -(defconst math-alg-inequalities - '(calcFunc-lt calcFunc-gt calcFunc-leq calcFunc-geq - calcFunc-eq calcFunc-neq)) - (defun math-remove-dashes (x) (if (string-match "\\`\\(.*\\)-\\(.*\\)\\'" x) (math-remove-dashes