mbeckerle commented on a change in pull request #143: Support
dfdl:length="prefixed"
URL: https://github.com/apache/incubator-daffodil/pull/143#discussion_r239894529
##########
File path:
daffodil-core/src/main/scala/org/apache/daffodil/grammar/AlignedMixin.scala
##########
@@ -125,8 +126,8 @@ trait AlignedMixin extends GrammarMixin { self: Term =>
}
private lazy val priorAlignmentApprox: AlignmentMultipleOf = {
- if (this.isInstanceOf[Root]) {
- AlignmentMultipleOf(0) // root is aligned with anything
+ if (this.isInstanceOf[Root] || this.isInstanceOf[DetachedElementDecl]) {
+ AlignmentMultipleOf(0) // root and detached elements are aligned with
anything
Review comment:
So the use case that needs to work right is just a 32-bit word-aligned
prefix-length integer which gives the prefix length of a "normally thought of
as" byte-aligned text string. The element itself shouldn't have to specify
32-bit alignment. That should happen because the prefix is a 32-bit aligned
integer word. I believe this is actually a PL/1 data situation. Strings all
have prefixes. Those are always aligned words (either 4 bytes or 2 bytes I
believe). Let's just assume 4 bytes for the moment. Then two 7-character
strings would look like for the first string, 4-byte length, 7-bytes of text,
then for the 2nd string 1 byte of alignment, 4-byte length, 7-bytes of text.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services