diff options
| author | Colin Walters | 2002-09-27 04:55:22 +0000 |
|---|---|---|
| committer | Colin Walters | 2002-09-27 04:55:22 +0000 |
| commit | 730576f3ece61a29a95b25df897ba0bdb73aa539 (patch) | |
| tree | 9d952ea5765dd2fbf7448673b7c9bd78313aba65 | |
| parent | e21880c69303379f462fa19e6eb386b16c61e5cc (diff) | |
| download | emacs-730576f3ece61a29a95b25df897ba0bdb73aa539.tar.gz emacs-730576f3ece61a29a95b25df897ba0bdb73aa539.zip | |
(calc-bug-address, calc-scan-for-dels, calc-stack)
(calc-stack-top, calc-always-load-extensions)
(calc-line-numbering, calc-line-breaking, calc-display-just)
(calc-display-origin, calc-number-radix, calc-leading-zeros)
(calc-group-digits, calc-group-char, calc-point-char)
(calc-frac-format, calc-prefer-frac, calc-hms-format)
(calc-date-format, calc-float-format, calc-complex-format)
(calc-full-float-format, calc-complex-mode, calc-infinite-mode)
(calc-display-strings, calc-matrix-just, calc-break-vectors)
(calc-full-vectors, calc-full-trail-vectors, calc-vector-commas)
(calc-vector-brackets, calc-matrix-brackets, calc-language)
(calc-language-option, calc-function-open, calc-function-open)
(calc-function-close, calc-language-output-filter)
(calc-language-input-filter, calc-radix-formatter)
(calc-left-label, calc-right-label, calc-word-size)
(calc-previous-modulo, calc-simplify-mode, calc-auto-recompute)
(calc-display-raw, calc-internal-prec, calc-inverse-flag)
(calc-hyperbolic-flag, calc-keep-args-flag, calc-angle-mode)
(calc-algebraic-mode, calc-incomplete-algebraic-mode)
(calc-symbolic-mode, calc-matrix-mode, calc-shift-prefix)
(calc-window-height, calc-display-trail, calc-show-selections)
(calc-use-selections, calc-assoc-selections)
(calc-display-working-message, calc-auto-why, calc-timing)
(calc-display-sci-high, calc-display-sci-low, calc-other-modes)
(calc-other-modes, calc-Y-help-msgs, calc-loaded-settings-file):
Make into real defvars.
(calc-mode-var-list): Delete.
(calc-mode-save-mode, calc-standard-date-formats)
(calc-autorange-units, calc-was-keypad-mode, calc-full-mode)
(calc-user-parse-tables, calc-gnuplot-default-device)
(calc-gnuplot-default-output, calc-gnuplot-print-device)
(calc-gnuplot-print-output, calc-gnuplot-geometry)
(calc-graph-default-resolution, calc-graph-default-resolution-3d)
(calc-invocation-macro, calc-show-banner): Make into defvars,
taken from `calc-mode-var-list'.
(calc-emacs-type-epoch, calc-emacs-type-19)
(calc-emacs-type-lucid, calc-emacs-type-gnu19): Make into defvars.
(calc-version, calc-version-date, calc-trail-pointer)
(calc-trail-overlay, calc-undo-list, calc-redo-list)
(calc-main-buffer, calc-trail-buffer, calc-why, calc-next-why)
(calc-inverse-flag, calc-hyperbolic-flag, calc-keep-args-flag)
(calc-last-kill, calc-previous-alg-entry, calc-dollar-values)
(calc-dollar-used, calc-hashes-used, calc-quick-prev-results)
(calc-said-hello, calc-executing-macro, calc-any-selections)
(calc-help-phase, calc-full-help-flag, calc-refresh-count)
(calc-display-dirty, calc-prepared-composition)
(calc-selection-cache-default-entry, calc-embedded-info)
(calc-embedded-active, calc-standalone-flag, var-EvalRules)
(math-eval-rules-cache-tag, math-radix-explicit-format)
(math-expr-function-mapping, math-expr-variable-mapping)
(math-read-expr-quotes, math-working-step, math-working-step-2)
(var-i, var-pi, var-e, var-phi, var-gamma, var-Modes): Make into
defvars, from toplevel setq.
(calc-mode-map): Set up keymap in more modern fashion.
(calc-dispatch-map): Ditto.
(calc-command-flags, calc-final-point-line)
(calc-final-point-column): Defvar.
(calc-do): Use `save-current-buffer' instead of `save-excursion'.
(sel-mode): Defvar.
(calc-any-evaltos): Ditto.
(calc-buffer, calc-prev-char, calc-prev-prev-char)
(calc-digit-value): Ditto.
(math-eval-rules-cache, math-eval-rules-cache-other): Ditto.
(math-sub-bignum): Bind `diff'.
(calc-selection-cache-entry): Defvar.
(calc-count-lines): Reference `pos' instead of `newpos'.
| -rw-r--r-- | lisp/ChangeLog | 72 | ||||
| -rw-r--r-- | lisp/calc/calc.el | 930 |
2 files changed, 502 insertions, 500 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a32e9f4be3b..83e8dcee482 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,75 @@ | |||
| 1 | 2002-09-27 Colin Walters <walters@verbum.org> | ||
| 2 | |||
| 3 | The following changes were written by | ||
| 4 | Stefan Monnier <monnier@cs.yale.edu>. | ||
| 5 | |||
| 6 | * calc/calc.el (calc-bug-address, calc-scan-for-dels, calc-stack) | ||
| 7 | (calc-stack-top, calc-always-load-extensions) | ||
| 8 | (calc-line-numbering, calc-line-breaking, calc-display-just) | ||
| 9 | (calc-display-origin, calc-number-radix, calc-leading-zeros) | ||
| 10 | (calc-group-digits, calc-group-char, calc-point-char) | ||
| 11 | (calc-frac-format, calc-prefer-frac, calc-hms-format) | ||
| 12 | (calc-date-format, calc-float-format, calc-complex-format) | ||
| 13 | (calc-full-float-format, calc-complex-mode, calc-infinite-mode) | ||
| 14 | (calc-display-strings, calc-matrix-just, calc-break-vectors) | ||
| 15 | (calc-full-vectors, calc-full-trail-vectors, calc-vector-commas) | ||
| 16 | (calc-vector-brackets, calc-matrix-brackets, calc-language) | ||
| 17 | (calc-language-option, calc-function-open, calc-function-open) | ||
| 18 | (calc-function-close, calc-language-output-filter) | ||
| 19 | (calc-language-input-filter, calc-radix-formatter) | ||
| 20 | (calc-left-label, calc-right-label, calc-word-size) | ||
| 21 | (calc-previous-modulo, calc-simplify-mode, calc-auto-recompute) | ||
| 22 | (calc-display-raw, calc-internal-prec, calc-inverse-flag) | ||
| 23 | (calc-hyperbolic-flag, calc-keep-args-flag, calc-angle-mode) | ||
| 24 | (calc-algebraic-mode, calc-incomplete-algebraic-mode) | ||
| 25 | (calc-symbolic-mode, calc-matrix-mode, calc-shift-prefix) | ||
| 26 | (calc-window-height, calc-display-trail, calc-show-selections) | ||
| 27 | (calc-use-selections, calc-assoc-selections) | ||
| 28 | (calc-display-working-message, calc-auto-why, calc-timing) | ||
| 29 | (calc-display-sci-high, calc-display-sci-low, calc-other-modes) | ||
| 30 | (calc-other-modes, calc-Y-help-msgs, calc-loaded-settings-file): | ||
| 31 | Make into real defvars. | ||
| 32 | (calc-mode-var-list): Delete. | ||
| 33 | (calc-mode-save-mode, calc-standard-date-formats) | ||
| 34 | (calc-autorange-units, calc-was-keypad-mode, calc-full-mode) | ||
| 35 | (calc-user-parse-tables, calc-gnuplot-default-device) | ||
| 36 | (calc-gnuplot-default-output, calc-gnuplot-print-device) | ||
| 37 | (calc-gnuplot-print-output, calc-gnuplot-geometry) | ||
| 38 | (calc-graph-default-resolution, calc-graph-default-resolution-3d) | ||
| 39 | (calc-invocation-macro, calc-show-banner): Make into defvars, | ||
| 40 | taken from `calc-mode-var-list'. | ||
| 41 | (calc-emacs-type-epoch, calc-emacs-type-19) | ||
| 42 | (calc-emacs-type-lucid, calc-emacs-type-gnu19): Make into defvars. | ||
| 43 | (calc-version, calc-version-date, calc-trail-pointer) | ||
| 44 | (calc-trail-overlay, calc-undo-list, calc-redo-list) | ||
| 45 | (calc-main-buffer, calc-trail-buffer, calc-why, calc-next-why) | ||
| 46 | (calc-inverse-flag, calc-hyperbolic-flag, calc-keep-args-flag) | ||
| 47 | (calc-last-kill, calc-previous-alg-entry, calc-dollar-values) | ||
| 48 | (calc-dollar-used, calc-hashes-used, calc-quick-prev-results) | ||
| 49 | (calc-said-hello, calc-executing-macro, calc-any-selections) | ||
| 50 | (calc-help-phase, calc-full-help-flag, calc-refresh-count) | ||
| 51 | (calc-display-dirty, calc-prepared-composition) | ||
| 52 | (calc-selection-cache-default-entry, calc-embedded-info) | ||
| 53 | (calc-embedded-active, calc-standalone-flag, var-EvalRules) | ||
| 54 | (math-eval-rules-cache-tag, math-radix-explicit-format) | ||
| 55 | (math-expr-function-mapping, math-expr-variable-mapping) | ||
| 56 | (math-read-expr-quotes, math-working-step, math-working-step-2) | ||
| 57 | (var-i, var-pi, var-e, var-phi, var-gamma, var-Modes): Make into | ||
| 58 | defvars, from toplevel setq. | ||
| 59 | (calc-mode-map): Set up keymap in more modern fashion. | ||
| 60 | (calc-dispatch-map): Ditto. | ||
| 61 | (calc-command-flags, calc-final-point-line) | ||
| 62 | (calc-final-point-column): Defvar. | ||
| 63 | (calc-do): Use `save-current-buffer' instead of `save-excursion'. | ||
| 64 | (sel-mode): Defvar. | ||
| 65 | (calc-any-evaltos): Ditto. | ||
| 66 | (calc-buffer, calc-prev-char, calc-prev-prev-char) | ||
| 67 | (calc-digit-value): Ditto. | ||
| 68 | (math-eval-rules-cache, math-eval-rules-cache-other): Ditto. | ||
| 69 | (math-sub-bignum): Bind `diff'. | ||
| 70 | (calc-selection-cache-entry): Defvar. | ||
| 71 | (calc-count-lines): Reference `pos' instead of `newpos'. | ||
| 72 | |||
| 1 | 2002-09-27 Simon Josefsson <jas@extundo.com> | 73 | 2002-09-27 Simon Josefsson <jas@extundo.com> |
| 2 | 74 | ||
| 3 | * mail/mail-hist.el (mail-hist-next-input): Fix docstring. | 75 | * mail/mail-hist.el (mail-hist-next-input): Fix docstring. |
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index f119266ddf7..9f8c212bb48 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el | |||
| @@ -236,356 +236,305 @@ This can safely be nil as long as the Calc files are on the load-path.") | |||
| 236 | (defvar calc-gnuplot-print-command "lp %s" | 236 | (defvar calc-gnuplot-print-command "lp %s" |
| 237 | "*Name of command for printing GNUPLOT output; %s = file name to print.") | 237 | "*Name of command for printing GNUPLOT output; %s = file name to print.") |
| 238 | 238 | ||
| 239 | ;; Address of the author of Calc, for use by report-calc-bug. | 239 | (defvar calc-bug-address "walters@debian.org" |
| 240 | (defvar calc-bug-address "walters@debian.org") | 240 | "Address of the author of Calc, for use by `report-calc-bug'.") |
| 241 | 241 | ||
| 242 | ;; If t, scan keymaps to find all DEL-like keys. | 242 | (defvar calc-scan-for-dels t |
| 243 | ;; if nil, only DEL itself is mapped to calc-pop. | 243 | "If t, scan keymaps to find all DEL-like keys. |
| 244 | (defvar calc-scan-for-dels t) | 244 | if nil, only DEL itself is mapped to calc-pop.") |
| 245 | 245 | ||
| 246 | (defvar calc-extensions-loaded nil) | 246 | (defvar calc-extensions-loaded nil) |
| 247 | 247 | ||
| 248 | ;; Calculator stack. | 248 | (defvar calc-stack '((top-of-stack 1 nil)) |
| 249 | ;; Entries are 3-lists: Formula, Height (in lines), Selection (or nil). | 249 | "Calculator stack. |
| 250 | (defvar calc-stack '((top-of-stack 1 nil))) | 250 | Entries are 3-lists: Formula, Height (in lines), Selection (or nil).") |
| 251 | 251 | ||
| 252 | (defvar calc-show-banner t | 252 | (defvar calc-show-banner t |
| 253 | "*If non-nil, show a friendly greeting above the stack.") | 253 | "*If non-nil, show a friendly greeting above the stack.") |
| 254 | 254 | ||
| 255 | ;; Index into calc-stack of "top" of stack. | 255 | (defvar calc-stack-top 1 |
| 256 | ;; This is 1 unless calc-truncate-stack has been used. | 256 | "Index into `calc-stack' of \"top\" of stack. |
| 257 | ;;(defvar calc-stack-top 1) | 257 | This is 1 unless `calc-truncate-stack' has been used.") |
| 258 | 258 | ||
| 259 | ;; If non-nil, load the calc-ext module automatically when calc is loaded. | 259 | (defvar calc-always-load-extensions nil |
| 260 | ;;(defvar calc-always-load-extensions nil) | 260 | "If non-nil, load the calc-ext module automatically when calc is loaded.") |
| 261 | 261 | ||
| 262 | ;; If non-nil, display line numbers in Calculator stack. | 262 | (defvar calc-line-numbering t |
| 263 | ;;(defvar calc-line-numbering t) | 263 | "If non-nil, display line numbers in Calculator stack.") |
| 264 | 264 | ||
| 265 | ;; If non-nil, break long values across multiple lines in Calculator stack. | 265 | (defvar calc-line-breaking t |
| 266 | ;;(defvar calc-line-breaking t) | 266 | "If non-nil, break long values across multiple lines in Calculator stack.") |
| 267 | 267 | ||
| 268 | ;; If nil, stack display is left-justified. | 268 | (defvar calc-display-just nil |
| 269 | ;; If 'right, stack display is right-justified. | 269 | "If nil, stack display is left-justified. |
| 270 | ;; If 'center, stack display is centered." | 270 | If `right', stack display is right-justified. |
| 271 | ;;(defvar calc-display-just nil) | 271 | If `center', stack display is centered.") |
| 272 | 272 | ||
| 273 | ;; Horizontal origin of displayed stack entries. | 273 | (defvar calc-display-origin nil |
| 274 | ;; In left-justified mode, this is effectively indentation. (Default 0). | 274 | "Horizontal origin of displayed stack entries. |
| 275 | ;; In right-justified mode, this is effectively window width. | 275 | In left-justified mode, this is effectively indentation. (Default 0). |
| 276 | ;; In centered mode, center of stack entry is placed here. | 276 | In right-justified mode, this is effectively window width. |
| 277 | ;;(defvar calc-display-origin nil) | 277 | In centered mode, center of stack entry is placed here.") |
| 278 | 278 | ||
| 279 | ;; Radix for entry and display of numbers in calc-mode, 2-36. | 279 | (defvar calc-number-radix 10 |
| 280 | ;;(defvar calc-number-radix 10) | 280 | "Radix for entry and display of numbers in calc-mode, 2-36.") |
| 281 | 281 | ||
| 282 | ;; If non-nil, leading zeros are provided to pad integers to calc-word-size. | 282 | (defvar calc-leading-zeros nil |
| 283 | ;;(defvar calc-leading-zeros nil) | 283 | "If non-nil, leading zeros are provided to pad integers to calc-word-size.") |
| 284 | 284 | ||
| 285 | ;; If non-nil, group digits in large displayed integers by inserting spaces. | 285 | (defvar calc-group-digits nil |
| 286 | ;; If an integer, group that many digits at a time. | 286 | "If non-nil, group digits in large displayed integers by inserting spaces. |
| 287 | ;; If 't', use 4 for binary and hex, 3 otherwise. | 287 | If an integer, group that many digits at a time. |
| 288 | ;;(defvar calc-group-digits nil) | 288 | If t, use 4 for binary and hex, 3 otherwise.") |
| 289 | 289 | ||
| 290 | ;; The character (in the form of a string) to be used for grouping digits. | 290 | (defvar calc-group-char "," |
| 291 | ;; This is used only when calc-group-digits mode is on. | 291 | "The character (in the form of a string) to be used for grouping digits. |
| 292 | ;;(defvar calc-group-char ",") | 292 | This is used only when calc-group-digits mode is on.") |
| 293 | 293 | ||
| 294 | ;; The character (in the form of a string) to be used as a decimal point. | 294 | (defvar calc-point-char "." |
| 295 | ;;(defvar calc-point-char ".") | 295 | "The character (in the form of a string) to be used as a decimal point.") |
| 296 | 296 | ||
| 297 | ;; Format of displayed fractions; a string of one or two of ":" or "/". | 297 | (defvar calc-frac-format '(":" nil) |
| 298 | ;;(defvar calc-frac-format '(":" nil)) | 298 | "Format of displayed fractions; a string of one or two of \":\" or \"/\".") |
| 299 | 299 | ||
| 300 | ;; If non-nil, prefer fractional over floating-point results. | 300 | (defvar calc-prefer-frac nil |
| 301 | ;;(defvar calc-prefer-frac nil) | 301 | "If non-nil, prefer fractional over floating-point results.") |
| 302 | 302 | ||
| 303 | ;; Format of displayed hours-minutes-seconds angles, a format string. | 303 | (defvar calc-hms-format "%s@ %s' %s\"" |
| 304 | ;; String must contain three %s marks for hours, minutes, seconds respectively. | 304 | "Format of displayed hours-minutes-seconds angles, a format string. |
| 305 | ;;(defvar calc-hms-format "%s@ %s' %s\"") | 305 | String must contain three %s marks for hours, minutes, seconds respectively.") |
| 306 | 306 | ||
| 307 | ;; Format of displayed date forms. | 307 | (defvar calc-date-format '((H ":" mm C SS pp " ") |
| 308 | ;;(defvar calc-date-format '((H ":" mm ":" SS pp " ") Www " " Mmm " " D ", " YYYY)) | 308 | Www " " Mmm " " D ", " YYYY) |
| 309 | 309 | "Format of displayed date forms.") | |
| 310 | ;; Format to use for display of floating-point numbers in calc-mode. | 310 | |
| 311 | ;; Must be a list of one of the following forms: | 311 | (defvar calc-float-format '(float 0) |
| 312 | ;; (float 0) Floating point format, display full precision. | 312 | "Format to use for display of floating-point numbers in calc-mode. |
| 313 | ;; (float N) N > 0: Floating point format, at most N significant figures. | 313 | Must be a list of one of the following forms: |
| 314 | ;; (float -N) -N < 0: Floating point format, calc-internal-prec - N figs. | 314 | (float 0) Floating point format, display full precision. |
| 315 | ;; (fix N) N >= 0: Fixed point format, N places after decimal point. | 315 | (float N) N > 0: Floating point format, at most N significant figures. |
| 316 | ;; (sci 0) Scientific notation, full precision. | 316 | (float -N) -N < 0: Floating point format, calc-internal-prec - N figs. |
| 317 | ;; (sci N) N > 0: Scientific notation, N significant figures. | 317 | (fix N) N >= 0: Fixed point format, N places after decimal point. |
| 318 | ;; (sci -N) -N < 0: Scientific notation, calc-internal-prec - N figs. | 318 | (sci 0) Scientific notation, full precision. |
| 319 | ;; (eng 0) Engineering notation, full precision. | 319 | (sci N) N > 0: Scientific notation, N significant figures. |
| 320 | ;; (eng N) N > 0: Engineering notation, N significant figures. | 320 | (sci -N) -N < 0: Scientific notation, calc-internal-prec - N figs. |
| 321 | ;; (eng -N) -N < 0: Engineering notation, calc-internal-prec - N figs. | 321 | (eng 0) Engineering notation, full precision. |
| 322 | ;;(defvar calc-float-format '(float 0)) | 322 | (eng N) N > 0: Engineering notation, N significant figures. |
| 323 | 323 | (eng -N) -N < 0: Engineering notation, calc-internal-prec - N figs.") | |
| 324 | ;; Format to use when full precision must be displayed. | 324 | |
| 325 | ;;(defvar calc-full-float-format '(float 0)) | 325 | (defvar calc-full-float-format '(float 0) |
| 326 | 326 | "Format to use when full precision must be displayed.") | |
| 327 | ;; Format to use for display of complex numbers in calc-mode. Must be one of: | 327 | |
| 328 | ;; nil Use (x, y) form. | 328 | (defvar calc-complex-format nil |
| 329 | ;; i Use x + yi form. | 329 | "Format to use for display of complex numbers in calc-mode. Must be one of: |
| 330 | ;; j Use x + yj form. | 330 | nil Use (x, y) form. |
| 331 | ;;(defvar calc-complex-format nil) | 331 | i Use x + yi form. |
| 332 | j Use x + yj form.") | ||
| 333 | |||
| 334 | (defvar calc-complex-mode 'cplx | ||
| 335 | "Preferred form, either `cplx' or `polar', for complex numbers.") | ||
| 332 | 336 | ||
| 333 | ;; Preferred form, either 'cplx or 'polar, for complex numbers. | 337 | (defvar calc-infinite-mode nil |
| 334 | ;;(defvar calc-complex-mode 'cplx) | 338 | "If nil, 1 / 0 is left unsimplified. |
| 339 | If 0, 1 / 0 is changed to inf (zeros are considered positive). | ||
| 340 | Otherwise, 1 / 0 is changed to uinf (undirected infinity).") | ||
| 341 | |||
| 342 | (defvar calc-display-strings nil | ||
| 343 | "If non-nil, display vectors of byte-sized integers as strings.") | ||
| 335 | 344 | ||
| 336 | ;; If nil, 1 / 0 is left unsimplified. | 345 | (defvar calc-matrix-just 'center |
| 337 | ;; If 0, 1 / 0 is changed to inf (zeros are considered positive). | 346 | "If nil, vector elements are left-justified. |
| 338 | ;; Otherwise, 1 / 0 is changed to uinf (undirected infinity). | 347 | If `right', vector elements are right-justified. |
| 339 | ;;(defvar calc-infinite-mode nil) | 348 | If `center', vector elements are centered.") |
| 349 | |||
| 350 | (defvar calc-break-vectors nil | ||
| 351 | "If non-nil, display vectors one element per line.") | ||
| 340 | 352 | ||
| 341 | ;; If non-nil, display vectors of byte-sized integers as strings. | 353 | (defvar calc-full-vectors t |
| 342 | ;;(defvar calc-display-strings nil) | 354 | "If non-nil, display long vectors in full. If nil, use abbreviated form.") |
| 355 | |||
| 356 | (defvar calc-full-trail-vectors t | ||
| 357 | "If non-nil, display long vectors in full in the trail.") | ||
| 343 | 358 | ||
| 344 | ;; If nil, vector elements are left-justified. | 359 | (defvar calc-vector-commas "," |
| 345 | ;; If 'right, vector elements are right-justified. | 360 | "If non-nil, separate elements of displayed vectors with this string.") |
| 346 | ;; If 'center, vector elements are centered." | 361 | |
| 347 | ;;(defvar calc-matrix-just 'center) | 362 | (defvar calc-vector-brackets "[]" |
| 363 | "If non-nil, surround displayed vectors with these characters.") | ||
| 364 | |||
| 365 | (defvar calc-matrix-brackets '(R O) | ||
| 366 | "A list of code-letter symbols that control \"big\" matrix display. | ||
| 367 | If `R' is present, display inner brackets for matrices. | ||
| 368 | If `O' is present, display outer brackets for matrices (above/below). | ||
| 369 | If `C' is present, display outer brackets for matrices (centered).") | ||
| 370 | |||
| 371 | (defvar calc-language nil | ||
| 372 | "Language or format for entry and display of stack values. Must be one of: | ||
| 373 | nil Use standard Calc notation. | ||
| 374 | flat Use standard Calc notation, one-line format. | ||
| 375 | big Display formulas in 2-d notation (enter w/std notation). | ||
| 376 | unform Use unformatted display: add(a, mul(b,c)). | ||
| 377 | c Use C language notation. | ||
| 378 | pascal Use Pascal language notation. | ||
| 379 | fortran Use Fortran language notation. | ||
| 380 | tex Use TeX notation. | ||
| 381 | eqn Use eqn notation. | ||
| 382 | math Use Mathematica(tm) notation. | ||
| 383 | maple Use Maple notation.") | ||
| 348 | 384 | ||
| 349 | ;; If non-nil, display vectors one element per line. | 385 | (defvar calc-language-option nil |
| 350 | ;;(defvar calc-break-vectors nil) | 386 | "Numeric prefix argument for the command that set `calc-language'.") |
| 351 | 387 | ||
| 352 | ;; If non-nil, display long vectors in full. If nil, use abbreviated form. | 388 | (defvar calc-function-open "(" |
| 353 | ;;(defvar calc-full-vectors t) | 389 | "Open-parenthesis string for function call notation.") |
| 354 | 390 | ||
| 355 | ;; If non-nil, display long vectors in full in the trail. | 391 | (defvar calc-function-close ")" |
| 356 | ;;(defvar calc-full-trail-vectors t) | 392 | "Close-parenthesis string for function call notation.") |
| 357 | 393 | ||
| 358 | ;; If non-nil, separate elements of displayed vectors with this string. | 394 | (defvar calc-language-output-filter nil |
| 359 | ;;(defvar calc-vector-commas ",") | 395 | "Function through which to pass strings after formatting.") |
| 360 | |||
| 361 | ;; If non-nil, surround displayed vectors with these characters. | ||
| 362 | ;;(defvar calc-vector-brackets "[]") | ||
| 363 | |||
| 364 | ;; A list of code-letter symbols that control "big" matrix display. | ||
| 365 | ;; If 'R is present, display inner brackets for matrices. | ||
| 366 | ;; If 'O is present, display outer brackets for matrices (above/below). | ||
| 367 | ;; If 'C is present, display outer brackets for matrices (centered). | ||
| 368 | ;;(defvar calc-matrix-brackets '(R O)) | ||
| 369 | |||
| 370 | ;; Language or format for entry and display of stack values. Must be one of: | ||
| 371 | ;; nil Use standard Calc notation. | ||
| 372 | ;; flat Use standard Calc notation, one-line format. | ||
| 373 | ;; big Display formulas in 2-d notation (enter w/std notation). | ||
| 374 | ;; unform Use unformatted display: add(a, mul(b,c)). | ||
| 375 | ;; c Use C language notation. | ||
| 376 | ;; pascal Use Pascal language notation. | ||
| 377 | ;; fortran Use Fortran language notation. | ||
| 378 | ;; tex Use TeX notation. | ||
| 379 | ;; eqn Use eqn notation. | ||
| 380 | ;; math Use Mathematica(tm) notation. | ||
| 381 | ;; maple Use Maple notation. | ||
| 382 | ;;(defvar calc-language nil) | ||
| 383 | 396 | ||
| 384 | ;; Numeric prefix argument for the command that set calc-language. | 397 | (defvar calc-language-input-filter nil |
| 385 | ;;(defvar calc-language-option nil) | 398 | "Function through which to pass strings before parsing.") |
| 386 | 399 | ||
| 387 | ;; Open-parenthesis string for function call notation. | 400 | (defvar calc-radix-formatter nil |
| 388 | ;;(defvar calc-function-open "(") | 401 | "Formatting function used for non-decimal numbers.") |
| 389 | 402 | ||
| 390 | ;; Close-parenthesis string for function call notation. | 403 | (defvar calc-left-label "" |
| 391 | ;;(defvar calc-function-close ")") | 404 | "Label to display at left of formula.") |
| 392 | 405 | ||
| 393 | ;; Function through which to pass strings after formatting. | 406 | (defvar calc-right-label "" |
| 394 | ;;(defvar calc-language-output-filter nil) | 407 | "Label to display at right of formula.") |
| 395 | 408 | ||
| 396 | ;; Function through which to pass strings before parsing. | 409 | (defvar calc-word-size 32 |
| 397 | ;;(defvar calc-language-input-filter nil) | 410 | "Minimum number of bits per word, if any, for binary operations in calc-mode.") |
| 398 | 411 | ||
| 399 | ;; Formatting function used for non-decimal numbers. | 412 | (defvar calc-previous-modulo nil |
| 400 | ;;(defvar calc-radix-formatter nil) | 413 | "Most recently used value of M in a modulo form.") |
| 401 | 414 | ||
| 402 | ;; Label to display at left of formula. | 415 | (defvar calc-simplify-mode nil |
| 403 | ;;(defvar calc-left-label "") | 416 | "Type of simplification applied to results. |
| 417 | If `none', results are not simplified when pushed on the stack. | ||
| 418 | If `num', functions are simplified only when args are constant. | ||
| 419 | If nil, only fast simplifications are applied. | ||
| 420 | If `binary', `math-clip' is applied if appropriate. | ||
| 421 | If `alg', `math-simplify' is applied. | ||
| 422 | If `ext', `math-simplify-extended' is applied. | ||
| 423 | If `units', `math-simplify-units' is applied.") | ||
| 404 | 424 | ||
| 405 | ;; Label to display at right of formula. | 425 | (defvar calc-auto-recompute t |
| 406 | ;;(defvar calc-right-label "") | 426 | "If non-nil, recompute evalto's automatically when necessary.") |
| 407 | 427 | ||
| 408 | ;; Minimum number of bits per word, if any, for binary operations in calc-mode. | 428 | (defvar calc-display-raw nil |
| 409 | ;;(defvar calc-word-size 32) | 429 | "If non-nil, display shows unformatted Lisp exprs. (For debugging)") |
| 410 | 430 | ||
| 411 | ;; Most recently used value of M in a modulo form. | 431 | (defvar calc-internal-prec 12 |
| 412 | ;;(defvar calc-previous-modulo nil) | 432 | "Number of digits of internal precision for calc-mode calculations.") |
| 413 | 433 | ||
| 414 | ;; Type of simplification applied to results. | 434 | (defvar calc-inverse-flag nil |
| 415 | ;; If 'none, results are not simplified when pushed on the stack. | 435 | "If non-nil, next operation is Inverse.") |
| 416 | ;; If 'num, functions are simplified only when args are constant. | ||
| 417 | ;; If nil, only fast simplifications are applied. | ||
| 418 | ;; If 'binary, math-clip is applied if appropriate. | ||
| 419 | ;; If 'alg, math-simplify is applied. | ||
| 420 | ;; If 'ext, math-simplify-extended is applied. | ||
| 421 | ;; If 'units, math-simplify-units is applied. | ||
| 422 | ;;(defvar calc-simplify-mode nil) | ||
| 423 | 436 | ||
| 424 | ;; If non-nil, recompute evalto's automatically when necessary. | 437 | (defvar calc-hyperbolic-flag nil |
| 425 | ;;(defvar calc-auto-recompute t) | 438 | "If non-nil, next operation is Hyperbolic.") |
| 426 | 439 | ||
| 427 | ;; If non-nil, display shows unformatted Lisp exprs. (For debugging) | 440 | (defvar calc-keep-args-flag nil |
| 428 | ;;(defvar calc-display-raw nil) | 441 | "If non-nil, next operation should not remove its arguments from stack.") |
| 429 | 442 | ||
| 430 | ;; Number of digits of internal precision for calc-mode calculations. | 443 | (defvar calc-angle-mode 'deg |
| 431 | ;;(defvar calc-internal-prec 12) | 444 | "If deg, angles are in degrees; if rad, angles are in radians. |
| 445 | If hms, angles are in degrees-minutes-seconds.") | ||
| 432 | 446 | ||
| 433 | ;; If non-nil, next operation is Inverse. | 447 | (defvar calc-algebraic-mode nil |
| 434 | ;;(defvar calc-inverse-flag nil) | 448 | "If non-nil, numeric entry accepts whole algebraic expressions. |
| 449 | If nil, algebraic expressions must be preceded by \"'\".") | ||
| 435 | 450 | ||
| 436 | ;; If non-nil, next operation is Hyperbolic. | 451 | (defvar calc-incomplete-algebraic-mode nil |
| 437 | ;;(defvar calc-hyperbolic-flag nil) | 452 | "Like calc-algebraic-mode except only affects ( and [ keys.") |
| 438 | 453 | ||
| 439 | ;; If non-nil, next operation should not remove its arguments from stack. | 454 | (defvar calc-symbolic-mode nil |
| 440 | ;;(defvar calc-keep-args-flag nil) | 455 | "If non-nil, inexact numeric computations like sqrt(2) are postponed. |
| 441 | 456 | If nil, computations on numbers always yield numbers where possible.") | |
| 442 | ;; If deg, angles are in degrees; if rad, angles are in radians. | 457 | |
| 443 | ;; If hms, angles are in degrees-minutes-seconds. | 458 | (defvar calc-matrix-mode nil |
| 444 | ;;(defvar calc-angle-mode 'deg) | 459 | "If `matrix', variables are assumed to be matrix-valued. |
| 445 | 460 | If a number, variables are assumed to be NxN matrices. | |
| 446 | ;; If non-nil, numeric entry accepts whole algebraic expressions. | 461 | If `scalar', variables are assumed to be scalar-valued. |
| 447 | ;; If nil, algebraic expressions must be preceded by "'". | 462 | If nil, symbolic math routines make no assumptions about variables.") |
| 448 | ;;(defvar calc-algebraic-mode nil) | 463 | |
| 449 | 464 | (defvar calc-shift-prefix nil | |
| 450 | ;; Like calc-algebraic-mode except only affects ( and [ keys. | 465 | "If non-nil, shifted letter keys are prefix keys rather than normal meanings.") |
| 451 | ;;(defvar calc-incomplete-algebraic-mode nil) | 466 | |
| 452 | 467 | (defvar calc-window-height 7 | |
| 453 | ;; If non-nil, inexact numeric computations like sqrt(2) are postponed. | 468 | "Initial height of Calculator window.") |
| 454 | ;; If nil, computations on numbers always yield numbers where possible. | 469 | |
| 455 | ;;(defvar calc-symbolic-mode nil) | 470 | (defvar calc-display-trail t |
| 456 | 471 | "If non-nil, M-x calc creates a window to display Calculator trail.") | |
| 457 | ;; If 'matrix, variables are assumed to be matrix-valued. | 472 | |
| 458 | ;; If a number, variables are assumed to be NxN matrices. | 473 | (defvar calc-show-selections t |
| 459 | ;; If 'scalar, variables are assumed to be scalar-valued. | 474 | "If non-nil, selected sub-formulas are shown by obscuring rest of formula. |
| 460 | ;; If nil, symbolic math routines make no assumptions about variables. | 475 | If nil, selected sub-formulas are highlighted by obscuring the sub-formulas.") |
| 461 | ;;(defvar calc-matrix-mode nil) | 476 | |
| 462 | 477 | (defvar calc-use-selections t | |
| 463 | ;; If non-nil, shifted letter keys are prefix keys rather than normal meanings. | 478 | "If non-nil, commands operate only on selected portions of formulas. |
| 464 | ;;(defvar calc-shift-prefix nil) | 479 | If nil, selections displayed but ignored.") |
| 465 | 480 | ||
| 466 | ;; Initial height of Calculator window. | 481 | (defvar calc-assoc-selections t |
| 467 | ;;(defvar calc-window-height 7) | 482 | "If non-nil, selection hides deep structure of associative formulas.") |
| 468 | 483 | ||
| 469 | ;; If non-nil, M-x calc creates a window to display Calculator trail. | 484 | (defvar calc-display-working-message 'lots |
| 470 | ;;(defvar calc-display-trail t) | 485 | "If non-nil, display \"Working...\" for potentially slow Calculator commands.") |
| 471 | 486 | ||
| 472 | ;; If non-nil, selected sub-formulas are shown by obscuring rest of formula. | 487 | (defvar calc-auto-why 'maybe |
| 473 | ;; If nil, selected sub-formulas are highlighted by obscuring the sub-formulas. | 488 | "If non-nil, automatically execute a \"why\" command to explain odd results.") |
| 474 | ;;(defvar calc-show-selections t) | 489 | |
| 475 | 490 | (defvar calc-timing nil | |
| 476 | ;; If non-nil, commands operate only on selected portions of formulas. | 491 | "If non-nil, display timing information on each slow command.") |
| 477 | ;; If nil, selections displayed but ignored. | 492 | |
| 478 | ;;(defvar calc-use-selections t) | 493 | (defvar calc-display-sci-high 0 |
| 479 | 494 | "Floating-point numbers with this positive exponent or higher above the | |
| 480 | ;; If non-nil, selection hides deep structure of associative formulas. | 495 | current precision are displayed in scientific notation in calc-mode.") |
| 481 | ;;(defvar calc-assoc-selections t) | 496 | |
| 482 | 497 | (defvar calc-display-sci-low -3 | |
| 483 | ;; If non-nil, display "Working..." for potentially slow Calculator commands. | 498 | "Floating-point numbers with this negative exponent or lower are displayed |
| 484 | ;;(defvar calc-display-working-message 'lots) | 499 | scientific notation in calc-mode.") |
| 485 | 500 | ||
| 486 | ;; If non-nil, automatically execute a "why" command to explain odd results. | 501 | |
| 487 | ;;(defvar calc-auto-why nil) | 502 | (defvar calc-other-modes nil |
| 488 | 503 | "List of used-defined strings to append to Calculator mode line.") | |
| 489 | ;; If non-nil, display timing information on each slow command. | 504 | |
| 490 | ;;(defvar calc-timing nil) | 505 | (defvar calc-Y-help-msgs nil |
| 491 | 506 | "List of strings for Y prefix help.") | |
| 492 | ;; Floating-point numbers with this positive exponent or higher above the | 507 | |
| 493 | ;; current precision are displayed in scientific notation in calc-mode. | 508 | (defvar calc-loaded-settings-file nil |
| 494 | (defvar calc-display-sci-high 0) | 509 | "t if `calc-settings-file' has been loaded yet.") |
| 495 | 510 | ||
| 496 | ;; Floating-point numbers with this negative exponent or lower are displayed | 511 | |
| 497 | ;; scientific notation in calc-mode. | 512 | |
| 498 | (defvar calc-display-sci-low -3) | 513 | (defvar calc-mode-save-mode 'local) |
| 499 | 514 | (defvar calc-standard-date-formats | |
| 500 | 515 | '("N" | |
| 501 | ;; List of used-defined strings to append to Calculator mode line. | 516 | "<H:mm:SSpp >Www Mmm D, YYYY" |
| 502 | (defvar calc-other-modes nil) | 517 | "D Mmm YYYY<, h:mm:SS>" |
| 503 | 518 | "Www Mmm BD< hh:mm:ss> YYYY" | |
| 504 | ;; List of strings for Y prefix help. | 519 | "M/D/Y< H:mm:SSpp>" |
| 505 | (defvar calc-Y-help-msgs nil) | 520 | "D.M.Y< h:mm:SS>" |
| 506 | 521 | "M-D-Y< H:mm:SSpp>" | |
| 507 | ;; t if calc-settings-file has been loaded yet. | 522 | "D-M-Y< h:mm:SS>" |
| 508 | (defvar calc-loaded-settings-file nil) | 523 | "j<, h:mm:SS>" |
| 509 | 524 | "YYddd< hh:mm:ss>")) | |
| 510 | 525 | (defvar calc-autorange-units nil) | |
| 511 | 526 | (defvar calc-was-keypad-mode nil) | |
| 512 | (defconst calc-mode-var-list '((calc-always-load-extensions nil) | 527 | (defvar calc-full-mode nil) |
| 513 | (calc-mode-save-mode local) | 528 | (defvar calc-user-parse-tables nil) |
| 514 | (calc-line-numbering t) | 529 | (defvar calc-gnuplot-default-device "default") |
| 515 | (calc-line-breaking t) | 530 | (defvar calc-gnuplot-default-output "STDOUT") |
| 516 | (calc-display-just nil) | 531 | (defvar calc-gnuplot-print-device "postscript") |
| 517 | (calc-display-origin nil) | 532 | (defvar calc-gnuplot-print-output "auto") |
| 518 | (calc-left-label "") | 533 | (defvar calc-gnuplot-geometry nil) |
| 519 | (calc-right-label "") | 534 | (defvar calc-graph-default-resolution 15) |
| 520 | (calc-number-radix 10) | 535 | (defvar calc-graph-default-resolution-3d 5) |
| 521 | (calc-leading-zeros nil) | 536 | (defvar calc-invocation-macro nil) |
| 522 | (calc-group-digits nil) | 537 | (defvar calc-show-banner t) |
| 523 | (calc-group-char ",") | ||
| 524 | (calc-point-char ".") | ||
| 525 | (calc-frac-format (":" nil)) | ||
| 526 | (calc-prefer-frac nil) | ||
| 527 | (calc-hms-format "%s@ %s' %s\"") | ||
| 528 | (calc-date-format ((H ":" mm C SS pp " ") | ||
| 529 | Www " " Mmm " " D ", " YYYY)) | ||
| 530 | (calc-standard-date-formats | ||
| 531 | ("N" | ||
| 532 | "<H:mm:SSpp >Www Mmm D, YYYY" | ||
| 533 | "D Mmm YYYY<, h:mm:SS>" | ||
| 534 | "Www Mmm BD< hh:mm:ss> YYYY" | ||
| 535 | "M/D/Y< H:mm:SSpp>" | ||
| 536 | "D.M.Y< h:mm:SS>" | ||
| 537 | "M-D-Y< H:mm:SSpp>" | ||
| 538 | "D-M-Y< h:mm:SS>" | ||
| 539 | "j<, h:mm:SS>" | ||
| 540 | "YYddd< hh:mm:ss>")) | ||
| 541 | (calc-float-format (float 0)) | ||
| 542 | (calc-full-float-format (float 0)) | ||
| 543 | (calc-complex-format nil) | ||
| 544 | (calc-matrix-just center) | ||
| 545 | (calc-full-vectors t) | ||
| 546 | (calc-full-trail-vectors t) | ||
| 547 | (calc-break-vectors nil) | ||
| 548 | (calc-vector-commas ",") | ||
| 549 | (calc-vector-brackets "[]") | ||
| 550 | (calc-matrix-brackets (R O)) | ||
| 551 | (calc-complex-mode cplx) | ||
| 552 | (calc-infinite-mode nil) | ||
| 553 | (calc-display-strings nil) | ||
| 554 | (calc-simplify-mode nil) | ||
| 555 | (calc-auto-recompute t) | ||
| 556 | (calc-word-size 32) | ||
| 557 | (calc-previous-modulo nil) | ||
| 558 | (calc-display-raw nil) | ||
| 559 | (calc-internal-prec 12) | ||
| 560 | (calc-angle-mode deg) | ||
| 561 | (calc-algebraic-mode nil) | ||
| 562 | (calc-incomplete-algebraic-mode nil) | ||
| 563 | (calc-symbolic-mode nil) | ||
| 564 | (calc-matrix-mode nil) | ||
| 565 | (calc-autorange-units nil) | ||
| 566 | (calc-shift-prefix nil) | ||
| 567 | (calc-window-height 7) | ||
| 568 | (calc-was-keypad-mode nil) | ||
| 569 | (calc-full-mode nil) | ||
| 570 | (calc-language nil) | ||
| 571 | (calc-language-option nil) | ||
| 572 | (calc-user-parse-tables nil) | ||
| 573 | (calc-show-selections t) | ||
| 574 | (calc-use-selections t) | ||
| 575 | (calc-assoc-selections t) | ||
| 576 | (calc-display-trail t) | ||
| 577 | (calc-display-working-message lots) | ||
| 578 | (calc-auto-why 'maybe) | ||
| 579 | (calc-timing nil) | ||
| 580 | (calc-gnuplot-default-device "default") | ||
| 581 | (calc-gnuplot-default-output "STDOUT") | ||
| 582 | (calc-gnuplot-print-device "postscript") | ||
| 583 | (calc-gnuplot-print-output "auto") | ||
| 584 | (calc-gnuplot-geometry nil) | ||
| 585 | (calc-graph-default-resolution 15) | ||
| 586 | (calc-graph-default-resolution-3d 5) | ||
| 587 | (calc-invocation-macro nil) | ||
| 588 | (calc-show-banner t))) | ||
| 589 | 538 | ||
| 590 | (defconst calc-local-var-list '(calc-stack | 539 | (defconst calc-local-var-list '(calc-stack |
| 591 | calc-stack-top | 540 | calc-stack-top |
| @@ -643,24 +592,21 @@ This can safely be nil as long as the Calc files are on the load-path.") | |||
| 643 | calc-internal-prec)) | 592 | calc-internal-prec)) |
| 644 | 593 | ||
| 645 | 594 | ||
| 646 | (defun calc-init-base () | 595 | ;; Verify that Calc is running on the right kind of system. |
| 647 | 596 | (defconst calc-emacs-type-epoch (and (fboundp 'epoch::version) epoch::version)) | |
| 648 | ;; Verify that Calc is running on the right kind of system. | 597 | (defvar calc-emacs-type-19 (not (or calc-emacs-type-epoch |
| 649 | (setq calc-emacs-type-epoch (and (fboundp 'epoch::version) epoch::version) | 598 | (string-lessp emacs-version "19")))) |
| 650 | calc-emacs-type-19 (not (or calc-emacs-type-epoch | 599 | (defvar calc-emacs-type-lucid (not (not (string-match "Lucid" emacs-version)))) |
| 651 | (string-lessp emacs-version "19"))) | 600 | (defvar calc-emacs-type-gnu19 (and calc-emacs-type-19 |
| 652 | calc-emacs-type-lucid (not (not (string-match "Lucid" emacs-version))) | ||
| 653 | calc-emacs-type-gnu19 (and calc-emacs-type-19 | ||
| 654 | (not calc-emacs-type-lucid))) | 601 | (not calc-emacs-type-lucid))) |
| 655 | 602 | ||
| 656 | ;; Set up the standard keystroke (M-#) to run the Calculator, if that key | 603 | ;; Set up the standard keystroke (M-#) to run the Calculator, if that key |
| 657 | ;; has not yet been bound to anything. For best results, the user should | 604 | ;; has not yet been bound to anything. For best results, the user should |
| 658 | ;; do this before Calc is even loaded, so that M-# can auto-load Calc. | 605 | ;; do this before Calc is even loaded, so that M-# can auto-load Calc. |
| 659 | (or (global-key-binding "\e#") | 606 | (or (global-key-binding "\e#") (global-set-key "\e#" 'calc-dispatch)) |
| 660 | (global-set-key "\e#" 'calc-dispatch)) | ||
| 661 | 607 | ||
| 662 | ;; Set up the autoloading linkage. | 608 | ;; Set up the autoloading linkage. |
| 663 | (let ((name (and (fboundp 'calc-dispatch) | 609 | (let ((name (and (fboundp 'calc-dispatch) |
| 664 | (eq (car-safe (symbol-function 'calc-dispatch)) 'autoload) | 610 | (eq (car-safe (symbol-function 'calc-dispatch)) 'autoload) |
| 665 | (nth 1 (symbol-function 'calc-dispatch)))) | 611 | (nth 1 (symbol-function 'calc-dispatch)))) |
| 666 | (p load-path)) | 612 | (p load-path)) |
| @@ -695,152 +641,133 @@ This can safely be nil as long as the Calc files are on the load-path.") | |||
| 695 | (list (directory-file-name | 641 | (list (directory-file-name |
| 696 | calc-autoload-directory))))))) | 642 | calc-autoload-directory))))))) |
| 697 | 643 | ||
| 698 | ;; The following modes use specially-formatted data. | 644 | ;; The following modes use specially-formatted data. |
| 699 | (put 'calc-mode 'mode-class 'special) | 645 | (put 'calc-mode 'mode-class 'special) |
| 700 | (put 'calc-trail-mode 'mode-class 'special) | 646 | (put 'calc-trail-mode 'mode-class 'special) |
| 701 | 647 | ||
| 702 | ;; Define "inexact-result" as an e-lisp error symbol. | 648 | ;; Define "inexact-result" as an e-lisp error symbol. |
| 703 | (put 'inexact-result 'error-conditions '(error inexact-result calc-error)) | 649 | (put 'inexact-result 'error-conditions '(error inexact-result calc-error)) |
| 704 | (put 'inexact-result 'error-message "Calc internal error (inexact-result)") | 650 | (put 'inexact-result 'error-message "Calc internal error (inexact-result)") |
| 705 | 651 | ||
| 706 | ;; Define "math-overflow" and "math-underflow" as e-lisp error symbols. | 652 | ;; Define "math-overflow" and "math-underflow" as e-lisp error symbols. |
| 707 | (put 'math-overflow 'error-conditions '(error math-overflow calc-error)) | 653 | (put 'math-overflow 'error-conditions '(error math-overflow calc-error)) |
| 708 | (put 'math-overflow 'error-message "Floating-point overflow occurred") | 654 | (put 'math-overflow 'error-message "Floating-point overflow occurred") |
| 709 | (put 'math-underflow 'error-conditions '(error math-underflow calc-error)) | 655 | (put 'math-underflow 'error-conditions '(error math-underflow calc-error)) |
| 710 | (put 'math-underflow 'error-message "Floating-point underflow occurred") | 656 | (put 'math-underflow 'error-message "Floating-point underflow occurred") |
| 711 | 657 | ||
| 712 | (setq calc-version "2.02g" | 658 | (defconst calc-version "2.02g") |
| 713 | calc-version-date "Mon Nov 19 2001" | 659 | (defconst calc-version-date "Mon Nov 19 2001") |
| 714 | calc-trail-pointer nil ; "Current" entry in trail buffer. | 660 | (defvar calc-trail-pointer nil) ; "Current" entry in trail buffer. |
| 715 | calc-trail-overlay nil ; Value of overlay-arrow-string. | 661 | (defvar calc-trail-overlay nil) ; Value of overlay-arrow-string. |
| 716 | calc-undo-list nil ; List of previous operations for undo. | 662 | (defvar calc-undo-list nil) ; List of previous operations for undo. |
| 717 | calc-redo-list nil ; List of recent undo operations. | 663 | (defvar calc-redo-list nil) ; List of recent undo operations. |
| 718 | calc-main-buffer nil ; Pointer to Calculator buffer. | 664 | (defvar calc-main-buffer nil) ; Pointer to Calculator buffer. |
| 719 | calc-trail-buffer nil ; Pointer to Calc Trail buffer. | 665 | (defvar calc-trail-buffer nil) ; Pointer to Calc Trail buffer. |
| 720 | calc-why nil ; Explanations of most recent errors. | 666 | (defvar calc-why nil) ; Explanations of most recent errors. |
| 721 | calc-next-why nil | 667 | (defvar calc-next-why nil) |
| 722 | calc-inverse-flag nil | 668 | (defvar calc-inverse-flag nil) |
| 723 | calc-hyperbolic-flag nil | 669 | (defvar calc-hyperbolic-flag nil) |
| 724 | calc-keep-args-flag nil | 670 | (defvar calc-keep-args-flag nil) |
| 725 | calc-function-open "(" | 671 | (defvar calc-last-kill nil) ; Last number killed in calc-mode. |
| 726 | calc-function-close ")" | 672 | (defvar calc-previous-alg-entry nil) ; Previous algebraic entry. |
| 727 | calc-language-output-filter nil | 673 | (defvar calc-dollar-values nil) ; Values to be used for '$'. |
| 728 | calc-language-input-filter nil | 674 | (defvar calc-dollar-used nil) ; Highest order of '$' that occurred. |
| 729 | calc-radix-formatter nil | 675 | (defvar calc-hashes-used nil) ; Highest order of '#' that occurred. |
| 730 | calc-last-kill nil ; Last number killed in calc-mode. | 676 | (defvar calc-quick-prev-results nil) ; Previous results from Quick Calc. |
| 731 | calc-previous-alg-entry nil ; Previous algebraic entry. | 677 | (defvar calc-said-hello nil) ; Has welcome message been said yet? |
| 732 | calc-dollar-values nil ; Values to be used for '$'. | 678 | (defvar calc-executing-macro nil) ; Kbd macro executing from "K" key. |
| 733 | calc-dollar-used nil ; Highest order of '$' that occurred. | 679 | (defvar calc-any-selections nil) ; Nil means no selections present. |
| 734 | calc-hashes-used nil ; Highest order of '#' that occurred. | 680 | (defvar calc-help-phase 0) ; Count of consecutive "?" keystrokes. |
| 735 | calc-quick-prev-results nil ; Previous results from Quick Calc. | 681 | (defvar calc-full-help-flag nil) ; Executing calc-full-help? |
| 736 | calc-said-hello nil ; Has welcome message been said yet? | 682 | (defvar calc-refresh-count 0) ; Count of calc-refresh calls. |
| 737 | calc-executing-macro nil ; Kbd macro executing from "K" key. | 683 | (defvar calc-display-dirty nil) |
| 738 | calc-any-selections nil ; Nil means no selections present. | 684 | (defvar calc-prepared-composition nil) |
| 739 | calc-help-phase 0 ; Count of consecutive "?" keystrokes. | 685 | (defvar calc-selection-cache-default-entry nil) |
| 740 | calc-full-help-flag nil ; Executing calc-full-help? | 686 | (defvar calc-embedded-info nil) |
| 741 | calc-refresh-count 0 ; Count of calc-refresh calls. | 687 | (defvar calc-embedded-active nil) |
| 742 | calc-display-dirty nil | 688 | (defvar calc-standalone-flag nil) |
| 743 | calc-prepared-composition nil | 689 | (defvar var-EvalRules nil) |
| 744 | calc-selection-cache-default-entry nil | 690 | (defvar math-eval-rules-cache-tag t) |
| 745 | calc-embedded-info nil | 691 | (defvar math-radix-explicit-format t) |
| 746 | calc-embedded-active nil | 692 | (defvar math-expr-function-mapping nil) |
| 747 | calc-standalone-flag nil | 693 | (defvar math-expr-variable-mapping nil) |
| 748 | var-EvalRules nil | 694 | (defvar math-read-expr-quotes nil) |
| 749 | math-eval-rules-cache-tag t | 695 | (defvar math-working-step nil) |
| 750 | math-radix-explicit-format t | 696 | (defvar math-working-step-2 nil) |
| 751 | math-expr-function-mapping nil | 697 | (defvar var-i '(special-const (math-imaginary 1))) |
| 752 | math-expr-variable-mapping nil | 698 | (defvar var-pi '(special-const (math-pi))) |
| 753 | math-read-expr-quotes nil | 699 | (defvar var-e '(special-const (math-e))) |
| 754 | math-working-step nil | 700 | (defvar var-phi '(special-const (math-phi))) |
| 755 | math-working-step-2 nil | 701 | (defvar var-gamma '(special-const (math-gamma-const))) |
| 756 | var-i '(special-const (math-imaginary 1)) | 702 | (defvar var-Modes '(special-const (math-get-modes-vec))) |
| 757 | var-pi '(special-const (math-pi)) | 703 | |
| 758 | var-e '(special-const (math-e)) | 704 | (mapcar (lambda (v) (or (boundp v) (set v nil))) |
| 759 | var-phi '(special-const (math-phi)) | ||
| 760 | var-gamma '(special-const (math-gamma-const)) | ||
| 761 | var-Modes '(special-const (math-get-modes-vec))) | ||
| 762 | |||
| 763 | (mapcar (function (lambda (v) (or (boundp (car v)) (set (car v) (nth 1 v))))) | ||
| 764 | calc-mode-var-list) | ||
| 765 | (mapcar (function (lambda (v) (or (boundp v) (set v nil)))) | ||
| 766 | calc-local-var-list) | 705 | calc-local-var-list) |
| 767 | 706 | ||
| 768 | (unless (boundp 'calc-mode-map) | 707 | (defvar calc-mode-map |
| 769 | (setq calc-mode-map (make-keymap)) | 708 | (let ((map (make-keymap))) |
| 770 | (suppress-keymap calc-mode-map t) | 709 | (suppress-keymap map t) |
| 771 | (define-key calc-mode-map "+" 'calc-plus) | 710 | (define-key map "+" 'calc-plus) |
| 772 | (define-key calc-mode-map "-" 'calc-minus) | 711 | (define-key map "-" 'calc-minus) |
| 773 | (define-key calc-mode-map "*" 'calc-times) | 712 | (define-key map "*" 'calc-times) |
| 774 | (define-key calc-mode-map "/" 'calc-divide) | 713 | (define-key map "/" 'calc-divide) |
| 775 | (define-key calc-mode-map "%" 'calc-mod) | 714 | (define-key map "%" 'calc-mod) |
| 776 | (define-key calc-mode-map "&" 'calc-inv) | 715 | (define-key map "&" 'calc-inv) |
| 777 | (define-key calc-mode-map "^" 'calc-power) | 716 | (define-key map "^" 'calc-power) |
| 778 | (define-key calc-mode-map "\M-%" 'calc-percent) | 717 | (define-key map "\M-%" 'calc-percent) |
| 779 | (define-key calc-mode-map "e" 'calcDigit-start) | 718 | (define-key map "e" 'calcDigit-start) |
| 780 | (define-key calc-mode-map "i" 'calc-info) | 719 | (define-key map "i" 'calc-info) |
| 781 | (define-key calc-mode-map "n" 'calc-change-sign) | 720 | (define-key map "n" 'calc-change-sign) |
| 782 | (define-key calc-mode-map "q" 'calc-quit) | 721 | (define-key map "q" 'calc-quit) |
| 783 | (define-key calc-mode-map "Y" 'nil) | 722 | (define-key map "Y" 'nil) |
| 784 | (define-key calc-mode-map "Y?" 'calc-shift-Y-prefix-help) | 723 | (define-key map "Y?" 'calc-shift-Y-prefix-help) |
| 785 | (define-key calc-mode-map "?" 'calc-help) | 724 | (define-key map "?" 'calc-help) |
| 786 | (define-key calc-mode-map " " 'calc-enter) | 725 | (define-key map " " 'calc-enter) |
| 787 | (define-key calc-mode-map "'" 'calc-algebraic-entry) | 726 | (define-key map "'" 'calc-algebraic-entry) |
| 788 | (define-key calc-mode-map "$" 'calc-auto-algebraic-entry) | 727 | (define-key map "$" 'calc-auto-algebraic-entry) |
| 789 | (define-key calc-mode-map "\"" 'calc-auto-algebraic-entry) | 728 | (define-key map "\"" 'calc-auto-algebraic-entry) |
| 790 | (define-key calc-mode-map "\t" 'calc-roll-down) | 729 | (define-key map "\t" 'calc-roll-down) |
| 791 | (define-key calc-mode-map "\M-\t" 'calc-roll-up) | 730 | (define-key map "\M-\t" 'calc-roll-up) |
| 792 | (define-key calc-mode-map "\C-m" 'calc-enter) | 731 | (define-key map "\C-m" 'calc-enter) |
| 793 | (define-key calc-mode-map "\M-\C-m" 'calc-last-args-stub) | 732 | (define-key map "\M-\C-m" 'calc-last-args-stub) |
| 794 | (define-key calc-mode-map "\C-j" 'calc-over) | 733 | (define-key map "\C-j" 'calc-over) |
| 795 | 734 | ||
| 796 | (mapcar (function | 735 | (mapcar (lambda (x) (define-key map (char-to-string x) 'undefined)) |
| 797 | (lambda (x) | ||
| 798 | (define-key calc-mode-map (char-to-string x) 'undefined))) | ||
| 799 | "lOW") | 736 | "lOW") |
| 800 | (mapcar (function | 737 | (mapcar (lambda (x) (define-key map (char-to-string x) 'calc-missing-key)) |
| 801 | (lambda (x) | ||
| 802 | (define-key calc-mode-map (char-to-string x) | ||
| 803 | 'calc-missing-key))) | ||
| 804 | (concat "ABCDEFGHIJKLMNPQRSTUVXZabcdfghjkmoprstuvwxyz" | 738 | (concat "ABCDEFGHIJKLMNPQRSTUVXZabcdfghjkmoprstuvwxyz" |
| 805 | ":\\|!()[]<>{},;=~`\C-k\M-k\C-w\M-w\C-y\C-_")) | 739 | ":\\|!()[]<>{},;=~`\C-k\M-k\C-w\M-w\C-y\C-_")) |
| 806 | (mapcar (function | 740 | (mapcar (lambda (x) (define-key map (char-to-string x) 'calcDigit-start)) |
| 807 | (lambda (x) | ||
| 808 | (define-key calc-mode-map (char-to-string x) 'calcDigit-start))) | ||
| 809 | "_0123456789.#@") | 741 | "_0123456789.#@") |
| 742 | map)) | ||
| 810 | 743 | ||
| 811 | (setq calc-digit-map (make-keymap)) | 744 | (defvar calc-digit-map |
| 745 | (let ((map (make-keymap))) | ||
| 812 | (if calc-emacs-type-lucid | 746 | (if calc-emacs-type-lucid |
| 813 | (map-keymap (function | 747 | (map-keymap (function |
| 814 | (lambda (keys bind) | 748 | (lambda (keys bind) |
| 815 | (define-key calc-digit-map keys | 749 | (define-key map keys |
| 816 | (if (eq bind 'undefined) | 750 | (if (eq bind 'undefined) |
| 817 | 'undefined 'calcDigit-nondigit)))) | 751 | 'undefined 'calcDigit-nondigit)))) |
| 818 | calc-mode-map) | 752 | calc-mode-map) |
| 819 | (let ((cmap (if calc-emacs-type-19 (nth 1 calc-mode-map) calc-mode-map)) | 753 | (let ((cmap (if calc-emacs-type-19 (nth 1 calc-mode-map) calc-mode-map)) |
| 820 | (dmap (if calc-emacs-type-19 (nth 1 calc-digit-map) | 754 | (dmap (if calc-emacs-type-19 (nth 1 map) map)) |
| 821 | calc-digit-map)) | ||
| 822 | (i 0)) | 755 | (i 0)) |
| 823 | (while (< i 128) | 756 | (while (< i 128) |
| 824 | (aset dmap i | 757 | (aset dmap i |
| 825 | (if (eq (aref cmap i) 'undefined) | 758 | (if (eq (aref cmap i) 'undefined) |
| 826 | 'undefined 'calcDigit-nondigit)) | 759 | 'undefined 'calcDigit-nondigit)) |
| 827 | (setq i (1+ i))))) | 760 | (setq i (1+ i))))) |
| 828 | (mapcar (function | 761 | (mapcar (lambda (x) (define-key map (char-to-string x) 'calcDigit-key)) |
| 829 | (lambda (x) | ||
| 830 | (define-key calc-digit-map (char-to-string x) | ||
| 831 | 'calcDigit-key))) | ||
| 832 | "_0123456789.e+-:n#@oh'\"mspM") | 762 | "_0123456789.e+-:n#@oh'\"mspM") |
| 833 | (mapcar (function | 763 | (mapcar (lambda (x) (define-key map (char-to-string x) 'calcDigit-letter)) |
| 834 | (lambda (x) | ||
| 835 | (define-key calc-digit-map (char-to-string x) | ||
| 836 | 'calcDigit-letter))) | ||
| 837 | "abcdfgijklqrtuvwxyzABCDEFGHIJKLNOPQRSTUVWXYZ") | 764 | "abcdfgijklqrtuvwxyzABCDEFGHIJKLNOPQRSTUVWXYZ") |
| 838 | (define-key calc-digit-map "'" 'calcDigit-algebraic) | 765 | (define-key map "'" 'calcDigit-algebraic) |
| 839 | (define-key calc-digit-map "`" 'calcDigit-edit) | 766 | (define-key map "`" 'calcDigit-edit) |
| 840 | (define-key calc-digit-map "\C-g" 'abort-recursive-edit) | 767 | (define-key map "\C-g" 'abort-recursive-edit) |
| 768 | map)) | ||
| 841 | 769 | ||
| 842 | (mapcar (function | 770 | (mapcar (lambda (x) |
| 843 | (lambda (x) | ||
| 844 | (condition-case err | 771 | (condition-case err |
| 845 | (progn | 772 | (progn |
| 846 | (define-key calc-digit-map x 'calcDigit-backspace) | 773 | (define-key calc-digit-map x 'calcDigit-backspace) |
| @@ -856,22 +783,21 @@ This can safely be nil as long as the Calc files are on the load-path.") | |||
| 856 | (vconcat "\e" x)) | 783 | (vconcat "\e" x)) |
| 857 | (concat "\e" x)) | 784 | (concat "\e" x)) |
| 858 | 'calc-pop-above)) | 785 | 'calc-pop-above)) |
| 859 | (error nil)))) | 786 | (error nil))) |
| 860 | (if calc-scan-for-dels | 787 | (if calc-scan-for-dels |
| 861 | (append (where-is-internal 'delete-backward-char global-map) | 788 | (append (where-is-internal 'delete-backward-char global-map) |
| 862 | (where-is-internal 'backward-delete-char global-map) | 789 | (where-is-internal 'backward-delete-char global-map) |
| 863 | '("\C-d")) | 790 | '("\C-d")) |
| 864 | '("\177" "\C-d"))) | 791 | '("\177" "\C-d"))) |
| 865 | 792 | ||
| 866 | (setq calc-dispatch-map (make-keymap)) | 793 | (defvar calc-dispatch-map |
| 867 | (mapcar (function | 794 | (let ((map (make-keymap))) |
| 868 | (lambda (x) | 795 | (mapcar (lambda (x) |
| 869 | (define-key calc-dispatch-map (char-to-string (car x)) (cdr x)) | 796 | (define-key map (char-to-string (car x)) (cdr x)) |
| 870 | (when (string-match "abcdefhijklnopqrstuwxyz" | 797 | (when (string-match "abcdefhijklnopqrstuwxyz" |
| 871 | (char-to-string (car x))) | 798 | (char-to-string (car x))) |
| 872 | (define-key calc-dispatch-map | 799 | (define-key map (char-to-string (- (car x) ?a -1)) (cdr x))) |
| 873 | (char-to-string (- (car x) ?a -1)) (cdr x))) | 800 | (define-key map (format "\e%c" (car x)) (cdr x))) |
| 874 | (define-key calc-dispatch-map (format "\e%c" (car x)) (cdr x)))) | ||
| 875 | '( ( ?a . calc-embedded-activate ) | 801 | '( ( ?a . calc-embedded-activate ) |
| 876 | ( ?b . calc-big-or-small ) | 802 | ( ?b . calc-big-or-small ) |
| 877 | ( ?c . calc ) | 803 | ( ?c . calc ) |
| @@ -904,52 +830,46 @@ This can safely be nil as long as the Calc files are on the load-path.") | |||
| 904 | ( ?_ . calc-grab-sum-across ) | 830 | ( ?_ . calc-grab-sum-across ) |
| 905 | ( ?0 . calc-reset ) | 831 | ( ?0 . calc-reset ) |
| 906 | ( ?# . calc-same-interface ) | 832 | ( ?# . calc-same-interface ) |
| 907 | ( ?? . calc-dispatch-help ) )) | 833 | ( ?? . calc-dispatch-help ) ))) |
| 908 | ) | 834 | map) |
| 909 | 835 | ||
| 910 | (autoload 'calc-extensions "calc-ext") | 836 | (autoload 'calc-extensions "calc-ext") |
| 911 | (autoload 'calc-need-macros "calc-macs") | 837 | (autoload 'calc-need-macros "calc-macs") |
| 912 | 838 | ||
| 913 | ;;;; (Autoloads here) | 839 | ;;;; (Autoloads here) |
| 914 | (mapcar (function (lambda (x) | 840 | (mapcar |
| 915 | (mapcar (function (lambda (func) | 841 | (lambda (x) (dolist (func (cdr x)) (autoload func (car x)))) |
| 916 | (autoload func (car x)))) (cdr x)))) | ||
| 917 | '( | 842 | '( |
| 918 | 843 | ||
| 919 | ("calc-aent" calc-Need-calc-aent calc-alg-digit-entry calc-alg-entry | 844 | ("calc-aent" calc-Need-calc-aent calc-alg-digit-entry calc-alg-entry |
| 920 | calc-check-user-syntax calc-do-alg-entry calc-do-calc-eval | 845 | calc-check-user-syntax calc-do-alg-entry calc-do-calc-eval |
| 921 | calc-do-quick-calc calc-match-user-syntax math-build-parse-table | 846 | calc-do-quick-calc calc-match-user-syntax math-build-parse-table |
| 922 | math-find-user-tokens math-read-expr-list math-read-exprs math-read-if | 847 | math-find-user-tokens math-read-expr-list math-read-exprs math-read-if |
| 923 | math-read-token math-remove-dashes) | 848 | math-read-token math-remove-dashes) |
| 924 | 849 | ||
| 925 | ("calc-misc" calc-Need-calc-misc | 850 | ("calc-misc" calc-Need-calc-misc |
| 926 | calc-do-handle-whys calc-do-refresh calc-num-prefix-name | 851 | calc-do-handle-whys calc-do-refresh calc-num-prefix-name |
| 927 | calc-record-list calc-record-why calc-report-bug calc-roll-down-stack | 852 | calc-record-list calc-record-why calc-report-bug calc-roll-down-stack |
| 928 | calc-roll-up-stack calc-temp-minibuffer-message calcFunc-floor | 853 | calc-roll-up-stack calc-temp-minibuffer-message calcFunc-floor |
| 929 | calcFunc-inv calcFunc-trunc math-concat math-constp math-div2 | 854 | calcFunc-inv calcFunc-trunc math-concat math-constp math-div2 |
| 930 | math-div2-bignum math-do-working math-evenp math-fixnatnump | 855 | math-div2-bignum math-do-working math-evenp math-fixnatnump |
| 931 | math-fixnump math-floor math-imod math-ipow math-looks-negp math-mod | 856 | math-fixnump math-floor math-imod math-ipow math-looks-negp math-mod |
| 932 | math-negp math-posp math-pow math-read-radix-digit math-reject-arg | 857 | math-negp math-posp math-pow math-read-radix-digit math-reject-arg |
| 933 | math-trunc math-zerop) | 858 | math-trunc math-zerop))) |
| 934 | 859 | ||
| 935 | )) | 860 | (mapcar |
| 936 | 861 | (lambda (x) (dolist (cmd (cdr x)) (autoload cmd (car x) nil t))) | |
| 937 | (mapcar (function (lambda (x) | ||
| 938 | (mapcar (function (lambda (cmd) | ||
| 939 | (autoload cmd (car x) nil t))) (cdr x)))) | ||
| 940 | '( | 862 | '( |
| 941 | 863 | ||
| 942 | ("calc-aent" calc-algebraic-entry calc-auto-algebraic-entry | 864 | ("calc-aent" calc-algebraic-entry calc-auto-algebraic-entry |
| 943 | calcDigit-algebraic calcDigit-edit) | 865 | calcDigit-algebraic calcDigit-edit) |
| 944 | 866 | ||
| 945 | ("calc-misc" another-calc calc-big-or-small calc-dispatch-help | 867 | ("calc-misc" another-calc calc-big-or-small calc-dispatch-help |
| 946 | calc-help calc-info calc-info-summary calc-inv calc-last-args-stub | 868 | calc-help calc-info calc-info-summary calc-inv calc-last-args-stub |
| 947 | calc-missing-key calc-mod calc-other-window calc-over calc-percent | 869 | calc-missing-key calc-mod calc-other-window calc-over calc-percent |
| 948 | calc-pop-above calc-power calc-roll-down calc-roll-up | 870 | calc-pop-above calc-power calc-roll-down calc-roll-up |
| 949 | calc-shift-Y-prefix-help calc-tutorial calcDigit-letter | 871 | calc-shift-Y-prefix-help calc-tutorial calcDigit-letter |
| 950 | report-calc-bug)))) | 872 | report-calc-bug))) |
| 951 | |||
| 952 | (calc-init-base) | ||
| 953 | 873 | ||
| 954 | 874 | ||
| 955 | ;;;###autoload (global-set-key "\e#" 'calc-dispatch) | 875 | ;;;###autoload (global-set-key "\e#" 'calc-dispatch) |
| @@ -1295,6 +1215,9 @@ See calc-keypad for details." | |||
| 1295 | 1215 | ||
| 1296 | (defvar calc-aborted-prefix nil) | 1216 | (defvar calc-aborted-prefix nil) |
| 1297 | (defvar calc-start-time nil) | 1217 | (defvar calc-start-time nil) |
| 1218 | (defvar calc-command-flags) | ||
| 1219 | (defvar calc-final-point-line) | ||
| 1220 | (defvar calc-final-point-column) | ||
| 1298 | ;;; Note that modifications to this function may break calc-pass-errors. | 1221 | ;;; Note that modifications to this function may break calc-pass-errors. |
| 1299 | (defun calc-do (do-body &optional do-slow) | 1222 | (defun calc-do (do-body &optional do-slow) |
| 1300 | (calc-check-defines) | 1223 | (calc-check-defines) |
| @@ -1303,7 +1226,8 @@ See calc-keypad for details." | |||
| 1303 | (calc-extensions) | 1226 | (calc-extensions) |
| 1304 | (current-time-string))) | 1227 | (current-time-string))) |
| 1305 | (gc-cons-threshold (max gc-cons-threshold | 1228 | (gc-cons-threshold (max gc-cons-threshold |
| 1306 | (if calc-timing 2000000 100000)))) | 1229 | (if calc-timing 2000000 100000))) |
| 1230 | calc-final-point-line calc-final-point-column) | ||
| 1307 | (setq calc-aborted-prefix "") | 1231 | (setq calc-aborted-prefix "") |
| 1308 | (unwind-protect | 1232 | (unwind-protect |
| 1309 | (condition-case err | 1233 | (condition-case err |
| @@ -1331,7 +1255,6 @@ See calc-keypad for details." | |||
| 1331 | (error "Computation got stuck or ran too long. Type `M' to increase the limit") | 1255 | (error "Computation got stuck or ran too long. Type `M' to increase the limit") |
| 1332 | (setq calc-aborted-prefix nil) | 1256 | (setq calc-aborted-prefix nil) |
| 1333 | (signal (car err) (cdr err))))) | 1257 | (signal (car err) (cdr err))))) |
| 1334 | (setq calc-old-aborted-prefix calc-aborted-prefix) | ||
| 1335 | (when calc-aborted-prefix | 1258 | (when calc-aborted-prefix |
| 1336 | (calc-record "<Aborted>" calc-aborted-prefix)) | 1259 | (calc-record "<Aborted>" calc-aborted-prefix)) |
| 1337 | (and calc-start-time | 1260 | (and calc-start-time |
| @@ -1354,7 +1277,7 @@ See calc-keypad for details." | |||
| 1354 | (progn | 1277 | (progn |
| 1355 | (goto-line calc-final-point-line) | 1278 | (goto-line calc-final-point-line) |
| 1356 | (move-to-column calc-final-point-column)) | 1279 | (move-to-column calc-final-point-column)) |
| 1357 | (save-excursion | 1280 | (save-current-buffer |
| 1358 | (calc-select-buffer) | 1281 | (calc-select-buffer) |
| 1359 | (goto-line calc-final-point-line) | 1282 | (goto-line calc-final-point-line) |
| 1360 | (move-to-column calc-final-point-column)))) | 1283 | (move-to-column calc-final-point-column)))) |
| @@ -1623,6 +1546,7 @@ See calc-keypad for details." | |||
| 1623 | (delete-region (point) (point-max)))) | 1546 | (delete-region (point) (point-max)))) |
| 1624 | (calc-set-command-flag 'renum-stack)))))) | 1547 | (calc-set-command-flag 'renum-stack)))))) |
| 1625 | 1548 | ||
| 1549 | (defvar sel-mode) | ||
| 1626 | (defun calc-get-stack-element (x) | 1550 | (defun calc-get-stack-element (x) |
| 1627 | (cond ((eq sel-mode 'entry) | 1551 | (cond ((eq sel-mode 'entry) |
| 1628 | x) | 1552 | x) |
| @@ -1691,6 +1615,7 @@ See calc-keypad for details." | |||
| 1691 | stack (cdr stack)))))) | 1615 | stack (cdr stack)))))) |
| 1692 | (and calc-embedded-info (calc-embedded-stack-change))) | 1616 | (and calc-embedded-info (calc-embedded-stack-change))) |
| 1693 | 1617 | ||
| 1618 | (defvar calc-any-evaltos) | ||
| 1694 | (defun calc-refresh (&optional align) | 1619 | (defun calc-refresh (&optional align) |
| 1695 | (interactive) | 1620 | (interactive) |
| 1696 | (and (eq major-mode 'calc-mode) | 1621 | (and (eq major-mode 'calc-mode) |
| @@ -1699,9 +1624,9 @@ See calc-keypad for details." | |||
| 1699 | (save-point (point)) | 1624 | (save-point (point)) |
| 1700 | (save-mark (condition-case err (mark) (error nil))) | 1625 | (save-mark (condition-case err (mark) (error nil))) |
| 1701 | (save-aligned (looking-at "\\.$")) | 1626 | (save-aligned (looking-at "\\.$")) |
| 1702 | (thing calc-stack)) | 1627 | (thing calc-stack) |
| 1703 | (setq calc-any-selections nil | 1628 | (calc-any-evaltos nil)) |
| 1704 | calc-any-evaltos nil) | 1629 | (setq calc-any-selections nil) |
| 1705 | (erase-buffer) | 1630 | (erase-buffer) |
| 1706 | (when calc-show-banner | 1631 | (when calc-show-banner |
| 1707 | (insert (propertize "--- Emacs Calculator Mode ---\n" | 1632 | (insert (propertize "--- Emacs Calculator Mode ---\n" |
| @@ -1971,7 +1896,10 @@ If mouse is pressed in Calc window, push cut buffer contents onto the stack." | |||
| 1971 | 1896 | ||
| 1972 | 1897 | ||
| 1973 | ;;;; Reading a number using the minibuffer. | 1898 | ;;;; Reading a number using the minibuffer. |
| 1974 | 1899 | (defvar calc-buffer) | |
| 1900 | (defvar calc-prev-char) | ||
| 1901 | (defvar calc-prev-prev-char) | ||
| 1902 | (defvar calc-digit-value) | ||
| 1975 | (defun calcDigit-start () | 1903 | (defun calcDigit-start () |
| 1976 | (interactive) | 1904 | (interactive) |
| 1977 | (calc-wrapper | 1905 | (calc-wrapper |
| @@ -2253,6 +2181,8 @@ If mouse is pressed in Calc window, push cut buffer contents onto the stack." | |||
| 2253 | ;;; Also, [Public] marks routines intended to be called from outside. | 2181 | ;;; Also, [Public] marks routines intended to be called from outside. |
| 2254 | ;;; [This notation has been neglected in many recent routines.] | 2182 | ;;; [This notation has been neglected in many recent routines.] |
| 2255 | 2183 | ||
| 2184 | (defvar math-eval-rules-cache) | ||
| 2185 | (defvar math-eval-rules-cache-other) | ||
| 2256 | ;;; Reduce an object to canonical (normalized) form. [O o; Z Z] [Public] | 2186 | ;;; Reduce an object to canonical (normalized) form. [O o; Z Z] [Public] |
| 2257 | (defun math-normalize (a) | 2187 | (defun math-normalize (a) |
| 2258 | (cond | 2188 | (cond |
| @@ -2644,7 +2574,7 @@ If mouse is pressed in Calc window, push cut buffer contents onto the stack." | |||
| 2644 | (defun math-sub-bignum (a b) ; [l l l] | 2574 | (defun math-sub-bignum (a b) ; [l l l] |
| 2645 | (if b | 2575 | (if b |
| 2646 | (if a | 2576 | (if a |
| 2647 | (let* ((a (copy-sequence a)) (aa a) (borrow nil) sum) | 2577 | (let* ((a (copy-sequence a)) (aa a) (borrow nil) sum diff) |
| 2648 | (while (and aa b) | 2578 | (while (and aa b) |
| 2649 | (if borrow | 2579 | (if borrow |
| 2650 | (if (>= (setq diff (- (car aa) (car b))) 1) | 2580 | (if (>= (setq diff (- (car aa) (car b))) 1) |
| @@ -2966,7 +2896,7 @@ If mouse is pressed in Calc window, push cut buffer contents onto the stack." | |||
| 2966 | 2896 | ||
| 2967 | 2897 | ||
| 2968 | 2898 | ||
| 2969 | 2899 | (defvar calc-selection-cache-entry) | |
| 2970 | ;;; Format the number A as a string. [X N; X Z] [Public] | 2900 | ;;; Format the number A as a string. [X N; X Z] [Public] |
| 2971 | (defun math-format-stack-value (entry) | 2901 | (defun math-format-stack-value (entry) |
| 2972 | (setq calc-selection-cache-entry calc-selection-cache-default-entry) | 2902 | (setq calc-selection-cache-entry calc-selection-cache-default-entry) |
| @@ -3043,8 +2973,8 @@ If mouse is pressed in Calc window, push cut buffer contents onto the stack." | |||
| 3043 | (defun calc-count-lines (s) | 2973 | (defun calc-count-lines (s) |
| 3044 | (let ((pos 0) | 2974 | (let ((pos 0) |
| 3045 | (num 1)) | 2975 | (num 1)) |
| 3046 | (while (setq newpos (string-match "\n" s pos)) | 2976 | (while (setq pos (string-match "\n" s pos)) |
| 3047 | (setq pos (1+ newpos) | 2977 | (setq pos (1+ pos) |
| 3048 | num (1+ num))) | 2978 | num (1+ num))) |
| 3049 | num)) | 2979 | num)) |
| 3050 | 2980 | ||