|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectsfi
$Id: sfi.java,v 1.25 2004/02/03 22:18:04 jjm Exp $
| Constructor Summary | |
sfi()
Creates a new instance of the interpreter. |
|
| Method Summary | |
void |
addSystemWord(java.lang.String id,
sfiInterface sfii)
Adds a system word. |
int |
col()
Column number consultor. |
boolean |
defineConstant(java.lang.String id,
int value)
Define a constant. |
void |
defineVariable(java.lang.String id,
int value)
Defines a variable. |
void |
deleteString(int address)
Deletes a memory stored string. |
void |
error(java.lang.String message)
Default error method. |
void |
execute(java.lang.String program)
Execute a program. |
boolean |
execWord(java.lang.String id)
Executes an user defined word. |
int |
getConstant(java.lang.String id)
Retrieves the value of a constant. |
java.lang.String |
getString(int address)
Retrieves a memory stored string. |
int |
getVariableValue(java.lang.String id)
Retrieves the value stored in a variable. |
int |
ip()
Instruction pointer consultor. |
boolean |
isDefinedConstant(java.lang.String id)
Tell if a given constant is defined. |
boolean |
isDefinedVariable(java.lang.String id)
Tell if a given variable is defined. |
boolean |
isDefinedWord(java.lang.String id)
Tell if a given word is defined. |
boolean |
isStackEmpty()
Checks if the stack is empty. |
int |
line()
Line number consultor. |
void |
output(java.lang.String o)
Default output method. |
void |
stackClear()
Clears the stack. |
int |
stackPop()
Retrieves a value from the stack. |
void |
stackPush(int value)
Puts a value in the stack. |
int |
storeString(java.lang.String value)
Stores a string in memory like C". |
void |
storeVariableValue(java.lang.String id,
int value)
Stores a value in a variable. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public sfi()
It defines the TRUE and FALSE constants.
| Method Detail |
public boolean isDefinedWord(java.lang.String id)
id - String that identifies the WORD.
public boolean execWord(java.lang.String id)
id - String that identifies the user defined
WORD.
public boolean defineConstant(java.lang.String id,
int value)
id - Identifier for the constant. Should be uppercase.value - Value for the constant.
public boolean isDefinedConstant(java.lang.String id)
id - The constant identifier.
public int getConstant(java.lang.String id)
isDefinedConstant.
id - The constant identifier.
public int storeString(java.lang.String value)
C". A program is needed, so
execute must be called before this method is
used. An error message is triggered for debug purposes.
value - The string to store.
public java.lang.String getString(int address)
address - Address of the string.
null if there's no string
associated to the address.public void deleteString(int address)
address - Address of the string.public boolean isDefinedVariable(java.lang.String id)
id - The variable identifier.
public void defineVariable(java.lang.String id,
int value)
id - The variable identifier.value - Initial value.
public void storeVariableValue(java.lang.String id,
int value)
id - The variable identifier.value - The value to store.public int getVariableValue(java.lang.String id)
id - The variable identifier.
public void stackPush(int value)
value - Value to push in the stack.public int stackPop()
public boolean isStackEmpty()
public void stackClear()
public void addSystemWord(java.lang.String id,
sfiInterface sfii)
id - Word identifier.sfii - Interface to the execWord method.public void execute(java.lang.String program)
program - The program String.public int line()
public int col()
public int ip()
public void error(java.lang.String message)
message - Error message.public void output(java.lang.String o)
o - Output.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||