Open mokus0 opened 12 years ago
@IreneKnapp has offered the use of her BridgeSupport parser for this task. So I don't forget, that code is in a darcs repo at http://ireneknapp.com/software/darcs/direct-cocoa/
For the record... confirmed that interface generator chokes on GNUstep headers too.
The interface generator no longer reads Apple's header files (probably not GNU's either), so I propose that the interface generator be overhauled or re-written to use BridgeSupport files. If these are not available on GNUstep, it would probably be worthwhile to write a generator for them rather than maintain a specialized HOC interface generator.
If I recall correctly (I looked at implementing this once a while back), there is not enough information in the BridgeSupport files to generate the exact layout built by the current interface generator, so this will probably entail changes that affect end-user code. Given the advantage of never having to write another hacky header parser, though, I think it is probably worth it.
Another option which @ekmett suggested is to run the headers through the C preprocessor and parse the results. The reason that's not already being done is, I believe, because the parser is interpreting a lot of meta-information from CPP macros that get erased by the preprocessor - but as Ed points out, we can provide our own redefinitions of those that would leave them in a form we can parse. The result would probably not be valid C, so we'd still have to write a custom parser, but it would probably be more resilient to formatting changes than the current approach.