blob: 1a5d6a81622871a8a50b66cab0bf86b10dc0b9e4 [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
Jack Jansen46d9e791996-04-12 16:29:23 +00006from bgenlocations import TOOLBOXDIR
Jack Jansen6259af91996-01-09 17:15:16 +00007
8LONG = "Fonts"
9SHORT = "Fm"
10
11def main():
12 input = "Fonts.h"
13 output = SHORT + "gen.py"
Jack Jansen46d9e791996-04-12 16:29:23 +000014 defsoutput = TOOLBOXDIR + LONG + ".py"
Jack Jansen6259af91996-01-09 17:15:16 +000015 scanner = MyScanner(input, output, defsoutput)
16 scanner.scan()
17 scanner.close()
18 print "=== Done scanning and generating, now importing the generated code... ==="
19 exec "import " + SHORT + "support"
20 print "=== Done. It's up to you to compile it now! ==="
21
22class MyScanner(Scanner):
23
24 def destination(self, type, name, arglist):
25 classname = "Function"
26 listname = "functions"
27 return classname, listname
28
29 def makeblacklistnames(self):
30 return [
31 "OutlineMetrics", # Too complicated
32 ]
33
34 def makeblacklisttypes(self):
35 return [
36 "FMInput_ptr", # Not needed for now
37 "FMOutPtr", # Ditto
38 ]
39
40 def makerepairinstructions(self):
41 return [
42 ([('Str255', '*', 'InMode')], [('Str255', '*', 'OutMode')]),
43 ([('FMetricRecPtr', 'theMetrics', 'InMode')], [('FMetricRecPtr', 'theMetrics', 'OutMode')]),
44 ]
45
46if __name__ == "__main__":
47 main()