]>
git.saurik.com Git - wxWidgets.git/blob - docs/doxygen/scripts/swig_tools.py
6 def __init__(self
, doxyparse
, outputdir
):
7 self
.doxyparser
= doxyparse
8 self
.output_dir
= outputdir
10 def make_bindings(self
):
11 output_dir
= os
.path
.abspath(os
.path
.join(self
.output_dir
, "swig"))
12 if not os
.path
.exists(output_dir
):
13 os
.makedirs(output_dir
)
15 for aclass
in self
.doxyparser
.classes
:
16 header_name
= aclass
.name
[2:].lower()
17 if aclass
.name
in excluded_classes
:
18 #print "Skipping %s" % aclass.name
21 filename
= os
.path
.join(output_dir
, "_" + header_name
+ ".i")
22 enums_text
= make_enums(aclass
)
23 method_text
= self
.make_swig_methods(aclass
)
34 """ % (enums_text
, aclass
.name
, get_first_value(aclass
.bases
), method_text
)
36 afile
= open(filename
, "wb")
41 def make_swig_methods(self
, aclass
):
45 %%pythonAppend %s "self._setOORInfo(self)"
46 %%pythonAppend %s() ""
47 %%typemap(out) %s*; // turn off this typemap
48 """ % (aclass
.name
, aclass
.name
, aclass
.name
)
50 for amethod
in aclass
.constructors
:
51 retval
+= " %s%s;\n\n" % (amethod
.name
, amethod
.argsstring
)
54 // Turn it back on again
55 %%typemap(out) %s* { $result = wxPyMake_wxObject($1, $owner); }
58 for amethod
in aclass
.methods
:
59 retval
+= " %s %s%s;\n\n" % (amethod
.return_type
, amethod
.name
, amethod
.argsstring
)