1 # Scan an Apple header file, generating a Python file of generator calls.
4 addpack
.addpack(':Tools:bgen:bgen')
6 from scantools
import Scanner
11 defsoutput
= "QuickDraw.py"
12 scanner
= MyScanner(input, output
, defsoutput
)
16 # Grmpf. Universal Headers have Text-stuff in a different include file...
17 input = "QuickDrawText.h"
18 output
= "@qdgentext.py"
19 defsoutput
= "@QuickDrawText.py"
22 scanner
= MyScanner(input, output
, defsoutput
)
29 print "=== Copying QuickDrawText stuff into main files... ==="
30 ifp
= open("@qdgentext.py")
31 ofp
= open("qdgen.py", "a")
35 ifp
= open("@QuickDrawText.py")
36 ofp
= open("QuickDraw.py", "a")
41 print "=== Done scanning and generating, now importing the generated code... ==="
43 print "=== Done. It's up to you to compile it now! ==="
45 class MyScanner(Scanner
):
47 def destination(self
, type, name
, arglist
):
48 classname
= "Function"
49 listname
= "functions"
52 if t
in ("WindowPtr", "WindowPeek", "WindowRef") and m
== "InMode":
55 return classname
, listname
57 def makeblacklistnames(self
):
67 def makeblacklisttypes(self
):
76 'ColorComplementProcPtr',
83 'DeviceLoopDrawingProcPtr',
99 def makerepairinstructions(self
):
101 ([('void_ptr', 'textBuf', 'InMode'),
102 ('short', 'firstByte', 'InMode'),
103 ('short', 'byteCount', 'InMode')],
104 [('TextThingie', '*', '*'), ('*', '*', '*'), ('*', '*', '*')]),
106 ([('Point', '*', 'OutMode')],
107 [('*', '*', 'InOutMode')]),
111 if __name__
== "__main__":