1 |
;; Calculator for GNU Emacs, part II [calc-incom.el] |
;; Calculator for GNU Emacs, part II [calc-incom.el] |
2 |
;; Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc. |
;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc. |
3 |
;; Written by Dave Gillespie, daveg@synaptics.com. |
;; Written by Dave Gillespie, daveg@synaptics.com. |
4 |
|
|
5 |
;; This file is part of GNU Emacs. |
;; This file is part of GNU Emacs. |
36 |
(calc-wrapper |
(calc-wrapper |
37 |
(if (or calc-algebraic-mode calc-incomplete-algebraic-mode) |
(if (or calc-algebraic-mode calc-incomplete-algebraic-mode) |
38 |
(calc-alg-entry "(") |
(calc-alg-entry "(") |
39 |
(calc-push (list 'incomplete calc-complex-mode)))) |
(calc-push (list 'incomplete calc-complex-mode))))) |
|
) |
|
40 |
|
|
41 |
(defun calc-end-complex () |
(defun calc-end-complex () |
42 |
(interactive) |
(interactive) |
59 |
(if (not (and (math-realp (nth 2 top)) |
(if (not (and (math-realp (nth 2 top)) |
60 |
(math-anglep (nth 3 top)))) |
(math-anglep (nth 3 top)))) |
61 |
(error "Components must be real")) |
(error "Components must be real")) |
62 |
(calc-enter-result 1 "()" (cdr top))))) |
(calc-enter-result 1 "()" (cdr top)))))) |
|
) |
|
63 |
|
|
64 |
(defun calc-begin-vector () |
(defun calc-begin-vector () |
65 |
(interactive) |
(interactive) |
66 |
(calc-wrapper |
(calc-wrapper |
67 |
(if (or calc-algebraic-mode calc-incomplete-algebraic-mode) |
(if (or calc-algebraic-mode calc-incomplete-algebraic-mode) |
68 |
(calc-alg-entry "[") |
(calc-alg-entry "[") |
69 |
(calc-push '(incomplete vec)))) |
(calc-push '(incomplete vec))))) |
|
) |
|
70 |
|
|
71 |
(defun calc-end-vector () |
(defun calc-end-vector () |
72 |
(interactive) |
(interactive) |
85 |
(if (not (and (eq (car-safe top) 'incomplete) |
(if (not (and (eq (car-safe top) 'incomplete) |
86 |
(eq (nth 1 top) 'vec))) |
(eq (nth 1 top) 'vec))) |
87 |
(error "Not entering a vector")) |
(error "Not entering a vector")) |
88 |
(calc-pop-push-record 1 "[]" (cdr top))))) |
(calc-pop-push-record 1 "[]" (cdr top)))))) |
|
) |
|
89 |
|
|
90 |
(defun calc-comma (&optional allow-polar) |
(defun calc-comma (&optional allow-polar) |
91 |
(interactive) |
(interactive) |
117 |
(if (and (eq (nth 1 new) 'intv) |
(if (and (eq (nth 1 new) 'intv) |
118 |
(> (length new) 5)) |
(> (length new) 5)) |
119 |
(error "Too many components in interval form")) |
(error "Too many components in interval form")) |
120 |
(calc-pop-push num new)))) |
(calc-pop-push num new))))) |
|
) |
|
121 |
|
|
122 |
(defun calc-semi () |
(defun calc-semi () |
123 |
(interactive) |
(interactive) |
164 |
(calc-pop-push num |
(calc-pop-push num |
165 |
(list 'incomplete 'vec |
(list 'incomplete 'vec |
166 |
(cons 'vec (append (cdr (cdr inc)) stuff))) |
(cons 'vec (append (cdr (cdr inc)) stuff))) |
167 |
(list 'incomplete 'vec))))))) |
(list 'incomplete 'vec)))))))) |
|
) |
|
168 |
|
|
169 |
(defun calc-digit-dots () |
(defun calc-digit-dots () |
170 |
(if (eq calc-prev-char ?.) |
(if (eq calc-prev-char ?.) |
180 |
(erase-buffer) |
(erase-buffer) |
181 |
(exit-minibuffer))) |
(exit-minibuffer))) |
182 |
;; just ignore extra decimal point, anticipating ".." |
;; just ignore extra decimal point, anticipating ".." |
183 |
(delete-backward-char 1)) |
(delete-backward-char 1))) |
|
) |
|
184 |
|
|
185 |
(defun calc-dots () |
(defun calc-dots () |
186 |
(interactive) |
(interactive) |
201 |
(setq new (append new '((neg (var inf var-inf)))))) |
(setq new (append new '((neg (var inf var-inf)))))) |
202 |
(if (> (length new) 5) |
(if (> (length new) 5) |
203 |
(error "Too many components in interval form")) |
(error "Too many components in interval form")) |
204 |
(calc-pop-push num new)))) |
(calc-pop-push num new))))) |
|
) |
|
205 |
|
|
206 |
(defun calc-find-first-incomplete (stack n) |
(defun calc-find-first-incomplete (stack n) |
207 |
(cond ((null stack) |
(cond ((null stack) |
209 |
((eq (car-safe (car-safe (car stack))) 'incomplete) |
((eq (car-safe (car-safe (car stack))) 'incomplete) |
210 |
n) |
n) |
211 |
(t |
(t |
212 |
(calc-find-first-incomplete (cdr stack) (1+ n)))) |
(calc-find-first-incomplete (cdr stack) (1+ n))))) |
|
) |
|
213 |
|
|
214 |
(defun calc-incomplete-error (a) |
(defun calc-incomplete-error (a) |
215 |
(cond ((memq (nth 1 a) '(cplx polar)) |
(cond ((memq (nth 1 a) '(cplx polar)) |
218 |
(error "Vector is incomplete")) |
(error "Vector is incomplete")) |
219 |
((eq (nth 1 a) 'intv) |
((eq (nth 1 a) 'intv) |
220 |
(error "Interval form is incomplete")) |
(error "Interval form is incomplete")) |
221 |
(t (error "Object is incomplete"))) |
(t (error "Object is incomplete")))) |
|
) |
|
|
|
|
|
|
|
222 |
|
|
223 |
|
;;; calc-incom.el ends here |