blob: d111964b5c9b42660e99e046622a143fabfadc46 [file] [log] [blame]
Jack Jansen6259af91996-01-09 17:15:16 +00001# Scan an Apple header file, generating a Python file of generator calls.
2
Jack Jansen0c4d9471998-04-17 14:07:56 +00003import sys
4import os
5BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen')
6sys.path.append(BGENDIR)
Jack Jansen6259af91996-01-09 17:15:16 +00007from scantools import Scanner
Jack Jansen46d9e791996-04-12 16:29:23 +00008from bgenlocations import TOOLBOXDIR
Jack Jansen6259af91996-01-09 17:15:16 +00009
10LONG = "Fonts"
Jack Jansen21f96871998-02-20 16:02:09 +000011SHORT = "fm"
Jack Jansen6259af91996-01-09 17:15:16 +000012
13def main():
14 input = "Fonts.h"
15 output = SHORT + "gen.py"
Jack Jansen46d9e791996-04-12 16:29:23 +000016 defsoutput = TOOLBOXDIR + LONG + ".py"
Jack Jansen6259af91996-01-09 17:15:16 +000017 scanner = MyScanner(input, output, defsoutput)
18 scanner.scan()
19 scanner.close()
20 print "=== Done scanning and generating, now importing the generated code... ==="
21 exec "import " + SHORT + "support"
22 print "=== Done. It's up to you to compile it now! ==="
23
24class MyScanner(Scanner):
25
26 def destination(self, type, name, arglist):
27 classname = "Function"
28 listname = "functions"
29 return classname, listname
30
31 def makeblacklistnames(self):
32 return [
33 "OutlineMetrics", # Too complicated
Jack Jansen21f96871998-02-20 16:02:09 +000034 "AntiTextIsAntiAliased", # XXXX Missing from library...
35 "AntiTextGetEnabled",
36 "AntiTextSetEnabled",
37 "AntiTextGetApplicationAware",
38 "AntiTextSetApplicationAware",
Jack Jansen6259af91996-01-09 17:15:16 +000039 ]
40
41 def makeblacklisttypes(self):
42 return [
43 "FMInput_ptr", # Not needed for now
44 "FMOutPtr", # Ditto
45 ]
46
47 def makerepairinstructions(self):
48 return [
49 ([('Str255', '*', 'InMode')], [('Str255', '*', 'OutMode')]),
50 ([('FMetricRecPtr', 'theMetrics', 'InMode')], [('FMetricRecPtr', 'theMetrics', 'OutMode')]),
51 ]
52
53if __name__ == "__main__":
54 main()