/[emacs]/emacs/lisp/calc/calc-forms.el
ViewVC logotype

Diff of /emacs/lisp/calc/calc-forms.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.13 by wl, Fri Mar 25 08:16:06 2005 UTC revision 1.14 by jpb, Mon May 2 19:42:52 2005 UTC
# Line 39  Line 39 
39       (calc-enter-result 0 "time"       (calc-enter-result 0 "time"
40                          (list 'mod                          (list 'mod
41                                (list 'hms                                (list 'hms
42                                      (string-to-int (substring time 11 13))                                      (string-to-number (substring time 11 13))
43                                      (string-to-int (substring time 14 16))                                      (string-to-number (substring time 14 16))
44                                      (string-to-int (substring time 17 19)))                                      (string-to-number (substring time 17 19)))
45                                (list 'hms 24 0 0))))))                                (list 'hms 24 0 0))))))
46    
47  (defun calc-to-hms (arg)  (defun calc-to-hms (arg)
# Line 80  Line 80 
80     (if (equal fmt "")     (if (equal fmt "")
81         (setq fmt "1"))         (setq fmt "1"))
82     (if (string-match "\\` *[0-9] *\\'" fmt)     (if (string-match "\\` *[0-9] *\\'" fmt)
83         (setq fmt (nth (string-to-int fmt) calc-standard-date-formats)))         (setq fmt (nth (string-to-number fmt) calc-standard-date-formats)))
84     (or (string-match "[a-zA-Z]" fmt)     (or (string-match "[a-zA-Z]" fmt)
85         (error "Bad date format specifier"))         (error "Bad date format specifier"))
86     (and arg     (and arg
# Line 441  Line 441 
441    
442    
443  (defun math-this-year ()  (defun math-this-year ()
444    (string-to-int (substring (current-time-string) -4)))    (string-to-number (substring (current-time-string) -4)))
445    
446  (defun math-leap-year-p (year)  (defun math-leap-year-p (year)
447    (if (Math-lessp year 1752)    (if (Math-lessp year 1752)
# Line 730  Line 730 
730            (if (or (string-match "\\([0-9][0-9]?\\):\\([0-9][0-9]?\\)\\(:\\([0-9][0-9]?\\(\\.[0-9]+\\)?\\)\\)? *\\([ap]m?\\|[ap]\\. *m\\.\\|noon\\|n\\>\\|midnight\\|mid\\>\\|m\\>\\)?" math-pd-str)            (if (or (string-match "\\([0-9][0-9]?\\):\\([0-9][0-9]?\\)\\(:\\([0-9][0-9]?\\(\\.[0-9]+\\)?\\)\\)? *\\([ap]m?\\|[ap]\\. *m\\.\\|noon\\|n\\>\\|midnight\\|mid\\>\\|m\\>\\)?" math-pd-str)
731                    (string-match "\\([0-9][0-9]?\\)\\(\\)\\(\\(\\(\\)\\)\\) *\\([ap]m?\\|[ap]\\. *m\\.\\|noon\\|n\\>\\|midnight\\|mid\\>\\|m\\>\\)" math-pd-str))                    (string-match "\\([0-9][0-9]?\\)\\(\\)\\(\\(\\(\\)\\)\\) *\\([ap]m?\\|[ap]\\. *m\\.\\|noon\\|n\\>\\|midnight\\|mid\\>\\|m\\>\\)" math-pd-str))
732                (let ((ampm (math-match-substring math-pd-str 6)))                (let ((ampm (math-match-substring math-pd-str 6)))
733                  (setq hour (string-to-int (math-match-substring math-pd-str 1))                  (setq hour (string-to-number (math-match-substring math-pd-str 1))
734                        minute (math-match-substring math-pd-str 2)                        minute (math-match-substring math-pd-str 2)
735                        second (math-match-substring math-pd-str 4)                        second (math-match-substring math-pd-str 4)
736                        math-pd-str (concat (substring math-pd-str 0 (match-beginning 0))                        math-pd-str (concat (substring math-pd-str 0 (match-beginning 0))
737                                    (substring math-pd-str (match-end 0))))                                    (substring math-pd-str (match-end 0))))
738                  (if (equal minute "")                  (if (equal minute "")
739                      (setq minute 0)                      (setq minute 0)
740                    (setq minute (string-to-int minute)))                    (setq minute (string-to-number minute)))
741                  (if (equal second "")                  (if (equal second "")
742                      (setq second 0)                      (setq second 0)
743                    (setq second (math-read-number second)))                    (setq second (math-read-number second)))
# Line 801  Line 801 
801            (setq temp 0)            (setq temp 0)
802            (while (string-match "[0-9]+" math-pd-str temp)            (while (string-match "[0-9]+" math-pd-str temp)
803              (and c (throw 'syntax "Too many numbers in date"))              (and c (throw 'syntax "Too many numbers in date"))
804              (setq c (string-to-int (math-match-substring math-pd-str 0)))              (setq c (string-to-number (math-match-substring math-pd-str 0)))
805              (or b (setq b c c nil))              (or b (setq b c c nil))
806              (or a (setq a b b nil))              (or a (setq a b b nil))
807              (setq temp (match-end 0)))              (setq temp (match-end 0)))
# Line 1021  Line 1021 
1021                                    (string-match "\\` *[0-9][0-9][0-9]" math-pd-str)                                    (string-match "\\` *[0-9][0-9][0-9]" math-pd-str)
1022                                  (string-match "\\` *[0-9][0-9]" math-pd-str))                                  (string-match "\\` *[0-9][0-9]" math-pd-str))
1023                              (string-match "\\` *[0-9]+" math-pd-str)))                              (string-match "\\` *[0-9]+" math-pd-str)))
1024                       (and (setq num (string-to-int                       (and (setq num (string-to-number
1025                                       (math-match-substring math-pd-str 0))                                       (math-match-substring math-pd-str 0))
1026                                  math-pd-str (substring math-pd-str (match-end 0)))                                  math-pd-str (substring math-pd-str (match-end 0)))
1027                            nil))                            nil))
# Line 1236  Line 1236 
1236                (setq p (cdr p))))                (setq p (cdr p))))
1237            (if (looking-at "\\([-+][0-9]?[0-9]\\)\\([0-9][0-9]\\)?\\(\\'\\|[^0-9]\\)")            (if (looking-at "\\([-+][0-9]?[0-9]\\)\\([0-9][0-9]\\)?\\(\\'\\|[^0-9]\\)")
1238                (setq offset (math-add                (setq offset (math-add
1239                              (string-to-int (buffer-substring                              (string-to-number (buffer-substring
1240                                              (match-beginning 1)                                              (match-beginning 1)
1241                                              (match-end 1)))                                              (match-end 1)))
1242                              (if (match-beginning 2)                              (if (match-beginning 2)
1243                                  (math-div (string-to-int (buffer-substring                                  (math-div (string-to-number (buffer-substring
1244                                                            (match-beginning 2)                                                               (match-beginning 2)
1245                                                            (match-end 2)))                                                               (match-end 2)))
1246                                            60)                                            60)
1247                                0)))))                                0)))))
1248          (if p          (if p

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26