|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--pnuts.lang.Context
Context represents an internal state in Pnuts runtime environment. A Context object contains the following information.
Field Summary | |
protected int |
beginLine
|
static java.io.PrintWriter |
defaultErrorStream
|
static java.io.PrintWriter |
defaultOutputStream
|
static java.io.PrintWriter |
defaultTerminalStream
|
protected int |
depth
|
protected int |
endLine
|
protected pnuts.lang.ImportEnv |
importEnv
|
protected pnuts.lang.Stack |
loadingResource
|
Constructor Summary | |
Context()
Create a new context |
|
Context(Package pkg)
Creates a context. |
|
Context(java.lang.String pkg)
Creates a context. |
Method Summary | |
java.lang.Object |
clone()
Make a clone of the context |
java.lang.Object |
clone(boolean clear)
Make a clone of the context |
protected void |
close()
|
boolean |
defined(java.lang.String name)
|
java.lang.Object |
get(java.lang.String key)
Get an environemnt variable associated with this context |
Package |
getCurrentPackage()
get the current package |
java.io.PrintWriter |
getErrorStream()
Get an OutputStream or a Writer to which error() write message |
java.lang.Object |
getId(java.lang.String symbol)
|
java.lang.String |
getName()
Gets the name of the context |
java.io.PrintWriter |
getOutputStream()
get output stream of the context |
PnutsImpl |
getPnutsImpl()
Gets the PnutsImpl object associated with this context |
protected java.lang.Object |
getScriptSource()
Get the source of the script. |
java.io.PrintWriter |
getTerminalStream()
get terminal-output-stream of the context |
java.util.Enumeration |
keys()
Returns an enumeration of the keys in the environment of this context. |
protected void |
onError(java.lang.Throwable t)
This method is called when an exception is thrown. |
protected void |
onExit(java.lang.Object arg)
This method is called when the excecution is terminated normally. |
protected void |
open(java.lang.String[] locals)
|
void |
set(java.lang.String key,
java.lang.Object value)
Define an environemnt variable associated with this context |
void |
setCurrentPackage(Package pkg)
set the current package |
void |
setErrorStream(java.lang.Object errorStream)
set an OutputStream or a Writer to which error() write message If errorStream is null, exception is thrown out of eval loop. |
void |
setErrorStream(java.lang.Object errorStream,
boolean autoFlush)
Set an OutputStream or a Writer to which error() write message If errorStream is null, exception is thrown out of eval loop. |
void |
setName(java.lang.String name)
Sets the name of the context |
void |
setOutputStream(java.lang.Object outputStream)
|
void |
setOutputStream(java.lang.Object out,
boolean autoFlush)
set output stream of the context |
void |
setPnutsImpl(PnutsImpl impl)
Changes the PnutsImpl object associated with this context |
void |
setTerminalStream(java.lang.Object stream)
|
void |
setTerminalStream(java.lang.Object str,
boolean autoFlush)
set terminal-output-stream of the context |
protected void |
setValue(java.lang.String symbol,
java.lang.Object obj)
|
protected java.lang.Object |
undefinedHook(java.lang.String symbol)
|
protected void |
updateLine(SimpleNode node)
|
protected void |
updateLine(SimpleNode node,
int beginLine,
int endLine)
|
java.lang.String[] |
usedPackages()
Returns the list of use()'d packages |
void |
usePackage(java.lang.String name)
Add a package to the use()'d package list. |
Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final java.io.PrintWriter defaultOutputStream
public static final java.io.PrintWriter defaultTerminalStream
public static final java.io.PrintWriter defaultErrorStream
protected int depth
protected pnuts.lang.Stack loadingResource
protected int beginLine
protected int endLine
protected pnuts.lang.ImportEnv importEnv
Constructor Detail |
public Context()
public Context(java.lang.String pkg)
pkg
- the name of the package.public Context(Package pkg)
pkg
- the initial package of the context.Method Detail |
public java.lang.Object clone()
public java.lang.Object clone(boolean clear)
clear
- If true, import() state and current package are reset
to the default values.public void setName(java.lang.String name)
public java.lang.String getName()
public void setPnutsImpl(PnutsImpl impl)
public PnutsImpl getPnutsImpl()
public java.lang.Object get(java.lang.String key)
key
- the name of the variablepublic void set(java.lang.String key, java.lang.Object value)
key
- the name of the variablevalue
- the value of the variablepublic java.util.Enumeration keys()
public void setOutputStream(java.lang.Object out, boolean autoFlush)
public void setOutputStream(java.lang.Object outputStream)
public java.io.PrintWriter getOutputStream()
public void setTerminalStream(java.lang.Object str, boolean autoFlush)
public void setTerminalStream(java.lang.Object stream)
public java.io.PrintWriter getTerminalStream()
public void setErrorStream(java.lang.Object errorStream, boolean autoFlush)
public void setErrorStream(java.lang.Object errorStream)
public java.io.PrintWriter getErrorStream()
public Package getCurrentPackage()
public void setCurrentPackage(Package pkg)
public java.lang.String[] usedPackages()
public void usePackage(java.lang.String name)
name
- the package nameprotected java.lang.Object getScriptSource()
java.net.URL object, when the script is not precompiled pnuts.lang.Runtime object, when the script is precompiled
protected void updateLine(SimpleNode node)
protected void updateLine(SimpleNode node, int beginLine, int endLine)
protected void onExit(java.lang.Object arg)
protected void onError(java.lang.Throwable t)
public java.lang.Object getId(java.lang.String symbol)
protected java.lang.Object undefinedHook(java.lang.String symbol)
public boolean defined(java.lang.String name)
protected void open(java.lang.String[] locals)
protected void close()
protected void setValue(java.lang.String symbol, java.lang.Object obj)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |