Die Migration der Bereiche "Docker Registry" und "Artifiacts" ist fast abgeschlossen. Die letzten Daten werden im Laufe des heutigen Abend (05.08.2021) noch vollständig hochgeladen. Das Anlegen neuer Images und Artifacts funktioniert bereits wieder.

Commit 57ffa902 authored by Ahmed's avatar Ahmed
Browse files

extends the usability of argumentReturnMathCommand

enable using of multiple argumentRterunMathCommand in the same component
parent 2791387e
......@@ -75,9 +75,7 @@ public class LanguageUnitCPP extends LanguageUnit {
}
public String getGeneratedHeader(TaggingResolver taggingResolver, BluePrintCPP bluePrint) {
MathCommand mathCommand = bluePrint.getMathCommandRegister().getMathCommand(ComponentConverter.nameOfFunction);
ExecutionOrderFixer.fixExecutionOrder(taggingResolver, bluePrint, (GeneratorCPP) bluePrint.getGenerator());
String nameOfFunction = ComponentConverter.nameOfFunction;
String resultString = "";
//guard defines
resultString += "#ifndef " + bluePrint.getName().toUpperCase() + "\n";
......
......@@ -17,9 +17,9 @@ import de.monticore.lang.monticar.generator.*;
import de.monticore.lang.monticar.generator.cpp.*;
import de.monticore.lang.monticar.generator.cpp.instruction.ConstantConnectInstructionCPP;
import de.monticore.lang.monticar.generator.optimization.MathInformationRegister;
import de.monticore.symboltable.types.references.ActualTypeArgument;
import de.se_rwth.commons.logging.Log;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.Set;
......@@ -31,8 +31,8 @@ import java.util.stream.Collectors;
public class ComponentConverter {
public static BluePrintCPP currentBluePrint = null;
public static String nameOfFunction = "";
public static MathCommand usedMathCommand = null;
public static List<String> namesOfFunctions = new ArrayList<>();
public static List<MathCommand> usedMathCommand = new ArrayList<>();
public static BluePrint convertComponentSymbolToBluePrint(EMAComponentInstanceSymbol componentSymbol, MathStatementsSymbol mathStatementsSymbol, List<String> includeStrings, GeneratorCPP generatorCPP) {
BluePrintCPP bluePrint = new BluePrintCPP(GeneralHelperMethods.getTargetLanguageComponentName(componentSymbol.getFullName()));
......@@ -61,27 +61,32 @@ public class ComponentConverter {
}
bluePrint.addVariable(ComponentInstanceConverter.convertComponentInstanceSymbolToVariable(instanceSymbol, componentSymbol));
}
//create arrays from variables that only differ at the end by _number_
BluePrintFixer.fixBluePrintVariableArrays(bluePrint);
//ToDo: add bluePrintFixer.fixBluePrintCvVariableArrays;
MathInformationFilter.filterStaticInformation(componentSymbol, bluePrint, mathStatementsSymbol, generatorCPP, includeStrings);
//save function name
if(mathStatementsSymbol != null) {
if (mathStatementsSymbol.getMathExpressionSymbols().get(0).isAssignmentExpression()) {
if (((MathAssignmentExpressionSymbol) mathStatementsSymbol.getMathExpressionSymbols().get(0)).getExpressionSymbol() instanceof MathMatrixNameExpressionSymbol) {
nameOfFunction = ((MathMatrixNameExpressionSymbol) ((MathAssignmentExpressionSymbol) mathStatementsSymbol.getMathExpressionSymbols().get(0)).getExpressionSymbol()).getNameToAccess();
List<MathExpressionSymbol> mathExpressionSymbols = mathStatementsSymbol.getMathExpressionSymbols();
for(MathExpressionSymbol mathExpresionSymbol : mathExpressionSymbols){
if (mathExpresionSymbol.isAssignmentExpression()) {
if (((MathAssignmentExpressionSymbol) mathExpresionSymbol).getExpressionSymbol() instanceof MathMatrixNameExpressionSymbol) {
namesOfFunctions.add(((MathMatrixNameExpressionSymbol) ((MathAssignmentExpressionSymbol) mathExpresionSymbol).getExpressionSymbol()).getNameToAccess());
}
} else if(mathStatementsSymbol.getMathExpressionSymbols().get(0).isValueExpression()){
if(((MathValueSymbol) mathStatementsSymbol.getMathExpressionSymbols().get(0)).getValue() instanceof MathMatrixNameExpressionSymbol){
nameOfFunction = ((MathMatrixNameExpressionSymbol)((MathValueSymbol) mathStatementsSymbol.getMathExpressionSymbols().get(0)).getValue()).getNameToAccess();
} else if(mathExpresionSymbol.isValueExpression()) {
if (((MathValueSymbol) mathExpresionSymbol).getValue() instanceof MathMatrixNameExpressionSymbol) {
boolean bool = namesOfFunctions.add(((MathMatrixNameExpressionSymbol) ((MathValueSymbol) mathExpresionSymbol).getValue()).getNameToAccess());
}
}
}
}
if(namesOfFunctions != null) {
for(String nameOfFunction : namesOfFunctions){
usedMathCommand.add(bluePrint.getMathCommandRegister().getMathCommand(nameOfFunction));
}
if(nameOfFunction != "") {
usedMathCommand = bluePrint.getMathCommandRegister().getMathCommand(nameOfFunction);
}
//ToDo: add a BluePrintFixer.fixerBluePrintCVfuncitons(bluePrint, nameOfFunction);
......
......@@ -194,9 +194,10 @@ public class ComponentConverterMethodGeneration {
mathExpressionSymbol, BluePrintCPP bluePrint, List<String> includeStrings/*, int lastIndex*/) {
MathFunctionFixer.fixMathFunctions(mathExpressionSymbol, bluePrint);
String result = ExecuteMethodGenerator.generateExecuteCode(mathExpressionSymbol, includeStrings);
if(ComponentConverter.usedMathCommand != null) {
String argumentReturnFunctionName = ComponentConverter.usedMathCommand.getMathCommandName();
if (ComponentConverter.usedMathCommand.isArgumentReturnMathCommand() && result.contains(argumentReturnFunctionName)) {
for (MathCommand mathCommand : ComponentConverter.usedMathCommand)
if(mathCommand != null) {
String argumentReturnFunctionName = mathCommand.getMathCommandName();
if (mathCommand.isArgumentReturnMathCommand() && result.contains(argumentReturnFunctionName)) {
result = fixArgumentReturnInstruction(result, method, mathExpressionSymbol, bluePrint);
}
}
......
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