Re: version() function
- Posted by "Juergen Luethje" <j.lue at gmx.de> Nov 20, 2004
- 505 views
Derek Parnell wrote: > I'm now wishing there was some obvious way of telling at runtime > which version of Euphoria I'm running with. Me too. > Currently I'm doing this, but I'm open to suggestions... > > > include machine.e > global function eu_version() > if routine_id("crash_routine") = -1 then > return 2.4 > else > return 2.5 > end if > end function It would be useful if the function could also tell about alpha, beta and official version. For instance, my "bit.e" library requires the Euphoria 2.4 Official Release or later, and someone couldn't run it, because he used Eu 2.4 alpha or beta. Internally, we could use e.g.: 2.4 alpha --> 2.40 2.4 beta --> 2.41 2.4 official --> 2.42 In "bit.e", I would then add some lines such as:
if eu_version() < 2.42 then puts(1, "Sorry, Euphoria 2.4 Official Release or later required.") abort(1) end if }}} <eucode>
My first idea was to look at some particular bytes in the EXE file (1st command-line argument), in order to detect the version. This would also work for older Euphoria versions. Currently I think that this would be too complicated, because it must take the different interpreters and compilers into account.
Regards, Juergen
Have you read a good program lately? }}}