pnuts.lang
Class Context

java.lang.Object
  |
  +--pnuts.lang.Context
Direct Known Subclasses:
CompileContext, ManualContext

public class Context
extends java.lang.Object
implements java.lang.Cloneable

Context represents an internal state in Pnuts runtime environment. A Context object contains the following information.

Note that the name space is shared by all contexts.

See Also:
ManualContext

Field Summary
protected  int beginLine
           
static java.io.PrintWriter defaultErrorStream
           
static java.io.PrintWriter defaultOutputStream
           
static java.io.PrintWriter defaultTerminalStream
           
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 _getId(java.lang.String symbol)
           
 java.lang.Object clone()
          Make a clone of the context
 boolean defined(java.lang.String name)
           
protected  java.lang.Object get(java.lang.String symbol)
           
 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()
           
 java.io.PrintWriter getOutputStream()
          get output stream of the context
 java.io.PrintWriter getTerminalStream()
          get terminal-output-stream of the context
protected  void set(java.lang.String symbol, java.lang.Object obj)
           
 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)
           
 void setOutputStream(java.lang.Object outputStream)
           
 void setOutputStream(java.lang.Object out, boolean autoFlush)
          set output stream of the context
 void setTerminalStream(java.lang.Object stream)
           
 void setTerminalStream(java.lang.Object str, boolean autoFlush)
          set terminal-output-stream of the context
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultOutputStream

public static final java.io.PrintWriter defaultOutputStream

defaultTerminalStream

public static final java.io.PrintWriter defaultTerminalStream

defaultErrorStream

public static final java.io.PrintWriter defaultErrorStream

loadingResource

protected pnuts.lang.Stack loadingResource

beginLine

protected int beginLine

importEnv

protected pnuts.lang.ImportEnv importEnv
Constructor Detail

Context

public Context()
Create a new context

Context

public Context(java.lang.String pkg)
Creates a context.
Parameters:
pkg - the name of the package.

Context

public Context(Package pkg)
Creates a context.
Parameters:
pkg - the initial package of the context.
Method Detail

clone

public java.lang.Object clone()
Make a clone of the context
Overrides:
clone in class java.lang.Object

setName

public void setName(java.lang.String name)

getName

public java.lang.String getName()

setOutputStream

public void setOutputStream(java.lang.Object out,
                            boolean autoFlush)
set output stream of the context

setOutputStream

public void setOutputStream(java.lang.Object outputStream)

getOutputStream

public java.io.PrintWriter getOutputStream()
get output stream of the context

setTerminalStream

public void setTerminalStream(java.lang.Object str,
                              boolean autoFlush)
set terminal-output-stream of the context

setTerminalStream

public void setTerminalStream(java.lang.Object stream)

getTerminalStream

public java.io.PrintWriter getTerminalStream()
get terminal-output-stream of the context

setErrorStream

public 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.

setErrorStream

public 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.

getErrorStream

public java.io.PrintWriter getErrorStream()
Get an OutputStream or a Writer to which error() write message

getCurrentPackage

public Package getCurrentPackage()
get the current package

set

protected void set(java.lang.String symbol,
                   java.lang.Object obj)

get

protected java.lang.Object get(java.lang.String symbol)

defined

public boolean defined(java.lang.String name)

getId

public java.lang.Object getId(java.lang.String symbol)

_getId

public java.lang.Object _getId(java.lang.String symbol)