Skip to content

Commit 566c957

Browse files
committed
Fixed yml tests.
Signed-off-by: Cervenka Dusan <cervenka@acrios.com>
1 parent 40ae66b commit 566c957

File tree

65 files changed

+434
-421
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+434
-421
lines changed

erpc_c/infra/erpc_client_manager.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
*/
2626

2727
extern "C" {
28+
#else
29+
#include "erpc_common.h"
2830
#endif
2931

3032
typedef void (*client_error_handler_t)(erpc_status_t err,

erpc_c/infra/erpc_codec.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "erpc_transport.hpp"
1717

1818
#include <cstring>
19-
#include <stdint.h>
19+
#include <cstdint>
2020

2121
/*!
2222
* @addtogroup infra_codec

erpcgen/Makefile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ SOURCES += $(OBJS_ROOT)/erpcgen_parser.tab.cpp \
7070
# Prevent make from deleting these temp files.
7171
.SECONDARY: $(OBJS_ROOT)/erpcgen_parser.tab.cpp \
7272
$(OBJS_ROOT)/erpcgen_lexer.cpp \
73-
$(OBJS_ROOT)/erpcgen/src/templates/c_common_standard_header.c \
74-
$(OBJS_ROOT)/erpcgen/src/templates/c_common_erpc_header.c \
73+
$(OBJS_ROOT)/erpcgen/src/templates/c_common_header.c \
7574
$(OBJS_ROOT)/erpcgen/src/templates/cpp_interface_header.c \
7675
$(OBJS_ROOT)/erpcgen/src/templates/cpp_interface_source.c \
7776
$(OBJS_ROOT)/erpcgen/src/templates/cpp_client_header.c \
@@ -93,8 +92,7 @@ SOURCES += $(OBJS_ROOT)/erpcgen_parser.tab.cpp \
9392
$(OBJS_ROOT)/erpcgen/src/templates/py_coders.c \
9493
$(OBJS_ROOT)/erpcgen/src/templates/py_global_init.c
9594

96-
SOURCES += $(OBJS_ROOT)/erpcgen/src/templates/c_common_standard_header.c \
97-
$(OBJS_ROOT)/erpcgen/src/templates/c_common_erpc_header.c \
95+
SOURCES += $(OBJS_ROOT)/erpcgen/src/templates/c_common_header.c \
9896
$(OBJS_ROOT)/erpcgen/src/templates/cpp_interface_header.c \
9997
$(OBJS_ROOT)/erpcgen/src/templates/cpp_interface_source.c \
10098
$(OBJS_ROOT)/erpcgen/src/templates/cpp_client_header.c \

erpcgen/VisualStudio_v14/.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ cpp_client_header.cpp
99
cpp_server_header.cpp
1010
cpp_server_source.cpp
1111
cpp_coders.cpp
12-
c_common_standard_header.cpp
13-
c_common_erpc_header.cpp
12+
c_common_header.cpp
1413
c_client_source.cpp
1514
c_client_header.cpp
1615
c_server_header.cpp

erpcgen/VisualStudio_v14/erpcgen.vcxproj

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,7 @@
9898
</CustomBuildStep>
9999
<PreBuildEvent>
100100
<Command>python.exe ..\bin\txt_to_c.py --output .\cpp_coders.cpp ..\src\templates\cpp_coders.template
101-
python.exe ..\bin\txt_to_c.py --output .\c_common_standard_header.cpp ..\src\templates\c_common_standard_header.template
102-
python.exe ..\bin\txt_to_c.py --output .\c_common_erpc_header.cpp ..\src\templates\c_common_erpc_header.template
101+
python.exe ..\bin\txt_to_c.py --output .\c_common_header.cpp ..\src\templates\c_common_header.template
103102
python.exe ..\bin\txt_to_c.py --output .\cpp_interface_header.cpp ..\src\templates\cpp_interface_header.template
104103
python.exe ..\bin\txt_to_c.py --output .\cpp_interface_source.cpp ..\src\templates\cpp_interface_source.template
105104
python.exe ..\bin\txt_to_c.py --output .\cpp_client_header.cpp ..\src\templates\cpp_client_header.template
@@ -146,8 +145,7 @@ python.exe ..\bin\txt_to_c.py --output .\py_global_init.cpp ..\src\templates\py_
146145
</Link>
147146
<PreBuildEvent>
148147
<Command>python.exe ..\bin\txt_to_c.py --output .\cpp_coders.cpp ..\src\templates\cpp_coders.template
149-
python.exe ..\bin\txt_to_c.py --output .\c_common_standard_header.cpp ..\src\templates\c_common_standard_header.template
150-
python.exe ..\bin\txt_to_c.py --output .\c_common_erpc_header.cpp ..\src\templates\c_common_erpc_header.template
148+
python.exe ..\bin\txt_to_c.py --output .\c_common_header.cpp ..\src\templates\c_common_header.template
151149
python.exe ..\bin\txt_to_c.py --output .\cpp_interface_header.cpp ..\src\templates\cpp_interface_header.template
152150
python.exe ..\bin\txt_to_c.py --output .\cpp_interface_source.cpp ..\src\templates\cpp_interface_source.template
153151
python.exe ..\bin\txt_to_c.py --output .\cpp_client_header.cpp ..\src\templates\cpp_client_header.template
@@ -246,8 +244,7 @@ python.exe ..\bin\txt_to_c.py --output .\py_global_init.cpp ..\src\templates\py_
246244
<ClCompile Include="..\src\UniqueIdChecker.cpp" />
247245
<ClCompile Include="..\src\Utils.cpp" />
248246
<ClCompile Include="cpp_coders.cpp" />
249-
<ClCompile Include="c_common_standard_header.cpp" />
250-
<ClCompile Include="c_common_erpc_header.cpp" />
247+
<ClCompile Include="c_common_header.cpp" />
251248
<ClCompile Include="c_crc.cpp" />
252249
<ClCompile Include="cpp_interface_header.cpp" />
253250
<ClCompile Include="cpp_interface_source.cpp" />

erpcgen/VisualStudio_v14/erpcgen.vcxproj.filters

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,7 @@
167167
<ClCompile Include="cpp_coders.cpp">
168168
<Filter>Source Files</Filter>
169169
</ClCompile>
170-
<ClCompile Include="c_common_standard_header.cpp">
171-
<Filter>Source Files</Filter>
172-
</ClCompile>
173-
<ClCompile Include="c_common_erpc_header.cpp">
170+
<ClCompile Include="c_common_header.cpp">
174171
<Filter>Source Files</Filter>
175172
</ClCompile>
176173
<ClCompile Include="cpp_interface_header.cpp">

erpcgen/src/CGenerator.cpp

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ using namespace std;
3131
static const char *const kIdentifierChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
3232

3333
// Templates strings converted from text files by txt_to_c.py.
34-
extern const char *const kCCommonStandardHeader;
35-
extern const char *const kCCommonErpcHeader;
34+
extern const char *const kCCommonHeader;
35+
extern const char *const kCppCommonHeader;
3636
extern const char *const kCppInterfaceHeader;
3737
extern const char *const kCppInterfaceSource;
3838
extern const char *const kCppClientHeader;
@@ -79,8 +79,8 @@ CGenerator::CGenerator(InterfaceDefinition *def)
7979

8080
void CGenerator::generateOutputFiles(const string &fileName)
8181
{
82-
generateCommonStandardCHeaderFiles(fileName);
83-
generateCommonErpcCHeaderFiles(fileName);
82+
generateCommonCHeaderFiles(fileName);
83+
generateCommonCppHeaderFiles(fileName);
8484

8585
generateInterfaceCppHeaderFile(fileName);
8686
generateInterfaceCppSourceFile(fileName);
@@ -98,20 +98,22 @@ void CGenerator::generateOutputFiles(const string &fileName)
9898
generateServerCSourceFile(fileName);
9999
}
100100

101-
void CGenerator::generateCommonStandardCHeaderFiles(string fileName)
101+
void CGenerator::generateCommonCHeaderFiles(string fileName)
102102
{
103-
fileName += "_common_standard.h";
104-
m_templateData["commonStandardCGuardMacro"] = generateIncludeGuardName(fileName);
105-
m_templateData["commonStandardCHeaderName"] = fileName;
106-
generateOutputFile(fileName, "c_common_standard_header", m_templateData, kCCommonStandardHeader);
103+
fileName += "_common.h";
104+
m_templateData["commonGuardMacro"] = generateIncludeGuardName(fileName);
105+
m_templateData["commonCHeaderName"] = fileName;
106+
m_templateData["cCommonHeaderFile"] = true;
107+
generateOutputFile(fileName, "c_common_header", m_templateData, kCCommonHeader);
107108
}
108109

109-
void CGenerator::generateCommonErpcCHeaderFiles(string fileName)
110+
void CGenerator::generateCommonCppHeaderFiles(string fileName)
110111
{
111-
fileName += "_common_erpc.h";
112-
m_templateData["commonErpcCGuardMacro"] = generateIncludeGuardName(fileName);
113-
m_templateData["commonErpcCHeaderName"] = fileName;
114-
generateOutputFile(fileName, "c_common_erpc_header", m_templateData, kCCommonErpcHeader);
112+
fileName += "_common.hpp";
113+
m_templateData["commonGuardMacro"] = generateIncludeGuardName(fileName);
114+
m_templateData["commonCppHeaderName"] = fileName;
115+
m_templateData["cCommonHeaderFile"] = false;
116+
generateOutputFile(fileName, "c_common_header", m_templateData, kCCommonHeader);
115117
}
116118

117119
void CGenerator::generateInterfaceCppHeaderFile(string fileName)
@@ -478,7 +480,7 @@ void CGenerator::generate()
478480
}
479481
/* Generate file with shim code version. */
480482
m_templateData["versionGuardMacro"] =
481-
generateIncludeGuardName(format_string("erpc_generated_shim_code_crc_%d", m_idlCrc16).c_str());
483+
generateIncludeGuardName(format_string("erpc_generated_shim_code_crc_%d", m_idlCrc16));
482484

483485
m_templateData["generateInfraErrorChecks"] = generateInfraErrorChecks;
484486
m_templateData["generateAllocErrorChecks"] = generateAllocErrorChecks;
@@ -596,7 +598,7 @@ void CGenerator::makeConstTemplateData()
596598
if (nullptr == constVarValue)
597599
{
598600
throw semantic_error(
599-
format_string("line %d: Const pointing to null Value object.", constVar->getLastLine()).c_str());
601+
format_string("line %d: Const pointing to null Value object.", constVar->getLastLine()));
600602
}
601603

602604
/* Use char[] for constants. */
@@ -617,8 +619,7 @@ void CGenerator::makeConstTemplateData()
617619
if (constVarValue->getType() != kIntegerValue)
618620
{
619621
throw semantic_error(format_string("line %d: Const enum pointing to non-integer Value object.",
620-
constVar->getLastLine())
621-
.c_str());
622+
constVar->getLastLine()));
622623
}
623624

624625
EnumType *constEnum = dynamic_cast<EnumType *>(constVarType);
@@ -635,9 +636,8 @@ void CGenerator::makeConstTemplateData()
635636
if (value.compare("") == 0)
636637
{
637638
value = "(" + constVarType->getName() + ") " + constVarValue->toString();
638-
Log::warning(format_string("Enum value '%s' is not pointing to any '%s' variable \n",
639-
constVarValue->toString().c_str(), constVarType->getName().c_str())
640-
.c_str());
639+
Log::warning("Enum value '%s' is not pointing to any '%s' variable \n",
640+
constVarValue->toString().c_str(), constVarType->getName().c_str());
641641
}
642642
}
643643
else
@@ -1104,8 +1104,7 @@ data_map CGenerator::getStructDefinitionTemplateData(Group *group, StructType *s
11041104
{
11051105
throw syntax_error(
11061106
format_string("line %d: Struct member shall use byref option. Member is using forward declared type.",
1107-
member->getFirstLine())
1108-
.c_str());
1107+
member->getFirstLine()));
11091108
}
11101109
// Handle nullable annotation
11111110
bool isNullable =
@@ -1693,7 +1692,7 @@ data_map CGenerator::getFunctionTemplateData(Group *group, Function *fn)
16931692

16941693
string proto = getFunctionPrototype(group, fn);
16951694
info["prototype"] = proto;
1696-
string protoCpp = getFunctionPrototype(group, fn, fn->getInterface()->getName() + "_client", "", true);
1695+
string protoCpp = getFunctionPrototype(group, fn, getOutputName(fn->getInterface()) + "_client", "", true);
16971696
info["prototypeCpp"] = protoCpp;
16981697
string protoInterface = getFunctionPrototype(group, fn, "", "", true);
16991698
info["prototypeInterface"] = protoInterface;
@@ -2520,11 +2519,11 @@ data_map CGenerator::getEncodeDecodeCall(const string &name, Group *group, DataT
25202519
}
25212520
else
25222521
{
2523-
throw semantic_error(format_string("line %d: Function has function type parameter (callback "
2524-
"parameter), but in IDL is missing function definition, which can "
2525-
"be passed there.",
2526-
structMember->getFirstLine())
2527-
.c_str());
2522+
throw semantic_error(
2523+
format_string("line %d: Function has function type parameter (callback "
2524+
"parameter), but in IDL is missing function definition, which can "
2525+
"be passed there.",
2526+
structMember->getFirstLine()));
25282527
}
25292528
templateData["encode"] = m_templateData["encodeFunctionType"];
25302529
templateData["decode"] = m_templateData["decodeFunctionType"];

erpcgen/src/CGenerator.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,18 +92,18 @@ class CGenerator : public Generator
9292
void generateOutputFiles(const std::string &fileNameExtension) override;
9393

9494
/*!
95-
* @brief This function generate header file output with common standard code.
95+
* @brief This function generate header file output with common eRPC code.
9696
*
97-
* @param[in] fileName Name for common standard header file output.
97+
* @param[in] fileName Name for common eRPC header file output.
9898
*/
99-
void generateCommonStandardCHeaderFiles(std::string fileName);
99+
void generateCommonCHeaderFiles(std::string fileName);
100100

101101
/*!
102102
* @brief This function generate header file output with common eRPC code.
103103
*
104104
* @param[in] fileName Name for common eRPC header file output.
105105
*/
106-
void generateCommonErpcCHeaderFiles(std::string fileName);
106+
void generateCommonCppHeaderFiles(std::string fileName);
107107

108108
/*!
109109
* @brief This function generate output interface header file.
@@ -253,7 +253,7 @@ class CGenerator : public Generator
253253
*
254254
* @return Contains interface function data.
255255
*/
256-
cpptempl::data_map getFunctionTypeTemplateData(Group *group, FunctionType *fn);
256+
cpptempl::data_map getFunctionTypeTemplateData(Group *group, FunctionType *fn) override;
257257

258258
/*!
259259
* @brief This function will get symbol comments and convert to language specific ones
@@ -476,7 +476,7 @@ class CGenerator : public Generator
476476
* @return String prototype representation for given function.
477477
*/
478478
std::string getFunctionPrototype(Group *group, FunctionBase *fn, const std::string &interfaceName = "",
479-
const std::string &name = "", bool insideInterfaceCall = false);
479+
const std::string &name = "", bool insideInterfaceCall = false) override;
480480

481481
/*!
482482
* @brief This function return interface function representation called by server side.

erpcgen/src/Generator.cpp

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
#include "format_string.hpp"
1818

1919
#include <algorithm>
20-
#include <list>
2120
#include <cstring>
2221
#include <ctime>
2322
#include <filesystem>
23+
#include <list>
2424

2525
using namespace erpcgen;
2626
using namespace cpptempl;
@@ -39,6 +39,7 @@ Generator::Generator(InterfaceDefinition *def, generator_type_t generatorType)
3939
string scopeName = "erpcShim";
4040
string scopeNameC;
4141
string scopeNamePrefix = "";
42+
string namespaceVal = scopeName;
4243

4344
m_templateData["erpcVersion"] = ERPC_VERSION;
4445
m_templateData["erpcVersionNumber"] = ERPC_VERSION_NUMBER;
@@ -92,13 +93,9 @@ Generator::Generator(InterfaceDefinition *def, generator_type_t generatorType)
9293
scopeName = getAnnStringValue(program, SCOPE_NAME_ANNOTATION);
9394
}
9495

95-
if (findAnnotation(m_def->getProgramSymbol(), NAMESPACE_ANNOTATION) != nullptr)
96-
{
97-
m_templateData["namespace"] = getAnnStringValue(m_def->getProgramSymbol(), NAMESPACE_ANNOTATION);
98-
}
99-
else
96+
if (findAnnotation(program, NAMESPACE_ANNOTATION) != nullptr)
10097
{
101-
m_templateData["namespace"] = "erpcshim";
98+
namespaceVal = getAnnStringValue(program, NAMESPACE_ANNOTATION);
10299
}
103100
}
104101

@@ -112,6 +109,7 @@ Generator::Generator(InterfaceDefinition *def, generator_type_t generatorType)
112109
}
113110
m_templateData["scopeNameC"] = scopeNameC;
114111
m_templateData["scopeNamePrefix"] = scopeNamePrefix;
112+
m_templateData["namespace"] = namespaceVal;
115113

116114
// get group annotation with vector of theirs interfaces
117115
m_groups.clear();
@@ -595,10 +593,8 @@ string Generator::getOutputName(Symbol *symbol, bool check)
595593
auto it = reserverdWords.find(annName);
596594
if (it != reserverdWords.end())
597595
{
598-
throw semantic_error(
599-
format_string("line %d: Wrong symbol name '%s'. Cannot use program language reserved words.", line,
600-
annName.c_str())
601-
.c_str());
596+
throw semantic_error(format_string(
597+
"line %d: Wrong symbol name '%s'. Cannot use program language reserved words.", line, annName.c_str()));
602598
}
603599
}
604600

@@ -701,7 +697,7 @@ void Generator::getCallbacksTemplateData(Group *group, const Interface *iface, d
701697
for (auto functionType : iface->getFunctionTypes())
702698
{
703699
if ((std::find(callbackTypesNames.begin(), callbackTypesNames.end(), functionType->getName()) ==
704-
callbackTypesNames.end()))
700+
callbackTypesNames.end()))
705701
{
706702
callbackTypes.push_back(functionType);
707703
callbackTypesNames.push_back(functionType->getName());
@@ -736,7 +732,8 @@ void Generator::getCallbacksTemplateData(Group *group, const Interface *iface, d
736732
data_map callbackType;
737733
callbackType["name"] = functionType->getName();
738734
callbackType["typenameName"] = getFunctionPrototype(nullptr, functionType);
739-
callbackType["interfaceTypenameName"] = getFunctionPrototype(nullptr, functionType, iface->getName() + "_interface");
735+
callbackType["interfaceTypenameName"] =
736+
getFunctionPrototype(nullptr, functionType, iface->getName() + "_interface");
740737
if (!functionsInt.empty())
741738
{
742739
callbackType["callbacks"] = functionsInt;

erpcgen/src/PythonGenerator.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ void PythonGenerator::generate()
122122
m_templateData["structs"] = empty;
123123
m_templateData["unions"] = empty;
124124
m_templateData["consts"] = empty;
125+
m_templateData["functions"] = empty;
125126

126127
parseSubtemplates();
127128

@@ -625,9 +626,9 @@ data_map PythonGenerator::getTypeInfo(DataType *t)
625626
}
626627
else
627628
{
628-
throw semantic_error(format_string("Function has function type parameter (callback parameter), but in "
629-
"IDL is missing function definition, which can be passed there.")
630-
.c_str());
629+
throw semantic_error(
630+
"Function has function type parameter (callback parameter), but in "
631+
"IDL is missing function definition, which can be passed there.");
631632
}
632633
break;
633634
}
@@ -669,7 +670,7 @@ data_map PythonGenerator::getTypeInfo(DataType *t)
669670
StructMember *discriminatorMember = dynamic_cast<StructMember *>(discriminatorSym);
670671
if (!discriminatorMember)
671672
{
672-
throw internal_error(format_string("union discriminator is not a struct member"));
673+
throw internal_error("union discriminator is not a struct member");
673674
}
674675
info["discriminatorType"] = getTypeInfo(discriminatorMember->getDataType());
675676
}

0 commit comments

Comments
 (0)