Jack Jansen | 52e9045 | 2001-11-05 14:44:23 +0000 | [diff] [blame] | 1 | # IBCarbonscan.py |
| 2 | |
| 3 | import sys |
| 4 | import os |
| 5 | import string |
| 6 | import MacOS |
Jack Jansen | 34cbe71 | 2001-11-05 16:15:45 +0000 | [diff] [blame^] | 7 | import sys |
Jack Jansen | 52e9045 | 2001-11-05 14:44:23 +0000 | [diff] [blame] | 8 | |
Jack Jansen | 34cbe71 | 2001-11-05 16:15:45 +0000 | [diff] [blame^] | 9 | BGENDIR= os.path.join(sys.prefix, ':Tools:bgen:bgen:') |
Jack Jansen | 52e9045 | 2001-11-05 14:44:23 +0000 | [diff] [blame] | 10 | sys.path.append(BGENDIR) |
| 11 | |
| 12 | from bgenlocations import TOOLBOXDIR |
| 13 | |
| 14 | from scantools import Scanner, Scanner_OSX |
| 15 | |
| 16 | def 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 Jansen | 34cbe71 | 2001-11-05 16:15:45 +0000 | [diff] [blame^] | 25 | import CarbonEvtsupport |
Jack Jansen | 52e9045 | 2001-11-05 14:44:23 +0000 | [diff] [blame] | 26 | print "done" |
| 27 | |
| 28 | RefObjectTypes = ["EventRef", |
| 29 | "EventQueueRef", |
| 30 | "EventLoopRef", |
| 31 | "EventLoopTimerRef", |
| 32 | "EventHandlerRef", |
| 33 | "EventHandlerCallRef", |
| 34 | "EventTargetRef", |
| 35 | "EventHotKeyRef", |
| 36 | ] |
| 37 | |
| 38 | class 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 Jansen | 34cbe71 | 2001-11-05 16:15:45 +0000 | [diff] [blame^] | 91 | |
| 92 | def makerepairinstructions(self): |
| 93 | return [] |
| 94 | |
Jack Jansen | 52e9045 | 2001-11-05 14:44:23 +0000 | [diff] [blame] | 95 | if __name__ == "__main__": |
| 96 | main() |