Re: Version Feature.
- Posted by Lucius Hilley III <lhilley at CDC.NET> Jan 28, 1999
- 461 views
On Thu, 28 Jan 1999 16:02:26 +0100, Rolf Schroeder <schroeder at DESY.DE> wrote: >Colin Taylor wrote: >> >> Another (related) feature which would be very useful is a conditional >> "compile". (I know Euphoria isn't really compiled - but I can't think of a >> better way to say it). >> >> example: >> >> If platform() = DOS32 then >> include graphics.e >> else >> include graphics.ew >> end if >> >> This feature would complement the version feature suggested by LLHIII. >> >> Colin Taylor >The feature exists since EU ver. 2.0 I think. >Have a nice night, Rolf Umm, No this feature doesn't exist. Yes the routined platform() exists but you can't include one library or another instead depending on the platform used. I agree that platform and version conditionals coding should be possible. IE: if version() < 2.0 then include special.e end if Yes you can write your code to be platform() specific BUT, It has to be through out your code not an include this or include that. IE: We want this BUT. if platform() = DOS32 then include dos.e--dos stuff else include windows.ew--windows stuff. end if The routine names in could be identical but designed for that platform allowing the code to be platform specific. A call to input_number() would be a fully featured routine in DOS where as input_number() could easily be a simple API call in Windows. IE: We have this. sequence s if platform() = DOS32 then if graphics_mode(261) then abort(0) end if -- "Using DOS. Must use DOS graphics." else -- "Using Windows. May use Windows graphical libraries." end if if platform() = DOS32 then pixel(4, {1, 1}) else --Use something similiar in windows. end if if platform() = DOS32 then puts(1, "input a # between 1 and 10") s = gets(0) else -- Use a windows API call. Looks prettier and -- can easily be used to only allow numbers entered. end if -- poke4() and peek4() weren't in 1.4 and I don't -- recall if they were in 1.5. If this was possible then a person COULD -- include patch code so as to allow the program to run on old versions. Before poke4() and peek4() were built-in someone built some routines to handle these cases. Obviously if the built-in is available you wouldn't want to use the Euphoria coded routines, because the built-in's are much faster. Lucius L. Hilley III I hope all this is as clear as mud.