Content-Length: 294547 | pFad | https://github.com/astand/c-coderdbc/commit/6661cdd2c48324a033d60fa1ce1a08dd459f9ec8

04 Added value table's macros printing to main driver header. · astand/c-coderdbc@6661cdd · GitHub
Skip to content

Commit 6661cdd

Browse files
committed
Added value table's macros printing to main driver header.
1 parent 961c15b commit 6661cdd

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)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/astand/c-coderdbc/commit/6661cdd2c48324a033d60fa1ce1a08dd459f9ec8

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy