1. version() function
- Posted by Derek Parnell <ddparnell at bigpond.com> Nov 19, 2004
- 558 views
I'm now wishing there was some obvious way of telling at runtime which version of Euphoria I'm running with. 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 -- Derek Parnell Melbourne, Australia
2. 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? }}}
3. Re: version() function
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Nov 21, 2004
- 532 views
On Thu, 18 Nov 2004 17:30:46 -0800, Derek Parnell <guest at RapidEuphoria.com> wrote: >I'm now wishing there was some obvious way of telling at runtime >which version of Euphoria I'm running with. > >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 Looks good to me. I might also suggest misc.e: pretty_print (2.4) (couldn't find anything for 2.3) sleep (2.2) reverse (2.1) misc.e was introduced in 2.0 Unfortunately, I can't suggest a check for 2.6! Maybe, if Rob does not think a version() routine is warranted, he could at least reserve say 65 as an opcode for machine_func. On a personal note, Derek, if you do wander off, I hope you find what you're looking for and remember to stop by once in a while. I can't in all honesty ask you to stay since it is clearly making you unhappy. I wouldn't be here without your efforts on win32lib. You'll certainly be missed. All the best, Pete