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
12 OBJECT
= "ThemeDrawingState"
16 output
= SHORT
+ "gen.py"
17 defsoutput
= TOOLBOXDIR
+ LONG
+ ".py"
18 scanner
= MyScanner(input, output
, defsoutput
)
21 print "=== Done scanning and generating, now importing the generated code... ==="
22 exec "import " + SHORT
+ "support"
23 print "=== Done. It's up to you to compile it now! ==="
25 class MyScanner(Scanner
):
27 def destination(self
, type, name
, arglist
):
28 classname
= "Function"
29 listname
= "functions"
32 # This is non-functional today
33 if t
== OBJECT
and m
== "InMode":
36 return classname
, listname
38 def writeinitialdefs(self
):
39 self
.defsfile
.write("def FOUR_CHAR_CODE(x): return x\n")
41 def makeblacklistnames(self
):
43 "GetThemeFont", # Funny stringbuffer in/out parameter, I think...
44 # Constants with funny definitions
45 "appearanceBadBrushIndexErr",
46 "appearanceProcessRegisteredErr",
47 "appearanceProcessNotRegisteredErr",
48 "appearanceBadTextColorIndexErr",
49 "appearanceThemeHasNoAccents",
50 "appearanceBadCursorIndexErr",
53 def makegreylist(self
):
55 ('#if TARGET_API_MAC_CARBON', [
57 'GetThemeTextShadowOutset',
58 'GetThemeTextDimensions',
63 def makeblacklisttypes(self
):
65 "MenuTitleDrawingUPP",
68 "ThemeTabTitleDrawUPP",
70 # "ThemeButtonDrawUPP",
71 "WindowTitleDrawingUPP",
72 "ProcessSerialNumber_ptr", # Too much work for now.
73 "ThemeTrackDrawInfo_ptr", # Too much work
74 # "ThemeButtonDrawInfo_ptr", # ditto
75 "ThemeWindowMetrics_ptr", # ditto
76 # "ThemeDrawingState", # This is an opaque pointer, so it should be simple. Later.
77 "Collection", # No interface to collection mgr yet.
81 def makerepairinstructions(self
):
83 ([("void", 'inContext', "OutMode")],
84 [("NULL", 'inContext', "InMode")]),
85 ([("Point", 'ioBounds', "OutMode")],
86 [("Point", 'ioBounds', "InOutMode")]),
89 if __name__
== "__main__":