This commit was manufactured by cvs2svn to create tag 'r212'.
[python/dscho.git] / Mac / Modules / fm / fmscan.py
blob6ade54707acca86560bc8a8f3f093a3140d4c88f
1 # Scan an Apple header file, generating a Python file of generator calls.
3 import sys
4 import os
5 BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen')
6 sys.path.append(BGENDIR)
7 from scantools import Scanner
8 from bgenlocations import TOOLBOXDIR
10 LONG = "Fonts"
11 SHORT = "fm"
13 def main():
14 input = "Fonts.h"
15 output = SHORT + "gen.py"
16 defsoutput = TOOLBOXDIR + LONG + ".py"
17 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! ==="
24 class MyScanner(Scanner):
26 def destination(self, type, name, arglist):
27 classname = "Function"
28 listname = "functions"
29 return classname, listname
31 def makeblacklistnames(self):
32 return [
33 "OutlineMetrics", # Too complicated
34 "AntiTextIsAntiAliased", # XXXX Missing from library...
35 "AntiTextGetEnabled",
36 "AntiTextSetEnabled",
37 "AntiTextGetApplicationAware",
38 "AntiTextSetApplicationAware",
39 # These are tricky: they're not Carbon dependent or anything, but they
40 # exist only on 8.6 or later (both in Carbon and Classic).
41 # Disabling them is the easiest path.
42 'SetAntiAliasedTextEnabled',
43 'IsAntiAliasedTextEnabled',
46 def makegreylist(self):
47 return [
48 ('#if !TARGET_API_MAC_CARBON', [
49 'InitFonts',
50 'SetFontLock',
51 'FlushFonts',
52 ])]
53 def makeblacklisttypes(self):
54 return [
55 "FMInput_ptr", # Not needed for now
56 "FMOutPtr", # Ditto
57 "void_ptr", # Don't know how to do this right now
58 "FontInfo", # Ditto
61 def makerepairinstructions(self):
62 return [
63 ([('Str255', '*', 'InMode')], [('Str255', '*', 'OutMode')]),
64 ([('FMetricRecPtr', 'theMetrics', 'InMode')], [('FMetricRecPtr', 'theMetrics', 'OutMode')]),
67 def writeinitialdefs(self):
68 self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
69 self.defsfile.write("kNilOptions = 0\n")
71 if __name__ == "__main__":
72 main()