Next: Instruction Meta-class Event Handling, Up: Defining Instruction Meta-classes [Contents][Index]
You should declare or define an instruction meta-class using the following macro.
This macro declares the prototype of a function named instr_meta_class_name that represents an instruction meta-class with the same name and is the event handler function of this instruction meta-class.
You can prepend the macro with the static
keyword to declare or define the static function.
A pointer to the function has the type qsmm_instr_meta_class_func_t
.
The function has the return type int
and the following arguments.
The handle of a multinode model containing the instruction meta-class.
The type of an event to process by the event handler function: QSMM_EVT_ENT_INIT
, QSMM_EVT_ENT_DONE
, QSMM_EVT_INSTR_CLASS_INIT
, QSMM_EVT_INSTR_CLASS_DONE
, QSMM_EVT_ENGINE_INIT
, QSMM_EVT_ENGINE_DONE
, or QSMM_EVT_ACTIVATE
.
The identifier of an executed node.
Is a valid identifier for an event QSMM_EVT_ACTIVATE
.
For other events is equal to -1.
The user parameter of this event handler function.
Is equal to the corresponding argument of qsmm_reg_instr_meta_class
function called to register the instruction meta-class.
For example, declare the prototype of a static function representing the instruction meta-class ‘move’ as follows:
static QSMM_INSTR_META_CLASS(move);
Define the static function ‘move’ as follows:
static QSMM_INSTR_META_CLASS(move) { ... }
This is a type of a pointer to the event handler function of an instruction meta-class. The type has the following declaration:
typedef int (*qsmm_instr_meta_class_func_t)( qsmm_t qsmm, int qsmm_evt, int qsmm_node, void *qsmm_param_p );
See above for the description of arguments of that event handler function.
To improve compatibility with future versions of QSMM library, avoid declaring event handler functions with this prototype explicitly—use the macro QSMM_INSTR_META_CLASS
instead.