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