New feature: support for variable length fields
mmindenhall opened this issue · 3 comments
Hi Igor,
It would be helpful to specify the "extra data" portion of a field with an expression. If you agree it would be useful, I'd be happy to take a first cut and submit another pull request.
Here's the reason for the request. BCD is something that belongs at the field level...it's a single entity within the binary message. However, the length of the field varies, and in some message formats there's a length field prior to the BCD bytes. For example:
{<bcd length ubyte>, <bcd field byte 0>, ... <bcd field byte (length-1)>}
I'd like to be able to specify that with the DSL...something like this:
ubyte length;
bcd(length) bcd_field;
Or for an array:
ubyte field_count;
ubyte field_length;
bcd(field_length) [field_count] bcd_fields;
The exact syntax doesn't really matter, as long as it's possible to specify the field size via an expression.
Thoughts?
I have added support of expressions for 'extra field number field', so now it is possible to write
ubyte arrlen; ubyte bitlen; bit:(bitlen) [arrlen] bitarray;
Wow, thanks! This is a holiday weekend in the US, so I might not be able to check it out until Tuesday.
Hello,
Thanks again...this is working as expected with my BCD JBBPCustomFieldTypeProcessor
implementation.