Re: development ideas for 4.1
- Posted by DerekParnell (admin) Feb 11, 2011
- 1846 views
There is talk about making C structs easier and less error prone in EUPHORIA. The reason we need to interface with C is it is that most of the APIs are written in C. In addition of wrapping C structs you also have to declare your routines separately and you also must define the constant values.
Rather than doing all of this wouldn't be better if we could simply include the C header from the EUPHORIA file? We would need a way to tokenize preprocessor syntax and also C header syntax. I am taking this idea to the forum as it might attract ideas.
In theory, and for some really simple headers, this would probably work pretty well. But many headers will rely on other included headers for things like data types. Also, ifdefs and other preprocessor macros make this a lot more complicated. So, I'm sure that it's possible to do this for really simple headers, it wouldn't be a general solution, unless euphoria were also able to parse C.
I'd be happy to be proven wrong, of course.
Matt
Matt's right. We would have to write and maintain a full C parser and C macro processor to be able to translate C headers for Euphoria usage.
I don't think that the cost would justify the benefit.