public class XT
extends java.lang.Object
name |
name of the Forth word associated with the XT or
null if there is no name associated with it
|
---|---|
here |
the location of any data associated with the XT.
This is the address return by >BODY .
Known as the Code Field Address in the FIG model.
|
immediate | Indicates if the word is immediate (true) or not (false). |
Modifier and Type | Field and Description |
---|---|
java.lang.reflect.Method |
handler
A reference to the Java Method that is used to process this XT.
|
int |
here
The location of any data associated with this XT.
|
boolean |
immediate
Indicates if the word is immediate (true) or not
(false).
|
java.lang.Object |
instance
A reference to the object instance in which the handler was
defined.
|
java.lang.String |
name
The Forth word name associated with the XT or null if there is
there is no name.
|
Constructor and Description |
---|
XT(VM vm)
Construct an XT without a handler.
|
XT(VM vm,
java.lang.Object instance,
java.lang.String name)
Construct an XT with a handler obtained from the given method
name in the given class.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(XT other)
Determine if this XT has the same behaviour as another XT.
|
java.lang.String |
readable(VM vm)
Return a string representation of the XT suitable for output
to the user.
|
void |
setHandler(java.lang.Object instance,
java.lang.String name)
Alter the handler for this XT to call the given method
name of the given class instance.
|
java.lang.String |
toString()
Returns a string representation of the XT suitable for
debugging.
|
public java.lang.String name
public boolean immediate
public int here
public java.lang.reflect.Method handler
public void
and must take
a single parameter, the current XT being processed.
Thus a handler must be declared as:
High level definitions are processed by the handlerpublic void
handler(XT xt) {...}
Kernel.definition
, this processes different types of user
definition. See the discussion of naming conventions in
WordSet
for further discussion.WordSet
public java.lang.Object instance
handler
field this can identify the type of XT.public XT(VM vm)
vm
- The virtual machine to which this XT will belong.public XT(VM vm, java.lang.Object instance, java.lang.String name) throws java.lang.NoSuchMethodException
vm
- The virtual machine to which the XT belongs.instance
- The object instance where the handler method
is located.name
- The name of the handler methodjava.lang.NoSuchMethodException
- when there is no method with the given name
in that class.public void setHandler(java.lang.Object instance, java.lang.String name) throws java.lang.NoSuchMethodException
instance
- The class instance where the handler is located.name
- The name of the handler method.java.lang.NoSuchMethodException
- when the given method can not be found in
the given class instance.public boolean equals(XT other)
other
- the XT to compare against.public java.lang.String readable(VM vm)
toString()
which is more
suited to the debugging environment.vm
- the virtual machine to which the XT belongspublic java.lang.String toString()
toString
in class java.lang.Object