1 # Scan an Apple header file, generating a Python file of generator calls.
5 BGENDIR
=os
.path
.join(sys
.prefix
, ':Tools:bgen:bgen')
6 sys
.path
.append(BGENDIR
)
7 from scantools
import Scanner
8 from bgenlocations
import TOOLBOXDIR
15 output
= SHORT
+ "gen.py"
16 defsoutput
= TOOLBOXDIR
+ LONG
+ ".py"
17 scanner
= MyScanner(input, output
, defsoutput
)
20 print "=== Done scanning and generating, now importing the generated code... ==="
21 exec "import " + SHORT
+ "support"
22 print "=== Done. It's up to you to compile it now! ==="
24 class MyScanner(Scanner
):
26 def destination(self
, type, name
, arglist
):
27 classname
= "Function"
28 listname
= "functions"
29 return classname
, listname
31 def makeblacklistnames(self
):
33 "OutlineMetrics", # Too complicated
34 "AntiTextIsAntiAliased", # XXXX Missing from library...
37 "AntiTextGetApplicationAware",
38 "AntiTextSetApplicationAware",
41 def makegreylist(self
):
43 ('#if !TARGET_API_MAC_CARBON', [
48 def makeblacklisttypes(self
):
50 "FMInput_ptr", # Not needed for now
52 "void_ptr", # Don't know how to do this right now
56 def makerepairinstructions(self
):
58 ([('Str255', '*', 'InMode')], [('Str255', '*', 'OutMode')]),
59 ([('FMetricRecPtr', 'theMetrics', 'InMode')], [('FMetricRecPtr', 'theMetrics', 'OutMode')]),
62 if __name__
== "__main__":