(py-indent-right, py-outdent-left): new commands, bound to C-c C-r and
[python/dscho.git] / Mac / Modules / evt / evtscan.py
blob517db710f3194f380cf646ac6a362c54f4638e2b
1 # Scan an Apple header file, generating a Python file of generator calls.
3 from scantools import Scanner
5 LONG = "Events"
6 SHORT = "evt"
7 OBJECT = "NOTUSED"
9 def main():
10 input = LONG + ".h"
11 output = SHORT + "gen.py"
12 defsoutput = LONG + ".py"
13 scanner = MyScanner(input, output, defsoutput)
14 scanner.scan()
15 scanner.close()
16 print "=== Done scanning and generating, now importing the generated code... ==="
17 exec "import " + SHORT + "support"
18 print "=== Done. It's up to you to compile it now! ==="
20 class MyScanner(Scanner):
22 def destination(self, type, name, arglist):
23 classname = "Function"
24 listname = "functions"
25 if arglist:
26 t, n, m = arglist[0]
27 # This is non-functional today
28 if t == OBJECT and m == "InMode":
29 classname = "Method"
30 listname = "methods"
31 return classname, listname
33 def makeblacklistnames(self):
34 return [
37 def makeblacklisttypes(self):
38 return [
41 def makerepairinstructions(self):
42 return [
43 ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
44 [("InBuffer", "*", "*")]),
46 ([("void", "*", "OutMode"), ("long", "*", "InMode"),
47 ("long", "*", "OutMode")],
48 [("VarVarOutBuffer", "*", "InOutMode")]),
50 ([("void", "wStorage", "OutMode")],
51 [("NullStorage", "*", "InMode")]),
53 # GetKeys
54 ([('KeyMap', 'theKeys', 'InMode')],
55 [('*', '*', 'OutMode')]),
58 if __name__ == "__main__":
59 main()