Update CEDET from upstream.
[bpt/emacs.git] / lisp / cedet / inversion.el
index 877ed54..6a13a12 100644 (file)
 
 (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:
@@ -140,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)
@@ -195,24 +200,25 @@ 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 nothing 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 nothing 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
@@ -340,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 SXEMACE-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)))