blob: e36db2c88f6f7377fffd271e4cc5e04e1af2bdae [file] [log] [blame]
Guido van Rossum17448e21995-01-30 11:53:55 +00001# Scan <Controls.h>, generating ctlgen.py.
Jack Jansenae8a68f1995-06-06 12:55:40 +00002import addpack
3addpack.addpack(':Tools:bgen:bgen')
Guido van Rossum17448e21995-01-30 11:53:55 +00004
5from scantools import Scanner
6
7def main():
8 input = "Controls.h"
9 output = "ctlgen.py"
10 defsoutput = "Controls.py"
11 scanner = MyScanner(input, output, defsoutput)
12 scanner.scan()
13 scanner.close()
14 print "=== Done scanning and generating, now doing 'import ctlsupport' ==="
15 import ctlsupport
16 print "=== Done. It's up to you to compile Ctlmodule.c ==="
17
18class MyScanner(Scanner):
19
20 def destination(self, type, name, arglist):
21 classname = "Function"
22 listname = "functions"
23 if arglist:
24 t, n, m = arglist[0]
Jack Jansenae8a68f1995-06-06 12:55:40 +000025 if t in ("ControlHandle", "ControlRef") and m == "InMode":
Guido van Rossum17448e21995-01-30 11:53:55 +000026 classname = "Method"
27 listname = "methods"
28 return classname, listname
29
30 def makeblacklistnames(self):
31 return [
32 'DisposeControl' # Implied by deletion of control object
33 'KillControls', # Implied by close of dialog
34 'SetCtlAction',
35 ]
36
37 def makeblacklisttypes(self):
38 return [
39 'ProcPtr',
Jack Jansenae8a68f1995-06-06 12:55:40 +000040 'ControlActionUPP',
Guido van Rossum17448e21995-01-30 11:53:55 +000041 'CCTabHandle',
42 'AuxCtlHandle',
43 ]
44
45 def makerepairinstructions(self):
46 return [
47 ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
48 [("InBuffer", "*", "*")]),
49
50 ([("void", "*", "OutMode"), ("long", "*", "InMode"),
51 ("long", "*", "OutMode")],
52 [("VarVarOutBuffer", "*", "InOutMode")]),
53
54 # For TrackControl
55 ([("ProcPtr", "actionProc", "InMode")],
56 [("FakeType('(ControlActionUPP)0')", "*", "*")]),
Jack Jansenae8a68f1995-06-06 12:55:40 +000057 ([("ControlActionUPP", "actionProc", "InMode")],
58 [("FakeType('(ControlActionUPP)0')", "*", "*")]),
Guido van Rossum17448e21995-01-30 11:53:55 +000059
60 ([("ControlHandle", "*", "OutMode")],
61 [("ExistingControlHandle", "*", "*")]),
Jack Jansenae8a68f1995-06-06 12:55:40 +000062 ([("ControlRef", "*", "OutMode")], # Ditto, for Universal Headers
63 [("ExistingControlHandle", "*", "*")]),
Guido van Rossum17448e21995-01-30 11:53:55 +000064 ]
65
66if __name__ == "__main__":
67 main()