3 |
;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002 Free Software Foundation, Inc. |
;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002 Free Software Foundation, Inc. |
4 |
|
|
5 |
;; Author: David Gillespie <daveg@synaptics.com> |
;; Author: David Gillespie <daveg@synaptics.com> |
6 |
;; Maintainer: Colin Walters <walters@debian.org> |
;; Maintainers: D. Goel <deego@gnufans.org> |
7 |
|
;; Colin Walters <walters@debian.org> |
8 |
|
|
9 |
;; This file is part of GNU Emacs. |
;; This file is part of GNU Emacs. |
10 |
|
|
660 |
(define-key calc-alg-map "\e\C-m" 'calc-last-args-stub) |
(define-key calc-alg-map "\e\C-m" 'calc-last-args-stub) |
661 |
(define-key calc-alg-map "\e\177" 'calc-pop-above) |
(define-key calc-alg-map "\e\177" 'calc-pop-above) |
662 |
)) |
)) |
663 |
|
|
664 |
;; The following is a relic for backward compatability only. |
;; The following is a relic for backward compatability only. |
665 |
;; The calc-define property list is now the recommended method. |
;; The calc-define property list is now the recommended method. |
666 |
(if (and (boundp 'calc-ext-defs) |
(if (and (boundp 'calc-ext-defs) |
1289 |
calc-mode-var-list)) |
calc-mode-var-list)) |
1290 |
(calc-set-language nil nil t) |
(calc-set-language nil nil t) |
1291 |
(calc-mode) |
(calc-mode) |
1292 |
(let ((executing-kbd-macro "")) ; inhibit message |
(calc-flush-caches t) |
|
(calc-flush-caches)) |
|
1293 |
(run-hooks 'calc-reset-hook)) |
(run-hooks 'calc-reset-hook)) |
1294 |
(calc-wrapper |
(calc-wrapper |
1295 |
(let ((win (get-buffer-window (current-buffer)))) |
(let ((win (get-buffer-window (current-buffer)))) |
1486 |
(calc-refresh-evaltos)) |
(calc-refresh-evaltos)) |
1487 |
(and (eq calc-mode-save-mode 'save) |
(and (eq calc-mode-save-mode 'save) |
1488 |
(not (equal var '(calc-mode-save-mode))) |
(not (equal var '(calc-mode-save-mode))) |
1489 |
(calc-save-modes t)))) |
(calc-save-modes)))) |
1490 |
(if calc-embedded-info (calc-embedded-modes-change var)) |
(if calc-embedded-info (calc-embedded-modes-change var)) |
1491 |
(symbol-value (car var))))) |
(symbol-value (car var))))) |
1492 |
|
|
1631 |
( * ( * ) ( * ) ) |
( * ( * ) ( * ) ) |
1632 |
( / ( / ) ( ) ) |
( / ( / ) ( ) ) |
1633 |
( | ( | ) ( | ) ) |
( | ( | ) ( | ) ) |
1634 |
( calcFunc-land ( calcFunc-land ) |
( calcFunc-land ( calcFunc-land ) |
1635 |
( calcFunc-land ) ) |
( calcFunc-land ) ) |
1636 |
( calcFunc-lor ( calcFunc-lor ) |
( calcFunc-lor ( calcFunc-lor ) |
1637 |
( calcFunc-lor ) ) )) |
( calcFunc-lor ) ) )) |
1638 |
|
|
1639 |
|
|
2725 |
(math-integerp int) (math-integerp num) (math-integerp den) |
(math-integerp int) (math-integerp num) (math-integerp den) |
2726 |
(not (math-zerop den)) |
(not (math-zerop den)) |
2727 |
(list 'frac (math-add num (math-mul int den)) den))))) |
(list 'frac (math-add num (math-mul int den)) den))))) |
2728 |
|
|
2729 |
;; Fractions |
;; Fractions |
2730 |
((string-match "^\\([0-9]*\\)[:/]\\([0-9]*\\)$" s) |
((string-match "^\\([0-9]*\\)[:/]\\([0-9]*\\)$" s) |
2731 |
(let ((num (math-match-substring s 1)) |
(let ((num (math-match-substring s 1)) |
2735 |
(and num den (math-integerp num) (math-integerp den) |
(and num den (math-integerp num) (math-integerp den) |
2736 |
(not (math-zerop den)) |
(not (math-zerop den)) |
2737 |
(list 'frac num den))))) |
(list 'frac num den))))) |
2738 |
|
|
2739 |
;; Modulo forms |
;; Modulo forms |
2740 |
((string-match "^\\(.*\\) *mod *\\(.*\\)$" s) |
((string-match "^\\(.*\\) *mod *\\(.*\\)$" s) |
2741 |
(let* ((n (math-match-substring s 1)) |
(let* ((n (math-match-substring s 1)) |
2771 |
(math-zerop (nth 1 minsec))) |
(math-zerop (nth 1 minsec))) |
2772 |
(math-add (list 'hms hours 0 0) minsec)) |
(math-add (list 'hms hours 0 0) minsec)) |
2773 |
(t nil))))) |
(t nil))))) |
2774 |
|
|
2775 |
;; Minutes |
;; Minutes |
2776 |
((string-match "^\\([^'#^]+\\)[mM']\\(.*\\)$" s) |
((string-match "^\\([^'#^]+\\)[mM']\\(.*\\)$" s) |
2777 |
(let* ((minutes (math-match-substring s 1)) |
(let* ((minutes (math-match-substring s 1)) |
2789 |
(math-zerop (nth 2 seconds))) |
(math-zerop (nth 2 seconds))) |
2790 |
(math-add (list 'hms 0 minutes 0) seconds)) |
(math-add (list 'hms 0 minutes 0) seconds)) |
2791 |
(t nil))))) |
(t nil))))) |
2792 |
|
|
2793 |
;; Seconds |
;; Seconds |
2794 |
((string-match "^\\([^\"#^]+\\)[sS\"]$" s) |
((string-match "^\\([^\"#^]+\\)[sS\"]$" s) |
2795 |
(let ((seconds (math-read-number (math-match-substring s 1)))) |
(let ((seconds (math-read-number (math-match-substring s 1)))) |
2797 |
(not (math-negp seconds)) |
(not (math-negp seconds)) |
2798 |
(Math-lessp seconds 60) |
(Math-lessp seconds 60) |
2799 |
(list 'hms 0 0 seconds)))) |
(list 'hms 0 0 seconds)))) |
2800 |
|
|
2801 |
;; Integer+fraction with explicit radix |
;; Integer+fraction with explicit radix |
2802 |
((string-match "^\\([0-9]+\\)\\(#\\|\\^\\^\\)\\([0-9a-zA-Z]*\\)[:/]\\([0-9a-zA-Z]*\\)[:/]\\([0-9a-zA-Z]\\)$" s) |
((string-match "^\\([0-9]+\\)\\(#\\|\\^\\^\\)\\([0-9a-zA-Z]*\\)[:/]\\([0-9a-zA-Z]*\\)[:/]\\([0-9a-zA-Z]\\)$" s) |
2803 |
(let ((radix (string-to-int (math-match-substring s 1))) |
(let ((radix (string-to-int (math-match-substring s 1))) |
2811 |
(list 'frac |
(list 'frac |
2812 |
(math-add num (math-mul int den)) |
(math-add num (math-mul int den)) |
2813 |
den))))) |
den))))) |
2814 |
|
|
2815 |
;; Fraction with explicit radix |
;; Fraction with explicit radix |
2816 |
((string-match "^\\([0-9]+\\)\\(#\\|\\^\\^\\)\\([0-9a-zA-Z]*\\)[:/]\\([0-9a-zA-Z]*\\)$" s) |
((string-match "^\\([0-9]+\\)\\(#\\|\\^\\^\\)\\([0-9a-zA-Z]*\\)[:/]\\([0-9a-zA-Z]*\\)$" s) |
2817 |
(let ((radix (string-to-int (math-match-substring s 1))) |
(let ((radix (string-to-int (math-match-substring s 1))) |
2820 |
(let ((num (if (> (length num) 0) (math-read-radix num radix) 1)) |
(let ((num (if (> (length num) 0) (math-read-radix num radix) 1)) |
2821 |
(den (if (> (length den) 0) (math-read-radix den radix) 1))) |
(den (if (> (length den) 0) (math-read-radix den radix) 1))) |
2822 |
(and num den (not (math-zerop den)) (list 'frac num den))))) |
(and num den (not (math-zerop den)) (list 'frac num den))))) |
2823 |
|
|
2824 |
;; Float with explicit radix and exponent |
;; Float with explicit radix and exponent |
2825 |
((or (string-match "^0*\\(\\([2-9]\\|1[0-4]\\)\\(#\\|\\^\\^\\)[0-9a-dA-D.]+\\)[eE]\\([-+]?[0-9]+\\)$" s) |
((or (string-match "^0*\\(\\([2-9]\\|1[0-4]\\)\\(#\\|\\^\\^\\)[0-9a-dA-D.]+\\)[eE]\\([-+]?[0-9]+\\)$" s) |
2826 |
(string-match "^\\(\\([0-9]+\\)\\(#\\|\\^\\^\\)[0-9a-zA-Z.]+\\) *\\* *\\2\\.? *\\^ *\\([-+]?[0-9]+\\)$" s)) |
(string-match "^\\(\\([0-9]+\\)\\(#\\|\\^\\^\\)[0-9a-zA-Z.]+\\) *\\* *\\2\\.? *\\^ *\\([-+]?[0-9]+\\)$" s)) |
2827 |
(let ((radix (string-to-int (math-match-substring s 2))) |
(let ((radix (string-to-int (math-match-substring s 2))) |
2828 |
(mant (math-match-substring s 1)) |
(mant (math-match-substring s 1)) |
2829 |
(exp (math-match-substring s 4))) |
(exp (math-match-substring s 4))) |
2830 |
(let ((mant (math-read-number mant)) |
(let ((mant (math-read-number mant)) |