Mercurial > emacs
annotate lisp/calc/calc-ext.el @ 63064:7e053d892401
*** empty log message ***
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Mon, 06 Jun 2005 12:47:19 +0000 |
parents | 24bf48d7bb93 |
children | 1db49616ce05 01137c1fdbe9 |
rev | line source |
---|---|
41271
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
1 ;;; calc-ext.el --- various extension functions for Calc |
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
2 |
62442
842c8b2c2940
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62390
diff
changeset
|
3 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2005 Free Software Foundation, Inc. |
41271
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
4 |
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
5 ;; Author: David Gillespie <daveg@synaptics.com> |
58301
4a12728aef72
(math-defsimplify): Changed the argument in the created function to
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58143
diff
changeset
|
6 ;; Maintainer: Jay Belanger <belanger@truman.edu> |
40785 | 7 |
8 ;; This file is part of GNU Emacs. | |
9 | |
10 ;; GNU Emacs is distributed in the hope that it will be useful, | |
11 ;; but WITHOUT ANY WARRANTY. No author or distributor | |
12 ;; accepts responsibility to anyone for the consequences of using it | |
13 ;; or for whether it serves any particular purpose or works at all, | |
14 ;; unless he says so in writing. Refer to the GNU Emacs General Public | |
15 ;; License for full details. | |
16 | |
17 ;; Everyone is granted permission to copy, modify and redistribute | |
18 ;; GNU Emacs, but only under the conditions described in the | |
19 ;; GNU Emacs General Public License. A copy of this license is | |
20 ;; supposed to have been given to you along with GNU Emacs so you | |
21 ;; can know your rights and responsibilities. It should be in a | |
22 ;; file named COPYING. Among other things, the copyright notice | |
23 ;; and this notice must be preserved on all copies. | |
24 | |
41271
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
25 ;;; Commentary: |
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
26 |
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
27 ;;; Code: |
40785 | 28 |
40908 | 29 (require 'calc) |
40785 | 30 (require 'calc-macs) |
31 | |
41271
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
32 (defvar math-simplifying nil) |
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
33 (defvar math-living-dangerously nil) ; true if unsafe simplifications are okay. |
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
34 (defvar math-integrating nil) |
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
35 |
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
36 (defvar math-rewrite-selections nil) |
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
37 |
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
38 (defvar math-compose-level 0) |
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
39 (defvar math-comp-selected nil) |
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
40 (defvar math-comp-tagged nil) |
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
41 (defvar math-comp-sel-hpos nil) |
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
42 (defvar math-comp-sel-vpos nil) |
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
43 (defvar math-comp-sel-cpos nil) |
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
44 (defvar math-compose-hash-args nil) |
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
45 |
62832
24bf48d7bb93
(calc-help-map, calc-alg-map, calc-alg-esc-map): Declare them.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
62442
diff
changeset
|
46 (defvar calc-alg-map) |
24bf48d7bb93
(calc-help-map, calc-alg-map, calc-alg-esc-map): Declare them.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
62442
diff
changeset
|
47 (defvar calc-alg-esc-map) |
24bf48d7bb93
(calc-help-map, calc-alg-map, calc-alg-esc-map): Declare them.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
62442
diff
changeset
|
48 |
40785 | 49 ;;; The following was made a function so that it could be byte-compiled. |
50 (defun calc-init-extensions () | |
51 | |
52 (define-key calc-mode-map ":" 'calc-fdiv) | |
53 (define-key calc-mode-map "\\" 'calc-idiv) | |
54 (define-key calc-mode-map "|" 'calc-concat) | |
55 (define-key calc-mode-map "!" 'calc-factorial) | |
56 (define-key calc-mode-map "C" 'calc-cos) | |
57 (define-key calc-mode-map "E" 'calc-exp) | |
58 (define-key calc-mode-map "H" 'calc-hyperbolic) | |
59 (define-key calc-mode-map "I" 'calc-inverse) | |
60 (define-key calc-mode-map "J" 'calc-conj) | |
61 (define-key calc-mode-map "L" 'calc-ln) | |
62 (define-key calc-mode-map "N" 'calc-eval-num) | |
63 (define-key calc-mode-map "P" 'calc-pi) | |
64 (define-key calc-mode-map "Q" 'calc-sqrt) | |
65 (define-key calc-mode-map "R" 'calc-round) | |
66 (define-key calc-mode-map "S" 'calc-sin) | |
67 (define-key calc-mode-map "T" 'calc-tan) | |
68 (define-key calc-mode-map "U" 'calc-undo) | |
69 (define-key calc-mode-map "X" 'calc-call-last-kbd-macro) | |
70 (define-key calc-mode-map "o" 'calc-realign) | |
71 (define-key calc-mode-map "p" 'calc-precision) | |
72 (define-key calc-mode-map "w" 'calc-why) | |
73 (define-key calc-mode-map "x" 'calc-execute-extended-command) | |
74 (define-key calc-mode-map "y" 'calc-copy-to-buffer) | |
75 | |
76 (define-key calc-mode-map "(" 'calc-begin-complex) | |
77 (define-key calc-mode-map ")" 'calc-end-complex) | |
78 (define-key calc-mode-map "[" 'calc-begin-vector) | |
79 (define-key calc-mode-map "]" 'calc-end-vector) | |
80 (define-key calc-mode-map "," 'calc-comma) | |
81 (define-key calc-mode-map ";" 'calc-semi) | |
82 (define-key calc-mode-map "`" 'calc-edit) | |
83 (define-key calc-mode-map "=" 'calc-evaluate) | |
84 (define-key calc-mode-map "~" 'calc-num-prefix) | |
85 (define-key calc-mode-map "<" 'calc-scroll-left) | |
86 (define-key calc-mode-map ">" 'calc-scroll-right) | |
87 (define-key calc-mode-map "{" 'calc-scroll-down) | |
88 (define-key calc-mode-map "}" 'calc-scroll-up) | |
89 (define-key calc-mode-map "\C-k" 'calc-kill) | |
90 (define-key calc-mode-map "\M-k" 'calc-copy-as-kill) | |
91 (define-key calc-mode-map "\C-w" 'calc-kill-region) | |
92 (define-key calc-mode-map "\M-w" 'calc-copy-region-as-kill) | |
93 (define-key calc-mode-map "\C-y" 'calc-yank) | |
58062
53168df2a0ea
(calc-init-extensions): Bound calc-yank to mouse-2.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
57594
diff
changeset
|
94 (define-key calc-mode-map [mouse-2] 'calc-yank) |
40785 | 95 (define-key calc-mode-map "\C-_" 'calc-undo) |
96 (define-key calc-mode-map "\C-xu" 'calc-undo) | |
97 (define-key calc-mode-map "\M-\C-m" 'calc-last-args) | |
98 | |
99 (define-key calc-mode-map "a" nil) | |
100 (define-key calc-mode-map "a?" 'calc-a-prefix-help) | |
101 (define-key calc-mode-map "aa" 'calc-apart) | |
102 (define-key calc-mode-map "ab" 'calc-substitute) | |
103 (define-key calc-mode-map "ac" 'calc-collect) | |
104 (define-key calc-mode-map "ad" 'calc-derivative) | |
105 (define-key calc-mode-map "ae" 'calc-simplify-extended) | |
106 (define-key calc-mode-map "af" 'calc-factor) | |
107 (define-key calc-mode-map "ag" 'calc-poly-gcd) | |
108 (define-key calc-mode-map "ai" 'calc-integral) | |
109 (define-key calc-mode-map "am" 'calc-match) | |
110 (define-key calc-mode-map "an" 'calc-normalize-rat) | |
111 (define-key calc-mode-map "ap" 'calc-poly-interp) | |
112 (define-key calc-mode-map "ar" 'calc-rewrite) | |
113 (define-key calc-mode-map "as" 'calc-simplify) | |
114 (define-key calc-mode-map "at" 'calc-taylor) | |
115 (define-key calc-mode-map "av" 'calc-alg-evaluate) | |
116 (define-key calc-mode-map "ax" 'calc-expand) | |
117 (define-key calc-mode-map "aA" 'calc-abs) | |
118 (define-key calc-mode-map "aF" 'calc-curve-fit) | |
119 (define-key calc-mode-map "aI" 'calc-num-integral) | |
120 (define-key calc-mode-map "aM" 'calc-map-equation) | |
121 (define-key calc-mode-map "aN" 'calc-find-minimum) | |
122 (define-key calc-mode-map "aP" 'calc-poly-roots) | |
123 (define-key calc-mode-map "aS" 'calc-solve-for) | |
124 (define-key calc-mode-map "aR" 'calc-find-root) | |
125 (define-key calc-mode-map "aT" 'calc-tabulate) | |
126 (define-key calc-mode-map "aX" 'calc-find-maximum) | |
127 (define-key calc-mode-map "a+" 'calc-summation) | |
128 (define-key calc-mode-map "a-" 'calc-alt-summation) | |
129 (define-key calc-mode-map "a*" 'calc-product) | |
130 (define-key calc-mode-map "a\\" 'calc-poly-div) | |
131 (define-key calc-mode-map "a%" 'calc-poly-rem) | |
132 (define-key calc-mode-map "a/" 'calc-poly-div-rem) | |
133 (define-key calc-mode-map "a=" 'calc-equal-to) | |
134 (define-key calc-mode-map "a#" 'calc-not-equal-to) | |
135 (define-key calc-mode-map "a<" 'calc-less-than) | |
136 (define-key calc-mode-map "a>" 'calc-greater-than) | |
137 (define-key calc-mode-map "a[" 'calc-less-equal) | |
138 (define-key calc-mode-map "a]" 'calc-greater-equal) | |
139 (define-key calc-mode-map "a." 'calc-remove-equal) | |
140 (define-key calc-mode-map "a{" 'calc-in-set) | |
141 (define-key calc-mode-map "a&" 'calc-logical-and) | |
142 (define-key calc-mode-map "a|" 'calc-logical-or) | |
143 (define-key calc-mode-map "a!" 'calc-logical-not) | |
144 (define-key calc-mode-map "a:" 'calc-logical-if) | |
145 (define-key calc-mode-map "a_" 'calc-subscript) | |
146 (define-key calc-mode-map "a\"" 'calc-expand-formula) | |
147 | |
148 (define-key calc-mode-map "b" nil) | |
149 (define-key calc-mode-map "b?" 'calc-b-prefix-help) | |
150 (define-key calc-mode-map "ba" 'calc-and) | |
151 (define-key calc-mode-map "bc" 'calc-clip) | |
152 (define-key calc-mode-map "bd" 'calc-diff) | |
153 (define-key calc-mode-map "bl" 'calc-lshift-binary) | |
154 (define-key calc-mode-map "bn" 'calc-not) | |
155 (define-key calc-mode-map "bo" 'calc-or) | |
156 (define-key calc-mode-map "bp" 'calc-pack-bits) | |
157 (define-key calc-mode-map "br" 'calc-rshift-binary) | |
158 (define-key calc-mode-map "bt" 'calc-rotate-binary) | |
159 (define-key calc-mode-map "bu" 'calc-unpack-bits) | |
160 (define-key calc-mode-map "bw" 'calc-word-size) | |
161 (define-key calc-mode-map "bx" 'calc-xor) | |
162 (define-key calc-mode-map "bB" 'calc-log) | |
163 (define-key calc-mode-map "bD" 'calc-fin-ddb) | |
164 (define-key calc-mode-map "bF" 'calc-fin-fv) | |
165 (define-key calc-mode-map "bI" 'calc-fin-irr) | |
166 (define-key calc-mode-map "bL" 'calc-lshift-arith) | |
167 (define-key calc-mode-map "bM" 'calc-fin-pmt) | |
168 (define-key calc-mode-map "bN" 'calc-fin-npv) | |
169 (define-key calc-mode-map "bP" 'calc-fin-pv) | |
170 (define-key calc-mode-map "bR" 'calc-rshift-arith) | |
171 (define-key calc-mode-map "bS" 'calc-fin-sln) | |
172 (define-key calc-mode-map "bT" 'calc-fin-rate) | |
173 (define-key calc-mode-map "bY" 'calc-fin-syd) | |
174 (define-key calc-mode-map "b#" 'calc-fin-nper) | |
175 (define-key calc-mode-map "b%" 'calc-percent-change) | |
176 | |
177 (define-key calc-mode-map "c" nil) | |
178 (define-key calc-mode-map "c?" 'calc-c-prefix-help) | |
179 (define-key calc-mode-map "cc" 'calc-clean) | |
180 (define-key calc-mode-map "cd" 'calc-to-degrees) | |
181 (define-key calc-mode-map "cf" 'calc-float) | |
182 (define-key calc-mode-map "ch" 'calc-to-hms) | |
183 (define-key calc-mode-map "cp" 'calc-polar) | |
184 (define-key calc-mode-map "cr" 'calc-to-radians) | |
185 (define-key calc-mode-map "cC" 'calc-cos) | |
186 (define-key calc-mode-map "cF" 'calc-fraction) | |
187 (define-key calc-mode-map "c%" 'calc-convert-percent) | |
188 | |
189 (define-key calc-mode-map "d" nil) | |
190 (define-key calc-mode-map "d?" 'calc-d-prefix-help) | |
191 (define-key calc-mode-map "d0" 'calc-decimal-radix) | |
192 (define-key calc-mode-map "d2" 'calc-binary-radix) | |
193 (define-key calc-mode-map "d6" 'calc-hex-radix) | |
194 (define-key calc-mode-map "d8" 'calc-octal-radix) | |
195 (define-key calc-mode-map "db" 'calc-line-breaking) | |
196 (define-key calc-mode-map "dc" 'calc-complex-notation) | |
197 (define-key calc-mode-map "dd" 'calc-date-notation) | |
198 (define-key calc-mode-map "de" 'calc-eng-notation) | |
199 (define-key calc-mode-map "df" 'calc-fix-notation) | |
200 (define-key calc-mode-map "dg" 'calc-group-digits) | |
201 (define-key calc-mode-map "dh" 'calc-hms-notation) | |
202 (define-key calc-mode-map "di" 'calc-i-notation) | |
203 (define-key calc-mode-map "dj" 'calc-j-notation) | |
204 (define-key calc-mode-map "dl" 'calc-line-numbering) | |
205 (define-key calc-mode-map "dn" 'calc-normal-notation) | |
206 (define-key calc-mode-map "do" 'calc-over-notation) | |
207 (define-key calc-mode-map "dp" 'calc-show-plain) | |
208 (define-key calc-mode-map "dr" 'calc-radix) | |
209 (define-key calc-mode-map "ds" 'calc-sci-notation) | |
210 (define-key calc-mode-map "dt" 'calc-truncate-stack) | |
211 (define-key calc-mode-map "dw" 'calc-auto-why) | |
212 (define-key calc-mode-map "dz" 'calc-leading-zeros) | |
213 (define-key calc-mode-map "dB" 'calc-big-language) | |
214 (define-key calc-mode-map "dD" 'calc-redo) | |
215 (define-key calc-mode-map "dC" 'calc-c-language) | |
216 (define-key calc-mode-map "dE" 'calc-eqn-language) | |
217 (define-key calc-mode-map "dF" 'calc-fortran-language) | |
218 (define-key calc-mode-map "dM" 'calc-mathematica-language) | |
219 (define-key calc-mode-map "dN" 'calc-normal-language) | |
220 (define-key calc-mode-map "dO" 'calc-flat-language) | |
221 (define-key calc-mode-map "dP" 'calc-pascal-language) | |
222 (define-key calc-mode-map "dT" 'calc-tex-language) | |
59810
3192518bb184
Add calc-latex-language to autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59664
diff
changeset
|
223 (define-key calc-mode-map "dL" 'calc-latex-language) |
40785 | 224 (define-key calc-mode-map "dU" 'calc-unformatted-language) |
225 (define-key calc-mode-map "dW" 'calc-maple-language) | |
226 (define-key calc-mode-map "d[" 'calc-truncate-up) | |
227 (define-key calc-mode-map "d]" 'calc-truncate-down) | |
228 (define-key calc-mode-map "d." 'calc-point-char) | |
229 (define-key calc-mode-map "d," 'calc-group-char) | |
230 (define-key calc-mode-map "d\"" 'calc-display-strings) | |
231 (define-key calc-mode-map "d<" 'calc-left-justify) | |
232 (define-key calc-mode-map "d=" 'calc-center-justify) | |
233 (define-key calc-mode-map "d>" 'calc-right-justify) | |
234 (define-key calc-mode-map "d{" 'calc-left-label) | |
235 (define-key calc-mode-map "d}" 'calc-right-label) | |
236 (define-key calc-mode-map "d'" 'calc-display-raw) | |
237 (define-key calc-mode-map "d " 'calc-refresh) | |
238 (define-key calc-mode-map "d\r" 'calc-refresh-top) | |
45579
eb535b77722f
(calc-init-extensions): Add binding for `d@'.
Miles Bader <miles@gnu.org>
parents:
43568
diff
changeset
|
239 (define-key calc-mode-map "d@" 'calc-toggle-banner) |
40785 | 240 |
241 (define-key calc-mode-map "f" nil) | |
242 (define-key calc-mode-map "f?" 'calc-f-prefix-help) | |
243 (define-key calc-mode-map "fb" 'calc-beta) | |
244 (define-key calc-mode-map "fe" 'calc-erf) | |
245 (define-key calc-mode-map "fg" 'calc-gamma) | |
246 (define-key calc-mode-map "fh" 'calc-hypot) | |
247 (define-key calc-mode-map "fi" 'calc-im) | |
248 (define-key calc-mode-map "fj" 'calc-bessel-J) | |
249 (define-key calc-mode-map "fn" 'calc-min) | |
250 (define-key calc-mode-map "fr" 'calc-re) | |
251 (define-key calc-mode-map "fs" 'calc-sign) | |
252 (define-key calc-mode-map "fx" 'calc-max) | |
253 (define-key calc-mode-map "fy" 'calc-bessel-Y) | |
254 (define-key calc-mode-map "fA" 'calc-abssqr) | |
255 (define-key calc-mode-map "fB" 'calc-inc-beta) | |
256 (define-key calc-mode-map "fE" 'calc-expm1) | |
257 (define-key calc-mode-map "fF" 'calc-floor) | |
258 (define-key calc-mode-map "fG" 'calc-inc-gamma) | |
259 (define-key calc-mode-map "fI" 'calc-ilog) | |
260 (define-key calc-mode-map "fL" 'calc-lnp1) | |
261 (define-key calc-mode-map "fM" 'calc-mant-part) | |
262 (define-key calc-mode-map "fQ" 'calc-isqrt) | |
263 (define-key calc-mode-map "fS" 'calc-scale-float) | |
264 (define-key calc-mode-map "fT" 'calc-arctan2) | |
265 (define-key calc-mode-map "fX" 'calc-xpon-part) | |
266 (define-key calc-mode-map "f[" 'calc-decrement) | |
267 (define-key calc-mode-map "f]" 'calc-increment) | |
268 | |
269 (define-key calc-mode-map "g" nil) | |
270 (define-key calc-mode-map "g?" 'calc-g-prefix-help) | |
271 (define-key calc-mode-map "ga" 'calc-graph-add) | |
272 (define-key calc-mode-map "gb" 'calc-graph-border) | |
273 (define-key calc-mode-map "gc" 'calc-graph-clear) | |
274 (define-key calc-mode-map "gd" 'calc-graph-delete) | |
275 (define-key calc-mode-map "gf" 'calc-graph-fast) | |
276 (define-key calc-mode-map "gg" 'calc-graph-grid) | |
277 (define-key calc-mode-map "gh" 'calc-graph-header) | |
278 (define-key calc-mode-map "gk" 'calc-graph-key) | |
279 (define-key calc-mode-map "gj" 'calc-graph-juggle) | |
280 (define-key calc-mode-map "gl" 'calc-graph-log-x) | |
281 (define-key calc-mode-map "gn" 'calc-graph-name) | |
282 (define-key calc-mode-map "gp" 'calc-graph-plot) | |
283 (define-key calc-mode-map "gq" 'calc-graph-quit) | |
284 (define-key calc-mode-map "gr" 'calc-graph-range-x) | |
285 (define-key calc-mode-map "gs" 'calc-graph-line-style) | |
286 (define-key calc-mode-map "gt" 'calc-graph-title-x) | |
287 (define-key calc-mode-map "gv" 'calc-graph-view-commands) | |
288 (define-key calc-mode-map "gx" 'calc-graph-display) | |
289 (define-key calc-mode-map "gz" 'calc-graph-zero-x) | |
290 (define-key calc-mode-map "gA" 'calc-graph-add-3d) | |
291 (define-key calc-mode-map "gC" 'calc-graph-command) | |
292 (define-key calc-mode-map "gD" 'calc-graph-device) | |
293 (define-key calc-mode-map "gF" 'calc-graph-fast-3d) | |
294 (define-key calc-mode-map "gG" 'calc-argument) | |
295 (define-key calc-mode-map "gH" 'calc-graph-hide) | |
296 (define-key calc-mode-map "gK" 'calc-graph-kill) | |
297 (define-key calc-mode-map "gL" 'calc-graph-log-y) | |
298 (define-key calc-mode-map "gN" 'calc-graph-num-points) | |
299 (define-key calc-mode-map "gO" 'calc-graph-output) | |
300 (define-key calc-mode-map "gP" 'calc-graph-print) | |
301 (define-key calc-mode-map "gR" 'calc-graph-range-y) | |
302 (define-key calc-mode-map "gS" 'calc-graph-point-style) | |
303 (define-key calc-mode-map "gT" 'calc-graph-title-y) | |
304 (define-key calc-mode-map "gV" 'calc-graph-view-trail) | |
305 (define-key calc-mode-map "gX" 'calc-graph-geometry) | |
306 (define-key calc-mode-map "gZ" 'calc-graph-zero-y) | |
307 (define-key calc-mode-map "g\C-l" 'calc-graph-log-z) | |
308 (define-key calc-mode-map "g\C-r" 'calc-graph-range-z) | |
309 (define-key calc-mode-map "g\C-t" 'calc-graph-title-z) | |
310 | |
311 (define-key calc-mode-map "h" 'calc-help-prefix) | |
312 | |
313 (define-key calc-mode-map "j" nil) | |
314 (define-key calc-mode-map "j?" 'calc-j-prefix-help) | |
315 (define-key calc-mode-map "ja" 'calc-select-additional) | |
316 (define-key calc-mode-map "jb" 'calc-break-selections) | |
317 (define-key calc-mode-map "jc" 'calc-clear-selections) | |
318 (define-key calc-mode-map "jd" 'calc-show-selections) | |
319 (define-key calc-mode-map "je" 'calc-enable-selections) | |
320 (define-key calc-mode-map "jl" 'calc-select-less) | |
321 (define-key calc-mode-map "jm" 'calc-select-more) | |
322 (define-key calc-mode-map "jn" 'calc-select-next) | |
323 (define-key calc-mode-map "jo" 'calc-select-once) | |
324 (define-key calc-mode-map "jp" 'calc-select-previous) | |
325 (define-key calc-mode-map "jr" 'calc-rewrite-selection) | |
326 (define-key calc-mode-map "js" 'calc-select-here) | |
327 (define-key calc-mode-map "jv" 'calc-sel-evaluate) | |
328 (define-key calc-mode-map "ju" 'calc-unselect) | |
329 (define-key calc-mode-map "jC" 'calc-sel-commute) | |
330 (define-key calc-mode-map "jD" 'calc-sel-distribute) | |
331 (define-key calc-mode-map "jE" 'calc-sel-jump-equals) | |
332 (define-key calc-mode-map "jI" 'calc-sel-isolate) | |
333 (define-key calc-mode-map "jJ" 'calc-conj) | |
334 (define-key calc-mode-map "jL" 'calc-commute-left) | |
335 (define-key calc-mode-map "jM" 'calc-sel-merge) | |
336 (define-key calc-mode-map "jN" 'calc-sel-negate) | |
337 (define-key calc-mode-map "jO" 'calc-select-once-maybe) | |
338 (define-key calc-mode-map "jR" 'calc-commute-right) | |
339 (define-key calc-mode-map "jS" 'calc-select-here-maybe) | |
340 (define-key calc-mode-map "jU" 'calc-sel-unpack) | |
341 (define-key calc-mode-map "j&" 'calc-sel-invert) | |
342 (define-key calc-mode-map "j\r" 'calc-copy-selection) | |
343 (define-key calc-mode-map "j\n" 'calc-copy-selection) | |
344 (define-key calc-mode-map "j\010" 'calc-del-selection) | |
345 (define-key calc-mode-map "j\177" 'calc-del-selection) | |
346 (define-key calc-mode-map "j'" 'calc-enter-selection) | |
347 (define-key calc-mode-map "j`" 'calc-edit-selection) | |
348 (define-key calc-mode-map "j+" 'calc-sel-add-both-sides) | |
349 (define-key calc-mode-map "j-" 'calc-sel-sub-both-sides) | |
350 (define-key calc-mode-map "j*" 'calc-sel-mult-both-sides) | |
351 (define-key calc-mode-map "j/" 'calc-sel-div-both-sides) | |
352 (define-key calc-mode-map "j\"" 'calc-sel-expand-formula) | |
353 | |
354 (define-key calc-mode-map "k" nil) | |
355 (define-key calc-mode-map "k?" 'calc-k-prefix-help) | |
356 (define-key calc-mode-map "ka" 'calc-random-again) | |
357 (define-key calc-mode-map "kb" 'calc-bernoulli-number) | |
358 (define-key calc-mode-map "kc" 'calc-choose) | |
359 (define-key calc-mode-map "kd" 'calc-double-factorial) | |
360 (define-key calc-mode-map "ke" 'calc-euler-number) | |
361 (define-key calc-mode-map "kf" 'calc-prime-factors) | |
362 (define-key calc-mode-map "kg" 'calc-gcd) | |
363 (define-key calc-mode-map "kh" 'calc-shuffle) | |
364 (define-key calc-mode-map "kl" 'calc-lcm) | |
365 (define-key calc-mode-map "km" 'calc-moebius) | |
366 (define-key calc-mode-map "kn" 'calc-next-prime) | |
367 (define-key calc-mode-map "kp" 'calc-prime-test) | |
368 (define-key calc-mode-map "kr" 'calc-random) | |
369 (define-key calc-mode-map "ks" 'calc-stirling-number) | |
370 (define-key calc-mode-map "kt" 'calc-totient) | |
371 (define-key calc-mode-map "kB" 'calc-utpb) | |
372 (define-key calc-mode-map "kC" 'calc-utpc) | |
373 (define-key calc-mode-map "kE" 'calc-extended-gcd) | |
374 (define-key calc-mode-map "kF" 'calc-utpf) | |
375 (define-key calc-mode-map "kK" 'calc-keep-args) | |
376 (define-key calc-mode-map "kN" 'calc-utpn) | |
377 (define-key calc-mode-map "kP" 'calc-utpp) | |
378 (define-key calc-mode-map "kT" 'calc-utpt) | |
379 | |
380 (define-key calc-mode-map "m" nil) | |
381 (define-key calc-mode-map "m?" 'calc-m-prefix-help) | |
382 (define-key calc-mode-map "ma" 'calc-algebraic-mode) | |
383 (define-key calc-mode-map "md" 'calc-degrees-mode) | |
62176
1a2830897544
Add `calc-embedded-preserve-modes' to autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
62034
diff
changeset
|
384 (define-key calc-mode-map "me" 'calc-embedded-preserve-modes) |
40785 | 385 (define-key calc-mode-map "mf" 'calc-frac-mode) |
386 (define-key calc-mode-map "mg" 'calc-get-modes) | |
387 (define-key calc-mode-map "mh" 'calc-hms-mode) | |
388 (define-key calc-mode-map "mi" 'calc-infinite-mode) | |
389 (define-key calc-mode-map "mm" 'calc-save-modes) | |
390 (define-key calc-mode-map "mp" 'calc-polar-mode) | |
391 (define-key calc-mode-map "mr" 'calc-radians-mode) | |
392 (define-key calc-mode-map "ms" 'calc-symbolic-mode) | |
393 (define-key calc-mode-map "mt" 'calc-total-algebraic-mode) | |
394 (define-key calc-mode-map "\emt" 'calc-total-algebraic-mode) | |
395 (define-key calc-mode-map "\em\et" 'calc-total-algebraic-mode) | |
396 (define-key calc-mode-map "mv" 'calc-matrix-mode) | |
397 (define-key calc-mode-map "mw" 'calc-working) | |
398 (define-key calc-mode-map "mx" 'calc-always-load-extensions) | |
399 (define-key calc-mode-map "mA" 'calc-alg-simplify-mode) | |
400 (define-key calc-mode-map "mB" 'calc-bin-simplify-mode) | |
401 (define-key calc-mode-map "mC" 'calc-auto-recompute) | |
402 (define-key calc-mode-map "mD" 'calc-default-simplify-mode) | |
403 (define-key calc-mode-map "mE" 'calc-ext-simplify-mode) | |
404 (define-key calc-mode-map "mF" 'calc-settings-file-name) | |
405 (define-key calc-mode-map "mM" 'calc-more-recursion-depth) | |
406 (define-key calc-mode-map "mN" 'calc-num-simplify-mode) | |
407 (define-key calc-mode-map "mO" 'calc-no-simplify-mode) | |
408 (define-key calc-mode-map "mR" 'calc-mode-record-mode) | |
409 (define-key calc-mode-map "mS" 'calc-shift-prefix) | |
410 (define-key calc-mode-map "mU" 'calc-units-simplify-mode) | |
411 (define-key calc-mode-map "mX" 'calc-load-everything) | |
412 | |
413 (define-key calc-mode-map "r" nil) | |
414 (define-key calc-mode-map "r?" 'calc-r-prefix-help) | |
415 | |
416 (define-key calc-mode-map "s" nil) | |
417 (define-key calc-mode-map "s?" 'calc-s-prefix-help) | |
418 (define-key calc-mode-map "sc" 'calc-copy-variable) | |
419 (define-key calc-mode-map "sd" 'calc-declare-variable) | |
420 (define-key calc-mode-map "se" 'calc-edit-variable) | |
421 (define-key calc-mode-map "si" 'calc-insert-variables) | |
62390
3e124bbd072e
(calc-init-extensions): Add `calc-copy-special-constant'.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
62176
diff
changeset
|
422 (define-key calc-mode-map "sk" 'calc-copy-special-constant) |
40785 | 423 (define-key calc-mode-map "sl" 'calc-let) |
424 (define-key calc-mode-map "sm" 'calc-store-map) | |
425 (define-key calc-mode-map "sn" 'calc-store-neg) | |
426 (define-key calc-mode-map "sp" 'calc-permanent-variable) | |
427 (define-key calc-mode-map "sr" 'calc-recall) | |
428 (define-key calc-mode-map "ss" 'calc-store) | |
429 (define-key calc-mode-map "st" 'calc-store-into) | |
430 (define-key calc-mode-map "su" 'calc-unstore) | |
431 (define-key calc-mode-map "sx" 'calc-store-exchange) | |
432 (define-key calc-mode-map "sA" 'calc-edit-AlgSimpRules) | |
433 (define-key calc-mode-map "sD" 'calc-edit-Decls) | |
434 (define-key calc-mode-map "sE" 'calc-edit-EvalRules) | |
435 (define-key calc-mode-map "sF" 'calc-edit-FitRules) | |
436 (define-key calc-mode-map "sG" 'calc-edit-GenCount) | |
437 (define-key calc-mode-map "sH" 'calc-edit-Holidays) | |
438 (define-key calc-mode-map "sI" 'calc-edit-IntegLimit) | |
439 (define-key calc-mode-map "sL" 'calc-edit-LineStyles) | |
440 (define-key calc-mode-map "sP" 'calc-edit-PointStyles) | |
441 (define-key calc-mode-map "sR" 'calc-edit-PlotRejects) | |
442 (define-key calc-mode-map "sS" 'calc-sin) | |
443 (define-key calc-mode-map "sT" 'calc-edit-TimeZone) | |
444 (define-key calc-mode-map "sU" 'calc-edit-Units) | |
445 (define-key calc-mode-map "sX" 'calc-edit-ExtSimpRules) | |
446 (define-key calc-mode-map "s+" 'calc-store-plus) | |
447 (define-key calc-mode-map "s-" 'calc-store-minus) | |
448 (define-key calc-mode-map "s*" 'calc-store-times) | |
449 (define-key calc-mode-map "s/" 'calc-store-div) | |
450 (define-key calc-mode-map "s^" 'calc-store-power) | |
451 (define-key calc-mode-map "s|" 'calc-store-concat) | |
452 (define-key calc-mode-map "s&" 'calc-store-inv) | |
453 (define-key calc-mode-map "s[" 'calc-store-decr) | |
454 (define-key calc-mode-map "s]" 'calc-store-incr) | |
455 (define-key calc-mode-map "s:" 'calc-assign) | |
456 (define-key calc-mode-map "s=" 'calc-evalto) | |
457 | |
458 (define-key calc-mode-map "t" nil) | |
459 (define-key calc-mode-map "t?" 'calc-t-prefix-help) | |
460 (define-key calc-mode-map "tb" 'calc-trail-backward) | |
461 (define-key calc-mode-map "td" 'calc-trail-display) | |
462 (define-key calc-mode-map "tf" 'calc-trail-forward) | |
463 (define-key calc-mode-map "th" 'calc-trail-here) | |
464 (define-key calc-mode-map "ti" 'calc-trail-in) | |
465 (define-key calc-mode-map "tk" 'calc-trail-kill) | |
466 (define-key calc-mode-map "tm" 'calc-trail-marker) | |
467 (define-key calc-mode-map "tn" 'calc-trail-next) | |
468 (define-key calc-mode-map "to" 'calc-trail-out) | |
469 (define-key calc-mode-map "tp" 'calc-trail-previous) | |
470 (define-key calc-mode-map "tr" 'calc-trail-isearch-backward) | |
471 (define-key calc-mode-map "ts" 'calc-trail-isearch-forward) | |
472 (define-key calc-mode-map "ty" 'calc-trail-yank) | |
473 (define-key calc-mode-map "t[" 'calc-trail-first) | |
474 (define-key calc-mode-map "t]" 'calc-trail-last) | |
475 (define-key calc-mode-map "t<" 'calc-trail-scroll-left) | |
476 (define-key calc-mode-map "t>" 'calc-trail-scroll-right) | |
477 (define-key calc-mode-map "t{" 'calc-trail-backward) | |
478 (define-key calc-mode-map "t}" 'calc-trail-forward) | |
479 (define-key calc-mode-map "t." 'calc-full-trail-vectors) | |
480 (define-key calc-mode-map "tC" 'calc-convert-time-zones) | |
481 (define-key calc-mode-map "tD" 'calc-date) | |
482 (define-key calc-mode-map "tI" 'calc-inc-month) | |
483 (define-key calc-mode-map "tJ" 'calc-julian) | |
484 (define-key calc-mode-map "tM" 'calc-new-month) | |
485 (define-key calc-mode-map "tN" 'calc-now) | |
486 (define-key calc-mode-map "tP" 'calc-date-part) | |
487 (define-key calc-mode-map "tT" 'calc-tan) | |
488 (define-key calc-mode-map "tU" 'calc-unix-time) | |
489 (define-key calc-mode-map "tW" 'calc-new-week) | |
490 (define-key calc-mode-map "tY" 'calc-new-year) | |
491 (define-key calc-mode-map "tZ" 'calc-time-zone) | |
492 (define-key calc-mode-map "t+" 'calc-business-days-plus) | |
493 (define-key calc-mode-map "t-" 'calc-business-days-minus) | |
494 | |
495 (define-key calc-mode-map "u" 'nil) | |
496 (define-key calc-mode-map "u?" 'calc-u-prefix-help) | |
497 (define-key calc-mode-map "ua" 'calc-autorange-units) | |
498 (define-key calc-mode-map "ub" 'calc-base-units) | |
499 (define-key calc-mode-map "uc" 'calc-convert-units) | |
500 (define-key calc-mode-map "ud" 'calc-define-unit) | |
501 (define-key calc-mode-map "ue" 'calc-explain-units) | |
502 (define-key calc-mode-map "ug" 'calc-get-unit-definition) | |
503 (define-key calc-mode-map "up" 'calc-permanent-units) | |
504 (define-key calc-mode-map "ur" 'calc-remove-units) | |
505 (define-key calc-mode-map "us" 'calc-simplify-units) | |
506 (define-key calc-mode-map "ut" 'calc-convert-temperature) | |
507 (define-key calc-mode-map "uu" 'calc-undefine-unit) | |
508 (define-key calc-mode-map "uv" 'calc-enter-units-table) | |
509 (define-key calc-mode-map "ux" 'calc-extract-units) | |
510 (define-key calc-mode-map "uV" 'calc-view-units-table) | |
511 (define-key calc-mode-map "uC" 'calc-vector-covariance) | |
512 (define-key calc-mode-map "uG" 'calc-vector-geometric-mean) | |
513 (define-key calc-mode-map "uM" 'calc-vector-mean) | |
514 (define-key calc-mode-map "uN" 'calc-vector-min) | |
515 (define-key calc-mode-map "uS" 'calc-vector-sdev) | |
516 (define-key calc-mode-map "uU" 'calc-undo) | |
517 (define-key calc-mode-map "uX" 'calc-vector-max) | |
518 (define-key calc-mode-map "u#" 'calc-vector-count) | |
519 (define-key calc-mode-map "u+" 'calc-vector-sum) | |
520 (define-key calc-mode-map "u*" 'calc-vector-product) | |
521 | |
522 (define-key calc-mode-map "v" 'nil) | |
523 (define-key calc-mode-map "v?" 'calc-v-prefix-help) | |
524 (define-key calc-mode-map "va" 'calc-arrange-vector) | |
525 (define-key calc-mode-map "vb" 'calc-build-vector) | |
526 (define-key calc-mode-map "vc" 'calc-mcol) | |
527 (define-key calc-mode-map "vd" 'calc-diag) | |
528 (define-key calc-mode-map "ve" 'calc-expand-vector) | |
529 (define-key calc-mode-map "vf" 'calc-vector-find) | |
530 (define-key calc-mode-map "vh" 'calc-head) | |
531 (define-key calc-mode-map "vi" 'calc-ident) | |
532 (define-key calc-mode-map "vk" 'calc-cons) | |
533 (define-key calc-mode-map "vl" 'calc-vlength) | |
534 (define-key calc-mode-map "vm" 'calc-mask-vector) | |
535 (define-key calc-mode-map "vn" 'calc-rnorm) | |
536 (define-key calc-mode-map "vp" 'calc-pack) | |
537 (define-key calc-mode-map "vr" 'calc-mrow) | |
538 (define-key calc-mode-map "vs" 'calc-subvector) | |
539 (define-key calc-mode-map "vt" 'calc-transpose) | |
540 (define-key calc-mode-map "vu" 'calc-unpack) | |
541 (define-key calc-mode-map "vv" 'calc-reverse-vector) | |
542 (define-key calc-mode-map "vx" 'calc-index) | |
543 (define-key calc-mode-map "vA" 'calc-apply) | |
544 (define-key calc-mode-map "vC" 'calc-cross) | |
545 (define-key calc-mode-map "vD" 'calc-mdet) | |
546 (define-key calc-mode-map "vE" 'calc-set-enumerate) | |
547 (define-key calc-mode-map "vF" 'calc-set-floor) | |
548 (define-key calc-mode-map "vG" 'calc-grade) | |
549 (define-key calc-mode-map "vH" 'calc-histogram) | |
550 (define-key calc-mode-map "vI" 'calc-inner-product) | |
551 (define-key calc-mode-map "vJ" 'calc-conj-transpose) | |
552 (define-key calc-mode-map "vL" 'calc-mlud) | |
553 (define-key calc-mode-map "vM" 'calc-map) | |
554 (define-key calc-mode-map "vN" 'calc-cnorm) | |
555 (define-key calc-mode-map "vO" 'calc-outer-product) | |
556 (define-key calc-mode-map "vR" 'calc-reduce) | |
557 (define-key calc-mode-map "vS" 'calc-sort) | |
558 (define-key calc-mode-map "vT" 'calc-mtrace) | |
559 (define-key calc-mode-map "vU" 'calc-accumulate) | |
560 (define-key calc-mode-map "vV" 'calc-set-union) | |
561 (define-key calc-mode-map "vX" 'calc-set-xor) | |
562 (define-key calc-mode-map "v^" 'calc-set-intersect) | |
563 (define-key calc-mode-map "v-" 'calc-set-difference) | |
564 (define-key calc-mode-map "v~" 'calc-set-complement) | |
565 (define-key calc-mode-map "v:" 'calc-set-span) | |
566 (define-key calc-mode-map "v#" 'calc-set-cardinality) | |
567 (define-key calc-mode-map "v+" 'calc-remove-duplicates) | |
568 (define-key calc-mode-map "v&" 'calc-inv) | |
569 (define-key calc-mode-map "v<" 'calc-matrix-left-justify) | |
570 (define-key calc-mode-map "v=" 'calc-matrix-center-justify) | |
571 (define-key calc-mode-map "v>" 'calc-matrix-right-justify) | |
572 (define-key calc-mode-map "v." 'calc-full-vectors) | |
573 (define-key calc-mode-map "v/" 'calc-break-vectors) | |
574 (define-key calc-mode-map "v," 'calc-vector-commas) | |
575 (define-key calc-mode-map "v[" 'calc-vector-brackets) | |
576 (define-key calc-mode-map "v]" 'calc-matrix-brackets) | |
577 (define-key calc-mode-map "v{" 'calc-vector-braces) | |
578 (define-key calc-mode-map "v}" 'calc-matrix-brackets) | |
579 (define-key calc-mode-map "v(" 'calc-vector-parens) | |
580 (define-key calc-mode-map "v)" 'calc-matrix-brackets) | |
54584 | 581 ;; We can't rely on the automatic upper->lower conversion because |
582 ;; in the global map V is explicitly bound, so we need to bind it | |
583 ;; explicitly as well :-( --stef | |
40785 | 584 (define-key calc-mode-map "V" (lookup-key calc-mode-map "v")) |
585 | |
586 (define-key calc-mode-map "z" 'nil) | |
587 (define-key calc-mode-map "z?" 'calc-z-prefix-help) | |
588 | |
589 (define-key calc-mode-map "Z" 'nil) | |
590 (define-key calc-mode-map "Z?" 'calc-shift-Z-prefix-help) | |
591 (define-key calc-mode-map "ZC" 'calc-user-define-composition) | |
592 (define-key calc-mode-map "ZD" 'calc-user-define) | |
593 (define-key calc-mode-map "ZE" 'calc-user-define-edit) | |
594 (define-key calc-mode-map "ZF" 'calc-user-define-formula) | |
595 (define-key calc-mode-map "ZG" 'calc-get-user-defn) | |
596 (define-key calc-mode-map "ZI" 'calc-user-define-invocation) | |
597 (define-key calc-mode-map "ZK" 'calc-user-define-kbd-macro) | |
598 (define-key calc-mode-map "ZP" 'calc-user-define-permanent) | |
599 (define-key calc-mode-map "ZS" 'calc-edit-user-syntax) | |
600 (define-key calc-mode-map "ZT" 'calc-timing) | |
601 (define-key calc-mode-map "ZU" 'calc-user-undefine) | |
602 (define-key calc-mode-map "Z[" 'calc-kbd-if) | |
603 (define-key calc-mode-map "Z:" 'calc-kbd-else) | |
604 (define-key calc-mode-map "Z|" 'calc-kbd-else-if) | |
605 (define-key calc-mode-map "Z]" 'calc-kbd-end-if) | |
606 (define-key calc-mode-map "Z<" 'calc-kbd-repeat) | |
607 (define-key calc-mode-map "Z>" 'calc-kbd-end-repeat) | |
608 (define-key calc-mode-map "Z(" 'calc-kbd-for) | |
609 (define-key calc-mode-map "Z)" 'calc-kbd-end-for) | |
610 (define-key calc-mode-map "Z{" 'calc-kbd-loop) | |
611 (define-key calc-mode-map "Z}" 'calc-kbd-end-loop) | |
612 (define-key calc-mode-map "Z/" 'calc-kbd-break) | |
613 (define-key calc-mode-map "Z`" 'calc-kbd-push) | |
614 (define-key calc-mode-map "Z'" 'calc-kbd-pop) | |
615 (define-key calc-mode-map "Z=" 'calc-kbd-report) | |
616 (define-key calc-mode-map "Z#" 'calc-kbd-query) | |
617 | |
618 (calc-init-prefixes) | |
619 | |
620 (mapcar (function | |
621 (lambda (x) | |
622 (define-key calc-mode-map (format "c%c" x) 'calc-clean-num) | |
623 (define-key calc-mode-map (format "j%c" x) 'calc-select-part) | |
624 (define-key calc-mode-map (format "r%c" x) 'calc-recall-quick) | |
625 (define-key calc-mode-map (format "s%c" x) 'calc-store-quick) | |
626 (define-key calc-mode-map (format "t%c" x) 'calc-store-into-quick) | |
627 (define-key calc-mode-map (format "u%c" x) 'calc-quick-units))) | |
628 "0123456789") | |
629 | |
630 (let ((i ?A)) | |
57589
e28f2c4ffed4
(calc-init-extensions): Define `calc-alg-map' and `calc-alg-esc-map'
Jay Belanger <jay.p.belanger@gmail.com>
parents:
54584
diff
changeset
|
631 (while (<= i ?z) |
e28f2c4ffed4
(calc-init-extensions): Define `calc-alg-map' and `calc-alg-esc-map'
Jay Belanger <jay.p.belanger@gmail.com>
parents:
54584
diff
changeset
|
632 (if (eq (car-safe (aref (nth 1 calc-mode-map) i)) 'keymap) |
e28f2c4ffed4
(calc-init-extensions): Define `calc-alg-map' and `calc-alg-esc-map'
Jay Belanger <jay.p.belanger@gmail.com>
parents:
54584
diff
changeset
|
633 (aset (nth 1 calc-mode-map) i |
e28f2c4ffed4
(calc-init-extensions): Define `calc-alg-map' and `calc-alg-esc-map'
Jay Belanger <jay.p.belanger@gmail.com>
parents:
54584
diff
changeset
|
634 (cons 'keymap (cons (cons ?\e (aref (nth 1 calc-mode-map) i)) |
e28f2c4ffed4
(calc-init-extensions): Define `calc-alg-map' and `calc-alg-esc-map'
Jay Belanger <jay.p.belanger@gmail.com>
parents:
54584
diff
changeset
|
635 (cdr (aref (nth 1 calc-mode-map) i)))))) |
40785 | 636 (setq i (1+ i)))) |
57589
e28f2c4ffed4
(calc-init-extensions): Define `calc-alg-map' and `calc-alg-esc-map'
Jay Belanger <jay.p.belanger@gmail.com>
parents:
54584
diff
changeset
|
637 |
e28f2c4ffed4
(calc-init-extensions): Define `calc-alg-map' and `calc-alg-esc-map'
Jay Belanger <jay.p.belanger@gmail.com>
parents:
54584
diff
changeset
|
638 (setq calc-alg-map (copy-keymap calc-mode-map) |
e28f2c4ffed4
(calc-init-extensions): Define `calc-alg-map' and `calc-alg-esc-map'
Jay Belanger <jay.p.belanger@gmail.com>
parents:
54584
diff
changeset
|
639 calc-alg-esc-map (copy-keymap esc-map)) |
40785 | 640 (let ((i 32)) |
641 (while (< i 127) | |
642 (or (memq i '(?' ?` ?= ??)) | |
57589
e28f2c4ffed4
(calc-init-extensions): Define `calc-alg-map' and `calc-alg-esc-map'
Jay Belanger <jay.p.belanger@gmail.com>
parents:
54584
diff
changeset
|
643 (aset (nth 1 calc-alg-map) i 'calc-auto-algebraic-entry)) |
40785 | 644 (or (memq i '(?# ?x ?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9)) |
57589
e28f2c4ffed4
(calc-init-extensions): Define `calc-alg-map' and `calc-alg-esc-map'
Jay Belanger <jay.p.belanger@gmail.com>
parents:
54584
diff
changeset
|
645 (aset (nth 1 calc-alg-esc-map) i (aref (nth 1 calc-mode-map) i))) |
40785 | 646 (setq i (1+ i)))) |
647 (define-key calc-alg-map "\e" calc-alg-esc-map) | |
648 (define-key calc-alg-map "\e\t" 'calc-roll-up) | |
649 (define-key calc-alg-map "\e\C-m" 'calc-last-args-stub) | |
650 (define-key calc-alg-map "\e\177" 'calc-pop-above) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49263
diff
changeset
|
651 |
40785 | 652 ;;;; (Autoloads here) |
653 (mapcar (function (lambda (x) | |
654 (mapcar (function (lambda (func) | |
655 (autoload func (car x)))) (cdr x)))) | |
656 '( | |
657 | |
58652
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
658 ("calc-alg" calc-has-rules math-defsimplify |
40785 | 659 calc-modify-simplify-mode calcFunc-collect calcFunc-esimplify |
660 calcFunc-islin calcFunc-islinnt calcFunc-lin calcFunc-linnt | |
661 calcFunc-simplify calcFunc-subst math-beforep | |
662 math-build-polynomial-expr math-expand-formula math-expr-contains | |
663 math-expr-contains-count math-expr-depends math-expr-height | |
664 math-expr-subst math-expr-weight math-integer-plus math-is-linear | |
665 math-is-multiple math-is-polynomial math-linear-in math-multiple-of | |
58652
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
666 math-poly-depends math-poly-mix math-poly-mul |
40785 | 667 math-poly-simplify math-poly-zerop math-polynomial-base |
668 math-polynomial-p math-recompile-eval-rules math-simplify | |
669 math-simplify-exp math-simplify-extended math-simplify-sqrt | |
670 math-to-simple-fraction) | |
671 | |
58652
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
672 ("calcalg2" calcFunc-asum calcFunc-deriv |
40785 | 673 calcFunc-ffinv calcFunc-finv calcFunc-fsolve calcFunc-gpoly |
674 calcFunc-integ calcFunc-poly calcFunc-prod calcFunc-roots | |
675 calcFunc-solve calcFunc-sum calcFunc-table calcFunc-taylor | |
676 calcFunc-tderiv math-expr-calls math-integral-q02 math-integral-q12 | |
677 math-integral-rational-funcs math-lcm-denoms math-looks-evenp | |
678 math-poly-all-roots math-prod-rec math-reject-solution math-solve-eqn | |
679 math-solve-for math-sum-rec math-try-integral) | |
680 | |
58652
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
681 ("calcalg3" calcFunc-efit calcFunc-fit |
40785 | 682 calcFunc-fitdummy calcFunc-fitparam calcFunc-fitvar |
683 calcFunc-hasfitparams calcFunc-hasfitvars calcFunc-maximize | |
684 calcFunc-minimize calcFunc-ninteg calcFunc-polint calcFunc-ratint | |
685 calcFunc-root calcFunc-wmaximize calcFunc-wminimize calcFunc-wroot | |
686 calcFunc-xfit math-find-minimum math-find-root math-ninteg-evaluate | |
687 math-ninteg-midpoint math-ninteg-romberg math-poly-interp) | |
688 | |
58652
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
689 ("calc-arith" calcFunc-abs calcFunc-abssqr |
40785 | 690 calcFunc-add calcFunc-ceil calcFunc-decr calcFunc-deven calcFunc-dimag |
691 calcFunc-dint calcFunc-div calcFunc-dnatnum calcFunc-dneg | |
692 calcFunc-dnonneg calcFunc-dnonzero calcFunc-dnumint calcFunc-dodd | |
693 calcFunc-dpos calcFunc-drange calcFunc-drat calcFunc-dreal | |
694 calcFunc-dscalar calcFunc-fceil calcFunc-ffloor calcFunc-float | |
695 calcFunc-fround calcFunc-frounde calcFunc-froundu calcFunc-ftrunc | |
696 calcFunc-idiv calcFunc-incr calcFunc-mant calcFunc-max calcFunc-min | |
697 calcFunc-mod calcFunc-mul calcFunc-neg calcFunc-percent calcFunc-pow | |
698 calcFunc-relch calcFunc-round calcFunc-rounde calcFunc-roundu | |
699 calcFunc-scf calcFunc-sub calcFunc-xpon math-abs math-abs-approx | |
700 math-add-objects-fancy math-add-or-sub math-add-symb-fancy | |
701 math-ceiling math-combine-prod math-combine-sum math-div-by-zero | |
702 math-div-objects-fancy math-div-symb-fancy math-div-zero | |
703 math-float-fancy math-floor-fancy math-floor-special math-guess-if-neg | |
704 math-intv-constp math-known-evenp math-known-imagp math-known-integerp | |
705 math-known-matrixp math-known-negp math-known-nonnegp | |
706 math-known-nonposp math-known-nonzerop math-known-num-integerp | |
707 math-known-oddp math-known-posp math-known-realp math-known-scalarp | |
708 math-max math-min math-mod-fancy math-mul-float math-mul-objects-fancy | |
709 math-mul-or-div math-mul-symb-fancy math-mul-zero math-neg-fancy | |
710 math-neg-float math-okay-neg math-possible-signs math-possible-types | |
711 math-pow-fancy math-pow-mod math-pow-of-zero math-pow-zero | |
712 math-quarter-integer math-round math-setup-declarations math-sqr | |
713 math-sqr-float math-trunc-fancy math-trunc-special) | |
714 | |
58652
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
715 ("calc-bin" calcFunc-and calcFunc-ash |
40785 | 716 calcFunc-clip calcFunc-diff calcFunc-lsh calcFunc-not calcFunc-or |
717 calcFunc-rash calcFunc-rot calcFunc-rsh calcFunc-xor math-clip | |
718 math-compute-max-digits math-convert-radix-digits math-float-parts | |
719 math-format-bignum-binary math-format-bignum-hex | |
720 math-format-bignum-octal math-format-bignum-radix math-format-binary | |
721 math-format-radix math-format-radix-float math-integer-log2 | |
722 math-power-of-2 math-radix-float-power) | |
723 | |
58652
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
724 ("calc-comb" calc-report-prime-test |
40785 | 725 calcFunc-choose calcFunc-dfact calcFunc-egcd calcFunc-fact |
726 calcFunc-gcd calcFunc-lcm calcFunc-moebius calcFunc-nextprime | |
727 calcFunc-perm calcFunc-prevprime calcFunc-prfac calcFunc-prime | |
728 calcFunc-random calcFunc-shuffle calcFunc-stir1 calcFunc-stir2 | |
729 calcFunc-totient math-init-random-base math-member math-prime-test | |
730 math-random-base) | |
731 | |
58652
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
732 ("calccomp" calcFunc-cascent calcFunc-cdescent |
40785 | 733 calcFunc-cheight calcFunc-cwidth math-comp-ascent math-comp-descent |
734 math-comp-height math-comp-width math-compose-expr | |
735 math-composition-to-string math-stack-value-offset-fancy | |
736 math-vector-is-string math-vector-to-string) | |
737 | |
58652
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
738 ("calc-cplx" calcFunc-arg calcFunc-conj |
40785 | 739 calcFunc-im calcFunc-polar calcFunc-re calcFunc-rect math-complex |
740 math-fix-circular math-imaginary math-imaginary-i math-normalize-polar | |
741 math-polar math-want-polar) | |
742 | |
58652
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
743 ("calc-embed" calc-do-embedded |
40785 | 744 calc-do-embedded-activate calc-embedded-evaluate-expr |
62176
1a2830897544
Add `calc-embedded-preserve-modes' to autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
62034
diff
changeset
|
745 calc-embedded-modes-change calc-embedded-var-change |
1a2830897544
Add `calc-embedded-preserve-modes' to autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
62034
diff
changeset
|
746 calc-embedded-preserve-modes) |
40785 | 747 |
58652
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
748 ("calc-fin" calc-to-percentage calcFunc-ddb |
40785 | 749 calcFunc-fv calcFunc-fvb calcFunc-fvl calcFunc-irr calcFunc-irrb |
750 calcFunc-nper calcFunc-nperb calcFunc-nperl calcFunc-npv calcFunc-npvb | |
751 calcFunc-pmt calcFunc-pmtb calcFunc-pv calcFunc-pvb calcFunc-pvl | |
752 calcFunc-rate calcFunc-rateb calcFunc-ratel calcFunc-sln calcFunc-syd) | |
753 | |
58652
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
754 ("calc-forms" calcFunc-badd calcFunc-bsub |
40785 | 755 calcFunc-date calcFunc-day calcFunc-dsadj calcFunc-hms |
756 calcFunc-holiday calcFunc-hour calcFunc-incmonth calcFunc-incyear | |
757 calcFunc-intv calcFunc-julian calcFunc-makemod calcFunc-minute | |
758 calcFunc-month calcFunc-newmonth calcFunc-newweek calcFunc-newyear | |
759 calcFunc-now calcFunc-pwday calcFunc-sdev calcFunc-second | |
760 calcFunc-time calcFunc-tzconv calcFunc-tzone calcFunc-unixtime | |
761 calcFunc-weekday calcFunc-year calcFunc-yearday math-combine-intervals | |
762 math-date-parts math-date-to-dt math-div-mod math-dt-to-date | |
763 math-format-date math-from-business-day math-from-hms math-make-intv | |
764 math-make-mod math-make-sdev math-mod-intv math-normalize-hms | |
765 math-normalize-mod math-parse-date math-read-angle-brackets | |
766 math-setup-add-holidays math-setup-holidays math-setup-year-holidays | |
767 math-sort-intv math-to-business-day math-to-hms) | |
768 | |
58652
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
769 ("calc-frac" calc-add-fractions |
40785 | 770 calc-div-fractions calc-mul-fractions calcFunc-fdiv calcFunc-frac |
771 math-make-frac) | |
772 | |
58652
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
773 ("calc-funcs" calc-prob-dist calcFunc-bern |
40785 | 774 calcFunc-besJ calcFunc-besY calcFunc-beta calcFunc-betaB |
775 calcFunc-betaI calcFunc-erf calcFunc-erfc calcFunc-euler | |
776 calcFunc-gamma calcFunc-gammaG calcFunc-gammaP calcFunc-gammaQ | |
777 calcFunc-gammag calcFunc-ltpb calcFunc-ltpc calcFunc-ltpf | |
778 calcFunc-ltpn calcFunc-ltpp calcFunc-ltpt calcFunc-utpb calcFunc-utpc | |
779 calcFunc-utpf calcFunc-utpn calcFunc-utpp calcFunc-utpt | |
780 math-bernoulli-number math-gammap1-raw) | |
781 | |
58652
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
782 ("calc-graph" calc-graph-show-tty) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
783 |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
784 ("calc-incom" calc-digit-dots) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
785 |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
786 ("calc-keypd" calc-do-keypad |
40785 | 787 calc-keypad-x-left-click calc-keypad-x-middle-click |
788 calc-keypad-x-right-click) | |
789 | |
58652
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
790 ("calc-lang" calc-set-language |
40785 | 791 math-read-big-balance math-read-big-rec) |
792 | |
58652
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
793 ("calc-map" calc-get-operator calcFunc-accum |
40785 | 794 calcFunc-afixp calcFunc-anest calcFunc-apply calcFunc-call |
795 calcFunc-fixp calcFunc-inner calcFunc-map calcFunc-mapa calcFunc-mapc | |
796 calcFunc-mapd calcFunc-mapeq calcFunc-mapeqp calcFunc-mapeqr | |
797 calcFunc-mapr calcFunc-nest calcFunc-outer calcFunc-raccum | |
798 calcFunc-reduce calcFunc-reducea calcFunc-reducec calcFunc-reduced | |
799 calcFunc-reducer calcFunc-rreduce calcFunc-rreducea calcFunc-rreducec | |
800 calcFunc-rreduced calcFunc-rreducer math-build-call | |
801 math-calcFunc-to-var math-multi-subst math-multi-subst-rec | |
802 math-var-to-calcFunc) | |
803 | |
58652
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
804 ("calc-mtx" calcFunc-det calcFunc-lud calcFunc-tr |
40785 | 805 math-col-matrix math-lud-solve math-matrix-inv-raw math-matrix-lud |
806 math-mul-mat-vec math-mul-mats math-row-matrix) | |
807 | |
58652
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
808 ("calc-math" calcFunc-alog calcFunc-arccos |
40785 | 809 calcFunc-arccosh calcFunc-arcsin calcFunc-arcsincos calcFunc-arcsinh |
60078
3482f7594027
Add functions to autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59828
diff
changeset
|
810 calcFunc-arctan calcFunc-arctan2 calcFunc-arctanh calcFunc-csc |
3482f7594027
Add functions to autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59828
diff
changeset
|
811 calcFunc-csch calcFunc-cos calcFunc-cosh calcFunc-cot calcFunc-coth |
3482f7594027
Add functions to autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59828
diff
changeset
|
812 calcFunc-deg calcFunc-exp calcFunc-exp10 calcFunc-expm1 |
40785 | 813 calcFunc-hypot calcFunc-ilog calcFunc-isqrt calcFunc-ln calcFunc-lnp1 |
60078
3482f7594027
Add functions to autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59828
diff
changeset
|
814 calcFunc-log calcFunc-log10 calcFunc-nroot calcFunc-rad calcFunc-sec |
3482f7594027
Add functions to autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59828
diff
changeset
|
815 calcFunc-sech calcFunc-sin |
40785 | 816 calcFunc-sincos calcFunc-sinh calcFunc-sqr calcFunc-sqrt calcFunc-tan |
817 calcFunc-tanh math-arccos-raw math-arcsin-raw math-arctan-raw | |
60078
3482f7594027
Add functions to autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59828
diff
changeset
|
818 math-arctan2-raw math-cos-raw math-cot-raw math-csc-raw |
3482f7594027
Add functions to autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59828
diff
changeset
|
819 math-exp-minus-1-raw math-exp-raw |
40785 | 820 math-from-radians math-from-radians-2 math-hypot math-infinite-dir |
821 math-isqrt-small math-ln-raw math-nearly-equal math-nearly-equal-float | |
822 math-nearly-zerop math-nearly-zerop-float math-nth-root | |
823 math-sin-cos-raw math-sin-raw math-sqrt math-sqrt-float math-sqrt-raw | |
824 math-tan-raw math-to-radians math-to-radians-2) | |
825 | |
58652
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
826 ("calc-mode" math-get-modes-vec) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
827 |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
828 ("calc-poly" calcFunc-apart calcFunc-expand |
40785 | 829 calcFunc-expandpow calcFunc-factor calcFunc-factors calcFunc-nrat |
830 calcFunc-pcont calcFunc-pdeg calcFunc-pdiv calcFunc-pdivide | |
831 calcFunc-pdivrem calcFunc-pgcd calcFunc-plead calcFunc-pprim | |
832 calcFunc-prem math-accum-factors math-atomic-factorp | |
833 math-div-poly-const math-div-thru math-expand-power math-expand-term | |
834 math-factor-contains math-factor-expr math-factor-expr-part | |
835 math-factor-expr-try math-factor-finish math-factor-poly-coefs | |
836 math-factor-protect math-mul-thru math-padded-polynomial | |
837 math-partial-fractions math-poly-degree math-poly-deriv-coefs | |
838 math-poly-gcd-frac-list math-poly-modulus-rec math-ratpoly-p | |
839 math-to-ratpoly math-to-ratpoly-rec) | |
840 | |
58652
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
841 ("calc-prog" calc-default-formula-arglist |
40785 | 842 calc-execute-kbd-macro calc-finish-user-syntax-edit |
843 calc-fix-token-name calc-fix-user-formula calc-read-parse-table | |
844 calc-read-parse-table-part calc-subsetp calc-write-parse-table | |
845 calc-write-parse-table-part calcFunc-constant calcFunc-eq calcFunc-geq | |
846 calcFunc-gt calcFunc-if calcFunc-in calcFunc-integer calcFunc-istrue | |
847 calcFunc-land calcFunc-leq calcFunc-lnot calcFunc-lor calcFunc-lt | |
848 calcFunc-negative calcFunc-neq calcFunc-nonvar calcFunc-real | |
849 calcFunc-refers calcFunc-rmeq calcFunc-typeof calcFunc-variable | |
850 math-body-refers-to math-break math-composite-inequalities | |
851 math-do-defmath math-handle-for math-handle-foreach | |
852 math-normalize-logical-op math-return) | |
853 | |
58652
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
854 ("calc-rewr" calcFunc-match calcFunc-matches |
40785 | 855 calcFunc-matchnot calcFunc-rewrite calcFunc-vmatches |
856 math-apply-rewrites math-compile-patterns math-compile-rewrites | |
857 math-flatten-lands math-match-patterns math-rewrite | |
858 math-rewrite-heads) | |
859 | |
860 ("calc-rules" calc-CommuteRules calc-DistribRules calc-FactorRules | |
861 calc-FitRules calc-IntegAfterRules calc-InvertRules calc-JumpRules | |
58652
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
862 calc-MergeRules calc-NegateRules |
40785 | 863 calc-compile-rule-set) |
864 | |
58652
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
865 ("calc-sel" calc-auto-selection |
40785 | 866 calc-delete-selection calc-encase-atoms calc-find-assoc-parent-formula |
867 calc-find-parent-formula calc-find-sub-formula calc-prepare-selection | |
868 calc-preserve-point calc-replace-selections calc-replace-sub-formula | |
869 calc-roll-down-with-selections calc-roll-up-with-selections | |
870 calc-sel-error) | |
871 | |
58652
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
872 ("calc-stat" calc-vector-op calcFunc-agmean |
40785 | 873 calcFunc-vcorr calcFunc-vcount calcFunc-vcov calcFunc-vflat |
874 calcFunc-vgmean calcFunc-vhmean calcFunc-vmax calcFunc-vmean | |
875 calcFunc-vmeane calcFunc-vmedian calcFunc-vmin calcFunc-vpcov | |
876 calcFunc-vprod calcFunc-vpsdev calcFunc-vpvar calcFunc-vsdev | |
877 calcFunc-vsum calcFunc-vvar math-flatten-many-vecs) | |
878 | |
58652
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
879 ("calc-store" calc-read-var-name |
40785 | 880 calc-store-value calc-var-name) |
881 | |
58652
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
882 ("calc-stuff" calc-explain-why calcFunc-clean |
40785 | 883 calcFunc-pclean calcFunc-pfloat calcFunc-pfrac) |
884 | |
58652
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
885 ("calc-units" calcFunc-usimplify |
40785 | 886 math-build-units-table math-build-units-table-buffer |
887 math-check-unit-name math-convert-temperature math-convert-units | |
888 math-extract-units math-remove-units math-simplify-units | |
889 math-single-units-in-expr-p math-to-standard-units | |
890 math-units-in-expr-p) | |
891 | |
58652
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
892 ("calc-vec" calcFunc-append calcFunc-appendrev |
40785 | 893 calcFunc-arrange calcFunc-cnorm calcFunc-cons calcFunc-cross |
894 calcFunc-ctrn calcFunc-cvec calcFunc-diag calcFunc-find | |
895 calcFunc-getdiag calcFunc-grade calcFunc-head calcFunc-histogram | |
896 calcFunc-idn calcFunc-index calcFunc-mcol calcFunc-mdims | |
897 calcFunc-mrcol calcFunc-mrow calcFunc-mrrow calcFunc-pack | |
898 calcFunc-rcons calcFunc-rdup calcFunc-rev calcFunc-rgrade | |
899 calcFunc-rhead calcFunc-rnorm calcFunc-rsort calcFunc-rsubvec | |
900 calcFunc-rtail calcFunc-sort calcFunc-subscr calcFunc-subvec | |
901 calcFunc-tail calcFunc-trn calcFunc-unpack calcFunc-unpackt | |
902 calcFunc-vcard calcFunc-vcompl calcFunc-vconcat calcFunc-vconcatrev | |
903 calcFunc-vdiff calcFunc-vec calcFunc-venum calcFunc-vexp | |
904 calcFunc-vfloor calcFunc-vint calcFunc-vlen calcFunc-vmask | |
905 calcFunc-vpack calcFunc-vspan calcFunc-vunion calcFunc-vunpack | |
906 calcFunc-vxor math-check-for-commas math-clean-set math-copy-matrix | |
907 math-dimension-error math-dot-product math-flatten-vector math-map-vec | |
908 math-map-vec-2 math-mat-col math-mimic-ident math-prepare-set | |
909 math-read-brackets math-reduce-cols math-reduce-vec math-transpose) | |
910 | |
58652
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
911 ("calc-yank" calc-alg-edit calc-clean-newlines |
40785 | 912 calc-do-grab-rectangle calc-do-grab-region calc-finish-stack-edit |
913 calc-force-refresh calc-locate-cursor-element calc-show-edit-buffer) | |
914 | |
915 )) | |
916 | |
917 (mapcar (function (lambda (x) | |
918 (mapcar (function (lambda (cmd) | |
919 (autoload cmd (car x) nil t))) (cdr x)))) | |
920 '( | |
921 | |
922 ("calc-alg" calc-alg-evaluate calc-apart calc-collect calc-expand | |
923 calc-expand-formula calc-factor calc-normalize-rat calc-poly-div | |
924 calc-poly-div-rem calc-poly-gcd calc-poly-rem calc-simplify | |
925 calc-simplify-extended calc-substitute) | |
926 | |
41453
1c2b2b53715a
(calc-init-extensions): Update the rest of the autoload names to match
Colin Walters <walters@gnu.org>
parents:
41386
diff
changeset
|
927 ("calcalg2" calc-alt-summation calc-derivative |
40785 | 928 calc-dump-integral-cache calc-integral calc-num-integral |
929 calc-poly-roots calc-product calc-solve-for calc-summation | |
930 calc-tabulate calc-taylor) | |
931 | |
41453
1c2b2b53715a
(calc-init-extensions): Update the rest of the autoload names to match
Colin Walters <walters@gnu.org>
parents:
41386
diff
changeset
|
932 ("calcalg3" calc-curve-fit calc-find-maximum calc-find-minimum |
40785 | 933 calc-find-root calc-poly-interp) |
934 | |
935 ("calc-arith" calc-abs calc-abssqr calc-ceiling calc-decrement | |
936 calc-floor calc-idiv calc-increment calc-mant-part calc-max calc-min | |
937 calc-round calc-scale-float calc-sign calc-trunc calc-xpon-part) | |
938 | |
939 ("calc-bin" calc-and calc-binary-radix calc-clip calc-decimal-radix | |
940 calc-diff calc-hex-radix calc-leading-zeros calc-lshift-arith | |
941 calc-lshift-binary calc-not calc-octal-radix calc-or calc-radix | |
942 calc-rotate-binary calc-rshift-arith calc-rshift-binary calc-word-size | |
943 calc-xor) | |
944 | |
945 ("calc-comb" calc-choose calc-double-factorial calc-extended-gcd | |
946 calc-factorial calc-gamma calc-gcd calc-lcm calc-moebius | |
947 calc-next-prime calc-perm calc-prev-prime calc-prime-factors | |
948 calc-prime-test calc-random calc-random-again calc-rrandom | |
949 calc-shuffle calc-totient) | |
950 | |
951 ("calc-cplx" calc-argument calc-complex-notation calc-i-notation | |
952 calc-im calc-j-notation calc-polar calc-polar-mode calc-re) | |
953 | |
954 ("calc-embed" calc-embedded-copy-formula-as-kill | |
955 calc-embedded-duplicate calc-embedded-edit calc-embedded-forget | |
956 calc-embedded-kill-formula calc-embedded-mark-formula | |
957 calc-embedded-new-formula calc-embedded-next calc-embedded-previous | |
958 calc-embedded-select calc-embedded-update-formula calc-embedded-word | |
959 calc-find-globals calc-show-plain) | |
960 | |
961 ("calc-fin" calc-convert-percent calc-fin-ddb calc-fin-fv | |
962 calc-fin-irr calc-fin-nper calc-fin-npv calc-fin-pmt calc-fin-pv | |
963 calc-fin-rate calc-fin-sln calc-fin-syd calc-percent-change) | |
964 | |
965 ("calc-forms" calc-business-days-minus calc-business-days-plus | |
966 calc-convert-time-zones calc-date calc-date-notation calc-date-part | |
967 calc-from-hms calc-hms-mode calc-hms-notation calc-inc-month | |
968 calc-julian calc-new-month calc-new-week calc-new-year calc-now | |
969 calc-time calc-time-zone calc-to-hms calc-unix-time) | |
970 | |
971 ("calc-frac" calc-fdiv calc-frac-mode calc-fraction | |
972 calc-over-notation calc-slash-notation) | |
973 | |
974 ("calc-funcs" calc-bernoulli-number calc-bessel-J calc-bessel-Y | |
975 calc-beta calc-erf calc-erfc calc-euler-number calc-inc-beta | |
976 calc-inc-gamma calc-stirling-number calc-utpb calc-utpc calc-utpf | |
977 calc-utpn calc-utpp calc-utpt) | |
978 | |
979 ("calc-graph" calc-graph-add calc-graph-add-3d calc-graph-border | |
980 calc-graph-clear calc-graph-command calc-graph-delete | |
981 calc-graph-device calc-graph-display calc-graph-fast | |
982 calc-graph-fast-3d calc-graph-geometry calc-graph-grid | |
983 calc-graph-header calc-graph-hide calc-graph-juggle calc-graph-key | |
984 calc-graph-kill calc-graph-line-style calc-graph-log-x | |
985 calc-graph-log-y calc-graph-log-z calc-graph-name | |
986 calc-graph-num-points calc-graph-output calc-graph-plot | |
987 calc-graph-point-style calc-graph-print calc-graph-quit | |
988 calc-graph-range-x calc-graph-range-y calc-graph-range-z | |
989 calc-graph-show-dumb calc-graph-title-x calc-graph-title-y | |
990 calc-graph-title-z calc-graph-view-commands calc-graph-view-trail | |
991 calc-graph-zero-x calc-graph-zero-y) | |
992 | |
993 ("calc-help" calc-a-prefix-help calc-b-prefix-help calc-c-prefix-help | |
994 calc-d-prefix-help calc-describe-function calc-describe-key | |
995 calc-describe-key-briefly calc-describe-variable calc-f-prefix-help | |
996 calc-full-help calc-g-prefix-help calc-help-prefix | |
997 calc-hyperbolic-prefix-help calc-inv-hyp-prefix-help | |
998 calc-inverse-prefix-help calc-j-prefix-help calc-k-prefix-help | |
999 calc-m-prefix-help calc-r-prefix-help calc-s-prefix-help | |
1000 calc-t-prefix-help calc-u-prefix-help calc-v-prefix-help) | |
1001 | |
1002 ("calc-incom" calc-begin-complex calc-begin-vector calc-comma | |
1003 calc-dots calc-end-complex calc-end-vector calc-semi) | |
1004 | |
1005 ("calc-keypd" calc-keypad-menu calc-keypad-menu-back | |
1006 calc-keypad-press) | |
1007 | |
1008 ("calc-lang" calc-big-language calc-c-language calc-eqn-language | |
1009 calc-flat-language calc-fortran-language calc-maple-language | |
1010 calc-mathematica-language calc-normal-language calc-pascal-language | |
59810
3192518bb184
Add calc-latex-language to autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59664
diff
changeset
|
1011 calc-tex-language calc-latex-language calc-unformatted-language) |
40785 | 1012 |
1013 ("calc-map" calc-accumulate calc-apply calc-inner-product calc-map | |
1014 calc-map-equation calc-map-stack calc-outer-product calc-reduce) | |
1015 | |
41453
1c2b2b53715a
(calc-init-extensions): Update the rest of the autoload names to match
Colin Walters <walters@gnu.org>
parents:
41386
diff
changeset
|
1016 ("calc-mtx" calc-mdet calc-mlud calc-mtrace) |
40785 | 1017 |
1018 ("calc-math" calc-arccos calc-arccosh calc-arcsin calc-arcsinh | |
1019 calc-arctan calc-arctan2 calc-arctanh calc-conj calc-cos calc-cosh | |
60078
3482f7594027
Add functions to autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59828
diff
changeset
|
1020 calc-cot calc-coth calc-csc calc-csch |
40785 | 1021 calc-degrees-mode calc-exp calc-expm1 calc-hypot calc-ilog |
1022 calc-imaginary calc-isqrt calc-ln calc-lnp1 calc-log calc-log10 | |
60078
3482f7594027
Add functions to autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59828
diff
changeset
|
1023 calc-pi calc-radians-mode calc-sec calc-sech |
3482f7594027
Add functions to autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59828
diff
changeset
|
1024 calc-sin calc-sincos calc-sinh calc-sqrt |
40785 | 1025 calc-tan calc-tanh calc-to-degrees calc-to-radians) |
1026 | |
1027 ("calc-mode" calc-alg-simplify-mode calc-algebraic-mode | |
1028 calc-always-load-extensions calc-auto-recompute calc-auto-why | |
1029 calc-bin-simplify-mode calc-break-vectors calc-center-justify | |
1030 calc-default-simplify-mode calc-display-raw calc-eng-notation | |
1031 calc-ext-simplify-mode calc-fix-notation calc-full-trail-vectors | |
1032 calc-full-vectors calc-get-modes calc-group-char calc-group-digits | |
1033 calc-infinite-mode calc-left-justify calc-left-label | |
1034 calc-line-breaking calc-line-numbering calc-matrix-brackets | |
1035 calc-matrix-center-justify calc-matrix-left-justify calc-matrix-mode | |
1036 calc-matrix-right-justify calc-mode-record-mode calc-no-simplify-mode | |
1037 calc-normal-notation calc-num-simplify-mode calc-point-char | |
1038 calc-right-justify calc-right-label calc-save-modes calc-sci-notation | |
1039 calc-settings-file-name calc-shift-prefix calc-symbolic-mode | |
1040 calc-total-algebraic-mode calc-truncate-down calc-truncate-stack | |
1041 calc-truncate-up calc-units-simplify-mode calc-vector-braces | |
1042 calc-vector-brackets calc-vector-commas calc-vector-parens | |
1043 calc-working) | |
1044 | |
1045 ("calc-prog" calc-call-last-kbd-macro calc-edit-user-syntax | |
1046 calc-equal-to calc-get-user-defn calc-greater-equal calc-greater-than | |
1047 calc-in-set calc-kbd-break calc-kbd-else calc-kbd-else-if | |
1048 calc-kbd-end-for calc-kbd-end-if calc-kbd-end-loop calc-kbd-end-repeat | |
1049 calc-kbd-for calc-kbd-if calc-kbd-loop calc-kbd-pop calc-kbd-push | |
1050 calc-kbd-query calc-kbd-repeat calc-kbd-report calc-less-equal | |
1051 calc-less-than calc-logical-and calc-logical-if calc-logical-not | |
1052 calc-logical-or calc-not-equal-to calc-pass-errors calc-remove-equal | |
1053 calc-timing calc-user-define calc-user-define-composition | |
1054 calc-user-define-edit calc-user-define-formula | |
1055 calc-user-define-invocation calc-user-define-kbd-macro | |
1056 calc-user-define-permanent calc-user-undefine) | |
1057 | |
1058 ("calc-rewr" calc-match calc-rewrite calc-rewrite-selection) | |
1059 | |
1060 ("calc-sel" calc-break-selections calc-clear-selections | |
1061 calc-copy-selection calc-del-selection calc-edit-selection | |
1062 calc-enable-selections calc-enter-selection calc-sel-add-both-sides | |
1063 calc-sel-div-both-sides calc-sel-evaluate calc-sel-expand-formula | |
1064 calc-sel-mult-both-sides calc-sel-sub-both-sides | |
1065 calc-select-additional calc-select-here calc-select-here-maybe | |
1066 calc-select-less calc-select-more calc-select-next calc-select-once | |
1067 calc-select-once-maybe calc-select-part calc-select-previous | |
1068 calc-show-selections calc-unselect) | |
1069 | |
41453
1c2b2b53715a
(calc-init-extensions): Update the rest of the autoload names to match
Colin Walters <walters@gnu.org>
parents:
41386
diff
changeset
|
1070 ("calcsel2" calc-commute-left calc-commute-right calc-sel-commute |
40785 | 1071 calc-sel-distribute calc-sel-invert calc-sel-isolate |
1072 calc-sel-jump-equals calc-sel-merge calc-sel-negate calc-sel-unpack) | |
1073 | |
1074 ("calc-stat" calc-vector-correlation calc-vector-count | |
1075 calc-vector-covariance calc-vector-geometric-mean | |
1076 calc-vector-harmonic-mean calc-vector-max calc-vector-mean | |
1077 calc-vector-mean-error calc-vector-median calc-vector-min | |
1078 calc-vector-pop-covariance calc-vector-pop-sdev | |
1079 calc-vector-pop-variance calc-vector-product calc-vector-sdev | |
1080 calc-vector-sum calc-vector-variance) | |
1081 | |
62390
3e124bbd072e
(calc-init-extensions): Add `calc-copy-special-constant'.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
62176
diff
changeset
|
1082 ("calc-store" calc-assign calc-copy-special-constant |
3e124bbd072e
(calc-init-extensions): Add `calc-copy-special-constant'.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
62176
diff
changeset
|
1083 calc-copy-variable calc-declare-variable |
40785 | 1084 calc-edit-AlgSimpRules calc-edit-Decls calc-edit-EvalRules |
1085 calc-edit-ExtSimpRules calc-edit-FitRules calc-edit-GenCount | |
1086 calc-edit-Holidays calc-edit-IntegLimit calc-edit-LineStyles | |
1087 calc-edit-PlotRejects calc-edit-PointStyles calc-edit-TimeZone | |
1088 calc-edit-Units calc-edit-variable calc-evalto calc-insert-variables | |
1089 calc-let calc-permanent-variable calc-recall calc-recall-quick | |
1090 calc-store calc-store-concat calc-store-decr calc-store-div | |
1091 calc-store-exchange calc-store-incr calc-store-into | |
1092 calc-store-into-quick calc-store-inv calc-store-map calc-store-minus | |
1093 calc-store-neg calc-store-plus calc-store-power calc-store-quick | |
1094 calc-store-times calc-subscript calc-unstore) | |
1095 | |
1096 ("calc-stuff" calc-clean calc-clean-num calc-flush-caches | |
1097 calc-less-recursion-depth calc-more-recursion-depth calc-num-prefix | |
1098 calc-version calc-why) | |
1099 | |
1100 ("calc-trail" calc-trail-backward calc-trail-first calc-trail-forward | |
1101 calc-trail-in calc-trail-isearch-backward calc-trail-isearch-forward | |
1102 calc-trail-kill calc-trail-last calc-trail-marker calc-trail-next | |
1103 calc-trail-out calc-trail-previous calc-trail-scroll-left | |
1104 calc-trail-scroll-right calc-trail-yank) | |
1105 | |
1106 ("calc-undo" calc-last-args calc-redo calc-undo) | |
1107 | |
1108 ("calc-units" calc-autorange-units calc-base-units | |
1109 calc-convert-temperature calc-convert-units calc-define-unit | |
1110 calc-enter-units-table calc-explain-units calc-extract-units | |
1111 calc-get-unit-definition calc-permanent-units calc-quick-units | |
1112 calc-remove-units calc-simplify-units calc-undefine-unit | |
1113 calc-view-units-table) | |
1114 | |
1115 ("calc-vec" calc-arrange-vector calc-build-vector calc-cnorm | |
1116 calc-conj-transpose calc-cons calc-cross calc-diag | |
1117 calc-display-strings calc-expand-vector calc-grade calc-head | |
1118 calc-histogram calc-ident calc-index calc-mask-vector calc-mcol | |
1119 calc-mrow calc-pack calc-pack-bits calc-remove-duplicates | |
1120 calc-reverse-vector calc-rnorm calc-set-cardinality | |
1121 calc-set-complement calc-set-difference calc-set-enumerate | |
1122 calc-set-floor calc-set-intersect calc-set-span calc-set-union | |
1123 calc-set-xor calc-sort calc-subvector calc-tail calc-transpose | |
1124 calc-unpack calc-unpack-bits calc-vector-find calc-vlength) | |
1125 | |
1126 ("calc-yank" calc-copy-as-kill calc-copy-region-as-kill | |
1127 calc-copy-to-buffer calc-edit calc-edit-cancel calc-edit-mode | |
41271
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
1128 calc-kill calc-kill-region calc-yank)))) |
40785 | 1129 |
1130 (defun calc-init-prefixes () | |
1131 (if calc-shift-prefix | |
1132 (progn | |
1133 (define-key calc-mode-map "A" (lookup-key calc-mode-map "a")) | |
1134 (define-key calc-mode-map "B" (lookup-key calc-mode-map "b")) | |
1135 (define-key calc-mode-map "C" (lookup-key calc-mode-map "c")) | |
1136 (define-key calc-mode-map "D" (lookup-key calc-mode-map "d")) | |
1137 (define-key calc-mode-map "F" (lookup-key calc-mode-map "f")) | |
1138 (define-key calc-mode-map "G" (lookup-key calc-mode-map "g")) | |
1139 (define-key calc-mode-map "J" (lookup-key calc-mode-map "j")) | |
1140 (define-key calc-mode-map "K" (lookup-key calc-mode-map "k")) | |
1141 (define-key calc-mode-map "M" (lookup-key calc-mode-map "m")) | |
1142 (define-key calc-mode-map "S" (lookup-key calc-mode-map "s")) | |
1143 (define-key calc-mode-map "T" (lookup-key calc-mode-map "t")) | |
1144 (define-key calc-mode-map "U" (lookup-key calc-mode-map "u"))) | |
1145 (define-key calc-mode-map "A" 'calc-abs) | |
1146 (define-key calc-mode-map "B" 'calc-log) | |
1147 (define-key calc-mode-map "C" 'calc-cos) | |
1148 (define-key calc-mode-map "D" 'calc-redo) | |
1149 (define-key calc-mode-map "F" 'calc-floor) | |
1150 (define-key calc-mode-map "G" 'calc-argument) | |
1151 (define-key calc-mode-map "J" 'calc-conj) | |
1152 (define-key calc-mode-map "K" 'calc-keep-args) | |
1153 (define-key calc-mode-map "M" 'calc-more-recursion-depth) | |
1154 (define-key calc-mode-map "S" 'calc-sin) | |
1155 (define-key calc-mode-map "T" 'calc-tan) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1156 (define-key calc-mode-map "U" 'calc-undo))) |
40785 | 1157 |
1158 (calc-init-extensions) | |
1159 | |
1160 | |
1161 | |
1162 | |
1163 ;;;; Miscellaneous. | |
1164 | |
58570
b651e7e3f5f8
(calc-command-flags, calc-gnuplot-buffer, calc-gnuplot-input)
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58454
diff
changeset
|
1165 ;; calc-command-flags is declared in calc.el |
b651e7e3f5f8
(calc-command-flags, calc-gnuplot-buffer, calc-gnuplot-input)
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58454
diff
changeset
|
1166 (defvar calc-command-flags) |
b651e7e3f5f8
(calc-command-flags, calc-gnuplot-buffer, calc-gnuplot-input)
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58454
diff
changeset
|
1167 |
40785 | 1168 (defun calc-clear-command-flag (f) |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1169 (setq calc-command-flags (delq f calc-command-flags))) |
40785 | 1170 |
1171 | |
1172 (defun calc-record-message (tag &rest args) | |
1173 (let ((msg (apply 'format args))) | |
1174 (message "%s" msg) | |
1175 (calc-record msg tag)) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1176 (calc-clear-command-flag 'clear-message)) |
40785 | 1177 |
1178 | |
1179 (defun calc-normalize-fancy (val) | |
1180 (let ((simp (if (consp calc-simplify-mode) | |
1181 (car calc-simplify-mode) | |
1182 calc-simplify-mode))) | |
1183 (cond ((eq simp 'binary) | |
1184 (let ((s (math-normalize val))) | |
1185 (if (math-realp s) | |
1186 (math-clip (math-round s)) | |
1187 s))) | |
1188 ((eq simp 'alg) | |
1189 (math-simplify val)) | |
1190 ((eq simp 'ext) | |
1191 (math-simplify-extended val)) | |
1192 ((eq simp 'units) | |
1193 (math-simplify-units val)) | |
1194 (t ; nil, none, num | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1195 (math-normalize val))))) |
40785 | 1196 |
1197 | |
62832
24bf48d7bb93
(calc-help-map, calc-alg-map, calc-alg-esc-map): Declare them.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
62442
diff
changeset
|
1198 (defvar calc-help-map nil) |
24bf48d7bb93
(calc-help-map, calc-alg-map, calc-alg-esc-map): Declare them.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
62442
diff
changeset
|
1199 |
24bf48d7bb93
(calc-help-map, calc-alg-map, calc-alg-esc-map): Declare them.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
62442
diff
changeset
|
1200 (if calc-help-map |
40785 | 1201 nil |
1202 (setq calc-help-map (make-keymap)) | |
1203 (define-key calc-help-map "b" 'calc-describe-bindings) | |
1204 (define-key calc-help-map "c" 'calc-describe-key-briefly) | |
1205 (define-key calc-help-map "f" 'calc-describe-function) | |
1206 (define-key calc-help-map "h" 'calc-full-help) | |
1207 (define-key calc-help-map "i" 'calc-info) | |
1208 (define-key calc-help-map "k" 'calc-describe-key) | |
1209 (define-key calc-help-map "n" 'calc-view-news) | |
1210 (define-key calc-help-map "s" 'calc-info-summary) | |
1211 (define-key calc-help-map "t" 'calc-tutorial) | |
1212 (define-key calc-help-map "v" 'calc-describe-variable) | |
1213 (define-key calc-help-map "\C-c" 'calc-describe-copying) | |
1214 (define-key calc-help-map "\C-d" 'calc-describe-distribution) | |
1215 (define-key calc-help-map "\C-n" 'calc-view-news) | |
1216 (define-key calc-help-map "\C-w" 'calc-describe-no-warranty) | |
1217 (define-key calc-help-map "?" 'calc-help-for-help) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1218 (define-key calc-help-map "\C-h" 'calc-help-for-help)) |
40785 | 1219 |
41271
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
1220 (defvar calc-prefix-help-phase 0) |
40785 | 1221 (defun calc-do-prefix-help (msgs group key) |
1222 (if calc-full-help-flag | |
1223 (list msgs group key) | |
1224 (if (cdr msgs) | |
1225 (progn | |
1226 (setq calc-prefix-help-phase | |
1227 (if (eq this-command last-command) | |
1228 (% (1+ calc-prefix-help-phase) (1+ (length msgs))) | |
1229 0)) | |
1230 (let ((msg (nth calc-prefix-help-phase msgs))) | |
1231 (message "%s" (if msg | |
1232 (concat group ": " msg ":" | |
1233 (make-string | |
1234 (- (apply 'max (mapcar 'length msgs)) | |
1235 (length msg)) 32) | |
1236 " [MORE]" | |
1237 (if key | |
1238 (concat " " (char-to-string key) | |
1239 "-") | |
1240 "")) | |
1241 (if key (format "%c-" key) ""))))) | |
1242 (setq calc-prefix-help-phase 0) | |
1243 (if key | |
1244 (if msgs | |
1245 (message "%s: %s: %c-" group (car msgs) key) | |
53869
f0e8bbd3dc50
(calc-do-prefix-help): Remove extra format
Andreas Schwab <schwab@suse.de>
parents:
52401
diff
changeset
|
1246 (message "%s: (none) %c-" group key)) |
40785 | 1247 (message "%s: %s" group (car msgs)))) |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1248 (and key (calc-unread-command key)))) |
40785 | 1249 |
1250 ;;;; Commands. | |
1251 | |
1252 | |
1253 ;;; General. | |
1254 | |
1255 (defun calc-reset (arg) | |
1256 (interactive "P") | |
59438
7e26bfe14017
(calc-reset): Restore saved values of variables instead of default
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58844
diff
changeset
|
1257 (setq arg (if arg (prefix-numeric-value arg) nil)) |
59465
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1258 (cond |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1259 ((and |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1260 calc-embedded-info |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1261 (equal (aref calc-embedded-info 0) (current-buffer)) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1262 (<= (point) (aref calc-embedded-info 5)) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1263 (>= (point) (aref calc-embedded-info 4))) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1264 (let ((cbuf (aref calc-embedded-info 1)) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1265 (calc-embedded-quiet t)) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1266 (save-window-excursion |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1267 (calc-embedded nil) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1268 (set-buffer cbuf) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1269 (calc-reset arg)) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1270 (calc-embedded nil))) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1271 ((eq major-mode 'calc-mode) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1272 (save-excursion |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1273 (unless (and arg (> (abs arg) 0)) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1274 (setq calc-stack nil)) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1275 (setq calc-undo-list nil |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1276 calc-redo-list nil) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1277 (let (calc-stack calc-user-parse-tables calc-standard-date-formats |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1278 calc-invocation-macro) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1279 (mapcar (function (lambda (v) (set v nil))) calc-local-var-list) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1280 (if (and arg (<= arg 0)) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1281 (calc-mode-var-list-restore-default-values) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1282 (calc-mode-var-list-restore-saved-values))) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1283 (calc-set-language nil nil t) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1284 (calc-mode) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1285 (calc-flush-caches t) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1286 (run-hooks 'calc-reset-hook)) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1287 (calc-wrapper |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1288 (let ((win (get-buffer-window (current-buffer)))) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1289 (calc-realign 0) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1290 ;; Adjust the window height if the window is visible, but doesn't |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1291 ;; take up the whole height of the frame. |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1292 (if (and |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1293 win |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1294 (< (window-height win) (1- (frame-height)))) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1295 (let ((height (- (window-height win) 2))) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1296 (set-window-point win (point)) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1297 (or (= height calc-window-height) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1298 (let ((swin (selected-window))) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1299 (select-window win) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1300 (enlarge-window (- calc-window-height height)) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1301 (select-window swin))))))) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1302 (message "(Calculator reset)")) |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1303 (t |
3a5d173e246a
(calc-reset): Reset when inside an embedded calculator; only reset when
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59459
diff
changeset
|
1304 (message "(Not inside a Calc buffer)")))) |
40785 | 1305 |
43568
d71670d5afa3
(calc-scroll-left): Call scroll-left interactively, so they do something.
Colin Walters <walters@gnu.org>
parents:
42206
diff
changeset
|
1306 ;; What a pain; scroll-left behaves differently when called non-interactively. |
40785 | 1307 (defun calc-scroll-left (n) |
1308 (interactive "P") | |
43568
d71670d5afa3
(calc-scroll-left): Call scroll-left interactively, so they do something.
Colin Walters <walters@gnu.org>
parents:
42206
diff
changeset
|
1309 (setq prefix-arg (or n (/ (window-width) 2))) |
d71670d5afa3
(calc-scroll-left): Call scroll-left interactively, so they do something.
Colin Walters <walters@gnu.org>
parents:
42206
diff
changeset
|
1310 (call-interactively #'scroll-left)) |
40785 | 1311 |
1312 (defun calc-scroll-right (n) | |
1313 (interactive "P") | |
43568
d71670d5afa3
(calc-scroll-left): Call scroll-left interactively, so they do something.
Colin Walters <walters@gnu.org>
parents:
42206
diff
changeset
|
1314 (setq prefix-arg (or n (/ (window-width) 2))) |
d71670d5afa3
(calc-scroll-left): Call scroll-left interactively, so they do something.
Colin Walters <walters@gnu.org>
parents:
42206
diff
changeset
|
1315 (call-interactively #'scroll-right)) |
40785 | 1316 |
1317 (defun calc-scroll-up (n) | |
1318 (interactive "P") | |
1319 (condition-case err | |
1320 (scroll-up (or n (/ (window-height) 2))) | |
1321 (error nil)) | |
1322 (if (pos-visible-in-window-p (max 1 (- (point-max) 2))) | |
1323 (if (eq major-mode 'calc-mode) | |
1324 (calc-realign) | |
1325 (goto-char (point-max)) | |
1326 (set-window-start (selected-window) | |
1327 (save-excursion | |
1328 (forward-line (- (1- (window-height)))) | |
1329 (point))) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1330 (forward-line -1)))) |
40785 | 1331 |
1332 (defun calc-scroll-down (n) | |
1333 (interactive "P") | |
1334 (or (pos-visible-in-window-p 1) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1335 (scroll-down (or n (/ (window-height) 2))))) |
40785 | 1336 |
1337 | |
1338 (defun calc-precision (n) | |
1339 (interactive "NPrecision: ") | |
1340 (calc-wrapper | |
1341 (if (< (prefix-numeric-value n) 3) | |
41271
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
1342 (error "Precision must be at least 3 digits") |
40785 | 1343 (calc-change-mode 'calc-internal-prec (prefix-numeric-value n) |
1344 (and (memq (car calc-float-format) '(float sci eng)) | |
1345 (< (nth 1 calc-float-format) | |
1346 (if (= calc-number-radix 10) 0 1)))) | |
1347 (calc-record calc-internal-prec "prec")) | |
41271
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
1348 (message "Floating-point precision is %d digits" calc-internal-prec))) |
40785 | 1349 |
1350 | |
1351 (defun calc-inverse (&optional n) | |
1352 (interactive "P") | |
58716
599d383ee37d
(calc-inverse, calc-hyperbolic): Add more checks.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58714
diff
changeset
|
1353 (let* ((hyp-flag (if (or |
599d383ee37d
(calc-inverse, calc-hyperbolic): Add more checks.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58714
diff
changeset
|
1354 (eq major-mode 'calc-keypad-mode) |
599d383ee37d
(calc-inverse, calc-hyperbolic): Add more checks.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58714
diff
changeset
|
1355 (eq major-mode 'calc-trail-mode)) |
58714
53295bbc3259
(calc-inverse, calc-hyperbolic): Give more thorough messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58652
diff
changeset
|
1356 (with-current-buffer calc-main-buffer |
53295bbc3259
(calc-inverse, calc-hyperbolic): Give more thorough messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58652
diff
changeset
|
1357 calc-hyperbolic-flag) |
53295bbc3259
(calc-inverse, calc-hyperbolic): Give more thorough messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58652
diff
changeset
|
1358 calc-hyperbolic-flag)) |
53295bbc3259
(calc-inverse, calc-hyperbolic): Give more thorough messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58652
diff
changeset
|
1359 (msg (if hyp-flag |
53295bbc3259
(calc-inverse, calc-hyperbolic): Give more thorough messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58652
diff
changeset
|
1360 "Inverse Hyperbolic..." |
53295bbc3259
(calc-inverse, calc-hyperbolic): Give more thorough messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58652
diff
changeset
|
1361 "Inverse..."))) |
53295bbc3259
(calc-inverse, calc-hyperbolic): Give more thorough messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58652
diff
changeset
|
1362 (calc-fancy-prefix 'calc-inverse-flag msg n))) |
40785 | 1363 |
40908 | 1364 (defconst calc-fancy-prefix-map |
1365 (let ((map (make-sparse-keymap))) | |
1366 (define-key map [t] 'calc-fancy-prefix-other-key) | |
1367 (define-key map (vector meta-prefix-char t) 'calc-fancy-prefix-other-key) | |
1368 (define-key map [switch-frame] nil) | |
1369 (define-key map [?\C-u] 'universal-argument) | |
1370 (define-key map [?0] 'digit-argument) | |
1371 (define-key map [?1] 'digit-argument) | |
1372 (define-key map [?2] 'digit-argument) | |
1373 (define-key map [?3] 'digit-argument) | |
1374 (define-key map [?4] 'digit-argument) | |
1375 (define-key map [?5] 'digit-argument) | |
1376 (define-key map [?6] 'digit-argument) | |
1377 (define-key map [?7] 'digit-argument) | |
1378 (define-key map [?8] 'digit-argument) | |
1379 (define-key map [?9] 'digit-argument) | |
1380 map) | |
1381 "Keymap used while processing calc-fancy-prefix.") | |
1382 | |
41271
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
1383 (defvar calc-is-keypad-press nil) |
40785 | 1384 (defun calc-fancy-prefix (flag msg n) |
1385 (let (prefix) | |
1386 (calc-wrapper | |
1387 (calc-set-command-flag 'keep-flags) | |
1388 (calc-set-command-flag 'no-align) | |
1389 (setq prefix (set flag (not (symbol-value flag))) | |
1390 prefix-arg n) | |
1391 (message (if prefix msg ""))) | |
1392 (and prefix | |
1393 (not calc-is-keypad-press) | |
40908 | 1394 (if (boundp 'overriding-terminal-local-map) |
1395 (setq overriding-terminal-local-map calc-fancy-prefix-map) | |
1396 (let ((event (calc-read-key t))) | |
1397 (if (eq (setq last-command-char (car event)) ?\C-u) | |
1398 (universal-argument) | |
1399 (if (or (not (integerp last-command-char)) | |
1400 (and (>= last-command-char 0) (< last-command-char ? ) | |
1401 (not (memq last-command-char '(?\e))))) | |
1402 (calc-wrapper)) ; clear flags if not a Calc command. | |
57594
072bb54df5bd
(calc-fancy-prefix): Removed emacs version check.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
57589
diff
changeset
|
1403 (setq last-command-event (cdr event)) |
40908 | 1404 (if (or (not (integerp last-command-char)) |
1405 (eq last-command-char ?-)) | |
1406 (calc-unread-command) | |
1407 (digit-argument n)))))))) | |
40785 | 1408 |
40908 | 1409 (defun calc-fancy-prefix-other-key (arg) |
1410 (interactive "P") | |
59638
22cbec80c668
(calc-fancy-prefix-other-key): Don't clear flags if the last command
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59465
diff
changeset
|
1411 (if (and |
22cbec80c668
(calc-fancy-prefix-other-key): Don't clear flags if the last command
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59465
diff
changeset
|
1412 (not (eq last-command-char 'tab)) |
22cbec80c668
(calc-fancy-prefix-other-key): Don't clear flags if the last command
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59465
diff
changeset
|
1413 (not (eq last-command-char 'M-tab)) |
22cbec80c668
(calc-fancy-prefix-other-key): Don't clear flags if the last command
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59465
diff
changeset
|
1414 (or (not (integerp last-command-char)) |
22cbec80c668
(calc-fancy-prefix-other-key): Don't clear flags if the last command
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59465
diff
changeset
|
1415 (and (>= last-command-char 0) (< last-command-char ? ) |
22cbec80c668
(calc-fancy-prefix-other-key): Don't clear flags if the last command
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59465
diff
changeset
|
1416 (not (eq last-command-char meta-prefix-char))))) |
40908 | 1417 (calc-wrapper)) ; clear flags if not a Calc command. |
59664
dc794585f43f
(calc-fancy-prefix-other-key): Set prefix arg.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59638
diff
changeset
|
1418 (setq prefix-arg arg) |
40908 | 1419 (calc-unread-command) |
1420 (setq overriding-terminal-local-map nil)) | |
1421 | |
40785 | 1422 (defun calc-invert-func () |
1423 (save-excursion | |
1424 (calc-select-buffer) | |
1425 (setq calc-inverse-flag (not (calc-is-inverse)) | |
1426 calc-hyperbolic-flag (calc-is-hyperbolic) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1427 current-prefix-arg nil))) |
40785 | 1428 |
1429 (defun calc-is-inverse () | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1430 calc-inverse-flag) |
40785 | 1431 |
1432 (defun calc-hyperbolic (&optional n) | |
1433 (interactive "P") | |
58716
599d383ee37d
(calc-inverse, calc-hyperbolic): Add more checks.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58714
diff
changeset
|
1434 (let* ((inv-flag (if (or |
599d383ee37d
(calc-inverse, calc-hyperbolic): Add more checks.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58714
diff
changeset
|
1435 (eq major-mode 'calc-keypad-mode) |
599d383ee37d
(calc-inverse, calc-hyperbolic): Add more checks.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58714
diff
changeset
|
1436 (eq major-mode 'calc-trail-mode)) |
58714
53295bbc3259
(calc-inverse, calc-hyperbolic): Give more thorough messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58652
diff
changeset
|
1437 (with-current-buffer calc-main-buffer |
53295bbc3259
(calc-inverse, calc-hyperbolic): Give more thorough messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58652
diff
changeset
|
1438 calc-inverse-flag) |
53295bbc3259
(calc-inverse, calc-hyperbolic): Give more thorough messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58652
diff
changeset
|
1439 calc-inverse-flag)) |
53295bbc3259
(calc-inverse, calc-hyperbolic): Give more thorough messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58652
diff
changeset
|
1440 (msg (if inv-flag |
53295bbc3259
(calc-inverse, calc-hyperbolic): Give more thorough messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58652
diff
changeset
|
1441 "Inverse Hyperbolic..." |
53295bbc3259
(calc-inverse, calc-hyperbolic): Give more thorough messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58652
diff
changeset
|
1442 "Hyperbolic..."))) |
53295bbc3259
(calc-inverse, calc-hyperbolic): Give more thorough messages.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58652
diff
changeset
|
1443 (calc-fancy-prefix 'calc-hyperbolic-flag msg n))) |
40785 | 1444 |
1445 (defun calc-hyperbolic-func () | |
1446 (save-excursion | |
1447 (calc-select-buffer) | |
1448 (setq calc-inverse-flag (calc-is-inverse) | |
1449 calc-hyperbolic-flag (not (calc-is-hyperbolic)) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1450 current-prefix-arg nil))) |
40785 | 1451 |
1452 (defun calc-is-hyperbolic () | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1453 calc-hyperbolic-flag) |
40785 | 1454 |
1455 (defun calc-keep-args (&optional n) | |
1456 (interactive "P") | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1457 (calc-fancy-prefix 'calc-keep-args-flag "Keep args..." n)) |
40785 | 1458 |
1459 | |
1460 (defun calc-change-mode (var value &optional refresh option) | |
1461 (if option | |
1462 (setq value (if value | |
1463 (> (prefix-numeric-value value) 0) | |
1464 (not (symbol-value var))))) | |
1465 (or (consp var) (setq var (list var) value (list value))) | |
1466 (if calc-inverse-flag | |
1467 (let ((old nil)) | |
1468 (or refresh (error "Not a display-mode command")) | |
1469 (calc-check-stack 1) | |
1470 (unwind-protect | |
1471 (let ((v var)) | |
1472 (while v | |
1473 (setq old (cons (symbol-value (car v)) old)) | |
1474 (set (car v) (car value)) | |
1475 (setq v (cdr v) | |
1476 value (cdr value))) | |
1477 (calc-refresh-top 1) | |
1478 (calc-refresh-evaltos) | |
1479 (symbol-value (car var))) | |
1480 (let ((v var)) | |
1481 (setq old (nreverse old)) | |
1482 (while v | |
1483 (set (car v) (car old)) | |
1484 (setq v (cdr v) | |
1485 old (cdr old))) | |
1486 (if (eq (car var) 'calc-language) | |
1487 (calc-set-language calc-language calc-language-option t))))) | |
1488 (let ((chg nil) | |
1489 (v var)) | |
1490 (while v | |
1491 (or (equal (symbol-value (car v)) (car value)) | |
1492 (progn | |
1493 (set (car v) (car value)) | |
1494 (if (eq (car v) 'calc-float-format) | |
1495 (setq calc-full-float-format | |
1496 (list (if (eq (car (car value)) 'fix) | |
1497 'float | |
1498 (car (car value))) | |
1499 0))) | |
1500 (setq chg t))) | |
1501 (setq v (cdr v) | |
1502 value (cdr value))) | |
1503 (if chg | |
1504 (progn | |
1505 (or (and refresh (calc-do-refresh)) | |
1506 (calc-refresh-evaltos)) | |
1507 (and (eq calc-mode-save-mode 'save) | |
1508 (not (equal var '(calc-mode-save-mode))) | |
47695
37adf7fffb23
(calc-reset): Don't bind `executing-kbd-macro'. Call
Colin Walters <walters@gnu.org>
parents:
45579
diff
changeset
|
1509 (calc-save-modes)))) |
40785 | 1510 (if calc-embedded-info (calc-embedded-modes-change var)) |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1511 (symbol-value (car var))))) |
40785 | 1512 |
45579
eb535b77722f
(calc-init-extensions): Add binding for `d@'.
Miles Bader <miles@gnu.org>
parents:
43568
diff
changeset
|
1513 (defun calc-toggle-banner () |
eb535b77722f
(calc-init-extensions): Add binding for `d@'.
Miles Bader <miles@gnu.org>
parents:
43568
diff
changeset
|
1514 "Toggle display of the friendly greeting calc normally shows above the stack." |
eb535b77722f
(calc-init-extensions): Add binding for `d@'.
Miles Bader <miles@gnu.org>
parents:
43568
diff
changeset
|
1515 (interactive) |
eb535b77722f
(calc-init-extensions): Add binding for `d@'.
Miles Bader <miles@gnu.org>
parents:
43568
diff
changeset
|
1516 (setq calc-show-banner (not calc-show-banner)) |
eb535b77722f
(calc-init-extensions): Add binding for `d@'.
Miles Bader <miles@gnu.org>
parents:
43568
diff
changeset
|
1517 (calc-refresh)) |
eb535b77722f
(calc-init-extensions): Add binding for `d@'.
Miles Bader <miles@gnu.org>
parents:
43568
diff
changeset
|
1518 |
40785 | 1519 (defun calc-refresh-top (n) |
1520 (interactive "p") | |
1521 (calc-wrapper | |
1522 (cond ((< n 0) | |
1523 (setq n (- n)) | |
1524 (let ((entry (calc-top n 'entry)) | |
1525 (calc-undo-list nil) (calc-redo-list nil)) | |
1526 (calc-pop-stack 1 n t) | |
1527 (calc-push-list (list (car entry)) n (list (nth 2 entry))))) | |
1528 ((= n 0) | |
1529 (calc-refresh)) | |
1530 (t | |
1531 (let ((entries (calc-top-list n 1 'entry)) | |
1532 (calc-undo-list nil) (calc-redo-list nil)) | |
1533 (calc-pop-stack n 1 t) | |
1534 (calc-push-list (mapcar 'car entries) | |
1535 1 | |
1536 (mapcar (function (lambda (x) (nth 2 x))) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1537 entries))))))) |
40785 | 1538 |
41271
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
1539 (defvar calc-refreshing-evaltos nil) |
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
1540 (defvar calc-no-refresh-evaltos nil) |
40785 | 1541 (defun calc-refresh-evaltos (&optional which-var) |
1542 (and calc-any-evaltos calc-auto-recompute (not calc-no-refresh-evaltos) | |
1543 (let ((calc-refreshing-evaltos t) | |
1544 (num (calc-stack-size)) | |
1545 (calc-undo-list nil) (calc-redo-list nil) | |
1546 value new-val) | |
1547 (while (> num 0) | |
1548 (setq value (calc-top num 'entry)) | |
1549 (if (and (not (nth 2 value)) | |
1550 (setq value (car value)) | |
1551 (or (eq (car-safe value) 'calcFunc-evalto) | |
1552 (and (eq (car-safe value) 'vec) | |
1553 (eq (car-safe (nth 1 value)) 'calcFunc-evalto)))) | |
1554 (progn | |
1555 (setq new-val (math-normalize value)) | |
1556 (or (equal new-val value) | |
1557 (progn | |
1558 (calc-push-list (list new-val) num) | |
1559 (calc-pop-stack 1 (1+ num) t))))) | |
1560 (setq num (1- num))))) | |
1561 (and calc-embedded-active which-var | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1562 (calc-embedded-var-change which-var))) |
40785 | 1563 |
1564 (defun calc-push (&rest vals) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1565 (calc-push-list vals)) |
40785 | 1566 |
1567 (defun calc-pop-push (n &rest vals) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1568 (calc-pop-push-list n vals)) |
40785 | 1569 |
1570 (defun calc-pop-push-record (n prefix &rest vals) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1571 (calc-pop-push-record-list n prefix vals)) |
40785 | 1572 |
1573 | |
1574 (defun calc-evaluate (n) | |
1575 (interactive "p") | |
1576 (calc-slow-wrapper | |
1577 (if (= n 0) | |
1578 (setq n (calc-stack-size))) | |
1579 (calc-with-default-simplification | |
1580 (if (< n 0) | |
1581 (calc-pop-push-record-list 1 "eval" | |
1582 (math-evaluate-expr (calc-top (- n))) | |
1583 (- n)) | |
1584 (calc-pop-push-record-list n "eval" (mapcar 'math-evaluate-expr | |
1585 (calc-top-list n))))) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1586 (calc-handle-whys))) |
40785 | 1587 |
1588 | |
1589 (defun calc-eval-num (n) | |
1590 (interactive "P") | |
1591 (calc-slow-wrapper | |
1592 (let* ((nn (prefix-numeric-value n)) | |
1593 (calc-internal-prec (cond ((>= nn 3) nn) | |
1594 ((< nn 0) (max (+ calc-internal-prec nn) | |
1595 3)) | |
1596 (t calc-internal-prec))) | |
1597 (calc-symbolic-mode nil)) | |
1598 (calc-with-default-simplification | |
1599 (calc-pop-push-record 1 "num" (math-evaluate-expr (calc-top 1))))) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1600 (calc-handle-whys))) |
40785 | 1601 |
1602 | |
1603 (defun calc-execute-extended-command (n) | |
1604 (interactive "P") | |
1605 (let* ((prompt (concat (calc-num-prefix-name n) "M-x ")) | |
1606 (cmd (intern (completing-read prompt obarray 'commandp t "calc-")))) | |
1607 (setq prefix-arg n) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1608 (command-execute cmd))) |
40785 | 1609 |
1610 | |
1611 (defun calc-realign (&optional num) | |
1612 (interactive "P") | |
1613 (if (and num (eq major-mode 'calc-mode)) | |
1614 (progn | |
1615 (calc-check-stack num) | |
1616 (calc-cursor-stack-index num) | |
1617 (and calc-line-numbering | |
1618 (forward-char 4))) | |
1619 (if (and calc-embedded-info | |
1620 (eq (current-buffer) (aref calc-embedded-info 0))) | |
1621 (progn | |
1622 (goto-char (aref calc-embedded-info 2)) | |
1623 (if (save-excursion (set-buffer (aref calc-embedded-info 1)) | |
1624 calc-show-plain) | |
1625 (forward-line 1))) | |
1626 (calc-wrapper | |
1627 (if (get-buffer-window (current-buffer)) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1628 (set-window-hscroll (get-buffer-window (current-buffer)) 0)))))) |
40785 | 1629 |
41271
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
1630 (defvar math-cache-list nil) |
40785 | 1631 |
1632 (defun calc-var-value (v) | |
1633 (and (symbolp v) | |
1634 (boundp v) | |
1635 (symbol-value v) | |
1636 (if (symbolp (symbol-value v)) | |
1637 (set v (funcall (symbol-value v))) | |
1638 (if (stringp (symbol-value v)) | |
1639 (let ((val (math-read-expr (symbol-value v)))) | |
1640 (if (eq (car-safe val) 'error) | |
1641 (error "Bad format in variable contents: %s" (nth 2 val)) | |
1642 (set v val))) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1643 (symbol-value v))))) |
40785 | 1644 |
1645 ;;; In the following table, ( OP LOPS ROPS ) means that if an OP | |
1646 ;;; term appears as the first argument to any LOPS term, or as the | |
1647 ;;; second argument to any ROPS term, then they should be treated | |
1648 ;;; as one large term for purposes of associative selection. | |
1649 (defconst calc-assoc-ops '( ( + ( + - ) ( + ) ) | |
1650 ( - ( + - ) ( + ) ) | |
1651 ( * ( * ) ( * ) ) | |
1652 ( / ( / ) ( ) ) | |
1653 ( | ( | ) ( | ) ) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49263
diff
changeset
|
1654 ( calcFunc-land ( calcFunc-land ) |
40785 | 1655 ( calcFunc-land ) ) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49263
diff
changeset
|
1656 ( calcFunc-lor ( calcFunc-lor ) |
40785 | 1657 ( calcFunc-lor ) ) )) |
1658 | |
1659 | |
1660 (defvar var-CommuteRules 'calc-CommuteRules) | |
1661 (defvar var-JumpRules 'calc-JumpRules) | |
1662 (defvar var-DistribRules 'calc-DistribRules) | |
1663 (defvar var-MergeRules 'calc-MergeRules) | |
1664 (defvar var-NegateRules 'calc-NegateRules) | |
1665 (defvar var-InvertRules 'calc-InvertRules) | |
1666 | |
1667 | |
1668 (defconst calc-tweak-eqn-table '( ( calcFunc-eq calcFunc-eq calcFunc-neq ) | |
1669 ( calcFunc-neq calcFunc-neq calcFunc-eq ) | |
1670 ( calcFunc-lt calcFunc-gt calcFunc-geq ) | |
1671 ( calcFunc-gt calcFunc-lt calcFunc-leq ) | |
1672 ( calcFunc-leq calcFunc-geq calcFunc-gt ) | |
1673 ( calcFunc-geq calcFunc-leq calcFunc-lt ) )) | |
1674 | |
1675 | |
1676 | |
1677 | |
1678 (defun calc-float (arg) | |
1679 (interactive "P") | |
1680 (calc-slow-wrapper | |
1681 (calc-unary-op "flt" | |
1682 (if (calc-is-hyperbolic) 'calcFunc-float 'calcFunc-pfloat) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1683 arg))) |
40785 | 1684 |
1685 | |
1686 (defvar calc-gnuplot-process nil) | |
58570
b651e7e3f5f8
(calc-command-flags, calc-gnuplot-buffer, calc-gnuplot-input)
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58454
diff
changeset
|
1687 (defvar calc-gnuplot-input) |
b651e7e3f5f8
(calc-command-flags, calc-gnuplot-buffer, calc-gnuplot-input)
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58454
diff
changeset
|
1688 (defvar calc-gnuplot-buffer) |
40785 | 1689 |
1690 (defun calc-gnuplot-alive () | |
1691 (and calc-gnuplot-process | |
1692 calc-gnuplot-buffer | |
1693 (buffer-name calc-gnuplot-buffer) | |
1694 calc-gnuplot-input | |
1695 (buffer-name calc-gnuplot-input) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1696 (memq (process-status calc-gnuplot-process) '(run stop)))) |
40785 | 1697 |
1698 | |
1699 | |
1700 | |
1701 | |
1702 (defun calc-load-everything () | |
1703 (interactive) | |
58652
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1704 (require 'calc-aent) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1705 (require 'calc-alg) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1706 (require 'calc-arith) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1707 (require 'calc-bin) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1708 (require 'calc-comb) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1709 (require 'calc-cplx) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1710 (require 'calc-embed) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1711 (require 'calc-fin) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1712 (require 'calc-forms) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1713 (require 'calc-frac) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1714 (require 'calc-funcs) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1715 (require 'calc-graph) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1716 (require 'calc-help) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1717 (require 'calc-incom) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1718 (require 'calc-keypd) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1719 (require 'calc-lang) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1720 (require 'calc-macs) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1721 (require 'calc-map) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1722 (require 'calc-math) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1723 (require 'calc-misc) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1724 (require 'calc-mode) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1725 (require 'calc-mtx) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1726 (require 'calc-poly) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1727 (require 'calc-prog) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1728 (require 'calc-rewr) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1729 (require 'calc-rules) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1730 (require 'calc-sel) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1731 (require 'calc-stat) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1732 (require 'calc-store) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1733 (require 'calc-stuff) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1734 (require 'calc-trail) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1735 (require 'calc-undo) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1736 (require 'calc-units) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1737 (require 'calc-vec) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1738 (require 'calc-yank) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1739 (require 'calcalg2) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1740 (require 'calcalg3) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1741 (require 'calccomp) |
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
1742 (require 'calcsel2) |
40785 | 1743 |
41271
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
1744 (message "All parts of Calc are now loaded")) |
40785 | 1745 |
1746 | |
1747 ;;; Vector commands. | |
1748 | |
1749 (defun calc-concat (arg) | |
1750 (interactive "P") | |
1751 (calc-wrapper | |
1752 (if (calc-is-inverse) | |
1753 (if (calc-is-hyperbolic) | |
1754 (calc-enter-result 2 "apnd" (list 'calcFunc-append | |
1755 (calc-top 1) (calc-top 2))) | |
1756 (calc-enter-result 2 "|" (list 'calcFunc-vconcat | |
1757 (calc-top 1) (calc-top 2)))) | |
1758 (if (calc-is-hyperbolic) | |
1759 (calc-binary-op "apnd" 'calcFunc-append arg '(vec)) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1760 (calc-binary-op "|" 'calcFunc-vconcat arg '(vec) nil '|))))) |
40785 | 1761 |
1762 (defun calc-append (arg) | |
1763 (interactive "P") | |
1764 (calc-hyperbolic-func) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1765 (calc-concat arg)) |
40785 | 1766 |
1767 | |
1768 (defconst calc-arg-values '( ( var ArgA var-ArgA ) ( var ArgB var-ArgB ) | |
1769 ( var ArgC var-ArgC ) ( var ArgD var-ArgD ) | |
1770 ( var ArgE var-ArgE ) ( var ArgF var-ArgF ) | |
1771 ( var ArgG var-ArgG ) ( var ArgH var-ArgH ) | |
1772 ( var ArgI var-ArgI ) ( var ArgJ var-ArgJ ) | |
1773 )) | |
1774 | |
1775 (defun calc-invent-args (n) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1776 (nreverse (nthcdr (- (length calc-arg-values) n) (reverse calc-arg-values)))) |
40785 | 1777 |
1778 | |
1779 | |
1780 | |
1781 ;;; User menu. | |
1782 | |
1783 (defun calc-user-key-map () | |
1784 (if calc-emacs-type-lucid | |
1785 (error "User-defined keys are not supported in Lucid Emacs")) | |
1786 (let ((res (cdr (lookup-key calc-mode-map "z")))) | |
1787 (if (eq (car (car res)) 27) | |
1788 (cdr res) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1789 res))) |
40785 | 1790 |
58102
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
1791 (defvar calc-z-prefix-buf nil) |
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
1792 (defvar calc-z-prefix-msgs nil) |
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
1793 |
40785 | 1794 (defun calc-z-prefix-help () |
1795 (interactive) | |
58102
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
1796 (let* ((calc-z-prefix-msgs nil) |
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
1797 (calc-z-prefix-buf "") |
40785 | 1798 (kmap (sort (copy-sequence (calc-user-key-map)) |
1799 (function (lambda (x y) (< (car x) (car y)))))) | |
1800 (flags (apply 'logior | |
1801 (mapcar (function | |
1802 (lambda (k) | |
1803 (calc-user-function-classify (car k)))) | |
1804 kmap)))) | |
1805 (if (= (logand flags 8) 0) | |
1806 (calc-user-function-list kmap 7) | |
1807 (calc-user-function-list kmap 1) | |
58102
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
1808 (setq calc-z-prefix-msgs (cons calc-z-prefix-buf calc-z-prefix-msgs) |
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
1809 calc-z-prefix-buf "") |
40785 | 1810 (calc-user-function-list kmap 6)) |
1811 (if (/= flags 0) | |
58102
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
1812 (setq calc-z-prefix-msgs (cons calc-z-prefix-buf calc-z-prefix-msgs))) |
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
1813 (calc-do-prefix-help (nreverse calc-z-prefix-msgs) "user" ?z))) |
40785 | 1814 |
1815 (defun calc-user-function-classify (key) | |
1816 (cond ((/= key (downcase key)) ; upper-case | |
1817 (if (assq (downcase key) (calc-user-key-map)) 9 1)) | |
1818 ((/= key (upcase key)) 2) ; lower-case | |
1819 ((= key ??) 0) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1820 (t 4))) ; other |
40785 | 1821 |
1822 (defun calc-user-function-list (map flags) | |
1823 (and map | |
1824 (let* ((key (car (car map))) | |
1825 (kind (calc-user-function-classify key)) | |
1826 (func (cdr (car map)))) | |
1827 (if (or (= (logand kind flags) 0) | |
1828 (not (symbolp func))) | |
1829 () | |
1830 (let* ((name (symbol-name func)) | |
1831 (name (if (string-match "\\`calc-" name) | |
1832 (substring name 5) name)) | |
1833 (pos (string-match (char-to-string key) name)) | |
1834 (desc | |
1835 (if (symbolp func) | |
1836 (if (= (logand kind 3) 0) | |
1837 (format "`%c' = %s" key name) | |
1838 (if pos | |
1839 (format "%s%c%s" | |
1840 (downcase (substring name 0 pos)) | |
1841 (upcase key) | |
1842 (downcase (substring name (1+ pos)))) | |
1843 (format "%c = %s" | |
1844 (upcase key) | |
1845 (downcase name)))) | |
1846 (char-to-string (upcase key))))) | |
58102
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
1847 (if (= (length calc-z-prefix-buf) 0) |
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
1848 (setq calc-z-prefix-buf (concat (if (= flags 1) "SHIFT + " "") |
40785 | 1849 desc)) |
58102
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
1850 (if (> (+ (length calc-z-prefix-buf) (length desc)) 58) |
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
1851 (setq calc-z-prefix-msgs |
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
1852 (cons calc-z-prefix-buf calc-z-prefix-msgs) |
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
1853 calc-z-prefix-buf (concat (if (= flags 1) "SHIFT + " "") |
40785 | 1854 desc)) |
58102
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
1855 (setq calc-z-prefix-buf (concat calc-z-prefix-buf ", " desc)))))) |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1856 (calc-user-function-list (cdr map) flags)))) |
40785 | 1857 |
1858 | |
1859 | |
1860 (defun calc-shift-Z-prefix-help () | |
1861 (interactive) | |
1862 (calc-do-prefix-help | |
1863 '("Define, Undefine, Formula, Kbd-macro, Edit, Get-defn" | |
1864 "Composition, Syntax; Invocation; Permanent; Timing" | |
1865 "kbd-macros: [ (if), : (else), | (else-if), ] (end-if)" | |
1866 "kbd-macros: < > (repeat), ( ) (for), { } (loop)" | |
1867 "kbd-macros: / (break)" | |
1868 "kbd-macros: ` (save), ' (restore)") | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1869 "user" ?Z)) |
40785 | 1870 |
1871 | |
1872 ;;;; Caches. | |
1873 | |
1874 (defmacro math-defcache (name init form) | |
1875 (let ((cache-prec (intern (concat (symbol-name name) "-cache-prec"))) | |
1876 (cache-val (intern (concat (symbol-name name) "-cache"))) | |
1877 (last-prec (intern (concat (symbol-name name) "-last-prec"))) | |
1878 (last-val (intern (concat (symbol-name name) "-last")))) | |
1879 (list 'progn | |
58143
ad1cd229b771
(math-defcache): Use defvar for the new variables it creates.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58132
diff
changeset
|
1880 (list 'defvar cache-prec (if init (math-numdigs (nth 1 init)) -100)) |
ad1cd229b771
(math-defcache): Use defvar for the new variables it creates.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58132
diff
changeset
|
1881 (list 'defvar cache-val (list 'quote init)) |
ad1cd229b771
(math-defcache): Use defvar for the new variables it creates.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58132
diff
changeset
|
1882 (list 'defvar last-prec -100) |
ad1cd229b771
(math-defcache): Use defvar for the new variables it creates.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58132
diff
changeset
|
1883 (list 'defvar last-val nil) |
40785 | 1884 (list 'setq 'math-cache-list |
1885 (list 'cons | |
1886 (list 'quote cache-prec) | |
1887 (list 'cons | |
1888 (list 'quote last-prec) | |
1889 'math-cache-list))) | |
1890 (list 'defun | |
1891 name () | |
1892 (list 'or | |
1893 (list '= last-prec 'calc-internal-prec) | |
1894 (list 'setq | |
1895 last-val | |
1896 (list 'math-normalize | |
1897 (list 'progn | |
1898 (list 'or | |
1899 (list '>= cache-prec | |
1900 'calc-internal-prec) | |
1901 (list 'setq | |
1902 cache-val | |
1903 (list 'let | |
1904 '((calc-internal-prec | |
1905 (+ calc-internal-prec | |
1906 4))) | |
1907 form) | |
1908 cache-prec | |
1909 '(+ calc-internal-prec 2))) | |
1910 cache-val)) | |
1911 last-prec 'calc-internal-prec)) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1912 last-val)))) |
40785 | 1913 (put 'math-defcache 'lisp-indent-hook 2) |
1914 | |
1915 ;;; Betcha didn't know that pi = 16 atan(1/5) - 4 atan(1/239). [F] [Public] | |
1916 (math-defcache math-pi (float (bigpos 463 238 793 589 653 592 141 3) -21) | |
1917 (math-add-float (math-mul-float '(float 16 0) | |
1918 (math-arctan-raw '(float 2 -1))) | |
1919 (math-mul-float '(float -4 0) | |
1920 (math-arctan-raw | |
1921 (math-float '(frac 1 239)))))) | |
1922 | |
1923 (math-defcache math-two-pi nil | |
1924 (math-mul-float (math-pi) '(float 2 0))) | |
1925 | |
1926 (math-defcache math-pi-over-2 nil | |
1927 (math-mul-float (math-pi) '(float 5 -1))) | |
1928 | |
1929 (math-defcache math-pi-over-4 nil | |
1930 (math-mul-float (math-pi) '(float 25 -2))) | |
1931 | |
1932 (math-defcache math-pi-over-180 nil | |
1933 (math-div-float (math-pi) '(float 18 1))) | |
1934 | |
1935 (math-defcache math-sqrt-pi nil | |
1936 (math-sqrt-float (math-pi))) | |
1937 | |
1938 (math-defcache math-sqrt-2 nil | |
1939 (math-sqrt-float '(float 2 0))) | |
1940 | |
1941 (math-defcache math-sqrt-12 nil | |
1942 (math-sqrt-float '(float 12 0))) | |
1943 | |
1944 (math-defcache math-sqrt-two-pi nil | |
1945 (math-sqrt-float (math-two-pi))) | |
1946 | |
1947 (math-defcache math-sqrt-e (float (bigpos 849 146 128 700 270 721 648 1) -21) | |
1948 (math-add-float '(float 1 0) (math-exp-minus-1-raw '(float 5 -1)))) | |
1949 | |
1950 (math-defcache math-e nil | |
1951 (math-pow (math-sqrt-e) 2)) | |
1952 | |
1953 (math-defcache math-phi nil | |
1954 (math-mul-float (math-add-float (math-sqrt-raw '(float 5 0)) '(float 1 0)) | |
1955 '(float 5 -1))) | |
1956 | |
1957 (math-defcache math-gamma-const nil | |
1958 '(float (bigpos 495 467 917 632 470 369 709 646 776 267 677 848 348 672 | |
1959 057 988 235 399 359 593 421 310 024 824 900 120 065 606 | |
1960 328 015 649 156 772 5) -100)) | |
1961 | |
1962 (defun math-half-circle (symb) | |
1963 (if (eq calc-angle-mode 'rad) | |
1964 (if symb | |
1965 '(var pi var-pi) | |
1966 (math-pi)) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1967 180)) |
40785 | 1968 |
1969 (defun math-full-circle (symb) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1970 (math-mul 2 (math-half-circle symb))) |
40785 | 1971 |
1972 (defun math-quarter-circle (symb) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1973 (math-div (math-half-circle symb) 2)) |
40785 | 1974 |
41271
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
1975 (defvar math-expand-formulas nil) |
40785 | 1976 |
1977 ;;;; Miscellaneous math routines. | |
1978 | |
1979 ;;; True if A is an odd integer. [P R R] [Public] | |
1980 (defun math-oddp (a) | |
1981 (if (consp a) | |
1982 (and (memq (car a) '(bigpos bigneg)) | |
1983 (= (% (nth 1 a) 2) 1)) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1984 (/= (% a 2) 0))) |
40785 | 1985 |
1986 ;;; True if A is a small or big integer. [P x] [Public] | |
1987 (defun math-integerp (a) | |
1988 (or (integerp a) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1989 (memq (car-safe a) '(bigpos bigneg)))) |
40785 | 1990 |
1991 ;;; True if A is (numerically) a non-negative integer. [P N] [Public] | |
1992 (defun math-natnump (a) | |
1993 (or (natnump a) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1994 (eq (car-safe a) 'bigpos))) |
40785 | 1995 |
1996 ;;; True if A is a rational (or integer). [P x] [Public] | |
1997 (defun math-ratp (a) | |
1998 (or (integerp a) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
1999 (memq (car-safe a) '(bigpos bigneg frac)))) |
40785 | 2000 |
2001 ;;; True if A is a real (or rational). [P x] [Public] | |
2002 (defun math-realp (a) | |
2003 (or (integerp a) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2004 (memq (car-safe a) '(bigpos bigneg frac float)))) |
40785 | 2005 |
2006 ;;; True if A is a real or HMS form. [P x] [Public] | |
2007 (defun math-anglep (a) | |
2008 (or (integerp a) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2009 (memq (car-safe a) '(bigpos bigneg frac float hms)))) |
40785 | 2010 |
2011 ;;; True if A is a number of any kind. [P x] [Public] | |
2012 (defun math-numberp (a) | |
2013 (or (integerp a) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2014 (memq (car-safe a) '(bigpos bigneg frac float cplx polar)))) |
40785 | 2015 |
2016 ;;; True if A is a complex number or angle. [P x] [Public] | |
2017 (defun math-scalarp (a) | |
2018 (or (integerp a) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2019 (memq (car-safe a) '(bigpos bigneg frac float cplx polar hms)))) |
40785 | 2020 |
2021 ;;; True if A is a vector. [P x] [Public] | |
2022 (defun math-vectorp (a) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2023 (eq (car-safe a) 'vec)) |
40785 | 2024 |
2025 ;;; True if A is any vector or scalar data object. [P x] | |
2026 (defun math-objvecp (a) ; [Public] | |
2027 (or (integerp a) | |
2028 (memq (car-safe a) '(bigpos bigneg frac float cplx polar | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2029 hms date sdev intv mod vec incomplete)))) |
40785 | 2030 |
2031 ;;; True if A is an object not composed of sub-formulas . [P x] [Public] | |
2032 (defun math-primp (a) | |
2033 (or (integerp a) | |
2034 (memq (car-safe a) '(bigpos bigneg frac float cplx polar | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2035 hms date mod var)))) |
40785 | 2036 |
2037 ;;; True if A is numerically (but not literally) an integer. [P x] [Public] | |
2038 (defun math-messy-integerp (a) | |
2039 (cond | |
2040 ((eq (car-safe a) 'float) (>= (nth 2 a) 0)) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2041 ((eq (car-safe a) 'frac) (Math-integerp (math-normalize a))))) |
40785 | 2042 |
2043 ;;; True if A is numerically an integer. [P x] [Public] | |
2044 (defun math-num-integerp (a) | |
2045 (or (Math-integerp a) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2046 (Math-messy-integerp a))) |
40785 | 2047 |
2048 ;;; True if A is (numerically) a non-negative integer. [P N] [Public] | |
2049 (defun math-num-natnump (a) | |
2050 (or (natnump a) | |
2051 (eq (car-safe a) 'bigpos) | |
2052 (and (eq (car-safe a) 'float) | |
2053 (Math-natnump (nth 1 a)) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2054 (>= (nth 2 a) 0)))) |
40785 | 2055 |
2056 ;;; True if A is an integer or will evaluate to an integer. [P x] [Public] | |
2057 (defun math-provably-integerp (a) | |
2058 (or (Math-integerp a) | |
2059 (and (memq (car-safe a) '(calcFunc-trunc | |
2060 calcFunc-round | |
2061 calcFunc-rounde | |
2062 calcFunc-roundu | |
2063 calcFunc-floor | |
2064 calcFunc-ceil)) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2065 (= (length a) 2)))) |
40785 | 2066 |
2067 ;;; True if A is a real or will evaluate to a real. [P x] [Public] | |
2068 (defun math-provably-realp (a) | |
2069 (or (Math-realp a) | |
2070 (math-provably-integer a) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2071 (memq (car-safe a) '(abs arg)))) |
40785 | 2072 |
2073 ;;; True if A is a non-real, complex number. [P x] [Public] | |
2074 (defun math-complexp (a) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2075 (memq (car-safe a) '(cplx polar))) |
40785 | 2076 |
2077 ;;; True if A is a non-real, rectangular complex number. [P x] [Public] | |
2078 (defun math-rect-complexp (a) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2079 (eq (car-safe a) 'cplx)) |
40785 | 2080 |
2081 ;;; True if A is a non-real, polar complex number. [P x] [Public] | |
2082 (defun math-polar-complexp (a) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2083 (eq (car-safe a) 'polar)) |
40785 | 2084 |
2085 ;;; True if A is a matrix. [P x] [Public] | |
2086 (defun math-matrixp (a) | |
2087 (and (Math-vectorp a) | |
2088 (Math-vectorp (nth 1 a)) | |
2089 (cdr (nth 1 a)) | |
2090 (let ((len (length (nth 1 a)))) | |
2091 (setq a (cdr a)) | |
2092 (while (and (setq a (cdr a)) | |
2093 (Math-vectorp (car a)) | |
2094 (= (length (car a)) len))) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2095 (null a)))) |
40785 | 2096 |
2097 (defun math-matrixp-step (a len) ; [P L] | |
2098 (or (null a) | |
2099 (and (Math-vectorp (car a)) | |
2100 (= (length (car a)) len) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2101 (math-matrixp-step (cdr a) len)))) |
40785 | 2102 |
2103 ;;; True if A is a square matrix. [P V] [Public] | |
2104 (defun math-square-matrixp (a) | |
2105 (let ((dims (math-mat-dimens a))) | |
2106 (and (cdr dims) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2107 (= (car dims) (nth 1 dims))))) |
40785 | 2108 |
2109 ;;; True if A is any scalar data object. [P x] | |
2110 (defun math-objectp (a) ; [Public] | |
2111 (or (integerp a) | |
2112 (memq (car-safe a) '(bigpos bigneg frac float cplx | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2113 polar hms date sdev intv mod)))) |
40785 | 2114 |
2115 ;;; Verify that A is an integer and return A in integer form. [I N; - x] | |
2116 (defun math-check-integer (a) ; [Public] | |
2117 (cond ((integerp a) a) ; for speed | |
2118 ((math-integerp a) a) | |
2119 ((math-messy-integerp a) | |
2120 (math-trunc a)) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2121 (t (math-reject-arg a 'integerp)))) |
40785 | 2122 |
2123 ;;; Verify that A is a small integer and return A in integer form. [S N; - x] | |
2124 (defun math-check-fixnum (a &optional allow-inf) ; [Public] | |
2125 (cond ((integerp a) a) ; for speed | |
2126 ((Math-num-integerp a) | |
2127 (let ((a (math-trunc a))) | |
2128 (if (integerp a) | |
2129 a | |
2130 (if (or (Math-lessp (lsh -1 -1) a) | |
2131 (Math-lessp a (- (lsh -1 -1)))) | |
2132 (math-reject-arg a 'fixnump) | |
2133 (math-fixnum a))))) | |
2134 ((and allow-inf (equal a '(var inf var-inf))) | |
2135 (lsh -1 -1)) | |
2136 ((and allow-inf (equal a '(neg (var inf var-inf)))) | |
2137 (- (lsh -1 -1))) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2138 (t (math-reject-arg a 'fixnump)))) |
40785 | 2139 |
2140 ;;; Verify that A is an integer >= 0 and return A in integer form. [I N; - x] | |
2141 (defun math-check-natnum (a) ; [Public] | |
2142 (cond ((natnump a) a) | |
2143 ((and (not (math-negp a)) | |
2144 (Math-num-integerp a)) | |
2145 (math-trunc a)) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2146 (t (math-reject-arg a 'natnump)))) |
40785 | 2147 |
2148 ;;; Verify that A is in floating-point form, or force it to be a float. [F N] | |
2149 (defun math-check-float (a) ; [Public] | |
2150 (cond ((eq (car-safe a) 'float) a) | |
2151 ((Math-vectorp a) (math-map-vec 'math-check-float a)) | |
2152 ((Math-objectp a) (math-float a)) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2153 (t a))) |
40785 | 2154 |
2155 ;;; Verify that A is a constant. | |
2156 (defun math-check-const (a &optional exp-ok) | |
2157 (if (or (math-constp a) | |
2158 (and exp-ok math-expand-formulas)) | |
2159 a | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2160 (math-reject-arg a 'constp))) |
40785 | 2161 |
2162 | |
2163 ;;; Coerce integer A to be a small integer. [S I] | |
2164 (defun math-fixnum (a) | |
2165 (if (consp a) | |
2166 (if (cdr a) | |
2167 (if (eq (car a) 'bigneg) | |
2168 (- (math-fixnum-big (cdr a))) | |
2169 (math-fixnum-big (cdr a))) | |
2170 0) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2171 a)) |
40785 | 2172 |
2173 (defun math-fixnum-big (a) | |
2174 (if (cdr a) | |
2175 (+ (car a) (* (math-fixnum-big (cdr a)) 1000)) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2176 (car a))) |
40785 | 2177 |
41271
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
2178 (defvar math-simplify-only nil) |
40785 | 2179 |
2180 (defun math-normalize-fancy (a) | |
2181 (cond ((eq (car a) 'frac) | |
2182 (math-make-frac (math-normalize (nth 1 a)) | |
2183 (math-normalize (nth 2 a)))) | |
2184 ((eq (car a) 'cplx) | |
2185 (let ((real (math-normalize (nth 1 a))) | |
2186 (imag (math-normalize (nth 2 a)))) | |
2187 (if (and (math-zerop imag) | |
2188 (not math-simplify-only)) ; oh, what a kludge! | |
2189 real | |
2190 (list 'cplx real imag)))) | |
2191 ((eq (car a) 'polar) | |
2192 (math-normalize-polar a)) | |
2193 ((eq (car a) 'hms) | |
2194 (math-normalize-hms a)) | |
2195 ((eq (car a) 'date) | |
2196 (list 'date (math-normalize (nth 1 a)))) | |
2197 ((eq (car a) 'mod) | |
2198 (math-normalize-mod a)) | |
2199 ((eq (car a) 'sdev) | |
2200 (let ((x (math-normalize (nth 1 a))) | |
2201 (s (math-normalize (nth 2 a)))) | |
2202 (if (or (and (Math-objectp x) (not (Math-scalarp x))) | |
2203 (and (Math-objectp s) (not (Math-scalarp s)))) | |
2204 (list 'calcFunc-sdev x s) | |
2205 (math-make-sdev x s)))) | |
2206 ((eq (car a) 'intv) | |
2207 (let ((mask (math-normalize (nth 1 a))) | |
2208 (lo (math-normalize (nth 2 a))) | |
2209 (hi (math-normalize (nth 3 a)))) | |
2210 (if (if (eq (car-safe lo) 'date) | |
2211 (not (eq (car-safe hi) 'date)) | |
2212 (or (and (Math-objectp lo) (not (Math-anglep lo))) | |
2213 (and (Math-objectp hi) (not (Math-anglep hi))))) | |
2214 (list 'calcFunc-intv mask lo hi) | |
2215 (math-make-intv mask lo hi)))) | |
2216 ((eq (car a) 'vec) | |
2217 (cons 'vec (mapcar 'math-normalize (cdr a)))) | |
2218 ((eq (car a) 'quote) | |
2219 (math-normalize (nth 1 a))) | |
2220 ((eq (car a) 'special-const) | |
2221 (calc-with-default-simplification | |
2222 (math-normalize (nth 1 a)))) | |
2223 ((eq (car a) 'var) | |
2224 (cons 'var (cdr a))) ; need to re-cons for selection routines | |
2225 ((eq (car a) 'calcFunc-if) | |
2226 (math-normalize-logical-op a)) | |
2227 ((memq (car a) '(calcFunc-lambda calcFunc-quote calcFunc-condition)) | |
2228 (let ((calc-simplify-mode 'none)) | |
2229 (cons (car a) (mapcar 'math-normalize (cdr a))))) | |
2230 ((eq (car a) 'calcFunc-evalto) | |
2231 (setq a (or (nth 1 a) 0)) | |
2232 (or calc-refreshing-evaltos | |
2233 (setq a (let ((calc-simplify-mode 'none)) (math-normalize a)))) | |
2234 (let ((b (if (and (eq (car-safe a) 'calcFunc-assign) | |
2235 (= (length a) 3)) | |
2236 (nth 2 a) | |
2237 a))) | |
2238 (list 'calcFunc-evalto | |
2239 a | |
2240 (if (eq calc-simplify-mode 'none) | |
2241 (math-normalize b) | |
2242 (calc-with-default-simplification | |
2243 (math-evaluate-expr b)))))) | |
2244 ((or (integerp (car a)) (consp (car a))) | |
2245 (if (null (cdr a)) | |
2246 (math-normalize (car a)) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2247 (error "Can't use multi-valued function in an expression"))))) |
40785 | 2248 |
58570
b651e7e3f5f8
(calc-command-flags, calc-gnuplot-buffer, calc-gnuplot-input)
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58454
diff
changeset
|
2249 ;; The variable math-normalize-a is local to math-normalize in calc.el, |
b651e7e3f5f8
(calc-command-flags, calc-gnuplot-buffer, calc-gnuplot-input)
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58454
diff
changeset
|
2250 ;; but is used by math-normalize-nonstandard, which is called by |
b651e7e3f5f8
(calc-command-flags, calc-gnuplot-buffer, calc-gnuplot-input)
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58454
diff
changeset
|
2251 ;; math-normalize. |
b651e7e3f5f8
(calc-command-flags, calc-gnuplot-buffer, calc-gnuplot-input)
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58454
diff
changeset
|
2252 (defvar math-normalize-a) |
b651e7e3f5f8
(calc-command-flags, calc-gnuplot-buffer, calc-gnuplot-input)
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58454
diff
changeset
|
2253 |
58102
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
2254 (defun math-normalize-nonstandard () |
40785 | 2255 (if (consp calc-simplify-mode) |
2256 (progn | |
2257 (setq calc-simplify-mode 'none | |
58102
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
2258 math-simplify-only (car-safe (cdr-safe math-normalize-a))) |
40785 | 2259 nil) |
58102
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
2260 (and (symbolp (car math-normalize-a)) |
40785 | 2261 (or (eq calc-simplify-mode 'none) |
2262 (and (eq calc-simplify-mode 'num) | |
58102
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
2263 (let ((aptr (setq math-normalize-a |
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
2264 (cons |
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
2265 (car math-normalize-a) |
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
2266 (mapcar 'math-normalize |
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
2267 (cdr math-normalize-a)))))) |
40785 | 2268 (while (and aptr (math-constp (car aptr))) |
2269 (setq aptr (cdr aptr))) | |
2270 aptr))) | |
58102
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
2271 (cons (car math-normalize-a) |
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
2272 (mapcar 'math-normalize (cdr math-normalize-a)))))) |
40785 | 2273 |
2274 | |
2275 ;;; Normalize a bignum digit list by trimming high-end zeros. [L l] | |
2276 (defun math-norm-bignum (a) | |
2277 (let ((digs a) (last nil)) | |
2278 (while digs | |
2279 (or (eq (car digs) 0) (setq last digs)) | |
2280 (setq digs (cdr digs))) | |
2281 (and last | |
2282 (progn | |
2283 (setcdr last nil) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2284 a)))) |
40785 | 2285 |
2286 (defun math-bignum-test (a) ; [B N; B s; b b] | |
2287 (if (consp a) | |
2288 a | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2289 (math-bignum a))) |
40785 | 2290 |
2291 | |
2292 ;;; Return 0 for zero, -1 for negative, 1 for positive. [S n] [Public] | |
2293 (defun calcFunc-sign (a &optional x) | |
2294 (let ((signs (math-possible-signs a))) | |
2295 (cond ((eq signs 4) (or x 1)) | |
2296 ((eq signs 2) 0) | |
2297 ((eq signs 1) (if x (math-neg x) -1)) | |
2298 ((math-looks-negp a) (math-neg (calcFunc-sign (math-neg a)))) | |
2299 (t (calc-record-why 'realp a) | |
2300 (if x | |
2301 (list 'calcFunc-sign a x) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2302 (list 'calcFunc-sign a)))))) |
40785 | 2303 |
2304 ;;; Return 0 if A is numerically equal to B, <0 if less, >0 if more. | |
2305 ;;; Arguments must be normalized! [S N N] | |
2306 (defun math-compare (a b) | |
2307 (cond ((equal a b) | |
2308 (if (and (consp a) | |
2309 (memq (car a) '(var neg * /)) | |
2310 (math-infinitep a)) | |
2311 2 | |
2312 0)) | |
2313 ((and (integerp a) (Math-integerp b)) | |
2314 (if (consp b) | |
2315 (if (eq (car b) 'bigpos) -1 1) | |
2316 (if (< a b) -1 1))) | |
2317 ((and (eq (car-safe a) 'bigpos) (Math-integerp b)) | |
2318 (if (eq (car-safe b) 'bigpos) | |
2319 (math-compare-bignum (cdr a) (cdr b)) | |
2320 1)) | |
2321 ((and (eq (car-safe a) 'bigneg) (Math-integerp b)) | |
2322 (if (eq (car-safe b) 'bigneg) | |
2323 (math-compare-bignum (cdr b) (cdr a)) | |
2324 -1)) | |
2325 ((eq (car-safe a) 'frac) | |
2326 (if (eq (car-safe b) 'frac) | |
2327 (math-compare (math-mul (nth 1 a) (nth 2 b)) | |
2328 (math-mul (nth 1 b) (nth 2 a))) | |
2329 (math-compare (nth 1 a) (math-mul b (nth 2 a))))) | |
2330 ((eq (car-safe b) 'frac) | |
2331 (math-compare (math-mul a (nth 2 b)) (nth 1 b))) | |
2332 ((and (eq (car-safe a) 'float) (eq (car-safe b) 'float)) | |
2333 (if (math-lessp-float a b) -1 1)) | |
2334 ((and (eq (car-safe a) 'date) (eq (car-safe b) 'date)) | |
2335 (math-compare (nth 1 a) (nth 1 b))) | |
2336 ((and (or (Math-anglep a) | |
2337 (and (eq (car a) 'cplx) (eq (nth 2 a) 0))) | |
2338 (or (Math-anglep b) | |
2339 (and (eq (car b) 'cplx) (eq (nth 2 b) 0)))) | |
2340 (calcFunc-sign (math-add a (math-neg b)))) | |
2341 ((and (eq (car-safe a) 'intv) | |
2342 (or (Math-anglep b) (eq (car-safe b) 'date))) | |
2343 (let ((res (math-compare (nth 2 a) b))) | |
2344 (cond ((eq res 1) 1) | |
2345 ((and (eq res 0) (memq (nth 1 a) '(0 1))) 1) | |
2346 ((eq (setq res (math-compare (nth 3 a) b)) -1) -1) | |
2347 ((and (eq res 0) (memq (nth 1 a) '(0 2))) -1) | |
2348 (t 2)))) | |
2349 ((and (eq (car-safe b) 'intv) | |
2350 (or (Math-anglep a) (eq (car-safe a) 'date))) | |
2351 (let ((res (math-compare a (nth 2 b)))) | |
2352 (cond ((eq res -1) -1) | |
2353 ((and (eq res 0) (memq (nth 1 b) '(0 1))) -1) | |
2354 ((eq (setq res (math-compare a (nth 3 b))) 1) 1) | |
2355 ((and (eq res 0) (memq (nth 1 b) '(0 2))) 1) | |
2356 (t 2)))) | |
2357 ((and (eq (car-safe a) 'intv) (eq (car-safe b) 'intv)) | |
2358 (let ((res (math-compare (nth 3 a) (nth 2 b)))) | |
2359 (cond ((eq res -1) -1) | |
2360 ((and (eq res 0) (or (memq (nth 1 a) '(0 2)) | |
2361 (memq (nth 1 b) '(0 1)))) -1) | |
2362 ((eq (setq res (math-compare (nth 2 a) (nth 3 b))) 1) 1) | |
2363 ((and (eq res 0) (or (memq (nth 1 a) '(0 1)) | |
2364 (memq (nth 1 b) '(0 2)))) 1) | |
2365 (t 2)))) | |
2366 ((math-infinitep a) | |
2367 (if (or (equal a '(var uinf var-uinf)) | |
2368 (equal a '(var nan var-nan))) | |
2369 2 | |
2370 (let ((dira (math-infinite-dir a))) | |
2371 (if (math-infinitep b) | |
2372 (if (or (equal b '(var uinf var-uinf)) | |
2373 (equal b '(var nan var-nan))) | |
2374 2 | |
2375 (let ((dirb (math-infinite-dir b))) | |
2376 (cond ((and (eq dira 1) (eq dirb -1)) 1) | |
2377 ((and (eq dira -1) (eq dirb 1)) -1) | |
2378 (t 2)))) | |
2379 (cond ((eq dira 1) 1) | |
2380 ((eq dira -1) -1) | |
2381 (t 2)))))) | |
2382 ((math-infinitep b) | |
2383 (if (or (equal b '(var uinf var-uinf)) | |
2384 (equal b '(var nan var-nan))) | |
2385 2 | |
2386 (let ((dirb (math-infinite-dir b))) | |
2387 (cond ((eq dirb 1) -1) | |
2388 ((eq dirb -1) 1) | |
2389 (t 2))))) | |
2390 ((and (eq (car-safe a) 'calcFunc-exp) | |
2391 (eq (car-safe b) '^) | |
2392 (equal (nth 1 b) '(var e var-e))) | |
2393 (math-compare (nth 1 a) (nth 2 b))) | |
2394 ((and (eq (car-safe b) 'calcFunc-exp) | |
2395 (eq (car-safe a) '^) | |
2396 (equal (nth 1 a) '(var e var-e))) | |
2397 (math-compare (nth 2 a) (nth 1 b))) | |
2398 ((or (and (eq (car-safe a) 'calcFunc-sqrt) | |
2399 (eq (car-safe b) '^) | |
2400 (or (equal (nth 2 b) '(frac 1 2)) | |
2401 (equal (nth 2 b) '(float 5 -1)))) | |
2402 (and (eq (car-safe b) 'calcFunc-sqrt) | |
2403 (eq (car-safe a) '^) | |
2404 (or (equal (nth 2 a) '(frac 1 2)) | |
2405 (equal (nth 2 a) '(float 5 -1))))) | |
2406 (math-compare (nth 1 a) (nth 1 b))) | |
2407 ((eq (car-safe a) 'var) | |
2408 2) | |
2409 (t | |
2410 (if (and (consp a) (consp b) | |
2411 (eq (car a) (car b)) | |
2412 (math-compare-lists (cdr a) (cdr b))) | |
2413 0 | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2414 2)))) |
40785 | 2415 |
2416 ;;; Compare two bignum digit lists, return -1 for A<B, 0 for A=B, 1 for A>B. | |
2417 (defun math-compare-bignum (a b) ; [S l l] | |
2418 (let ((res 0)) | |
2419 (while (and a b) | |
2420 (if (< (car a) (car b)) | |
2421 (setq res -1) | |
2422 (if (> (car a) (car b)) | |
2423 (setq res 1))) | |
2424 (setq a (cdr a) | |
2425 b (cdr b))) | |
2426 (if a | |
2427 (progn | |
2428 (while (eq (car a) 0) (setq a (cdr a))) | |
2429 (if a 1 res)) | |
2430 (while (eq (car b) 0) (setq b (cdr b))) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2431 (if b -1 res)))) |
40785 | 2432 |
2433 (defun math-compare-lists (a b) | |
2434 (cond ((null a) (null b)) | |
2435 ((null b) nil) | |
2436 (t (and (Math-equal (car a) (car b)) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2437 (math-compare-lists (cdr a) (cdr b)))))) |
40785 | 2438 |
2439 (defun math-lessp-float (a b) ; [P F F] | |
2440 (let ((ediff (- (nth 2 a) (nth 2 b)))) | |
2441 (if (>= ediff 0) | |
2442 (if (>= ediff (+ calc-internal-prec calc-internal-prec)) | |
2443 (if (eq (nth 1 a) 0) | |
2444 (Math-integer-posp (nth 1 b)) | |
2445 (Math-integer-negp (nth 1 a))) | |
2446 (Math-lessp (math-scale-int (nth 1 a) ediff) | |
2447 (nth 1 b))) | |
2448 (if (>= (setq ediff (- ediff)) | |
2449 (+ calc-internal-prec calc-internal-prec)) | |
2450 (if (eq (nth 1 b) 0) | |
2451 (Math-integer-negp (nth 1 a)) | |
2452 (Math-integer-posp (nth 1 b))) | |
2453 (Math-lessp (nth 1 a) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2454 (math-scale-int (nth 1 b) ediff)))))) |
40785 | 2455 |
2456 ;;; True if A is numerically equal to B. [P N N] [Public] | |
2457 (defun math-equal (a b) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2458 (= (math-compare a b) 0)) |
40785 | 2459 |
2460 ;;; True if A is numerically less than B. [P R R] [Public] | |
2461 (defun math-lessp (a b) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2462 (= (math-compare a b) -1)) |
40785 | 2463 |
2464 ;;; True if A is numerically equal to the integer B. [P N S] [Public] | |
2465 ;;; B must not be a multiple of 10. | |
2466 (defun math-equal-int (a b) | |
2467 (or (eq a b) | |
2468 (and (eq (car-safe a) 'float) | |
2469 (eq (nth 1 a) b) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2470 (= (nth 2 a) 0)))) |
40785 | 2471 |
2472 | |
2473 | |
2474 | |
2475 ;;; Return the dimensions of a matrix as a list. [l x] [Public] | |
2476 (defun math-mat-dimens (m) | |
2477 (if (math-vectorp m) | |
2478 (if (math-matrixp m) | |
2479 (cons (1- (length m)) | |
2480 (math-mat-dimens (nth 1 m))) | |
2481 (list (1- (length m)))) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2482 nil)) |
40785 | 2483 |
2484 | |
2485 | |
2486 (defun calc-binary-op-fancy (name func arg ident unary) | |
2487 (let ((n (prefix-numeric-value arg))) | |
2488 (cond ((> n 1) | |
2489 (calc-enter-result n | |
2490 name | |
2491 (list 'calcFunc-reduce | |
2492 (math-calcFunc-to-var func) | |
2493 (cons 'vec (calc-top-list-n n))))) | |
2494 ((= n 1) | |
2495 (if unary | |
2496 (calc-enter-result 1 name (list unary (calc-top-n 1))))) | |
2497 ((= n 0) | |
2498 (if ident | |
2499 (calc-enter-result 0 name ident) | |
2500 (error "Argument must be nonzero"))) | |
2501 (t | |
2502 (let ((rhs (calc-top-n 1))) | |
2503 (calc-enter-result (- 1 n) | |
2504 name | |
2505 (mapcar (function | |
2506 (lambda (x) | |
2507 (list func x rhs))) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2508 (calc-top-list-n (- n) 2)))))))) |
40785 | 2509 |
2510 (defun calc-unary-op-fancy (name func arg) | |
2511 (let ((n (prefix-numeric-value arg))) | |
2512 (if (= n 0) (setq n (calc-stack-size))) | |
2513 (cond ((> n 0) | |
2514 (calc-enter-result n | |
2515 name | |
2516 (mapcar (function | |
2517 (lambda (x) | |
2518 (list func x))) | |
2519 (calc-top-list-n n)))) | |
2520 ((< n 0) | |
2521 (calc-enter-result 1 | |
2522 name | |
2523 (list func (calc-top-n (- n))) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2524 (- n)))))) |
40785 | 2525 |
2526 (defvar var-Holidays '(vec (var sat var-sat) (var sun var-sun))) | |
2527 (defvar var-Decls (list 'vec)) | |
2528 | |
2529 | |
2530 (defun math-inexact-result () | |
2531 (and calc-symbolic-mode | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2532 (signal 'inexact-result nil))) |
40785 | 2533 |
2534 (defun math-overflow (&optional exp) | |
2535 (if (and exp (math-negp exp)) | |
2536 (math-underflow) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2537 (signal 'math-overflow nil))) |
40785 | 2538 |
2539 (defun math-underflow () | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2540 (signal 'math-underflow nil)) |
40785 | 2541 |
2542 ;;; Compute the greatest common divisor of A and B. [I I I] [Public] | |
2543 (defun math-gcd (a b) | |
2544 (cond ((not (or (consp a) (consp b))) | |
2545 (if (< a 0) (setq a (- a))) | |
2546 (if (< b 0) (setq b (- b))) | |
2547 (let (c) | |
2548 (if (< a b) | |
2549 (setq c b b a a c)) | |
2550 (while (> b 0) | |
2551 (setq c b | |
2552 b (% a b) | |
2553 a c)) | |
2554 a)) | |
2555 ((eq a 0) b) | |
2556 ((eq b 0) a) | |
2557 (t | |
2558 (if (Math-integer-negp a) (setq a (math-neg a))) | |
2559 (if (Math-integer-negp b) (setq b (math-neg b))) | |
2560 (let (c) | |
2561 (if (Math-natnum-lessp a b) | |
2562 (setq c b b a a c)) | |
2563 (while (and (consp a) (not (eq b 0))) | |
2564 (setq c b | |
2565 b (math-imod a b) | |
2566 a c)) | |
2567 (while (> b 0) | |
2568 (setq c b | |
2569 b (% a b) | |
2570 a c)) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2571 a)))) |
40785 | 2572 |
2573 | |
2574 ;;;; Algebra. | |
2575 | |
2576 ;;; Evaluate variables in an expression. | |
2577 (defun math-evaluate-expr (x) ; [Public] | |
2578 (if calc-embedded-info | |
2579 (calc-embedded-evaluate-expr x) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2580 (calc-normalize (math-evaluate-expr-rec x)))) |
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2581 |
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2582 (defalias 'calcFunc-evalv 'math-evaluate-expr) |
40785 | 2583 |
2584 (defun calcFunc-evalvn (x &optional prec) | |
2585 (if prec | |
2586 (progn | |
2587 (or (math-num-integerp prec) | |
2588 (if (and (math-vectorp prec) | |
2589 (= (length prec) 2) | |
2590 (math-num-integerp (nth 1 prec))) | |
2591 (setq prec (math-add (nth 1 prec) calc-internal-prec)) | |
2592 (math-reject-arg prec 'integerp))) | |
2593 (setq prec (math-trunc prec)) | |
2594 (if (< prec 3) (setq prec 3)) | |
2595 (if (> prec calc-internal-prec) | |
2596 (math-normalize | |
2597 (let ((calc-internal-prec prec)) | |
2598 (calcFunc-evalvn x))) | |
2599 (let ((calc-internal-prec prec)) | |
2600 (calcFunc-evalvn x)))) | |
2601 (let ((calc-symbolic-mode nil)) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2602 (math-evaluate-expr x)))) |
40785 | 2603 |
2604 (defun math-evaluate-expr-rec (x) | |
2605 (if (consp x) | |
2606 (if (memq (car x) '(calcFunc-quote calcFunc-condition | |
2607 calcFunc-evalto calcFunc-assign)) | |
2608 (if (and (eq (car x) 'calcFunc-assign) | |
2609 (= (length x) 3)) | |
2610 (list (car x) (nth 1 x) (math-evaluate-expr-rec (nth 2 x))) | |
2611 x) | |
2612 (if (eq (car x) 'var) | |
2613 (if (and (calc-var-value (nth 2 x)) | |
2614 (not (eq (car-safe (symbol-value (nth 2 x))) | |
2615 'incomplete))) | |
2616 (let ((val (symbol-value (nth 2 x)))) | |
2617 (if (eq (car-safe val) 'special-const) | |
2618 (if calc-symbolic-mode | |
2619 x | |
2620 val) | |
2621 val)) | |
2622 x) | |
2623 (if (Math-primp x) | |
2624 x | |
2625 (cons (car x) (mapcar 'math-evaluate-expr-rec (cdr x)))))) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2626 x)) |
40785 | 2627 |
2628 (defun math-any-floats (expr) | |
2629 (if (Math-primp expr) | |
2630 (math-floatp expr) | |
2631 (while (and (setq expr (cdr expr)) (not (math-any-floats (car expr))))) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2632 expr)) |
40785 | 2633 |
2634 (defvar var-FactorRules 'calc-FactorRules) | |
2635 | |
58102
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
2636 (defvar math-mt-many nil) |
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
2637 (defvar math-mt-func nil) |
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
2638 |
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
2639 (defun math-map-tree (math-mt-func mmt-expr &optional math-mt-many) |
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
2640 (or math-mt-many (setq math-mt-many 1000000)) |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2641 (math-map-tree-rec mmt-expr)) |
40785 | 2642 |
2643 (defun math-map-tree-rec (mmt-expr) | |
58102
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
2644 (or (= math-mt-many 0) |
40785 | 2645 (let ((mmt-done nil) |
2646 mmt-nextval) | |
2647 (while (not mmt-done) | |
58102
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
2648 (while (and (/= math-mt-many 0) |
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
2649 (setq mmt-nextval (funcall math-mt-func mmt-expr)) |
40785 | 2650 (not (equal mmt-expr mmt-nextval))) |
2651 (setq mmt-expr mmt-nextval | |
58102
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
2652 math-mt-many (if (> math-mt-many 0) |
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
2653 (1- math-mt-many) |
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
2654 (1+ math-mt-many)))) |
40785 | 2655 (if (or (Math-primp mmt-expr) |
58102
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
2656 (<= math-mt-many 0)) |
40785 | 2657 (setq mmt-done t) |
2658 (setq mmt-nextval (cons (car mmt-expr) | |
2659 (mapcar 'math-map-tree-rec | |
2660 (cdr mmt-expr)))) | |
2661 (if (equal mmt-nextval mmt-expr) | |
2662 (setq mmt-done t) | |
2663 (setq mmt-expr mmt-nextval)))))) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2664 mmt-expr) |
40785 | 2665 |
2666 (defun math-is-true (expr) | |
2667 (if (Math-numberp expr) | |
2668 (not (Math-zerop expr)) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2669 (math-known-nonzerop expr))) |
40785 | 2670 |
2671 (defun math-const-var (expr) | |
2672 (and (consp expr) | |
2673 (eq (car expr) 'var) | |
2674 (or (and (symbolp (nth 2 expr)) | |
2675 (boundp (nth 2 expr)) | |
2676 (eq (car-safe (symbol-value (nth 2 expr))) 'special-const)) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2677 (memq (nth 2 expr) '(var-inf var-uinf var-nan))))) |
40785 | 2678 |
58570
b651e7e3f5f8
(calc-command-flags, calc-gnuplot-buffer, calc-gnuplot-input)
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58454
diff
changeset
|
2679 ;; The variable math-integral-cache is originally declared in calcalg2.el, |
b651e7e3f5f8
(calc-command-flags, calc-gnuplot-buffer, calc-gnuplot-input)
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58454
diff
changeset
|
2680 ;; but is set by math-defintegral and math-definitegral2. |
b651e7e3f5f8
(calc-command-flags, calc-gnuplot-buffer, calc-gnuplot-input)
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58454
diff
changeset
|
2681 (defvar math-integral-cache) |
b651e7e3f5f8
(calc-command-flags, calc-gnuplot-buffer, calc-gnuplot-input)
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58454
diff
changeset
|
2682 |
40785 | 2683 (defmacro math-defintegral (funcs &rest code) |
2684 (setq math-integral-cache nil) | |
2685 (append '(progn) | |
2686 (mapcar (function | |
2687 (lambda (func) | |
2688 (list 'put (list 'quote func) ''math-integral | |
2689 (list 'nconc | |
2690 (list 'get (list 'quote func) ''math-integral) | |
2691 (list 'list | |
2692 (list 'function | |
2693 (append '(lambda (u)) | |
2694 code))))))) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2695 (if (symbolp funcs) (list funcs) funcs)))) |
40785 | 2696 (put 'math-defintegral 'lisp-indent-hook 1) |
2697 | |
2698 (defmacro math-defintegral-2 (funcs &rest code) | |
2699 (setq math-integral-cache nil) | |
2700 (append '(progn) | |
2701 (mapcar (function | |
2702 (lambda (func) | |
2703 (list 'put (list 'quote func) ''math-integral-2 | |
2704 (list 'nconc | |
2705 (list 'get (list 'quote func) | |
2706 ''math-integral-2) | |
2707 (list 'list | |
2708 (list 'function | |
2709 (append '(lambda (u v)) | |
2710 code))))))) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2711 (if (symbolp funcs) (list funcs) funcs)))) |
40785 | 2712 (put 'math-defintegral-2 'lisp-indent-hook 1) |
2713 | |
2714 (defvar var-IntegAfterRules 'calc-IntegAfterRules) | |
2715 | |
2716 (defvar var-FitRules 'calc-FitRules) | |
2717 | |
41271
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
2718 (defvar math-poly-base-variable nil) |
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
2719 (defvar math-poly-neg-powers nil) |
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
2720 (defvar math-poly-mult-powers 1) |
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
2721 (defvar math-poly-frac-powers nil) |
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
2722 (defvar math-poly-exp-base nil) |
40785 | 2723 |
2724 (defun math-build-var-name (name) | |
2725 (if (stringp name) | |
2726 (setq name (intern name))) | |
2727 (if (string-match "\\`var-." (symbol-name name)) | |
2728 (list 'var (intern (substring (symbol-name name) 4)) name) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2729 (list 'var name (intern (concat "var-" (symbol-name name)))))) |
40785 | 2730 |
41271
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
2731 (defvar math-simplifying-units nil) |
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
2732 (defvar math-combining-units t) |
40785 | 2733 |
2734 ;;; Nontrivial number parsing. | |
2735 | |
2736 (defun math-read-number-fancy (s) | |
2737 (cond | |
2738 | |
2739 ;; Integer+fractions | |
2740 ((string-match "^\\([0-9]*\\)[:/]\\([0-9]*\\)[:/]\\([0-9]*\\)$" s) | |
2741 (let ((int (math-match-substring s 1)) | |
2742 (num (math-match-substring s 2)) | |
2743 (den (math-match-substring s 3))) | |
2744 (let ((int (if (> (length int) 0) (math-read-number int) 0)) | |
2745 (num (if (> (length num) 0) (math-read-number num) 1)) | |
2746 (den (if (> (length num) 0) (math-read-number den) 1))) | |
2747 (and int num den | |
2748 (math-integerp int) (math-integerp num) (math-integerp den) | |
2749 (not (math-zerop den)) | |
2750 (list 'frac (math-add num (math-mul int den)) den))))) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49263
diff
changeset
|
2751 |
40785 | 2752 ;; Fractions |
2753 ((string-match "^\\([0-9]*\\)[:/]\\([0-9]*\\)$" s) | |
2754 (let ((num (math-match-substring s 1)) | |
2755 (den (math-match-substring s 2))) | |
2756 (let ((num (if (> (length num) 0) (math-read-number num) 1)) | |
2757 (den (if (> (length num) 0) (math-read-number den) 1))) | |
2758 (and num den (math-integerp num) (math-integerp den) | |
2759 (not (math-zerop den)) | |
2760 (list 'frac num den))))) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49263
diff
changeset
|
2761 |
40785 | 2762 ;; Modulo forms |
2763 ((string-match "^\\(.*\\) *mod *\\(.*\\)$" s) | |
2764 (let* ((n (math-match-substring s 1)) | |
2765 (m (math-match-substring s 2)) | |
2766 (n (math-read-number n)) | |
2767 (m (math-read-number m))) | |
2768 (and n m (math-anglep n) (math-anglep m) | |
2769 (list 'mod n m)))) | |
2770 | |
2771 ;; Error forms | |
2772 ((string-match "^\\(.*\\) *\\+/- *\\(.*\\)$" s) | |
2773 (let* ((x (math-match-substring s 1)) | |
2774 (sigma (math-match-substring s 2)) | |
2775 (x (math-read-number x)) | |
2776 (sigma (math-read-number sigma))) | |
2777 (and x sigma (math-scalarp x) (math-anglep sigma) | |
2778 (list 'sdev x sigma)))) | |
2779 | |
2780 ;; Hours (or degrees) | |
2781 ((or (string-match "^\\([^#^]+\\)[@oOhH]\\(.*\\)$" s) | |
2782 (string-match "^\\([^#^]+\\)[dD][eE]?[gG]?\\(.*\\)$" s)) | |
2783 (let* ((hours (math-match-substring s 1)) | |
2784 (minsec (math-match-substring s 2)) | |
2785 (hours (math-read-number hours)) | |
2786 (minsec (if (> (length minsec) 0) (math-read-number minsec) 0))) | |
2787 (and hours minsec | |
2788 (math-num-integerp hours) | |
2789 (not (math-negp hours)) (not (math-negp minsec)) | |
2790 (cond ((math-num-integerp minsec) | |
2791 (and (Math-lessp minsec 60) | |
2792 (list 'hms hours minsec 0))) | |
2793 ((and (eq (car-safe minsec) 'hms) | |
2794 (math-zerop (nth 1 minsec))) | |
2795 (math-add (list 'hms hours 0 0) minsec)) | |
2796 (t nil))))) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49263
diff
changeset
|
2797 |
40785 | 2798 ;; Minutes |
2799 ((string-match "^\\([^'#^]+\\)[mM']\\(.*\\)$" s) | |
2800 (let* ((minutes (math-match-substring s 1)) | |
2801 (seconds (math-match-substring s 2)) | |
2802 (minutes (math-read-number minutes)) | |
2803 (seconds (if (> (length seconds) 0) (math-read-number seconds) 0))) | |
2804 (and minutes seconds | |
2805 (math-num-integerp minutes) | |
2806 (not (math-negp minutes)) (not (math-negp seconds)) | |
2807 (cond ((math-realp seconds) | |
2808 (and (Math-lessp minutes 60) | |
2809 (list 'hms 0 minutes seconds))) | |
2810 ((and (eq (car-safe seconds) 'hms) | |
2811 (math-zerop (nth 1 seconds)) | |
2812 (math-zerop (nth 2 seconds))) | |
2813 (math-add (list 'hms 0 minutes 0) seconds)) | |
2814 (t nil))))) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49263
diff
changeset
|
2815 |
40785 | 2816 ;; Seconds |
2817 ((string-match "^\\([^\"#^]+\\)[sS\"]$" s) | |
2818 (let ((seconds (math-read-number (math-match-substring s 1)))) | |
2819 (and seconds (math-realp seconds) | |
2820 (not (math-negp seconds)) | |
2821 (Math-lessp seconds 60) | |
2822 (list 'hms 0 0 seconds)))) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49263
diff
changeset
|
2823 |
40785 | 2824 ;; Integer+fraction with explicit radix |
2825 ((string-match "^\\([0-9]+\\)\\(#\\|\\^\\^\\)\\([0-9a-zA-Z]*\\)[:/]\\([0-9a-zA-Z]*\\)[:/]\\([0-9a-zA-Z]\\)$" s) | |
62034
b00f3dbbb0b5
(calc-read-number-fancy): Replace string-to-int by string-to-number.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
60078
diff
changeset
|
2826 (let ((radix (string-to-number (math-match-substring s 1))) |
40785 | 2827 (int (math-match-substring s 3)) |
2828 (num (math-match-substring s 4)) | |
2829 (den (math-match-substring s 5))) | |
2830 (let ((int (if (> (length int) 0) (math-read-radix int radix) 0)) | |
2831 (num (if (> (length num) 0) (math-read-radix num radix) 1)) | |
2832 (den (if (> (length den) 0) (math-read-radix den radix) 1))) | |
2833 (and int num den (not (math-zerop den)) | |
2834 (list 'frac | |
2835 (math-add num (math-mul int den)) | |
2836 den))))) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49263
diff
changeset
|
2837 |
40785 | 2838 ;; Fraction with explicit radix |
2839 ((string-match "^\\([0-9]+\\)\\(#\\|\\^\\^\\)\\([0-9a-zA-Z]*\\)[:/]\\([0-9a-zA-Z]*\\)$" s) | |
62034
b00f3dbbb0b5
(calc-read-number-fancy): Replace string-to-int by string-to-number.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
60078
diff
changeset
|
2840 (let ((radix (string-to-number (math-match-substring s 1))) |
40785 | 2841 (num (math-match-substring s 3)) |
2842 (den (math-match-substring s 4))) | |
2843 (let ((num (if (> (length num) 0) (math-read-radix num radix) 1)) | |
2844 (den (if (> (length den) 0) (math-read-radix den radix) 1))) | |
2845 (and num den (not (math-zerop den)) (list 'frac num den))))) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49263
diff
changeset
|
2846 |
40785 | 2847 ;; Float with explicit radix and exponent |
2848 ((or (string-match "^0*\\(\\([2-9]\\|1[0-4]\\)\\(#\\|\\^\\^\\)[0-9a-dA-D.]+\\)[eE]\\([-+]?[0-9]+\\)$" s) | |
2849 (string-match "^\\(\\([0-9]+\\)\\(#\\|\\^\\^\\)[0-9a-zA-Z.]+\\) *\\* *\\2\\.? *\\^ *\\([-+]?[0-9]+\\)$" s)) | |
62034
b00f3dbbb0b5
(calc-read-number-fancy): Replace string-to-int by string-to-number.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
60078
diff
changeset
|
2850 (let ((radix (string-to-number (math-match-substring s 2))) |
40785 | 2851 (mant (math-match-substring s 1)) |
2852 (exp (math-match-substring s 4))) | |
2853 (let ((mant (math-read-number mant)) | |
2854 (exp (math-read-number exp))) | |
2855 (and mant exp | |
2856 (math-mul mant (math-pow (math-float radix) exp)))))) | |
2857 | |
2858 ;; Float with explicit radix, no exponent | |
2859 ((string-match "^\\([0-9]+\\)\\(#\\|\\^\\^\\)\\([0-9a-zA-Z]*\\)\\.\\([0-9a-zA-Z]*\\)$" s) | |
62034
b00f3dbbb0b5
(calc-read-number-fancy): Replace string-to-int by string-to-number.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
60078
diff
changeset
|
2860 (let ((radix (string-to-number (math-match-substring s 1))) |
40785 | 2861 (int (math-match-substring s 3)) |
2862 (fracs (math-match-substring s 4))) | |
2863 (let ((int (if (> (length int) 0) (math-read-radix int radix) 0)) | |
2864 (frac (if (> (length fracs) 0) (math-read-radix fracs radix) 0)) | |
2865 (calc-prefer-frac nil)) | |
2866 (and int frac | |
2867 (math-add int (math-div frac (math-pow radix (length fracs)))))))) | |
2868 | |
2869 ;; Integer with explicit radix | |
2870 ((string-match "^\\([0-9]+\\)\\(#\\|\\^\\^\\)\\([0-9a-zA-Z]+\\)$" s) | |
2871 (math-read-radix (math-match-substring s 3) | |
62034
b00f3dbbb0b5
(calc-read-number-fancy): Replace string-to-int by string-to-number.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
60078
diff
changeset
|
2872 (string-to-number (math-match-substring s 1)))) |
40785 | 2873 |
2874 ;; C language hexadecimal notation | |
2875 ((and (eq calc-language 'c) | |
2876 (string-match "^0[xX]\\([0-9a-fA-F]+\\)$" s)) | |
2877 (let ((digs (math-match-substring s 1))) | |
2878 (math-read-radix digs 16))) | |
2879 | |
2880 ;; Pascal language hexadecimal notation | |
2881 ((and (eq calc-language 'pascal) | |
2882 (string-match "^\\$\\([0-9a-fA-F]+\\)$" s)) | |
2883 (let ((digs (math-match-substring s 1))) | |
2884 (math-read-radix digs 16))) | |
2885 | |
2886 ;; Fraction using "/" instead of ":" | |
2887 ((string-match "^\\([0-9]+\\)/\\([0-9/]+\\)$" s) | |
2888 (math-read-number (concat (math-match-substring s 1) ":" | |
2889 (math-match-substring s 2)))) | |
2890 | |
2891 ;; Syntax error! | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2892 (t nil))) |
40785 | 2893 |
2894 (defun math-read-radix (s r) ; [I X D] | |
2895 (setq s (upcase s)) | |
2896 (let ((i 0) | |
2897 (res 0) | |
2898 dig) | |
2899 (while (and (< i (length s)) | |
2900 (setq dig (math-read-radix-digit (elt s i))) | |
2901 (< dig r)) | |
2902 (setq res (math-add (math-mul res r) dig) | |
2903 i (1+ i))) | |
2904 (and (= i (length s)) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2905 res))) |
40785 | 2906 |
2907 | |
2908 | |
2909 ;;; Expression parsing. | |
2910 | |
58102
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
2911 (defvar math-expr-data) |
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
2912 |
58132
349b9aab8e82
(math-read-expr): Use declared variables math-exp-pos,
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58102
diff
changeset
|
2913 (defun math-read-expr (math-exp-str) |
349b9aab8e82
(math-read-expr): Use declared variables math-exp-pos,
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58102
diff
changeset
|
2914 (let ((math-exp-pos 0) |
349b9aab8e82
(math-read-expr): Use declared variables math-exp-pos,
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58102
diff
changeset
|
2915 (math-exp-old-pos 0) |
349b9aab8e82
(math-read-expr): Use declared variables math-exp-pos,
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58102
diff
changeset
|
2916 (math-exp-keep-spaces nil) |
349b9aab8e82
(math-read-expr): Use declared variables math-exp-pos,
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58102
diff
changeset
|
2917 math-exp-token math-expr-data) |
58454
09310c09d91e
(math-read-replacement-list, math-read-superscripts): New variables.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58410
diff
changeset
|
2918 (setq math-exp-str (math-read-preprocess-string math-exp-str)) |
58132
349b9aab8e82
(math-read-expr): Use declared variables math-exp-pos,
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58102
diff
changeset
|
2919 (while (setq math-exp-token (string-match "\\.\\.\\([^.]\\|.[^.]\\)" math-exp-str)) |
349b9aab8e82
(math-read-expr): Use declared variables math-exp-pos,
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58102
diff
changeset
|
2920 (setq math-exp-str (concat (substring math-exp-str 0 math-exp-token) "\\dots" |
349b9aab8e82
(math-read-expr): Use declared variables math-exp-pos,
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58102
diff
changeset
|
2921 (substring math-exp-str (+ math-exp-token 2))))) |
40785 | 2922 (math-build-parse-table) |
2923 (math-read-token) | |
2924 (let ((val (catch 'syntax (math-read-expr-level 0)))) | |
2925 (if (stringp val) | |
58132
349b9aab8e82
(math-read-expr): Use declared variables math-exp-pos,
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58102
diff
changeset
|
2926 (list 'error math-exp-old-pos val) |
349b9aab8e82
(math-read-expr): Use declared variables math-exp-pos,
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58102
diff
changeset
|
2927 (if (equal math-exp-token 'end) |
40785 | 2928 val |
58132
349b9aab8e82
(math-read-expr): Use declared variables math-exp-pos,
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58102
diff
changeset
|
2929 (list 'error math-exp-old-pos "Syntax error")))))) |
40785 | 2930 |
2931 (defun math-read-plain-expr (exp-str &optional error-check) | |
2932 (let* ((calc-language nil) | |
2933 (math-expr-opers math-standard-opers) | |
2934 (val (math-read-expr exp-str))) | |
2935 (and error-check | |
2936 (eq (car-safe val) 'error) | |
2937 (error "%s: %s" (nth 2 val) exp-str)) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2938 val)) |
40785 | 2939 |
2940 | |
2941 (defun math-read-string () | |
58102
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
2942 (let ((str (read-from-string (concat math-expr-data "\"")))) |
57dc7bb5ee57
(calc-init-extensions): Remove old code.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58062
diff
changeset
|
2943 (or (and (= (cdr str) (1+ (length math-expr-data))) |
40785 | 2944 (stringp (car str))) |
2945 (throw 'syntax "Error in string constant")) | |
2946 (math-read-token) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2947 (append '(vec) (car str) nil))) |
40785 | 2948 |
2949 | |
2950 | |
2951 ;;; They said it couldn't be done... | |
2952 | |
2953 (defun math-read-big-expr (str) | |
2954 (and (> (length calc-left-label) 0) | |
2955 (string-match (concat "^" (regexp-quote calc-left-label)) str) | |
2956 (setq str (concat (substring str 0 (match-beginning 0)) | |
2957 (substring str (match-end 0))))) | |
2958 (and (> (length calc-right-label) 0) | |
2959 (string-match (concat (regexp-quote calc-right-label) " *$") str) | |
2960 (setq str (concat (substring str 0 (match-beginning 0)) | |
2961 (substring str (match-end 0))))) | |
2962 (if (string-match "\\\\[^ \n|]" str) | |
59828
2f3d955df59a
(math-read-big-expr): Make LaTeX the default TeX mode.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59810
diff
changeset
|
2963 (if (eq calc-language 'latex) |
40785 | 2964 (math-read-expr str) |
59828
2f3d955df59a
(math-read-big-expr): Make LaTeX the default TeX mode.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59810
diff
changeset
|
2965 (let ((calc-language 'latex) |
40785 | 2966 (calc-language-option nil) |
59828
2f3d955df59a
(math-read-big-expr): Make LaTeX the default TeX mode.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59810
diff
changeset
|
2967 (math-expr-opers (get 'latex 'math-oper-table)) |
2f3d955df59a
(math-read-big-expr): Make LaTeX the default TeX mode.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59810
diff
changeset
|
2968 (math-expr-function-mapping (get 'latex 'math-function-table)) |
2f3d955df59a
(math-read-big-expr): Make LaTeX the default TeX mode.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
59810
diff
changeset
|
2969 (math-expr-variable-mapping (get 'latex 'math-variable-table))) |
40785 | 2970 (math-read-expr str))) |
58410
8d1aac87d0f4
(math-read-big-expr, math-read-big-bigp): Replace variable lines by
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58301
diff
changeset
|
2971 (let ((math-read-big-lines nil) |
40785 | 2972 (pos 0) |
2973 (width 0) | |
58410
8d1aac87d0f4
(math-read-big-expr, math-read-big-bigp): Replace variable lines by
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58301
diff
changeset
|
2974 (math-read-big-err-msg nil) |
8d1aac87d0f4
(math-read-big-expr, math-read-big-bigp): Replace variable lines by
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58301
diff
changeset
|
2975 math-read-big-baseline math-read-big-h2 |
40785 | 2976 new-pos p) |
2977 (while (setq new-pos (string-match "\n" str pos)) | |
58410
8d1aac87d0f4
(math-read-big-expr, math-read-big-bigp): Replace variable lines by
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58301
diff
changeset
|
2978 (setq math-read-big-lines |
8d1aac87d0f4
(math-read-big-expr, math-read-big-bigp): Replace variable lines by
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58301
diff
changeset
|
2979 (cons (substring str pos new-pos) math-read-big-lines) |
40785 | 2980 pos (1+ new-pos))) |
58410
8d1aac87d0f4
(math-read-big-expr, math-read-big-bigp): Replace variable lines by
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58301
diff
changeset
|
2981 (setq math-read-big-lines |
8d1aac87d0f4
(math-read-big-expr, math-read-big-bigp): Replace variable lines by
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58301
diff
changeset
|
2982 (nreverse (cons (substring str pos) math-read-big-lines)) |
8d1aac87d0f4
(math-read-big-expr, math-read-big-bigp): Replace variable lines by
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58301
diff
changeset
|
2983 p math-read-big-lines) |
40785 | 2984 (while p |
2985 (setq width (max width (length (car p))) | |
2986 p (cdr p))) | |
58410
8d1aac87d0f4
(math-read-big-expr, math-read-big-bigp): Replace variable lines by
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58301
diff
changeset
|
2987 (if (math-read-big-bigp math-read-big-lines) |
40785 | 2988 (or (catch 'syntax |
58410
8d1aac87d0f4
(math-read-big-expr, math-read-big-bigp): Replace variable lines by
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58301
diff
changeset
|
2989 (math-read-big-rec 0 0 width (length math-read-big-lines))) |
8d1aac87d0f4
(math-read-big-expr, math-read-big-bigp): Replace variable lines by
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58301
diff
changeset
|
2990 math-read-big-err-msg |
40785 | 2991 '(error 0 "Syntax error")) |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
2992 (math-read-expr str))))) |
40785 | 2993 |
58410
8d1aac87d0f4
(math-read-big-expr, math-read-big-bigp): Replace variable lines by
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58301
diff
changeset
|
2994 (defun math-read-big-bigp (math-read-big-lines) |
8d1aac87d0f4
(math-read-big-expr, math-read-big-bigp): Replace variable lines by
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58301
diff
changeset
|
2995 (and (cdr math-read-big-lines) |
40785 | 2996 (let ((matrix nil) |
2997 (v 0) | |
58410
8d1aac87d0f4
(math-read-big-expr, math-read-big-bigp): Replace variable lines by
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58301
diff
changeset
|
2998 (height (if (> (length (car math-read-big-lines)) 0) 1 0))) |
8d1aac87d0f4
(math-read-big-expr, math-read-big-bigp): Replace variable lines by
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58301
diff
changeset
|
2999 (while (and (cdr math-read-big-lines) |
40785 | 3000 (let* ((i 0) |
3001 j | |
58410
8d1aac87d0f4
(math-read-big-expr, math-read-big-bigp): Replace variable lines by
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58301
diff
changeset
|
3002 (l1 (car math-read-big-lines)) |
8d1aac87d0f4
(math-read-big-expr, math-read-big-bigp): Replace variable lines by
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58301
diff
changeset
|
3003 (l2 (nth 1 math-read-big-lines)) |
40785 | 3004 (len (min (length l1) (length l2)))) |
3005 (if (> (length l2) 0) | |
3006 (setq height (1+ height))) | |
3007 (while (and (< i len) | |
3008 (or (memq (aref l1 i) '(?\ ?\- ?\_)) | |
3009 (memq (aref l2 i) '(?\ ?\-)) | |
3010 (and (memq (aref l1 i) '(?\| ?\,)) | |
3011 (= (aref l2 i) (aref l1 i))) | |
3012 (and (eq (aref l1 i) ?\[) | |
3013 (eq (aref l2 i) ?\[) | |
58410
8d1aac87d0f4
(math-read-big-expr, math-read-big-bigp): Replace variable lines by
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58301
diff
changeset
|
3014 (let ((math-rb-h2 (length l1))) |
40785 | 3015 (setq j (math-read-big-balance |
3016 (1+ i) v "["))) | |
3017 (setq i (1- j))))) | |
3018 (setq i (1+ i))) | |
3019 (or (= i len) | |
3020 (and (eq (aref l1 i) ?\[) | |
3021 (eq (aref l2 i) ?\[) | |
3022 (setq matrix t) | |
3023 nil)))) | |
58410
8d1aac87d0f4
(math-read-big-expr, math-read-big-bigp): Replace variable lines by
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58301
diff
changeset
|
3024 (setq math-read-big-lines (cdr math-read-big-lines) |
40785 | 3025 v (1+ v))) |
3026 (or (and (> height 1) | |
58410
8d1aac87d0f4
(math-read-big-expr, math-read-big-bigp): Replace variable lines by
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58301
diff
changeset
|
3027 (not (cdr math-read-big-lines))) |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
3028 matrix)))) |
40785 | 3029 |
3030 ;;; Nontrivial "flat" formatting. | |
3031 | |
41271
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
3032 (defvar math-format-hash-args nil) |
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
3033 (defvar calc-can-abbrev-vectors nil) |
fcd507927105
Change all toplevel `setq' forms to `defvar' forms, and move them
Colin Walters <walters@gnu.org>
parents:
41043
diff
changeset
|
3034 |
40785 | 3035 (defun math-format-flat-expr-fancy (a prec) |
3036 (cond | |
3037 ((eq (car a) 'incomplete) | |
3038 (format "<incomplete %s>" (nth 1 a))) | |
3039 ((eq (car a) 'vec) | |
3040 (if (or calc-full-trail-vectors (not calc-can-abbrev-vectors) | |
3041 (< (length a) 7)) | |
3042 (concat "[" (math-format-flat-vector (cdr a) ", " | |
3043 (if (cdr (cdr a)) 0 1000)) "]") | |
3044 (concat "[" | |
3045 (math-format-flat-expr (nth 1 a) 0) ", " | |
3046 (math-format-flat-expr (nth 2 a) 0) ", " | |
3047 (math-format-flat-expr (nth 3 a) 0) ", ..., " | |
3048 (math-format-flat-expr (nth (1- (length a)) a) 0) "]"))) | |
3049 ((eq (car a) 'intv) | |
3050 (concat (if (memq (nth 1 a) '(0 1)) "(" "[") | |
3051 (math-format-flat-expr (nth 2 a) 1000) | |
3052 " .. " | |
3053 (math-format-flat-expr (nth 3 a) 1000) | |
3054 (if (memq (nth 1 a) '(0 2)) ")" "]"))) | |
3055 ((eq (car a) 'date) | |
3056 (concat "<" (math-format-date a) ">")) | |
3057 ((and (eq (car a) 'calcFunc-lambda) (> (length a) 2)) | |
3058 (let ((p (cdr a)) | |
3059 (ap calc-arg-values) | |
3060 (math-format-hash-args (if (= (length a) 3) 1 t))) | |
3061 (while (and (cdr p) (equal (car p) (car ap))) | |
3062 (setq p (cdr p) ap (cdr ap))) | |
3063 (concat "<" | |
3064 (if (cdr p) | |
3065 (concat (math-format-flat-vector | |
3066 (nreverse (cdr (reverse (cdr a)))) ", " 0) | |
3067 " : ") | |
3068 "") | |
3069 (math-format-flat-expr (nth (1- (length a)) a) 0) | |
3070 ">"))) | |
3071 ((eq (car a) 'var) | |
3072 (or (and math-format-hash-args | |
3073 (let ((p calc-arg-values) (v 1)) | |
3074 (while (and p (not (equal (car p) a))) | |
3075 (setq p (and (eq math-format-hash-args t) (cdr p)) | |
3076 v (1+ v))) | |
3077 (and p | |
3078 (if (eq math-format-hash-args 1) | |
3079 "#" | |
3080 (format "#%d" v))))) | |
3081 (symbol-name (nth 1 a)))) | |
3082 ((and (memq (car a) '(calcFunc-string calcFunc-bstring)) | |
3083 (= (length a) 2) | |
3084 (math-vectorp (nth 1 a)) | |
3085 (math-vector-is-string (nth 1 a))) | |
3086 (concat (substring (symbol-name (car a)) 9) | |
3087 "(" (math-vector-to-string (nth 1 a) t) ")")) | |
3088 (t | |
3089 (let ((op (math-assq2 (car a) math-standard-opers))) | |
3090 (cond ((and op (= (length a) 3)) | |
3091 (if (> prec (min (nth 2 op) (nth 3 op))) | |
3092 (concat "(" (math-format-flat-expr a 0) ")") | |
3093 (let ((lhs (math-format-flat-expr (nth 1 a) (nth 2 op))) | |
3094 (rhs (math-format-flat-expr (nth 2 a) (nth 3 op)))) | |
3095 (setq op (car op)) | |
3096 (if (or (equal op "^") (equal op "_")) | |
3097 (if (= (aref lhs 0) ?-) | |
3098 (setq lhs (concat "(" lhs ")"))) | |
3099 (setq op (concat " " op " "))) | |
3100 (concat lhs op rhs)))) | |
3101 ((eq (car a) 'neg) | |
3102 (concat "-" (math-format-flat-expr (nth 1 a) 1000))) | |
3103 (t | |
3104 (concat (math-remove-dashes | |
3105 (if (string-match "\\`calcFunc-\\([a-zA-Z0-9']+\\)\\'" | |
3106 (symbol-name (car a))) | |
3107 (math-match-substring (symbol-name (car a)) 1) | |
3108 (symbol-name (car a)))) | |
3109 "(" | |
3110 (math-format-flat-vector (cdr a) ", " 0) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
3111 ")"))))))) |
40785 | 3112 |
3113 (defun math-format-flat-vector (vec sep prec) | |
3114 (if vec | |
3115 (let ((buf (math-format-flat-expr (car vec) prec))) | |
3116 (while (setq vec (cdr vec)) | |
3117 (setq buf (concat buf sep (math-format-flat-expr (car vec) prec)))) | |
3118 buf) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
3119 "")) |
40785 | 3120 |
3121 (defun math-format-nice-expr (x w) | |
3122 (cond ((and (eq (car-safe x) 'vec) | |
3123 (cdr (cdr x)) | |
3124 (let ((ops '(vec calcFunc-assign calcFunc-condition | |
3125 calcFunc-schedule calcFunc-iterations | |
3126 calcFunc-phase))) | |
3127 (or (memq (car-safe (nth 1 x)) ops) | |
3128 (memq (car-safe (nth 2 x)) ops) | |
3129 (memq (car-safe (nth 3 x)) ops) | |
3130 calc-break-vectors))) | |
3131 (concat "[ " (math-format-flat-vector (cdr x) ",\n " 0) " ]")) | |
3132 (t | |
3133 (let ((str (math-format-flat-expr x 0)) | |
3134 (pos 0) p) | |
3135 (or (string-match "\"" str) | |
3136 (while (<= (setq p (+ pos w)) (length str)) | |
3137 (while (and (> (setq p (1- p)) pos) | |
3138 (not (= (aref str p) ? )))) | |
3139 (if (> p (+ pos 5)) | |
3140 (setq str (concat (substring str 0 p) | |
3141 "\n " | |
3142 (substring str p)) | |
3143 pos (1+ p)) | |
3144 (setq pos (+ pos w))))) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
3145 str)))) |
40785 | 3146 |
3147 (defun math-assq2 (v a) | |
3148 (while (and a (not (eq v (nth 1 (car a))))) | |
3149 (setq a (cdr a))) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
3150 (car a)) |
40785 | 3151 |
3152 (defun math-format-number-fancy (a prec) | |
3153 (cond | |
3154 ((eq (car a) 'float) ; non-decimal radix | |
3155 (if (Math-integer-negp (nth 1 a)) | |
3156 (concat "-" (math-format-number (math-neg a))) | |
3157 (let ((str (if (and calc-radix-formatter | |
3158 (not (memq calc-language '(c pascal)))) | |
3159 (funcall calc-radix-formatter | |
3160 calc-number-radix | |
3161 (math-format-radix-float a prec)) | |
3162 (format "%d#%s" calc-number-radix | |
3163 (math-format-radix-float a prec))))) | |
3164 (if (and prec (> prec 191) (string-match "\\*" str)) | |
3165 (concat "(" str ")") | |
3166 str)))) | |
3167 ((eq (car a) 'frac) | |
3168 (setq a (math-adjust-fraction a)) | |
3169 (if (> (length (car calc-frac-format)) 1) | |
3170 (if (Math-integer-negp (nth 1 a)) | |
3171 (concat "-" (math-format-number (math-neg a))) | |
3172 (let ((q (math-idivmod (nth 1 a) (nth 2 a)))) | |
3173 (concat (let ((calc-frac-format nil)) | |
3174 (math-format-number (car q))) | |
3175 (substring (car calc-frac-format) 0 1) | |
3176 (let ((math-radix-explicit-format nil) | |
3177 (calc-frac-format nil)) | |
3178 (math-format-number (cdr q))) | |
3179 (substring (car calc-frac-format) 1 2) | |
3180 (let ((math-radix-explicit-format nil) | |
3181 (calc-frac-format nil)) | |
3182 (math-format-number (nth 2 a)))))) | |
3183 (concat (let ((calc-frac-format nil)) | |
3184 (math-format-number (nth 1 a))) | |
3185 (car calc-frac-format) | |
3186 (let ((math-radix-explicit-format nil) | |
3187 (calc-frac-format nil)) | |
3188 (math-format-number (nth 2 a)))))) | |
3189 ((eq (car a) 'cplx) | |
3190 (if (math-zerop (nth 2 a)) | |
3191 (math-format-number (nth 1 a)) | |
3192 (if (null calc-complex-format) | |
3193 (concat "(" (math-format-number (nth 1 a)) | |
3194 ", " (math-format-number (nth 2 a)) ")") | |
3195 (if (math-zerop (nth 1 a)) | |
3196 (if (math-equal-int (nth 2 a) 1) | |
3197 (symbol-name calc-complex-format) | |
3198 (if (math-equal-int (nth 2 a) -1) | |
3199 (concat "-" (symbol-name calc-complex-format)) | |
3200 (if prec | |
3201 (math-compose-expr (list '* (nth 2 a) '(cplx 0 1)) prec) | |
3202 (concat (math-format-number (nth 2 a)) " " | |
3203 (symbol-name calc-complex-format))))) | |
3204 (if prec | |
3205 (math-compose-expr (list (if (math-negp (nth 2 a)) '- '+) | |
3206 (nth 1 a) | |
3207 (list 'cplx 0 (math-abs (nth 2 a)))) | |
3208 prec) | |
3209 (concat (math-format-number (nth 1 a)) | |
3210 (if (math-negp (nth 2 a)) " - " " + ") | |
3211 (math-format-number | |
3212 (list 'cplx 0 (math-abs (nth 2 a)))))))))) | |
3213 ((eq (car a) 'polar) | |
3214 (concat "(" (math-format-number (nth 1 a)) | |
3215 "; " (math-format-number (nth 2 a)) ")")) | |
3216 ((eq (car a) 'hms) | |
3217 (if (math-negp a) | |
3218 (concat "-" (math-format-number (math-neg a))) | |
3219 (let ((calc-number-radix 10) | |
3220 (calc-leading-zeros nil) | |
3221 (calc-group-digits nil)) | |
3222 (format calc-hms-format | |
3223 (let ((calc-frac-format '(":" nil))) | |
3224 (math-format-number (nth 1 a))) | |
3225 (let ((calc-frac-format '(":" nil))) | |
3226 (math-format-number (nth 2 a))) | |
3227 (math-format-number (nth 3 a)))))) | |
3228 ((eq (car a) 'intv) | |
3229 (concat (if (memq (nth 1 a) '(0 1)) "(" "[") | |
3230 (math-format-number (nth 2 a)) | |
3231 " .. " | |
3232 (math-format-number (nth 3 a)) | |
3233 (if (memq (nth 1 a) '(0 2)) ")" "]"))) | |
3234 ((eq (car a) 'sdev) | |
3235 (concat (math-format-number (nth 1 a)) | |
3236 " +/- " | |
3237 (math-format-number (nth 2 a)))) | |
3238 ((eq (car a) 'vec) | |
3239 (math-format-flat-expr a 0)) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
3240 (t (format "%s" a)))) |
40785 | 3241 |
3242 (defun math-adjust-fraction (a) | |
3243 (if (nth 1 calc-frac-format) | |
3244 (progn | |
3245 (if (Math-integerp a) (setq a (list 'frac a 1))) | |
3246 (let ((g (math-quotient (nth 1 calc-frac-format) | |
3247 (math-gcd (nth 2 a) | |
3248 (nth 1 calc-frac-format))))) | |
3249 (list 'frac (math-mul (nth 1 a) g) (math-mul (nth 2 a) g)))) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
3250 a)) |
40785 | 3251 |
3252 (defun math-format-bignum-fancy (a) ; [X L] | |
3253 (let ((str (cond ((= calc-number-radix 10) | |
3254 (math-format-bignum-decimal a)) | |
3255 ((= calc-number-radix 2) | |
3256 (math-format-bignum-binary a)) | |
3257 ((= calc-number-radix 8) | |
3258 (math-format-bignum-octal a)) | |
3259 ((= calc-number-radix 16) | |
3260 (math-format-bignum-hex a)) | |
3261 (t (math-format-bignum-radix a))))) | |
3262 (if calc-leading-zeros | |
3263 (let* ((calc-internal-prec 6) | |
3264 (digs (math-compute-max-digits (math-abs calc-word-size) | |
3265 calc-number-radix)) | |
3266 (len (length str))) | |
3267 (if (< len digs) | |
3268 (setq str (concat (make-string (- digs len) ?0) str))))) | |
3269 (if calc-group-digits | |
3270 (let ((i (length str)) | |
3271 (g (if (integerp calc-group-digits) | |
3272 (math-abs calc-group-digits) | |
3273 (if (memq calc-number-radix '(2 16)) 4 3)))) | |
3274 (while (> i g) | |
3275 (setq i (- i g) | |
3276 str (concat (substring str 0 i) | |
3277 calc-group-char | |
3278 (substring str i)))) | |
3279 str)) | |
3280 (if (and (/= calc-number-radix 10) | |
3281 math-radix-explicit-format) | |
3282 (if calc-radix-formatter | |
3283 (funcall calc-radix-formatter calc-number-radix str) | |
3284 (format "%d#%s" calc-number-radix str)) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
3285 str))) |
40785 | 3286 |
3287 | |
3288 (defun math-group-float (str) ; [X X] | |
3289 (let* ((pt (or (string-match "[^0-9a-zA-Z]" str) (length str))) | |
3290 (g (if (integerp calc-group-digits) (math-abs calc-group-digits) 3)) | |
3291 (i pt)) | |
3292 (if (and (integerp calc-group-digits) (< calc-group-digits 0)) | |
3293 (while (< (setq i (+ (1+ i) g)) (length str)) | |
3294 (setq str (concat (substring str 0 i) | |
3295 calc-group-char | |
3296 (substring str i)) | |
3297 i (+ i (1- (length calc-group-char)))))) | |
3298 (setq i pt) | |
3299 (while (> i g) | |
3300 (setq i (- i g) | |
3301 str (concat (substring str 0 i) | |
3302 calc-group-char | |
3303 (substring str i)))) | |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
3304 str)) |
40785 | 3305 |
3306 ;;; Users can redefine this in their .emacs files. | |
3307 (defvar calc-keypad-user-menu nil | |
42206 | 3308 "If non-nil, this describes an additional menu for calc-keypad. |
40785 | 3309 It should contain a list of three rows. |
3310 Each row should be a list of six keys. | |
3311 Each key should be a list of a label string, plus a Calc command name spec. | |
3312 A command spec is a command name symbol, a keyboard macro string, a | |
3313 list containing a numeric entry string, or nil. | |
3314 A key may contain additional specs for Inverse, Hyperbolic, and Inv+Hyp.") | |
3315 | |
3316 (run-hooks 'calc-ext-load-hook) | |
3317 | |
58610
903d22ed0208
Move require to end of file.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58570
diff
changeset
|
3318 (provide 'calc-ext) |
58652
5f04991ece3d
Remove dummy autoloading functions from autoloads.
Jay Belanger <jay.p.belanger@gmail.com>
parents:
58610
diff
changeset
|
3319 |
52401 | 3320 ;;; arch-tag: 1814ba7f-a390-49dc-9e25-a5adc205e97e |
41043
21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
Colin Walters <walters@gnu.org>
parents:
40946
diff
changeset
|
3321 ;;; calc-ext.el ends here |