summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/carbonevt/CarbonEvtscan.py
blob: 96f9b55b854bf7298331763cb4ad968aea97d029 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# IBCarbonscan.py

import sys
import os
import string
import MacOS

BGENDIR= '/Users/dsp/Documents/python/dist/src/Tools/bgen/bgen'
sys.path.append(BGENDIR)

from bgenlocations import TOOLBOXDIR

from scantools import Scanner, Scanner_OSX

def main():
	print "---Scanning CarbonEvents.h---"
	input = ["CarbonEvents.h"]
	output = "CarbonEventsgen.py"
	defsoutput = TOOLBOXDIR + "CarbonEvents.py"
	scanner = CarbonEvents_Scanner(input, output, defsoutput)
	scanner.scan()
	scanner.close()
	print "--done scanning, importing--"
	import CarbonEventssupport
	print "done"

RefObjectTypes = ["EventRef", 
				"EventQueueRef", 
				"EventLoopRef",
				"EventLoopTimerRef",
				"EventHandlerRef",
				"EventHandlerCallRef",
				"EventTargetRef",
				"EventHotKeyRef",
				]

class CarbonEvents_Scanner(Scanner):
	def destination(self, type, name, arglist):
		classname = "CarbonEventsFunction"
		listname = "functions"
		if arglist:
			t, n, m = arglist[0]
			print "*********", t,
			if t in RefObjectTypes and m == "InMode":
				print "method"
				classname = "CarbonEventsMethod"
				listname = t + "methods"
			else:
				print "not method"
		return classname, listname

	def makeblacklistnames(self):
		return [
			"MacCreateEvent",
			"TrackMouseLocationWithOptions",
			"TrackMouseLocation",
			"TrackMouseRegion",
			"RegisterToolboxObjectClass",
			"UnregisterToolboxObjectClass",
			"ProcessHICommand",
			"GetCFRunLoopFromEventLoop",
			
			"InvokeEventHandlerUPP",
			"InvokeEventComparatorUPP",
			"InvokeEventLoopTimerUPP",

			# Wrote by hand
			"InstallEventHandler",
			"RunApplicationEventLoop",
						
			# Write by hand?
			"GetEventParameter",
			"FlushSpecificEventsFromQueue",
			"FindSpecificEventInQueue",
			"InstallEventLoopTimer",

			# Don't do these because they require a CFRelease
			"CreateTypeStringWithOSType",
			"CopyEvent",
			]

#	def makeblacklisttypes(self):
#		return ["EventComparatorUPP",
#				"EventLoopTimerUPP",
#				#"EventHandlerUPP",
#				"EventComparatorProcPtr",
#				"EventLoopTimerProcPtr",
#				"EventHandlerProcPtr",
#				]
if __name__ == "__main__":
	main()