diff --git a/configuration/parser/AlgorithmTraversalLibClang.py b/configuration/parser/AlgorithmTraversalLibClang.py index c8bc2a5ac6d117b8d35119b77102957ad613480f..e2abd61705ee549b4987a4c313b312794d07b14d 100644 --- a/configuration/parser/AlgorithmTraversalLibClang.py +++ b/configuration/parser/AlgorithmTraversalLibClang.py @@ -44,14 +44,14 @@ class Property(): description, default_value, scope="algorithm"): - self.typename = name[1:-1] + self.typename = name.strip('"') self.typedef = typedef self.name = name self.description = description self.default_value = default_value self.scope = scope - # print(name, typedef, description, default_value) + print(name, typedef, description, default_value) class Parameter(): @@ -237,10 +237,6 @@ class AlgorithmTraversal(): elif "Parameters" in c.type.spelling: return AlgorithmTraversal.traverse_children( c.get_definition(), AlgorithmTraversal.parameters) - elif c.kind == cindex.CursorKind.FIELD_DECL: - if c.spelling in AlgorithmTraversal.__properties: - prop = AlgorithmTraversal.__properties[c.spelling] - return ("Property", prop["name"], c.type.get_template_argument_type(0).spelling, prop["description"], prop["default_value"]) else: return None @@ -258,6 +254,9 @@ class AlgorithmTraversal(): algorithm_parameters = [] algorithm_class_parameters = AlgorithmTraversal.traverse_children( c, AlgorithmTraversal.algorithm_definition) + # Add properties + for _, prop in AlgorithmTraversal.__properties.items(): + algorithm_class_parameters.append(("Property", prop["name"], prop["variable_type"], prop["description"], prop["default_value"])) algorithm_properties = [] for d in algorithm_class_parameters: if d[0] == "AlgorithmClass": @@ -301,6 +300,7 @@ class AlgorithmTraversal(): pass this_position = ts.index("this", last_found) semicolon_position = ts.index(";", last_found) + variable_type = "".join(ts[last_found + 2:this_position - 4]) variable_name = ts[this_position - 2] name = ts[this_position + 2] description = ts[semicolon_position - 2] @@ -308,6 +308,7 @@ class AlgorithmTraversal(): properties[variable_name] = { "name": name, "description": description, + "variable_type": variable_type, "default_value": default_value } diff --git a/configuration/parser/ParseAlgorithms.py b/configuration/parser/ParseAlgorithms.py index cdd5c0ede60e61c69520be2d0c465ba4625799d3..5aaf2fb0fd7a6d27cfcb17419271c45581ac0676 100755 --- a/configuration/parser/ParseAlgorithms.py +++ b/configuration/parser/ParseAlgorithms.py @@ -605,9 +605,6 @@ class AllenCore(): def write_algorithms_view(algorithms, filename, default_properties): from subprocess import (PIPE, run) - a = ';'.join(["{}::{}".format(a.namespace, a.name) for a in parsed_algorithms]) - print(a) - # Run the default_properties executable to get a JSON # representation of the default values of all properties of # all algorithms