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 |
| 7 | |
| 8 | BGENDIR= '/Users/dsp/Documents/python/dist/src/Tools/bgen/bgen' |
| 9 | sys.path.append(BGENDIR) |
| 10 | |
| 11 | from bgenlocations import TOOLBOXDIR |
| 12 | |
| 13 | from scantools import Scanner, Scanner_OSX |
| 14 | |
| 15 | def main(): |
| 16 | print "---Scanning CarbonEvents.h---" |
| 17 | input = ["CarbonEvents.h"] |
| 18 | output = "CarbonEventsgen.py" |
| 19 | defsoutput = TOOLBOXDIR + "CarbonEvents.py" |
| 20 | scanner = CarbonEvents_Scanner(input, output, defsoutput) |
| 21 | scanner.scan() |
| 22 | scanner.close() |
| 23 | print "--done scanning, importing--" |
| 24 | import CarbonEventssupport |
| 25 | print "done" |
| 26 | |
| 27 | RefObjectTypes = ["EventRef", |
| 28 | "EventQueueRef", |
| 29 | "EventLoopRef", |
| 30 | "EventLoopTimerRef", |
| 31 | "EventHandlerRef", |
| 32 | "EventHandlerCallRef", |
| 33 | "EventTargetRef", |
| 34 | "EventHotKeyRef", |
| 35 | ] |
| 36 | |
| 37 | class CarbonEvents_Scanner(Scanner): |
| 38 | def destination(self, type, name, arglist): |
| 39 | classname = "CarbonEventsFunction" |
| 40 | listname = "functions" |
| 41 | if arglist: |
| 42 | t, n, m = arglist[0] |
| 43 | print "*********", t, |
| 44 | if t in RefObjectTypes and m == "InMode": |
| 45 | print "method" |
| 46 | classname = "CarbonEventsMethod" |
| 47 | listname = t + "methods" |
| 48 | else: |
| 49 | print "not method" |
| 50 | return classname, listname |
| 51 | |
| 52 | def makeblacklistnames(self): |
| 53 | return [ |
| 54 | "MacCreateEvent", |
| 55 | "TrackMouseLocationWithOptions", |
| 56 | "TrackMouseLocation", |
| 57 | "TrackMouseRegion", |
| 58 | "RegisterToolboxObjectClass", |
| 59 | "UnregisterToolboxObjectClass", |
| 60 | "ProcessHICommand", |
| 61 | "GetCFRunLoopFromEventLoop", |
| 62 | |
| 63 | "InvokeEventHandlerUPP", |
| 64 | "InvokeEventComparatorUPP", |
| 65 | "InvokeEventLoopTimerUPP", |
| 66 | |
| 67 | # Wrote by hand |
| 68 | "InstallEventHandler", |
| 69 | "RunApplicationEventLoop", |
| 70 | |
| 71 | # Write by hand? |
| 72 | "GetEventParameter", |
| 73 | "FlushSpecificEventsFromQueue", |
| 74 | "FindSpecificEventInQueue", |
| 75 | "InstallEventLoopTimer", |
| 76 | |
| 77 | # Don't do these because they require a CFRelease |
| 78 | "CreateTypeStringWithOSType", |
| 79 | "CopyEvent", |
| 80 | ] |
| 81 | |
| 82 | # def makeblacklisttypes(self): |
| 83 | # return ["EventComparatorUPP", |
| 84 | # "EventLoopTimerUPP", |
| 85 | # #"EventHandlerUPP", |
| 86 | # "EventComparatorProcPtr", |
| 87 | # "EventLoopTimerProcPtr", |
| 88 | # "EventHandlerProcPtr", |
| 89 | # ] |
| 90 | if __name__ == "__main__": |
| 91 | main() |