From: Ronald Oussoren <ronaldoussoren@ma...> - 2008-02-11 11:13:04
On Monday, February 11, 2008, at 10:29AM, "Arnar Birgisson" <arnarbi@...> wrote:
>Thank you Ronald,
>On Feb 11, 2008 9:11 AM, Ronald Oussoren <ronaldoussoren@...> wrote:
>> The tool for this is pyobjc-metadata in the pyobjc repository. There is little to no documentation at the moment.
>> I have to wrap another 3th party framework in the near future, and will use that opportunity to write some documentation and push pyobjc-metadata to pypi (making it easier to install). In theory, a working wrapper is just one script invocation away, although the tool uses a regex-based parser to scan header files and that parser might be easy to confuse.
>Very good. Have you thought about using a more sophisticated parser,
>perhaps based on ANTLR or similar?
I have thought about it, but don't have any plans to work on that. The "clang" frontend for llvm might also be a better way to get a good parser, especially because you might be able to extract more information from the parse tree that way without compiling and running small C programs (which my current tool and Apple's tool do).
>In the meantime, I figured out the bus errors. My selectors were
>wrong, I was missing the names of the parameters (which I guess in
>Obj-C are part of the method name). Now I'm dealing with some
>commnication errors that I'm sure are more related to the Wiimote
>library than the objc-bridge.
Objective-C has a non-traditional way to name methods, which it inherited from Smalltalk. A method name can contain several parts, with arguments in between the parts. A method like "-initWithFrame:(NSRect)frame andColor:(NSColor*)color" might look like a method with keyword arguments, but is actually a method with a segemented name, the entire name is initWithFrame:andColor: (including the colons), which you can access in Python as initWithFrame_andColor_ (that is, replace colons by underscores).
Get latest updates about Open Source Projects, Conferences and News.