Context
Context represents an internal state in Pnuts runtime environment. A Context
object contains the following information.
- stack frame
- Which Pnuts-package being used
- Imported Java-package list
- OutputStream to which print() write data
- OutputStream to which error() write message
A pnuts.lang.Context object represents a context. See "Pnuts API Overview" for details.
getContext() refers to the currently executing context, which is created
when an interactive session starts or load() or loadFile() is
called. All other executions refer to the current context.
- eval(expression)
- eval(expression, package)
- eval(expression, context)
|
eval() can have a context as a parameter.
Where user message is shown
For each context the following can be specified.
- Standard Output
- Error Output
- Where Result of evaluation is printed
- context . getOutputStream ()
- context . setOutputStream (anOutputStream
or aWriter)
- context . getErrorStream ()
- context . setErrorStream (anOutputStream
or aWriter)
- context . getTerminalStream ()
- context . setTerminalStream
(anOutputStream or aWriter)
|