annotate lisp/calc/calc-store.el @ 97200:d53d10659659

commit patch to x-load-color-file posted by lekktu@gmail.com
author Adrian Robert <Adrian.B.Robert@gmail.com>
date Fri, 01 Aug 2008 15:33:15 +0000
parents 6c9af2bfcfee
children a9dc0e7c3f2b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
41271
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
1 ;;; calc-store.el --- value storage functions for Calc
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
2
64325
1db49616ce05 Update copyright information.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62442
diff changeset
3 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004,
79702
9754bb0422ed Add 2008 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 78215
diff changeset
4 ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
41271
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
5
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
6 ;; Author: David Gillespie <daveg@synaptics.com>
77465
1154f082efd9 Update maintainer's address.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 76595
diff changeset
7 ;; Maintainer: Jay Belanger <jay.p.belanger@gmail.com>
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
8
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
10
94654
6c9af2bfcfee Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
76595
497d17a80bb8 Change form of license text to match rest of Emacs.
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
94654
6c9af2bfcfee Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
13 ;; the Free Software Foundation, either version 3 of the License, or
6c9af2bfcfee Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
14 ;; (at your option) any later version.
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
15
76595
497d17a80bb8 Change form of license text to match rest of Emacs.
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
497d17a80bb8 Change form of license text to match rest of Emacs.
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
497d17a80bb8 Change form of license text to match rest of Emacs.
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
497d17a80bb8 Change form of license text to match rest of Emacs.
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
19 ;; GNU General Public License for more details.
497d17a80bb8 Change form of license text to match rest of Emacs.
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
20
497d17a80bb8 Change form of license text to match rest of Emacs.
Glenn Morris <rgm@gnu.org>
parents: 75346
diff changeset
21 ;; You should have received a copy of the GNU General Public License
94654
6c9af2bfcfee Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
23
41271
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
24 ;;; Commentary:
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
25
41271
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
26 ;;; Code:
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
27
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
28 ;; This file is autoloaded from calc-ext.el.
58673
202eaef4ca19 Add a provide statement.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58547
diff changeset
29
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
30 (require 'calc-ext)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
31 (require 'calc-macs)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
32
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
33 ;;; Memory commands.
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
34
41271
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
35 (defvar calc-store-keep nil)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
36 (defun calc-store (&optional var)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
37 (interactive)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
38 (let ((calc-store-keep t))
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
39 (calc-store-into var)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
40
41271
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
41 (defvar calc-given-value-flag nil)
58547
1e95f60dbab4 (calc-given-value, calc-store-opers): Declare them.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 52401
diff changeset
42 (defvar calc-given-value)
1e95f60dbab4 (calc-given-value, calc-store-opers): Declare them.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 52401
diff changeset
43
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
44 (defun calc-store-into (&optional var)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
45 (interactive)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
46 (calc-wrapper
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
47 (let ((calc-given-value nil)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
48 (calc-given-value-flag 1))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
49 (or var (setq var (calc-read-var-name "Store: " t)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
50 (if var
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
51 (let ((found (assq var '( ( + . calc-store-plus )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
52 ( - . calc-store-minus )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
53 ( * . calc-store-times )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
54 ( / . calc-store-div )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
55 ( ^ . calc-store-power )
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
56 ( | . calc-store-concat ) ))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
57 (if found
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
58 (funcall (cdr found))
62358
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
59 (let ((msg
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
60 (calc-store-value var (or calc-given-value (calc-top 1))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
61 "" calc-given-value-flag)))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
62 (message (concat "Stored to variable \"%s\"" msg)
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
63 (calc-var-name var)))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
64 (setq var (calc-is-assignments (calc-top 1)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
65 (if var
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
66 (while var
62358
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
67 (let ((msg
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
68 (calc-store-value (car (car var)) (cdr (car var))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
69 (if (not (cdr var)) "")
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
70 (if (not (cdr var)) 1))))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
71 (message (concat "Stored to variable \"%s\"" msg)
66157
9b54a8bf0ecf (calc-store-into): Get proper variable name to display in message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 65680
diff changeset
72 (calc-var-name (car (car var)))))
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
73 (setq var (cdr var))))))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
74
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
75 (defun calc-store-plus (&optional var)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
76 (interactive)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
77 (calc-store-binary var "+" '+))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
78
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
79 (defun calc-store-minus (&optional var)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
80 (interactive)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
81 (calc-store-binary var "-" '-))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
82
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
83 (defun calc-store-times (&optional var)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
84 (interactive)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
85 (calc-store-binary var "*" '*))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
86
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
87 (defun calc-store-div (&optional var)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
88 (interactive)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
89 (calc-store-binary var "/" '/))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
90
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
91 (defun calc-store-power (&optional var)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
92 (interactive)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
93 (calc-store-binary var "^" '^))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
94
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
95 (defun calc-store-concat (&optional var)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
96 (interactive)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
97 (calc-store-binary var "|" '|))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
98
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
99 (defun calc-store-neg (n &optional var)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
100 (interactive "p")
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
101 (calc-store-binary var "n" '/ (- n)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
102
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
103 (defun calc-store-inv (n &optional var)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
104 (interactive "p")
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
105 (calc-store-binary var "&" '^ (- n)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
106
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
107 (defun calc-store-incr (n &optional var)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
108 (interactive "p")
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
109 (calc-store-binary var "n" '- (- n)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
110
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
111 (defun calc-store-decr (n &optional var)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
112 (interactive "p")
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
113 (calc-store-binary var "n" '- n))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
114
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
115 (defun calc-store-value (var value tag &optional pop)
62358
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
116 (let ((msg ""))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
117 (if var
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
118 (let ((old (calc-var-value var)))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
119 (set var value)
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
120 (if pop (or calc-store-keep (calc-pop-stack pop)))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
121 (calc-record-undo (list 'store (symbol-name var) old))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
122 (if tag
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
123 (let ((calc-full-trail-vectors nil))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
124 (calc-record value (format ">%s%s" tag (calc-var-name var)))))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
125 (cond
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
126 ((and (memq var '(var-e var-i var-pi var-phi var-gamma))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
127 (eq (car-safe old) 'special-const))
84889
fa8470bb9f1a (calc-var-name-map): Use `mapc' rather than `mapcar'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78215
diff changeset
128 (setq msg (format " (Note: Built-in definition of %s has been lost)"
62358
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
129 (calc-var-name var))))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
130 ((and (memq var '(var-inf var-uinf var-nan))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
131 (null old))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
132 (setq msg (format " (Note: %s has built-in meanings which may interfere)"
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
133 (calc-var-name var)))))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
134 (calc-refresh-evaltos var)))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
135 msg))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
136
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
137 (defun calc-var-name (var)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
138 (if (symbolp var) (setq var (symbol-name var)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
139 (if (string-match "\\`var-." var)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
140 (substring var 4)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
141 var))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
142
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
143 (defun calc-store-binary (var tag func &optional val)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
144 (calc-wrapper
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
145 (let ((calc-simplify-mode (if (eq calc-simplify-mode 'none)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
146 'num calc-simplify-mode))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
147 (value (or val (calc-top 1))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
148 (or var (setq var (calc-read-var-name (format "Store %s: " tag))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
149 (if var
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
150 (let ((old (calc-var-value var)))
62358
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
151 (if (eq (car-safe old) 'special-const)
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
152 (error "\"%s\" is a special constant" (calc-var-name var)))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
153 (if (not old)
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
154 (if (memq var '(var-inf var-uinf var-nan))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
155 (error "\"%s\" is a special variable" (calc-var-name var))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
156 (error "No such variable: \"%s\"" (calc-var-name var))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
157 (if (stringp old)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
158 (setq old (math-read-expr old)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
159 (if (eq (car-safe old) 'error)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
160 (error "Bad format in variable contents: %s" (nth 2 old)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
161 (calc-store-value var
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
162 (calc-normalize (if (calc-is-inverse)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
163 (list func value old)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
164 (list func old value)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
165 tag (and (not val) 1))
62358
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
166 (message "Variable \"%s\" changed" (calc-var-name var)))))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
167
58547
1e95f60dbab4 (calc-given-value, calc-store-opers): Declare them.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 52401
diff changeset
168 (defvar calc-var-name-map nil "Keymap for reading Calc variable names.")
1e95f60dbab4 (calc-given-value, calc-store-opers): Declare them.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 52401
diff changeset
169 (if calc-var-name-map
1e95f60dbab4 (calc-given-value, calc-store-opers): Declare them.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 52401
diff changeset
170 ()
1e95f60dbab4 (calc-given-value, calc-store-opers): Declare them.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 52401
diff changeset
171 (setq calc-var-name-map (copy-keymap minibuffer-local-completion-map))
1e95f60dbab4 (calc-given-value, calc-store-opers): Declare them.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 52401
diff changeset
172 (define-key calc-var-name-map " " 'self-insert-command)
84889
fa8470bb9f1a (calc-var-name-map): Use `mapc' rather than `mapcar'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78215
diff changeset
173 (mapc (function
fa8470bb9f1a (calc-var-name-map): Use `mapc' rather than `mapcar'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78215
diff changeset
174 (lambda (x)
fa8470bb9f1a (calc-var-name-map): Use `mapc' rather than `mapcar'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78215
diff changeset
175 (define-key calc-var-name-map (char-to-string x)
fa8470bb9f1a (calc-var-name-map): Use `mapc' rather than `mapcar'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78215
diff changeset
176 'calcVar-digit)))
fa8470bb9f1a (calc-var-name-map): Use `mapc' rather than `mapcar'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78215
diff changeset
177 "0123456789")
fa8470bb9f1a (calc-var-name-map): Use `mapc' rather than `mapcar'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78215
diff changeset
178 (mapc (function
fa8470bb9f1a (calc-var-name-map): Use `mapc' rather than `mapcar'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78215
diff changeset
179 (lambda (x)
fa8470bb9f1a (calc-var-name-map): Use `mapc' rather than `mapcar'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78215
diff changeset
180 (define-key calc-var-name-map (char-to-string x)
fa8470bb9f1a (calc-var-name-map): Use `mapc' rather than `mapcar'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78215
diff changeset
181 'calcVar-oper)))
fa8470bb9f1a (calc-var-name-map): Use `mapc' rather than `mapcar'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78215
diff changeset
182 "+-*/^|"))
58547
1e95f60dbab4 (calc-given-value, calc-store-opers): Declare them.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 52401
diff changeset
183
1e95f60dbab4 (calc-given-value, calc-store-opers): Declare them.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 52401
diff changeset
184 (defvar calc-store-opers)
1e95f60dbab4 (calc-given-value, calc-store-opers): Declare them.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 52401
diff changeset
185
93262
ed8741f16e51 (calc-read-var-name-history): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87649
diff changeset
186 (defvar calc-read-var-name-history nil
ed8741f16e51 (calc-read-var-name-history): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87649
diff changeset
187 "History for reading variable names.")
ed8741f16e51 (calc-read-var-name-history): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87649
diff changeset
188
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
189 (defun calc-read-var-name (prompt &optional calc-store-opers)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
190 (setq calc-given-value nil
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
191 calc-aborted-prefix nil)
84889
fa8470bb9f1a (calc-var-name-map): Use `mapc' rather than `mapcar'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78215
diff changeset
192 (let ((var (concat
59090
ce01a490300d (calc-read-var-name): Remove initial "var-" from minibuffer.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58673
diff changeset
193 "var-"
ce01a490300d (calc-read-var-name): Remove initial "var-" from minibuffer.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58673
diff changeset
194 (let ((minibuffer-completion-table
84889
fa8470bb9f1a (calc-var-name-map): Use `mapc' rather than `mapcar'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78215
diff changeset
195 (mapcar (lambda (x) (substring x 4))
59090
ce01a490300d (calc-read-var-name): Remove initial "var-" from minibuffer.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58673
diff changeset
196 (all-completions "var-" obarray)))
84889
fa8470bb9f1a (calc-var-name-map): Use `mapc' rather than `mapcar'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78215
diff changeset
197 (minibuffer-completion-predicate
59090
ce01a490300d (calc-read-var-name): Remove initial "var-" from minibuffer.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58673
diff changeset
198 (lambda (x) (boundp (intern (concat "var-" x)))))
ce01a490300d (calc-read-var-name): Remove initial "var-" from minibuffer.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58673
diff changeset
199 (minibuffer-completion-confirm t))
93262
ed8741f16e51 (calc-read-var-name-history): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87649
diff changeset
200 (read-from-minibuffer
ed8741f16e51 (calc-read-var-name-history): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87649
diff changeset
201 prompt nil calc-var-name-map nil
ed8741f16e51 (calc-read-var-name-history): New variable.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 87649
diff changeset
202 'calc-read-var-name-history)))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
203 (setq calc-aborted-prefix "")
59090
ce01a490300d (calc-read-var-name): Remove initial "var-" from minibuffer.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58673
diff changeset
204 (and (not (equal var "var-"))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
205 (if (string-match "\\`\\([-a-zA-Z0-9]+\\) *:?=" var)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
206 (if (null calc-given-value-flag)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
207 (error "Assignment is not allowed in this command")
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
208 (let ((svar (intern (substring var 0 (match-end 1)))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
209 (setq calc-given-value-flag 0
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
210 calc-given-value (math-read-expr
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
211 (substring var (match-end 0))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
212 (if (eq (car-safe calc-given-value) 'error)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
213 (error "Bad format: %s" (nth 2 calc-given-value)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
214 (setq calc-given-value (math-evaluate-expr calc-given-value))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
215 svar))
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
216 (intern var)))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
217
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
218 (defun calcVar-digit ()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
219 (interactive)
59265
eb45d1b6dbc3 (calcVar-digit, calcVar-oper): Remove need for "var-" at the
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59211
diff changeset
220 (if (calc-minibuffer-contains "\\'")
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
221 (if (eq calc-store-opers 0)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
222 (beep)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
223 (insert "q")
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
224 (self-insert-and-exit))
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
225 (self-insert-command 1)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
226
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
227 (defun calcVar-oper ()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
228 (interactive)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
229 (if (and (eq calc-store-opers t)
59265
eb45d1b6dbc3 (calcVar-digit, calcVar-oper): Remove need for "var-" at the
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59211
diff changeset
230 (calc-minibuffer-contains "\\'"))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
231 (progn
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
232 (erase-buffer)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
233 (self-insert-and-exit))
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
234 (self-insert-command 1)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
235
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
236 (defun calc-store-map (&optional oper var)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
237 (interactive)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
238 (calc-wrapper
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
239 (let* ((sel-mode nil)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
240 (calc-dollar-values (mapcar 'calc-get-stack-element
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
241 (nthcdr calc-stack-top calc-stack)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
242 (calc-dollar-used 0)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
243 (oper (or oper (calc-get-operator "Store Mapping")))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
244 (nargs (car oper)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
245 (or var (setq var (calc-read-var-name (format "Store Mapping %s: "
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
246 (nth 2 oper)))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
247 (if var
62358
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
248 (let ((old (calc-var-value var)))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
249 (if (eq (car-safe old) 'special-const)
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
250 (error "\"%s\" is a special constant" (calc-var-name var)))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
251 (if (not old)
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
252 (if (memq var '(var-inf var-uinf var-nan))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
253 (error "\"%s\" is a special variable" (calc-var-name var))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
254 (error "No such variable: \"%s\"" (calc-var-name var))))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
255 (let ((calc-simplify-mode (if (eq calc-simplify-mode 'none)
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
256 'num calc-simplify-mode))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
257 (values (and (> nargs 1)
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
258 (calc-top-list (1- nargs) (1+ calc-dollar-used)))))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
259 (message "Working...")
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
260 (calc-set-command-flag 'clear-message)
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
261 (if (stringp old)
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
262 (setq old (math-read-expr old)))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
263 (if (eq (car-safe old) 'error)
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
264 (error "Bad format in variable contents: %s" (nth 2 old)))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
265 (setq values (if (calc-is-inverse)
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
266 (append values (list old))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
267 (append (list old) values)))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
268 (calc-store-value var
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
269 (calc-normalize (cons (nth 1 oper) values))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
270 (nth 2 oper)
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
271 (+ calc-dollar-used (1- nargs)))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
272 (message "Variable \"%s\" changed" (calc-var-name var))))))))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
273
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
274
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
275 (defun calc-store-exchange (&optional var)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
276 (interactive)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
277 (calc-wrapper
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
278 (let ((calc-given-value nil)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
279 (calc-given-value-flag 1)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
280 top)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
281 (or var (setq var (calc-read-var-name "Exchange with: ")))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
282 (if var
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
283 (let ((value (calc-var-value var)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
284 (if (eq (car-safe value) 'special-const)
62358
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
285 (error "\"%s\" is a special constant" (calc-var-name var)))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
286 (if (not value)
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
287 (if (memq var '(var-inf var-uinf var-nan))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
288 (error "\"%s\" is a special variable" (calc-var-name var))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
289 (error "No such variable: \"%s\"" (calc-var-name var))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
290 (setq top (or calc-given-value (calc-top 1)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
291 (calc-store-value var top nil)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
292 (calc-pop-push-record calc-given-value-flag
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
293 (concat "<>" (calc-var-name var)) value))))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
294
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
295 (defun calc-unstore (&optional var)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
296 (interactive)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
297 (calc-wrapper
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
298 (or var (setq var (calc-read-var-name "Unstore: ")))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
299 (if var
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
300 (progn
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
301 (and (memq var '(var-e var-i var-pi var-phi var-gamma))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
302 (eq (car-safe (calc-var-value var)) 'special-const)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
303 (message "(Note: Built-in definition of %s has been lost)" var))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
304 (if (and (boundp var) (symbol-value var))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
305 (message "Unstored variable \"%s\"" (calc-var-name var))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
306 (message "Variable \"%s\" remains unstored" (calc-var-name var)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
307 (makunbound var)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
308 (calc-refresh-evaltos var)))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
309
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
310 (defun calc-let (&optional var)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
311 (interactive)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
312 (calc-wrapper
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
313 (let* ((calc-given-value nil)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
314 (calc-given-value-flag 1)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
315 thing value)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
316 (or var (setq var (calc-read-var-name "Let variable: ")))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
317 (if calc-given-value
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
318 (setq value calc-given-value
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
319 thing (calc-top 1))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
320 (setq value (calc-top 1)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
321 thing (calc-top 2)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
322 (setq var (if var
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
323 (list (cons var value))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
324 (calc-is-assignments value)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
325 (if var
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
326 (calc-pop-push-record
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
327 (1+ calc-given-value-flag)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
328 (concat "=" (calc-var-name (car (car var))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
329 (let ((saved-val (mapcar (function
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
330 (lambda (v)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
331 (and (boundp (car v))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
332 (symbol-value (car v)))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
333 var)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
334 (unwind-protect
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
335 (let ((vv var))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
336 (while vv
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
337 (set (car (car vv)) (calc-normalize (cdr (car vv))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
338 (calc-refresh-evaltos (car (car vv)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
339 (setq vv (cdr vv)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
340 (math-evaluate-expr thing))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
341 (while saved-val
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
342 (if (car saved-val)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
343 (set (car (car var)) (car saved-val))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
344 (makunbound (car (car var))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
345 (setq saved-val (cdr saved-val)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
346 var (cdr var)))
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
347 (calc-handle-whys))))))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
348
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
349 (defun calc-is-assignments (value)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
350 (if (memq (car-safe value) '(calcFunc-eq calcFunc-assign))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
351 (and (eq (car-safe (nth 1 value)) 'var)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
352 (list (cons (nth 2 (nth 1 value)) (nth 2 value))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
353 (if (eq (car-safe value) 'vec)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
354 (let ((vv nil))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
355 (while (and (setq value (cdr value))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
356 (memq (car-safe (car value))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
357 '(calcFunc-eq calcFunc-assign))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
358 (eq (car-safe (nth 1 (car value))) 'var))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
359 (setq vv (cons (cons (nth 2 (nth 1 (car value)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
360 (nth 2 (car value)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
361 vv)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
362 (and (not value)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
363 vv)))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
364
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
365 (defun calc-recall (&optional var)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
366 (interactive)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
367 (calc-wrapper
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
368 (or var (setq var (calc-read-var-name "Recall: ")))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
369 (if var
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
370 (let ((value (calc-var-value var)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
371 (or value
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
372 (error "No such variable: \"%s\"" (calc-var-name var)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
373 (if (stringp value)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
374 (setq value (math-read-expr value)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
375 (if (eq (car-safe value) 'error)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
376 (error "Bad format in variable contents: %s" (nth 2 value)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
377 (setq value (calc-normalize value))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
378 (let ((calc-full-trail-vectors nil))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
379 (calc-record value (concat "<" (calc-var-name var))))
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
380 (calc-push value)))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
381
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
382 (defun calc-store-quick ()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
383 (interactive)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
384 (calc-store (intern (format "var-q%c" last-command-char))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
385
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
386 (defun calc-store-into-quick ()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
387 (interactive)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
388 (calc-store-into (intern (format "var-q%c" last-command-char))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
389
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
390 (defun calc-recall-quick ()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
391 (interactive)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
392 (calc-recall (intern (format "var-q%c" last-command-char))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
393
62392
0476ffde9ab3 (calc-copy-special-constant): New function.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62358
diff changeset
394 (defun calc-copy-special-constant (&optional sconst var)
0476ffde9ab3 (calc-copy-special-constant): New function.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62358
diff changeset
395 (interactive)
0476ffde9ab3 (calc-copy-special-constant): New function.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62358
diff changeset
396 (let ((sc '(("")
0476ffde9ab3 (calc-copy-special-constant): New function.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62358
diff changeset
397 ("e" . (special-const (math-e)))
0476ffde9ab3 (calc-copy-special-constant): New function.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62358
diff changeset
398 ("pi" . (special-const (math-pi)))
0476ffde9ab3 (calc-copy-special-constant): New function.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62358
diff changeset
399 ("i" . (special-const (math-imaginary 1)))
0476ffde9ab3 (calc-copy-special-constant): New function.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62358
diff changeset
400 ("phi" . (special-const (math-phi)))
0476ffde9ab3 (calc-copy-special-constant): New function.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62358
diff changeset
401 ("gamma" . (special-const (math-gamma-const))))))
0476ffde9ab3 (calc-copy-special-constant): New function.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62358
diff changeset
402 (calc-wrapper
0476ffde9ab3 (calc-copy-special-constant): New function.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62358
diff changeset
403 (or sconst (setq sconst (completing-read "Special constant: " sc nil t)))
0476ffde9ab3 (calc-copy-special-constant): New function.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62358
diff changeset
404 (unless (string= sconst "")
0476ffde9ab3 (calc-copy-special-constant): New function.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62358
diff changeset
405 (let ((value (cdr (assoc sconst sc))))
0476ffde9ab3 (calc-copy-special-constant): New function.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62358
diff changeset
406 (or var (setq var (calc-read-var-name
84889
fa8470bb9f1a (calc-var-name-map): Use `mapc' rather than `mapcar'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78215
diff changeset
407 (format "Copy special constant %s, to: "
62392
0476ffde9ab3 (calc-copy-special-constant): New function.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62358
diff changeset
408 sconst))))
0476ffde9ab3 (calc-copy-special-constant): New function.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62358
diff changeset
409 (if var
0476ffde9ab3 (calc-copy-special-constant): New function.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62358
diff changeset
410 (let ((msg (calc-store-value var value "")))
0476ffde9ab3 (calc-copy-special-constant): New function.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62358
diff changeset
411 (message (concat "Special constant \"%s\" copied to \"%s\"" msg)
0476ffde9ab3 (calc-copy-special-constant): New function.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62358
diff changeset
412 sconst (calc-var-name var)))))))))
0476ffde9ab3 (calc-copy-special-constant): New function.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62358
diff changeset
413
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
414 (defun calc-copy-variable (&optional var1 var2)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
415 (interactive)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
416 (calc-wrapper
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
417 (or var1 (setq var1 (calc-read-var-name "Copy variable: ")))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
418 (if var1
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
419 (let ((value (calc-var-value var1)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
420 (or value
59211
999144478c9a (calc-copy-variable): Fix mistyped variable name. Display variable
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59090
diff changeset
421 (error "No such variable: \"%s\"" (calc-var-name var1)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
422 (or var2 (setq var2 (calc-read-var-name
84889
fa8470bb9f1a (calc-var-name-map): Use `mapc' rather than `mapcar'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78215
diff changeset
423 (format "Copy variable: %s, to: "
59211
999144478c9a (calc-copy-variable): Fix mistyped variable name. Display variable
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59090
diff changeset
424 (calc-var-name var1)))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
425 (if var2
62358
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
426 (let ((msg (calc-store-value var2 value "")))
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
427 (message (concat "Variable \"%s\" copied to \"%s\"" msg)
75b110fa35a8 (calc-store-value): Return a string rather than display it as a message.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 62165
diff changeset
428 (calc-var-name var1) (calc-var-name var2))))))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
429
41271
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
430 (defvar calc-last-edited-variable nil)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
431 (defun calc-edit-variable (&optional var)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
432 (interactive)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
433 (calc-wrapper
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
434 (or var (setq var (calc-read-var-name
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
435 (if calc-last-edited-variable
65680
ed770a0a7846 2005-09-24 Emilio C. Lopes <eclig@gmx.net>
Romain Francoise <romain@orebokech.com>
parents: 64325
diff changeset
436 (format "Edit (default %s): "
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
437 (calc-var-name calc-last-edited-variable))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
438 "Edit: "))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
439 (or var (setq var calc-last-edited-variable))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
440 (if var
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
441 (let* ((value (calc-var-value var)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
442 (if (eq (car-safe value) 'special-const)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
443 (error "%s is a special constant" var))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
444 (setq calc-last-edited-variable var)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
445 (calc-edit-mode (list 'calc-finish-stack-edit (list 'quote var))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
446 t
59299
b851b98f8dc1 (calc-edit-variable): Change title to match new header.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59265
diff changeset
447 (concat "Editing variable `" (calc-var-name var) "'. "))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
448 (and value
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
449 (insert (math-format-nice-expr value (frame-width)) "\n")))))
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
450 (calc-show-edit-buffer))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
451
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
452 (defun calc-edit-Decls ()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
453 (interactive)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
454 (calc-edit-variable 'var-Decls))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
455
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
456 (defun calc-edit-EvalRules ()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
457 (interactive)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
458 (calc-edit-variable 'var-EvalRules))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
459
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
460 (defun calc-edit-FitRules ()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
461 (interactive)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
462 (calc-edit-variable 'var-FitRules))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
463
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
464 (defun calc-edit-GenCount ()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
465 (interactive)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
466 (calc-edit-variable 'var-GenCount))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
467
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
468 (defun calc-edit-Holidays ()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
469 (interactive)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
470 (calc-edit-variable 'var-Holidays))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
471
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
472 (defun calc-edit-IntegLimit ()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
473 (interactive)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
474 (calc-edit-variable 'var-IntegLimit))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
475
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
476 (defun calc-edit-LineStyles ()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
477 (interactive)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
478 (calc-edit-variable 'var-LineStyles))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
479
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
480 (defun calc-edit-PointStyles ()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
481 (interactive)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
482 (calc-edit-variable 'var-PointStyles))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
483
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
484 (defun calc-edit-PlotRejects ()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
485 (interactive)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
486 (calc-edit-variable 'var-PlotRejects))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
487
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
488 (defun calc-edit-AlgSimpRules ()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
489 (interactive)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
490 (calc-edit-variable 'var-AlgSimpRules))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
491
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
492 (defun calc-edit-TimeZone ()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
493 (interactive)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
494 (calc-edit-variable 'var-TimeZone))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
495
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
496 (defun calc-edit-Units ()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
497 (interactive)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
498 (calc-edit-variable 'var-Units))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
499
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
500 (defun calc-edit-ExtSimpRules ()
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
501 (interactive)
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
502 (calc-edit-variable 'var-ExtSimpRules))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
503
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
504 (defun calc-declare-variable (&optional var)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
505 (interactive)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
506 (calc-wrapper
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
507 (or var (setq var (calc-read-var-name "Declare: " 0)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
508 (or var (setq var 'var-All))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
509 (let* (dp decl def row rp)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
510 (or (and (calc-var-value 'var-Decls)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
511 (eq (car-safe var-Decls) 'vec))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
512 (setq var-Decls (list 'vec)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
513 (setq dp var-Decls)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
514 (while (and (setq dp (cdr dp))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
515 (or (not (eq (car-safe (car dp)) 'vec))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
516 (/= (length (car dp)) 3)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
517 (progn
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
518 (setq row (nth 1 (car dp))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
519 rp row)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
520 (if (eq (car-safe row) 'vec)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
521 (progn
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
522 (while
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
523 (and (setq rp (cdr rp))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
524 (or (not (eq (car-safe (car rp)) 'var))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
525 (not (eq (nth 2 (car rp)) var)))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
526 (setq rp (car rp)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
527 (if (or (not (eq (car-safe row) 'var))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
528 (not (eq (nth 2 row) var)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
529 (setq rp nil)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
530 (not rp)))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
531 (calc-unread-command ?\C-a)
59720
be3370bd02da (calc-declare-variable): Use calc-var-name to display variable name.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 59299
diff changeset
532 (setq decl (read-string (format "Declare: %s to be: " (calc-var-name var))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
533 (and rp
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
534 (math-format-flat-expr (nth 2 (car dp)) 0))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
535 (setq decl (and (string-match "[^ \t]" decl)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
536 (math-read-exprs decl)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
537 (if (eq (car-safe decl) 'error)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
538 (error "Bad format in declaration: %s" (nth 2 decl)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
539 (if (cdr decl)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
540 (setq decl (cons 'vec decl))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
541 (setq decl (car decl)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
542 (and (eq (car-safe decl) 'vec)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
543 (= (length decl) 2)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
544 (setq decl (nth 1 decl)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
545 (calc-record (append '(vec) (list (math-build-var-name var))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
546 (and decl (list decl)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
547 "decl")
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
548 (setq var-Decls (copy-sequence var-Decls))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
549 (if (eq (car-safe row) 'vec)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
550 (progn
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
551 (setcdr row (delq rp (cdr row)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
552 (or (cdr row)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
553 (setq var-Decls (delq (car dp) var-Decls))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
554 (setq var-Decls (delq (car dp) var-Decls)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
555 (if decl
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
556 (progn
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
557 (setq dp (and (not (eq var 'var-All)) var-Decls))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
558 (while (and (setq dp (cdr dp))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
559 (or (not (eq (car-safe (car dp)) 'vec))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
560 (/= (length (car dp)) 3)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
561 (not (equal (nth 2 (car dp)) decl)))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
562 (if dp
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
563 (setcar (cdr (car dp))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
564 (append (if (eq (car-safe (nth 1 (car dp))) 'vec)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
565 (nth 1 (car dp))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
566 (list 'vec (nth 1 (car dp))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
567 (list (math-build-var-name var))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
568 (setq var-Decls (append var-Decls
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
569 (list (list 'vec
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
570 (math-build-var-name var)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
571 decl)))))))
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
572 (calc-refresh-evaltos 'var-Decls))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
573
41271
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
574 (defvar calc-dont-insert-variables '(var-FitRules var-FactorRules
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
575 var-CommuteRules var-JumpRules
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
576 var-DistribRules var-MergeRules
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
577 var-NegateRules var-InvertRules
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
578 var-IntegAfterRules
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
579 var-TimeZone var-PlotRejects
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
580 var-PlotData1 var-PlotData2
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
581 var-PlotData3 var-PlotData4
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
582 var-PlotData5 var-PlotData6
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
583 var-DUMMY))
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
584
58547
1e95f60dbab4 (calc-given-value, calc-store-opers): Declare them.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 52401
diff changeset
585 ;; The variable calc-pv-pos is local to calc-permanent-variable, but
1e95f60dbab4 (calc-given-value, calc-store-opers): Declare them.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 52401
diff changeset
586 ;; used by calc-insert-permanent-variable, which is called by
1e95f60dbab4 (calc-given-value, calc-store-opers): Declare them.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 52401
diff changeset
587 ;; calc-permanent-variable.
1e95f60dbab4 (calc-given-value, calc-store-opers): Declare them.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 52401
diff changeset
588 (defvar calc-pv-pos)
1e95f60dbab4 (calc-given-value, calc-store-opers): Declare them.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 52401
diff changeset
589
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
590 (defun calc-permanent-variable (&optional var)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
591 (interactive)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
592 (calc-wrapper
65680
ed770a0a7846 2005-09-24 Emilio C. Lopes <eclig@gmx.net>
Romain Francoise <romain@orebokech.com>
parents: 64325
diff changeset
593 (or var (setq var (calc-read-var-name "Save variable (default all): ")))
58547
1e95f60dbab4 (calc-given-value, calc-store-opers): Declare them.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 52401
diff changeset
594 (let (calc-pv-pos)
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
595 (and var (or (and (boundp var) (symbol-value var))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
596 (error "No such variable")))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
597 (set-buffer (find-file-noselect (substitute-in-file-name
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
598 calc-settings-file)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
599 (if var
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
600 (calc-insert-permanent-variable var)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
601 (mapatoms (function
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
602 (lambda (x)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
603 (and (string-match "\\`var-" (symbol-name x))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
604 (not (memq x calc-dont-insert-variables))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
605 (calc-var-value x)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
606 (not (eq (car-safe (symbol-value x)) 'special-const))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
607 (calc-insert-permanent-variable x))))))
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
608 (save-buffer))))
41271
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
609
fcd507927105 Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents: 41047
diff changeset
610
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
611
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
612 (defun calc-insert-permanent-variable (var)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
613 (goto-char (point-min))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
614 (if (search-forward (concat "(setq " (symbol-name var) " '") nil t)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
615 (progn
58547
1e95f60dbab4 (calc-given-value, calc-store-opers): Declare them.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 52401
diff changeset
616 (setq calc-pv-pos (point-marker))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
617 (forward-line -1)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
618 (if (looking-at ";;; Variable .* stored by Calc on ")
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
619 (progn
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
620 (delete-region (match-end 0) (progn (end-of-line) (point)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
621 (insert (current-time-string))))
58547
1e95f60dbab4 (calc-given-value, calc-store-opers): Declare them.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 52401
diff changeset
622 (goto-char (- calc-pv-pos 8 (length (symbol-name var))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
623 (forward-sexp 1)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
624 (backward-char 1)
58547
1e95f60dbab4 (calc-given-value, calc-store-opers): Declare them.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 52401
diff changeset
625 (delete-region calc-pv-pos (point)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
626 (goto-char (point-max))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
627 (insert "\n;;; Variable \""
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
628 (symbol-name var)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
629 "\" stored by Calc on "
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
630 (current-time-string)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
631 "\n(setq "
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
632 (symbol-name var)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
633 " ')\n")
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
634 (backward-char 2))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
635 (insert (prin1-to-string (calc-var-value var)))
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
636 (forward-line 1))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
637
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
638 (defun calc-insert-variables (buf)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
639 (interactive "bBuffer in which to save variable values: ")
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
640 (save-excursion
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
641 (set-buffer buf)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
642 (mapatoms (function
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
643 (lambda (x)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
644 (and (string-match "\\`var-" (symbol-name x))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
645 (not (memq x calc-dont-insert-variables))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
646 (calc-var-value x)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
647 (not (eq (car-safe (symbol-value x)) 'special-const))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
648 (or (not (eq x 'var-Decls))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
649 (not (equal var-Decls '(vec))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
650 (or (not (eq x 'var-Holidays))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
651 (not (equal var-Holidays '(vec (var sat var-sat)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
652 (var sun var-sun)))))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
653 (insert "(setq "
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
654 (symbol-name x)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
655 " "
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
656 (prin1-to-string
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
657 (let ((calc-language
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
658 (if (memq calc-language '(nil big))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
659 'flat
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
660 calc-language)))
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
661 (math-format-value (symbol-value x) 100000)))
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
662 ")\n")))))))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
663
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
664 (defun calc-assign (arg)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
665 (interactive "P")
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
666 (calc-slow-wrapper
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
667 (calc-binary-op ":=" 'calcFunc-assign arg)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
668
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
669 (defun calc-evalto (arg)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
670 (interactive "P")
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
671 (calc-slow-wrapper
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
672 (calc-unary-op "=>" 'calcFunc-evalto arg)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
673
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
674 (defun calc-subscript (arg)
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
675 (interactive "P")
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
676 (calc-slow-wrapper
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
677 (calc-binary-op "sub" 'calcFunc-subscr arg)))
40785
2fb9d407ae73 Initial import of Calc 2.02f.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
678
58673
202eaef4ca19 Add a provide statement.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58547
diff changeset
679 (provide 'calc-store)
202eaef4ca19 Add a provide statement.
Jay Belanger <jay.p.belanger@gmail.com>
parents: 58547
diff changeset
680
93975
1e3a407766b9 Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 93262
diff changeset
681 ;; arch-tag: 2fbfec82-a521-42ca-bcd8-4f254ae6313e
41047
73f364fd8aaa Style cleanup; don't put closing parens on their
Colin Walters <walters@gnu.org>
parents: 40785
diff changeset
682 ;;; calc-store.el ends here