File: IBCarbonsupport.py

package info (click to toggle)
python2.4 2.4.1-2sarge1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 47,012 kB
  • ctags: 86,497
  • sloc: ansic: 304,593; python: 268,756; makefile: 3,843; perl: 3,736; lisp: 3,678; sh: 2,206; xml: 894; objc: 747; cpp: 7; sed: 2
file content (51 lines) | stat: -rw-r--r-- 1,223 bytes parent folder | download | duplicates (20)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# IBCarbonsupport.py

from macsupport import *

IBNibRef = OpaqueByValueType('IBNibRef', 'IBNibRefObj')
#CFBundleRef = OpaqueByValueType('CFBundleRef')

IBCarbonFunction = OSErrFunctionGenerator
IBCarbonMethod = OSErrMethodGenerator

includestuff = """
#include <Carbon/Carbon.h>
#include "pymactoolbox.h"

#ifdef USE_TOOLBOX_OBJECT_GLUE
extern int _CFStringRefObj_Convert(PyObject *, CFStringRef *);
#endif

"""

initstuff = """

"""

module = MacModule('_IBCarbon', 'IBCarbon', includestuff, finalstuff, initstuff)

class CFReleaserObject(PEP253Mixin, GlobalObjectDefinition):
    def outputFreeIt(self, name):
        Output("CFRelease(%s);" % name)

class CFNibDesc(PEP253Mixin, GlobalObjectDefinition):
    def outputFreeIt(self, name):
        Output("DisposeNibReference(%s);" % name)

#cfstringobject = CFReleaserObject("CFStringRef")
#module.addobject(cfstringobject)
#cfbundleobject = CFReleaserObject("CFBundleRef")
#module.addobject(cfbundleobject)
ibnibobject = CFNibDesc("IBNibRef", "IBNibRefObj")
module.addobject(ibnibobject)

functions = []
methods = []

execfile('IBCarbongen.py')

for f in functions: module.add(f)
for m in methods: ibnibobject.add(m)

SetOutputFileName('_IBCarbon.c')
module.generate()