Aufgrund einer Wartung wird GitLab am 21.09. zwischen 8:00 und 9:00 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to maintenance, GitLab will be temporarily unavailable on 21.09. between 8:00 and 9:00 am.

Commit afab8e82 authored by Jean Meurice's avatar Jean Meurice
Browse files

Merge branch 'master' of...

Merge branch 'master' of https://git.rwth-aachen.de/monticore/EmbeddedMontiArc/generators/EMAM2Cpp into sim_dev
parents c884b329 fbad20f0
Pipeline #455629 failed with stage
in 11 minutes and 10 seconds
......@@ -31,7 +31,7 @@ masterJobLinux:
- gcc --help
- mvn -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B clean deploy --settings settings.xml
- cat target/site/jacoco/index.html
- mvn package sonar:sonar -s settings.xml
# - mvn package sonar:sonar -s settings.xml
only:
- master
except:
......
......@@ -10,7 +10,7 @@
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-math-generator</artifactId>
<version>0.4.5</version>
<version>0.4.6</version>
<!-- == PROJECT DEPENDENCIES ============================================= -->
......
......@@ -85,6 +85,10 @@ public class Method {
instructions.add(instruction);
}
public void addInstruction(int index, Instruction instruction) {
instructions.add(index, instruction);
}
public void addInstructions(List<Instruction> instructions) {
this.instructions.addAll(instructions);
}
......
......@@ -161,9 +161,25 @@ public class ComponentConverter {
bluePrint.addMethod(update);
}
addOthersToExecuteMethod(bluePrint);
return bluePrint;
}
private static void addOthersToExecuteMethod(EMAMBluePrintCPP bluePrint) {
Optional<Method> executeOpt = bluePrint.getMethod("execute");
if (executeOpt.isPresent()) {
Method exMethod = executeOpt.get();
if (bluePrint.getMethod("next").isPresent()) {
exMethod.addInstruction(0, new TargetCodeInstruction("next();\n"));
}
if (bluePrint.getMethod("dynamic").isPresent()) {
exMethod.addInstruction(0, new TargetCodeInstruction("dynamic();\n"));
}
}
}
public static void addVariables(EMAComponentInstanceSymbol componentSymbol, EMAMBluePrintCPP bluePrint) {
//add parameters as variables
for (EMAVariable variable : componentSymbol.getParameters()) {
......
......@@ -13,6 +13,7 @@ import de.monticore.lang.monticar.generator.cpp.GeneralHelperMethods;
import de.monticore.lang.monticar.generator.cpp.GeneratorCPP;
import de.monticore.lang.monticar.generator.cpp.MathFunctionFixer;
import de.monticore.lang.monticar.generator.cpp.instruction.ConnectInstructionCPP;
import de.monticore.lang.monticar.generator.cpp.instruction.ExecuteDynamicConnects;
import de.monticore.lang.monticar.generator.cpp.loopSolver.CPPEquationSystemHelper;
import de.monticore.lang.monticar.generator.cpp.loopSolver.EquationSystemComponentInstanceSymbol;
import de.monticore.lang.monticar.generator.cpp.loopSolver.RHSComponentInstanceSymbol;
......@@ -88,6 +89,9 @@ public class ComponentConverterMethodGeneration {
} else
generateExecuteMethodInner(exMethod, componentSymbol, bluePrint, mathStatementsSymbol, generatorCPP, includeStrings);
// Add other instructions
fixExecuteDynamicConnects(exMethod);
// rearrange execute to be last
bluePrint.getMethods().remove(exMethod);
bluePrint.addMethod(exMethod);
......@@ -95,6 +99,27 @@ public class ComponentConverterMethodGeneration {
return exMethod;
}
private static void fixExecuteDynamicConnects(Method exMethod) {
List<Instruction> instructions = exMethod.getInstructions();
List<Integer> idx = new ArrayList<>();
for(int i = 1; i < instructions.size(); ++i){
if((instructions.get(i-1) instanceof ExecuteDynamicConnects) && (instructions.get(i) instanceof ExecuteDynamicConnects)){
ExecuteDynamicConnects a = (ExecuteDynamicConnects) instructions.get(i-1);
ExecuteDynamicConnects b = (ExecuteDynamicConnects) instructions.get(i);
if(a.getBeforeComponentName().equals(b.getBeforeComponentName())){
idx.add(i);
}
}
}
Collections.sort(idx, Collections.reverseOrder());
for(int i : idx){
instructions.remove(i);
}
exMethod.setInstructions(instructions);
}
private static void generateExecuteForRHSComponent(RHSComponentInstanceSymbol componentSymbol, EMAMBluePrintCPP bluePrint, GeneratorCPP generatorCPP, List<String> includeStrings, Method exMethod) {
SemiExplicitForm semiExplicitForm = componentSymbol.getSemiExplicitForm();
addRHSOutputCalls(componentSymbol, exMethod, bluePrint, generatorCPP);
......
package de.monticore.lang.monticar.generator.cpp.dynamic_interface;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
......
......@@ -17,7 +17,7 @@ using namespace std;
bool running = true;
void signal_handler(int signal);
int get_socket_id(PacketReader &input_packet, int max_count);
......
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