Re: Including Files

new topic     » goto parent     » topic index » view thread      » older message » newer message

cklester wrote:
> 
> Can this please be considered?
> 
> I'd like to be able to include files using a variable. For example:
> 
> sequence s
> s = dir("plugins")
> for t=1 to length(s) do
>    if not find(s,{".",".."}) then
>        include s[t]
>    end if
> end for
> 
> Thanks! :)

I think the only 'reasonable' way to do this is to use something like
ooeu's eval() (which it can do).  I haven't migrated that into the c
backend yet, so you'd be stuck with the euphoria backend.  I have some
ideas on how to do it, however, though it's going to be a lot of work.

The difficulty is in adding to the symbol table at runtime.  The c backend
converts all the symtab indices into pointers.  In order to add stuff at
the end of the symbol table, you need to be able to allocate new space.
My solution will use linked symbol table blocks, so that each time you
call eval, a new one gets allocated.

As Ray mentioned, translation is where this gets difficult.  I've got some
ooeu features translating, but to add an eval, you have to embed the 
interpreter into the runtime library, rather than just the support routines.
And then you have to be able to allow stuff to go back and forth between
the translated and interpreted code.  

Similar issues arise from the var_id family of features.  A better way to
do this might be to translate your plugins to c, so that you could 
dynamically load them.  Since the translator is all free, there's less
reason not to do this sort of thing.  You might take a look at the ooeu
debugger, or even the win32lib dll wrapper
(http://www.rapideuphoria.com/windll.zip)
that allows a dll to use the win32lib in the main program.  They should
give some ideas about how to integrate eu code in this manner.

Matt

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu