1# IBCarbonsupport.py 2 3from macsupport import * 4 5IBNibRef = OpaqueByValueType('IBNibRef', 'IBNibRefObj') 6#CFBundleRef = OpaqueByValueType('CFBundleRef') 7 8IBCarbonFunction = OSErrFunctionGenerator 9IBCarbonMethod = OSErrMethodGenerator 10 11includestuff = """ 12#include <Carbon/Carbon.h> 13#include "pymactoolbox.h" 14 15#ifdef USE_TOOLBOX_OBJECT_GLUE 16extern int _CFStringRefObj_Convert(PyObject *, CFStringRef *); 17#endif 18 19""" 20 21initstuff = """ 22 23""" 24 25module = MacModule('_IBCarbon', 'IBCarbon', includestuff, finalstuff, initstuff) 26 27class CFReleaserObject(PEP253Mixin, GlobalObjectDefinition): 28 def outputFreeIt(self, name): 29 Output("CFRelease(%s);" % name) 30 31class CFNibDesc(PEP253Mixin, GlobalObjectDefinition): 32 def outputFreeIt(self, name): 33 Output("DisposeNibReference(%s);" % name) 34 35#cfstringobject = CFReleaserObject("CFStringRef") 36#module.addobject(cfstringobject) 37#cfbundleobject = CFReleaserObject("CFBundleRef") 38#module.addobject(cfbundleobject) 39ibnibobject = CFNibDesc("IBNibRef", "IBNibRefObj") 40module.addobject(ibnibobject) 41 42functions = [] 43methods = [] 44 45execfile('IBCarbongen.py') 46 47for f in functions: module.add(f) 48for m in methods: ibnibobject.add(m) 49 50SetOutputFileName('_IBCarbon.c') 51module.generate() 52