1995-01-30 07:53:55 -04:00
|
|
|
# Scan an Apple header file, generating a Python file of generator calls.
|
1995-06-06 10:08:40 -03:00
|
|
|
import addpack
|
|
|
|
addpack.addpack(':Tools:bgen:bgen')
|
1996-04-12 13:29:23 -03:00
|
|
|
from bgenlocations import TOOLBOXDIR
|
1995-01-30 07:53:55 -04:00
|
|
|
|
|
|
|
from scantools import Scanner
|
|
|
|
|
|
|
|
def main():
|
|
|
|
input = "Windows.h"
|
|
|
|
output = "wingen.py"
|
1996-04-12 13:29:23 -03:00
|
|
|
defsoutput = TOOLBOXDIR + "Windows.py"
|
1995-01-30 07:53:55 -04:00
|
|
|
scanner = MyScanner(input, output, defsoutput)
|
|
|
|
scanner.scan()
|
|
|
|
scanner.close()
|
|
|
|
print "=== Done scanning and generating, now importing the generated code... ==="
|
|
|
|
import winsupport
|
|
|
|
print "=== Done. It's up to you to compile it now! ==="
|
|
|
|
|
|
|
|
class MyScanner(Scanner):
|
|
|
|
|
|
|
|
def destination(self, type, name, arglist):
|
|
|
|
classname = "Function"
|
|
|
|
listname = "functions"
|
|
|
|
if arglist:
|
|
|
|
t, n, m = arglist[0]
|
1995-06-06 10:08:40 -03:00
|
|
|
if t in ("WindowPtr", "WindowPeek", "WindowRef") and m == "InMode":
|
1995-01-30 07:53:55 -04:00
|
|
|
classname = "Method"
|
|
|
|
listname = "methods"
|
|
|
|
return classname, listname
|
|
|
|
|
|
|
|
def makeblacklistnames(self):
|
|
|
|
return [
|
|
|
|
'DisposeWindow', # Implied when the object is deleted
|
|
|
|
'CloseWindow',
|
|
|
|
]
|
|
|
|
|
|
|
|
def makeblacklisttypes(self):
|
|
|
|
return [
|
|
|
|
'ProcPtr',
|
|
|
|
'WCTabHandle',
|
|
|
|
'AuxWinHandle',
|
|
|
|
'PixPatHandle',
|
1995-11-15 11:18:47 -04:00
|
|
|
'DragGrayRgnUPP',
|
1995-01-30 07:53:55 -04:00
|
|
|
]
|
|
|
|
|
|
|
|
def makerepairinstructions(self):
|
|
|
|
return [
|
|
|
|
|
|
|
|
# GetWTitle
|
|
|
|
([("Str255", "*", "InMode")],
|
|
|
|
[("*", "*", "OutMode")]),
|
|
|
|
|
|
|
|
([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
|
|
|
|
[("InBuffer", "*", "*")]),
|
|
|
|
|
|
|
|
([("void", "*", "OutMode"), ("long", "*", "InMode"),
|
|
|
|
("long", "*", "OutMode")],
|
|
|
|
[("VarVarOutBuffer", "*", "InOutMode")]),
|
|
|
|
|
|
|
|
([("void", "wStorage", "OutMode")],
|
|
|
|
[("NullStorage", "*", "InMode")]),
|
|
|
|
|
|
|
|
([("WindowPtr", "*", "OutMode")],
|
|
|
|
[("ExistingWindowPtr", "*", "*")]),
|
1995-06-06 10:08:40 -03:00
|
|
|
([("WindowRef", "*", "OutMode")], # Same, but other style headerfiles
|
|
|
|
[("ExistingWindowPtr", "*", "*")]),
|
1995-02-28 05:49:02 -04:00
|
|
|
|
|
|
|
([("WindowPtr", "FrontWindow", "ReturnMode")],
|
|
|
|
[("ExistingWindowPtr", "*", "*")]),
|
1995-06-06 10:08:40 -03:00
|
|
|
([("WindowRef", "FrontWindow", "ReturnMode")], # Ditto
|
|
|
|
[("ExistingWindowPtr", "*", "*")]),
|
1995-01-30 07:53:55 -04:00
|
|
|
]
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|
1995-02-28 05:49:02 -04:00
|
|
|
|