changes by Barry, e.g. font lock & email addresses
[python/dscho.git] / Mac / Modules / list / listscan.py
blob8061b566c505eb2b07188530ea138daec3dc437b
1 # Scan an Apple header file, generating a Python file of generator calls.
3 import addpack
4 addpack.addpack(':tools:bgen:bgen')
5 from scantools import Scanner
7 LONG = "Lists"
8 SHORT = "list"
9 OBJECT = "ListRef"
11 def main():
12 input = LONG + ".h"
13 output = SHORT + "gen.py"
14 defsoutput = LONG + ".py"
15 scanner = MyScanner(input, output, defsoutput)
16 scanner.scan()
17 scanner.close()
18 print "=== Done scanning and generating, now importing the generated code... ==="
19 exec "import " + SHORT + "support"
20 print "=== Done. It's up to you to compile it now! ==="
22 class MyScanner(Scanner):
24 def destination(self, type, name, arglist):
25 classname = "Function"
26 listname = "functions"
27 if arglist:
28 t, n, m = arglist[-1]
29 # This is non-functional today
30 if t == OBJECT and m == "InMode":
31 classname = "Method"
32 listname = "methods"
33 return classname, listname
35 def makeblacklistnames(self):
36 return [
37 "LDispose", # Done by removing the object
38 "LSearch", # We don't want to handle procs just yet
39 "LGetCellDataLocation", # What does this do??
42 def makeblacklisttypes(self):
43 return [
46 def makerepairinstructions(self):
47 return [
48 ([('ListBounds_ptr', '*', 'InMode')],
49 [('Rect_ptr', '*', 'InMode')]),
51 ([("Cell", "theCell", "OutMode")],
52 [("Cell", "theCell", "InOutMode")]),
54 ([("void_ptr", "*", "InMode"), ("short", "*", "InMode")],
55 [("InBufferShortsize", "*", "*")]),
57 ([("void", "*", "OutMode"), ("short", "*", "OutMode")],
58 [("VarOutBufferShortsize", "*", "InOutMode")]),
60 # ([("void", "wStorage", "OutMode")],
61 # [("NullStorage", "*", "InMode")]),
63 # # GetKeys
64 # ([('KeyMap', 'theKeys', 'InMode')],
65 # [('*', '*', 'OutMode')]),
67 # # GetTicker
68 # ([('unsigned long', '*', '*')],
69 # [('unsigned_long', '*', '*')]),
72 if __name__ == "__main__":
73 main()