|
Tea Java Runtime API Version 3.1.0 |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
|
+--com.pdmfc.tea.runtime.SContext
|
+--com.pdmfc.tea.runtime.STeaRuntime
Represents a Tea interpreter.
Usage of this class is preferable to the direct manipulation of
SContext objects when running a Tea program.
| Constructor Summary | |
STeaRuntime()
Initializes this toplevel context. |
|
| Method Summary | |
void |
addFunction(java.lang.String functionName,
SObjFunction function)
|
void |
addModule(SModule pkg)
Initializes the package in this context. |
void |
addModule(java.lang.String className)
Initializes a package in this context. |
static SObjPair |
buildPathList(java.lang.String pathList)
Creates a Tea list of strings from the pathList
argument. |
void |
end()
Signals that this context is no longer to be used. |
void |
holdStop()
Signals this interpreter that it must wait for a call to the releaseStop() method before calling
stop() for all packages in the stop()
method. |
void |
releaseStop()
The complement to holdStop(). |
void |
setCliArgs(java.lang.String[] args,
int start,
int count)
Specifies the command line arguments that are passed to the Tea interpreter. |
void |
setImportDirs(java.lang.String dirList,
SCompiler compiler)
Sets the list of directories from where the import Tea
function will try to read files. |
void |
start()
Signals that this context will be used shortly after. |
void |
stop()
Signals that this context will not be used until a call to the start() method is made again. |
| Methods inherited from class com.pdmfc.tea.runtime.SContext |
clearAll, clone, getVar, getVarObject, isDefined, newChild, newVar, newVar, setVar |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public STeaRuntime()
throws STeaException
| Method Detail |
public void setCliArgs(java.lang.String[] args,
int start,
int count)
argv Tea
global variable. This Tea variable will contain a liS of strings
corresponding to the command line arguments.args - Contains the command line arguments.start - The index in args of the first string to be used
as command line argument.count - The number of elements int args that will be used
as command line arguments.
public void setImportDirs(java.lang.String dirList,
SCompiler compiler)
throws STeaException
import Tea
function will try to read files.
A Tea global variable named TEA_LIBRARY will be
created. This variable will contain a list of strings. Each string
element is the pathname of one of the directories represented by
dirLiS.
For each directory, a Tea script named init.tea
will be executed, if it exits.
This method must not be invoked between calls to
start() and stop. Internally
start() is is called just before executing the
init.tea scripts and stop() is called
just afterwards.
dirList - List of directories. Each directory is separated by
a path separator character.compiler - Tea compiler that will be used to compile the
init.tea scripts.com.pdmfc.tea.SException - Thrown if there were any
problems executing one of the init.tea scripts.public static SObjPair buildPathList(java.lang.String pathList)
pathList
argument.pathList - Represents a list of paths.
public final void addFunction(java.lang.String functionName,
SObjFunction function)
public void addModule(SModule pkg)
throws STeaException
pkg - Reference to the SModule object to be
initialized.
public void addModule(java.lang.String className)
throws STeaException
className is instantiated. That class must be
derived from the SModule class. The newly created
SModule object is initialized inside this context.className - The name of the java class, derived from SModule, of
the object to be inSantiated.com.pdmfc.tea.SException - Thrown if there were any problems loading the class or inSantiating
the object.public void start()
public void stop()
start() method is made again. All the packages loaded
so far are signaled with a call to their stop()
method.
Before calling the packages' stop() method the
current thread waits until all necessary calls to
releaseStop() are performed. The calls to
releaseStop() must be as many as the ones to
holdStop. Note that as the current thread sleeps, the
calls to releaseStop() must be made from another
thread.
public void holdStop()
releaseStop() method before calling
stop() for all packages in the stop()
method. Note that for each call to this method there must be a
corresponding call to releaseStop() before the
stop() method exits.public void releaseStop()
holdStop().public void end()
|
Tea Java Runtime API Version 3.1.0 |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||