Skip to content

Commit

Permalink
Fixed yml tests.
Browse files Browse the repository at this point in the history
Signed-off-by: Cervenka Dusan <[email protected]>
  • Loading branch information
Hadatko committed Jul 20, 2023
1 parent 40ae66b commit 566c957
Show file tree
Hide file tree
Showing 65 changed files with 434 additions and 421 deletions.
2 changes: 2 additions & 0 deletions erpc_c/infra/erpc_client_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
*/

extern "C" {
#else
#include "erpc_common.h"
#endif

typedef void (*client_error_handler_t)(erpc_status_t err,
Expand Down
2 changes: 1 addition & 1 deletion erpc_c/infra/erpc_codec.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "erpc_transport.hpp"

#include <cstring>
#include <stdint.h>
#include <cstdint>

/*!
* @addtogroup infra_codec
Expand Down
6 changes: 2 additions & 4 deletions erpcgen/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ SOURCES += $(OBJS_ROOT)/erpcgen_parser.tab.cpp \
# Prevent make from deleting these temp files.
.SECONDARY: $(OBJS_ROOT)/erpcgen_parser.tab.cpp \
$(OBJS_ROOT)/erpcgen_lexer.cpp \
$(OBJS_ROOT)/erpcgen/src/templates/c_common_standard_header.c \
$(OBJS_ROOT)/erpcgen/src/templates/c_common_erpc_header.c \
$(OBJS_ROOT)/erpcgen/src/templates/c_common_header.c \
$(OBJS_ROOT)/erpcgen/src/templates/cpp_interface_header.c \
$(OBJS_ROOT)/erpcgen/src/templates/cpp_interface_source.c \
$(OBJS_ROOT)/erpcgen/src/templates/cpp_client_header.c \
Expand All @@ -93,8 +92,7 @@ SOURCES += $(OBJS_ROOT)/erpcgen_parser.tab.cpp \
$(OBJS_ROOT)/erpcgen/src/templates/py_coders.c \
$(OBJS_ROOT)/erpcgen/src/templates/py_global_init.c

SOURCES += $(OBJS_ROOT)/erpcgen/src/templates/c_common_standard_header.c \
$(OBJS_ROOT)/erpcgen/src/templates/c_common_erpc_header.c \
SOURCES += $(OBJS_ROOT)/erpcgen/src/templates/c_common_header.c \
$(OBJS_ROOT)/erpcgen/src/templates/cpp_interface_header.c \
$(OBJS_ROOT)/erpcgen/src/templates/cpp_interface_source.c \
$(OBJS_ROOT)/erpcgen/src/templates/cpp_client_header.c \
Expand Down
3 changes: 1 addition & 2 deletions erpcgen/VisualStudio_v14/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ cpp_client_header.cpp
cpp_server_header.cpp
cpp_server_source.cpp
cpp_coders.cpp
c_common_standard_header.cpp
c_common_erpc_header.cpp
c_common_header.cpp
c_client_source.cpp
c_client_header.cpp
c_server_header.cpp
Expand Down
9 changes: 3 additions & 6 deletions erpcgen/VisualStudio_v14/erpcgen.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@
</CustomBuildStep>
<PreBuildEvent>
<Command>python.exe ..\bin\txt_to_c.py --output .\cpp_coders.cpp ..\src\templates\cpp_coders.template
python.exe ..\bin\txt_to_c.py --output .\c_common_standard_header.cpp ..\src\templates\c_common_standard_header.template
python.exe ..\bin\txt_to_c.py --output .\c_common_erpc_header.cpp ..\src\templates\c_common_erpc_header.template
python.exe ..\bin\txt_to_c.py --output .\c_common_header.cpp ..\src\templates\c_common_header.template
python.exe ..\bin\txt_to_c.py --output .\cpp_interface_header.cpp ..\src\templates\cpp_interface_header.template
python.exe ..\bin\txt_to_c.py --output .\cpp_interface_source.cpp ..\src\templates\cpp_interface_source.template
python.exe ..\bin\txt_to_c.py --output .\cpp_client_header.cpp ..\src\templates\cpp_client_header.template
Expand Down Expand Up @@ -146,8 +145,7 @@ python.exe ..\bin\txt_to_c.py --output .\py_global_init.cpp ..\src\templates\py_
</Link>
<PreBuildEvent>
<Command>python.exe ..\bin\txt_to_c.py --output .\cpp_coders.cpp ..\src\templates\cpp_coders.template
python.exe ..\bin\txt_to_c.py --output .\c_common_standard_header.cpp ..\src\templates\c_common_standard_header.template
python.exe ..\bin\txt_to_c.py --output .\c_common_erpc_header.cpp ..\src\templates\c_common_erpc_header.template
python.exe ..\bin\txt_to_c.py --output .\c_common_header.cpp ..\src\templates\c_common_header.template
python.exe ..\bin\txt_to_c.py --output .\cpp_interface_header.cpp ..\src\templates\cpp_interface_header.template
python.exe ..\bin\txt_to_c.py --output .\cpp_interface_source.cpp ..\src\templates\cpp_interface_source.template
python.exe ..\bin\txt_to_c.py --output .\cpp_client_header.cpp ..\src\templates\cpp_client_header.template
Expand Down Expand Up @@ -246,8 +244,7 @@ python.exe ..\bin\txt_to_c.py --output .\py_global_init.cpp ..\src\templates\py_
<ClCompile Include="..\src\UniqueIdChecker.cpp" />
<ClCompile Include="..\src\Utils.cpp" />
<ClCompile Include="cpp_coders.cpp" />
<ClCompile Include="c_common_standard_header.cpp" />
<ClCompile Include="c_common_erpc_header.cpp" />
<ClCompile Include="c_common_header.cpp" />
<ClCompile Include="c_crc.cpp" />
<ClCompile Include="cpp_interface_header.cpp" />
<ClCompile Include="cpp_interface_source.cpp" />
Expand Down
5 changes: 1 addition & 4 deletions erpcgen/VisualStudio_v14/erpcgen.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,7 @@
<ClCompile Include="cpp_coders.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="c_common_standard_header.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="c_common_erpc_header.cpp">
<ClCompile Include="c_common_header.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="cpp_interface_header.cpp">
Expand Down
57 changes: 28 additions & 29 deletions erpcgen/src/CGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ using namespace std;
static const char *const kIdentifierChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";

// Templates strings converted from text files by txt_to_c.py.
extern const char *const kCCommonStandardHeader;
extern const char *const kCCommonErpcHeader;
extern const char *const kCCommonHeader;
extern const char *const kCppCommonHeader;
extern const char *const kCppInterfaceHeader;
extern const char *const kCppInterfaceSource;
extern const char *const kCppClientHeader;
Expand Down Expand Up @@ -79,8 +79,8 @@ CGenerator::CGenerator(InterfaceDefinition *def)

void CGenerator::generateOutputFiles(const string &fileName)
{
generateCommonStandardCHeaderFiles(fileName);
generateCommonErpcCHeaderFiles(fileName);
generateCommonCHeaderFiles(fileName);
generateCommonCppHeaderFiles(fileName);

generateInterfaceCppHeaderFile(fileName);
generateInterfaceCppSourceFile(fileName);
Expand All @@ -98,20 +98,22 @@ void CGenerator::generateOutputFiles(const string &fileName)
generateServerCSourceFile(fileName);
}

void CGenerator::generateCommonStandardCHeaderFiles(string fileName)
void CGenerator::generateCommonCHeaderFiles(string fileName)
{
fileName += "_common_standard.h";
m_templateData["commonStandardCGuardMacro"] = generateIncludeGuardName(fileName);
m_templateData["commonStandardCHeaderName"] = fileName;
generateOutputFile(fileName, "c_common_standard_header", m_templateData, kCCommonStandardHeader);
fileName += "_common.h";
m_templateData["commonGuardMacro"] = generateIncludeGuardName(fileName);
m_templateData["commonCHeaderName"] = fileName;
m_templateData["cCommonHeaderFile"] = true;
generateOutputFile(fileName, "c_common_header", m_templateData, kCCommonHeader);
}

void CGenerator::generateCommonErpcCHeaderFiles(string fileName)
void CGenerator::generateCommonCppHeaderFiles(string fileName)
{
fileName += "_common_erpc.h";
m_templateData["commonErpcCGuardMacro"] = generateIncludeGuardName(fileName);
m_templateData["commonErpcCHeaderName"] = fileName;
generateOutputFile(fileName, "c_common_erpc_header", m_templateData, kCCommonErpcHeader);
fileName += "_common.hpp";
m_templateData["commonGuardMacro"] = generateIncludeGuardName(fileName);
m_templateData["commonCppHeaderName"] = fileName;
m_templateData["cCommonHeaderFile"] = false;
generateOutputFile(fileName, "c_common_header", m_templateData, kCCommonHeader);
}

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

m_templateData["generateInfraErrorChecks"] = generateInfraErrorChecks;
m_templateData["generateAllocErrorChecks"] = generateAllocErrorChecks;
Expand Down Expand Up @@ -596,7 +598,7 @@ void CGenerator::makeConstTemplateData()
if (nullptr == constVarValue)
{
throw semantic_error(
format_string("line %d: Const pointing to null Value object.", constVar->getLastLine()).c_str());
format_string("line %d: Const pointing to null Value object.", constVar->getLastLine()));
}

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

EnumType *constEnum = dynamic_cast<EnumType *>(constVarType);
Expand All @@ -635,9 +636,8 @@ void CGenerator::makeConstTemplateData()
if (value.compare("") == 0)
{
value = "(" + constVarType->getName() + ") " + constVarValue->toString();
Log::warning(format_string("Enum value '%s' is not pointing to any '%s' variable \n",
constVarValue->toString().c_str(), constVarType->getName().c_str())
.c_str());
Log::warning("Enum value '%s' is not pointing to any '%s' variable \n",
constVarValue->toString().c_str(), constVarType->getName().c_str());
}
}
else
Expand Down Expand Up @@ -1104,8 +1104,7 @@ data_map CGenerator::getStructDefinitionTemplateData(Group *group, StructType *s
{
throw syntax_error(
format_string("line %d: Struct member shall use byref option. Member is using forward declared type.",
member->getFirstLine())
.c_str());
member->getFirstLine()));
}
// Handle nullable annotation
bool isNullable =
Expand Down Expand Up @@ -1693,7 +1692,7 @@ data_map CGenerator::getFunctionTemplateData(Group *group, Function *fn)

string proto = getFunctionPrototype(group, fn);
info["prototype"] = proto;
string protoCpp = getFunctionPrototype(group, fn, fn->getInterface()->getName() + "_client", "", true);
string protoCpp = getFunctionPrototype(group, fn, getOutputName(fn->getInterface()) + "_client", "", true);
info["prototypeCpp"] = protoCpp;
string protoInterface = getFunctionPrototype(group, fn, "", "", true);
info["prototypeInterface"] = protoInterface;
Expand Down Expand Up @@ -2520,11 +2519,11 @@ data_map CGenerator::getEncodeDecodeCall(const string &name, Group *group, DataT
}
else
{
throw semantic_error(format_string("line %d: Function has function type parameter (callback "
"parameter), but in IDL is missing function definition, which can "
"be passed there.",
structMember->getFirstLine())
.c_str());
throw semantic_error(
format_string("line %d: Function has function type parameter (callback "
"parameter), but in IDL is missing function definition, which can "
"be passed there.",
structMember->getFirstLine()));
}
templateData["encode"] = m_templateData["encodeFunctionType"];
templateData["decode"] = m_templateData["decodeFunctionType"];
Expand Down
12 changes: 6 additions & 6 deletions erpcgen/src/CGenerator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,18 @@ class CGenerator : public Generator
void generateOutputFiles(const std::string &fileNameExtension) override;

/*!
* @brief This function generate header file output with common standard code.
* @brief This function generate header file output with common eRPC code.
*
* @param[in] fileName Name for common standard header file output.
* @param[in] fileName Name for common eRPC header file output.
*/
void generateCommonStandardCHeaderFiles(std::string fileName);
void generateCommonCHeaderFiles(std::string fileName);

/*!
* @brief This function generate header file output with common eRPC code.
*
* @param[in] fileName Name for common eRPC header file output.
*/
void generateCommonErpcCHeaderFiles(std::string fileName);
void generateCommonCppHeaderFiles(std::string fileName);

/*!
* @brief This function generate output interface header file.
Expand Down Expand Up @@ -253,7 +253,7 @@ class CGenerator : public Generator
*
* @return Contains interface function data.
*/
cpptempl::data_map getFunctionTypeTemplateData(Group *group, FunctionType *fn);
cpptempl::data_map getFunctionTypeTemplateData(Group *group, FunctionType *fn) override;

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

/*!
* @brief This function return interface function representation called by server side.
Expand Down
23 changes: 10 additions & 13 deletions erpcgen/src/Generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
#include "format_string.hpp"

#include <algorithm>
#include <list>
#include <cstring>
#include <ctime>
#include <filesystem>
#include <list>

using namespace erpcgen;
using namespace cpptempl;
Expand All @@ -39,6 +39,7 @@ Generator::Generator(InterfaceDefinition *def, generator_type_t generatorType)
string scopeName = "erpcShim";
string scopeNameC;
string scopeNamePrefix = "";
string namespaceVal = scopeName;

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

if (findAnnotation(m_def->getProgramSymbol(), NAMESPACE_ANNOTATION) != nullptr)
{
m_templateData["namespace"] = getAnnStringValue(m_def->getProgramSymbol(), NAMESPACE_ANNOTATION);
}
else
if (findAnnotation(program, NAMESPACE_ANNOTATION) != nullptr)
{
m_templateData["namespace"] = "erpcshim";
namespaceVal = getAnnStringValue(program, NAMESPACE_ANNOTATION);
}
}

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

// get group annotation with vector of theirs interfaces
m_groups.clear();
Expand Down Expand Up @@ -595,10 +593,8 @@ string Generator::getOutputName(Symbol *symbol, bool check)
auto it = reserverdWords.find(annName);
if (it != reserverdWords.end())
{
throw semantic_error(
format_string("line %d: Wrong symbol name '%s'. Cannot use program language reserved words.", line,
annName.c_str())
.c_str());
throw semantic_error(format_string(
"line %d: Wrong symbol name '%s'. Cannot use program language reserved words.", line, annName.c_str()));
}
}

Expand Down Expand Up @@ -701,7 +697,7 @@ void Generator::getCallbacksTemplateData(Group *group, const Interface *iface, d
for (auto functionType : iface->getFunctionTypes())
{
if ((std::find(callbackTypesNames.begin(), callbackTypesNames.end(), functionType->getName()) ==
callbackTypesNames.end()))
callbackTypesNames.end()))
{
callbackTypes.push_back(functionType);
callbackTypesNames.push_back(functionType->getName());
Expand Down Expand Up @@ -736,7 +732,8 @@ void Generator::getCallbacksTemplateData(Group *group, const Interface *iface, d
data_map callbackType;
callbackType["name"] = functionType->getName();
callbackType["typenameName"] = getFunctionPrototype(nullptr, functionType);
callbackType["interfaceTypenameName"] = getFunctionPrototype(nullptr, functionType, iface->getName() + "_interface");
callbackType["interfaceTypenameName"] =
getFunctionPrototype(nullptr, functionType, iface->getName() + "_interface");
if (!functionsInt.empty())
{
callbackType["callbacks"] = functionsInt;
Expand Down
9 changes: 5 additions & 4 deletions erpcgen/src/PythonGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ void PythonGenerator::generate()
m_templateData["structs"] = empty;
m_templateData["unions"] = empty;
m_templateData["consts"] = empty;
m_templateData["functions"] = empty;

parseSubtemplates();

Expand Down Expand Up @@ -625,9 +626,9 @@ data_map PythonGenerator::getTypeInfo(DataType *t)
}
else
{
throw semantic_error(format_string("Function has function type parameter (callback parameter), but in "
"IDL is missing function definition, which can be passed there.")
.c_str());
throw semantic_error(
"Function has function type parameter (callback parameter), but in "
"IDL is missing function definition, which can be passed there.");
}
break;
}
Expand Down Expand Up @@ -669,7 +670,7 @@ data_map PythonGenerator::getTypeInfo(DataType *t)
StructMember *discriminatorMember = dynamic_cast<StructMember *>(discriminatorSym);
if (!discriminatorMember)
{
throw internal_error(format_string("union discriminator is not a struct member"));
throw internal_error("union discriminator is not a struct member");
}
info["discriminatorType"] = getTypeInfo(discriminatorMember->getDataType());
}
Expand Down
2 changes: 1 addition & 1 deletion erpcgen/src/PythonGenerator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class PythonGenerator : public Generator
* @return String prototype representation for given function.
*/
std::string getFunctionPrototype(Group *group, FunctionBase *fn, const std::string &interfaceName = "",
const std::string &name = "", bool insideInterfaceCall = false);
const std::string &name = "", bool insideInterfaceCall = false) override;

/*!
* @brief This function sets const template data.
Expand Down
Loading

0 comments on commit 566c957

Please sign in to comment.