Bump version number to 2.4.2 to pick up the latest minor bug fixes.
[python/dscho.git] / Mac / Modules / te / tescan.py
blobed37dbbe253dfcdc77c3346628a094b720dda927
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 = "TextEdit"
10 SHORT = "te"
11 OBJECT = "TEHandle"
13 def main():
14 input = LONG + ".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 "=== Testing definitions output code ==="
21 execfile(defsoutput, {}, {})
22 print "=== Done scanning and generating, now importing the generated code... ==="
23 exec "import " + SHORT + "support"
24 print "=== Done. It's up to you to compile it now! ==="
26 class MyScanner(Scanner):
28 def destination(self, type, name, arglist):
29 classname = "Function"
30 listname = "functions"
31 if arglist:
32 t, n, m = arglist[-1]
33 # This is non-functional today
34 if t == OBJECT and m == "InMode":
35 classname = "Method"
36 listname = "methods"
37 return classname, listname
39 def makeblacklistnames(self):
40 return [
41 "TEDispose",
42 "TEInit",
43 ## "TEGetHiliteRgn",
46 def makegreylist(self):
47 return [
48 ('#if TARGET_API_MAC_CARBON', [
49 'TEGetScrapHandle',
50 'TESetScrapHandle',
51 ])]
53 def makeblacklisttypes(self):
54 return [
55 "TEClickLoopUPP",
56 "UniversalProcPtr",
57 "WordBreakUPP",
58 "TEDoTextUPP",
59 "TERecalcUPP",
60 "TEFindWordUPP",
63 def makerepairinstructions(self):
64 return [
65 ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
66 [("InBuffer", "*", "*")]),
68 # TEContinuousStyle
69 ([("short", "mode", "OutMode"), ("TextStyle", "aStyle", "OutMode")],
70 [("short", "mode", "InOutMode"), ("TextStyle", "aStyle", "InOutMode")])
73 if __name__ == "__main__":
74 main()