1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-04 02:51:31 -08:00

calc/calc-prog.el

calc/calc-graph.el
calc/calc-map.el: Change `arglist' to `math-arglist' throughout.
This commit is contained in:
Jay Belanger 2011-01-20 21:48:26 -06:00
parent a10c414934
commit 26d82c3ad3
4 changed files with 45 additions and 39 deletions

View file

@ -1,3 +1,9 @@
2011-01-21 Jay Belanger <jay.p.belanger@gmail.com>
* calc/calc-prog.el
calc/calc-graph.el
calc/calc-map.el: Change `arglist' to `math-arglist' throughout.
2011-01-21 Štěpán Němec <stepnem@gmail.com> (tiny change) 2011-01-21 Štěpán Němec <stepnem@gmail.com> (tiny change)
* calc/calc-ext.el (calc-init-extensions): Map all `undo' * calc/calc-ext.el (calc-init-extensions): Map all `undo'

View file

@ -575,16 +575,16 @@
(setq calc-graph-xstep 1) (setq calc-graph-xstep 1)
(error "%s is not a suitable basis for %s" calc-graph-xname calc-graph-yname))))) (error "%s is not a suitable basis for %s" calc-graph-xname calc-graph-yname)))))
(or (math-realp calc-graph-yvalue) (or (math-realp calc-graph-yvalue)
(let ((arglist nil)) (let ((math-arglist nil))
(setq calc-graph-yvalue (math-evaluate-expr calc-graph-yvalue)) (setq calc-graph-yvalue (math-evaluate-expr calc-graph-yvalue))
(calc-default-formula-arglist calc-graph-yvalue) (calc-default-formula-arglist calc-graph-yvalue)
(or arglist (or math-arglist
(error "%s does not contain any unassigned variables" calc-graph-yname)) (error "%s does not contain any unassigned variables" calc-graph-yname))
(and (cdr arglist) (and (cdr math-arglist)
(error "%s contains more than one variable: %s" (error "%s contains more than one variable: %s"
calc-graph-yname arglist)) calc-graph-yname math-arglist))
(setq calc-graph-yvalue (math-expr-subst calc-graph-yvalue (setq calc-graph-yvalue (math-expr-subst calc-graph-yvalue
(math-build-var-name (car arglist)) (math-build-var-name (car math-arglist))
'(var DUMMY var-DUMMY))))) '(var DUMMY var-DUMMY)))))
(setq calc-graph-ycache (assoc calc-graph-yvalue calc-graph-data-cache)) (setq calc-graph-ycache (assoc calc-graph-yvalue calc-graph-data-cache))
(delq calc-graph-ycache calc-graph-data-cache) (delq calc-graph-ycache calc-graph-data-cache)
@ -736,17 +736,17 @@
calc-graph-zp calc-graph-yvalue calc-graph-zp calc-graph-yvalue
calc-graph-xvec t)) calc-graph-xvec t))
(or (math-realp calc-graph-yvalue) (or (math-realp calc-graph-yvalue)
(let ((arglist nil)) (let ((math-arglist nil))
(setq calc-graph-yvalue (math-evaluate-expr calc-graph-yvalue)) (setq calc-graph-yvalue (math-evaluate-expr calc-graph-yvalue))
(calc-default-formula-arglist calc-graph-yvalue) (calc-default-formula-arglist calc-graph-yvalue)
(setq arglist (sort arglist 'string-lessp)) (setq math-arglist (sort math-arglist 'string-lessp))
(or (cdr arglist) (or (cdr math-arglist)
(error "%s does not contain enough unassigned variables" calc-graph-yname)) (error "%s does not contain enough unassigned variables" calc-graph-yname))
(and (cdr (cdr arglist)) (and (cdr (cdr math-arglist))
(error "%s contains too many variables: %s" calc-graph-yname arglist)) (error "%s contains too many variables: %s" calc-graph-yname math-arglist))
(setq calc-graph-yvalue (math-multi-subst calc-graph-yvalue (setq calc-graph-yvalue (math-multi-subst calc-graph-yvalue
(mapcar 'math-build-var-name (mapcar 'math-build-var-name
arglist) math-arglist)
'((var DUMMY var-DUMMY) '((var DUMMY var-DUMMY)
(var DUMMY2 var-DUMMY2)))))) (var DUMMY2 var-DUMMY2))))))
(if (setq calc-graph-xvec (eq (car-safe calc-graph-xvalue) 'vec)) (if (setq calc-graph-xvec (eq (car-safe calc-graph-xvalue) 'vec))

View file

@ -572,7 +572,7 @@
(and nargs forcenargs (/= nargs forcenargs) (>= nargs 0) (and nargs forcenargs (/= nargs forcenargs) (>= nargs 0)
(error "Must be a %d-argument operator" nargs))) (error "Must be a %d-argument operator" nargs)))
((memq key '(?\$ ?\')) ((memq key '(?\$ ?\'))
(let* ((arglist nil) (let* ((math-arglist nil)
(has-args nil) (has-args nil)
(record-entry nil) (record-entry nil)
(expr (if (eq key ?\$) (expr (if (eq key ?\$)
@ -592,13 +592,13 @@
(if (> calc-dollar-used 0) (if (> calc-dollar-used 0)
(progn (progn
(setq has-args calc-dollar-used (setq has-args calc-dollar-used
arglist (calc-invent-args has-args)) math-arglist (calc-invent-args has-args))
(math-multi-subst (car func) (math-multi-subst (car func)
(reverse arglist) (reverse math-arglist)
arglist)) math-arglist))
(if (> calc-hashes-used 0) (if (> calc-hashes-used 0)
(setq has-args calc-hashes-used (setq has-args calc-hashes-used
arglist (calc-invent-args has-args))) math-arglist (calc-invent-args has-args)))
(car func)))))) (car func))))))
(if (eq (car-safe expr) 'calcFunc-lambda) (if (eq (car-safe expr) 'calcFunc-lambda)
(setq oper (list "$" (- (length expr) 2) expr) (setq oper (list "$" (- (length expr) 2) expr)
@ -607,16 +607,16 @@
(progn (progn
(calc-default-formula-arglist expr) (calc-default-formula-arglist expr)
(setq record-entry t (setq record-entry t
arglist (sort arglist 'string-lessp)) math-arglist (sort math-arglist 'string-lessp))
(if calc-verify-arglist (if calc-verify-arglist
(setq arglist (read-from-minibuffer (setq math-arglist (read-from-minibuffer
"Function argument list: " "Function argument list: "
(if arglist (if math-arglist
(prin1-to-string arglist) (prin1-to-string math-arglist)
"()") "()")
minibuffer-local-map minibuffer-local-map
t))) t)))
(setq arglist (mapcar (function (setq math-arglist (mapcar (function
(lambda (x) (lambda (x)
(list 'var (list 'var
x x
@ -624,10 +624,10 @@
(concat (concat
"var-" "var-"
(symbol-name x)))))) (symbol-name x))))))
arglist)))) math-arglist))))
(setq oper (list "$" (setq oper (list "$"
(length arglist) (length math-arglist)
(append '(calcFunc-lambda) arglist (append '(calcFunc-lambda) math-arglist
(list expr))) (list expr)))
done t)) done t))
(if record-entry (if record-entry

View file

@ -171,17 +171,17 @@
(interactive) (interactive)
(calc-wrapper (calc-wrapper
(let* ((form (calc-top 1)) (let* ((form (calc-top 1))
(arglist nil) (math-arglist nil)
(is-lambda (and (eq (car-safe form) 'calcFunc-lambda) (is-lambda (and (eq (car-safe form) 'calcFunc-lambda)
(>= (length form) 2))) (>= (length form) 2)))
odef key keyname cmd cmd-base cmd-base-default odef key keyname cmd cmd-base cmd-base-default
func calc-user-formula-alist is-symb) func calc-user-formula-alist is-symb)
(if is-lambda (if is-lambda
(setq arglist (mapcar (function (lambda (x) (nth 1 x))) (setq math-arglist (mapcar (function (lambda (x) (nth 1 x)))
(nreverse (cdr (reverse (cdr form))))) (nreverse (cdr (reverse (cdr form)))))
form (nth (1- (length form)) form)) form (nth (1- (length form)) form))
(calc-default-formula-arglist form) (calc-default-formula-arglist form)
(setq arglist (sort arglist 'string-lessp))) (setq math-arglist (sort math-arglist 'string-lessp)))
(message "Define user key: z-") (message "Define user key: z-")
(setq key (read-char)) (setq key (read-char))
(if (= (calc-user-function-classify key) 0) (if (= (calc-user-function-classify key) 0)
@ -267,17 +267,17 @@
(format "%05d" (% (random) 10000))))))) (format "%05d" (% (random) 10000)))))))
(if is-lambda (if is-lambda
(setq calc-user-formula-alist arglist) (setq calc-user-formula-alist math-arglist)
(while (while
(progn (progn
(setq calc-user-formula-alist (setq calc-user-formula-alist
(read-from-minibuffer "Function argument list: " (read-from-minibuffer "Function argument list: "
(if arglist (if math-arglist
(prin1-to-string arglist) (prin1-to-string math-arglist)
"()") "()")
minibuffer-local-map minibuffer-local-map
t)) t))
(and (not (calc-subsetp calc-user-formula-alist arglist)) (and (not (calc-subsetp calc-user-formula-alist math-arglist))
(not (y-or-n-p (not (y-or-n-p
"Okay for arguments that don't appear in formula to be ignored? ")))))) "Okay for arguments that don't appear in formula to be ignored? "))))))
(setq is-symb (and calc-user-formula-alist (setq is-symb (and calc-user-formula-alist
@ -328,14 +328,14 @@
(setcdr kmap (cons (cons key cmd) (cdr kmap))))))) (setcdr kmap (cons (cons key cmd) (cdr kmap)))))))
(message ""))) (message "")))
(defvar arglist) ; dynamically bound in all callers (defvar math-arglist) ; dynamically bound in all callers
(defun calc-default-formula-arglist (form) (defun calc-default-formula-arglist (form)
(if (consp form) (if (consp form)
(if (eq (car form) 'var) (if (eq (car form) 'var)
(if (or (memq (nth 1 form) arglist) (if (or (memq (nth 1 form) math-arglist)
(math-const-var form)) (math-const-var form))
() ()
(setq arglist (cons (nth 1 form) arglist))) (setq math-arglist (cons (nth 1 form) math-arglist)))
(calc-default-formula-arglist-step (cdr form))))) (calc-default-formula-arglist-step (cdr form)))))
(defun calc-default-formula-arglist-step (l) (defun calc-default-formula-arglist-step (l)
@ -394,23 +394,23 @@
(intern (concat "calcFunc-" x)))))))) (intern (concat "calcFunc-" x))))))))
(comps (get func 'math-compose-forms)) (comps (get func 'math-compose-forms))
entry entry2 entry entry2
(arglist nil) (math-arglist nil)
(calc-user-formula-alist nil)) (calc-user-formula-alist nil))
(if (math-zerop comp) (if (math-zerop comp)
(if (setq entry (assq calc-language comps)) (if (setq entry (assq calc-language comps))
(put func 'math-compose-forms (delq entry comps))) (put func 'math-compose-forms (delq entry comps)))
(calc-default-formula-arglist comp) (calc-default-formula-arglist comp)
(setq arglist (sort arglist 'string-lessp)) (setq math-arglist (sort math-arglist 'string-lessp))
(while (while
(progn (progn
(setq calc-user-formula-alist (setq calc-user-formula-alist
(read-from-minibuffer "Composition argument list: " (read-from-minibuffer "Composition argument list: "
(if arglist (if math-arglist
(prin1-to-string arglist) (prin1-to-string math-arglist)
"()") "()")
minibuffer-local-map minibuffer-local-map
t)) t))
(and (not (calc-subsetp calc-user-formula-alist arglist)) (and (not (calc-subsetp calc-user-formula-alist math-arglist))
(y-or-n-p (y-or-n-p
"Okay for arguments that don't appear in formula to be invisible? ")))) "Okay for arguments that don't appear in formula to be invisible? "))))
(or (setq entry (assq calc-language comps)) (or (setq entry (assq calc-language comps))