[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/subr.el
From: |
Kim F . Storm |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/subr.el |
Date: |
Fri, 26 Aug 2005 08:31:55 -0400 |
Index: emacs/lisp/subr.el
diff -c emacs/lisp/subr.el:1.477 emacs/lisp/subr.el:1.478
*** emacs/lisp/subr.el:1.477 Thu Aug 25 10:57:38 2005
--- emacs/lisp/subr.el Fri Aug 26 12:31:55 2005
***************
*** 2851,2858 ****
(setq ,(car spec) (1+ ,(car spec)))))
(progress-reporter-done ,temp2)
nil ,@(cdr (cdr spec)))))
! ;;;; Integer list & Version funs.
(defvar version-separator "."
"*Specify the string used to separate the version elements.
--- 2851,2859 ----
(setq ,(car spec) (1+ ,(car spec)))))
(progress-reporter-done ,temp2)
nil ,@(cdr (cdr spec)))))
+
! ;;;; Compare Version Strings
(defvar version-separator "."
"*Specify the string used to separate the version elements.
***************
*** 2952,2958 ****
(nreverse lst)))))
! (defun integer-list-< (l1 l2)
"Return t if integer list L1 is lesser than L2.
Note that integer list (1) is equal to (1 0), (1 0 0), (1 0 0 0),
--- 2953,2959 ----
(nreverse lst)))))
! (defun version-list-< (l1 l2)
"Return t if integer list L1 is lesser than L2.
Note that integer list (1) is equal to (1 0), (1 0 0), (1 0 0 0),
***************
*** 2968,2979 ****
;; l1 null and l2 null ==> l1 length = l2 length
((and (null l1) (null l2)) nil)
;; l1 not null and l2 null ==> l1 length > l2 length
! (l1 (< (integer-list-not-zero l1) 0))
;; l1 null and l2 not null ==> l2 length > l1 length
! (t (< 0 (integer-list-not-zero l2)))))
! (defun integer-list-= (l1 l2)
"Return t if integer list L1 is equal to L2.
Note that integer list (1) is equal to (1 0), (1 0 0), (1 0 0 0),
--- 2969,2980 ----
;; l1 null and l2 null ==> l1 length = l2 length
((and (null l1) (null l2)) nil)
;; l1 not null and l2 null ==> l1 length > l2 length
! (l1 (< (version-list-not-zero l1) 0))
;; l1 null and l2 not null ==> l2 length > l1 length
! (t (< 0 (version-list-not-zero l2)))))
! (defun version-list-= (l1 l2)
"Return t if integer list L1 is equal to L2.
Note that integer list (1) is equal to (1 0), (1 0 0), (1 0 0 0),
***************
*** 2989,3000 ****
;; l1 null and l2 null ==> l1 length = l2 length
((and (null l1) (null l2)))
;; l1 not null and l2 null ==> l1 length > l2 length
! (l1 (zerop (integer-list-not-zero l1)))
;; l1 null and l2 not null ==> l2 length > l1 length
! (t (zerop (integer-list-not-zero l2)))))
! (defun integer-list-<= (l1 l2)
"Return t if integer list L1 is lesser than or equal to L2.
Note that integer list (1) is equal to (1 0), (1 0 0), (1 0 0 0),
--- 2990,3001 ----
;; l1 null and l2 null ==> l1 length = l2 length
((and (null l1) (null l2)))
;; l1 not null and l2 null ==> l1 length > l2 length
! (l1 (zerop (version-list-not-zero l1)))
;; l1 null and l2 not null ==> l2 length > l1 length
! (t (zerop (version-list-not-zero l2)))))
! (defun version-list-<= (l1 l2)
"Return t if integer list L1 is lesser than or equal to L2.
Note that integer list (1) is equal to (1 0), (1 0 0), (1 0 0 0),
***************
*** 3010,3024 ****
;; l1 null and l2 null ==> l1 length = l2 length
((and (null l1) (null l2)))
;; l1 not null and l2 null ==> l1 length > l2 length
! (l1 (<= (integer-list-not-zero l1) 0))
;; l1 null and l2 not null ==> l2 length > l1 length
! (t (<= 0 (integer-list-not-zero l2)))))
!
! (defalias 'version= 'string-equal
! "Return t if version V1 is equal to V2.
! Compare version string using `string-equal'.")
(defun version< (v1 v2)
--- 3011,3030 ----
;; l1 null and l2 null ==> l1 length = l2 length
((and (null l1) (null l2)))
;; l1 not null and l2 null ==> l1 length > l2 length
! (l1 (<= (version-list-not-zero l1) 0))
;; l1 null and l2 not null ==> l2 length > l1 length
! (t (<= 0 (version-list-not-zero l2)))))
! (defun version-list-not-zero (lst)
! "Return the first non-zero element of integer list LST.
! If all LST elements are zeroes or LST is nil, return zero."
! (while (and lst (zerop (car lst)))
! (setq lst (cdr lst)))
! (if lst
! (car lst)
! ;; there is no element different of zero
! 0))
(defun version< (v1 v2)
***************
*** 3028,3034 ****
etc. That is, the trailing \".0\"s are irrelevant. Also, version string
\"1\"
is greater than \"1pre\" which is greater than \"1beta\" which is greater than
\"1alpha\"."
! (integer-list-< (version-to-list v1) (version-to-list v2)))
(defun version<= (v1 v2)
--- 3034,3040 ----
etc. That is, the trailing \".0\"s are irrelevant. Also, version string
\"1\"
is greater than \"1pre\" which is greater than \"1beta\" which is greater than
\"1alpha\"."
! (version-list-< (version-to-list v1) (version-to-list v2)))
(defun version<= (v1 v2)
***************
*** 3038,3056 ****
etc. That is, the trailing \".0\"s are irrelevant. Also, version string
\"1\"
is greater than \"1pre\" which is greater than \"1beta\" which is greater than
\"1alpha\"."
! (integer-list-<= (version-to-list v1) (version-to-list v2)))
! (defun integer-list-not-zero (lst)
! "Return the first non-zero element of integer list LST.
- If all LST elements are zeroes or LST is nil, return zero."
- (while (zerop (car lst))
- (setq lst (cdr lst)))
- (if lst
- (car lst)
- ;; there is no element different of zero
- 0))
;; arch-tag: f7e0e6e5-70aa-4897-ae72-7a3511ec40bc
--- 3044,3060 ----
etc. That is, the trailing \".0\"s are irrelevant. Also, version string
\"1\"
is greater than \"1pre\" which is greater than \"1beta\" which is greater than
\"1alpha\"."
! (version-list-<= (version-to-list v1) (version-to-list v2)))
+ (defun version= (v1 v2)
+ "Return t if version V1 is equal to V2.
! Note that version string \"1\" is equal to \"1.0\", \"1.0.0\", \"1.0.0.0\",
! etc. That is, the trailing \".0\"s are irrelevant. Also, version string
\"1\"
! is greater than \"1pre\" which is greater than \"1beta\" which is greater than
! \"1alpha\"."
! (version-list-= (version-to-list v1) (version-to-list v2)))
;; arch-tag: f7e0e6e5-70aa-4897-ae72-7a3511ec40bc
- [Emacs-diffs] Changes to emacs/lisp/subr.el, Thien-Thi Nguyen, 2005/08/06
- [Emacs-diffs] Changes to emacs/lisp/subr.el, Richard M . Stallman, 2005/08/08
- [Emacs-diffs] Changes to emacs/lisp/subr.el, Kim F . Storm, 2005/08/17
- [Emacs-diffs] Changes to emacs/lisp/subr.el, Richard M . Stallman, 2005/08/20
- [Emacs-diffs] Changes to emacs/lisp/subr.el, Vinicius Jose Latorre, 2005/08/24
- [Emacs-diffs] Changes to emacs/lisp/subr.el, Richard M . Stallman, 2005/08/25
- [Emacs-diffs] Changes to emacs/lisp/subr.el,
Kim F . Storm <=