|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD | |||||||||
java.lang.Objectjava.lang.Enum<OcpCode>
org.extex.ocpware.type.OcpCode
public enum OcpCode
This enumeration provides information about the ΩCP instructions.
A ΩCP Program consists of a set of instructions. The instructions are stored in words of the length of 4 bytes (of 8 bits each). Each instruction is determined by an op code of one byte. The instruction can have 0 to 2 arguments. Any argument is at most 3 bytes (24 bits) long.
An instruction without arguments has the following layout:
| 8 bit | 24 bit |
| op code | unused |
An instruction with one argument has the following layout:
| 8 bit | 24 bit |
| op code | argument 1 |
An instruction with two arguments has the following layout:
| 8 bit | 24 bit |
| op code | argument 1 |
| unused | argument 2 |
| table[] | Tables |
| state[] | States |
| pc | Program counter |
| cs | Current state |
| first | The pointer to the first character of the prefix |
| last | The pointer to the last character of the prefix |
| stack[] | Stack |
| stateStack[] | State stack |
ADD, DIV,
GOTO, GOTO_BEG,
GOTO_END, GOTO_EQ,
GOTO_GE, GOTO_GT,
GOTO_LE, GOTO_LT,
GOTO_NE,
GOTO_NO_ADVANCE,
LEFT_BACKUP,
LEFT_RETURN,
LEFT_START, LOOKUP,
MOD, MULT,
PBACK_CHAR,
PBACK_LCHAR,
PBACK_NUM,
PBACK_OUTPUT,
PBACK_SOME,
PUSH_CHAR,
PUSH_LCHAR,
PUSH_NUM,
RIGHT_CHAR,
RIGHT_LCHAR,
RIGHT_NUM,
RIGHT_OUTPUT,
RIGHT_SOME,
STATE_CHANGE,
STATE_POP,
STATE_PUSH, STOP,
SUB.
| Enum Constant Summary | |
|---|---|
ADD
The constant ADD contains the description of the ΩCP instruction to add two numbers from the stack. |
|
DIV
The constant DIV contains the description of the ΩCP instruction to divide two numbers from the stack. |
|
GOTO
The constant GOTO contains the description of the ΩCP instruction to unconditionally branch to another instruction. |
|
GOTO_BEG
The constant GOTO_BEG contains the description of the ΩCP instruction to conditionally branch to another instruction. |
|
GOTO_END
The constant GOTO_END contains the description of the ΩCP instruction to conditionally branch to another instruction. |
|
GOTO_EQ
The constant GOTO_EQ contains the description of the ΩCP instruction to conditionally branch to another instruction. |
|
GOTO_GE
The constant GOTO_GE contains the description of the ΩCP instruction to conditionally branch to another instruction. |
|
GOTO_GT
The constant GOTO_GT contains the description of the ΩCP instruction to conditionally branch to another instruction. |
|
GOTO_LE
The constant GOTO_LE contains the description of the ΩCP instruction to conditionally branch to another instruction. |
|
GOTO_LT
The constant GOTO_LT contains the description of the ΩCP instruction to conditionally branch to another instruction. |
|
GOTO_NE
The constant GOTO_NE contains the description of the ΩCP instruction to conditionally branch to another instruction. |
|
GOTO_NO_ADVANCE
The constant GOTO_NO_ADVANCE contains the description of the ΩCP instruction to conditionally branch to another instruction. |
|
LEFT_BACKUP
The constant LEFT_BACKUP contains the description of the ΩCP instruction to back up the last pointer by 1. |
|
LEFT_RETURN
The constant LEFT_RETURN contains the description of the ΩCP instruction to reset the last pointer to first - 1. |
|
LEFT_START
The constant LEFT_START contains the description of the ΩCP instruction to set the first character position to last + 1. |
|
LOOKUP
The constant LOOKUP contains the description of the ΩCP instruction to look-up a value from a table. |
|
MOD
The constant MOD contains the description of the ΩCP instruction to compute the remainder of two numbers from the stack. |
|
MULT
The constant MULT contains the description of the ΩCP instruction to multiply two numbers from the stack. |
|
PBACK_CHAR
The constant PBACK_CHAR contains the description of the ΩCP instruction to push back a character from the right end of the prefix. |
|
PBACK_LCHAR
The constant PBACK_LCHAR contains the description of the ΩCP instruction to push back a character from the left end of the prefix. |
|
PBACK_NUM
The constant PBACK_NUM contains the description of the ΩCP instruction to push back a constant taken from the argument. |
|
PBACK_OUTPUT
The constant PBACK_OUTPUT contains the description of the ΩCP instruction to push back the top value from the arithmetic stack. |
|
PBACK_SOME
The constant PBACK_SOME contains the description of the ΩCP instruction to push back some characters from the prefix. |
|
PUSH_CHAR
The constant PUSH_CHAR contains the description of the ΩCP instruction to push a character from the prefix to the stack. |
|
PUSH_LCHAR
The constant PUSH_LCHAR contains the description of the ΩCP instruction to push a character from the prefix to the stack. |
|
PUSH_NUM
The constant PUSH_NUM contains the description of the ΩCP instruction to push a constant to the stack. |
|
RIGHT_CHAR
The constant RIGHT_CHAR contains the description of the ΩCP instruction to output a character from the right end of the prefix. |
|
RIGHT_LCHAR
The constant RIGHT_LCHAR contains the description of the ΩCP instruction to output a character from the left end of the prefix. |
|
RIGHT_NUM
The constant RIGHT_NUM contains the description of the ΩCP instruction to output a constant character number. |
|
RIGHT_OUTPUT
The constant RIGHT_OUTPUT contains the description of the ΩCP instruction to output the topmost number from the arithmetic stack. |
|
RIGHT_SOME
The constant RIGHT_SOME contains the description of the ΩCP instruction to output some characters from the prefix. |
|
STATE_CHANGE
The constant STATE_CHANGE contains the description of the ΩCP instruction to set the current state to a given value. |
|
STATE_POP
The constant STATE_POP contains the description of the ΩCP instruction to pop the current state from the state stack. |
|
STATE_PUSH
The constant STATE_PUSH contains the description of the ΩCP instruction to push a state to the state stack. |
|
STOP
The constant STOP contains the description of the ΩCP instruction to stop the processing of the current prefix. |
|
SUB
The constant SUB contains the description of the ΩCP instruction to subtract two numbers from the stack. |
|
| Field Summary | |
|---|---|
static int |
ARGUMENT_BIT_MASK
The constant ARGUMENT_BIT_MASK contains the bit mask for the lower 24 bits used as arguments in the ΩCP engine. |
static int |
OP_ADD
The constant OP_ADD contains the op code for the ΩCP instruction to add two numbers from the stack. |
static int |
OP_DIV
The constant OP_DIV contains the op code for the ΩCP instruction to divide two numbers from the stack. |
static int |
OP_GOTO
The constant OP_GOTO contains the op code for the ΩCP instruction to adjust the program counter. |
static int |
OP_GOTO_BEG
The constant OP_GOTO_BEG contains the op code for the ΩCP instruction to conditionally adjust the program counter at the beginning of input. |
static int |
OP_GOTO_END
The constant OP_GOTO_END contains the op code for the ΩCP instruction to conditionally adjust the program counter at the end of input. |
static int |
OP_GOTO_EQ
The constant OP_GOTO_EQ contains the op code for the ΩCP instruction conditionally adjust the program counter. |
static int |
OP_GOTO_GE
The constant OP_GOTO_GE contains the op code for the ΩCP instruction conditionally adjust the program counter. |
static int |
OP_GOTO_GT
The constant OP_GOTO_GT contains the op code for the ΩCP instruction to conditionally adjust the program counter. |
static int |
OP_GOTO_LE
The constant OP_GOTO_LE contains the op code for the ΩCP instruction to conditionally adjust the program counter. |
static int |
OP_GOTO_LT
The constant OP_GOTO_LT contains the op code for the ΩCP instruction to conditionally adjust the program counter. |
static int |
OP_GOTO_NE
The constant OP_GOTO_NE contains the op code for the ΩCP instruction to conditionally adjust the program counter. |
static int |
OP_GOTO_NO_ADVANCE
The constant OP_GOTO_NO_ADVANCE contains the op code for the ocp instruction to conditionally adjust the program counter after advancing last. |
static int |
OP_LEFT_BACKUP
The constant OP_LEFT_BACKUP contains the op code for the ΩCP instruction to decrement the last pointer by 1. |
static int |
OP_LEFT_RETURN
The constant OP_LEFT_RETURN contains the op code for the ΩCP instruction to rest last to first - 1. |
static int |
OP_LEFT_START
The constant OP_LEFT_START contains the op code for the ΩCP instruction to set first to last + 1. |
static int |
OP_LOOKUP
The constant OP_LOOKUP contains the op code for the ΩCP instruction to lookup a table entry. |
static int |
OP_MOD
The constant OP_MOD contains the op code for the ΩCP instruction to compute the remainder of two arguments from the stack. |
static int |
OP_MULT
The constant OP_MULT contains the op code for the ΩCP instruction to multiply two arguments from the stack. |
static int |
OP_PBACK_CHAR
The constant OP_PBACK_CHAR contains the op code for the ΩCP instruction to push back a character from the right end of the prefix |
static int |
OP_PBACK_LCHAR
The constant OP_PBACK_LCHAR contains the op code for the ΩCP instruction to push back a character from the left end of the prefix. |
static int |
OP_PBACK_NUM
The constant OP_PBACK_NUM contains the op code for the ΩCP instruction to push back a number. |
static int |
OP_PBACK_OUTPUT
The constant OP_PBACK_OUTPUT contains the op code for the ΩCP instruction to push back a character from the arithmetic stack. |
static int |
OP_PBACK_SOME
The constant OP_PBACK_SOME contains the op code for the ΩCP instruction to push back a match. |
static int |
OP_PUSH_CHAR
The constant OP_PUSH_CHAR contains the op code for the ΩCP instruction to push back a character. |
static int |
OP_PUSH_LCHAR
The constant OP_PUSH_LCHAR contains the op code for the ΩCP instruction to push a referenced character. |
static int |
OP_PUSH_NUM
The constant OP_PUSH_NUM contains the op code for the ΩCP instruction to push a number. |
static int |
OP_RIGHT_CHAR
The constant OP_RIGHT_CHAR contains the op code for the ΩCP instruction to output a character from the right end of the prefix. |
static int |
OP_RIGHT_LCHAR
The constant OP_RIGHT_LCHAR contains the op code for the ΩCP instruction to output a character from the left end of the prefix. |
static int |
OP_RIGHT_NUM
The constant OP_RIGHT_NUM contains the op code for the ΩCP instruction to output a constant. |
static int |
OP_RIGHT_OUTPUT
The constant OP_RIGHT_OUTPUT contains the op code for the ΩCP instruction to pop a value off the arithmetic stack and output it. |
static int |
OP_RIGHT_SOME
The constant OP_RIGHT_SOME contains the op code for the ΩCP instruction to output some characters of the prefix. |
static int |
OP_STATE_CHANGE
The constant OP_STATE_CHANGE contains the op code for the ΩCP instruction to set a new state. |
static int |
OP_STATE_POP
The constant OP_STATE_POP contains the op code for the ΩCP instruction to pop a state from the state stack. |
static int |
OP_STATE_PUSH
The constant OP_STATE_PUSH contains the op code for the ΩCP instruction to push a state onto the state stack. |
static int |
OP_STOP
The constant OP_STOP contains the op code for the ΩCP instruction to end the processing. |
static int |
OP_SUB
The constant OP_SUB contains the op code for the ΩCP instruction to subtract two numbers from the stack. |
static int |
OPCODE_OFFSET
The constant OPCODE_OFFSET contains the offset for the op code. |
| Method Summary | |
|---|---|
static OcpCode |
get(int opcode)
Get the OcpCode for a given op code. |
OcpArgumentType[] |
getArguments()
Getter for the description of the arguments of the instruction. |
java.lang.String |
getInstruction()
Getter for instruction. |
int |
getOpcode()
Getter for opcode. |
int |
inst()
Get the first word of the instruction withput argument. |
int |
inst(int arg)
Get the first word of the instruction with one argument. |
static OcpCode |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. |
static OcpCode[] |
values()
Returns an array containing the constants of this enum type, in the order they're declared. |
| Methods inherited from class java.lang.Enum |
|---|
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Enum Constant Detail |
|---|
public static final OcpCode RIGHT_OUTPUT
public static final OcpCode RIGHT_NUM
public static final OcpCode RIGHT_CHAR
public static final OcpCode RIGHT_LCHAR
public static final OcpCode RIGHT_SOME
public static final OcpCode PBACK_OUTPUT
public static final OcpCode PBACK_NUM
public static final OcpCode PBACK_CHAR
public static final OcpCode PBACK_LCHAR
public static final OcpCode PBACK_SOME
public static final OcpCode ADD
public static final OcpCode SUB
public static final OcpCode MULT
public static final OcpCode DIV
public static final OcpCode MOD
public static final OcpCode LOOKUP
public static final OcpCode PUSH_NUM
public static final OcpCode PUSH_CHAR
public static final OcpCode PUSH_LCHAR
public static final OcpCode STATE_CHANGE
public static final OcpCode STATE_PUSH
public static final OcpCode STATE_POP
public static final OcpCode LEFT_START
public static final OcpCode LEFT_RETURN
public static final OcpCode LEFT_BACKUP
public static final OcpCode GOTO
public static final OcpCode GOTO_NE
public static final OcpCode GOTO_EQ
public static final OcpCode GOTO_LT
public static final OcpCode GOTO_LE
public static final OcpCode GOTO_GT
public static final OcpCode GOTO_GE
public static final OcpCode GOTO_NO_ADVANCE
public static final OcpCode GOTO_BEG
public static final OcpCode GOTO_END
public static final OcpCode STOP
| Field Detail |
|---|
public static final int OP_ADD
ADD,
Constant Field Valuespublic static final int OP_DIV
DIV,
Constant Field Valuespublic static final int OP_GOTO
GOTO,
Constant Field Valuespublic static final int OP_GOTO_BEG
GOTO_BEG,
Constant Field Valuespublic static final int OP_GOTO_END
GOTO_END,
Constant Field Valuespublic static final int OP_GOTO_EQ
GOTO_EQ,
Constant Field Valuespublic static final int OP_GOTO_GE
GOTO_GE,
Constant Field Valuespublic static final int OP_GOTO_GT
GOTO_GT,
Constant Field Valuespublic static final int OP_GOTO_LE
GOTO_LE,
Constant Field Valuespublic static final int OP_GOTO_LT
GOTO_LT,
Constant Field Valuespublic static final int OP_GOTO_NE
GOTO_NE,
Constant Field Valuespublic static final int OP_GOTO_NO_ADVANCE
GOTO_NO_ADVANCE,
Constant Field Valuespublic static final int OP_LEFT_BACKUP
LEFT_BACKUP,
Constant Field Valuespublic static final int OP_LEFT_RETURN
LEFT_RETURN,
Constant Field Valuespublic static final int OP_LEFT_START
LEFT_START,
Constant Field Valuespublic static final int OP_LOOKUP
LOOKUP,
Constant Field Valuespublic static final int OP_MOD
MOD,
Constant Field Valuespublic static final int OP_MULT
MULT,
Constant Field Valuespublic static final int OP_PBACK_CHAR
PBACK_CHAR,
Constant Field Valuespublic static final int OP_PBACK_LCHAR
PBACK_LCHAR,
Constant Field Valuespublic static final int OP_PBACK_NUM
PBACK_NUM,
Constant Field Valuespublic static final int OP_PBACK_OUTPUT
PBACK_OUTPUT,
Constant Field Valuespublic static final int OP_PBACK_SOME
PBACK_SOME,
Constant Field Valuespublic static final int OP_PUSH_CHAR
PUSH_CHAR,
Constant Field Valuespublic static final int OP_PUSH_LCHAR
PUSH_LCHAR,
Constant Field Valuespublic static final int OP_PUSH_NUM
PUSH_NUM,
Constant Field Valuespublic static final int OP_RIGHT_CHAR
RIGHT_CHAR,
Constant Field Valuespublic static final int OP_RIGHT_LCHAR
RIGHT_LCHAR,
Constant Field Valuespublic static final int OP_RIGHT_NUM
RIGHT_NUM,
Constant Field Valuespublic static final int OP_RIGHT_OUTPUT
RIGHT_OUTPUT,
Constant Field Valuespublic static final int OP_RIGHT_SOME
RIGHT_SOME,
Constant Field Valuespublic static final int OP_STATE_CHANGE
STATE_CHANGE,
Constant Field Valuespublic static final int OP_STATE_POP
STATE_POP,
Constant Field Valuespublic static final int OP_STATE_PUSH
STATE_PUSH,
Constant Field Valuespublic static final int OP_STOP
STOP,
Constant Field Valuespublic static final int OP_SUB
SUB,
Constant Field Valuespublic static final int ARGUMENT_BIT_MASK
public static final int OPCODE_OFFSET
| Method Detail |
|---|
public static final OcpCode[] values()
for(OcpCode c : OcpCode.values())
System.out.println(c);
public static OcpCode valueOf(java.lang.String name)
name - the name of the enum constant to be returned.
java.lang.IllegalArgumentException - if this enum type has no constant
with the specified namepublic static OcpCode get(int opcode)
opcode - the op code
null for an unknown op codepublic OcpArgumentType[] getArguments()
public int getOpcode()
public java.lang.String getInstruction()
public int inst()
public int inst(int arg)
arg - the argument
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD | |||||||||