1995-01-30 07:53:55 -04:00
|
|
|
# Scan AppleEvents.h header file, generate aegen.py and AppleEvents.py files.
|
|
|
|
# Then run aesupport to generate AEmodule.c.
|
1998-04-17 11:07:56 -03:00
|
|
|
# (Should learn how to tell the compiler to compile it as well.)
|
1995-01-30 07:53:55 -04:00
|
|
|
|
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
import string
|
|
|
|
import MacOS
|
1998-04-17 11:07:56 -03:00
|
|
|
|
2002-08-05 12:39:30 -03:00
|
|
|
from bgenlocations import TOOLBOXDIR, BGENDIR
|
1998-04-17 11:07:56 -03:00
|
|
|
sys.path.append(BGENDIR)
|
1995-01-30 07:53:55 -04:00
|
|
|
|
|
|
|
from scantools import Scanner
|
|
|
|
|
|
|
|
def main():
|
2007-08-30 15:39:28 -03:00
|
|
|
print("=== Scanning AEDataModel.h, AppleEvents.h, AERegistry.h, AEObjects.h ===")
|
2004-07-18 03:16:08 -03:00
|
|
|
input = ["AEDataModel.h", "AEInteraction.h", "AppleEvents.h", "AERegistry.h", "AEObjects.h"]
|
|
|
|
output = "aegen.py"
|
|
|
|
defsoutput = TOOLBOXDIR + "AppleEvents.py"
|
|
|
|
scanner = AppleEventsScanner(input, output, defsoutput)
|
|
|
|
scanner.scan()
|
|
|
|
scanner.close()
|
2007-08-30 15:39:28 -03:00
|
|
|
print("=== Testing definitions output code ===")
|
2007-08-11 21:43:29 -03:00
|
|
|
exec(open(defsoutput).read(), {}, {})
|
2007-08-30 15:39:28 -03:00
|
|
|
print("=== Done Scanning and Generating, now doing 'import aesupport' ===")
|
2004-07-18 03:16:08 -03:00
|
|
|
import aesupport
|
2007-08-30 15:39:28 -03:00
|
|
|
print("=== Done 'import aesupport'. It's up to you to compile AEmodule.c ===")
|
1995-01-30 07:53:55 -04:00
|
|
|
|
|
|
|
class AppleEventsScanner(Scanner):
|
|
|
|
|
2004-07-18 03:16:08 -03:00
|
|
|
def destination(self, type, name, arglist):
|
|
|
|
classname = "AEFunction"
|
|
|
|
listname = "functions"
|
|
|
|
if arglist:
|
|
|
|
t, n, m = arglist[0]
|
|
|
|
if t[-4:] == "_ptr" and m == "InMode" and \
|
|
|
|
t[:-4] in ("AEDesc", "AEAddressDesc", "AEDescList",
|
|
|
|
"AERecord", "AppleEvent"):
|
|
|
|
classname = "AEMethod"
|
|
|
|
listname = "aedescmethods"
|
|
|
|
return classname, listname
|
|
|
|
|
|
|
|
def makeblacklistnames(self):
|
|
|
|
return [
|
|
|
|
"AEDisposeDesc",
|
|
|
|
# "AEGetEventHandler",
|
|
|
|
"AEGetDescData", # Use object.data
|
|
|
|
"AEGetSpecialHandler",
|
|
|
|
# Constants with funny definitions
|
|
|
|
"kAEDontDisposeOnResume",
|
|
|
|
"kAEUseStandardDispatch",
|
|
|
|
]
|
|
|
|
|
|
|
|
def makeblacklisttypes(self):
|
|
|
|
return [
|
|
|
|
"ProcPtr",
|
|
|
|
"AEArrayType",
|
|
|
|
"AECoercionHandlerUPP",
|
|
|
|
"UniversalProcPtr",
|
|
|
|
"OSLCompareUPP",
|
|
|
|
"OSLAccessorUPP",
|
|
|
|
]
|
|
|
|
|
|
|
|
def makerepairinstructions(self):
|
|
|
|
return [
|
|
|
|
([("Boolean", "isSysHandler", "InMode")],
|
|
|
|
[("AlwaysFalse", "*", "*")]),
|
|
|
|
|
|
|
|
([("void_ptr", "*", "InMode"), ("Size", "*", "InMode")],
|
|
|
|
[("InBuffer", "*", "*")]),
|
|
|
|
|
|
|
|
([("EventHandlerProcPtr", "*", "InMode"), ("long", "*", "InMode")],
|
|
|
|
[("EventHandler", "*", "*")]),
|
|
|
|
|
|
|
|
([("EventHandlerProcPtr", "*", "OutMode"), ("long", "*", "OutMode")],
|
|
|
|
[("EventHandler", "*", "*")]),
|
|
|
|
|
|
|
|
([("AEEventHandlerUPP", "*", "InMode"), ("long", "*", "InMode")],
|
|
|
|
[("EventHandler", "*", "*")]),
|
|
|
|
|
|
|
|
([("AEEventHandlerUPP", "*", "OutMode"), ("long", "*", "OutMode")],
|
|
|
|
[("EventHandler", "*", "*")]),
|
|
|
|
|
|
|
|
([("void", "*", "OutMode"), ("Size", "*", "InMode"),
|
|
|
|
("Size", "*", "OutMode")],
|
|
|
|
[("VarVarOutBuffer", "*", "InOutMode")]),
|
|
|
|
|
|
|
|
([("AppleEvent", "theAppleEvent", "OutMode")],
|
|
|
|
[("AppleEvent_ptr", "*", "InMode")]),
|
|
|
|
|
|
|
|
([("AEDescList", "theAEDescList", "OutMode")],
|
|
|
|
[("AEDescList_ptr", "*", "InMode")]),
|
|
|
|
]
|
|
|
|
|
|
|
|
def writeinitialdefs(self):
|
|
|
|
self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
|
1998-02-20 12:02:09 -04:00
|
|
|
|
1995-01-30 07:53:55 -04:00
|
|
|
if __name__ == "__main__":
|
2004-07-18 03:16:08 -03:00
|
|
|
main()
|