org.mozilla.javascript.tools.shell
Class Main

java.lang.Object
  extended by org.mozilla.javascript.tools.shell.Main

public class Main
extends java.lang.Object

The shell program. Can execute scripts interactively or in batch mode at the command line. An example of controlling the JavaScript engine.

Author:
Norris Boyd

Field Summary
protected static ToolErrorReporter errorReporter
           
protected static int exitCode
           
static Global global
           
static ShellContextFactory shellContextFactory
           
 
Constructor Summary
Main()
           
 
Method Summary
static java.lang.Object evaluateScript(net.sourceforge.htmlunit.corejs.javascript.Script script, net.sourceforge.htmlunit.corejs.javascript.Context cx, net.sourceforge.htmlunit.corejs.javascript.Scriptable scope)
           
static int exec(java.lang.String[] origArgs)
          Execute the given arguments, but don't System.exit at the end.
static java.io.PrintStream getErr()
           
static Global getGlobal()
           
static java.io.InputStream getIn()
           
static java.io.PrintStream getOut()
           
static net.sourceforge.htmlunit.corejs.javascript.Script loadScriptFromSource(net.sourceforge.htmlunit.corejs.javascript.Context cx, java.lang.String scriptSource, java.lang.String path, int lineno, java.lang.Object securityDomain)
           
static void main(java.lang.String[] args)
          Main entry point.
static void processFile(net.sourceforge.htmlunit.corejs.javascript.Context cx, net.sourceforge.htmlunit.corejs.javascript.Scriptable scope, java.lang.String filename)
           
static java.lang.String[] processOptions(java.lang.String[] args)
          Parse arguments.
static void processSource(net.sourceforge.htmlunit.corejs.javascript.Context cx, java.lang.String filename)
          Evaluate JavaScript source.
static void setErr(java.io.PrintStream err)
           
static void setIn(java.io.InputStream in)
           
static void setOut(java.io.PrintStream out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

shellContextFactory

public static ShellContextFactory shellContextFactory

global

public static Global global

errorReporter

protected static ToolErrorReporter errorReporter

exitCode

protected static int exitCode
Constructor Detail

Main

public Main()
Method Detail

main

public static void main(java.lang.String[] args)
Main entry point. Process arguments as would a normal Java program. Also create a new Context and associate it with the current thread. Then set up the execution environment and begin to execute scripts.


exec

public static int exec(java.lang.String[] origArgs)
Execute the given arguments, but don't System.exit at the end.


getGlobal

public static Global getGlobal()

processOptions

public static java.lang.String[] processOptions(java.lang.String[] args)
Parse arguments.


processSource

public static void processSource(net.sourceforge.htmlunit.corejs.javascript.Context cx,
                                 java.lang.String filename)
Evaluate JavaScript source.

Parameters:
cx - the current context
filename - the name of the file to compile, or null for interactive mode.

processFile

public static void processFile(net.sourceforge.htmlunit.corejs.javascript.Context cx,
                               net.sourceforge.htmlunit.corejs.javascript.Scriptable scope,
                               java.lang.String filename)

loadScriptFromSource

public static net.sourceforge.htmlunit.corejs.javascript.Script loadScriptFromSource(net.sourceforge.htmlunit.corejs.javascript.Context cx,
                                                                                     java.lang.String scriptSource,
                                                                                     java.lang.String path,
                                                                                     int lineno,
                                                                                     java.lang.Object securityDomain)

evaluateScript

public static java.lang.Object evaluateScript(net.sourceforge.htmlunit.corejs.javascript.Script script,
                                              net.sourceforge.htmlunit.corejs.javascript.Context cx,
                                              net.sourceforge.htmlunit.corejs.javascript.Scriptable scope)

getIn

public static java.io.InputStream getIn()

setIn

public static void setIn(java.io.InputStream in)

getOut

public static java.io.PrintStream getOut()

setOut

public static void setOut(java.io.PrintStream out)

getErr

public static java.io.PrintStream getErr()

setErr

public static void setErr(java.io.PrintStream err)


Copyright © 2010. All Rights Reserved.