1 # Scan an Apple header file, generating a Python file of generator calls.
3 # Note that the scrap-manager include file is so weird that this
4 # generates a boilerplate to be edited by hand.
7 from bgenlocations
import TOOLBOXDIR
, BGENDIR
8 sys
.path
.append(BGENDIR
)
9 from scantools
import Scanner
16 output
= SHORT
+ "gen.py"
17 defsoutput
= "@Scrap.py"
18 scanner
= MyScanner(input, output
, defsoutput
)
21 ## print "=== Testing definitions output code ==="
22 ## execfile(defsoutput, {}, {})
23 print "=== Done scanning and generating, now importing the generated code... ==="
24 exec "import " + SHORT
+ "support"
25 print "=== Done. It's up to you to compile it now! ==="
27 class MyScanner(Scanner
):
29 def destination(self
, type, name
, arglist
):
30 classname
= "Function"
31 listname
= "functions"
34 if t
== 'ScrapRef' and m
== "InMode":
37 return classname
, listname
39 def makeblacklistnames(self
):
41 "GetScrapFlavorInfoList",
48 def makeblacklisttypes(self
):
50 'ScrapPromiseKeeperUPP',
53 def makerepairinstructions(self
):
55 ([('void', '*', 'OutMode')], [('putscrapbuffer', '*', 'InMode')]),
56 ([('void_ptr', '*', 'InMode')], [('putscrapbuffer', '*', 'InMode')]),
59 if __name__
== "__main__":