diff options
| author | Juanma Barranquero | 2007-09-26 00:09:32 +0000 |
|---|---|---|
| committer | Juanma Barranquero | 2007-09-26 00:09:32 +0000 |
| commit | 2a78421d93d41c8d569e9d66e59df96f6f59eb51 (patch) | |
| tree | 4fc96d482b30fb358c53d011ecf3b9416ace5a91 /lisp | |
| parent | 09040c8d89ea6ccd353daf9cdfffca3e910dba5f (diff) | |
| download | emacs-2a78421d93d41c8d569e9d66e59df96f6f59eb51.tar.gz emacs-2a78421d93d41c8d569e9d66e59df96f6f59eb51.zip | |
(calc-digit-map, calc-dispatch-map, calc-mode, calc-quit):
Use `mapc' rather than `mapcar'.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/calc/calc.el | 288 |
1 files changed, 144 insertions, 144 deletions
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index 8e416293a45..913b02e003f 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el | |||
| @@ -213,7 +213,7 @@ | |||
| 213 | :group 'applications) | 213 | :group 'applications) |
| 214 | 214 | ||
| 215 | ;;;###autoload | 215 | ;;;###autoload |
| 216 | (defcustom calc-settings-file | 216 | (defcustom calc-settings-file |
| 217 | (convert-standard-filename "~/.calc.el") | 217 | (convert-standard-filename "~/.calc.el") |
| 218 | "*File in which to record permanent settings." | 218 | "*File in which to record permanent settings." |
| 219 | :group 'calc | 219 | :group 'calc |
| @@ -233,10 +233,10 @@ | |||
| 233 | (texinfo-mode . calc-normal-language)) | 233 | (texinfo-mode . calc-normal-language)) |
| 234 | "*Alist of major modes with appropriate Calc languages." | 234 | "*Alist of major modes with appropriate Calc languages." |
| 235 | :group 'calc | 235 | :group 'calc |
| 236 | :type '(alist :key-type (symbol :tag "Major mode") | 236 | :type '(alist :key-type (symbol :tag "Major mode") |
| 237 | :value-type (symbol :tag "Calc language"))) | 237 | :value-type (symbol :tag "Calc language"))) |
| 238 | 238 | ||
| 239 | (defcustom calc-embedded-announce-formula | 239 | (defcustom calc-embedded-announce-formula |
| 240 | "%Embed\n\\(% .*\n\\)*" | 240 | "%Embed\n\\(% .*\n\\)*" |
| 241 | "*A regular expression which is sure to be followed by a calc-embedded formula." | 241 | "*A regular expression which is sure to be followed by a calc-embedded formula." |
| 242 | :group 'calc | 242 | :group 'calc |
| @@ -259,13 +259,13 @@ | |||
| 259 | :type '(alist :key-type (symbol :tag "Major mode") | 259 | :type '(alist :key-type (symbol :tag "Major mode") |
| 260 | :value-type (regexp :tag "Regexp to announce formula"))) | 260 | :value-type (regexp :tag "Regexp to announce formula"))) |
| 261 | 261 | ||
| 262 | (defcustom calc-embedded-open-formula | 262 | (defcustom calc-embedded-open-formula |
| 263 | "\\`\\|^\n\\|\\$\\$?\\|\\\\\\[\\|^\\\\begin[^{].*\n\\|^\\\\begin{.*[^x]}.*\n\\|^@.*\n\\|^\\.EQ.*\n\\|\\\\(\\|^%\n\\|^\\.\\\\\"\n" | 263 | "\\`\\|^\n\\|\\$\\$?\\|\\\\\\[\\|^\\\\begin[^{].*\n\\|^\\\\begin{.*[^x]}.*\n\\|^@.*\n\\|^\\.EQ.*\n\\|\\\\(\\|^%\n\\|^\\.\\\\\"\n" |
| 264 | "*A regular expression for the opening delimiter of a formula used by calc-embedded." | 264 | "*A regular expression for the opening delimiter of a formula used by calc-embedded." |
| 265 | :group 'calc | 265 | :group 'calc |
| 266 | :type '(regexp)) | 266 | :type '(regexp)) |
| 267 | 267 | ||
| 268 | (defcustom calc-embedded-close-formula | 268 | (defcustom calc-embedded-close-formula |
| 269 | "\\'\\|\n$\\|\\$\\$?\\|\\\\]\\|^\\\\end[^{].*\n\\|^\\\\end{.*[^x]}.*\n\\|^@.*\n\\|^\\.EN.*\n\\|\\\\)\\|\n%\n\\|^\\.\\\\\"\n" | 269 | "\\'\\|\n$\\|\\$\\$?\\|\\\\]\\|^\\\\end[^{].*\n\\|^\\\\end{.*[^x]}.*\n\\|^@.*\n\\|^\\.EN.*\n\\|\\\\)\\|\n%\n\\|^\\.\\\\\"\n" |
| 270 | "*A regular expression for the closing delimiter of a formula used by calc-embedded." | 270 | "*A regular expression for the closing delimiter of a formula used by calc-embedded." |
| 271 | :group 'calc | 271 | :group 'calc |
| @@ -279,13 +279,13 @@ | |||
| 279 | :value-type (list (regexp :tag "Opening formula delimiter") | 279 | :value-type (list (regexp :tag "Opening formula delimiter") |
| 280 | (regexp :tag "Closing formula delimiter")))) | 280 | (regexp :tag "Closing formula delimiter")))) |
| 281 | 281 | ||
| 282 | (defcustom calc-embedded-open-word | 282 | (defcustom calc-embedded-open-word |
| 283 | "^\\|[^-+0-9.eE]" | 283 | "^\\|[^-+0-9.eE]" |
| 284 | "*A regular expression for the opening delimiter of a formula used by calc-embedded-word." | 284 | "*A regular expression for the opening delimiter of a formula used by calc-embedded-word." |
| 285 | :group 'calc | 285 | :group 'calc |
| 286 | :type '(regexp)) | 286 | :type '(regexp)) |
| 287 | 287 | ||
| 288 | (defcustom calc-embedded-close-word | 288 | (defcustom calc-embedded-close-word |
| 289 | "$\\|[^-+0-9.eE]" | 289 | "$\\|[^-+0-9.eE]" |
| 290 | "*A regular expression for the closing delimiter of a formula used by calc-embedded-word." | 290 | "*A regular expression for the closing delimiter of a formula used by calc-embedded-word." |
| 291 | :group 'calc | 291 | :group 'calc |
| @@ -299,7 +299,7 @@ | |||
| 299 | :value-type (list (regexp :tag "Opening word delimiter") | 299 | :value-type (list (regexp :tag "Opening word delimiter") |
| 300 | (regexp :tag "Closing word delimiter")))) | 300 | (regexp :tag "Closing word delimiter")))) |
| 301 | 301 | ||
| 302 | (defcustom calc-embedded-open-plain | 302 | (defcustom calc-embedded-open-plain |
| 303 | "%%% " | 303 | "%%% " |
| 304 | "*A string which is the opening delimiter for a \"plain\" formula. | 304 | "*A string which is the opening delimiter for a \"plain\" formula. |
| 305 | If calc-show-plain mode is enabled, this is inserted at the front of | 305 | If calc-show-plain mode is enabled, this is inserted at the front of |
| @@ -307,7 +307,7 @@ each formula." | |||
| 307 | :group 'calc | 307 | :group 'calc |
| 308 | :type '(string)) | 308 | :type '(string)) |
| 309 | 309 | ||
| 310 | (defcustom calc-embedded-close-plain | 310 | (defcustom calc-embedded-close-plain |
| 311 | " %%%\n" | 311 | " %%%\n" |
| 312 | "*A string which is the closing delimiter for a \"plain\" formula. | 312 | "*A string which is the closing delimiter for a \"plain\" formula. |
| 313 | See calc-embedded-open-plain." | 313 | See calc-embedded-open-plain." |
| @@ -332,13 +332,13 @@ See calc-embedded-open-plain." | |||
| 332 | :value-type (list (string :tag "Opening \"plain\" delimiter") | 332 | :value-type (list (string :tag "Opening \"plain\" delimiter") |
| 333 | (string :tag "Closing \"plain\" delimiter")))) | 333 | (string :tag "Closing \"plain\" delimiter")))) |
| 334 | 334 | ||
| 335 | (defcustom calc-embedded-open-new-formula | 335 | (defcustom calc-embedded-open-new-formula |
| 336 | "\n\n" | 336 | "\n\n" |
| 337 | "*A string which is inserted at front of formula by calc-embedded-new-formula." | 337 | "*A string which is inserted at front of formula by calc-embedded-new-formula." |
| 338 | :group 'calc | 338 | :group 'calc |
| 339 | :type '(string)) | 339 | :type '(string)) |
| 340 | 340 | ||
| 341 | (defcustom calc-embedded-close-new-formula | 341 | (defcustom calc-embedded-close-new-formula |
| 342 | "\n\n" | 342 | "\n\n" |
| 343 | "*A string which is inserted at end of formula by calc-embedded-new-formula." | 343 | "*A string which is inserted at end of formula by calc-embedded-new-formula." |
| 344 | :group 'calc | 344 | :group 'calc |
| @@ -352,14 +352,14 @@ See calc-embedded-open-plain." | |||
| 352 | :value-type (list (string :tag "Opening new formula delimiter") | 352 | :value-type (list (string :tag "Opening new formula delimiter") |
| 353 | (string :tag "Closing new formula delimiter")))) | 353 | (string :tag "Closing new formula delimiter")))) |
| 354 | 354 | ||
| 355 | (defcustom calc-embedded-open-mode | 355 | (defcustom calc-embedded-open-mode |
| 356 | "% " | 356 | "% " |
| 357 | "*A string which should precede calc-embedded mode annotations. | 357 | "*A string which should precede calc-embedded mode annotations. |
| 358 | This is not required to be present for user-written mode annotations." | 358 | This is not required to be present for user-written mode annotations." |
| 359 | :group 'calc | 359 | :group 'calc |
| 360 | :type '(string)) | 360 | :type '(string)) |
| 361 | 361 | ||
| 362 | (defcustom calc-embedded-close-mode | 362 | (defcustom calc-embedded-close-mode |
| 363 | "\n" | 363 | "\n" |
| 364 | "*A string which should follow calc-embedded mode annotations. | 364 | "*A string which should follow calc-embedded mode annotations. |
| 365 | This is not required to be present for user-written mode annotations." | 365 | This is not required to be present for user-written mode annotations." |
| @@ -384,19 +384,19 @@ This is not required to be present for user-written mode annotations." | |||
| 384 | :value-type (list (string :tag "Opening annotation delimiter") | 384 | :value-type (list (string :tag "Opening annotation delimiter") |
| 385 | (string :tag "Closing annotation delimiter")))) | 385 | (string :tag "Closing annotation delimiter")))) |
| 386 | 386 | ||
| 387 | (defcustom calc-gnuplot-name | 387 | (defcustom calc-gnuplot-name |
| 388 | "gnuplot" | 388 | "gnuplot" |
| 389 | "*Name of GNUPLOT program, for calc-graph features." | 389 | "*Name of GNUPLOT program, for calc-graph features." |
| 390 | :group 'calc | 390 | :group 'calc |
| 391 | :type '(string)) | 391 | :type '(string)) |
| 392 | 392 | ||
| 393 | (defcustom calc-gnuplot-plot-command | 393 | (defcustom calc-gnuplot-plot-command |
| 394 | nil | 394 | nil |
| 395 | "*Name of command for displaying GNUPLOT output; %s = file name to print." | 395 | "*Name of command for displaying GNUPLOT output; %s = file name to print." |
| 396 | :group 'calc | 396 | :group 'calc |
| 397 | :type '(choice (string) (sexp))) | 397 | :type '(choice (string) (sexp))) |
| 398 | 398 | ||
| 399 | (defcustom calc-gnuplot-print-command | 399 | (defcustom calc-gnuplot-print-command |
| 400 | "lp %s" | 400 | "lp %s" |
| 401 | "*Name of command for printing GNUPLOT output; %s = file name to print." | 401 | "*Name of command for printing GNUPLOT output; %s = file name to print." |
| 402 | :group 'calc | 402 | :group 'calc |
| @@ -520,7 +520,7 @@ This is used only when calc-group-digits mode is on.") | |||
| 520 | 520 | ||
| 521 | (defcalcmodevar calc-point-char "." | 521 | (defcalcmodevar calc-point-char "." |
| 522 | "The character (in the form of a string) to be used as a decimal point.") | 522 | "The character (in the form of a string) to be used as a decimal point.") |
| 523 | 523 | ||
| 524 | (defcalcmodevar calc-frac-format '(":" nil) | 524 | (defcalcmodevar calc-frac-format '(":" nil) |
| 525 | "Format of displayed fractions; a string of one or two of \":\" or \"/\".") | 525 | "Format of displayed fractions; a string of one or two of \":\" or \"/\".") |
| 526 | 526 | ||
| @@ -710,9 +710,9 @@ If nil, selections displayed but ignored.") | |||
| 710 | "YYddd< hh:mm:ss>")) | 710 | "YYddd< hh:mm:ss>")) |
| 711 | 711 | ||
| 712 | (defcalcmodevar calc-autorange-units nil) | 712 | (defcalcmodevar calc-autorange-units nil) |
| 713 | 713 | ||
| 714 | (defcalcmodevar calc-was-keypad-mode nil) | 714 | (defcalcmodevar calc-was-keypad-mode nil) |
| 715 | 715 | ||
| 716 | (defcalcmodevar calc-full-mode nil) | 716 | (defcalcmodevar calc-full-mode nil) |
| 717 | 717 | ||
| 718 | (defcalcmodevar calc-user-parse-tables nil) | 718 | (defcalcmodevar calc-user-parse-tables nil) |
| @@ -722,7 +722,7 @@ If nil, selections displayed but ignored.") | |||
| 722 | (defcalcmodevar calc-gnuplot-default-output "STDOUT") | 722 | (defcalcmodevar calc-gnuplot-default-output "STDOUT") |
| 723 | 723 | ||
| 724 | (defcalcmodevar calc-gnuplot-print-device "postscript") | 724 | (defcalcmodevar calc-gnuplot-print-device "postscript") |
| 725 | 725 | ||
| 726 | (defcalcmodevar calc-gnuplot-print-output "auto") | 726 | (defcalcmodevar calc-gnuplot-print-output "auto") |
| 727 | 727 | ||
| 728 | (defcalcmodevar calc-gnuplot-geometry nil) | 728 | (defcalcmodevar calc-gnuplot-geometry nil) |
| @@ -730,7 +730,7 @@ If nil, selections displayed but ignored.") | |||
| 730 | (defcalcmodevar calc-graph-default-resolution 15) | 730 | (defcalcmodevar calc-graph-default-resolution 15) |
| 731 | 731 | ||
| 732 | (defcalcmodevar calc-graph-default-resolution-3d 5) | 732 | (defcalcmodevar calc-graph-default-resolution-3d 5) |
| 733 | 733 | ||
| 734 | (defcalcmodevar calc-invocation-macro nil) | 734 | (defcalcmodevar calc-invocation-macro nil) |
| 735 | 735 | ||
| 736 | (defcalcmodevar calc-show-banner t | 736 | (defcalcmodevar calc-show-banner t |
| @@ -926,8 +926,8 @@ If nil, selections displayed but ignored.") | |||
| 926 | (defvar var-gamma '(special-const (math-gamma-const))) | 926 | (defvar var-gamma '(special-const (math-gamma-const))) |
| 927 | (defvar var-Modes '(special-const (math-get-modes-vec))) | 927 | (defvar var-Modes '(special-const (math-get-modes-vec))) |
| 928 | 928 | ||
| 929 | (mapcar (lambda (v) (or (boundp v) (set v nil))) | 929 | (mapc (lambda (v) (or (boundp v) (set v nil))) |
| 930 | calc-local-var-list) | 930 | calc-local-var-list) |
| 931 | 931 | ||
| 932 | (defvar calc-mode-map | 932 | (defvar calc-mode-map |
| 933 | (let ((map (make-keymap))) | 933 | (let ((map (make-keymap))) |
| @@ -983,89 +983,89 @@ If nil, selections displayed but ignored.") | |||
| 983 | (if (eq (aref cmap i) 'undefined) | 983 | (if (eq (aref cmap i) 'undefined) |
| 984 | 'undefined 'calcDigit-nondigit)) | 984 | 'undefined 'calcDigit-nondigit)) |
| 985 | (setq i (1+ i))))) | 985 | (setq i (1+ i))))) |
| 986 | (mapcar (lambda (x) (define-key map (char-to-string x) 'calcDigit-key)) | 986 | (mapc (lambda (x) (define-key map (char-to-string x) 'calcDigit-key)) |
| 987 | "_0123456789.e+-:n#@oh'\"mspM") | 987 | "_0123456789.e+-:n#@oh'\"mspM") |
| 988 | (mapcar (lambda (x) (define-key map (char-to-string x) 'calcDigit-letter)) | 988 | (mapc (lambda (x) (define-key map (char-to-string x) 'calcDigit-letter)) |
| 989 | "abcdfgijklqrtuvwxyzABCDEFGHIJKLNOPQRSTUVWXYZ") | 989 | "abcdfgijklqrtuvwxyzABCDEFGHIJKLNOPQRSTUVWXYZ") |
| 990 | (define-key map "'" 'calcDigit-algebraic) | 990 | (define-key map "'" 'calcDigit-algebraic) |
| 991 | (define-key map "`" 'calcDigit-edit) | 991 | (define-key map "`" 'calcDigit-edit) |
| 992 | (define-key map "\C-g" 'abort-recursive-edit) | 992 | (define-key map "\C-g" 'abort-recursive-edit) |
| 993 | map)) | 993 | map)) |
| 994 | 994 | ||
| 995 | (mapcar (lambda (x) | 995 | (mapc (lambda (x) |
| 996 | (condition-case err | 996 | (condition-case err |
| 997 | (progn | 997 | (progn |
| 998 | (define-key calc-digit-map x 'calcDigit-backspace) | 998 | (define-key calc-digit-map x 'calcDigit-backspace) |
| 999 | (define-key calc-mode-map x 'calc-pop) | 999 | (define-key calc-mode-map x 'calc-pop) |
| 1000 | (define-key calc-mode-map | 1000 | (define-key calc-mode-map |
| 1001 | (if (vectorp x) | 1001 | (if (vectorp x) |
| 1002 | (if calc-emacs-type-lucid | 1002 | (if calc-emacs-type-lucid |
| 1003 | (if (= (length x) 1) | 1003 | (if (= (length x) 1) |
| 1004 | (vector (if (consp (aref x 0)) | 1004 | (vector (if (consp (aref x 0)) |
| 1005 | (cons 'meta (aref x 0)) | 1005 | (cons 'meta (aref x 0)) |
| 1006 | (list 'meta (aref x 0)))) | 1006 | (list 'meta (aref x 0)))) |
| 1007 | "\e\C-d") | 1007 | "\e\C-d") |
| 1008 | (vconcat "\e" x)) | 1008 | (vconcat "\e" x)) |
| 1009 | (concat "\e" x)) | 1009 | (concat "\e" x)) |
| 1010 | 'calc-pop-above)) | 1010 | 'calc-pop-above)) |
| 1011 | (error nil))) | 1011 | (error nil))) |
| 1012 | (if calc-scan-for-dels | 1012 | (if calc-scan-for-dels |
| 1013 | (append (where-is-internal 'delete-backward-char global-map) | 1013 | (append (where-is-internal 'delete-backward-char global-map) |
| 1014 | (where-is-internal 'backward-delete-char global-map) | 1014 | (where-is-internal 'backward-delete-char global-map) |
| 1015 | '("\C-d")) | 1015 | '("\C-d")) |
| 1016 | '("\177" "\C-d"))) | 1016 | '("\177" "\C-d"))) |
| 1017 | 1017 | ||
| 1018 | (defvar calc-dispatch-map | 1018 | (defvar calc-dispatch-map |
| 1019 | (let ((map (make-keymap))) | 1019 | (let ((map (make-keymap))) |
| 1020 | (mapcar (lambda (x) | 1020 | (mapc (lambda (x) |
| 1021 | (define-key map (char-to-string (car x)) (cdr x)) | 1021 | (define-key map (char-to-string (car x)) (cdr x)) |
| 1022 | (when (string-match "abcdefhijklnopqrstuwxyz" | 1022 | (when (string-match "abcdefhijklnopqrstuwxyz" |
| 1023 | (char-to-string (car x))) | 1023 | (char-to-string (car x))) |
| 1024 | (define-key map (char-to-string (- (car x) ?a -1)) (cdr x))) | 1024 | (define-key map (char-to-string (- (car x) ?a -1)) (cdr x))) |
| 1025 | (define-key map (format "\e%c" (car x)) (cdr x))) | 1025 | (define-key map (format "\e%c" (car x)) (cdr x))) |
| 1026 | '( ( ?a . calc-embedded-activate ) | 1026 | '( ( ?a . calc-embedded-activate ) |
| 1027 | ( ?b . calc-big-or-small ) | 1027 | ( ?b . calc-big-or-small ) |
| 1028 | ( ?c . calc ) | 1028 | ( ?c . calc ) |
| 1029 | ( ?d . calc-embedded-duplicate ) | 1029 | ( ?d . calc-embedded-duplicate ) |
| 1030 | ( ?e . calc-embedded ) | 1030 | ( ?e . calc-embedded ) |
| 1031 | ( ?f . calc-embedded-new-formula ) | 1031 | ( ?f . calc-embedded-new-formula ) |
| 1032 | ( ?g . calc-grab-region ) | 1032 | ( ?g . calc-grab-region ) |
| 1033 | ( ?h . calc-dispatch-help ) | 1033 | ( ?h . calc-dispatch-help ) |
| 1034 | ( ?i . calc-info ) | 1034 | ( ?i . calc-info ) |
| 1035 | ( ?j . calc-embedded-select ) | 1035 | ( ?j . calc-embedded-select ) |
| 1036 | ( ?k . calc-keypad ) | 1036 | ( ?k . calc-keypad ) |
| 1037 | ( ?l . calc-load-everything ) | 1037 | ( ?l . calc-load-everything ) |
| 1038 | ( ?m . read-kbd-macro ) | 1038 | ( ?m . read-kbd-macro ) |
| 1039 | ( ?n . calc-embedded-next ) | 1039 | ( ?n . calc-embedded-next ) |
| 1040 | ( ?o . calc-other-window ) | 1040 | ( ?o . calc-other-window ) |
| 1041 | ( ?p . calc-embedded-previous ) | 1041 | ( ?p . calc-embedded-previous ) |
| 1042 | ( ?q . quick-calc ) | 1042 | ( ?q . quick-calc ) |
| 1043 | ( ?r . calc-grab-rectangle ) | 1043 | ( ?r . calc-grab-rectangle ) |
| 1044 | ( ?s . calc-info-summary ) | 1044 | ( ?s . calc-info-summary ) |
| 1045 | ( ?t . calc-tutorial ) | 1045 | ( ?t . calc-tutorial ) |
| 1046 | ( ?u . calc-embedded-update-formula ) | 1046 | ( ?u . calc-embedded-update-formula ) |
| 1047 | ( ?w . calc-embedded-word ) | 1047 | ( ?w . calc-embedded-word ) |
| 1048 | ( ?x . calc-quit ) | 1048 | ( ?x . calc-quit ) |
| 1049 | ( ?y . calc-copy-to-buffer ) | 1049 | ( ?y . calc-copy-to-buffer ) |
| 1050 | ( ?z . calc-user-invocation ) | 1050 | ( ?z . calc-user-invocation ) |
| 1051 | ( ?\' . calc-embedded-new-formula ) | 1051 | ( ?\' . calc-embedded-new-formula ) |
| 1052 | ( ?\` . calc-embedded-edit ) | 1052 | ( ?\` . calc-embedded-edit ) |
| 1053 | ( ?: . calc-grab-sum-down ) | 1053 | ( ?: . calc-grab-sum-down ) |
| 1054 | ( ?_ . calc-grab-sum-across ) | 1054 | ( ?_ . calc-grab-sum-across ) |
| 1055 | ( ?0 . calc-reset ) | 1055 | ( ?0 . calc-reset ) |
| 1056 | ( ?? . calc-dispatch-help ) | 1056 | ( ?? . calc-dispatch-help ) |
| 1057 | ( ?# . calc-same-interface ) | 1057 | ( ?# . calc-same-interface ) |
| 1058 | ( ?& . calc-same-interface ) | 1058 | ( ?& . calc-same-interface ) |
| 1059 | ( ?\\ . calc-same-interface ) | 1059 | ( ?\\ . calc-same-interface ) |
| 1060 | ( ?= . calc-same-interface ) | 1060 | ( ?= . calc-same-interface ) |
| 1061 | ( ?* . calc-same-interface ) | 1061 | ( ?* . calc-same-interface ) |
| 1062 | ( ?/ . calc-same-interface ) | 1062 | ( ?/ . calc-same-interface ) |
| 1063 | ( ?+ . calc-same-interface ) | 1063 | ( ?+ . calc-same-interface ) |
| 1064 | ( ?- . calc-same-interface ) )) | 1064 | ( ?- . calc-same-interface ) )) |
| 1065 | map)) | 1065 | map)) |
| 1066 | 1066 | ||
| 1067 | ;;;; (Autoloads here) | 1067 | ;;;; (Autoloads here) |
| 1068 | (mapcar | 1068 | (mapc |
| 1069 | (lambda (x) (dolist (func (cdr x)) (autoload func (car x)))) | 1069 | (lambda (x) (dolist (func (cdr x)) (autoload func (car x)))) |
| 1070 | '( | 1070 | '( |
| 1071 | 1071 | ||
| @@ -1077,7 +1077,7 @@ If nil, selections displayed but ignored.") | |||
| 1077 | 1077 | ||
| 1078 | ("calc-embed" calc-do-embedded-activate) | 1078 | ("calc-embed" calc-do-embedded-activate) |
| 1079 | 1079 | ||
| 1080 | ("calc-misc" | 1080 | ("calc-misc" |
| 1081 | calc-do-handle-whys calc-do-refresh calc-num-prefix-name | 1081 | calc-do-handle-whys calc-do-refresh calc-num-prefix-name |
| 1082 | calc-record-list calc-record-why calc-report-bug calc-roll-down-stack | 1082 | calc-record-list calc-record-why calc-report-bug calc-roll-down-stack |
| 1083 | calc-roll-up-stack calc-temp-minibuffer-message calcFunc-floor | 1083 | calc-roll-up-stack calc-temp-minibuffer-message calcFunc-floor |
| @@ -1087,7 +1087,7 @@ If nil, selections displayed but ignored.") | |||
| 1087 | math-negp math-posp math-pow math-read-radix-digit math-reject-arg | 1087 | math-negp math-posp math-pow math-read-radix-digit math-reject-arg |
| 1088 | math-trunc math-zerop))) | 1088 | math-trunc math-zerop))) |
| 1089 | 1089 | ||
| 1090 | (mapcar | 1090 | (mapc |
| 1091 | (lambda (x) (dolist (cmd (cdr x)) (autoload cmd (car x) nil t))) | 1091 | (lambda (x) (dolist (cmd (cdr x)) (autoload cmd (car x) nil t))) |
| 1092 | '( | 1092 | '( |
| 1093 | 1093 | ||
| @@ -1095,7 +1095,7 @@ If nil, selections displayed but ignored.") | |||
| 1095 | calcDigit-algebraic calcDigit-edit) | 1095 | calcDigit-algebraic calcDigit-edit) |
| 1096 | 1096 | ||
| 1097 | ("calc-misc" another-calc calc-big-or-small calc-dispatch-help | 1097 | ("calc-misc" another-calc calc-big-or-small calc-dispatch-help |
| 1098 | calc-help calc-info calc-info-goto-node calc-info-summary calc-inv | 1098 | calc-help calc-info calc-info-goto-node calc-info-summary calc-inv |
| 1099 | calc-last-args-stub | 1099 | calc-last-args-stub |
| 1100 | calc-missing-key calc-mod calc-other-window calc-over calc-percent | 1100 | calc-missing-key calc-mod calc-other-window calc-over calc-percent |
| 1101 | calc-pop-above calc-power calc-roll-down calc-roll-up | 1101 | calc-pop-above calc-power calc-roll-down calc-roll-up |
| @@ -1193,12 +1193,12 @@ Notations: 3.14e6 3.14 * 10^6 | |||
| 1193 | \\{calc-mode-map} | 1193 | \\{calc-mode-map} |
| 1194 | " | 1194 | " |
| 1195 | (interactive) | 1195 | (interactive) |
| 1196 | (mapcar (function | 1196 | (mapc (function |
| 1197 | (lambda (v) (set-default v (symbol-value v)))) calc-local-var-list) | 1197 | (lambda (v) (set-default v (symbol-value v)))) calc-local-var-list) |
| 1198 | (kill-all-local-variables) | 1198 | (kill-all-local-variables) |
| 1199 | (use-local-map (if (eq calc-algebraic-mode 'total) | 1199 | (use-local-map (if (eq calc-algebraic-mode 'total) |
| 1200 | (progn (require 'calc-ext) calc-alg-map) calc-mode-map)) | 1200 | (progn (require 'calc-ext) calc-alg-map) calc-mode-map)) |
| 1201 | (mapcar (function (lambda (v) (make-local-variable v))) calc-local-var-list) | 1201 | (mapc (function (lambda (v) (make-local-variable v))) calc-local-var-list) |
| 1202 | (make-local-variable 'overlay-arrow-position) | 1202 | (make-local-variable 'overlay-arrow-position) |
| 1203 | (make-local-variable 'overlay-arrow-string) | 1203 | (make-local-variable 'overlay-arrow-string) |
| 1204 | (add-hook 'change-major-mode-hook 'font-lock-defontify nil t) | 1204 | (add-hook 'change-major-mode-hook 'font-lock-defontify nil t) |
| @@ -1375,8 +1375,8 @@ commands given here will actually operate on the *Calculator* stack." | |||
| 1375 | (calc-create-buffer)) | 1375 | (calc-create-buffer)) |
| 1376 | (run-hooks 'calc-end-hook) | 1376 | (run-hooks 'calc-end-hook) |
| 1377 | (setq calc-undo-list nil calc-redo-list nil) | 1377 | (setq calc-undo-list nil calc-redo-list nil) |
| 1378 | (mapcar (function (lambda (v) (set-default v (symbol-value v)))) | 1378 | (mapc (function (lambda (v) (set-default v (symbol-value v)))) |
| 1379 | calc-local-var-list) | 1379 | calc-local-var-list) |
| 1380 | (let ((buf (current-buffer)) | 1380 | (let ((buf (current-buffer)) |
| 1381 | (win (get-buffer-window (current-buffer))) | 1381 | (win (get-buffer-window (current-buffer))) |
| 1382 | (kbuf (get-buffer "*Calc Keypad*"))) | 1382 | (kbuf (get-buffer "*Calc Keypad*"))) |
| @@ -2284,7 +2284,7 @@ See calc-keypad for details." | |||
| 2284 | 2284 | ||
| 2285 | 2285 | ||
| 2286 | 2286 | ||
| 2287 | (defconst math-bignum-digit-length | 2287 | (defconst math-bignum-digit-length |
| 2288 | (truncate (/ (log10 (/ most-positive-fixnum 2)) 2)) | 2288 | (truncate (/ (log10 (/ most-positive-fixnum 2)) 2)) |
| 2289 | "The length of a \"digit\" in Calc bignums. | 2289 | "The length of a \"digit\" in Calc bignums. |
| 2290 | If a big integer is of the form (bigpos N0 N1 ...), this is the | 2290 | If a big integer is of the form (bigpos N0 N1 ...), this is the |
| @@ -2292,11 +2292,11 @@ length of the allowable Emacs integers N0, N1,... | |||
| 2292 | The value of 2*10^(2*MATH-BIGNUM-DIGIT-LENGTH) must be less than the | 2292 | The value of 2*10^(2*MATH-BIGNUM-DIGIT-LENGTH) must be less than the |
| 2293 | largest Emacs integer.") | 2293 | largest Emacs integer.") |
| 2294 | 2294 | ||
| 2295 | (defconst math-bignum-digit-size | 2295 | (defconst math-bignum-digit-size |
| 2296 | (expt 10 math-bignum-digit-length) | 2296 | (expt 10 math-bignum-digit-length) |
| 2297 | "An upper bound for the size of the \"digit\"s in Calc bignums.") | 2297 | "An upper bound for the size of the \"digit\"s in Calc bignums.") |
| 2298 | 2298 | ||
| 2299 | (defconst math-small-integer-size | 2299 | (defconst math-small-integer-size |
| 2300 | (expt math-bignum-digit-size 2) | 2300 | (expt math-bignum-digit-size 2) |
| 2301 | "An upper bound for the size of \"small integer\"s in Calc.") | 2301 | "An upper bound for the size of \"small integer\"s in Calc.") |
| 2302 | 2302 | ||
| @@ -2307,16 +2307,16 @@ largest Emacs integer.") | |||
| 2307 | ;;; following forms: | 2307 | ;;; following forms: |
| 2308 | ;;; | 2308 | ;;; |
| 2309 | ;;; integer An integer. For normalized numbers, this format | 2309 | ;;; integer An integer. For normalized numbers, this format |
| 2310 | ;;; is used only for | 2310 | ;;; is used only for |
| 2311 | ;;; negative math-small-integer-size + 1 to | 2311 | ;;; negative math-small-integer-size + 1 to |
| 2312 | ;;; math-small-integer-size - 1 | 2312 | ;;; math-small-integer-size - 1 |
| 2313 | ;;; | 2313 | ;;; |
| 2314 | ;;; (bigpos N0 N1 N2 ...) A big positive integer, | 2314 | ;;; (bigpos N0 N1 N2 ...) A big positive integer, |
| 2315 | ;;; N0 + N1*math-bignum-digit-size | 2315 | ;;; N0 + N1*math-bignum-digit-size |
| 2316 | ;;; + N2*(math-bignum-digit-size)^2 ... | 2316 | ;;; + N2*(math-bignum-digit-size)^2 ... |
| 2317 | ;;; (bigneg N0 N1 N2 ...) A big negative integer, | 2317 | ;;; (bigneg N0 N1 N2 ...) A big negative integer, |
| 2318 | ;;; - N0 - N1*math-bignum-digit-size ... | 2318 | ;;; - N0 - N1*math-bignum-digit-size ... |
| 2319 | ;;; Each digit N is in the range | 2319 | ;;; Each digit N is in the range |
| 2320 | ;;; 0 ... math-bignum-digit-size -1. | 2320 | ;;; 0 ... math-bignum-digit-size -1. |
| 2321 | ;;; Normalized, always at least three N present, | 2321 | ;;; Normalized, always at least three N present, |
| 2322 | ;;; and the most significant N is nonzero. | 2322 | ;;; and the most significant N is nonzero. |
| @@ -2407,14 +2407,14 @@ largest Emacs integer.") | |||
| 2407 | (cond | 2407 | (cond |
| 2408 | ((not (consp math-normalize-a)) | 2408 | ((not (consp math-normalize-a)) |
| 2409 | (if (integerp math-normalize-a) | 2409 | (if (integerp math-normalize-a) |
| 2410 | (if (or (>= math-normalize-a math-small-integer-size) | 2410 | (if (or (>= math-normalize-a math-small-integer-size) |
| 2411 | (<= math-normalize-a (- math-small-integer-size))) | 2411 | (<= math-normalize-a (- math-small-integer-size))) |
| 2412 | (math-bignum math-normalize-a) | 2412 | (math-bignum math-normalize-a) |
| 2413 | math-normalize-a) | 2413 | math-normalize-a) |
| 2414 | math-normalize-a)) | 2414 | math-normalize-a)) |
| 2415 | ((eq (car math-normalize-a) 'bigpos) | 2415 | ((eq (car math-normalize-a) 'bigpos) |
| 2416 | (if (eq (nth (1- (length math-normalize-a)) math-normalize-a) 0) | 2416 | (if (eq (nth (1- (length math-normalize-a)) math-normalize-a) 0) |
| 2417 | (let* ((last (setq math-normalize-a | 2417 | (let* ((last (setq math-normalize-a |
| 2418 | (copy-sequence math-normalize-a))) (digs math-normalize-a)) | 2418 | (copy-sequence math-normalize-a))) (digs math-normalize-a)) |
| 2419 | (while (setq digs (cdr digs)) | 2419 | (while (setq digs (cdr digs)) |
| 2420 | (or (eq (car digs) 0) (setq last digs))) | 2420 | (or (eq (car digs) 0) (setq last digs))) |
| @@ -2422,14 +2422,14 @@ largest Emacs integer.") | |||
| 2422 | (if (cdr (cdr (cdr math-normalize-a))) | 2422 | (if (cdr (cdr (cdr math-normalize-a))) |
| 2423 | math-normalize-a | 2423 | math-normalize-a |
| 2424 | (cond | 2424 | (cond |
| 2425 | ((cdr (cdr math-normalize-a)) (+ (nth 1 math-normalize-a) | 2425 | ((cdr (cdr math-normalize-a)) (+ (nth 1 math-normalize-a) |
| 2426 | (* (nth 2 math-normalize-a) | 2426 | (* (nth 2 math-normalize-a) |
| 2427 | math-bignum-digit-size))) | 2427 | math-bignum-digit-size))) |
| 2428 | ((cdr math-normalize-a) (nth 1 math-normalize-a)) | 2428 | ((cdr math-normalize-a) (nth 1 math-normalize-a)) |
| 2429 | (t 0)))) | 2429 | (t 0)))) |
| 2430 | ((eq (car math-normalize-a) 'bigneg) | 2430 | ((eq (car math-normalize-a) 'bigneg) |
| 2431 | (if (eq (nth (1- (length math-normalize-a)) math-normalize-a) 0) | 2431 | (if (eq (nth (1- (length math-normalize-a)) math-normalize-a) 0) |
| 2432 | (let* ((last (setq math-normalize-a (copy-sequence math-normalize-a))) | 2432 | (let* ((last (setq math-normalize-a (copy-sequence math-normalize-a))) |
| 2433 | (digs math-normalize-a)) | 2433 | (digs math-normalize-a)) |
| 2434 | (while (setq digs (cdr digs)) | 2434 | (while (setq digs (cdr digs)) |
| 2435 | (or (eq (car digs) 0) (setq last digs))) | 2435 | (or (eq (car digs) 0) (setq last digs))) |
| @@ -2437,21 +2437,21 @@ largest Emacs integer.") | |||
| 2437 | (if (cdr (cdr (cdr math-normalize-a))) | 2437 | (if (cdr (cdr (cdr math-normalize-a))) |
| 2438 | math-normalize-a | 2438 | math-normalize-a |
| 2439 | (cond | 2439 | (cond |
| 2440 | ((cdr (cdr math-normalize-a)) (- (+ (nth 1 math-normalize-a) | 2440 | ((cdr (cdr math-normalize-a)) (- (+ (nth 1 math-normalize-a) |
| 2441 | (* (nth 2 math-normalize-a) | 2441 | (* (nth 2 math-normalize-a) |
| 2442 | math-bignum-digit-size)))) | 2442 | math-bignum-digit-size)))) |
| 2443 | ((cdr math-normalize-a) (- (nth 1 math-normalize-a))) | 2443 | ((cdr math-normalize-a) (- (nth 1 math-normalize-a))) |
| 2444 | (t 0)))) | 2444 | (t 0)))) |
| 2445 | ((eq (car math-normalize-a) 'float) | 2445 | ((eq (car math-normalize-a) 'float) |
| 2446 | (math-make-float (math-normalize (nth 1 math-normalize-a)) | 2446 | (math-make-float (math-normalize (nth 1 math-normalize-a)) |
| 2447 | (nth 2 math-normalize-a))) | 2447 | (nth 2 math-normalize-a))) |
| 2448 | ((or (memq (car math-normalize-a) | 2448 | ((or (memq (car math-normalize-a) |
| 2449 | '(frac cplx polar hms date mod sdev intv vec var quote | 2449 | '(frac cplx polar hms date mod sdev intv vec var quote |
| 2450 | special-const calcFunc-if calcFunc-lambda | 2450 | special-const calcFunc-if calcFunc-lambda |
| 2451 | calcFunc-quote calcFunc-condition | 2451 | calcFunc-quote calcFunc-condition |
| 2452 | calcFunc-evalto)) | 2452 | calcFunc-evalto)) |
| 2453 | (integerp (car math-normalize-a)) | 2453 | (integerp (car math-normalize-a)) |
| 2454 | (and (consp (car math-normalize-a)) | 2454 | (and (consp (car math-normalize-a)) |
| 2455 | (not (eq (car (car math-normalize-a)) 'lambda)))) | 2455 | (not (eq (car (car math-normalize-a)) 'lambda)))) |
| 2456 | (require 'calc-ext) | 2456 | (require 'calc-ext) |
| 2457 | (math-normalize-fancy math-normalize-a)) | 2457 | (math-normalize-fancy math-normalize-a)) |
| @@ -2461,7 +2461,7 @@ largest Emacs integer.") | |||
| 2461 | (math-normalize-nonstandard)) | 2461 | (math-normalize-nonstandard)) |
| 2462 | (let ((args (mapcar 'math-normalize (cdr math-normalize-a)))) | 2462 | (let ((args (mapcar 'math-normalize (cdr math-normalize-a)))) |
| 2463 | (or (condition-case err | 2463 | (or (condition-case err |
| 2464 | (let ((func | 2464 | (let ((func |
| 2465 | (assq (car math-normalize-a) '( ( + . math-add ) | 2465 | (assq (car math-normalize-a) '( ( + . math-add ) |
| 2466 | ( - . math-sub ) | 2466 | ( - . math-sub ) |
| 2467 | ( * . math-mul ) | 2467 | ( * . math-mul ) |
| @@ -2477,7 +2477,7 @@ largest Emacs integer.") | |||
| 2477 | (require 'calc-ext) | 2477 | (require 'calc-ext) |
| 2478 | (math-recompile-eval-rules))) | 2478 | (math-recompile-eval-rules))) |
| 2479 | (and (or math-eval-rules-cache-other | 2479 | (and (or math-eval-rules-cache-other |
| 2480 | (assq (car math-normalize-a) | 2480 | (assq (car math-normalize-a) |
| 2481 | math-eval-rules-cache)) | 2481 | math-eval-rules-cache)) |
| 2482 | (math-apply-rewrites | 2482 | (math-apply-rewrites |
| 2483 | (cons (car math-normalize-a) args) | 2483 | (cons (car math-normalize-a) args) |
| @@ -2496,12 +2496,12 @@ largest Emacs integer.") | |||
| 2496 | (cons (car math-normalize-a) args)) | 2496 | (cons (car math-normalize-a) args)) |
| 2497 | nil) | 2497 | nil) |
| 2498 | (wrong-type-argument | 2498 | (wrong-type-argument |
| 2499 | (or calc-next-why | 2499 | (or calc-next-why |
| 2500 | (calc-record-why "Wrong type of argument" | 2500 | (calc-record-why "Wrong type of argument" |
| 2501 | (cons (car math-normalize-a) args))) | 2501 | (cons (car math-normalize-a) args))) |
| 2502 | nil) | 2502 | nil) |
| 2503 | (args-out-of-range | 2503 | (args-out-of-range |
| 2504 | (calc-record-why "*Argument out of range" | 2504 | (calc-record-why "*Argument out of range" |
| 2505 | (cons (car math-normalize-a) args)) | 2505 | (cons (car math-normalize-a) args)) |
| 2506 | nil) | 2506 | nil) |
| 2507 | (inexact-result | 2507 | (inexact-result |
| @@ -2559,7 +2559,7 @@ largest Emacs integer.") | |||
| 2559 | (defun math-bignum-big (a) ; [L s] | 2559 | (defun math-bignum-big (a) ; [L s] |
| 2560 | (if (= a 0) | 2560 | (if (= a 0) |
| 2561 | nil | 2561 | nil |
| 2562 | (cons (% a math-bignum-digit-size) | 2562 | (cons (% a math-bignum-digit-size) |
| 2563 | (math-bignum-big (/ a math-bignum-digit-size))))) | 2563 | (math-bignum-big (/ a math-bignum-digit-size))))) |
| 2564 | 2564 | ||
| 2565 | 2565 | ||
| @@ -2595,7 +2595,7 @@ largest Emacs integer.") | |||
| 2595 | 2595 | ||
| 2596 | (defun math-div10-bignum (a) ; [l l] | 2596 | (defun math-div10-bignum (a) ; [l l] |
| 2597 | (if (cdr a) | 2597 | (if (cdr a) |
| 2598 | (cons (+ (/ (car a) 10) (* (% (nth 1 a) 10) | 2598 | (cons (+ (/ (car a) 10) (* (% (nth 1 a) 10) |
| 2599 | (expt 10 (1- math-bignum-digit-length)))) | 2599 | (expt 10 (1- math-bignum-digit-length)))) |
| 2600 | (math-div10-bignum (cdr a))) | 2600 | (math-div10-bignum (cdr a))) |
| 2601 | (list (/ (car a) 10)))) | 2601 | (list (/ (car a) 10)))) |
| @@ -2649,10 +2649,10 @@ largest Emacs integer.") | |||
| 2649 | (if (consp a) | 2649 | (if (consp a) |
| 2650 | (cons (car a) (math-scale-left-bignum (cdr a) n)) | 2650 | (cons (car a) (math-scale-left-bignum (cdr a) n)) |
| 2651 | (if (>= n math-bignum-digit-length) | 2651 | (if (>= n math-bignum-digit-length) |
| 2652 | (if (or (>= a math-bignum-digit-size) | 2652 | (if (or (>= a math-bignum-digit-size) |
| 2653 | (<= a (- math-bignum-digit-size))) | 2653 | (<= a (- math-bignum-digit-size))) |
| 2654 | (math-scale-left (math-bignum a) n) | 2654 | (math-scale-left (math-bignum a) n) |
| 2655 | (math-scale-left (* a math-bignum-digit-size) | 2655 | (math-scale-left (* a math-bignum-digit-size) |
| 2656 | (- n math-bignum-digit-length))) | 2656 | (- n math-bignum-digit-length))) |
| 2657 | (let ((sz (expt 10 (- (* 2 math-bignum-digit-length) n)))) | 2657 | (let ((sz (expt 10 (- (* 2 math-bignum-digit-length) n)))) |
| 2658 | (if (or (>= a sz) (<= a (- sz))) | 2658 | (if (or (>= a sz) (<= a (- sz))) |
| @@ -2662,7 +2662,7 @@ largest Emacs integer.") | |||
| 2662 | (defun math-scale-left-bignum (a n) | 2662 | (defun math-scale-left-bignum (a n) |
| 2663 | (if (>= n math-bignum-digit-length) | 2663 | (if (>= n math-bignum-digit-length) |
| 2664 | (while (>= (setq a (cons 0 a) | 2664 | (while (>= (setq a (cons 0 a) |
| 2665 | n (- n math-bignum-digit-length)) | 2665 | n (- n math-bignum-digit-length)) |
| 2666 | math-bignum-digit-length))) | 2666 | math-bignum-digit-length))) |
| 2667 | (if (> n 0) | 2667 | (if (> n 0) |
| 2668 | (math-mul-bignum-digit a (expt 10 n) 0) | 2668 | (math-mul-bignum-digit a (expt 10 n) 0) |
| @@ -2679,7 +2679,7 @@ largest Emacs integer.") | |||
| 2679 | (- (math-scale-right (- a) n))) | 2679 | (- (math-scale-right (- a) n))) |
| 2680 | (if (>= n math-bignum-digit-length) | 2680 | (if (>= n math-bignum-digit-length) |
| 2681 | (while (and (> (setq a (/ a math-bignum-digit-size)) 0) | 2681 | (while (and (> (setq a (/ a math-bignum-digit-size)) 0) |
| 2682 | (>= (setq n (- n math-bignum-digit-length)) | 2682 | (>= (setq n (- n math-bignum-digit-length)) |
| 2683 | math-bignum-digit-length)))) | 2683 | math-bignum-digit-length)))) |
| 2684 | (if (> n 0) | 2684 | (if (> n 0) |
| 2685 | (/ a (expt 10 n)) | 2685 | (/ a (expt 10 n)) |
| @@ -2701,12 +2701,12 @@ largest Emacs integer.") | |||
| 2701 | (math-normalize | 2701 | (math-normalize |
| 2702 | (cons (car a) | 2702 | (cons (car a) |
| 2703 | (let ((val (if (< n (- math-bignum-digit-length)) | 2703 | (let ((val (if (< n (- math-bignum-digit-length)) |
| 2704 | (math-scale-right-bignum | 2704 | (math-scale-right-bignum |
| 2705 | (cdr a) | 2705 | (cdr a) |
| 2706 | (- (- math-bignum-digit-length) n)) | 2706 | (- (- math-bignum-digit-length) n)) |
| 2707 | (if (< n 0) | 2707 | (if (< n 0) |
| 2708 | (math-mul-bignum-digit | 2708 | (math-mul-bignum-digit |
| 2709 | (cdr a) | 2709 | (cdr a) |
| 2710 | (expt 10 (+ math-bignum-digit-length n)) 0) | 2710 | (expt 10 (+ math-bignum-digit-length n)) 0) |
| 2711 | (cdr a))))) ; n = -math-bignum-digit-length | 2711 | (cdr a))))) ; n = -math-bignum-digit-length |
| 2712 | (if (and val (>= (car val) (/ math-bignum-digit-size 2))) | 2712 | (if (and val (>= (car val) (/ math-bignum-digit-size 2))) |
| @@ -2779,7 +2779,7 @@ largest Emacs integer.") | |||
| 2779 | (let* ((a (copy-sequence a)) (aa a) (carry nil) sum) | 2779 | (let* ((a (copy-sequence a)) (aa a) (carry nil) sum) |
| 2780 | (while (and aa b) | 2780 | (while (and aa b) |
| 2781 | (if carry | 2781 | (if carry |
| 2782 | (if (< (setq sum (+ (car aa) (car b))) | 2782 | (if (< (setq sum (+ (car aa) (car b))) |
| 2783 | (1- math-bignum-digit-size)) | 2783 | (1- math-bignum-digit-size)) |
| 2784 | (progn | 2784 | (progn |
| 2785 | (setcar aa (1+ sum)) | 2785 | (setcar aa (1+ sum)) |
| @@ -2895,7 +2895,7 @@ largest Emacs integer.") | |||
| 2895 | (defun math-mul (a b) | 2895 | (defun math-mul (a b) |
| 2896 | (or | 2896 | (or |
| 2897 | (and (not (consp a)) (not (consp b)) | 2897 | (and (not (consp a)) (not (consp b)) |
| 2898 | (< a math-bignum-digit-size) (> a (- math-bignum-digit-size)) | 2898 | (< a math-bignum-digit-size) (> a (- math-bignum-digit-size)) |
| 2899 | (< b math-bignum-digit-size) (> b (- math-bignum-digit-size)) | 2899 | (< b math-bignum-digit-size) (> b (- math-bignum-digit-size)) |
| 2900 | (* a b)) | 2900 | (* a b)) |
| 2901 | (and (Math-zerop a) (not (eq (car-safe b) 'mod)) | 2901 | (and (Math-zerop a) (not (eq (car-safe b) 'mod)) |
| @@ -2982,8 +2982,8 @@ largest Emacs integer.") | |||
| 2982 | (and (= d 1) a) | 2982 | (and (= d 1) a) |
| 2983 | (let* ((a (copy-sequence a)) (aa a) prod) | 2983 | (let* ((a (copy-sequence a)) (aa a) prod) |
| 2984 | (while (progn | 2984 | (while (progn |
| 2985 | (setcar aa | 2985 | (setcar aa |
| 2986 | (% (setq prod (+ (* (car aa) d) c)) | 2986 | (% (setq prod (+ (* (car aa) d) c)) |
| 2987 | math-bignum-digit-size)) | 2987 | math-bignum-digit-size)) |
| 2988 | (cdr aa)) | 2988 | (cdr aa)) |
| 2989 | (setq aa (cdr aa) | 2989 | (setq aa (cdr aa) |
| @@ -3076,7 +3076,7 @@ largest Emacs integer.") | |||
| 3076 | (cdr res2))))) | 3076 | (cdr res2))))) |
| 3077 | 3077 | ||
| 3078 | (defun math-div-bignum-part (a b blen) ; a < b*math-bignum-digit-size [D.l l L] | 3078 | (defun math-div-bignum-part (a b blen) ; a < b*math-bignum-digit-size [D.l l L] |
| 3079 | (let* ((num (+ (* (or (nth blen a) 0) math-bignum-digit-size) | 3079 | (let* ((num (+ (* (or (nth blen a) 0) math-bignum-digit-size) |
| 3080 | (or (nth (1- blen) a) 0))) | 3080 | (or (nth (1- blen) a) 0))) |
| 3081 | (den (nth (1- blen) b)) | 3081 | (den (nth (1- blen) b)) |
| 3082 | (guess (min (/ num den) (1- math-bignum-digit-size)))) | 3082 | (guess (min (/ num den) (1- math-bignum-digit-size)))) |
| @@ -3390,14 +3390,14 @@ largest Emacs integer.") | |||
| 3390 | (if a | 3390 | (if a |
| 3391 | (let ((s "")) | 3391 | (let ((s "")) |
| 3392 | (while (cdr (cdr a)) | 3392 | (while (cdr (cdr a)) |
| 3393 | (setq s (concat | 3393 | (setq s (concat |
| 3394 | (format | 3394 | (format |
| 3395 | (concat "%0" | 3395 | (concat "%0" |
| 3396 | (number-to-string (* 2 math-bignum-digit-length)) | 3396 | (number-to-string (* 2 math-bignum-digit-length)) |
| 3397 | "d") | 3397 | "d") |
| 3398 | (+ (* (nth 1 a) math-bignum-digit-size) (car a))) s) | 3398 | (+ (* (nth 1 a) math-bignum-digit-size) (car a))) s) |
| 3399 | a (cdr (cdr a)))) | 3399 | a (cdr (cdr a)))) |
| 3400 | (concat (int-to-string | 3400 | (concat (int-to-string |
| 3401 | (+ (* (or (nth 1 a) 0) math-bignum-digit-size) (car a))) s)) | 3401 | (+ (* (or (nth 1 a) 0) math-bignum-digit-size) (car a))) s)) |
| 3402 | "0")) | 3402 | "0")) |
| 3403 | 3403 | ||