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

Commit6661cdd

Browse files
committed
Added value table's macros printing to main driver header.
1 parent961c15b commit6661cdd

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,30 @@ void CiMainGenerator::Gen_MainHeader()
137137
{
138138
max_sig_name_len = s.Name.size();
139139
}
140+
141+
// For each signal in current message print value tables definitions
142+
if (s.ValDefs.vpairs.size() >0)
143+
{
144+
fwriter->AppendLine(StrPrint("\n// Value tables for @%s signal", s.Name.c_str()),2);
145+
146+
for (auto i =0; i < s.ValDefs.vpairs.size(); i++)
147+
{
148+
// The value table definition consists of 'signal name + message name + value definition'
149+
// This provides reliable way of avoiding issues with same macros names
150+
std::string defname =StrPrint("%s_%s_%s", s.Name.c_str(), m.Name.c_str(), s.ValDefs.vpairs[i].first.c_str());
151+
152+
// @ifndef guard for the case when different values of table have
153+
// the same name (it is valid for DBC file format)
154+
// For this case only one of same named values will be available as macro
155+
fwriter->AppendLine(StrPrint("#ifndef %s", defname.c_str()));
156+
157+
fwriter->AppendLine(StrPrint("#define %s_%s_%s (%d)",
158+
s.Name.c_str(), m.Name.c_str(), s.ValDefs.vpairs[i].first.c_str(),
159+
s.ValDefs.vpairs[i].second));
160+
161+
fwriter->AppendLine(StrPrint("#endif"),2);
162+
}
163+
}
140164
}
141165

142166
fwriter->AppendText("\n");

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp