1 # Scan an Apple header file, generating a Python file of generator calls.
5 from bgenlocations
import TOOLBOXDIR
, BGENDIR
6 sys
.path
.append(BGENDIR
)
7 from scantools
import Scanner
11 OBJECT
= "ThemeDrawingState"
15 output
= SHORT
+ "gen.py"
16 defsoutput
= TOOLBOXDIR
+ LONG
+ ".py"
17 scanner
= MyScanner(input, output
, defsoutput
)
20 print "=== Testing definitions output code ==="
21 execfile(defsoutput
, {}, {})
22 print "=== Done scanning and generating, now importing the generated code... ==="
23 exec "import " + SHORT
+ "support"
24 print "=== Done. It's up to you to compile it now! ==="
26 class MyScanner(Scanner
):
28 def destination(self
, type, name
, arglist
):
29 classname
= "Function"
30 listname
= "functions"
33 # This is non-functional today
34 if t
== OBJECT
and m
== "InMode":
37 return classname
, listname
39 def writeinitialdefs(self
):
40 self
.defsfile
.write("def FOUR_CHAR_CODE(x): return x\n")
42 def makeblacklistnames(self
):
44 "GetThemeFont", # Funny stringbuffer in/out parameter, I think...
45 # Constants with funny definitions
46 "appearanceBadBrushIndexErr",
47 "appearanceProcessRegisteredErr",
48 "appearanceProcessNotRegisteredErr",
49 "appearanceBadTextColorIndexErr",
50 "appearanceThemeHasNoAccents",
51 "appearanceBadCursorIndexErr",
54 def makeblacklisttypes(self
):
56 "MenuTitleDrawingUPP",
59 "ThemeTabTitleDrawUPP",
61 # "ThemeButtonDrawUPP",
62 "WindowTitleDrawingUPP",
63 "ProcessSerialNumber_ptr", # Too much work for now.
64 "ThemeTrackDrawInfo_ptr", # Too much work
65 # "ThemeButtonDrawInfo_ptr", # ditto
66 "ThemeWindowMetrics_ptr", # ditto
67 # "ThemeDrawingState", # This is an opaque pointer, so it should be simple. Later.
68 "Collection", # No interface to collection mgr yet.
72 def makerepairinstructions(self
):
74 ([("void", 'inContext', "OutMode")],
75 [("NULL", 'inContext', "InMode")]),
76 ([("Point", 'ioBounds', "OutMode")],
77 [("Point", 'ioBounds', "InOutMode")]),
80 if __name__
== "__main__":