blob: 72c2db2c3225678478f037a2831968894cd8b47a [file] [log] [blame]
Jack Jansene32596b1999-03-04 22:54:29 +00001# Scan an Apple header file, generating a Python file of generator calls.
2
3import sys
4import os
5BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen')
6sys.path.append(BGENDIR)
7from scantools import Scanner
8from bgenlocations import TOOLBOXDIR
9
10LONG = "Appearance"
11SHORT = "app"
12OBJECT = "NOTUSED"
13
14def main():
15 input = LONG + ".h"
16 output = SHORT + "gen.py"
17 defsoutput = TOOLBOXDIR + LONG + ".py"
18 scanner = MyScanner(input, output, defsoutput)
19 scanner.scan()
20 scanner.close()
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! ==="
24
25class MyScanner(Scanner):
26
27 def destination(self, type, name, arglist):
28 classname = "Function"
29 listname = "functions"
30 if arglist:
31 t, n, m = arglist[0]
32 # This is non-functional today
33 if t == OBJECT and m == "InMode":
34 classname = "Method"
35 listname = "methods"
36 return classname, listname
37
38 def writeinitialdefs(self):
39 self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
40
41 def makeblacklistnames(self):
42 return [
Jack Jansend6bc4e71999-12-10 16:16:19 +000043 "GetThemeFont", # Funny stringbuffer in/out parameter, I think...
Jack Jansen620e9142000-12-19 21:33:51 +000044 # Constants with funny definitions
45 "appearanceBadBrushIndexErr",
46 "appearanceProcessRegisteredErr",
47 "appearanceProcessNotRegisteredErr",
48 "appearanceBadTextColorIndexErr",
49 "appearanceThemeHasNoAccents",
50 "appearanceBadCursorIndexErr",
Jack Jansene32596b1999-03-04 22:54:29 +000051 ]
52
Jack Jansenf7d5aa62000-12-10 23:43:49 +000053 def makegreylist(self):
54 return [
55 ('#if TARGET_API_MAC_CARBON', [
56 'GetThemeMetric',
57 ])]
58
Jack Jansene32596b1999-03-04 22:54:29 +000059 def makeblacklisttypes(self):
60 return [
61 "MenuTitleDrawingUPP",
62 "MenuItemDrawingUPP",
Jack Jansend6bc4e71999-12-10 16:16:19 +000063 "ThemeIteratorUPP",
64 "ThemeTabTitleDrawUPP",
65 "ThemeEraseUPP",
66 "ThemeButtonDrawUPP",
67 "WindowTitleDrawingUPP",
68 "ProcessSerialNumber_ptr", # Too much work for now.
69 "ThemeTrackDrawInfo_ptr", # Too much work
70 "ThemeButtonDrawInfo_ptr", # ditto
71 "ThemeWindowMetrics_ptr", # ditto
72 "ThemeDrawingState", # This is an opaque pointer, so it should be simple. Later.
73 "Collection", # No interface to collection mgr yet.
Jack Jansene32596b1999-03-04 22:54:29 +000074 ]
75
76 def makerepairinstructions(self):
77 return [
78 ]
79
80if __name__ == "__main__":
81 main()