mbeckerle commented on a change in pull request #422:
URL: https://github.com/apache/incubator-daffodil/pull/422#discussion_r498449005



##########
File path: 
daffodil-core/src/main/scala/org/apache/daffodil/runtime2/Runtime2DataProcessor.scala
##########
@@ -0,0 +1,211 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.daffodil.runtime2
+
+import java.io.File
+import java.io.InputStream
+import java.io.OutputStream
+
+import org.apache.daffodil.api.DFDL
+import org.apache.daffodil.api.DaffodilTunables
+import org.apache.daffodil.api.DataLocation
+import org.apache.daffodil.api.ValidationMode
+import org.apache.daffodil.externalvars.Binding
+import org.apache.daffodil.processors.Failure
+import org.apache.daffodil.processors.ProcessorResult
+import org.apache.daffodil.processors.Success
+import org.apache.daffodil.processors.VariableMap
+import org.apache.daffodil.processors.WithDiagnosticsImpl
+import org.apache.daffodil.processors.parsers.ParseError
+import org.apache.daffodil.processors.unparsers.UnparseError
+import org.apache.daffodil.util.Maybe
+import org.apache.daffodil.util.Maybe.Nope
+import os.Pipe
+
+/**
+ * Effectively a scala proxy object that does its work via the underlying 
C-code.
+ * Will need to consider how to use features of underlying C-code to get 
infoset,
+ * walk infoset, generate XML for use by TDML tests.
+ */
+class Runtime2DataProcessor(executableFile: os.Path) extends 
DFDL.DataProcessorBase {
+  /**
+   * Returns a data processor with all the same state, but the validation mode 
changed to that of the argument.
+   *
+   * Note that the default validation mode is "off", that is, no validation is 
performed.
+   */
+  override def withValidationMode(mode: ValidationMode.Type): 
DFDL.DataProcessor = ???
+
+  override def withTunable(name: String, value: String): DFDL.DataProcessor = 
???
+
+  override def withTunables(tunables: Map[String, String]): DFDL.DataProcessor 
= ???
+
+  override def withExternalVariables(extVars: Map[String, String]): 
DFDL.DataProcessor = ???
+
+  override def withExternalVariables(extVars: File): DFDL.DataProcessor = ???
+
+  override def withExternalVariables(extVars: Seq[Binding]): 
DFDL.DataProcessor = ???
+
+  override def validationMode: ValidationMode.Type = ???
+
+  override def getTunables(): DaffodilTunables = ???
+
+  override def save(output: DFDL.Output): Unit = ???
+
+  override def variableMap: VariableMap = ???
+
+  override def setValidationMode(mode: ValidationMode.Type): Unit = ???
+
+  override def setExternalVariables(extVars: Map[String, String]): Unit = ???
+
+  override def setExternalVariables(extVars: File): Unit = ???
+
+  override def setExternalVariables(extVars: File, tunable: DaffodilTunables): 
Unit = ???
+
+  override def setExternalVariables(extVars: Seq[Binding]): Unit = ???
+
+  override def setTunable(tunable: String, value: String): Unit = ???
+
+  override def setTunables(tunables: Map[String, String]): Unit = ???
+
+  /**
+   * Returns an object which contains the result, and/or diagnostic 
information.
+   */
+  def parse(input: InputStream): ParseResult = {

Review comment:
       Agree we need  to think this through.
   
   Some requirements: 
   * use an alternate back-end, but still run TDML tests against it 
interactively. (C-code generation, C-compiler, and invoking of it all 
transparent to the user.)
   
   That requirement is what motivates the runtime2 library having a walker that 
outputs XML and inputs XML, and a TDML processor that glues it all together. 
This motivates the creation of things like DataProcessor even though the 
concept makes little sense for runtime2, it allows reuse of more code in 
creating the test interface for TDML. 
   
   If you have that requirement, the same mechanisms can be used to provide the 
CLI with the same "snap compiling" capability so that you can have daffodil 
parse and daffodil unparse for the CLI that "work-alike" across the back-ends.  
   
   A separate requirement is to be able to generate a ".a" or ".so" C-callable 
library and matching ".h" include files that implements parse and unparse C 
APIs. The generated code would be one library distinct from the static code 
runtime2 library (which is likely to be quite large eventually).  Creating this 
generated library feels like what the CLI should do when using runtime 2 
backend and invoking the save parser option. 




----------------------------------------------------------------
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]


Reply via email to