diff options
| author | Jay Belanger | 2004-11-26 22:33:49 +0000 |
|---|---|---|
| committer | Jay Belanger | 2004-11-26 22:33:49 +0000 |
| commit | 866ebaa9050adcc75b2c6f057b35266dafce41b4 (patch) | |
| tree | c5f399a63f88c959dd3cb19c5557cc186f18dbfc | |
| parent | f58af89963db89986cc4db8c9a06bc1cfbf59e16 (diff) | |
| download | emacs-866ebaa9050adcc75b2c6f057b35266dafce41b4.tar.gz emacs-866ebaa9050adcc75b2c6f057b35266dafce41b4.zip | |
(math-grade-vec): New variable.
(calcFunc-grade, calcFunc-rgrade, math-grade-beforep): Replace
variable grade-vec by declared variable.
(math-rb-close): New variable.
(math-read-brackets, math-read-vector): Replace variable close by
declared variable.
| -rw-r--r-- | lisp/calc/calc-vec.el | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/lisp/calc/calc-vec.el b/lisp/calc/calc-vec.el index a78f98ec3cc..0999fae52a3 100644 --- a/lisp/calc/calc-vec.el +++ b/lisp/calc/calc-vec.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 | ||
| @@ -1101,21 +1100,26 @@ | |||
| 1101 | (cons 'vec (nreverse (sort (copy-sequence (cdr vec)) 'math-beforep))) | 1100 | (cons 'vec (nreverse (sort (copy-sequence (cdr vec)) 'math-beforep))) |
| 1102 | (math-reject-arg vec 'vectorp))) | 1101 | (math-reject-arg vec 'vectorp))) |
| 1103 | 1102 | ||
| 1104 | (defun calcFunc-grade (grade-vec) | 1103 | ;; The variable math-grade-vec is local to calcFunc-grade and |
| 1105 | (if (math-vectorp grade-vec) | 1104 | ;; calcFunc-rgrade, but is used by math-grade-beforep, which is called |
| 1106 | (let* ((len (1- (length grade-vec)))) | 1105 | ;; by calcFunc-grade and calcFunc-rgrade. |
| 1106 | (defvar math-grade-vec) | ||
| 1107 | |||
| 1108 | (defun calcFunc-grade (math-grade-vec) | ||
| 1109 | (if (math-vectorp math-grade-vec) | ||
| 1110 | (let* ((len (1- (length math-grade-vec)))) | ||
| 1107 | (cons 'vec (sort (cdr (calcFunc-index len)) 'math-grade-beforep))) | 1111 | (cons 'vec (sort (cdr (calcFunc-index len)) 'math-grade-beforep))) |
| 1108 | (math-reject-arg grade-vec 'vectorp))) | 1112 | (math-reject-arg math-grade-vec 'vectorp))) |
| 1109 | 1113 | ||
| 1110 | (defun calcFunc-rgrade (grade-vec) | 1114 | (defun calcFunc-rgrade (math-grade-vec) |
| 1111 | (if (math-vectorp grade-vec) | 1115 | (if (math-vectorp math-grade-vec) |
| 1112 | (let* ((len (1- (length grade-vec)))) | 1116 | (let* ((len (1- (length math-grade-vec)))) |
| 1113 | (cons 'vec (nreverse (sort (cdr (calcFunc-index len)) | 1117 | (cons 'vec (nreverse (sort (cdr (calcFunc-index len)) |
| 1114 | 'math-grade-beforep)))) | 1118 | 'math-grade-beforep)))) |
| 1115 | (math-reject-arg grade-vec 'vectorp))) | 1119 | (math-reject-arg math-grade-vec 'vectorp))) |
| 1116 | 1120 | ||
| 1117 | (defun math-grade-beforep (i j) | 1121 | (defun math-grade-beforep (i j) |
| 1118 | (math-beforep (nth i grade-vec) (nth j grade-vec))) | 1122 | (math-beforep (nth i math-grade-vec) (nth j math-grade-vec))) |
| 1119 | 1123 | ||
| 1120 | 1124 | ||
| 1121 | ;;; Compile a histogram of data from a vector. | 1125 | ;;; Compile a histogram of data from a vector. |
| @@ -1461,14 +1465,17 @@ | |||
| 1461 | 1465 | ||
| 1462 | 1466 | ||
| 1463 | 1467 | ||
| 1468 | ;; The variable math-rb-close is local to math-read-brackets, but | ||
| 1469 | ;; is used by math-read-vector, which is called (directly and | ||
| 1470 | ;; indirectly) by math-read-brackets. | ||
| 1471 | (defvar math-rb-close) | ||
| 1464 | 1472 | ||
| 1465 | 1473 | (defun math-read-brackets (space-sep math-rb-close) | |
| 1466 | (defun math-read-brackets (space-sep close) | ||
| 1467 | (and space-sep (setq space-sep (not (math-check-for-commas)))) | 1474 | (and space-sep (setq space-sep (not (math-check-for-commas)))) |
| 1468 | (math-read-token) | 1475 | (math-read-token) |
| 1469 | (while (eq math-exp-token 'space) | 1476 | (while (eq math-exp-token 'space) |
| 1470 | (math-read-token)) | 1477 | (math-read-token)) |
| 1471 | (if (or (equal math-expr-data close) | 1478 | (if (or (equal math-expr-data math-rb-close) |
| 1472 | (eq math-exp-token 'end)) | 1479 | (eq math-exp-token 'end)) |
| 1473 | (progn | 1480 | (progn |
| 1474 | (math-read-token) | 1481 | (math-read-token) |
| @@ -1495,7 +1502,7 @@ | |||
| 1495 | (setq vals2 (catch 'syntax (math-read-vector)))) | 1502 | (setq vals2 (catch 'syntax (math-read-vector)))) |
| 1496 | (if (and (not (stringp vals2)) | 1503 | (if (and (not (stringp vals2)) |
| 1497 | (or (assoc math-expr-data '(("\\ldots") ("\\dots") (";"))) | 1504 | (or (assoc math-expr-data '(("\\ldots") ("\\dots") (";"))) |
| 1498 | (equal math-expr-data close) | 1505 | (equal math-expr-data math-rb-close) |
| 1499 | (eq math-exp-token 'end))) | 1506 | (eq math-exp-token 'end))) |
| 1500 | (setq space-sep nil | 1507 | (setq space-sep nil |
| 1501 | vals vals2) | 1508 | vals vals2) |
| @@ -1509,7 +1516,7 @@ | |||
| 1509 | (math-read-token) | 1516 | (math-read-token) |
| 1510 | (setq vals (if (> (length vals) 2) | 1517 | (setq vals (if (> (length vals) 2) |
| 1511 | (cons 'calcFunc-mul (cdr vals)) (nth 1 vals))) | 1518 | (cons 'calcFunc-mul (cdr vals)) (nth 1 vals))) |
| 1512 | (let ((exp2 (if (or (equal math-expr-data close) | 1519 | (let ((exp2 (if (or (equal math-expr-data math-rb-close) |
| 1513 | (equal math-expr-data ")") | 1520 | (equal math-expr-data ")") |
| 1514 | (eq math-exp-token 'end)) | 1521 | (eq math-exp-token 'end)) |
| 1515 | '(var inf var-inf) | 1522 | '(var inf var-inf) |
| @@ -1519,14 +1526,14 @@ | |||
| 1519 | (if (equal math-expr-data ")") 2 3) | 1526 | (if (equal math-expr-data ")") 2 3) |
| 1520 | vals | 1527 | vals |
| 1521 | exp2))) | 1528 | exp2))) |
| 1522 | (if (not (or (equal math-expr-data close) | 1529 | (if (not (or (equal math-expr-data math-rb-close) |
| 1523 | (equal math-expr-data ")") | 1530 | (equal math-expr-data ")") |
| 1524 | (eq math-exp-token 'end))) | 1531 | (eq math-exp-token 'end))) |
| 1525 | (throw 'syntax "Expected `]'"))) | 1532 | (throw 'syntax "Expected `]'"))) |
| 1526 | (if (equal math-expr-data ";") | 1533 | (if (equal math-expr-data ";") |
| 1527 | (let ((math-exp-keep-spaces space-sep)) | 1534 | (let ((math-exp-keep-spaces space-sep)) |
| 1528 | (setq vals (cons 'vec (math-read-matrix (list vals)))))) | 1535 | (setq vals (cons 'vec (math-read-matrix (list vals)))))) |
| 1529 | (if (not (or (equal math-expr-data close) | 1536 | (if (not (or (equal math-expr-data math-rb-close) |
| 1530 | (eq math-exp-token 'end))) | 1537 | (eq math-exp-token 'end))) |
| 1531 | (throw 'syntax "Expected `]'"))) | 1538 | (throw 'syntax "Expected `]'"))) |
| 1532 | (or (eq math-exp-token 'end) | 1539 | (or (eq math-exp-token 'end) |
| @@ -1557,7 +1564,7 @@ | |||
| 1557 | (math-read-token)) | 1564 | (math-read-token)) |
| 1558 | (and (not (eq math-exp-token 'end)) | 1565 | (and (not (eq math-exp-token 'end)) |
| 1559 | (not (equal math-expr-data ";")) | 1566 | (not (equal math-expr-data ";")) |
| 1560 | (not (equal math-expr-data close)) | 1567 | (not (equal math-expr-data math-rb-close)) |
| 1561 | (not (equal math-expr-data "\\dots")) | 1568 | (not (equal math-expr-data "\\dots")) |
| 1562 | (not (equal math-expr-data "\\ldots")))) | 1569 | (not (equal math-expr-data "\\ldots")))) |
| 1563 | (if (equal math-expr-data ",") | 1570 | (if (equal math-expr-data ",") |