Commit 2df1956f authored by Ahmed's avatar Ahmed

extends some features

parent 57ffa902
......@@ -68,7 +68,7 @@ public class ErodeCommand extends ArgumentReturnMathCommand{
//add parameters
Variable src = new Variable();
method.addParameter(src, "src", "CommonMatrix",MathConverter.curBackend.getMatrixTypeName(), MathConverter.curBackend.getIncludeHeaderName());;
method.addParameter(src, "src", "CommonMatrixType",MathConverter.curBackend.getMatrixTypeName(), MathConverter.curBackend.getIncludeHeaderName());;
Variable dst = new Variable();
method.addParameter(dst, "dst", "CommonMatrixType", MathConverter.curBackend.getMatrixTypeName(), MathConverter.curBackend.getIncludeHeaderName());
Variable erosion_elem = new Variable();
......
......@@ -76,7 +76,7 @@ public class ComponentConverter {
}
} else if(mathExpresionSymbol.isValueExpression()) {
if (((MathValueSymbol) mathExpresionSymbol).getValue() instanceof MathMatrixNameExpressionSymbol) {
boolean bool = namesOfFunctions.add(((MathMatrixNameExpressionSymbol) ((MathValueSymbol) mathExpresionSymbol).getValue()).getNameToAccess());
namesOfFunctions.add(((MathMatrixNameExpressionSymbol) ((MathValueSymbol) mathExpresionSymbol).getValue()).getNameToAccess());
}
}
}
......
......@@ -138,8 +138,6 @@ public class ComponentConverterMethodGeneration {
}
generateInstruction(method, mathExpressionSymbol, bluePrint, includeStrings);
//lastIndex = currentGenerationIndex;
//fix argumentReturnFunctionsInstructions
}
handleInstructionReOrdering(method, beginIndex);
}
......@@ -345,23 +343,33 @@ public class ComponentConverterMethodGeneration {
}
private static String fixArgumentReturnInstruction(String instruction, Method method, MathExpressionSymbol mathExpressionSymbol, BluePrintCPP bluePrintCPP){
String newInstruction = "";
String newInstruction1 = "";
String newInstruction2 = "";
if(instruction.contains("=")){
int indexOfEqualOperator = instruction.indexOf("=");
String beforeEqualOperatorSubString = instruction.substring(0,indexOfEqualOperator-1);
String afterEqualOperatorSubString = instruction.substring(indexOfEqualOperator+2);
if(beforeEqualOperatorSubString.contains(" ")){
//there is two words
int indexOfWhiteSpace = beforeEqualOperatorSubString.indexOf(" ");
String firstWord = beforeEqualOperatorSubString.substring(0,indexOfWhiteSpace);
String secondWord = beforeEqualOperatorSubString.substring(indexOfWhiteSpace+1);
newInstruction1 = beforeEqualOperatorSubString + ";\n";
beforeEqualOperatorSubString = secondWord;
}
if(afterEqualOperatorSubString.contains(",")){
int indexOfCommaOperator = afterEqualOperatorSubString.indexOf(",");
newInstruction = afterEqualOperatorSubString.substring(0,indexOfCommaOperator) + ", " + beforeEqualOperatorSubString +
newInstruction2 = afterEqualOperatorSubString.substring(0,indexOfCommaOperator) + ", " + beforeEqualOperatorSubString +
afterEqualOperatorSubString.substring(indexOfCommaOperator);
}else{
int indexOfBracket = afterEqualOperatorSubString.indexOf(")");
newInstruction = afterEqualOperatorSubString.substring(0,indexOfBracket) + ", " + beforeEqualOperatorSubString +
newInstruction2 = afterEqualOperatorSubString.substring(0,indexOfBracket) + ", " + beforeEqualOperatorSubString +
afterEqualOperatorSubString.substring(indexOfBracket);
}
newInstruction = removeBracket(newInstruction);
return newInstruction;
newInstruction2 = removeBracket(newInstruction2);
return newInstruction1 + newInstruction2;
}
return instruction;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment