Re: Comments on ORAC
- Posted by Matt Lewis <matthewwalkerlewis at gmai?.com> Nov 11, 2007
- 626 views
Mike wrote: > > Pete Lomax wrote: > > > > Mike wrote: > > > However, I've restricted it to work only for constants that are associated > > > with > > > functions that eventually lead back to the specific machine_func() call > > > that > > > links to a dll. > > > > Any further thoughts on using the #30000000 mask idea to eliminate that > > restriction? > > > > Regards, > > Pete > > Sorry Pete. A mask would only be useful if the Euphoria internals were > modified > to natively support (what I refer to as) seamless calls. If such a > modification > were done, there'd be no need for what I just did to Orac.. ummm, it would be > a > better solution - for sure. Unfortunately, I'm not one of the few people > talented > enough to do this adjustment. What I've done is a compile-time analysis, > whereas, > a mask is a run-time flag. > > Now, if the Euphoria internals were modified to have said mask, Orac could > only > take advantage of this for routines called as procedures since it'd have to > emit > some "if" statements. Therefore, routines called as functions (in an > expression) > just wouldn't work. I think you're overcomplicating this. Since you're writing a preprocessor, you just need to create a global function and a global procedure, something like:
global function call_indirect_function( integer func, sequence args ) if and_bits( func, C_FUNC_INDIRECT ) then return c_func( and_bits( func, ROUTINE_MASK ), args ) elsif and_bits( func, EU_FUNC_INDIRECT ) then return call_func( and_bits( func, ROUTINEMASK ), args ) end if -- error handling here... end function
Matt