Repository navigation
Compile DBC files into a plain-C const database - #9
Merged
Merged
Conversation
dbc_compiler -c_path writes sorted const tables for PGN, CAN ID, and SPN lookup. The runtime in j1939_db.c is ISO C11: no constructors and no malloc. Identical layouts collapse to one generic row. When layouts differ, BA_ "J1939Default" marks the generic row. -no-strings omits the name blob. J1939Parser stays the C++ map path. J1939DbParser is a thin wrapper over the C database so existing tests keep their entry point.
Keep the C database include path and the test-data folder definition.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dbc_compiler -c_path db.ccompiles a DBC into a const C11 database (sibling.h) for PGN, CAN ID, and SPN lookup.-pgn_pathand-union_pathare unchanged.-no-stringsomits the name blob.BA_ "SPN",BA_ "J1939Default", and multiplexed signals, including two signals that share a start bit. Identical layouts under one PGN become one generic row. Two different generic layouts for the same PGN fail the compiler.j1939_db.c(j1939_db_find,j1939_signal_by_spn,j1939_signal_by_name, raw/phys/store).J1939Parseris unchanged.J1939DbParseris a thin C++ wrapper.Fixes #3
Test plan
all_testsand the coverage job stays above the gcovr floors (97.8% line, 93.3% branch)tests/dbc/j1939.dbcandtests/dbc/big_endian_database.dbcround-trip: generated C compiles withcc -std=c11 -Wall -Werror, and raw values match the C++ mapdbc_compiler -in tests/dbc/j1939.dbc -c_path db.c -no-stringsstill accepts-pgn_pathon the same invocation