You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "Steve Lawrence (Jira)" <ji...@apache.org> on 2022/01/25 15:51:00 UTC

[jira] [Commented] (DAFFODIL-2633) TDML documentPart type byte doesn't check for even number of digits

    [ https://issues.apache.org/jira/browse/DAFFODIL-2633?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17481907#comment-17481907 ] 

Steve Lawrence commented on DAFFODIL-2633:
------------------------------------------

It looks like we currently accept nibbles when docmentPart type is "byte" and we pad with zeros when converting to bytes depending on LTR or RTL. And we set the bitLimit correctly so we don't parse those extra pad bytes. So in your example, the TDML runner creates a bit string that is "0010 0000" with bit limit set to 4 bits.

I also wonder if allowing nibbles was intentional? With bits we don't require them to be a multiple of 8, which is maybe reasonable for many of our weird bit-centric formats that don't use full bytes, especialy if you want to mix in documentPart type="char" with non-byte char sets. Allowing nibbles also allows something like this:

{code:xml}
<tdml:document>
  <tdml:documentPart type="byte">2</tdml:documentPart>
  <tdml:documentPart type="bits">0010</tdml:documentPart>
</tdml:document>
{code}

So you could specify half of a byte in hex and the other half in bits. I'm not sure if this is something worth allowing or maybe it just leads to confusion?

If the goal is to limit confusion, if we limit type="byte" to multiples of 2, do we also want to limit bits to multiples of 8? Though, as mentioned before, this might cause issues with non-byte charsets if you want to fill in extra bits.

Also, I'm guessing the 4 you're seeing has something to do with the schema? With a unit test I can see that the data bits parsed by the TDML runner do not have the 4 (it's 0010 0000 with bit limit set to 4), but I'm not sure what kind of schema would cause that. Do you have the schema you used that cause the 4?

> TDML documentPart type byte doesn't check for even number of digits
> -------------------------------------------------------------------
>
>                 Key: DAFFODIL-2633
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2633
>             Project: Daffodil
>          Issue Type: Bug
>          Components: TDML Runner
>    Affects Versions: 3.2.1
>            Reporter: Mike Beckerle
>            Priority: Major
>
>  
> <tdml:documentPart type="byte">2</tdml:documentPart>
> doesn't cause any error message, seems to create the '$' character. (which is hex 24, so the 4 comes from ???)
> Should give a diagnostic, not even number of hex digits. 



--
This message was sent by Atlassian Jira
(v8.20.1#820001)