1+ <#--
2+ Licensed to the Apache Software Foundation (ASF) under one
3+ or more contributor license agreements. See the NOTICE file
4+ distributed with this work for additional information
5+ regarding copyright ownership. The ASF licenses this file
6+ to you under the Apache License, Version 2.0 (the
7+ "License"); you may not use this file except in compliance
8+ with the License. You may obtain a copy of the License at
9+
10+ https://www.apache.org/licenses/LICENSE-2.0
11+
12+ Unless required by applicable law or agreed to in writing,
13+ software distributed under the License is distributed on an
14+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+ KIND, either express or implied. See the License for the
16+ specific language governing permissions and limitations
17+ under the License.
18+ -->
19+ <#-- Prevent freemarker from escaping stuff -->
20+ <#outputformat "undefined" >
21+ <#-- Declare the name and type of variables passed in to the template -->
22+ <#-- @ftlvariable name="languageName" type="java.lang.String" -->
23+ <#-- @ftlvariable name="protocolName" type="java.lang.String" -->
24+ <#-- @ftlvariable name="outputFlavor" type="java.lang.String" -->
25+ <#-- @ftlvariable name="helper" type="org.apache.plc4x.language.c.CLanguageTemplateHelper" -->
26+ <#-- @ftlvariable name="tracer" type="org.apache.plc4x.plugins.codegenerator.protocol.freemarker.Tracer" -->
27+ <#-- @ftlvariable name="type" type="org.apache.plc4x.plugins.codegenerator.types.definitions.ComplexTypeDefinition" -->
28+ <#-- Declare the name and type of variables declared locally inside the template -->
29+ <#-- @ftlvariable name="field" type="org.apache.plc4x.plugins.codegenerator.types.fields.Field" -->
30+ ${helper.getSourceDirectory()?replace(".", "/") } /${helper.camelCaseToSnakeCase(type.name)} .c
31+ /*
32+ * Licensed to the Apache Software Foundation (ASF) under one
33+ * or more contributor license agreements. See the NOTICE file
34+ * distributed with this work for additional information
35+ * regarding copyright ownership. The ASF licenses this file
36+ * to you under the Apache License, Version 2.0 (the
37+ * "License"); you may not use this file except in compliance
38+ * with the License. You may obtain a copy of the License at
39+ *
40+ * https://www.apache.org/licenses/LICENSE-2.0
41+ *
42+ * Unless required by applicable law or agreed to in writing,
43+ * software distributed under the License is distributed on an
44+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
45+ * KIND, either express or implied. See the License for the
46+ * specific language governing permissions and limitations
47+ * under the License.
48+ */
49+
50+ #ifndef ${helper.getCTypeName(type.name)?upper_case } _H_
51+ #define ${helper.getCTypeName(type.name)?upper_case } _H_
52+
53+ #include <stdbool .h >
54+ #include <stdint .h >
55+ #include <plc4c /spi /context.h >
56+ #include <plc4c /spi /read_buffer.h >
57+ #include <plc4c /spi /write_buffer.h >
58+ #include <plc4c /utils /list.h >
59+
60+ // Code generated by code-generation. DO NOT EDIT.
61+
62+ <#--
63+ When using const fields, output the constant reference values
64+ as global const values so we can use them elsewhere.
65+ -->
66+ <#if helper.getAllConstFields()?has_content >
67+
68+ // Constant values.
69+ <#list helper.getAllConstFields() as entry >
70+ <#assign constField=entry.key >
71+ <#assign parentTypeName=entry.value >
72+ static const ${helper.getLanguageTypeNameForField(constField)} ${helper.getCTypeName(parentTypeName)?upper_case } _${helper.camelCaseToSnakeCase(constField.name)?upper_case } _const = ${helper.toParseExpression(type, constField, constField.referenceValue, parserArguments) } ;
73+ ${helper.getLanguageTypeNameForField(constField)} ${helper.getCTypeName(parentTypeName)?upper_case } _${helper.camelCaseToSnakeCase(constField.name)?upper_case } () {
74+ return ${helper.getCTypeName(parentTypeName)?upper_case } _${helper.camelCaseToSnakeCase(constField.name)?upper_case } _const;
75+ }
76+ </#list >
77+ </#if >
78+
79+ </#outputformat >
0 commit comments