Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Any time bit-order changes, split off yet another buffered data output stream. Record the bit order of every buffered output stream.
  • When eventually collapsing the data output streams together, check that we in fact end up changing bit orders on proper byte boundaries or issue a runtime SDE.
    • Probably need to save information on each buffered data output stream for diagnostic purposes in issuing this error. E.g., the Term's Runtime Data object.

 

So let's go back to where we have just unparsed element 'b' and we're about to unparse element 'c'.

draw.io Diagram
bordertrue
viewerToolbartrue
fitWindowfalse
diagramNameCopy of buffered50
simpleViewerfalse
width
diagramWidth598
revision1

If we recognize that element 'c' has a different bit order, and we split off another buffered stream we get:

draw.io Diagram
bordertrue
viewerToolbartrue
fitWindowfalse
diagramNameCopy of Copy of buffered50
simpleViewerfalse
width
diagramWidth893
revision2

Now, the middle stream is marked FINAL, because we are splitting due to bit order change, not due to some additional suspended material to be added on later. The right-most stream contains the representation of 'c', confident that this stream begins on a byte boundary.

Now we unparse element 'd'. This is a string, and without getting into the details, we're going to say that it contains 28 bits containing the characters 'abc' then a NUL. These characters are 7-bits wide each, and they are stored LSBF. These characters in hex are 'a' is 0x61, 'b' is 0x62, 'c' is 0x63, and NUL is 0x00. First we unparse the 'a' getting 7 bits of 1100001. The frag byte has room for 4 characters, and LSBF those are the lease significant 4 bits of this character, so 0001. So the data output stream gets 0001 added to its frag byte for a full byte of 00001110 or hex 0x0E. This would be moved to the whole bytes, and the remaining 2 bits of the character 11 placed in the frag byte. So our streams now look like this:

draw.io Diagram
bordertrue
viewerToolbartrue
fitWindowfalse
diagramNameCopy of Copy of Copy of buffered50
simpleViewerfalse
width
diagramWidth893
revision4

By the same technique we output the next 3 characters, 'b', 'c', and the NUL (7 bits each), and we get:

draw.io Diagram
bordertrue
viewerToolbartrue
fitWindowfalse
diagramNameCopy of Copy of Copy of Copy of buffered50
simpleViewerfalse
width
diagramWidth893
revision4

At this point we have unparsed element 'd', so we know it's length now, it is 28 bits long.

NEXT UP:  'a' outputValueCalc can be evaluated, and the whole thing can collapse to the right (illustrate this).