1996-04-16 11:29:15 -03:00
|
|
|
# Scan an Apple header file, generating a Python file of generator calls.
|
|
|
|
|
1998-04-17 11:07:56 -03:00
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen')
|
|
|
|
sys.path.append(BGENDIR)
|
1998-02-20 11:57:30 -04:00
|
|
|
from scantools import Scanner_PreUH3
|
1997-08-27 11:09:25 -03:00
|
|
|
from bgenlocations import MWERKSDIR, TOOLBOXDIR
|
1996-04-16 11:29:15 -03:00
|
|
|
|
1998-02-20 11:57:30 -04:00
|
|
|
WASTEDIR=":::::Waste 1.3 Distribution:WASTE C/C++ Headers:"
|
1996-04-16 11:29:15 -03:00
|
|
|
|
|
|
|
OBJECT = "TEHandle"
|
|
|
|
SHORT = "waste"
|
|
|
|
OBJECT = "WEReference"
|
|
|
|
OBJECT2 = "WEObjectReference"
|
|
|
|
|
|
|
|
def main():
|
1997-08-27 11:09:25 -03:00
|
|
|
input = WASTEDIR + "WASTE.h"
|
1996-04-16 11:29:15 -03:00
|
|
|
output = SHORT + "gen.py"
|
|
|
|
defsoutput = TOOLBOXDIR + "WASTEconst.py"
|
|
|
|
scanner = MyScanner(input, output, defsoutput)
|
|
|
|
scanner.scan()
|
1996-04-23 13:17:08 -03:00
|
|
|
## scanner.gentypetest(SHORT+"typetest.py")
|
1996-04-16 11:29:15 -03:00
|
|
|
scanner.close()
|
|
|
|
print "=== Done scanning and generating, now importing the generated code... ==="
|
|
|
|
exec "import " + SHORT + "support"
|
|
|
|
print "=== Done. It's up to you to compile it now! ==="
|
|
|
|
|
1998-02-20 11:57:30 -04:00
|
|
|
class MyScanner(Scanner_PreUH3):
|
1996-04-16 11:29:15 -03:00
|
|
|
|
|
|
|
def destination(self, type, name, arglist):
|
|
|
|
classname = "Function"
|
|
|
|
listname = "functions"
|
|
|
|
if arglist:
|
|
|
|
t, n, m = arglist[-1]
|
|
|
|
# This is non-functional today
|
|
|
|
if t == OBJECT and m == "InMode":
|
|
|
|
classname = "Method"
|
|
|
|
listname = "methods"
|
|
|
|
else:
|
|
|
|
t, n, m = arglist[0]
|
|
|
|
if t == OBJECT2 and m == "InMode":
|
|
|
|
classname = "Method2"
|
|
|
|
listname = "methods2"
|
|
|
|
return classname, listname
|
|
|
|
|
1998-02-20 11:57:30 -04:00
|
|
|
def writeinitialdefs(self):
|
|
|
|
self.defsfile.write("kPascalStackBased = None # workaround for header parsing\n")
|
1996-04-16 11:29:15 -03:00
|
|
|
def makeblacklistnames(self):
|
|
|
|
return [
|
|
|
|
"WEDispose",
|
|
|
|
"WESetInfo", # Argument type unknown...
|
|
|
|
"WEGetInfo",
|
1996-08-06 13:04:22 -03:00
|
|
|
"WEVersion", # Unfortunately...
|
1996-04-16 11:29:15 -03:00
|
|
|
]
|
|
|
|
|
|
|
|
def makeblacklisttypes(self):
|
|
|
|
return [
|
|
|
|
"DragReference", # For now...
|
|
|
|
"UniversalProcPtr",
|
1997-08-27 11:09:25 -03:00
|
|
|
"WEFontIDToNameUPP",
|
|
|
|
"WEFontNameToIDUPP",
|
1996-04-16 11:29:15 -03:00
|
|
|
]
|
|
|
|
|
|
|
|
def makerepairinstructions(self):
|
|
|
|
return [
|
1996-08-06 13:04:22 -03:00
|
|
|
([("void_ptr", "*", "InMode"), ("SInt32", "*", "InMode")],
|
1996-04-16 11:29:15 -03:00
|
|
|
[("InBuffer", "*", "*")]),
|
|
|
|
|
|
|
|
# WEContinuousStyle
|
1996-04-23 13:17:08 -03:00
|
|
|
([("WEStyleMode", "mode", "OutMode"), ("TextStyle", "ts", "OutMode")],
|
|
|
|
[("WEStyleMode", "mode", "InOutMode"), ("TextStyle", "ts", "OutMode")]),
|
|
|
|
|
|
|
|
# WECopyRange
|
|
|
|
([('Handle', 'hText', 'InMode'), ('StScrpHandle', 'hStyles', 'InMode'),
|
|
|
|
('WESoupHandle', 'hSoup', 'InMode')],
|
|
|
|
[('OptHandle', 'hText', 'InMode'), ('OptStScrpHandle', 'hStyles', 'InMode'),
|
|
|
|
('OptSoupHandle', 'hSoup', 'InMode')]),
|
|
|
|
|
|
|
|
# WEInsert
|
|
|
|
([('StScrpHandle', 'hStyles', 'InMode'), ('WESoupHandle', 'hSoup', 'InMode')],
|
1996-05-07 12:24:01 -03:00
|
|
|
[('OptStScrpHandle', 'hStyles', 'InMode'), ('OptSoupHandle', 'hSoup', 'InMode')]),
|
|
|
|
|
|
|
|
# WEGetObjectOwner
|
|
|
|
("WEGetObjectOwner",
|
|
|
|
[('WEReference', '*', 'ReturnMode')],
|
|
|
|
[('ExistingWEReference', '*', 'ReturnMode')])
|
1996-04-23 13:17:08 -03:00
|
|
|
|
1996-04-16 11:29:15 -03:00
|
|
|
]
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|