Re: Detecting the Eu version
- Posted by "Igor Kachan" <kinz at peterlink.ru> Dec 13, 2004
- 581 views
Hi, Juergen! You wrote: > Hi all, > > recently Derek and Pete (L) posted here some useful code, that allows > a program to detect the current Eu version at runtime. I think it is > especially helpful to use such a functionality in libraries, that > require at least a particular Eu version. > > Concerning Eu 2.5, it can look like this: > }}} <eucode> > include machine.e > if routine_id("crash_routine") = -1 then -- crash_routine() was > puts(1, "Euphoria 2.5 or later required." -- introduced in v2.5 > & "\n\nPress Enter ...") > if getc(0) then end if > abort(1) > end if There is some universal method - all ex.exes, exw.exes, exus, ec.exes etc have the unique lengths. So, you can detect the version with something like to:
global function version(sequence name, atom EXE_Length) name = machine_func(22, name) -- dir info if name[1][3] = EXE_Length then return 1 else return 0 end if end fubction
[snip] Just pass the name of the needed interpreter and its known length and you'll get an answer is it yours one or no, it is not. Regards, Igor Kachan kinz at peterlink.ru