org.getopt.luke.plugins
Class Shell

java.lang.Object
  extended by org.mozilla.javascript.ScriptableObject
      extended by org.mozilla.javascript.IdScriptableObject
          extended by org.mozilla.javascript.ImporterTopLevel
              extended by org.getopt.luke.plugins.Shell
All Implemented Interfaces:
java.io.Serializable, org.mozilla.javascript.ConstProperties, org.mozilla.javascript.debug.DebuggableObject, org.mozilla.javascript.IdFunctionCall, org.mozilla.javascript.Scriptable

public class Shell
extends org.mozilla.javascript.ImporterTopLevel

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
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.mozilla.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
 
Fields inherited from interface org.mozilla.javascript.Scriptable
NOT_FOUND
 
Constructor Summary
Shell(java.io.PrintWriter stdout, java.io.PrintWriter stderr, java.io.InputStream stdin)
           
 
Method Summary
 void destroy()
           
 java.lang.String getClassName()
           
 org.mozilla.javascript.Context getContext()
           
 void help()
          Print a help message.
static void load(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, java.lang.Object[] args, org.mozilla.javascript.Function funObj)
          Load and execute a set of JavaScript source files.
static void print(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, java.lang.Object[] args, org.mozilla.javascript.Function funObj)
          Print the string values of its arguments.
 void processSource(org.mozilla.javascript.Context cx, java.io.File filename)
          Evaluate JavaScript source.
 void processSource(org.mozilla.javascript.Context cx, java.lang.String script)
           
 void prompt()
           
 void quit()
          Quit the shell.
static double version(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, java.lang.Object[] args, org.mozilla.javascript.Function funObj)
          Get and set the language version.
 
Methods inherited from class org.mozilla.javascript.ImporterTopLevel
execIdCall, findPrototypeId, get, has, importPackage, init, initPrototypeId, initStandardObjects
 
Methods inherited from class org.mozilla.javascript.IdScriptableObject
activatePrototypeMap, addIdFunctionProperty, defaultGet, defaultPut, delete, exportAsJSClass, fillConstructorProperties, findInstanceIdInfo, getAttributes, getInstanceIdName, getInstanceIdValue, getMaxInstanceId, hasPrototypeMap, incompatibleCallError, initPrototypeConstructor, initPrototypeMethod, initPrototypeValue, instanceIdInfo, put, setAttributes, setInstanceIdValue
 
Methods inherited from class org.mozilla.javascript.ScriptableObject
associateValue, avoidObjectDetection, callMethod, callMethod, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineProperty, defineProperty, defineProperty, defineProperty, delete, deleteProperty, deleteProperty, equivalentValues, get, getAllIds, getAssociatedValue, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, has, hasInstance, hasProperty, hasProperty, isConst, isGetterOrSetter, isSealed, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sealObject, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Shell

public Shell(java.io.PrintWriter stdout,
             java.io.PrintWriter stderr,
             java.io.InputStream stdin)
Method Detail

destroy

public void destroy()

getClassName

public java.lang.String getClassName()
Specified by:
getClassName in interface org.mozilla.javascript.Scriptable
Overrides:
getClassName in class org.mozilla.javascript.ImporterTopLevel

help

public void help()
Print a help message. This method is defined as a JavaScript function.


print

public static void print(org.mozilla.javascript.Context cx,
                         org.mozilla.javascript.Scriptable thisObj,
                         java.lang.Object[] args,
                         org.mozilla.javascript.Function funObj)
Print the string values of its arguments. This method is defined as a JavaScript function. Note that its arguments are of the "varargs" form, which allows it to handle an arbitrary number of arguments supplied to the JavaScript function.


quit

public void quit()
Quit the shell. This only affects the interactive mode. This method is defined as a JavaScript function.


version

public static double version(org.mozilla.javascript.Context cx,
                             org.mozilla.javascript.Scriptable thisObj,
                             java.lang.Object[] args,
                             org.mozilla.javascript.Function funObj)
Get and set the language version. This method is defined as a JavaScript function.


load

public static void load(org.mozilla.javascript.Context cx,
                        org.mozilla.javascript.Scriptable thisObj,
                        java.lang.Object[] args,
                        org.mozilla.javascript.Function funObj)
Load and execute a set of JavaScript source files. This method is defined as a JavaScript function.


prompt

public void prompt()

getContext

public org.mozilla.javascript.Context getContext()

processSource

public void processSource(org.mozilla.javascript.Context cx,
                          java.io.File filename)
Evaluate JavaScript source.

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

processSource

public void processSource(org.mozilla.javascript.Context cx,
                          java.lang.String script)