@@ -66,11 +66,12 @@ void CiMainGenerator::Generate(std::vector<MessageDescriptor_t*>& msgs,
66
66
SetCommonValues (drvname);
67
67
68
68
// work_dir_path has the base dir path to gen files
69
+ // 1 step is to define final directory for source code bunch
69
70
mhead.dir = work_dir_path;
70
71
mhead.fname = drvname + " .h" ;
71
72
mhead.fpath = mhead.dir + " /" + mhead.fname ;
72
73
73
- // 1 step is to define final directory for source code bunch
74
+ // 2 step is to print main head file
74
75
fwriter->AppendLine (" #pragma once" , 2 );
75
76
fwriter->AppendLine (" #ifdef __cplusplus\n extern \" C\" {\n #endif" , 2 );
76
77
fwriter->AppendLine (" #include <stdint.h>" , 2 );
@@ -178,9 +179,37 @@ void CiMainGenerator::Generate(std::vector<MessageDescriptor_t*>& msgs,
178
179
fwriter->AppendLine (wbuff, 2 );
179
180
}
180
181
182
+ fwriter->AppendLine (" // Function signatures" , 2 );
183
+
184
+ for (size_t num = 0 ; num < sigprt->sigs_expr .size (); num++)
185
+ {
186
+ // write message typedef s and additional expressions
187
+ MessageDescriptor_t& m = sigprt->sigs_expr [num]->msg ;
188
+
189
+ snprintf (wbuff, kWBUFF_len , " uint32_t Unpack_%s_%s(%s_t* _m, const uint8_t* _d, uint8_t dlc_);" ,
190
+ m.Name .c_str (), drvname.c_str (), m.Name .c_str ());
191
+
192
+ fwriter->AppendLine (wbuff);
193
+
194
+ snprintf (wbuff, kWBUFF_len , " #ifdef %s" , usestruct_str.c_str ());
195
+ fwriter->AppendLine (wbuff);
196
+ snprintf (wbuff, kWBUFF_len , " uint32_t Pack_%s_%s(const %s_t* _m, __CoderDbcCanFrame_t__* cframe);" ,
197
+ m.Name .c_str (), drvname.c_str (), m.Name .c_str ());
198
+ fwriter->AppendLine (wbuff);
199
+
200
+ fwriter->AppendLine (" #else" );
201
+
202
+ snprintf (wbuff, kWBUFF_len ,
203
+ " uint32_t Pack_%s_%s(const %s_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide);" ,
204
+ m.Name .c_str (), drvname.c_str (), m.Name .c_str ());
205
+ fwriter->AppendLine (wbuff);
206
+
207
+ snprintf (wbuff, kWBUFF_len , " #endif // %s" , usestruct_str.c_str ());
208
+ fwriter->AppendLine (wbuff, 2 );
209
+ }
210
+
181
211
fwriter->AppendLine (" #ifdef __cplusplus\n }\n #endif" );
182
212
fwriter->Flush (mhead.fpath );
183
- // 2 step is to print main head file
184
213
185
214
// 3 step is to print main source file
186
215
0 commit comments