_make_boundary(): Fix for SF bug #745478, broken boundary calculation
[python/dscho.git] / Mac / Modules / fm / fmscan.py
blob12fb52e764c80d4936047d0c4cb6a44fa79944e6
1 # Scan an Apple header file, generating a Python file of generator calls.
3 import sys
4 import os
5 from bgenlocations import TOOLBOXDIR, BGENDIR
6 sys.path.append(BGENDIR)
7 from scantools import Scanner
9 LONG = "Fonts"
10 SHORT = "fm"
12 def main():
13 input = "Fonts.h"
14 output = SHORT + "gen.py"
15 defsoutput = TOOLBOXDIR + LONG + ".py"
16 scanner = MyScanner(input, output, defsoutput)
17 scanner.scan()
18 scanner.close()
19 print "=== Testing definitions output code ==="
20 execfile(defsoutput, {}, {})
21 print "=== Done scanning and generating, now importing the generated code... ==="
22 exec "import " + SHORT + "support"
23 print "=== Done. It's up to you to compile it now! ==="
25 class MyScanner(Scanner):
27 def destination(self, type, name, arglist):
28 classname = "Function"
29 listname = "functions"
30 return classname, listname
32 def makeblacklistnames(self):
33 return [
34 "OutlineMetrics", # Too complicated
35 "AntiTextIsAntiAliased", # XXXX Missing from library...
36 "AntiTextGetEnabled",
37 "AntiTextSetEnabled",
38 "AntiTextGetApplicationAware",
39 "AntiTextSetApplicationAware",
40 # These are tricky: they're not Carbon dependent or anything, but they
41 # exist only on 8.6 or later (both in Carbon and Classic).
42 # Disabling them is the easiest path.
43 'SetAntiAliasedTextEnabled',
44 'IsAntiAliasedTextEnabled',
45 # OS8-only
46 'InitFonts',
47 'SetFontLock',
48 'FlushFonts',
51 def makegreylist(self):
52 return [
53 ('#if !TARGET_API_MAC_CARBON', [
54 ])]
55 def makeblacklisttypes(self):
56 return [
57 "FMInput_ptr", # Not needed for now
58 "FMOutPtr", # Ditto
59 ## "void_ptr", # Don't know how to do this right now
60 "FontInfo", # Ditto
63 def makerepairinstructions(self):
64 return [
65 ([('Str255', '*', 'InMode')], [('Str255', '*', 'OutMode')]),
66 ([('FMetricRecPtr', 'theMetrics', 'InMode')], [('FMetricRecPtr', 'theMetrics', 'OutMode')]),
67 ([('short', 'byteCount', 'InMode'), ('void_ptr', 'textAddr', 'InMode'),],
68 [('TextBuffer', 'inText', 'InMode')]),
71 def writeinitialdefs(self):
72 self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
73 self.defsfile.write("kNilOptions = 0\n")
75 if __name__ == "__main__":
76 main()