org.millscript.millscript.vm
Class TraceableMachine

java.lang.Object
  extended by org.millscript.millscript.vm.TraceableMachine
Direct Known Subclasses:
BasicMachine

public abstract class TraceableMachine
extends java.lang.Object

This class provides the basis for a traceable machine. This class provides the skeletal implementation for a function call trace, similar to a Java stack trace.


Field Summary
protected  int doingIndex
          The index of the next value in the doing stack.
 
Constructor Summary
TraceableMachine()
           
 
Method Summary
 org.millscript.commons.util.IList doingList()
          Returns a list of function applications, in reverse order.
 void enterFunction(java.lang.Object x)
          Called when entering a function, this adds the specified object to the function call stack.
 void enterUpdater(java.lang.Object x)
          Called when entering a function updater.
 void exitFunction(java.lang.Object x)
          Called when exiting a function, this removes the last object from the function call stack.
 void exitUpdater(java.lang.Object x)
          Called when exiting a function updater.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

doingIndex

protected int doingIndex
The index of the next value in the doing stack. Note this is also the number of values in the doing stack.

Constructor Detail

TraceableMachine

public TraceableMachine()
Method Detail

doingList

public org.millscript.commons.util.IList doingList()
Returns a list of function applications, in reverse order. This has to be returned in reverse order, so that the last item we were doing is reported first in the trace.

Returns:
a list containing the current function call stack, in reverse order.

enterFunction

public void enterFunction(java.lang.Object x)
Called when entering a function, this adds the specified object to the function call stack. To keep the call stack consistent, calls to this method should be paired with a call to exitFunction(java.lang.Object).

Parameters:
x - the object to be added to the function call stack, specifically the function being entered

exitFunction

public void exitFunction(java.lang.Object x)
Called when exiting a function, this removes the last object from the function call stack. To keep the call stack consistent, calls to this method should be paired with a call to enterFunction(java.lang.Object).

Parameters:
x - the object to be removed from the function call stack, specifically the function being exited.

enterUpdater

public void enterUpdater(java.lang.Object x)
Called when entering a function updater.

Parameters:
x - the object to be entered, e.g. the function whose updater is being entered.

exitUpdater

public void exitUpdater(java.lang.Object x)
Called when exiting a function updater.

Parameters:
x - the object to be exited, e.g. the function whose updater is being exited.


Copyright © 2001-2007 Open World Ltd. All Rights Reserved.