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.
-
applet
- If Pnuts starts in applet this variable should be set.
-
prompt
- "prompt" string for the command shell
-
eval(InputStream)
- evaluate data from InputStream "in" in the global package
-
eval(InputStream, String)
- evaluate data from InputStream "in" in a package "pkg"
-
eval(String)
- evaluate "str" in the global package
-
eval(String, Context)
- evaluate "str" in "context"
-
eval(String, String)
- evaluate "str" in package "pkg"
-
evalDepth()
- returns the depth of evaluations
-
format(Object)
- returns a formatted string for obj
-
get(String)
-
-
get(String, String)
-
-
getClassLoader()
- get ClassLoader for class access
-
load(InputStream)
- load a script from InputStream "in"
-
load(InputStream, boolean, Context)
- Load a script from an InputStream in the specified Context.
-
load(InputStream, Context)
- load a script from InputStream "in" in "context"
-
load(String)
- load a script "file"
-
load(String, Context)
- load a script "file" in "context"
-
loadFile(String)
- load a local script "file"
-
loadFile(String, Context)
- load a local script "file" in "context"
-
main(String[])
- starts the command shell interpreter
-
registerQuantityFactory(String, QuantityFactory)
-
-
require(String)
- load a script "file" only when the script has not been read.
-
set(String, Object)
- set a value "val" to a global variable "str"
-
set(String, Object, String)
- set a value "val" to a variable "str" in package "pkg"
-
setClassLoader(ClassLoader)
- set ClassLoader for class access
-
setLoadPath(Object[])
- set a search path for scripts as an object array
Elements of the array should one of the followings.
-
setLoadPath(String)
- set a search path for scripts as a colon-separated String
This method remains for compatibility reason.
-
setPrompt(String)
- set a "prompt" string for the command shell
applet
public static Applet applet
- If Pnuts starts in applet this variable should be set.
prompt
public static String prompt
- "prompt" string for the command shell
registerQuantityFactory
public static void registerQuantityFactory(String unit,
QuantityFactory factory)
setClassLoader
public static void setClassLoader(ClassLoader loader)
- set ClassLoader for class access
- Parameters:
- loader - the ClassLoader with which classes are accessed
getClassLoader
public static ClassLoader getClassLoader()
- get ClassLoader for class access
setPrompt
public static void setPrompt(String str)
- set a "prompt" string for the command shell
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
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.
format
public static String format(Object obj)
- returns a formatted string for obj
get
public static Object get(String str)
get
public static Object get(String str,
String pkg)
set
public static void set(String str,
Object val)
- set a value "val" to a global variable "str"
set
public static void set(String str,
Object val,
String pkg)
- set a value "val" to a variable "str" in package "pkg"
eval
public static Object eval(String str,
String pkg)
- evaluate "str" in package "pkg"
eval
public static Object eval(String str)
- evaluate "str" in the global package
eval
public static Object eval(InputStream in)
- evaluate data from InputStream "in" in the global package
eval
public static Object eval(InputStream in,
String pkg)
- evaluate data from InputStream "in" in a package "pkg"
eval
public static Object eval(String str,
Context context)
- evaluate "str" in "context"
evalDepth
public static int evalDepth()
- returns the depth of evaluations
loadFile
public static Object loadFile(String file) throws FileNotFoundException
- load a local script "file"
loadFile
public static Object loadFile(String file,
Context context) throws FileNotFoundException
- load a local script "file" in "context"
load
public static Object load(String file) throws FileNotFoundException
- load a script "file"
load
public static Object load(String file,
Context context) throws FileNotFoundException
- load a script "file" in "context"
load
public static Object load(InputStream in)
- load a script from InputStream "in"
load
public static Object load(InputStream in,
Context context)
- load a script from InputStream "in" in "context"
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
require
public static synchronized void require(String file) throws FileNotFoundException
- load a script "file" only when the script has not been read.
main
public static void main(String args[])
- starts the command shell interpreter
All Packages Class Hierarchy This Package Previous Next Index