Conversation
Signed-off-by: Yogev Neumann <xqgex@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR consolidates Data Element template architecture by introducing type-specific organization. The changes rename assemble_de.j2 to assemble_de_bitstring.j2, inline the file_header_de.j2 content directly into the main template, and refactor the Python generator to dispatch by ASN.1 type class. This eliminates template indirection while preparing the codebase for additional Data Element type generators (INTEGER, ENUMERATED, etc.) without behavioral changes to generated C code.
Changes:
- Rename and consolidate BIT STRING template with inline file header
- Add type-class dispatcher pattern in generator with improved error messages
- Add three new test files for internal BIT STRING constants validation
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
tools/templates/file_header_de.j2 |
Deleted template file (content moved inline) |
tools/templates/assemble_de_bitstring.j2 |
Renamed from assemble_de.j2 with inlined file header content |
tools/j2735_c_generator_data_element.py |
Refactored to dispatch by type class with new module docstring |
tools/tests/c_generator/test_bitstring_internal_root_size.py |
New test file for root size constant validation |
tools/tests/c_generator/test_bitstring_internal_max_wire_bits.py |
New test file for max wire bits constant validation |
tools/tests/c_generator/test_bitstring_internal_ext_size.py |
New test file for extended size constant validation |
Python CI ReportCommit: Python TestsTest Output✅ All tests passed Coverage: 98%
Details (2377 statements, 56 missed)
Python Static Analysis
mypypylintflake8ruffcodespell |
CI ReportCommit: Static Analysis
cppcheckClick to expandclang-tidyClick to expandSanitizers (ASan + UBSan)Test Output✅ No issues detected Valgrind Memory CheckTest Output✅ No memory issues detected |
Signed-off-by: Yogev Neumann <xqgex@users.noreply.github.com>
Python CI ReportCommit: Python TestsTest Output✅ All tests passed Coverage: 97%
Details (2353 statements, 60 missed)
Python Static Analysis
mypypylintflake8ruffcodespell |
CI ReportCommit: Static Analysis
cppcheckClick to expandclang-tidyClick to expandSanitizers (ASan + UBSan)Test Output✅ No issues detected Valgrind Memory CheckTest Output✅ No memory issues detected |
## Pull Request ### Description Consolidate Data Frame SEQUENCE templates and enforce `J2735_INTERNAL_*` naming for all internal macros. **Naming consistency:** All internal macros that are not part of the public API now use the `J2735_INTERNAL_` prefix consistently: - `J2735_OFF_` → `J2735_INTERNAL_OFF_` - `J2735_OPT_` → `J2735_INTERNAL_OPT_` - `J2735_PREFIX_BITS_` → `J2735_INTERNAL_PREFIX_BITS_` - `J2735_ROOT_SIZE_BITS_` → `J2735_INTERNAL_ROOT_SIZE_BITS_` **Wire format redesign:** Replaced the byte-level `ByteSegment` / `compute_wire_format()` Python API with a higher-level `WireVariant` / `get_sequence_variants()` API. Layout rendering (Unicode box-drawing tables) is now handled entirely by Jinja templates, making the Python layer responsible only for determining which variants exist (fixed, extensible with/without extensions, optional absent/present). **Template modularization:** - Monolithic `assemble_df.j2` → `assemble_df_sequence.j2` (focused on SEQUENCE types only) - `wire_format.j2` (Markdown table) → `wire_format_section.j2` + `wire_format_table.j2` (column-based) + `wire_format_compact.j2` (row-based for large types) - New `asn1_definition.j2` for rendering ASN.1 type definitions inside Doxygen comments - Six sequence sub-templates renamed to match the `_internal_` convention **Jinja filter housekeeping:** All filters renamed with `filter_` prefix for clarity. Two new filters added: `filter_is_signed` and `filter_format_range`. **Test coverage:** Added 8 new Python test files (~2,100 lines), expanded `conftest.py` with `make_optional_mock_spec()` builder and lightweight synthetic type helpers (`make_integer_field`, `make_bitstring_field`, `make_sequence`). New tests cover every sub-template, wire format variant generation, and structural invariants (box-drawing symmetry, bit position continuity). **Other:** Added Doxyfile for API documentation generation. ### Related Issue Follows #3 (Consolidate Data Element templates) ### Additional Notes The generated C headers (`BSMcoreData`, `IntersectionReferenceID`, `PathPrediction`) have been regenerated and verified against the existing C test suite. ### Type of Change - [ ] Bug fix (non-breaking change that fixes an issue) - [x] New feature (non-breaking change that adds functionality) - [x] Breaking change (fix or feature that would cause existing functionality to change) - [x] Documentation update - [ ] Performance improvement ### Checklist - [x] My code follows the project's zero-copy coding style - [x] I have read the [CONTRIBUTING.md](../CONTRIBUTING.md) guidelines - [x] I have added/updated documentation as needed - [x] I have added tests that prove my fix/feature works - [x] I have run `make pre-push` and all checks pass - [x] I have signed my commits (DCO) using `git commit -s` Signed-off-by: Yogev Neumann <xqgex@users.noreply.github.com>
Pull Request
Description
Consolidate Data Element templates into type-specific architecture
assemble_de.j2toassemble_de_bitstring.j2(BIT STRING specific)file_header_de.j2content inline intoassemble_de_bitstring.j2j2735_c_generator_data_element.py:generate_data_element()byASN1TypeClass_generate_bitstring()as internal helperdata_typefromtypedef.type_class.nameRelated Issue
N/A
Additional Notes
This is a template architecture refactor, not a behavioral change. Generated C code remains identical. The consolidation removes indirection and positions the codebase to add new Data Element type generators cleanly.
Type of Change
Checklist
make pre-pushand all checks passgit commit -s