1. Dynamic file includes

How can dynamic file includes be accomplished...

--tested but this didn't work
sequence fn = "/blah/to/file/hello.e"
include fn



How can the EUDIR be configured at runtime...

-- again no joy here
system ("export EUINC=$EUINC:/blah/to/file/")
puts(1, getenv("EUINC"))


new topic     » topic index » view message » categorize

2. Re: Dynamic file includes

Ron Weidner wrote:
> 
> 
> How can dynamic file includes be accomplished...
> 
> }}}
<eucode>
> --tested but this didn't work
> sequence fn = "/blah/to/file/hello.e"
> include fn
> <font color="#330033"></eucode>
{{{
</font>
> 
> 
> How can the EUDIR be configured at runtime...
> 
> }}}
<eucode>
> -- again no joy here
> system ("export EUINC=$EUINC:/blah/to/file/")
> puts(1, getenv("EUINC"))
> <font color="#330033"></eucode>
{{{
</font>
> 
"Include" is a top-level statement, string data cannot be past to it via
variables. Filepaths and/or relative filenames can only be placed next to the
statement, along with the optional namespace declaration.

But to answer your question, Euphoria doesnt support dynamic inclustion...
because all the included files and the current source file are entirely
scanned/parsed and converted to intermediate language (IL) before the interprter
executes it. In previous versions of Euphoria, blocks of code were
scanned/parsed, converted to IL, then executed (I think)? and some sort of
"Mickey Mouse" method would allow for partial solution, or so I heard. I don't
think Euphoria needs them, it would be difficult to work out with bound &
translated/compiled programs in that all the included files would embedded into
the application.

Regards,
Vincent

--
Without walls and fences, there is no need for Windows and Gates.

new topic     » goto parent     » topic index » view message » categorize

3. Re: Dynamic file includes

You could try using the dynamic include file program I wrote. I'm not sure
whether it will still work with euphoria 2.5, but it might be worth a try. If it
does work, theres still no way it will work with a bound program.

http://www.rapideuphoria.com/dynaminc.zip

new topic     » goto parent     » topic index » view message » categorize

4. Re: Dynamic file includes

Vincent wrote:

<snip>

> But to answer your question, Euphoria doesnt support dynamic inclustion...
> because all the included files and the current source file are entirely
> scanned/parsed and converted to intermediate language (IL) before the
> interprter executes it. In previous versions of Euphoria, blocks of
> code were scanned/parsed, converted to IL, then executed (I think)? and
> some sort of "Mickey Mouse" method would allow for partial solution, or
> so I heard. I don't think Euphoria needs them, it would be difficult to
> work out with bound & translated/compiled programs in that all the
> included files would embedded into the application.

Also using Eu 2.5, programs can take advantage of a dynamic include
technique. I wrote that already before Eu 2.5 was released (URL might
wrap):
http://www.listfilter.com/cgi-bin/esearch.exu?fromMonth=2&fromYear=9&toMonth=2&toYear=9&postedBy=Juergen+Luethje&keywords=%2214+Feb+2004+10%3A54%3A22%22

CK, this seems to be a FAQ ... ( hint, hint blink )

Regards,
   Juergen

new topic     » goto parent     » topic index » view message » categorize

5. Re: Dynamic file includes

> Subject: Dynamic file includes
> 
> 
> posted by: Ron Weidner <nova812 at hotmail.com>
> 
> 
> How can dynamic file includes be accomplished...
> 
> }}}
<eucode>
> --tested but this didn't work
> sequence fn = "/blah/to/file/hello.e"
> include fn
> </eucode>
{{{

> 

Using Eu 2.4, you could do this:

constant dynInc = open("dyncommands.e","w")
--be sure to chooes some unique file name here
puts(dynInc,"include /blah/to/file/hello.e\n")
close(dynInc)
include dyncommands.e


The file holding a dynamic command list must be hardcoded, but you could 
generate its contents as needed.
This is reported not to work in 2.5, which is why I didn't switch to it, 
plus the added load time on my old secondary machine.
Search for "dynamic include" or "local include" in the archives. The 
solution I'm describing was exposed in details by I. Kachan iirc.

> 
> How can the EUDIR be configured at runtime...
> 
> }}}
<eucode>
> -- again no joy here
> system ("export EUINC=$EUINC:/blah/to/file/")

Are you sure you can modify env variables on the fly wothout some kind 
of logoff/logon pair?
And I'd add a \n at the end of any command string you pass to 
system[_exec], just in case.

> puts(1, getenv("EUINC"))
> </eucode>
{{{

> 

HTH
CChris

new topic     » goto parent     » topic index » view message » categorize

6. Re: Dynamic file includes

I think Bach can do dynamic includes. Or, look at the modifed interpreters 
that execute strings, simply load your dynamic include into a sequence and 
execute it as needed.

Kat

new topic     » goto parent     » topic index » view message » categorize

7. Re: Dynamic file includes

Thanks for the tips guys.  It looks like I'll work around 
not having dynamic file inlcudes.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu