blob: adbb3dca6900560e743b19a8f5cd088e3acfa9dd [file] [log] [blame]
Jack Jansen6259af91996-01-09 17:15:16 +00001# Scan an Apple header file, generating a Python file of generator calls.
2
3import addpack
4addpack.addpack(':tools:bgen:bgen')
5from scantools import Scanner
6
7LONG = "Fonts"
8SHORT = "Fm"
9
10def main():
11 input = "Fonts.h"
12 output = SHORT + "gen.py"
13 defsoutput = LONG + ".py"
14 scanner = MyScanner(input, output, defsoutput)
15 scanner.scan()
16 scanner.close()
17 print "=== Done scanning and generating, now importing the generated code... ==="
18 exec "import " + SHORT + "support"
19 print "=== Done. It's up to you to compile it now! ==="
20
21class MyScanner(Scanner):
22
23 def destination(self, type, name, arglist):
24 classname = "Function"
25 listname = "functions"
26 return classname, listname
27
28 def makeblacklistnames(self):
29 return [
30 "OutlineMetrics", # Too complicated
31 ]
32
33 def makeblacklisttypes(self):
34 return [
35 "FMInput_ptr", # Not needed for now
36 "FMOutPtr", # Ditto
37 ]
38
39 def makerepairinstructions(self):
40 return [
41 ([('Str255', '*', 'InMode')], [('Str255', '*', 'OutMode')]),
42 ([('FMetricRecPtr', 'theMetrics', 'InMode')], [('FMetricRecPtr', 'theMetrics', 'OutMode')]),
43 ]
44
45if __name__ == "__main__":
46 main()