1. Re: No more platform(), conditional includes, conditional functions, conditiona
well this as exciting as C preprocessor directive and it is what I always wanted
for euphoria.
I strongly vote for it. Include it in version 4.0 and trace the line (see my
prevous post.)
regards,
Jacques DeschĂȘnes
Jeremy Cowgar wrote:
>
> Wow, I am pumped... Look at this code:
>
> }}}
<eucode>
> with define=debug
> atom lib
>
> ifdef debug then
> include safe.e
> else
> include machine.e
> end ifdef
>
>
> ifdef LINUX then
>
> lib = open_dll("hello.so")
> global function say_hello()
> puts(1, "Hello from Linux!\n")
> end function
>
> elsifdef WIN32 then
>
> lib = open_dll("hello.dll")
> global function say_hello()
> puts(1, "Hello from Windows!\n")
> end function
>
> elsifdef DOS32 then
>
> lib = -1
> global function say_hello()
> puts(1, "Hello from DOS!\n")
> end function
>
> end ifdef
>
> say_hello()
> </eucode>
{{{
>
> This all works and this works at the parsing level. What this means is:
>
> }}}
<eucode>
> for i = 1 to length(lines) do
> ifdef debug then
> printf(1, "Line: %s\n", {lines[i]})
> end ifdef
>
> -- real code
> end for
> </eucode>
{{{
>
> During the parse, the ifdef is translated at parse/compile time. Not runtime.
> This means that the decision "ifdef debug" is made once, not every iteration
> of the loop. Therefore, if debug is defined, then this is *exactly* what the
> code looks like to the runtime or in the C code translated:
>
> }}}
<eucode>
> for i = 1 to length(lines) do
> printf(1, "Line: %s\n", {lines[i]})
> -- real code
> end for
> </eucode>
{{{
>
> Notice, no decision logic! If debug is not defined, then in both the
> interpreter
> and C code translated, you only see:
>
> }}}
<eucode>
> for i = 1 to length(lines) do
> -- real code
> end for
> </eucode>
{{{
>
> This is exciting!
>
> --
> Jeremy Cowgar
> <a href="http://jeremy.cowgar.com">http://jeremy.cowgar.com</a>