1 # Scan AppleEvents.h header file, generate aegen.py and AppleEvents.py files.
2 # Then run aesupport to generate AEmodule.c.
3 0# (Should learn how to tell the compiler to compile it as well.)
6 addpack
.addpack(':Tools:bgen:bgen')
13 from bgenlocations
import TOOLBOXDIR
15 from scantools
import Scanner
18 print "=== Scanning AERegistry.h for defines ==="
19 input = "AERegistry.h"
20 output
= "@dummy-registry.py"
21 defsoutput
= TOOLBOXDIR
+ "AERegistry.py"
22 scanner
= AppleEventsScanner(input, output
, defsoutput
)
25 print "=== Scanning AEObjects.h for defines ==="
26 # XXXX This isn't correct. We only scan AEObjects.h for defines, but there
27 # are some functions in there that are probably useful (the accessor stuff)
28 # once we start writing servers in python.
30 output
= "@dummy-objects.py"
31 defsoutput
= TOOLBOXDIR
+ "AEObjects.py"
32 scanner
= AppleEventsScanner(input, output
, defsoutput
)
35 print "=== Scanning AppleEvents.py ==="
36 input = "AppleEvents.h"
38 defsoutput
= TOOLBOXDIR
+ "AppleEvents.py"
39 scanner
= AppleEventsScanner(input, output
, defsoutput
)
42 print "=== Done Scanning and Generating, now doing 'import aesupport' ==="
44 print "=== Done 'import aesupport'. It's up to you to compile AEmodule.c ==="
46 class AppleEventsScanner(Scanner
):
48 def destination(self
, type, name
, arglist
):
49 classname
= "AEFunction"
50 listname
= "functions"
53 if t
[-4:] == "_ptr" and m
== "InMode" and \
54 t
[:-4] in ("AEDesc", "AEAddressDesc", "AEDescList",
55 "AERecord", "AppleEvent"):
56 classname
= "AEMethod"
57 listname
= "aedescmethods"
58 return classname
, listname
60 def makeblacklistnames(self
):
63 # "AEGetEventHandler",
66 def makeblacklisttypes(self
):
70 "AECoercionHandlerUPP",
74 def makerepairinstructions(self
):
76 ([("Boolean", "isSysHandler", "InMode")],
77 [("AlwaysFalse", "*", "*")]),
79 ([("void_ptr", "*", "InMode"), ("Size", "*", "InMode")],
80 [("InBuffer", "*", "*")]),
82 ([("EventHandlerProcPtr", "*", "InMode"), ("long", "*", "InMode")],
83 [("EventHandler", "*", "*")]),
85 ([("EventHandlerProcPtr", "*", "OutMode"), ("long", "*", "OutMode")],
86 [("EventHandler", "*", "*")]),
88 ([("AEEventHandlerUPP", "*", "InMode"), ("long", "*", "InMode")],
89 [("EventHandler", "*", "*")]),
91 ([("AEEventHandlerUPP", "*", "OutMode"), ("long", "*", "OutMode")],
92 [("EventHandler", "*", "*")]),
94 ([("void", "*", "OutMode"), ("Size", "*", "InMode"),
95 ("Size", "*", "OutMode")],
96 [("VarVarOutBuffer", "*", "InOutMode")]),
98 ([("AppleEvent", "theAppleEvent", "OutMode")],
99 [("AppleEvent_ptr", "*", "InMode")]),
101 ([("AEDescList", "theAEDescList", "OutMode")],
102 [("AEDescList_ptr", "*", "InMode")]),
105 if __name__
== "__main__":