orc
Class Orc

java.lang.Object
  extended by orc.Orc

public class Orc
extends java.lang.Object

Main class for Orc. Parses Orc file and executes it.

Run with the argument "-help" to get a list of command-line options.

Author:
wcook, dkitchin

Constructor Summary
Orc()
           
 
Method Summary
static Node compile(Config cfg)
           
static Expression compile(java.io.Reader source, Config cfg)
           
static Node compile(java.io.Reader source, Node target, Config cfg)
           
static java.io.File createTmpdir(java.lang.String prefix)
          Create a new temporary directory and return the path to that directory.
static boolean deleteDirectory(java.io.File directory)
          Delete a directory recursively
static void main(java.lang.String[] args)
          Orc toplevel main function.
static java.io.Reader openInclude(java.lang.String name)
          Open an include file.
static OrcInstance runEmbedded(java.io.File source)
          Deprecated.  
static OrcInstance runEmbedded(java.io.Reader source)
          Deprecated.  
static OrcInstance runEmbedded(java.io.Reader source, Config cfg)
          Deprecated.  
static OrcInstance runEmbedded(java.lang.String source)
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Orc

public Orc()
Method Detail

main

public static void main(java.lang.String[] args)
Orc toplevel main function. Command line arguments are forwarded to Config for parsing.


openInclude

public static java.io.Reader openInclude(java.lang.String name)
                                  throws java.io.FileNotFoundException
Open an include file. Include files are actually stored as class resources, so that they will continue to work when Orc is deployed as a servlet or JAR, so you can't use any old filename. Specifically, the filename is always interpreted relatively to the orc.inc package, and you can't use "." or ".." in paths.

TODO: support relative names correctly.

Parameters:
name - of the include file relative to orc/inc (e.g. "prelude.inc")
Returns:
Reader to read the file.
Throws:
java.io.FileNotFoundException - if the resource is not found.

compile

public static Expression compile(java.io.Reader source,
                                 Config cfg)
                          throws java.io.IOException,
                                 CompilationException
Throws:
java.io.IOException
CompilationException

compile

public static Node compile(Config cfg)
                    throws CompilationException,
                           java.io.IOException
Throws:
CompilationException
java.io.IOException

compile

public static Node compile(java.io.Reader source,
                           Node target,
                           Config cfg)
                    throws CompilationException,
                           java.io.IOException
Throws:
CompilationException
java.io.IOException

runEmbedded

public static OrcInstance runEmbedded(java.lang.String source)
                               throws CompilationException,
                                      java.io.FileNotFoundException,
                                      java.io.IOException
Deprecated. 

Throws:
java.io.IOException
java.io.FileNotFoundException
CompilationException

runEmbedded

public static OrcInstance runEmbedded(java.io.File source)
                               throws CompilationException,
                                      java.io.FileNotFoundException,
                                      java.io.IOException
Deprecated. 

Throws:
java.io.IOException
java.io.FileNotFoundException
CompilationException

runEmbedded

public static OrcInstance runEmbedded(java.io.Reader source)
                               throws CompilationException,
                                      java.io.IOException
Deprecated. 

Throws:
java.io.IOException
CompilationException

runEmbedded

public static OrcInstance runEmbedded(java.io.Reader source,
                                      Config cfg)
                               throws CompilationException,
                                      java.io.IOException
Deprecated. 

Compile an Orc source program from the given input stream. Start a new Orc engine running this program in a separate thread. Returns an OrcInstance object with information about the running instance.

Parameters:
source -
cfg -
Throws:
java.io.IOException
CompilationException

createTmpdir

public static java.io.File createTmpdir(java.lang.String prefix)
                                 throws java.io.IOException
Create a new temporary directory and return the path to that directory. The directory will NOT be deleted automatically; you can use deleteDirectory to do that when you are done with it.

Throws:
java.io.IOException

deleteDirectory

public static boolean deleteDirectory(java.io.File directory)
Delete a directory recursively