blob: 3f0e51b97129f791317c43be0d4b5e9dc9f936c0 [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"
Jack Jansen21f96871998-02-20 16:02:09 +00009SHORT = "fm"
Jack Jansen6259af91996-01-09 17:15:16 +000010
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
Jack Jansen21f96871998-02-20 16:02:09 +000032 "AntiTextIsAntiAliased", # XXXX Missing from library...
33 "AntiTextGetEnabled",
34 "AntiTextSetEnabled",
35 "AntiTextGetApplicationAware",
36 "AntiTextSetApplicationAware",
Jack Jansen6259af91996-01-09 17:15:16 +000037 ]
38
39 def makeblacklisttypes(self):
40 return [
41 "FMInput_ptr", # Not needed for now
42 "FMOutPtr", # Ditto
43 ]
44
45 def makerepairinstructions(self):
46 return [
47 ([('Str255', '*', 'InMode')], [('Str255', '*', 'OutMode')]),
48 ([('FMetricRecPtr', 'theMetrics', 'InMode')], [('FMetricRecPtr', 'theMetrics', 'OutMode')]),
49 ]
50
51if __name__ == "__main__":
52 main()