All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class pnuts.lang.Pnuts

pnuts.lang.Pnuts

public class Pnuts
"Manager" class for Pnuts interpreter.
"pnuts" command starts from main method of this class.
Annotated reference manual is here.


Variable Index

 o applet
If Pnuts starts in applet this variable should be set.
 o prompt
"prompt" string for the command shell

Method Index

 o eval(InputStream)
evaluate data from InputStream "in" in the global package
 o eval(InputStream, String)
evaluate data from InputStream "in" in a package "pkg"
 o eval(String)
evaluate "str" in the global package
 o eval(String, Context)
evaluate "str" in "context"
 o eval(String, String)
evaluate "str" in package "pkg"
 o evalDepth()
returns the depth of evaluations
 o format(Object)
returns a formatted string for obj
 o get(String)
 o get(String, String)
 o getClassLoader()
get ClassLoader for class access
 o load(InputStream)
load a script from InputStream "in"
 o load(InputStream, boolean, Context)
Load a script from an InputStream in the specified Context.
 o load(InputStream, Context)
load a script from InputStream "in" in "context"
 o load(String)
load a script "file"
 o load(String, Context)
load a script "file" in "context"
 o loadFile(String)
load a local script "file"
 o loadFile(String, Context)
load a local script "file" in "context"
 o main(String[])
starts the command shell interpreter
 o registerQuantityFactory(String, QuantityFactory)
 o require(String)
load a script "file" only when the script has not been read.
 o set(String, Object)
set a value "val" to a global variable "str"
 o set(String, Object, String)
set a value "val" to a variable "str" in package "pkg"
 o setClassLoader(ClassLoader)
set ClassLoader for class access
 o setLoadPath(Object[])
set a search path for scripts as an object array Elements of the array should one of the followings.
 o setLoadPath(String)
set a search path for scripts as a colon-separated String This method remains for compatibility reason.
 o setPrompt(String)
set a "prompt" string for the command shell

Variables

 o applet
 public static Applet applet
If Pnuts starts in applet this variable should be set.

 o prompt
 public static String prompt
"prompt" string for the command shell

Methods

 o registerQuantityFactory
 public static void registerQuantityFactory(String unit,
                                            QuantityFactory factory)
 o setClassLoader
 public static void setClassLoader(ClassLoader loader)
set ClassLoader for class access

Parameters:
loader - the ClassLoader with which classes are accessed
 o getClassLoader
 public static ClassLoader getClassLoader()
get ClassLoader for class access

 o setPrompt
 public static void setPrompt(String str)
set a "prompt" string for the command shell

 o setLoadPath
 public static void setLoadPath(Object paths[])
set a search path for scripts as an object array Elements of the array should one of the followings. String: base name of resource URL: base name of URL File: base directory

 o setLoadPath
 public static void setLoadPath(String path)
set a search path for scripts as a colon-separated String This method remains for compatibility reason. It will be deleted in the future.

 o format
 public static String format(Object obj)
returns a formatted string for obj

 o get
 public static Object get(String str)
 o get
 public static Object get(String str,
                          String pkg)
 o set
 public static void set(String str,
                        Object val)
set a value "val" to a global variable "str"

 o set
 public static void set(String str,
                        Object val,
                        String pkg)
set a value "val" to a variable "str" in package "pkg"

 o eval
 public static Object eval(String str,
                           String pkg)
evaluate "str" in package "pkg"

 o eval
 public static Object eval(String str)
evaluate "str" in the global package

 o eval
 public static Object eval(InputStream in)
evaluate data from InputStream "in" in the global package

 o eval
 public static Object eval(InputStream in,
                           String pkg)
evaluate data from InputStream "in" in a package "pkg"

 o eval
 public static Object eval(String str,
                           Context context)
evaluate "str" in "context"

 o evalDepth
 public static int evalDepth()
returns the depth of evaluations

 o loadFile
 public static Object loadFile(String file) throws FileNotFoundException
load a local script "file"

 o loadFile
 public static Object loadFile(String file,
                               Context context) throws FileNotFoundException
load a local script "file" in "context"

 o load
 public static Object load(String file) throws FileNotFoundException
load a script "file"

 o load
 public static Object load(String file,
                           Context context) throws FileNotFoundException
load a script "file" in "context"

 o load
 public static Object load(InputStream in)
load a script from InputStream "in"

 o load
 public static Object load(InputStream in,
                           Context context)
load a script from InputStream "in" in "context"

 o load
 public static Object load(InputStream in,
                           boolean interactive,
                           Context context)
Load a script from an InputStream in the specified Context.

Parameters:
in - an InputStream from which the interpreter reads an input
interactive -
  • When "interactive" is true, the greeting message, the prompt, and the results of evaluations are displayed. When an exception is thrown and not caught by any exception handler, it is caught at the top level of the interpreter, display an error message, and resume the interactive session. If the exception is caught by a handler that is registered at the top level, the result of the handler becomes the return value of the last expression.
  • When "interactive" is false, exceptions are caught at the top level of the interpreter and exits this function. If the exception thrown is caught by a handler that is registered at the top level, the result of the handler becomes the return value of this method.
context - a Context in which the interpretation is taken place.
Returns:
the result of the last expression
 o require
 public static synchronized void require(String file) throws FileNotFoundException
load a script "file" only when the script has not been read.

 o main
 public static void main(String args[])
starts the command shell interpreter


All Packages  Class Hierarchy  This Package  Previous  Next  Index