|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.millscript.millscript.vm.TraceableMachine
org.millscript.millscript.vm.BasicMachine
public abstract class BasicMachine
This class provides the skeletal implementation for a machine.
| Field Summary | |
|---|---|
protected java.lang.Object[] |
piggyBank
This is the equivalent of the call stack in a conventional implementation. |
protected java.lang.Object[] |
valueStack
This is an operand stack. |
| Fields inherited from class org.millscript.millscript.vm.TraceableMachine |
|---|
doingIndex |
| Constructor Summary | |
|---|---|
BasicMachine()
|
|
| Method Summary | |
|---|---|
int |
getCount()
Returns the number of objects in the stack. |
java.lang.Object |
getIndex(int n)
Returns the object at the specified position in the stack. |
java.lang.Object |
peekObject()
Returns the object at the top of the stack. |
void |
pokeObject(java.lang.Object x)
Replaces the object at the top of the stack with the specified object. |
java.lang.Object[] |
popArgsArray(int nargs)
Pops the specified number of values from the top of the value stack and returns them as an array. |
java.lang.Object[] |
popArgsIntoArray(java.lang.Object[] args)
Pops enough arguments off the stack to fill the supplied array. |
org.millscript.commons.util.ListIterator<java.lang.Object> |
popArgsIterator(int nargs)
Pops the specified number of values from the top of the operand stack and returns an iterator to iterate over them. |
org.millscript.commons.util.IList<java.lang.Object> |
popArgsList(int nargs,
boolean mutable)
Pops the specifed number of values from the top of the operand stack and returns them as a list. |
java.lang.Object |
popObject()
Pops the object off the top of the operand stack and returns it as the value of this method. |
void |
pushArgsArray(java.lang.Object[] args)
Pushes all of the values in the specified array onto the stack. |
void |
pushArgsIterator(java.util.Iterator<?> it)
Pushes each of the values from the specified iterator onto the stack. |
void |
pushArgsList(org.millscript.commons.util.IList<?> list)
Pushes all of the values in the specified list onto the stack. |
void |
pushArgsMapIterator(org.millscript.commons.util.MapIterator<?,?> it)
Pushes each of the values from the specified map iterator onto the stack. |
void |
pushBoolean(boolean b)
Pushes the specified boolean value onto the operand stack. |
void |
pushObject(java.lang.Object val)
Pushes the specified object onto the operand stack. |
void |
reset()
Resets this machine after an error, making it ready to action new code. |
void |
restoreSaved()
Restore all the variables in the current save set (in reverse order) and dispose of the save set. |
void |
saveRef(Ref r)
Save a variable and its current value. |
void |
setCount(int n)
Sets the number of values on the stack. |
void |
startSaving()
Start a new save-set. |
| Methods inherited from class org.millscript.millscript.vm.TraceableMachine |
|---|
doingList, enterFunction, enterUpdater, exitFunction, exitUpdater |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.Object[] piggyBank
protected java.lang.Object[] valueStack
| Constructor Detail |
|---|
public BasicMachine()
| Method Detail |
|---|
public int getCount()
public java.lang.Object getIndex(int n)
n - index of the element to return
public java.lang.Object peekObject()
public void pokeObject(java.lang.Object x)
x - the object to put at the top of the stackpublic java.lang.Object[] popArgsArray(int nargs)
nargs - the number of values to pop
public java.lang.Object[] popArgsIntoArray(java.lang.Object[] args)
args - the array to fill with values from the stack
public org.millscript.commons.util.ListIterator<java.lang.Object> popArgsIterator(int nargs)
nargs - the number of values to pop
public org.millscript.commons.util.IList<java.lang.Object> popArgsList(int nargs,
boolean mutable)
nargs - the number of values to pop
public java.lang.Object popObject()
public void pushArgsArray(java.lang.Object[] args)
args - the array to get values to push onto the stack frompublic void pushArgsIterator(java.util.Iterator<?> it)
it - the iterator to get values to push onto the stack frompublic void pushArgsList(org.millscript.commons.util.IList<?> list)
list - the list to get values to push onto the stack frompublic void pushArgsMapIterator(org.millscript.commons.util.MapIterator<?,?> it)
it - the map iterator to push values onto the stack frompublic void pushBoolean(boolean b)
b - a boolean value to push onto the operand stack.public void pushObject(java.lang.Object val)
val - an object to push onto the operand stack.public void reset()
public void restoreSaved()
public void saveRef(Ref r)
r - the reference to savepublic void setCount(int n)
n - the maximum number of values that should remain on the stackpublic void startSaving()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||