(py-outdent-p): new function
[python/dscho.git] / Mac / Modules / ctl / ctlscan.py
blobf104e8d52048a35d6dc3c16a72c12525c83e0cdf
1 # Scan <Controls.h>, generating ctlgen.py.
3 from scantools import Scanner
5 def main():
6 input = "Controls.h"
7 output = "ctlgen.py"
8 defsoutput = "Controls.py"
9 scanner = MyScanner(input, output, defsoutput)
10 scanner.scan()
11 scanner.close()
12 print "=== Done scanning and generating, now doing 'import ctlsupport' ==="
13 import ctlsupport
14 print "=== Done. It's up to you to compile Ctlmodule.c ==="
16 class MyScanner(Scanner):
18 def destination(self, type, name, arglist):
19 classname = "Function"
20 listname = "functions"
21 if arglist:
22 t, n, m = arglist[0]
23 if t == "ControlHandle" and m == "InMode":
24 classname = "Method"
25 listname = "methods"
26 return classname, listname
28 def makeblacklistnames(self):
29 return [
30 'DisposeControl' # Implied by deletion of control object
31 'KillControls', # Implied by close of dialog
32 'SetCtlAction',
35 def makeblacklisttypes(self):
36 return [
37 'ProcPtr',
38 'CCTabHandle',
39 'AuxCtlHandle',
42 def makerepairinstructions(self):
43 return [
44 ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
45 [("InBuffer", "*", "*")]),
47 ([("void", "*", "OutMode"), ("long", "*", "InMode"),
48 ("long", "*", "OutMode")],
49 [("VarVarOutBuffer", "*", "InOutMode")]),
51 # For TrackControl
52 ([("ProcPtr", "actionProc", "InMode")],
53 [("FakeType('(ControlActionUPP)0')", "*", "*")]),
55 ([("ControlHandle", "*", "OutMode")],
56 [("ExistingControlHandle", "*", "*")]),
59 if __name__ == "__main__":
60 main()