Move setting of ioready 'wait' earlier in call chain, to
[python/dscho.git] / Mac / Modules / carbonevt / CarbonEvtscan.py
blobd3088fd0f2300e328ca491ef66f2bd481f6165c2
1 # IBCarbonscan.py
3 import sys
4 import os
5 import string
6 import MacOS
7 import sys
9 from bgenlocations import TOOLBOXDIR, BGENDIR
10 sys.path.append(BGENDIR)
12 from scantools import Scanner, Scanner_OSX
14 def main():
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)
20 scanner.scan()
21 scanner.close()
22 print "=== Testing definitions output code ==="
23 execfile(defsoutput, {}, {})
24 print "--done scanning, importing--"
25 import CarbonEvtsupport
26 print "done"
28 RefObjectTypes = ["EventRef",
29 "EventQueueRef",
30 "EventLoopRef",
31 "EventLoopTimerRef",
32 "EventHandlerRef",
33 "EventHandlerCallRef",
34 "EventTargetRef",
35 "EventHotKeyRef",
38 class CarbonEvents_Scanner(Scanner_OSX):
39 def destination(self, type, name, arglist):
40 classname = "CarbonEventsFunction"
41 listname = "functions"
42 if arglist:
43 t, n, m = arglist[0]
44 if t in RefObjectTypes and m == "InMode":
45 if t == "EventHandlerRef":
46 classname = "EventHandlerRefMethod"
47 else:
48 classname = "CarbonEventsMethod"
49 listname = t + "methods"
50 #else:
51 # print "not method"
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):
63 return [
64 "sHandler",
65 "MacCreateEvent",
66 # "TrackMouseLocationWithOptions",
67 # "TrackMouseLocation",
68 # "TrackMouseRegion",
69 "RegisterToolboxObjectClass",
70 "UnregisterToolboxObjectClass",
71 "ProcessHICommand",
72 "GetCFRunLoopFromEventLoop",
74 "InvokeEventHandlerUPP",
75 "InvokeEventComparatorUPP",
76 "InvokeEventLoopTimerUPP",
77 "NewEventComparatorUPP",
78 "NewEventLoopTimerUPP",
79 "NewEventHandlerUPP",
80 "DisposeEventComparatorUPP",
81 "DisposeEventLoopTimerUPP",
82 "DisposeEventHandlerUPP",
84 # Wrote by hand
85 "InstallEventHandler",
86 "RemoveEventHandler",
87 "RunApplicationEventLoop",
89 # Write by hand?
90 "GetEventParameter",
91 "FlushSpecificEventsFromQueue",
92 "FindSpecificEventInQueue",
93 "InstallEventLoopTimer",
95 # Don't do these because they require a CFRelease
96 "CreateTypeStringWithOSType",
97 "CopyEvent",
100 # def makeblacklisttypes(self):
101 # return ["EventComparatorUPP",
102 # "EventLoopTimerUPP",
103 # #"EventHandlerUPP",
104 # "EventComparatorProcPtr",
105 # "EventLoopTimerProcPtr",
106 # "EventHandlerProcPtr",
109 def makerepairinstructions(self):
110 return [
111 ([("UInt32", 'inSize', "InMode"), ("void_ptr", 'inDataPtr', "InMode")],
112 [("MyInBuffer", 'inDataPtr', "InMode")]),
113 ([("Boolean", 'ioWasInRgn', "OutMode")],
114 [("Boolean", 'ioWasInRgn', "InOutMode")]),
117 if __name__ == "__main__":
118 main()