summaryrefslogtreecommitdiff
path: root/lisp/calc/calc-ext.el
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-03-17 05:17:24 -0600
committerTom Tromey <tromey@redhat.com>2013-03-17 05:17:24 -0600
commit6bd488cd8d05aa3983ca55f70ee384732d8c0085 (patch)
tree5645fc7b882638d6c0eb3f61fd55bde1a63fc190 /lisp/calc/calc-ext.el
parent71f91792e3013b397996905224f387da5cc539a9 (diff)
parent9c44569ea2a18099307e0571d523d8637000a153 (diff)
downloademacs-6bd488cd8d05aa3983ca55f70ee384732d8c0085.tar.gz
merge from trunk
Diffstat (limited to 'lisp/calc/calc-ext.el')
-rw-r--r--lisp/calc/calc-ext.el88
1 files changed, 44 insertions, 44 deletions
diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el
index 57de072fdc7..2cb5bf450d5 100644
--- a/lisp/calc/calc-ext.el
+++ b/lisp/calc/calc-ext.el
@@ -2945,50 +2945,6 @@ If X is not an error form, return 1."
(and x sigma (math-scalarp x) (math-anglep sigma)
(list 'sdev x sigma))))
- ;; Hours (or degrees)
- ((or (string-match "^\\([^#^]+\\)[@oOhH]\\(.*\\)$" s)
- (string-match "^\\([^#^]+\\)[dD][eE]?[gG]?\\(.*\\)$" s))
- (let* ((hours (math-match-substring s 1))
- (minsec (math-match-substring s 2))
- (hours (math-read-number hours))
- (minsec (if (> (length minsec) 0) (math-read-number minsec) 0)))
- (and hours minsec
- (math-num-integerp hours)
- (not (math-negp hours)) (not (math-negp minsec))
- (cond ((math-num-integerp minsec)
- (and (Math-lessp minsec 60)
- (list 'hms hours minsec 0)))
- ((and (eq (car-safe minsec) 'hms)
- (math-zerop (nth 1 minsec)))
- (math-add (list 'hms hours 0 0) minsec))
- (t nil)))))
-
- ;; Minutes
- ((string-match "^\\([^'#^]+\\)[mM']\\(.*\\)$" s)
- (let* ((minutes (math-match-substring s 1))
- (seconds (math-match-substring s 2))
- (minutes (math-read-number minutes))
- (seconds (if (> (length seconds) 0) (math-read-number seconds) 0)))
- (and minutes seconds
- (math-num-integerp minutes)
- (not (math-negp minutes)) (not (math-negp seconds))
- (cond ((math-realp seconds)
- (and (Math-lessp minutes 60)
- (list 'hms 0 minutes seconds)))
- ((and (eq (car-safe seconds) 'hms)
- (math-zerop (nth 1 seconds))
- (math-zerop (nth 2 seconds)))
- (math-add (list 'hms 0 minutes 0) seconds))
- (t nil)))))
-
- ;; Seconds
- ((string-match "^\\([^\"#^]+\\)[sS\"]$" s)
- (let ((seconds (math-read-number (math-match-substring s 1))))
- (and seconds (math-realp seconds)
- (not (math-negp seconds))
- (Math-lessp seconds 60)
- (list 'hms 0 0 seconds))))
-
;; Integer+fraction with explicit radix
((string-match "^\\([0-9]+\\)\\(#\\|\\^\\^\\)\\([0-9a-zA-Z]*\\)[:/]\\([0-9a-zA-Z]*\\)[:/]\\([0-9a-zA-Z]\\)$" s)
(let ((radix (string-to-number (math-match-substring s 1)))
@@ -3061,6 +3017,50 @@ If X is not an error form, return 1."
(let ((digs (math-match-substring s 1)))
(math-read-radix digs 16)))
+ ;; Hours (or degrees)
+ ((or (string-match "^\\([^#^]+\\)[@oOhH]\\(.*\\)$" s)
+ (string-match "^\\([^#^]+\\)[dD][eE]?[gG]?\\(.*\\)$" s))
+ (let* ((hours (math-match-substring s 1))
+ (minsec (math-match-substring s 2))
+ (hours (math-read-number hours))
+ (minsec (if (> (length minsec) 0) (math-read-number minsec) 0)))
+ (and hours minsec
+ (math-num-integerp hours)
+ (not (math-negp hours)) (not (math-negp minsec))
+ (cond ((math-num-integerp minsec)
+ (and (Math-lessp minsec 60)
+ (list 'hms hours minsec 0)))
+ ((and (eq (car-safe minsec) 'hms)
+ (math-zerop (nth 1 minsec)))
+ (math-add (list 'hms hours 0 0) minsec))
+ (t nil)))))
+
+ ;; Minutes
+ ((string-match "^\\([^'#^]+\\)[mM']\\(.*\\)$" s)
+ (let* ((minutes (math-match-substring s 1))
+ (seconds (math-match-substring s 2))
+ (minutes (math-read-number minutes))
+ (seconds (if (> (length seconds) 0) (math-read-number seconds) 0)))
+ (and minutes seconds
+ (math-num-integerp minutes)
+ (not (math-negp minutes)) (not (math-negp seconds))
+ (cond ((math-realp seconds)
+ (and (Math-lessp minutes 60)
+ (list 'hms 0 minutes seconds)))
+ ((and (eq (car-safe seconds) 'hms)
+ (math-zerop (nth 1 seconds))
+ (math-zerop (nth 2 seconds)))
+ (math-add (list 'hms 0 minutes 0) seconds))
+ (t nil)))))
+
+ ;; Seconds
+ ((string-match "^\\([^\"#^]+\\)[sS\"]$" s)
+ (let ((seconds (math-read-number (math-match-substring s 1))))
+ (and seconds (math-realp seconds)
+ (not (math-negp seconds))
+ (Math-lessp seconds 60)
+ (list 'hms 0 0 seconds))))
+
;; Fraction using "/" instead of ":"
((string-match "^\\([0-9]+\\)/\\([0-9/]+\\)$" s)
(math-read-number (concat (math-match-substring s 1) ":"