Teach Windows build and installer about new _symtable module/DLL.
[python/dscho.git] / Mac / Modules / te / tescan.py
blobc9cff60449e64fba5d1ec9621e1b9ce2b2895d7b
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 = "TextEdit"
11 SHORT = "te"
12 OBJECT = "TEHandle"
14 def main():
15 input = LONG + ".h"
16 output = SHORT + "gen.py"
17 defsoutput = TOOLBOXDIR + LONG + ".py"
18 scanner = MyScanner(input, output, defsoutput)
19 scanner.scan()
20 scanner.close()
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 if arglist:
31 t, n, m = arglist[-1]
32 # This is non-functional today
33 if t == OBJECT and m == "InMode":
34 classname = "Method"
35 listname = "methods"
36 return classname, listname
38 def makeblacklistnames(self):
39 return [
40 "TEDispose",
41 "TEInit",
42 ## "TEGetHiliteRgn",
45 def makegreylist(self):
46 return [
47 ('#if TARGET_API_MAC_CARBON', [
48 'TEGetScrapHandle',
49 'TESetScrapHandle',
50 ])]
52 def makeblacklisttypes(self):
53 return [
54 "TEClickLoopUPP",
55 "UniversalProcPtr",
56 "WordBreakUPP",
57 "TEDoTextUPP",
58 "TERecalcUPP",
59 "TEFindWordUPP",
62 def makerepairinstructions(self):
63 return [
64 ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
65 [("InBuffer", "*", "*")]),
67 # TEContinuousStyle
68 ([("short", "mode", "OutMode"), ("TextStyle", "aStyle", "OutMode")],
69 [("short", "mode", "InOutMode"), ("TextStyle", "aStyle", "InOutMode")])
72 if __name__ == "__main__":
73 main()