|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsleep.runtime.ScriptInstance
public class ScriptInstance
Every piece of information related to a loaded script. This includes the scripts runtime environment, code in compiled form, variable information, and listeners for runtime issues.
Nested Class Summary | |
---|---|
static class |
ScriptInstance.ProfilerStatistic
A container for a profile statistic about a sleep function |
static class |
ScriptInstance.SleepStackElement
A container for Sleep strack trace elements. |
Field Summary | |
---|---|
protected int |
debug
track all of the flagged debug options for this script (set to DEBUG_SHOW_ERRORS by default) |
static int |
DEBUG_NONE
debug should be absolutely quiet, never fire any runtime warnings |
static int |
DEBUG_REQUIRE_STRICT
fire runtime warning whenever an undeclared variable is fired |
static int |
DEBUG_SHOW_ERRORS
fire runtime warnings for all critical flow interrupting errors |
static int |
DEBUG_SHOW_WARNINGS
fire runtime warnings for anything flagged for retrieval with checkError() |
static int |
DEBUG_THROW_WARNINGS
throw exceptions for anything flagged for retrieval with checkError() |
static int |
DEBUG_TRACE_CALLS
fire a runtime warning describing each function call |
static int |
DEBUG_TRACE_LOGIC
fire a runtime warning describing each predicate decision made |
static int |
DEBUG_TRACE_PROFILE_ONLY
forces function call tracing to occur (for the sake of profiling a script) but supresses all runtime warnings as a result of the tracing |
protected static int |
DEBUG_TRACE_SUPPRESS
users shouldn't need to flag this, it is just a general method of saying we're suppressing trace messages... |
protected ScriptEnvironment |
environment
The script environment which contains all of the runtime info for a script |
protected boolean |
loaded
true by default, indicates wether or not the script is loaded. |
protected java.lang.String |
name
the name of this script |
protected IOObject |
parent
|
protected Block |
script
The compiled sleep code for this script, the ScriptLoader will set this value upon loading a script. |
protected ScriptVariables |
variables
The script variables which contains all of the variable information for a script |
protected java.util.LinkedList |
watchers
A list of listeners watching for a runtime error |
Constructor Summary | |
---|---|
ScriptInstance()
Constructs a new script instance |
|
ScriptInstance(java.util.Hashtable environmentToShare)
Constructs a script instance, if the parameter is null a default implementation will be used. |
|
ScriptInstance(Variable varContainerToUse,
java.util.Hashtable environmentToShare)
Constructs a script instance, if either of the parameters are null a default implementation will be used. |
Method Summary | |
---|---|
void |
addWarningWatcher(RuntimeWarningWatcher w)
Register a runtime warning watcher listener. |
Scalar |
callFunction(java.lang.String funcName,
java.util.Stack parameters)
Calls a subroutine/built-in function using this script. |
void |
clearStackTrace()
Removes the top element of the stack trace |
void |
collect(java.lang.String function,
int lineNo,
long ticks)
this function is used internally by the sleep interpreter to collect profiler statistics when DEBUG_TRACE_CALLS or DEBUG_TRACE_PROFILE_ONLY is enabled |
void |
fireWarning(java.lang.String message,
int line)
Fire a runtime script warning |
void |
fireWarning(java.lang.String message,
int line,
boolean isTrace)
Fire a runtime script warning |
ScriptInstance |
fork()
Creates a forked script instance. |
int |
getDebugFlags()
retrieve the debug flags for this script |
java.lang.String |
getName()
Returns the name of this script (typically a full pathname) as a String |
java.util.List |
getProfilerStatistics()
Returns a sorted (in order of total ticks used) list of function call statistics for this script environment. |
Block |
getRunnableBlock()
Returns the compiled form of this script |
ScriptEnvironment |
getScriptEnvironment()
Returns this scripts runtime environment |
ScriptVariables |
getScriptVariables()
Returns the variable container used by this script |
java.util.List |
getStackTrace()
Returns the last stack trace. |
void |
installBlock(Block _script)
Install a block as the compiled script code |
boolean |
isLoaded()
Returns wether or not this script is loaded. |
boolean |
isProfileOnly()
a quick way to check if we are profiling and not tracing the script steps |
void |
printProfileStatistics(java.io.OutputStream out)
Dumps the profiler statistics to the specified stream |
void |
recordStackFrame(java.lang.String description,
int lineNumber)
Records a stack frame into this environments stack trace tracker thingie. |
void |
recordStackFrame(java.lang.String description,
java.lang.String source,
int lineNumber)
Records a stack frame into this environments stack trace tracker thingie. |
void |
removeWarningWatcher(RuntimeWarningWatcher w)
Removes a runtime warning watcher listener |
void |
run()
Executes this script, same as runScript() just here for Runnable compatability |
Scalar |
runScript()
Executes this script, should be done first thing once a script is loaded |
void |
setDebugFlags(int options)
set the debug flags for this script |
void |
setName(java.lang.String sn)
Sets the name of this script |
void |
setParent(IOObject p)
Sets up the parent of this script (in case it is being run via &fork()). |
void |
setScriptVariables(ScriptVariables v)
Sets the variable container to be used by this script |
void |
setUnloaded()
Flag this script as unloaded |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String name
protected boolean loaded
protected java.util.LinkedList watchers
protected ScriptEnvironment environment
protected ScriptVariables variables
protected Block script
public static final int DEBUG_NONE
public static final int DEBUG_SHOW_ERRORS
public static final int DEBUG_SHOW_WARNINGS
public static final int DEBUG_REQUIRE_STRICT
public static final int DEBUG_TRACE_CALLS
public static final int DEBUG_TRACE_PROFILE_ONLY
protected static final int DEBUG_TRACE_SUPPRESS
public static final int DEBUG_THROW_WARNINGS
public static final int DEBUG_TRACE_LOGIC
protected int debug
protected IOObject parent
Constructor Detail |
---|
public ScriptInstance(java.util.Hashtable environmentToShare)
public ScriptInstance(Variable varContainerToUse, java.util.Hashtable environmentToShare)
public ScriptInstance()
Method Detail |
---|
public void setDebugFlags(int options)
public int getDebugFlags()
public void installBlock(Block _script)
public ScriptEnvironment getScriptEnvironment()
public void setScriptVariables(ScriptVariables v)
public ScriptVariables getScriptVariables()
public java.lang.String getName()
public void setName(java.lang.String sn)
public Scalar runScript()
public void recordStackFrame(java.lang.String description, java.lang.String source, int lineNumber)
public void recordStackFrame(java.lang.String description, int lineNumber)
public void clearStackTrace()
public java.util.List getStackTrace()
public void collect(java.lang.String function, int lineNo, long ticks)
public boolean isProfileOnly()
public java.util.List getProfilerStatistics()
public void printProfileStatistics(java.io.OutputStream out)
public ScriptInstance fork()
public void run()
run
in interface java.lang.Runnable
public void setParent(IOObject p)
public Block getRunnableBlock()
public Scalar callFunction(java.lang.String funcName, java.util.Stack parameters)
public void setUnloaded()
public boolean isLoaded()
public void addWarningWatcher(RuntimeWarningWatcher w)
public void removeWarningWatcher(RuntimeWarningWatcher w)
public void fireWarning(java.lang.String message, int line)
public void fireWarning(java.lang.String message, int line, boolean isTrace)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |