@@ -31,8 +31,8 @@ using namespace std;
31
31
static const char *const kIdentifierChars = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_" ;
32
32
33
33
// 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 ;
36
36
extern const char *const kCppInterfaceHeader ;
37
37
extern const char *const kCppInterfaceSource ;
38
38
extern const char *const kCppClientHeader ;
@@ -79,8 +79,8 @@ CGenerator::CGenerator(InterfaceDefinition *def)
79
79
80
80
void CGenerator::generateOutputFiles (const string &fileName)
81
81
{
82
- generateCommonStandardCHeaderFiles (fileName);
83
- generateCommonErpcCHeaderFiles (fileName);
82
+ generateCommonCHeaderFiles (fileName);
83
+ generateCommonCppHeaderFiles (fileName);
84
84
85
85
generateInterfaceCppHeaderFile (fileName);
86
86
generateInterfaceCppSourceFile (fileName);
@@ -98,20 +98,22 @@ void CGenerator::generateOutputFiles(const string &fileName)
98
98
generateServerCSourceFile (fileName);
99
99
}
100
100
101
- void CGenerator::generateCommonStandardCHeaderFiles (string fileName)
101
+ void CGenerator::generateCommonCHeaderFiles (string fileName)
102
102
{
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 );
107
108
}
108
109
109
- void CGenerator::generateCommonErpcCHeaderFiles (string fileName)
110
+ void CGenerator::generateCommonCppHeaderFiles (string fileName)
110
111
{
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 );
115
117
}
116
118
117
119
void CGenerator::generateInterfaceCppHeaderFile (string fileName)
@@ -478,7 +480,7 @@ void CGenerator::generate()
478
480
}
479
481
/* Generate file with shim code version. */
480
482
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));
482
484
483
485
m_templateData[" generateInfraErrorChecks" ] = generateInfraErrorChecks;
484
486
m_templateData[" generateAllocErrorChecks" ] = generateAllocErrorChecks;
@@ -596,7 +598,7 @@ void CGenerator::makeConstTemplateData()
596
598
if (nullptr == constVarValue)
597
599
{
598
600
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 ()));
600
602
}
601
603
602
604
/* Use char[] for constants. */
@@ -617,8 +619,7 @@ void CGenerator::makeConstTemplateData()
617
619
if (constVarValue->getType () != kIntegerValue )
618
620
{
619
621
throw semantic_error (format_string (" line %d: Const enum pointing to non-integer Value object." ,
620
- constVar->getLastLine ())
621
- .c_str ());
622
+ constVar->getLastLine ()));
622
623
}
623
624
624
625
EnumType *constEnum = dynamic_cast <EnumType *>(constVarType);
@@ -635,9 +636,8 @@ void CGenerator::makeConstTemplateData()
635
636
if (value.compare (" " ) == 0 )
636
637
{
637
638
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 ());
641
641
}
642
642
}
643
643
else
@@ -1104,8 +1104,7 @@ data_map CGenerator::getStructDefinitionTemplateData(Group *group, StructType *s
1104
1104
{
1105
1105
throw syntax_error (
1106
1106
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 ()));
1109
1108
}
1110
1109
// Handle nullable annotation
1111
1110
bool isNullable =
@@ -1693,7 +1692,7 @@ data_map CGenerator::getFunctionTemplateData(Group *group, Function *fn)
1693
1692
1694
1693
string proto = getFunctionPrototype (group, fn);
1695
1694
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 );
1697
1696
info[" prototypeCpp" ] = protoCpp;
1698
1697
string protoInterface = getFunctionPrototype (group, fn, " " , " " , true );
1699
1698
info[" prototypeInterface" ] = protoInterface;
@@ -2520,11 +2519,11 @@ data_map CGenerator::getEncodeDecodeCall(const string &name, Group *group, DataT
2520
2519
}
2521
2520
else
2522
2521
{
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 () ));
2528
2527
}
2529
2528
templateData[" encode" ] = m_templateData[" encodeFunctionType" ];
2530
2529
templateData[" decode" ] = m_templateData[" decodeFunctionType" ];
0 commit comments