Page 1 of 1

getting the newLISP version number: (sys-info 6)

Posted: Mon Jan 22, 2007 8:25 am
by cormullion
I'm just working out how to get the newLISP version number.

How does (sys-info 6) work? Are there always 4 digits, and is the point release always two digits? What happens when version 10 comes?

At present, it returns 9015, which is quite easy to resolve to 9.0.15. What did it say for 9.0.9 - 909 or 9009? How do you tell the difference between 9.11.0 and 9.1.10?

The manual retains a dignified silence on these vital issues ... :-)

Posted: Mon Jan 22, 2007 8:46 am
by HPW
9.0.0 is 9000 so I would expect 9.0.9 to be 9009

I think Lutz use only one digit for point-releases and make not more than 99 development releases.

I would expect than 10.0.0 to be 10000

;-)

Posted: Mon Jan 22, 2007 9:22 am
by cormullion
Ah! Thanks - so you reckon this might do the trick for the next few versions:

Code: Select all

(set 'version-string (string (sys-info 6)))

(set 'dev-version (pop version-string -2))    ; last two digits
(set 'point-version (pop version-string -1))  ; one digit
(set 'version version-string)                 ; what's left

(println version "." point-version "." dev-version)


Posted: Wed Jan 24, 2007 7:01 am
by cormullion
This is better:

Code: Select all

(set 'version-string (string (sys-info 6))) 

(set 'dev-version (pop version-string -2 2))  ; last two digits 
(set 'point-version (pop version-string -1))  ; one digit 
(set 'version version-string)                 ; what's left 

(println version "." point-version "." dev-version) 

Posted: Wed Jan 24, 2007 10:43 pm
by Lutz
... and here is another solution:

Code: Select all

(let (v (string (sys-info 6))) 
    (append (chop v 3) "." (v 1) "." (-2 v)))

=> "9.0.18"
Lutz