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

Olabusayo Kilo commented on DAFFODIL-2173:
------------------------------------------

First pass at a solution, involves the following steps
 # Determine bitorder and byteorder of data at current position (finfo)
 # Check if bitPosition is mid byte.
 ## If it's mid byte, call fillByteArray (currently private) for bits up to the 
next byte boundary. Update byteLimit.
 ## 
{code:java}
// val bitsAlreadyCosumed = loc.bitPos0b % 8
// val firstByteBitArray = new Array[Byte](1)
/* if (bitsAlreadyConsumed != 0 ) // mid-byte {
* bitsToDisplay = 8 - bitsAlreadyConsumed
* inStream.fillByteArray(firstByteBitarray, bitsToDisplay, finfo)
* bytesLimit -= 1 //we've taken care of first byte
* }{code}

 # Call inputSource.get as usual, either with byteLimit 1 less, or unchanged. 
Decode this byte array as is currently done.
 # Use bitOrder and byteOrder to display bitArray (e.g xxxxx100 or 100xxxxx)

> Data dumps should be bit-aware
> ------------------------------
>
>                 Key: DAFFODIL-2173
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2173
>             Project: Daffodil
>          Issue Type: Bug
>          Components: Debugger
>    Affects Versions: 2.4.0
>            Reporter: Olabusayo Kilo
>            Assignee: Olabusayo Kilo
>            Priority: Major
>
> Data dumps print out bytes without regard to the bit offset. So if some bits 
> have already been consumed, the dumps might include those already consumed 
> bits.
> Ideally we would like to be bit sensitive. A possible solution would be to 
> track if the first byte of the left over data, already had consumed bytes i.e 
> ended mid-byte, and only display those non consumed bits. That is, if the 
> data ended at bit 5, and bit order is mostSignificantBitFirst, then this 
> picture would look like xxxxx000 (where the 0's are the actual left over data 
> bits in that first byte of the left over data.) If bitOrder is 
> leastSignificantBitFirst the picture would look like 000xxxxx.
> inStream.fillByteArray takes the bit offset into accound and can be utilized.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to