Skip to content
Snippets Groups Projects
Commit 3cd5ff88 authored by Thomas Böhm's avatar Thomas Böhm
Browse files

Protobuf-c compilers creates code only with lower case variable names.

parent 76530b03
No related branches found
No related tags found
No related merge requests found
......@@ -458,10 +458,10 @@ public class CoreExecutable extends ExecutionUnitExecutableBase<Core, CSourcePac
/** Create read code for the given {@link BusMasterPortExecutable} and analyze message fields. */
private void readMessageFromBus(IReadExecutable exec, InputPort p, List<IStatementTerm> body) {
Port sourcePort = p.getIncomingChannels().get(0).getSource();
String noValGuard = " if (msg.has_" + sourcePort.getName() + "==0) {\n";
String thenBlock = "noval_" + p.getName() + "_ID_" + p.getId() + "= true;\n}\n";
String elseBlock = "else { \n noval_" + p.getName() + "_ID_" + p.getId() + "= false;\n";
String valueAssignRHS = " msg." + sourcePort.getName();
String noValGuard = " if (msg.has_" + sourcePort.getName().toLowerCase() + " == false) {\n";
String thenBlock = "noval_" + p.getName() + "_ID_" + p.getId() + " = true;\n}\n";
String elseBlock = "else { \n noval_" + p.getName() + "_ID_" + p.getId() + " = false;\n";
String valueAssignRHS = " msg." + sourcePort.getName().toLowerCase();
String valueAssign = p.getName() + "_ID_" + p.getId() + "=" + valueAssignRHS + "; \n} \n";
String content = noValGuard + thenBlock + elseBlock + valueAssign;
if(exec instanceof IReadExecutableWithNoValSupport) {
......@@ -477,11 +477,12 @@ public class CoreExecutable extends ExecutionUnitExecutableBase<Core, CSourcePac
/** Create write code for the given {@link BusMasterPortExecutable}, update message fields. */
private void writeMessageToBus(IWriteExecutable exec, OutputPort p, List<IStatementTerm> body) {
String noValGuard = " if (noval_" + p.getName() + "_ID_" + p.getId() + "==true) {\n";
String thenBlock = "msg.has_" + p.getName() + "= 0;\n}\n";
String elseBlock = "else { \n msg.has_" + p.getName() + "= 1;\n";
String noValGuard = " if (noval_" + p.getName() + "_ID_" + p.getId() + " == true) {\n";
String thenBlock = "msg.has_" + p.getName().toLowerCase() + "= 0;\n}\n";
String elseBlock = "else { \n msg.has_" + p.getName().toLowerCase() + " = true;\n";
String valueAssign =
" msg." + p.getName() + " = " + p.getName() + "_ID_" + p.getId() + "; \n} \n";
" msg." + p.getName().toLowerCase() + " = " + p.getName() + "_ID_" + p.getId() +
"; \n} \n";
String content = noValGuard + thenBlock + elseBlock + valueAssign;
if(exec instanceof IWriteExecutableWithNoValSupport) {
Assignment sampleProto =
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment