Function: calc-store-binary

calc-store-binary is a byte-compiled function defined in calc-store.el.gz.

Signature

(calc-store-binary VAR TAG FUNC &optional VAL)

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-store.el.gz
(defun calc-store-binary (var tag func &optional val)
  (calc-wrapper
   (let ((calc-simplify-mode (if (eq calc-simplify-mode 'none)
				 'num calc-simplify-mode))
	 (value (or val (calc-top 1))))
     (or var (setq var (calc-read-var-name (format "Store %s: " tag))))
     (if var
	 (let ((old (calc-var-value var)))
	   (if (eq (car-safe old) 'special-const)
	       (error "\"%s\" is a special constant" (calc-var-name var)))
	   (if (not old)
               (if (memq var '(var-inf var-uinf var-nan))
                   (error "\"%s\" is a special variable" (calc-var-name var))
                 (error "No such variable: \"%s\"" (calc-var-name var))))
	   (if (stringp old)
	       (setq old (math-read-expr old)))
	   (if (eq (car-safe old) 'error)
	       (error "Bad format in variable contents: %s" (nth 2 old)))
	   (calc-store-value var
			     (calc-normalize (if (calc-is-inverse)
						 (list func value old)
					       (list func old value)))
			     tag (and (not val) 1))
	   (message "Variable \"%s\" changed" (calc-var-name var)))))))