;;AUTOLOAD: *version-number*
;;AUTODOC: *version-number* "klone version as a true number"
;; holds an integer number describing the version number
;; Allows for easier comparisons of version numbers
;; This number is built from the version name string in *version* by adding:
;;  - the main version * 10000
;;  - the minor version * 100
;;  - the patch level (a,b,c...) * 1 (a=1, b=2,...)
;; alpha version starts at the previous minor + 50
;; beta versions start at the previous minor + 70
;; Where versions strings are in the form:
;; <major>.<minor>[patch]
;; or <major>.<minor>{alpha|beta}[number]
;; e.g:
;; 2.2f = 20206, 2.3beta4 = 20274, 2.2 = 20200, 2.2a = 20201, 2.4alpha1 = 20351

(with (nums (match "([0-9]+)[.]([0-9]+)([^0-9]*)([0-9]*)"
      *version* 1 2 4 3
  ))
  (setq *version-number* (+ 
      (* (coerce (get nums 0) Int) 10000)
      (* (coerce (get nums 1) Int) 100)
      (if
	(= "beta" (get nums 3))
	(+ -30 (coerce (get nums 2) Int))

	(= "alpha" (get nums 3))
	(+ -50 (coerce (get nums 2) Int))

	(= "" (get nums 2))
	(if (match "^[a-z]$" (get nums 3))
	  (- (get (get nums 3) 0) #\`)
	  0
	)
	
))))

