diff options
| author | Jay Belanger | 2004-11-26 22:34:59 +0000 |
|---|---|---|
| committer | Jay Belanger | 2004-11-26 22:34:59 +0000 |
| commit | 32bac5ed0dc8baba35d65307ced9a5b63858a699 (patch) | |
| tree | a38fab7452c16f868511acc62618857f5b9bcf11 | |
| parent | 3f53a1f4df0e5691b4f3d9ac6ceeeb1e06a395cf (diff) | |
| download | emacs-32bac5ed0dc8baba35d65307ced9a5b63858a699.tar.gz emacs-32bac5ed0dc8baba35d65307ced9a5b63858a699.zip | |
(calc-flush-caches): Remove unnecessary variables.
(math-lud-cache, math-log2-cache, math-radix-digits-cache)
(math-radix-float-cache-tag, math-random-cache, math-max-digits-cache)
(math-integral-cache, math-units-table, math-format-date-cache)
(math-holidays-cache-tag): Declare them.
(math-moc-func): New variable.
(math-map-over-constants, math-map-over-constants-rec):
Replace variable func by declared variable.
| -rw-r--r-- | lisp/calc/calc-stuff.el | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/lisp/calc/calc-stuff.el b/lisp/calc/calc-stuff.el index 6b261398842..431e3eca19f 100644 --- a/lisp/calc/calc-stuff.el +++ b/lisp/calc/calc-stuff.el | |||
| @@ -3,8 +3,7 @@ | |||
| 3 | ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: David Gillespie <daveg@synaptics.com> | 5 | ;; Author: David Gillespie <daveg@synaptics.com> |
| 6 | ;; Maintainers: D. Goel <deego@gnufans.org> | 6 | ;; Maintainer: Jay Belanger <belanger@truman.edu> |
| 7 | ;; Colin Walters <walters@debian.org> | ||
| 8 | 7 | ||
| 9 | ;; This file is part of GNU Emacs. | 8 | ;; This file is part of GNU Emacs. |
| 10 | 9 | ||
| @@ -165,6 +164,18 @@ With a prefix, push that prefix as a number onto the stack." | |||
| 165 | (interactive) | 164 | (interactive) |
| 166 | (message "Calc %s" calc-version)) | 165 | (message "Calc %s" calc-version)) |
| 167 | 166 | ||
| 167 | ;; The following caches are declared in other files, but are | ||
| 168 | ;; reset here. | ||
| 169 | (defvar math-lud-cache) ; calc-mtx.el | ||
| 170 | (defvar math-log2-cache) ; calc-bin.el | ||
| 171 | (defvar math-radix-digits-cache) ; calc-bin.el | ||
| 172 | (defvar math-radix-float-cache-tag) ; calc-bin.el | ||
| 173 | (defvar math-random-cache) ; calc-comb.el | ||
| 174 | (defvar math-max-digits-cache) ; calc-bin.el | ||
| 175 | (defvar math-integral-cache) ; calcalg2.el | ||
| 176 | (defvar math-units-table) ; calc-units.el | ||
| 177 | (defvar math-format-date-cache) ; calc-forms.el | ||
| 178 | (defvar math-holidays-cache-tag) ; calc-forms.el | ||
| 168 | 179 | ||
| 169 | (defun calc-flush-caches (&optional inhibit-msg) | 180 | (defun calc-flush-caches (&optional inhibit-msg) |
| 170 | (interactive "P") | 181 | (interactive "P") |
| @@ -175,13 +186,10 @@ With a prefix, push that prefix as a number onto the stack." | |||
| 175 | math-radix-float-cache-tag nil | 186 | math-radix-float-cache-tag nil |
| 176 | math-random-cache nil | 187 | math-random-cache nil |
| 177 | math-max-digits-cache nil | 188 | math-max-digits-cache nil |
| 178 | math-checked-rewrites nil | ||
| 179 | math-integral-cache nil | 189 | math-integral-cache nil |
| 180 | math-units-table nil | 190 | math-units-table nil |
| 181 | math-decls-cache-tag nil | 191 | math-decls-cache-tag nil |
| 182 | math-eval-rules-cache-tag t | 192 | math-eval-rules-cache-tag t |
| 183 | math-graph-var-cache nil | ||
| 184 | math-graph-data-cache nil | ||
| 185 | math-format-date-cache nil | 193 | math-format-date-cache nil |
| 186 | math-holidays-cache-tag t) | 194 | math-holidays-cache-tag t) |
| 187 | (mapcar (function (lambda (x) (set x -100))) math-cache-list) | 195 | (mapcar (function (lambda (x) (set x -100))) math-cache-list) |
| @@ -270,17 +278,22 @@ With a prefix, push that prefix as a number onto the stack." | |||
| 270 | (math-map-over-constants (function (lambda (x) (calcFunc-frac x tol))) | 278 | (math-map-over-constants (function (lambda (x) (calcFunc-frac x tol))) |
| 271 | a)) | 279 | a)) |
| 272 | 280 | ||
| 273 | (defun math-map-over-constants (func expr) | 281 | ;; The variable math-moc-func is local to math-map-over-constants, |
| 282 | ;; but is used by math-map-over-constants-rec, which is called by | ||
| 283 | ;; math-map-over-constants. | ||
| 284 | (defvar math-moc-func) | ||
| 285 | |||
| 286 | (defun math-map-over-constants (math-moc-func expr) | ||
| 274 | (math-map-over-constants-rec expr)) | 287 | (math-map-over-constants-rec expr)) |
| 275 | 288 | ||
| 276 | (defun math-map-over-constants-rec (expr) | 289 | (defun math-map-over-constants-rec (expr) |
| 277 | (cond ((or (Math-primp expr) | 290 | (cond ((or (Math-primp expr) |
| 278 | (memq (car expr) '(intv sdev))) | 291 | (memq (car expr) '(intv sdev))) |
| 279 | (or (and (Math-objectp expr) | 292 | (or (and (Math-objectp expr) |
| 280 | (funcall func expr)) | 293 | (funcall math-moc-func expr)) |
| 281 | expr)) | 294 | expr)) |
| 282 | ((and (memq (car expr) '(^ calcFunc-subscr)) | 295 | ((and (memq (car expr) '(^ calcFunc-subscr)) |
| 283 | (eq func 'math-float) | 296 | (eq math-moc-func 'math-float) |
| 284 | (= (length expr) 3) | 297 | (= (length expr) 3) |
| 285 | (Math-integerp (nth 2 expr))) | 298 | (Math-integerp (nth 2 expr))) |
| 286 | (list (car expr) | 299 | (list (car expr) |