7 from bgenlocations
import TOOLBOXDIR
, BGENDIR
8 sys
.path
.append(BGENDIR
)
10 from scantools
import Scanner
, Scanner_OSX
13 print "---Scanning CarbonEvents.h---"
14 input = ["CarbonEvents.h"]
15 output
= "CarbonEventsgen.py"
16 defsoutput
= TOOLBOXDIR
+ "CarbonEvents.py"
17 scanner
= CarbonEvents_Scanner(input, output
, defsoutput
)
20 print "=== Testing definitions output code ==="
21 execfile(defsoutput
, {}, {})
22 print "--done scanning, importing--"
23 import CarbonEvtsupport
26 RefObjectTypes
= ["EventRef",
31 "EventHandlerCallRef",
36 class CarbonEvents_Scanner(Scanner_OSX
):
37 def destination(self
, type, name
, arglist
):
38 classname
= "CarbonEventsFunction"
39 listname
= "functions"
42 if t
in RefObjectTypes
and m
== "InMode":
43 if t
== "EventHandlerRef":
44 classname
= "EventHandlerRefMethod"
46 classname
= "CarbonEventsMethod"
47 listname
= t
+ "methods"
50 return classname
, listname
52 def writeinitialdefs(self
):
53 self
.defsfile
.write("def FOUR_CHAR_CODE(x): return x\n")
54 self
.defsfile
.write("def FOUR_CHAR_CODE(x): return x\n")
55 self
.defsfile
.write("false = 0\n")
56 self
.defsfile
.write("true = 1\n")
57 self
.defsfile
.write("keyAEEventClass = FOUR_CHAR_CODE('evcl')\n")
58 self
.defsfile
.write("keyAEEventID = FOUR_CHAR_CODE('evti')\n")
60 def makeblacklistnames(self
):
64 # "TrackMouseLocationWithOptions",
65 # "TrackMouseLocation",
67 "RegisterToolboxObjectClass",
68 "UnregisterToolboxObjectClass",
70 "GetCFRunLoopFromEventLoop",
72 "InvokeEventHandlerUPP",
73 "InvokeEventComparatorUPP",
74 "InvokeEventLoopTimerUPP",
75 "NewEventComparatorUPP",
76 "NewEventLoopTimerUPP",
78 "DisposeEventComparatorUPP",
79 "DisposeEventLoopTimerUPP",
80 "DisposeEventHandlerUPP",
83 "InstallEventHandler",
88 "FlushSpecificEventsFromQueue",
89 "FindSpecificEventInQueue",
90 "InstallEventLoopTimer",
92 # Don't do these because they require a CFRelease
93 "CreateTypeStringWithOSType",
97 # def makeblacklisttypes(self):
98 # return ["EventComparatorUPP",
99 # "EventLoopTimerUPP",
100 # #"EventHandlerUPP",
101 # "EventComparatorProcPtr",
102 # "EventLoopTimerProcPtr",
103 # "EventHandlerProcPtr",
106 def makerepairinstructions(self
):
108 ([("UInt32", 'inSize', "InMode"), ("void_ptr", 'inDataPtr', "InMode")],
109 [("MyInBuffer", 'inDataPtr', "InMode")]),
110 ([("Boolean", 'ioWasInRgn', "OutMode")],
111 [("Boolean", 'ioWasInRgn', "InOutMode")]),
114 if __name__
== "__main__":