blob: 293edd65021961c3cc1bf7e043b7017aaf634861 [file] [log] [blame]
Jack Jansen52e90452001-11-05 14:44:23 +00001# IBCarbonscan.py
2
3import sys
4import os
5import string
6import MacOS
Jack Jansen34cbe712001-11-05 16:15:45 +00007import sys
Jack Jansen52e90452001-11-05 14:44:23 +00008
Jack Jansen34cbe712001-11-05 16:15:45 +00009BGENDIR= os.path.join(sys.prefix, ':Tools:bgen:bgen:')
Jack Jansen52e90452001-11-05 14:44:23 +000010sys.path.append(BGENDIR)
11
12from bgenlocations import TOOLBOXDIR
13
14from scantools import Scanner, Scanner_OSX
15
16def main():
17 print "---Scanning CarbonEvents.h---"
18 input = ["CarbonEvents.h"]
19 output = "CarbonEventsgen.py"
20 defsoutput = TOOLBOXDIR + "CarbonEvents.py"
21 scanner = CarbonEvents_Scanner(input, output, defsoutput)
22 scanner.scan()
23 scanner.close()
24 print "--done scanning, importing--"
Jack Jansen34cbe712001-11-05 16:15:45 +000025 import CarbonEvtsupport
Jack Jansen52e90452001-11-05 14:44:23 +000026 print "done"
27
28RefObjectTypes = ["EventRef",
29 "EventQueueRef",
30 "EventLoopRef",
31 "EventLoopTimerRef",
32 "EventHandlerRef",
33 "EventHandlerCallRef",
34 "EventTargetRef",
35 "EventHotKeyRef",
36 ]
37
38class CarbonEvents_Scanner(Scanner):
39 def destination(self, type, name, arglist):
40 classname = "CarbonEventsFunction"
41 listname = "functions"
42 if arglist:
43 t, n, m = arglist[0]
44 print "*********", t,
45 if t in RefObjectTypes and m == "InMode":
46 print "method"
47 classname = "CarbonEventsMethod"
48 listname = t + "methods"
49 else:
50 print "not method"
51 return classname, listname
52
53 def makeblacklistnames(self):
54 return [
55 "MacCreateEvent",
56 "TrackMouseLocationWithOptions",
57 "TrackMouseLocation",
58 "TrackMouseRegion",
59 "RegisterToolboxObjectClass",
60 "UnregisterToolboxObjectClass",
61 "ProcessHICommand",
62 "GetCFRunLoopFromEventLoop",
63
64 "InvokeEventHandlerUPP",
65 "InvokeEventComparatorUPP",
66 "InvokeEventLoopTimerUPP",
67
68 # Wrote by hand
69 "InstallEventHandler",
70 "RunApplicationEventLoop",
71
72 # Write by hand?
73 "GetEventParameter",
74 "FlushSpecificEventsFromQueue",
75 "FindSpecificEventInQueue",
76 "InstallEventLoopTimer",
77
78 # Don't do these because they require a CFRelease
79 "CreateTypeStringWithOSType",
80 "CopyEvent",
81 ]
82
83# def makeblacklisttypes(self):
84# return ["EventComparatorUPP",
85# "EventLoopTimerUPP",
86# #"EventHandlerUPP",
87# "EventComparatorProcPtr",
88# "EventLoopTimerProcPtr",
89# "EventHandlerProcPtr",
90# ]
Jack Jansen34cbe712001-11-05 16:15:45 +000091
92 def makerepairinstructions(self):
93 return []
94
Jack Jansen52e90452001-11-05 14:44:23 +000095if __name__ == "__main__":
96 main()