Function: calc-do-calc-eval
calc-do-calc-eval is an autoloaded and byte-compiled function defined
in calc-aent.el.gz.
Signature
(calc-do-calc-eval STR SEPARATOR ARGS)
Source Code
;; Defined in /usr/src/emacs/lisp/calc/calc-aent.el.gz
;;;###autoload
(defun calc-do-calc-eval (str separator args)
(calc-check-defines)
(catch 'calc-error
(save-excursion
(calc-create-buffer)
(cond
((and (consp str) (not (symbolp (car str))))
(let ((calc-language nil)
(math-expr-opers (math-standard-ops))
(calc-internal-prec 12)
(calc-word-size 32)
(calc-symbolic-mode nil)
(calc-matrix-mode nil)
(calc-angle-mode 'deg)
(calc-number-radix 10)
(calc-twos-complement-mode nil)
(calc-leading-zeros nil)
(calc-group-digits nil)
(calc-point-char ".")
(calc-frac-format '(":" nil))
(calc-prefer-frac nil)
(calc-hms-format "%s@ %s' %s\"")
(calc-date-format '((H ":" mm C SS pp " ")
Www " " Mmm " " D ", " YYYY))
(calc-float-format '(float 0))
(calc-full-float-format '(float 0))
(calc-complex-format nil)
(calc-matrix-just nil)
(calc-full-vectors t)
(calc-break-vectors nil)
(calc-vector-commas ",")
(calc-vector-brackets "[]")
(calc-matrix-brackets '(R O))
(calc-complex-mode 'cplx)
(calc-infinite-mode nil)
(calc-display-strings nil)
(calc-simplify-mode nil)
(calc-display-working-message 'lots)
(strp (cdr str)))
(while strp
(set (car strp) (nth 1 strp))
(setq strp (cdr (cdr strp))))
(calc-do-calc-eval (car str) separator args)))
((eq separator 'eval)
(eval str t))
((eq separator 'macro)
(require 'calc-ext)
(let* ((calc-buffer (current-buffer))
(calc-window (get-buffer-window calc-buffer))
(save-window (selected-window)))
(if calc-window
(unwind-protect
(progn
(select-window calc-window)
(calc-execute-kbd-macro str nil (car args)))
(and (window-point save-window)
(select-window save-window)))
(save-window-excursion
(select-window (get-largest-window))
(switch-to-buffer calc-buffer)
(calc-execute-kbd-macro str nil (car args)))))
nil)
((eq separator 'pop)
(or (not (integerp str))
(= str 0)
(calc-pop (min str (calc-stack-size))))
(calc-stack-size))
((eq separator 'top)
(and (integerp str)
(> str 0)
(<= str (calc-stack-size))
(math-format-value (calc-top-n str (car args)) 1000)))
((eq separator 'rawtop)
(and (integerp str)
(> str 0)
(<= str (calc-stack-size))
(calc-top-n str (car args))))
(t
(let* ((calc-command-flags nil)
(calc-next-why nil)
(calc-language (if (memq calc-language '(nil big))
'flat calc-language))
(calc-dollar-values (mapcar
(lambda (x)
(if (stringp x)
(progn
(setq x (math-read-exprs x))
(if (eq (car-safe x)
'error)
(throw 'calc-error
(calc-eval-error
(cdr x)))
(car x)))
x))
args))
(calc-dollar-used 0)
(res (if (stringp str)
(math-read-exprs str)
(list str)))
buf)
(if (eq (car res) 'error)
(calc-eval-error (cdr res))
(setq res (mapcar 'calc-normalize res))
(and (memq 'clear-message calc-command-flags)
(message ""))
(cond ((eq separator 'pred)
(require 'calc-ext)
(if (= (length res) 1)
(math-is-true (car res))
(calc-eval-error '(0 "Single value expected"))))
((eq separator 'raw)
(if (= (length res) 1)
(car res)
(calc-eval-error '(0 "Single value expected"))))
((eq separator 'list)
res)
((memq separator '(num rawnum))
(if (= (length res) 1)
(if (math-constp (car res))
(if (eq separator 'num)
(math-format-value (car res) 1000)
(car res))
(calc-eval-error
(list 0
(if calc-next-why
(calc-explain-why (car calc-next-why))
"Number expected"))))
(calc-eval-error '(0 "Single value expected"))))
((eq separator 'push)
(calc-push-list res)
nil)
(t (while res
(setq buf (concat buf
(and buf (or separator ", "))
(math-format-value (car res) 1000))
res (cdr res)))
buf)))))))))