[阅读: 561] 2005-10-26 04:06:18
// ----------------------------------------------------------------------------
// Instruction set: opcode
// ----------------------------------------------------------------------------
// Constants operations
#define OPCODE_LOAD_CONST_NUMERIC 0x01 // load_const_numeric 8bytes_numeric_const
#define OPCODE_LOAD_CONST_TRUEFALSE 0x02 // load_const_truefalse 4bytes_truefalse_const
#define OPCODE_LOAD_CONST_STRING 0x03 // load_const_string 4bytes_offset_to_string_const
// Variable operations
#define OPCODE_LOAD 0x04 // load 4bytes_index_to_variable_table
#define OPCODE_STORE 0x05 // store 4bytes_index_to_variable_table
// Array operations
#define OPCODE_LOAD_ARRAY 0x06 // load_array 4bytes_index_to_variable_table ( index in array is in stack top )
#define OPCODE_STORE_ARRAY 0x07 // store_array 4bytes_index_to_variable_table
// Arithmetic operations - for two numeric value on stack top only
#define OPCODE_ADD 0x08 // add
#define OPCODE_SUB 0x09 // sub
#define OPCODE_MUL 0x0A // mul
#define OPCODE_DIV 0x0B // div
// Logical operations - for one or two truefalse value on stack top only
#define OPCODE_NOT 0x0C // not
#define OPCODE_AND 0x0D // and
#define OPCODE_OR 0x0E // or
// Relational operations - the result is a truefalse on stack top
// Numeric operands - for two numeric values values on stack top
#define OPCODE_CMP_EQ 0x0F // cmp_eq
#define OPCODE_CMP_NE 0x10 // cmp_ne
#define OPCODE_CMP_GT 0x11 // cmp_gt
#define OPCODE_CMP_GE 0x12 // cmp_ge
#define OPCODE_CMP_LT 0x13 // cmp_lt
#define OPCODE_CMP_LE 0x14 // cmp_le
// Conditional Jumps - for one truefalse on stack top
#define OPCODE_IF_FALSE 0x15 // if_false jump_address offset-to-code-area
#define OPCODE_IF_TRUE 0x16 // if_true jump_address offset-to-code-area
#define OPCODE_JUMP 0x17 // jump jump_address offset-to-code-area
// Subroutine invocation
#define OPCODE_CALL_INTERNAL 0x18 // call_internal 4bytes_offset_string_constant_table
#define OPCODE_CALL_UDF 0x19 // call_udf 4bytes_index_to_udf_import_table
#define OPCODE_CALL_DLL 0x1A // call_dll TBD
// Return from subroutine
#define OPCODE_RETURN 0x1B // return
// Self-increment. Operation is applied on the top of stack
#define OPCODE_INC 0x1C // inc
// self-decrement. Operation is applied on the top of stack
#define OPCODE_DEC 0x1D // dec
// Assign value at the top of stack to udf variable
#define OPCODE_UDF_ASSIGN 0x1E // udf_assign
// Load history value of a variable - the past bar number is at top of stack
#define OPCODE_LOAD_HISTORY 0x1F // load_history 4bytes_index_to_variable_table
// Load history value of udf variable - the past bar number is at top of stack
#define OPCODE_LOAD_HISTORY_UDF 0x20 // load_history_udf 4bytes_offset_string_constant_table
// Fill whole array with a value - the value is in top of stack.
#define OPCODE_FILL_ARRAY 0x21 // fill_array 4bytes_index_to_variable_table