Next: , Up: Instruction Class Set Definition   [Contents][Index]

4.4.1 Function Declaration

You should normally declare or define an instruction class set using the following macro.

Macro: QSMM_INSTR_CLASS_SET (instr_class_set_name)

This macro declares the prototype of a function named instr_class_set_name that represents an instruction class set with the same name and is the event handler function of this instruction class set. The macro can be prepended with the static keyword to declare or define the static function. A pointer to the function has the type qsmm_instr_class_set_func_t (see further on in this subsection). The function is declared as having the return type int and the following arguments.

Function argument: qsmm_t qsmm

The handle of a multinode model that contains the instruction class set.

Function argument: int qsmm_evt

The type of an event that should be processed by the event handler function. Can be one of these constants: QSMM_EVT_ENT_INIT, QSMM_EVT_ENT_DONE, QSMM_EVT_ENGINE_INIT, QSMM_EVT_ENGINE_DONE, QSMM_EVT_NODE_ENTER, QSMM_EVT_NODE_LEAVE.

Function argument: int qsmm_node

The identifier of a node that receives or returns control. Is a valid identifier for events QSMM_EVT_NODE_ENTER and QSMM_EVT_NODE_LEAVE. For other events is equal to -1.

Function argument: void * qsmm_param_p

The user parameter of this event handler function. For events QSMM_EVT_ENT_INIT, QSMM_EVT_ENT_DONE, QSMM_EVT_ENGINE_INIT, and QSMM_EVT_ENGINE_DONE, is equal to the value of the corresponding argument of function qsmm_reg_instr_class_set invoked to register the instruction class set. For events QSMM_EVT_NODE_ENTER and QSMM_EVT_NODE_LEAVE, is equal to the value of the corresponding argument of function qsmm_node_call_default invoked to call the node.

For example, the prototype of a static function that represents instruction class set ‘walker’ can be declared as follows:

static QSMM_INSTR_CLASS_SET(walker);

Static function ‘walker’ can be defined as follows:

static QSMM_INSTR_CLASS_SET(walker) {
Data type: qsmm_instr_class_set_func_t

This is a type for the pointer to the event handler function of an instruction class set. The type has the following declaration:

typedef int
    qsmm_t qsmm,
    int qsmm_evt,
    int qsmm_node,
    void *qsmm_param_p

See above, for a description of arguments of that event handler function. To improve compatibility with future versions of the library, avoid declaring the event handler functions with such prototype explicitly; use the macro QSMM_INSTR_CLASS_SET instead.

Next: , Up: Instruction Class Set Definition   [Contents][Index]