diff --git a/src/visualstates/generators/cpprosgenerator.py b/src/visualstates/generators/cpprosgenerator.py index 397045b..77d9079 100644 --- a/src/visualstates/generators/cpprosgenerator.py +++ b/src/visualstates/generators/cpprosgenerator.py @@ -183,7 +183,7 @@ def generateStateNamespaceClass(self, classStr): classStr.append('class Namespace' + str(state.id) + ' {\n') classStr.append('public:\n') classStr.append('\tGlobalNamespace* globalNamespace;\n') - types, varNames, initialValues = CPPParser.parseVariables(state.getNamespace().variables) + types, varNames, initialValues = CPPParser.parseVariables(state.getNamespace().variables, state.getNamespace().params) for i in range(len(types)): classStr.append(types[i] + ' ' + varNames[i] + ';\n') classStr.append('\n') diff --git a/src/visualstates/generators/pythonrosgenerator.py b/src/visualstates/generators/pythonrosgenerator.py index d0a9dfb..a081247 100644 --- a/src/visualstates/generators/pythonrosgenerator.py +++ b/src/visualstates/generators/pythonrosgenerator.py @@ -30,7 +30,7 @@ class PythonRosGenerator(BaseGenerator): def __init__(self, libraries, config, states, globalNamespace): BaseGenerator.__init__(self, libraries, config, states, globalNamespace) - def generate(self, params, projectPath, projectName): + def generate(self, projectPath, projectName): stringList = [] self.generateImports(stringList) self.generateSignalHandling(stringList) @@ -47,11 +47,6 @@ def generate(self, params, projectPath, projectName): xmlDoc = self.generatePackageXml(self.config, projectName) xmlStr = xmlDoc.toprettyxml(indent=' ') - # replacing parameters with their values - for param in params: - findText = '${' + param.name + '}' - sourceCode = sourceCode.replace(findText, param.value) - # writing to files fp = open(projectPath + os.sep + projectName + '.py', 'w') fp.write(sourceCode) @@ -162,7 +157,7 @@ def generateStateClass(self, state, stateStr): else: varValue = param.value - stateStr.append('\t\t' + param.name + ' = ' + varValue + '\n') + stateStr.append('\t\tself.' + param.name + ' = ' + varValue + '\n') stateStr.append('\n') if (len(state.namespace.functions) > 0): diff --git a/src/visualstates/parsers/cppparser.py b/src/visualstates/parsers/cppparser.py index b18af94..2e51775 100644 --- a/src/visualstates/parsers/cppparser.py +++ b/src/visualstates/parsers/cppparser.py @@ -30,7 +30,7 @@ def parseFunctions(funcStr): funcNames = [] codes = [] funcExists = True - while funcExists and len(funcStr) > 0 and funcStr.index('{') >= 0: + while funcExists and len(funcStr) > 0 and funcStr.find('{') >= 0: funcStr = funcStr.strip() funcStartIndex = funcStr.index('{') funcSignature = funcStr[0:funcStartIndex].strip()