Aufgrund einer Störung des s3 Storage, könnten in nächster Zeit folgende GitLab Funktionen nicht zur Verfügung stehen: LFS, Container Registry, Job Artifacs, Uploads (Wiki, Bilder, Projekt-Exporte). Wir bitten um Verständnis. Es wird mit Hochdruck an der Behebung des Problems gearbeitet. Weitere Informationen zur Störung des Object Storage finden Sie hier: https://maintenance.itc.rwth-aachen.de/ticket/status/messages/59-object-storage-pilot

Commit 89c6b8a4 authored by Ahmed's avatar Ahmed
Browse files

Merge branch 'adi-dev'

parents da296159 b96299c1
......@@ -63,4 +63,8 @@ public abstract class MathCommand {
return false;
}
public boolean isArgumentReturnMathCommand() {
return false;
}
}
/* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.generator;
import com.sun.org.apache.xpath.internal.Arg;
import de.monticore.lang.monticar.generator.cpp.commands.ArgumentReturnMathCommand;
import java.util.ArrayList;
import java.util.List;
......@@ -9,6 +12,7 @@ import java.util.List;
*/
public abstract class MathCommandRegister {
public List<MathCommand> mathCommands = new ArrayList<>();
public List<ArgumentReturnMathCommand> argumentReturnMathCommands = new ArrayList<>();
public MathCommandRegister() {
init();
......@@ -18,14 +22,27 @@ public abstract class MathCommandRegister {
mathCommands.add(mathCommand);
}
public void registerMathCommand(ArgumentReturnMathCommand argumentReturnMathCommand){
mathCommands.add(argumentReturnMathCommand);
argumentReturnMathCommands.add(argumentReturnMathCommand);
}
public MathCommand getMathCommand(String functionName) {
for (MathCommand mathCommand : mathCommands) {
if (mathCommand.getMathCommandName().equals(functionName))
return mathCommand;
if (mathCommand.getMathCommandName().equals(functionName))
if(mathCommand.isArgumentReturnMathCommand()){
return getArgumentReturnMathCommand(mathCommand);
} else {
return mathCommand;
}
}
return null;
}
public ArgumentReturnMathCommand getArgumentReturnMathCommand(MathCommand mathCommand){
return (ArgumentReturnMathCommand) mathCommand;
}
public boolean isMathCommand(String functionName) {
boolean isMathCommand = false;
if (getMathCommand(functionName) != null) {
......
......@@ -123,7 +123,7 @@ public class GeneratorCPP implements Generator {
public String generateString(TaggingResolver taggingResolver, EMAComponentInstanceSymbol componentInstanceSymbol, Scope symtab) {
MathStatementsSymbol mathSymbol = Helper.getMathStatementsSymbolFor(componentInstanceSymbol, symtab);
/// FIXME: 20/12/2019 go inside getMathStatement to consider how to determinte the expression type
return generateString(taggingResolver, componentInstanceSymbol, mathSymbol);
}
......
......@@ -3,6 +3,9 @@ package de.monticore.lang.monticar.generator.cpp;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.math._symboltable.MathStatementsSymbol;
import de.monticore.lang.math._symboltable.expression.MathAssignmentExpressionSymbol;
import de.monticore.lang.math._symboltable.expression.MathExpressionSymbol;
import de.monticore.lang.math._symboltable.matrix.MathMatrixNameExpressionSymbol;
import de.monticore.lang.monticar.generator.*;
import de.monticore.lang.monticar.generator.cpp.converter.ComponentConverter;
import de.monticore.lang.monticar.generator.cpp.converter.MathConverter;
......@@ -73,6 +76,7 @@ public class LanguageUnitCPP extends LanguageUnit {
public String getGeneratedHeader(TaggingResolver taggingResolver, BluePrintCPP bluePrint) {
ExecutionOrderFixer.fixExecutionOrder(taggingResolver, bluePrint, (GeneratorCPP) bluePrint.getGenerator());
String nameOfFunction = ComponentConverter.nameOfFunction;
String resultString = "";
//guard defines
resultString += "#ifndef " + bluePrint.getName().toUpperCase() + "\n";
......
/* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.generator.cpp.commands;
import de.monticore.lang.math._symboltable.expression.MathExpressionSymbol;
import de.monticore.lang.math._symboltable.matrix.MathMatrixAccessSymbol;
import de.monticore.lang.math._symboltable.matrix.MathMatrixNameExpressionSymbol;
import de.monticore.lang.monticar.generator.BluePrint;
import de.monticore.lang.monticar.generator.MathCommand;
import de.monticore.lang.monticar.generator.cpp.BluePrintCPP;
import de.monticore.lang.monticar.generator.cpp.MathFunctionFixer;
import de.monticore.lang.monticar.generator.cpp.OctaveHelper;
import de.monticore.lang.monticar.generator.cpp.converter.ExecuteMethodGenerator;
import de.monticore.lang.monticar.generator.cpp.converter.MathConverter;
import de.monticore.lang.monticar.generator.cpp.symbols.MathStringExpression;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
/**
* @author Ahmed Diab.
*/
public abstract class ArgumentReturnMathCommand extends MathCommand{
//TODO rename to argumentReturnMathCommand
public ArgumentReturnMathCommand() {
}
public ArgumentReturnMathCommand(String argumentReturnMathCommandName) {
super(argumentReturnMathCommandName);
}
public boolean isTargetLanguageCommand(String command) {
if (!command.isEmpty())
for (String s : getTargetLanguageCommandNames())
if (s.contentEquals(command))
return true;
return false;
}
public boolean isArgumentReturnMathCommand() {
return true;
}
}
......@@ -20,7 +20,7 @@ import java.util.List;
* @author Ahmed Diab
*/
public class ErodeCommand extends MathCommand{
public class ErodeCommand extends ArgumentReturnMathCommand{
public ErodeCommand() {
setMathCommandName("erode");
}
......
/* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.generator.cpp.converter;
import com.sun.xml.internal.bind.v2.TODO;
import de.monticore.expressionsbasis._ast.ASTExpression;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAPortInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc.types.EMAVariable;
import de.monticore.lang.embeddedmontiarcdynamic.embeddedmontiarcdynamic._symboltable.instanceStructure.EMADynamicComponentInstanceSymbol;
import de.monticore.lang.math._symboltable.MathStatementsSymbol;
import de.monticore.lang.math._symboltable.expression.MathAssignmentExpressionSymbol;
import de.monticore.lang.math._symboltable.expression.MathExpressionSymbol;
import de.monticore.lang.math._symboltable.matrix.MathMatrixArithmeticValueSymbol;
import de.monticore.lang.math._symboltable.matrix.MathMatrixExpressionSymbol;
import de.monticore.lang.math._symboltable.matrix.MathMatrixNameExpressionSymbol;
import de.monticore.lang.monticar.generator.*;
import de.monticore.lang.monticar.generator.cpp.*;
import de.monticore.lang.monticar.generator.cpp.instruction.ConstantConnectInstructionCPP;
......@@ -29,6 +32,7 @@ import java.util.stream.Collectors;
public class ComponentConverter {
public static BluePrintCPP currentBluePrint = null;
public static String nameOfFunction = "";
public static BluePrint convertComponentSymbolToBluePrint(EMAComponentInstanceSymbol componentSymbol, MathStatementsSymbol mathStatementsSymbol, List<String> includeStrings, GeneratorCPP generatorCPP) {
BluePrintCPP bluePrint = new BluePrintCPP(GeneralHelperMethods.getTargetLanguageComponentName(componentSymbol.getFullName()));
......@@ -59,7 +63,14 @@ public class ComponentConverter {
//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.getMathExpressionSymbols().get(0) instanceof MathAssignmentExpressionSymbol ){
nameOfFunction = ((MathMatrixNameExpressionSymbol)((MathAssignmentExpressionSymbol)mathStatementsSymbol.getMathExpressionSymbols().get(0)).getExpressionSymbol()).getNameToAccess();
}
//ToDo: add a BluePrintFixer.fixerBluePrintCVfuncitons(bluePrint, nameOfFunction);
generateInitMethod(componentSymbol, bluePrint, generatorCPP, includeStrings);
//generate execute method
......@@ -172,6 +183,7 @@ public class ComponentConverter {
generateInitStaticVariablePart(method, v, bluePrint);
} else {
generateInitNonStaticVariable(method, v, bluePrint);
//TODO: Handle the case for type changes like cube to vector<vector<Point>>
}
if (v.isArray())
v.setName(oldName);
......
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