Skip to content

Normalize CANdo bit_start Ranges To Plain Integers - #550

Open
coderask wants to merge 1 commit into
mainfrom
normalize-bit-start-ranges
Open

Normalize CANdo bit_start Ranges To Plain Integers#550
coderask wants to merge 1 commit into
mainfrom
normalize-bit-start-ranges

Conversation

@coderask

Copy link
Copy Markdown
Contributor

Summary

In GRCAN.CANdo, 26 bit_start values used range notation (e.g. bit_start: 0-7) instead of plain integers (bit_start: 0). The range end is always derivable from bit_start + type_width(data_type) - 1, making it redundant information.

Every Perl parser was already stripping the range on read:

  • DBCparser.pl used $v =~ s/-.*//smx; in two places
  • STRUCTparser.pl only captured (\d+) so it ignored ranges naturally

Changes

  1. GRCAN.CANdo -- Converted all 26 bit_start range values to plain integers (just the start value).

  2. DBCparser.pl -- Removed the now-unnecessary range-stripping logic:

    • Removed $v =~ s/-.*//smx; from the Message ID signal parsing block (line 858).
    • Simplified the Custom CAN ID bit_start regex from ([\d\-]+) to (\d+) and removed the $bs =~ s/-.*//smx; line (lines 913-915).

Why

  • The range notation was redundant and a source of complexity.
  • Removing it simplifies the parsers and reduces special-case handling.
  • This is preparatory cleanup for future Rust parser migration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant