Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbd87a48

Browse files
committed
Fixed generator formatting bugs.
1 parent22ea2f1 commitbd87a48

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

‎src/codegen/c-main-generator.cpp‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ void CiMainGenerator::Generate(std::vector<MessageDescriptor_t*>& msgs, const Fs
5252
fwriter->AppendLine("#ifdef __cplusplus\nextern\"C\" {\n#endif",2);
5353
fwriter->AppendLine("#include <stdint.h>",2);
5454

55+
fwriter->AppendLine("// include current dbc-driver compilation config");
56+
fwriter->AppendLine(PrintF("#include\"%s-config.h\"", fsd.drvname.c_str()),2);
57+
5558
fwriter->AppendLine(PrintF("#ifdef %s", fsd.usemon_def.c_str()));
5659

5760
fwriter->AppendText(
@@ -130,9 +133,9 @@ void CiMainGenerator::Generate(std::vector<MessageDescriptor_t*>& msgs, const Fs
130133
fwriter->AppendLine(PrintF("#endif // %s", fsd.usebits_def.c_str()),2);
131134

132135
// start mon1 section
133-
fwriter->AppendLine(PrintF("#ifdef %s", fsd.usebits_def.c_str()),2);
136+
fwriter->AppendLine(PrintF("#ifdef %s", fsd.usemon_def.c_str()),2);
134137
fwriter->AppendLine(" FrameMonitor_t mon1;",2);
135-
fwriter->AppendLine(PrintF("#endif // %s", fsd.usebits_def.c_str()),2);
138+
fwriter->AppendLine(PrintF("#endif // %s", fsd.usemon_def.c_str()),2);
136139
fwriter->AppendLine(PrintF("} %s_t;", m.Name.c_str()),2);
137140
}
138141

@@ -149,15 +152,13 @@ void CiMainGenerator::Generate(std::vector<MessageDescriptor_t*>& msgs, const Fs
149152

150153
fwriter->AppendLine(PrintF("#ifdef %s", fsd.usesruct_def.c_str()));
151154

152-
fwriter->AppendLine(
153-
PrintF("uint32_t Pack_%s_%s(const %s_t* _m, __CoderDbcCanFrame_t__* cframe);",
154-
m.Name.c_str(), fsd.DrvName_orig.c_str(), m.Name.c_str()));
155+
fwriter->AppendLine(PrintF("uint32_t Pack_%s_%s(%s_t* _m, __CoderDbcCanFrame_t__* cframe);",
156+
m.Name.c_str(), fsd.DrvName_orig.c_str(), m.Name.c_str()));
155157

156158
fwriter->AppendLine("#else");
157159

158-
fwriter->AppendLine(
159-
PrintF("uint32_t Pack_%s_%s(const %s_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide);",
160-
m.Name.c_str(), fsd.DrvName_orig.c_str(), m.Name.c_str()));
160+
fwriter->AppendLine(PrintF("uint32_t Pack_%s_%s(%s_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide);",
161+
m.Name.c_str(), fsd.DrvName_orig.c_str(), m.Name.c_str()));
161162

162163
fwriter->AppendLine(PrintF("#endif // %s", fsd.usesruct_def.c_str()),2);
163164
}
@@ -169,7 +170,7 @@ void CiMainGenerator::Generate(std::vector<MessageDescriptor_t*>& msgs, const Fs
169170

170171
// 3 step is to print main source file
171172
// include main header file
172-
fwriter->AppendLine(PrintF("#include""%s""", fsd.core_h.fname.c_str()),3);
173+
fwriter->AppendLine(PrintF("#include\"%s\"", fsd.core_h.fname.c_str()),3);
173174

174175
// put diagmonitor ifdef selection for including @drv-fmon header
175176
// with FMon_* signatures to call from unpack function
@@ -181,7 +182,7 @@ void CiMainGenerator::Generate(std::vector<MessageDescriptor_t*>& msgs, const Fs
181182
"// function signature for CRC calculation\n"
182183
"// function signature for getting system tick value (100 us step)\n");
183184

184-
fwriter->AppendLine(PrintF("#include""%s-fmon.h""", fsd.drvname.c_str()),2);
185+
fwriter->AppendLine(PrintF("#include\"%s-fmon.h\"", fsd.drvname.c_str()),2);
185186

186187
fwriter->AppendLine(PrintF("#endif // %s", fsd.usemon_def.c_str()),3);
187188

@@ -206,17 +207,16 @@ void CiMainGenerator::Generate(std::vector<MessageDescriptor_t*>& msgs, const Fs
206207
fwriter->AppendLine(PrintF("#ifdef %s", fsd.usesruct_def.c_str()),2);
207208

208209
// second function
209-
fwriter->AppendLine(PrintF("uint32_t Pack_%s_%s(const%s_t* _m, __CoderDbcCanFrame_t__* cframe)",
210+
fwriter->AppendLine(PrintF("uint32_t Pack_%s_%s(%s_t* _m, __CoderDbcCanFrame_t__* cframe)",
210211
m.Name.c_str(), fsd.DrvName_orig.c_str(), m.Name.c_str()));
211212

212213
WritePackStructBody(sigprt->sigs_expr[num]);
213214

214215
fwriter->AppendLine("#else",2);
215216

216217
// third function
217-
fwriter->AppendLine(
218-
PrintF("uint32_t Pack_%s_%s(const %s_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide)",
219-
m.Name.c_str(), fsd.DrvName_orig.c_str(), m.Name.c_str()));
218+
fwriter->AppendLine(PrintF("uint32_t Pack_%s_%s(%s_t* _m, uint8_t* _d, uint8_t* _len, uint8_t* _ide)",
219+
m.Name.c_str(), fsd.DrvName_orig.c_str(), m.Name.c_str()));
220220

221221
WritePackArrayBody(sigprt->sigs_expr[num]);
222222

‎src/codegen/c-sigprinter.cpp‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,7 @@ std::string CSigPrinter::PrintSignalExpr(const SignalDescriptor_t* sig, std::vec
182182
snprintf(workbuff, WBUFF_LEN,"((_d[%d] >> %d) & (%s))", bn, bbc - slen, msk[slen].c_str());
183183
tosigexpr += workbuff;
184184

185-
snprintf(workbuff, WBUFF_LEN,"((_m->{%s} & (%s)) << %d)", sig->Name.c_str(), msk[slen].c_str(),
186-
bbc - slen);
185+
snprintf(workbuff, WBUFF_LEN,"((_m->%s & (%s)) << %d)", sig->Name.c_str(), msk[slen].c_str(), bbc - slen);
187186
AppendToByteLine(to_bytes[bn], workbuff);
188187
}
189188
elseif (bbc == slen)
@@ -275,4 +274,4 @@ void CSigPrinter::AppendToByteLine(std::string& expr, std::string str)
275274
// First appending
276275
expr = str;
277276
}
278-
}
277+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp