Remove all trailing spaces
No real changes, just clean up sources by removing trailing spaces from all the non-generated files. This should hopefully avoid future commits mixing significant changes with insignificant whitespace ones.
This commit is contained in:
@@ -16,14 +16,14 @@ class CBuilder:
|
||||
output_dir = os.path.abspath(os.path.join(self.output_dir, "c"))
|
||||
if not os.path.exists(output_dir):
|
||||
os.makedirs(output_dir)
|
||||
|
||||
|
||||
for aclass in self.doxyparser.classes:
|
||||
# This bit doesn't work, because the aclass.name is not the same as
|
||||
# those listed in common
|
||||
if aclass.name in excluded_classes:
|
||||
#print "Skipping %s" % aclass.name
|
||||
continue
|
||||
|
||||
|
||||
self.make_c_header(output_dir, aclass)
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ class CBuilder:
|
||||
|
||||
def make_c_methods(self, aclass):
|
||||
retval = ""
|
||||
|
||||
|
||||
wxc_classname = 'wxC' + aclass.name[2:].capitalize()
|
||||
|
||||
for amethod in aclass.constructors:
|
||||
@@ -59,13 +59,13 @@ class CBuilder:
|
||||
if amethod.name.startswith('m_'):
|
||||
# for some reason, public members are listed as methods
|
||||
continue
|
||||
|
||||
|
||||
args = '(' + wxc_classname + '* obj'
|
||||
if amethod.argsstring.find('()') != -1:
|
||||
args += ')'
|
||||
else:
|
||||
else:
|
||||
args += ', ' + amethod.argsstring[1:].strip()
|
||||
|
||||
|
||||
retval += """
|
||||
// %s
|
||||
%s %s%s;\n
|
||||
|
@@ -15,7 +15,7 @@ excluded_classes = [
|
||||
"wxArchiveIterator",
|
||||
"wxArchiveNotifier",
|
||||
"wxArchiveOutputStream",
|
||||
"wxArray< T >",
|
||||
"wxArray< T >",
|
||||
"wxArrayString",
|
||||
"wxAutomationObject",
|
||||
"wxBufferedInputStream",
|
||||
@@ -160,5 +160,5 @@ def make_enums(aclass):
|
||||
retval += ", "
|
||||
retval += "\n"
|
||||
retval += "};\n\n"
|
||||
|
||||
|
||||
return retval
|
||||
|
@@ -38,23 +38,23 @@ class ClassDefinition:
|
||||
self.includes = []
|
||||
self.bases = []
|
||||
self.enums = {}
|
||||
|
||||
|
||||
def __str__(self):
|
||||
str_repr = """
|
||||
Class: %s
|
||||
Bases: %s
|
||||
Includes: %s
|
||||
Brief Description:
|
||||
Brief Description:
|
||||
%s
|
||||
|
||||
Detailed Description:
|
||||
%s
|
||||
""" % (self.name, string.join(self.bases, ", "), self.includes, self.brief_description, self.detailed_description)
|
||||
str_repr += "Methods:\n"
|
||||
|
||||
|
||||
for method in self.methods:
|
||||
str_repr += str(method)
|
||||
|
||||
|
||||
return str_repr
|
||||
|
||||
class MethodDefinition:
|
||||
@@ -66,20 +66,20 @@ class MethodDefinition:
|
||||
self.params = []
|
||||
self.brief_description = ""
|
||||
self.detailed_description = ""
|
||||
|
||||
|
||||
def __str__(self):
|
||||
str_repr = """
|
||||
Method: %s
|
||||
Return Type: %s
|
||||
Params: %r
|
||||
Prototype: %s
|
||||
Brief Description:
|
||||
Brief Description:
|
||||
%s
|
||||
|
||||
Detailed Description:
|
||||
%s
|
||||
""" % (self.name, self.return_type, self.params, self.definition + self.argsstring, self.brief_description, self.detailed_description)
|
||||
return str_repr
|
||||
return str_repr
|
||||
|
||||
def getTextValue(node, recursive=False):
|
||||
text = ""
|
||||
@@ -89,7 +89,7 @@ def getTextValue(node, recursive=False):
|
||||
if child.nodeType == child.TEXT_NODE:
|
||||
# Add a space to ensure we have a space between qualifiers and parameter names
|
||||
text += child.nodeValue.strip() + " "
|
||||
|
||||
|
||||
return text.strip()
|
||||
|
||||
def doxyMLToText(node):
|
||||
@@ -104,7 +104,7 @@ class DoxyMLParser:
|
||||
for aclass in self.classes:
|
||||
if aclass.name == name:
|
||||
return aclass
|
||||
|
||||
|
||||
return None
|
||||
|
||||
def get_enums_and_functions(self, filename, aclass):
|
||||
@@ -119,17 +119,17 @@ class DoxyMLParser:
|
||||
def is_derived_from_base(self, aclass, abase):
|
||||
base = get_first_value(aclass.bases)
|
||||
while base and base != "":
|
||||
|
||||
|
||||
if base == abase:
|
||||
return True
|
||||
|
||||
|
||||
parentclass = self.find_class(base)
|
||||
|
||||
|
||||
if parentclass:
|
||||
base = get_first_value(parentclass.bases)
|
||||
else:
|
||||
base = None
|
||||
|
||||
|
||||
return False
|
||||
|
||||
def parse(self, filename):
|
||||
@@ -138,7 +138,7 @@ class DoxyMLParser:
|
||||
new_class = self.parse_class(node)
|
||||
self.classes.append(new_class)
|
||||
self.get_enums_and_functions(filename, new_class)
|
||||
|
||||
|
||||
def parse_class(self, class_node):
|
||||
new_class = ClassDefinition()
|
||||
new_class.name = getTextValue(class_node.getElementsByTagName("compoundname")[0])
|
||||
@@ -156,21 +156,21 @@ class DoxyMLParser:
|
||||
self.parse_methods(new_class, class_node)
|
||||
|
||||
return new_class
|
||||
|
||||
|
||||
def parse_enum(self, new_class, enum, root):
|
||||
enum_name = ""
|
||||
enum_values = []
|
||||
|
||||
|
||||
for node in enum.childNodes:
|
||||
if node.nodeName == "name":
|
||||
enum_name = getTextValue(node)
|
||||
elif node.nodeName == "enumvalue":
|
||||
enum_values.append(getTextValue(node.getElementsByTagName("name")[0]))
|
||||
|
||||
|
||||
new_class.enums[enum_name] = enum_values
|
||||
|
||||
|
||||
def parse_methods(self, new_class, root):
|
||||
for method in root.getElementsByTagName("memberdef"):
|
||||
for method in root.getElementsByTagName("memberdef"):
|
||||
new_method = MethodDefinition()
|
||||
for node in method.childNodes:
|
||||
if node.nodeName == "name":
|
||||
@@ -187,10 +187,10 @@ class DoxyMLParser:
|
||||
if child.nodeType == child.ELEMENT_NODE:
|
||||
param[child.nodeName] = getTextValue(child)
|
||||
new_method.params.append(param)
|
||||
|
||||
|
||||
if self.verbose:
|
||||
print "Adding %s" % (new_method.name + new_method.argsstring)
|
||||
|
||||
|
||||
if new_method.name == new_class.name:
|
||||
new_class.constructors.append(new_method)
|
||||
elif new_method.name == "~" + new_class.name:
|
||||
@@ -199,30 +199,30 @@ class DoxyMLParser:
|
||||
new_class.methods.append(new_method)
|
||||
|
||||
if __name__ == "__main__":
|
||||
option_dict = {
|
||||
option_dict = {
|
||||
"report" : (False, "Print out the classes and methods found by this script."),
|
||||
"verbose" : (False, "Provide status updates and other information."),
|
||||
}
|
||||
|
||||
|
||||
parser = optparse.OptionParser(usage="usage: %prog [options] <doxyml files to parse>\n" + __description__, version="%prog 1.0")
|
||||
|
||||
|
||||
for opt in option_dict:
|
||||
default = option_dict[opt][0]
|
||||
|
||||
|
||||
action = "store"
|
||||
if type(default) == types.BooleanType:
|
||||
action = "store_true"
|
||||
parser.add_option("--" + opt, default=default, action=action, dest=opt, help=option_dict[opt][1])
|
||||
|
||||
|
||||
options, arguments = parser.parse_args()
|
||||
|
||||
if len(arguments) < 1:
|
||||
parser.print_usage()
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
doxyparse = DoxyMLParser(verbose = options.verbose)
|
||||
for arg in arguments:
|
||||
doxyparse.parse(arg)
|
||||
doxyparse.parse(arg)
|
||||
|
||||
if options.report:
|
||||
for aclass in doxyparse.classes:
|
||||
|
@@ -12,42 +12,42 @@ import swig_tools
|
||||
from common import *
|
||||
|
||||
if __name__ == "__main__":
|
||||
option_dict = {
|
||||
option_dict = {
|
||||
"output_dir" : ("output", "Directory to output bindings to"),
|
||||
"sip" : (True, "Produce SIP bindings"),
|
||||
"swig" : (True, "Produce SWIG bindings."),
|
||||
"c" : (True, "Produce C wrappers."),
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
parser = optparse.OptionParser(usage="usage: %prog <doxyml files to parse>\n" , version="%prog 1.0")
|
||||
|
||||
|
||||
for opt in option_dict:
|
||||
default = option_dict[opt][0]
|
||||
|
||||
|
||||
action = "store"
|
||||
if type(default) == types.BooleanType:
|
||||
action = "store_true"
|
||||
parser.add_option("--" + opt, default=default, action=action, dest=opt, help=option_dict[opt][1])
|
||||
|
||||
|
||||
options, arguments = parser.parse_args()
|
||||
|
||||
if len(arguments) < 1:
|
||||
parser.print_usage()
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
doxyparse = doxymlparser.DoxyMLParser()
|
||||
for arg in arguments:
|
||||
doxyparse.parse(arg)
|
||||
|
||||
|
||||
if options.sip:
|
||||
builder = sip_tools.SIPBuilder(doxyparse, options.output_dir)
|
||||
builder.make_bindings()
|
||||
|
||||
|
||||
if options.swig:
|
||||
builder = swig_tools.SWIGBuilder(doxyparse, options.output_dir)
|
||||
builder.make_bindings()
|
||||
|
||||
|
||||
if options.c:
|
||||
builder = c_tools.CBuilder(doxyparse, options.output_dir)
|
||||
builder.make_bindings()
|
||||
|
@@ -11,12 +11,12 @@ class SIPBuilder:
|
||||
output_dir = os.path.abspath(os.path.join(self.output_dir, "sip"))
|
||||
if not os.path.exists(output_dir):
|
||||
os.makedirs(output_dir)
|
||||
|
||||
|
||||
for aclass in self.doxyparser.classes:
|
||||
if aclass.name in excluded_classes:
|
||||
print "Skipping %s" % aclass.name
|
||||
continue
|
||||
|
||||
|
||||
header_name = aclass.name[2:].lower()
|
||||
filename = os.path.join(output_dir, "_" + header_name + ".sip")
|
||||
enums_text = make_enums(aclass)
|
||||
@@ -24,7 +24,7 @@ class SIPBuilder:
|
||||
base_class = get_first_value(aclass.bases)
|
||||
if base_class != "":
|
||||
base_class = ": %s" % base_class
|
||||
|
||||
|
||||
text = """
|
||||
%s
|
||||
class %s %s
|
||||
@@ -45,12 +45,12 @@ public:
|
||||
|
||||
def make_sip_methods(self, aclass):
|
||||
retval = ""
|
||||
|
||||
|
||||
for amethod in aclass.constructors + aclass.methods:
|
||||
transfer = ""
|
||||
|
||||
|
||||
# FIXME: we need to come up with a way of filtering the methods out by various criteria
|
||||
# including parameters and method name, and how to deal with overloads
|
||||
# including parameters and method name, and how to deal with overloads
|
||||
if aclass.name in ignored_methods:
|
||||
should_ignore = False
|
||||
for method in ignored_methods[aclass.name]:
|
||||
@@ -66,19 +66,19 @@ public:
|
||||
print "param type = %s, amethod.param type = %s" % (params[i], amethod.params[i]["type"])
|
||||
should_ignore = False
|
||||
break
|
||||
|
||||
|
||||
if should_ignore:
|
||||
continue
|
||||
|
||||
|
||||
# We need to let SIP know when wx is responsible for deleting the object.
|
||||
# We do this if the class is derived from wxWindow, since wxTLW manages child windows
|
||||
# and wxApp deletes all wxTLWs on shutdown
|
||||
if amethod in aclass.constructors and self.doxyparser.is_derived_from_base(aclass, "wxWindow"):
|
||||
transfer = "/Transfer/"
|
||||
|
||||
|
||||
if amethod.name.startswith("operator"):
|
||||
continue
|
||||
|
||||
|
||||
retval += " %s %s%s%s;\n\n" % (amethod.return_type.replace("virtual ", ""), amethod.name, amethod.argsstring, transfer)
|
||||
|
||||
|
||||
return retval
|
||||
|
@@ -11,13 +11,13 @@ class SWIGBuilder:
|
||||
output_dir = os.path.abspath(os.path.join(self.output_dir, "swig"))
|
||||
if not os.path.exists(output_dir):
|
||||
os.makedirs(output_dir)
|
||||
|
||||
|
||||
for aclass in self.doxyparser.classes:
|
||||
header_name = aclass.name[2:].lower()
|
||||
if aclass.name in excluded_classes:
|
||||
#print "Skipping %s" % aclass.name
|
||||
continue
|
||||
|
||||
|
||||
filename = os.path.join(output_dir, "_" + header_name + ".i")
|
||||
enums_text = make_enums(aclass)
|
||||
method_text = self.make_swig_methods(aclass)
|
||||
@@ -37,25 +37,25 @@ public:
|
||||
afile.write(text)
|
||||
afile.close()
|
||||
|
||||
|
||||
|
||||
def make_swig_methods(self, aclass):
|
||||
retval = ""
|
||||
|
||||
|
||||
retval += """
|
||||
%%pythonAppend %s "self._setOORInfo(self)"
|
||||
%%pythonAppend %s() ""
|
||||
%%typemap(out) %s*; // turn off this typemap
|
||||
""" % (aclass.name, aclass.name, aclass.name)
|
||||
|
||||
|
||||
for amethod in aclass.constructors:
|
||||
retval += " %s%s;\n\n" % (amethod.name, amethod.argsstring)
|
||||
|
||||
|
||||
retval += """
|
||||
// Turn it back on again
|
||||
%%typemap(out) %s* { $result = wxPyMake_wxObject($1, $owner); }
|
||||
%%typemap(out) %s* { $result = wxPyMake_wxObject($1, $owner); }
|
||||
""" % aclass.name
|
||||
|
||||
|
||||
for amethod in aclass.methods:
|
||||
retval += " %s %s%s;\n\n" % (amethod.return_type, amethod.name, amethod.argsstring)
|
||||
|
||||
|
||||
return retval
|
||||
|
Reference in New Issue
Block a user