mbeckerle commented on code in PR #98: URL: https://github.com/apache/daffodil-site/pull/98#discussion_r1034994553
########## site/dev/design-notes/runtime2-todos.adoc: ########## @@ -36,7 +36,108 @@ If someone wants to help please let the mailto:[email protected][dev] list know in order to avoid duplication. -=== Report hanging problem running sbt (really dev.dirs) from MSYS2 on Windows +=== Anonymous/multiple choice groups + +We already handle elements having xs:choice complex types. +In addition, we should support anonymous/multiple choice groups. +We may need to refine the choice runtime structure +in order to allow multiple choice groups +to be inlined into parent elements. +Here is an example schema +and corresponding C code to demonstrate: + +[source,xml] +---- + <xs:complexType name="NestedUnionType"> + <xs:sequence> + <xs:element name="first_tag" type="idl:int32"/> + <xs:choice dfdl:choiceDispatchKey="{xs:string(./first_tag)}"> + <xs:element name="foo" type="idl:FooType" dfdl:choiceBranchKey="1 2"/> + <xs:element name="bar" type="idl:BarType" dfdl:choiceBranchKey="3 4"/> + </xs:choice> + <xs:element name="second_tag" type="idl:int32"/> + <xs:choice dfdl:choiceDispatchKey="{xs:string(./second_tag)}"> + <xs:element name="fie" type="idl:FieType" dfdl:choiceBranchKey="1"/> + <xs:element name="fum" type="idl:FumType" dfdl:choiceBranchKey="2"/> + </xs:choice> + </xs:sequence> + </xs:complexType> +---- + +[source,c] +---- +typedef struct NestedUnion +{ + InfosetBase _base; + int32_t first_tag; + size_t _choice_1; // choice of which union field to use + union + { + foo foo; + bar bar; + }; + int32_t second_tag; + size_t _choice_2; // choice of which union field to use + union + { + fie fie; + fum fum; + }; +} NestedUnion; +---- + +=== Arrays + +Instead of expanding arrays inline within childrenERDs, +we may want to store a single entry +for an array in childrenERDs +giving the array's offset and size of all its elements. +We would have to write code +for special case treatment of array member fields +versus scalar member fields +but we could save space/memory in childrenERDs Review Comment: I can't really comment on whether array ERDs help with that. I just think that for this runtime we really do need to make the implementation of arrays very efficient. -- 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]
