chore: tweaks

This commit is contained in:
anjingyu 2025-07-16 16:32:04 +08:00
parent 88531ed44d
commit 8ba5a1b4e6
2 changed files with 22 additions and 3 deletions

View File

@ -303,9 +303,7 @@ std::string GenHelper::GenMessageDef(const ad::dbcc::Message &msg, const ad::dbc
const std::string indent2 = GenerateIndent(indent_level + 1);
ss << indent << "/* " << msg.Name() << "(0x" << std::hex << msg.Id() << std::dec << "), len: " << msg.Dlc() << " bytes */"
<< std::endl;
ss << indent << "typedef struct _" << msg.Name() << "_0x" << std::hex << msg.Id() << std::dec
<< std::endl;
ss << indent << "{" << std::endl;
ss << indent << "typedef struct {" << std::endl;
for (const auto &sig : sigs) {
ad::dbcc::helper::SignalHelper sig_helper(sig.second);

View File

@ -61,6 +61,27 @@ function main()
/usr/bin/python3 "./parse_test.py" "$PROJ_DIR/test-data/parse_test.dbc"
/usr/bin/python3 "./gen_test.py" "$PROJ_DIR/test-data/gen_test.dbc" "$PROJ_DIR/test-data/gen_test.json"
# python "./test.py" "$@"
# Build the generated code
if command -v "clang" 1>/dev/null 2>&1; then
clang -o parser.o -c parser.c
if [ $? -ne 0 ]; then
echo "[W] Can not build parser.c successfully!";
else
echo "[I] Build parser.c successfully!";
rm parser.o
fi
elif command -v "gcc" 1>/dev/null 2>&1; then
gcc -o parser.o -c parser.c
if [ $? -ne 0 ]; then
echo "[W] Can not build parser.c successfully!";
else
echo "[I] Build parser.c successfully!";
rm parser.o
fi
else
echo "[W] Can not find Clang or GCC, please build the generated file by yourself."
fi
popd >/dev/null 2>&1 || exit
}