Move setting of ioready 'wait' earlier in call chain, to
[python/dscho.git] / Mac / Modules / list / listscan.py
blob66cb2adf5d09185fbac6c9df02a14f3eff898e0e
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 = "Lists"
10 SHORT = "list"
11 OBJECT = "ListHandle"
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 in ('ListHandle', 'ListRef') and m == "InMode":
35 classname = "Method"
36 listname = "methods"
37 return classname, listname
39 def makeblacklistnames(self):
40 return [
41 "LDispose", # Done by removing the object
42 "LSearch", # We don't want to handle procs just yet
43 "CreateCustomList", # done manually
44 "SetListDefinitionProc",
46 # These have funny argument/return values
47 "GetListViewBounds",
48 "GetListCellIndent",
49 "GetListCellSize",
50 "GetListVisibleCells",
51 "GetListClickLocation",
52 "GetListMouseLocation",
53 "GetListDataBounds",
54 "SetListLastClick",
57 def makeblacklisttypes(self):
58 return [
59 "ListClickLoopUPP", # Too difficult for now
60 "ListDefSpecPtr", # later
63 def makerepairinstructions(self):
64 return [
65 ([('ListBounds_ptr', '*', 'InMode')],
66 [('Rect_ptr', '*', 'InMode')]),
68 ([("Cell", "theCell", "OutMode")],
69 [("Cell", "theCell", "InOutMode")]),
71 ([("void_ptr", "*", "InMode"), ("short", "*", "InMode")],
72 [("InBufferShortsize", "*", "*")]),
74 ([("void", "*", "OutMode"), ("short", "*", "OutMode")],
75 [("VarOutBufferShortsize", "*", "InOutMode")]),
77 # SetListCellIndent doesn't have const
78 ([("Point", "indent", "OutMode")],
79 [("Point_ptr", "indent", "InMode")]),
83 def writeinitialdefs(self):
84 self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
87 if __name__ == "__main__":
88 main()