You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2020/06/18 06:57:28 UTC
[plc4x] branch feature/c-code-generation-tagged-unions updated: -
Fixed a big in the generation of enum property generation
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch feature/c-code-generation-tagged-unions
in repository https://gitbox.apache.org/repos/asf/plc4x.git
The following commit(s) were added to refs/heads/feature/c-code-generation-tagged-unions by this push:
new 8e9cfff - Fixed a big in the generation of enum property generation
8e9cfff is described below
commit 8e9cfffcb44a4296b25369ef634d9c3c4dea95fe
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Thu Jun 18 08:57:21 2020 +0200
- Fixed a big in the generation of enum property generation
---
.../org/apache/plc4x/language/c/CLanguageTemplateHelper.java | 9 ++++-----
.../plc4c/generated-sources/s7/src/s7_var_payload_data_item.c | 2 +-
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/build-utils/language-c/src/main/java/org/apache/plc4x/language/c/CLanguageTemplateHelper.java b/build-utils/language-c/src/main/java/org/apache/plc4x/language/c/CLanguageTemplateHelper.java
index a3e5bd5..bc3d686 100644
--- a/build-utils/language-c/src/main/java/org/apache/plc4x/language/c/CLanguageTemplateHelper.java
+++ b/build-utils/language-c/src/main/java/org/apache/plc4x/language/c/CLanguageTemplateHelper.java
@@ -584,11 +584,10 @@ public class CLanguageTemplateHelper extends BaseFreemarkerLanguageTemplateHelpe
// Handling enum properties in C is a little more tricky as we have to use the enum value
// and pass this to a function that then returns the desired property value.
else if(propertyTypeDefinition instanceof EnumTypeDefinition) {
- EnumTypeDefinition enumTypeDefinition = (EnumTypeDefinition) propertyTypeDefinition;
- StringBuilder sb = new StringBuilder("plc4c_")
- .append(getCTypeName(propertyTypeDefinition.getName()))
- .append("_get_").append(camelCaseToSnakeCase(vl.getChild().getName()));
- return sb.toString();
+ return "plc4c_" +
+ getCTypeName(propertyTypeDefinition.getName()) +
+ "_get_" + camelCaseToSnakeCase(vl.getChild().getName()) +
+ "(" + vl.getName() + ")";
}
// Else ... generate a simple access path.
StringBuilder sb = new StringBuilder(vl.getName());
diff --git a/sandbox/plc4c/generated-sources/s7/src/s7_var_payload_data_item.c b/sandbox/plc4c/generated-sources/s7/src/s7_var_payload_data_item.c
index 621ab79..df1f3f7 100644
--- a/sandbox/plc4c/generated-sources/s7/src/s7_var_payload_data_item.c
+++ b/sandbox/plc4c/generated-sources/s7/src/s7_var_payload_data_item.c
@@ -54,7 +54,7 @@ plc4c_return_code plc4c_s7_read_write_s7_var_payload_data_item_parse(plc4c_spi_r
}
{
// Count array
- uint8_t itemCount = ((plc4c_s7_read_write_data_transport_size_get_size_in_bits) ? plc4c_spi_evaluation_helper_ceil((dataLength) / (8.0)) : dataLength);
+ uint8_t itemCount = ((plc4c_s7_read_write_data_transport_size_get_size_in_bits(transportSize)) ? plc4c_spi_evaluation_helper_ceil((dataLength) / (8.0)) : dataLength);
for(int curItem = 0; curItem < itemCount; curItem++) {
int8_t _value = plc4c_spi_read_byte(buf, 8);