Re: Comments on ORAC
- Posted by Mike <vulcan at win.co?nz> Nov 11, 2007
- 641 views
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. However, I can easily extend Orac to include integers assigned at the top-level (just like the constants are). This might reduce the remaining deficiency to tolerable levels. The thing about integers, of course, is that they can be re-assigned at run-time so all sorts of effects are possible. And yet, perhaps the easiest idea is simply to add a declaration specifier that tells the compiler how to treat "seamless calls" with that particular reference, eg: dll_proc int DeleteObject .. the integer is assigned somewhere at runtime DeleteObject(hWnd) // it works! The analysis that Orac does is to automatically deduce whether a symbol will be used as a function reference for an indirect call. But all I really need to know is what did the programmer intend the symbol to be used for. Well, a specifier would do it. In fact, 2 specifiers - one for C functions and one for C procedures, say, dll_proc and dll_func. I could take this idea a little bit further by permitting any data type to be used, so that a sequence could therefore be the reference, eg: dll_func seq gdi gdi = repeat(0, ..) gdi.1 = c_func(.. gdi.2 = c_func(.. gdi.3 = c_func(.. .. gdi.2(987) // also works! The numbers shown here can all be replaced by constant names and, as you know, the auto-numbering of Orac can be used to make this very easy (and safe). I think this idea would achieve pretty much all we'd need for now without having alter Euphoria itself. regards, Mike