tuxji opened a new pull request #532: URL: https://github.com/apache/daffodil/pull/532
Add a new runtime2 backend to Daffodil with a C code generator and libcli/libruntime libraries. The C code generator implements a small but still functional subset of DFDL 1.0 for binary data: - binary boolean, integer, and real numbers - arrays of simple and complex elements - choice groups using dispatch/branch keys - validation of "fixed" attributes - padding of explicit length complex elements with fill bytes Also add a new CLI subcommand "daffodil generate" to call the code generator and modify the CLI subcommand "daffodil test" to support running TDML tests with daffodil-runtime2. We are documenting reviewer requested changes in [Runtime2 ToDos](https://daffodil.apache.org/dev/design-notes/runtime2-todos/). We plan to address these changes while continuing to build out the C code generator to implement more of the "Runtime 2 Design" table in <https://cwiki.apache.org/confluence/display/DAFFODIL/WIP%3A+Daffodil+Runtime+2>. Build requirements and instructions are in the top-level README.md and BUILD.md files. DAFFODIL-2202 ______________________________________________________________________ Changelog for selected files: main.yml - Use msys2 shell on windows, install runtime2 build requirements, use explicit versions for actions and oses. sonarclound.yml - Install runtime2 build requirements, use explicit versions for actions and oses. README.md - Fix or disable markdownlint warnings, wrap paragraphs, add runtime2 build requirements, sort hyperlink tags alphabetically. build.sbt - Add runtime2 project, allow environment variables CC and AR to override cCompiler and ccArchiveCommand's default settings, ensure C compiler test-builds C files by doing a recursive glob on "c" and "examples", make tdmlProc and cli depend on runtime2 because they call it, and add runtime2 to daffodil-test's test classpath. bin.LICENSE - Add os-lib license. Main.scala - Add generate subcommand option. Compiler.scala - Make ProcessorFactory.forLanguage call runtime2 using Class.forName to avoid core dependency on runtime2. ElementBase.scala, ElementDeclMixin.scala, ElementRef.scala - Add DSOM getters for fixedAttr, hasFixedValue, fixedValueAsString & fixedValue, make IDEA recommended fixes. ElementBaseGrammarMixin.scala - Make IDEA recommended fixes. ElementDeclGrammarMixin.scala - Give Runtime2CodeGenerator access to RootGrammarMixin.documentElement. Grammar.scala - Give Runtime2CodeGenerator access to BinaryGram.children. GrammarTerm.scala - Allow subclasses to override Gram.context and change its type from SchemaComponent to ElementBase. Production.scala - Give Runtime2CodeGenerator access to Prod.guard. ElementCombinator.scala - Give Runtime2CodeGenerator access to ElementParseAndUnspecifiedLength.{context, eBeforeContext, eValue, eAfterValue, repTypeElementGram, subComb}, make IDEA recommended fixes. PrimitivesBinaryNumber.scala - Give Runtime2CodeGenerator access to BinaryIntegerKnownLength.{signed, lengthInBits}. SequenceCombinator.scala - Give Runtime2CodeGenerator access to OrderedSequence.sequenceChildren, make IDEA recommended fixes. tdml.xsd - Add daffodil-runtime2 to tdml:{defaultImplementations, implementations}. dafext.xsd - Add tdmlImplementation to tunables. DFDLParserUnparser.scala - Add ProcessorFactory.forLanguage, trait CodeGenerator, split half of DataProcessor into DataProcessorBase. DataProcessor.scala - Minor cleanups. TDMLRunner.scala - Create TDMLDFDLProcessorFactory or Runtime2TDMLDFDLProcessorFactory object depending on tdmlImplementation tunable and call cleanUp on parse/unparse results. TDMLDFDLProcessor.scala - Add TDMLResult.cleanUp abstract function. DaffodilTDMLDFDLProcessor.scala - Implement DaffodilTDMLParseResult.cleanUp and DaffodilTDMLUnparseResult.cleanUp. Runtime2TDMLDFDLProcessor.scala - Run TDML tests on runtime2 backend. Use cleanUp to remove all temporary files. choice-unparse2.tdml - Change model name from "c" to "c1" to avoid conflict with daffodil-runtime2's "c" resources directory. Dependencies.scala - Add os-lib dependency for writing C files. Rat.scala - Ignore runtime2 tests' binary data files. plugins.sbt - Add sbt-cc plugin so sbt can test-build C files. sonar-project.properties - Make scan ignore C files since SonarCloud CLI Docker action can't analyze them anyway. Also prevent some scan warnings. -- 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. For queries about this service, please contact Infrastructure at: [email protected]
