mbeckerle commented on issue #311:
URL:
https://github.com/apache/daffodil-vscode/issues/311#issuecomment-1372897379
Sorry to be so delayed in review of this.
Suggest the GUI should use standard DFDL terminology, not try to introduce
new concepts like lower-offset/higher-offset. or logical byte where the size
might not be 8 bits.
For bits, those terms just beg the question. Higher offset from where? Where
does it start.
The DFDL bit order terms are "least significant bit first" (abbreviated
LSBF) or "most significant bit first" (MSBF).
The constant is the place-value of the bit in its contribution to the
numeric value of the whole byte.
The "bit that represents the 2^7 place value" is an entirely unambiguous way
to refer to a bit. Within an 8 bit byte (unsigned conceptually, values 0 to
255 max), the 2^7 bit is the most-significant bit. The 2^0 bit is the least
significant.
Which of those is at bit position 1? Depends on MSBF or LSBF.
The significance of the bits isn't changing, the bit position numbering
scheme is changing. Consider 0x31 aka 49 or binary 00110001
Consider it as a number, not some representation in a computer.
As a binary number, the most significant 4 bits are 0011 the least
significant 4 bits are 0001. None of that changes regardless of what bit order
you choose. The value is always 0x31 or 49 hex for this byte.
Bit order just says how do you number the positions
87654321 (LSBF) or
12345678 (MSBF)
And that *only* matters if you are talking about parts of a byte. Is bit 5 a
0 or a 1.
in 0011**0**001 MSBF bit 5 is a 0.
in 001**1**0001 LSBF bit 5 is a 1.
There is one knob/setting that is purely about how the data is displayed on
the viewport and that is about bytes being displayed left to right or right to
left.
So the viewport should allow you to choose whether to present the bytes from
left to right (used with MSBF and big-endian typically, or to present the bytes
right to left (used with LSBF and littleEndian typically).
You also introduced a notion of logical byte having differing bit widths -
this is not a DFDL concept.
Suggest you avoid introducing this.
In DFDL, logical means "about the infoset" not the representation.
In the representation, the term "byte" always means an 8 bit 'octet' in the
DFDL spec.
In DFDL representation 'text' a character encoding's _code units_ can be
smaller than a whole byte. But a representation byte is always 8 bits
regardless of how the character code units are laid out on them.
If you are talking about carving up the data stream into a bunch of
consecutive 7-bit pieces, in DFDL you can only do that when you are talking
about text. Specifically text having a character encoding with 7-bit 'width'
for each character code unit.
In DFDL if you define a format which is a 7-bit integer of type "xs:byte" we
say your logical type is xs:byte (number with range from -128 to +127) is
populated from 7 specific bits in the representation. Those 7 bits may come
from within 1 byte of representation, or they may come from 7 bits that span 2
bytes in the representation.
<element name="x" type="xs:byte" dfdl:lengthUnits='bits' dfdl:length="7"
dfdl:representation="binary"
dfdl:binaryNumberRep="binary"/>
This is an element which is of type xs:byte, where the value of that byte is
taken from a 7-bit wide signed integer (2's complement) representation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]