X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/73b0cd50031a714347109169ceb8bacae338612a..28e8e49e08c19dd8f23aca4293d9cccc9477f2bf:/lisp/cedet/inversion.el diff --git a/lisp/cedet/inversion.el b/lisp/cedet/inversion.el index ce38b2fe6f..26f526872e 100644 --- a/lisp/cedet/inversion.el +++ b/lisp/cedet/inversion.el @@ -1,10 +1,9 @@ ;;; inversion.el --- When you need something in version XX.XX -;;; Copyright (C) 2002-2003, 2005-2011 -;;; Free Software Foundation, Inc. +;;; Copyright (C) 2002-2003, 2005-2016 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam -;; Version: 0.2 +;; Version: 1.3 ;; Keywords: OO, lisp ;; This file is part of GNU Emacs. @@ -80,15 +79,20 @@ (defconst inversion-decoders '( - (alpha "^\\([0-9]+\\)\\.\\([0-9]+\\)\\s-*\\.?alpha\\([0-9]+\\)?$" 3) - (beta "^\\([0-9]+\\)\\.\\([0-9]+\\)\\s-*\\.?beta\\([0-9]+\\)?$" 3) - (beta "^\\([0-9]+\\)\\.\\([0-9]+\\)\\s-*(beta\\([0-9]+\\)?)" 3) + (alpha "^\\([0-9]+\\)\\.\\([0-9]+\\)\\.?\\([0-9]*\\)?\\s-*\\.?alpha\\([0-9]+\\)?$" 4) + (beta "^\\([0-9]+\\)\\.\\([0-9]+\\)\\.?\\([0-9]*\\)?\\s-*\\.?beta\\([0-9]+\\)?$" 4) + (beta "^\\([0-9]+\\)\\.\\([0-9]+\\)\\.?\\([0-9]*\\)?\\s-*\\.?(beta\\([0-9]+\\)?)$" 4) + (beta "^[^/]+/\\w+--\\w+--\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)--patch-\\([0-9]+\\)" 4) + (beta "^\\w+: v\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)-\\([0-9]+\\)-\\(.*\\)" 5) (prerelease "^\\([0-9]+\\)\\.\\([0-9]+\\)\\s-*\\.?pre\\([0-9]+\\)?$" 3) - (full "^\\([0-9]+\\)\\.\\([0-9]+\\)$" 2) + (full "^\\([0-9]+\\)\\.\\([0-9]+\\)\\.?\\([0-9]+\\)?$" 3) (fullsingle "^\\([0-9]+\\)$" 1) - (patch "^\\([0-9]+\\)\\.\\([0-9]+\\) (patch \\([0-9]+\\))" 3) + (patch "^\\([0-9]+\\)\\.\\([0-9]+\\)\\.?\\([0-9]+\\)?\\s-*(patch \\([0-9]+\\))" 4) (point "^\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)$" 3) + (point "^\\w+: v\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)-\\(0\\)-\\(.*\\)" 5) (build "^\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\).\\([0-9]+\\)$" 4) + (full "^[^/]+/\\w+--\\w+--\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)--version-\\([0-9]+\\)" 4) + (full "^\\w+: v\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)" 5) ) "List of decoders for version strings. Each decoder is of the form: @@ -141,7 +145,7 @@ where RELEASE is a symbol such as `full', or `beta'." ;; Decode the code (setq code (inversion-decode-version ver)) (unless code - (error "%S-version value cannot be decoded" package)) + (error "%S-version value (%s) cannot be decoded" package ver)) code)) (defun inversion-package-incompatibility-version (package) @@ -196,37 +200,38 @@ not an indication of new features or bug fixes." (v2-3 (nth 3 ver2)) (v2-4 (nth 4 ver2)) ) - (or (and (= v1-0 v2-0) - (= v1-1 v2-1) - (= v1-2 v2-2) - (= v1-3 v2-3) - v1-4 v2-4 ; all or nothin if elt - is = + + (cond ((and (equal (list v1-1 v1-2 v1-3 v1-4) + (list v2-1 v2-2 v2-3 v2-4)) + v1-0 v2-0) + (< v1-0 v2-0)) + ((and (equal v1-1 v2-1) + (equal v1-2 v2-2) + (equal v1-3 v2-3) + v1-4 v2-4) ; all or nothing if elt - is = (< v1-4 v2-4)) - (and (= v1-0 v2-0) - (= v1-1 v2-1) - (= v1-2 v2-2) - v1-3 v2-3 ; all or nothin if elt - is = + ((and (equal v1-1 v2-1) + (equal v1-2 v2-2) + v1-3 v2-3) ; all or nothing if elt - is = (< v1-3 v2-3)) - (and (= v1-1 v2-1) + ((and (equal v1-1 v2-1) + v1-2 v2-2) (< v1-2 v2-2)) - (and (< v1-1 v2-1)) - (and (< v1-0 v2-0) - (= v1-1 v2-1) - (= v1-2 v2-2) - ) + ((and v1-1 v2-1) + (< v1-1 v2-1)) ))) (defun inversion-check-version (version incompatible-version - minimum &rest reserved) + minimum &rest reserved) "Check that a given version meets the minimum requirement. VERSION, INCOMPATIBLE-VERSION and MINIMUM are of similar format to return entries of `inversion-decode-version', or a classic version string. INCOMPATIBLE-VERSION can be nil. RESERVED arguments are kept for a later use. Return: -- nil if everything is ok -- 'outdated if VERSION is less than MINIMUM. -- 'incompatible if VERSION is not backward compatible with MINIMUM. +- nil if everything is ok. +- `outdated' if VERSION is less than MINIMUM. +- `incompatible' if VERSION is not backward compatible with MINIMUM. - t if the check failed." (let ((code (if (stringp version) (inversion-decode-version version) @@ -341,13 +346,17 @@ Optional argument RESERVED is saved for later use." ;; Return the package symbol that was required. package)) -(defun inversion-require-emacs (emacs-ver xemacs-ver) - "Declare that you need either EMACS-VER, or XEMACS-VER. +;;;###autoload +(defun inversion-require-emacs (emacs-ver xemacs-ver sxemacs-ver) + "Declare that you need either EMACS-VER, XEMACS-VER or SXEMACS-ver. Only checks one based on which kind of Emacs is being run." (let ((err (inversion-test 'emacs - (if (featurep 'xemacs) - xemacs-ver - emacs-ver)))) + (cond ((featurep 'sxemacs) + sxemacs-ver) + ((featurep 'xemacs) + xemacs-ver) + (t + emacs-ver))))) (if err (error err) ;; Something nice... t))) @@ -375,7 +384,7 @@ Return nil when VERSION-STRING was not found." (with-temp-buffer ;; The 3000 is a bit arbitrary, but should cut down on ;; fileio as version info usually is at the very top - ;; of a file. AFter a long commentary could be bad. + ;; of a file. After a long commentary could be bad. (insert-file-contents-literally file nil 0 3000) (goto-char (point-min)) (when (re-search-forward (format tag package 'version) nil t) @@ -420,7 +429,7 @@ INSTALLDIR path." ;;(message "%S added to `load-path'" default-directory) (add-to-list 'load-path default-directory)) ;; We get to this point iff we do not accept or there is no - ;; system file. Lets check the version of what we just + ;; system file. Let's check the version of what we just ;; installed... just to be safe. (let ((newver (inversion-find-version package))) (if (not newver)