rvl.swv
Interface EngineInterface

All Known Implementing Classes:
AbstractEngine, DOSEngine, GenStatEngine, LaTeXEngine, MapleEngine, REngine, SASEngine, SplusEngine, StataEngine, SWVEngine, UnixEngine

public interface EngineInterface

This interface specifies the methods needed to buffer code and run it in the desired program.

In most cases, the easiest way to implement this interface is to instead extend AbstractEngine, and overriding just a few of its methods.

If you do implement this interface directly, you need to have it call openCodeFile and setParent in the constructor.


Method Summary
 void closeCodeFile()
          Close the code file
 void closeFig()
          Put code to close the graphics file created by setupFig
 void deleteCodeFile()
          Delete the code file
 java.lang.String[] getFileNames()
          Return code and output file names
 boolean openCodeFile(java.lang.String baseName)
          Open a file for saving the code.
 void postProcess()
          Post-process the output file produced by runCode().
This could be useful if you need to do some cleaning-up operations to get the output file in suitable shape
 void putCode(java.lang.String line)
          Add a line of code to the code file
 void putComment(java.lang.String text)
          Put a comment line into the source code.
 void putExpr(java.lang.String expr)
          Evaluate an expression and put it in the output stream
 void putSeparator(java.lang.String text)
          Put code that will add the given text in a separate line of the engine's output.
 void putStartup(boolean weaving)
          Put startup code in the Code file.
 java.lang.Process runCode()
          Run the code, and return the its Process object.
 void setBinary(java.lang.String binloc)
          Set where to find the program to run on the code.
 void setParents(StatWeave parent, FileInterface filei)
          Set the parents that drive this instance
 FigFile setupFig(java.lang.String chunkName)
          Put code that will set up a file to receive figure output, and return its specs in a FigFile object
 

Method Detail

openCodeFile

boolean openCodeFile(java.lang.String baseName)
Open a file for saving the code. Return true if successful.


closeCodeFile

void closeCodeFile()
Close the code file


deleteCodeFile

void deleteCodeFile()
Delete the code file


getFileNames

java.lang.String[] getFileNames()
Return code and output file names


setParents

void setParents(StatWeave parent,
                FileInterface filei)
Set the parents that drive this instance


setBinary

void setBinary(java.lang.String binloc)
Set where to find the program to run on the code. (This need not be called if only tangling)


putCode

void putCode(java.lang.String line)
Add a line of code to the code file


putExpr

void putExpr(java.lang.String expr)
Evaluate an expression and put it in the output stream


putStartup

void putStartup(boolean weaving)
Put startup code in the Code file. Test weaving to discriminate between startup code for weaving and that for tangling.


putSeparator

void putSeparator(java.lang.String text)
Put code that will add the given text in a separate line of the engine's output. This is used by the parent to keep track of beginnings and ends of output chunks.


putComment

void putComment(java.lang.String text)
Put a comment line into the source code.


setupFig

FigFile setupFig(java.lang.String chunkName)
Put code that will set up a file to receive figure output, and return its specs in a FigFile object


closeFig

void closeFig()
Put code to close the graphics file created by setupFig


runCode

java.lang.Process runCode()
Run the code, and return the its Process object. (It is permissible to return null to have StatWeave skip over it.)


postProcess

void postProcess()
Post-process the output file produced by runCode().
This could be useful if you need to do some cleaning-up operations to get the output file in suitable shape