Commit a7aa7101 authored by Evgeny Kusmenko's avatar Evgeny Kusmenko
Browse files

Merge branch 'richter-dev' into 'master'

Richter dev

See merge request !13
parents a0f5d8b3 7f6cecec
Pipeline #63847 passed with stage
in 2 minutes and 48 seconds
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<groupId>de.monticore.lang.monticar</groupId> <groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-math-generator</artifactId> <artifactId>embedded-montiarc-math-generator</artifactId>
<version>0.0.20-SNAPSHOT</version> <version>0.0.21-SNAPSHOT</version>
<!-- == PROJECT DEPENDENCIES ============================================= --> <!-- == PROJECT DEPENDENCIES ============================================= -->
......
...@@ -8,7 +8,6 @@ import de.monticore.lang.monticar.generator.Variable; ...@@ -8,7 +8,6 @@ import de.monticore.lang.monticar.generator.Variable;
import de.monticore.lang.monticar.generator.cpp.MathCommandRegisterCPP; import de.monticore.lang.monticar.generator.cpp.MathCommandRegisterCPP;
import de.monticore.lang.monticar.generator.cpp.MathFunctionFixer; import de.monticore.lang.monticar.generator.cpp.MathFunctionFixer;
import de.monticore.lang.monticar.generator.cpp.OctaveHelper; import de.monticore.lang.monticar.generator.cpp.OctaveHelper;
import de.monticore.lang.monticar.generator.cpp.StringValueListExtractorUtil;
import de.monticore.lang.monticar.generator.cpp.symbols.MathChainedExpression; import de.monticore.lang.monticar.generator.cpp.symbols.MathChainedExpression;
import de.monticore.lang.monticar.generator.cpp.symbols.MathStringExpression; import de.monticore.lang.monticar.generator.cpp.symbols.MathStringExpression;
import de.monticore.lang.monticar.types2._ast.ASTElementType; import de.monticore.lang.monticar.types2._ast.ASTElementType;
...@@ -111,7 +110,7 @@ public class ExecuteMethodGeneratorHandler { ...@@ -111,7 +110,7 @@ public class ExecuteMethodGeneratorHandler {
result = "=" + TypeConverter.getDimensionString(TypeConverter.getColvecAccessString(type), dims, includeStrings); result = "=" + TypeConverter.getDimensionString(TypeConverter.getColvecAccessString(type), dims, includeStrings);
} }
} else if (dims.size() == 2) { } else if (dims.size() == 2) {
if (typeString.equals(TypeConverter.getMatAccessString(type))) { if (typeIsCompatible(typeString, type, dims)) {
result = "=" + TypeConverter.getDimensionString(TypeConverter.getMatAccessString(type), dims, includeStrings); result = "=" + TypeConverter.getDimensionString(TypeConverter.getMatAccessString(type), dims, includeStrings);
} }
} else if (dims.size() == 3) { } else if (dims.size() == 3) {
...@@ -122,6 +121,14 @@ public class ExecuteMethodGeneratorHandler { ...@@ -122,6 +121,14 @@ public class ExecuteMethodGeneratorHandler {
return result; return result;
} }
private static boolean typeIsCompatible(String typeString, ASTElementType type, List<MathExpressionSymbol> dims) {
boolean result = typeString.equals(TypeConverter.getMatAccessString(type));
if (!result && (dims.size() == 2) && (dims.get(1).getTextualRepresentation().contentEquals("1"))) {
result = typeString.contentEquals("colvec") && TypeConverter.getMatAccessString(type).contentEquals("mat");
}
return result;
}
public static String generateExecuteCode(MathValueSymbol mathValueSymbol, List<String> includeStrings) { public static String generateExecuteCode(MathValueSymbol mathValueSymbol, List<String> includeStrings) {
String result = ""; String result = "";
String type = generateExecuteCode(mathValueSymbol.getType(), includeStrings); String type = generateExecuteCode(mathValueSymbol.getType(), includeStrings);
......
...@@ -272,7 +272,7 @@ public class ExecuteMethodGeneratorMatrixExpressionHandler { ...@@ -272,7 +272,7 @@ public class ExecuteMethodGeneratorMatrixExpressionHandler {
&& symbol.isMathMatrixAccessOperatorSymbolPresent() && symbol.isMathMatrixAccessOperatorSymbolPresent()
&& (!symbol.getNameToAccess().isEmpty()) && (!symbol.getNameToAccess().isEmpty())
&& (!MathCommandRegisterCPP.containsCommandExpression(symbol, symbol.getNameToAccess() + input)) && (!MathCommandRegisterCPP.containsCommandExpression(symbol, symbol.getNameToAccess() + input))
&& (!MathFunctionFixer.fixForLoopAccess(symbol.getMathMatrixAccessOperatorSymbol().getMathMatrixNameExpressionSymbol(), ComponentConverter.currentBluePrint)) && ((!MathFunctionFixer.fixForLoopAccess(symbol.getMathMatrixAccessOperatorSymbol().getMathMatrixNameExpressionSymbol(), ComponentConverter.currentBluePrint)) || (!input.contains("-1")))
&& (!StringValueListExtractorUtil.containsPortName(symbol.getNameToAccess())); && (!StringValueListExtractorUtil.containsPortName(symbol.getNameToAccess()));
} }
} }
...@@ -12,7 +12,7 @@ void init() ...@@ -12,7 +12,7 @@ void init()
} }
void execute() void execute()
{ {
colvec a; colvec a=mat(10,1);
} }
}; };
......
Supports Markdown
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