Re: [Pyobjc-dev] NSRunAlertPanel signature?
Brought to you by:
ronaldoussoren
From: Bob I. <bo...@re...> - 2003-08-20 05:30:56
|
On Tuesday, Aug 19, 2003, at 15:16 America/New_York, Zachery Bir wrote: > In the AppKit docs, it spells the method NSRunAlertPanel like this: > > int NSRunAlertPanel(NSString *title, NSString *msg, NSString > *defaultButton, NSString *alternateButton, NSString *otherButton, ...) > > I assumed that the ellipsis in argument list meant the additional > buttons were unbounded. However, PyObjC complains when more than 5 > parameters are passed. UI issues aside, is one or the other (signature > or implementation) incorrect? ellipsis at the end of a C function prototype means that it's one of those nasty magical C functions that take a variable number of arguments (arglist_t, va_args, or whatever). Key offenders would be stuff like printf and NSLog. If you pop open Scripts/CodeGenerators/cocoa_generator.py in the PyObjC source and search for NSRunAlertPanel, you'll see that the current code generator ignores the fact that NSRunAlertPanel can take a variable number of arguments. So basically, the current code generator isn't smart enough to do anything useful for a few kinds of "complex functions", so you'll have to live with a non-varargs version of NSRunAlertPanel until someone writes a smarter code generator (IIRC, the libffi code for this madness isn't trivial, and the python bridge would be NO fun.. but I think ctypes might have support for it) and you upgrade to whatever version of PyObjC that may be. -bob |