9 from bgenlocations
import TOOLBOXDIR
, BGENDIR
10 sys
.path
.append(BGENDIR
)
12 from scantools
import Scanner
, Scanner_OSX
15 print "---Scanning CarbonEvents.h---"
16 input = ["CarbonEvents.h"]
17 output
= "CarbonEventsgen.py"
18 defsoutput
= TOOLBOXDIR
+ "CarbonEvents.py"
19 scanner
= CarbonEvents_Scanner(input, output
, defsoutput
)
22 print "=== Testing definitions output code ==="
23 execfile(defsoutput
, {}, {})
24 print "--done scanning, importing--"
25 import CarbonEvtsupport
28 RefObjectTypes
= ["EventRef",
33 "EventHandlerCallRef",
38 class CarbonEvents_Scanner(Scanner_OSX
):
39 def destination(self
, type, name
, arglist
):
40 classname
= "CarbonEventsFunction"
41 listname
= "functions"
44 if t
in RefObjectTypes
and m
== "InMode":
45 if t
== "EventHandlerRef":
46 classname
= "EventHandlerRefMethod"
48 classname
= "CarbonEventsMethod"
49 listname
= t
+ "methods"
52 return classname
, listname
54 def writeinitialdefs(self
):
55 self
.defsfile
.write("def FOUR_CHAR_CODE(x): return x\n")
56 self
.defsfile
.write("def FOUR_CHAR_CODE(x): return x\n")
57 self
.defsfile
.write("false = 0\n")
58 self
.defsfile
.write("true = 1\n")
59 self
.defsfile
.write("keyAEEventClass = FOUR_CHAR_CODE('evcl')\n")
60 self
.defsfile
.write("keyAEEventID = FOUR_CHAR_CODE('evti')\n")
62 def makeblacklistnames(self
):
66 # "TrackMouseLocationWithOptions",
67 # "TrackMouseLocation",
69 "RegisterToolboxObjectClass",
70 "UnregisterToolboxObjectClass",
72 "GetCFRunLoopFromEventLoop",
74 "InvokeEventHandlerUPP",
75 "InvokeEventComparatorUPP",
76 "InvokeEventLoopTimerUPP",
77 "NewEventComparatorUPP",
78 "NewEventLoopTimerUPP",
80 "DisposeEventComparatorUPP",
81 "DisposeEventLoopTimerUPP",
82 "DisposeEventHandlerUPP",
85 "InstallEventHandler",
87 "RunApplicationEventLoop",
91 "FlushSpecificEventsFromQueue",
92 "FindSpecificEventInQueue",
93 "InstallEventLoopTimer",
95 # Don't do these because they require a CFRelease
96 "CreateTypeStringWithOSType",
100 # def makeblacklisttypes(self):
101 # return ["EventComparatorUPP",
102 # "EventLoopTimerUPP",
103 # #"EventHandlerUPP",
104 # "EventComparatorProcPtr",
105 # "EventLoopTimerProcPtr",
106 # "EventHandlerProcPtr",
109 def makerepairinstructions(self
):
111 ([("UInt32", 'inSize', "InMode"), ("void_ptr", 'inDataPtr', "InMode")],
112 [("MyInBuffer", 'inDataPtr', "InMode")]),
113 ([("Boolean", 'ioWasInRgn', "OutMode")],
114 [("Boolean", 'ioWasInRgn', "InOutMode")]),
117 if __name__
== "__main__":