4.3.1 Event Handler Call Parameters

The event handler function of an instruction meta-class and the event handler function of an instruction class set have the argument ‘qsmm_mehcall_t mehcall’ for retrieving and modifying the parameters of an event.

Data type: qsmm_mehcall_t

This is a type for a handle of container of parameters for a call to the event handler function of an instruction meta-class or instruction class set. The event handler functions have the argument mehcall for passing the handle. In the type name, “mehcall” is the abbreviation of “Model Event Handler CALL.” Functions belonging to the Model Event Handler Call API take an argument of qsmm_mehcall_t type for retrieving and setting various event parameters. The type is a pointer to the structure qsmm_mehcall_s and has the following definition:

typedef struct qsmm_mehcall_s *qsmm_mehcall_t;

You can dereference the variables of this type. They can have the NULL value.

Below there is a description of a structure pointed to by the type qsmm_mehcall_t.

Structure: qsmm_mehcall_s

This structure holds the parameters of a call to the event handler of an instruction meta-class or instruction class set. The structure contains the following fields.

Field: int evt

Event type. See Event Handling, for a description of events sent to the event handler of an instruction meta-class. See Event Handling, for a description of events sent to the event handler of an instruction class set.

Field: qsmm_sig_t node

The identifier of a node associated with the event. For an event QSMM_EVT_ACTIVATE sent to the event handler of an instruction meta-class, it is the identifier of a node that invoked an instruction. For an event QSMM_EVT_NODE_ENTER sent to the event handler of an instruction class set, it is the identifier of a node that receives control. For an event QSMM_EVT_NODE_LEAVE sent to the event handler of an instruction class set, it is the identifier of a node that returns control. For other events, the identifier is equal to QSMM_SIG_INVALID.

Field: void *param_p

A user parameter. For the event handler of an instruction meta-class, it is a user parameter passed to the function qsmm_reg_instr_meta_class or macro QSMM_REG_INSTR_META_CLASS_PARAM when registering the instruction meta-class. For events QSMM_EVT_NODE_ENTER and QSMM_EVT_NODE_LEAVE sent to the event handler of an instruction class set, it is a user parameter passed to the function qsmm_node_call_default. For other events sent to the event handler of an instruction class set, it is a user parameter passed to the function qsmm_reg_instr_class_set or macro QSMM_REG_INSTR_CLASS_SET_PARAM when registering the instruction class set.

Field: void *priv_p

Opaque parameters. Functions belonging to the Model Event Handler Call API listed in this section can access them.

The following table lists the parameters of a model event handler call, functions for querying and setting them, and references to manual sections describing the functions.

ParameterFunction and Applicable EventsReference to a Section
The flag indicating whether to return control from a nodeQuerying:
qsmm_get_mehcall_return
(instruction meta-class –
QSMM_EVT_ACTIVATE,
instruction class set –
QSMM_EVT_NODE_ENTER)

Setting:
qsmm_set_mehcall_return
(instruction meta-class –
QSMM_EVT_ACTIVATE,
instruction class set –
QSMM_EVT_NODE_ENTER)
Returning Control from a Node
The number of frames in the node call stackQuerying:
qsmm_get_mehcall_stack_sz
Working with the Node Call Stack
The identifier of a node in the node call stackQuerying:
qsmm_get_mehcall_stack_node
Working with the Node Call Stack
The index of a current node state in the node call stackQuerying:
qsmm_get_mehcall_stack_state
Working with the Node Call Stack
The index of an instruction class in the node call stackQuerying:
qsmm_get_mehcall_stack_instr_class
Working with the Node Call Stack
A user frame in the node call stackRetrieving:
qsmm_get_mehcall_stack_frame
Working with the Node Call Stack
Instruction meta-class nameQuerying:
qsmm_get_mehcall_instr_meta_class
(instruction meta-class – all events)
Instruction Class Identifiers
Instruction class set nameQuerying:
qsmm_get_mehcall_instr_class_set
(instruction meta-class –
QSMM_EVT_INSTR_CLASS_INIT,
QSMM_EVT_INSTR_CLASS_DONE,
QSMM_EVT_ACTIVATE,
instruction class set – all events)
Instruction Class Identifiers
Binary parameters of an instruction classQuerying:
qsmm_get_mehcall_instr_param_bin
(instruction meta-class –
QSMM_EVT_INSTR_CLASS_INIT,
QSMM_EVT_INSTR_CLASS_DONE,
QSMM_EVT_ACTIVATE)
Accessing Binary Instruction Parameters
Text parameters of an instruction classQuerying:
qsmm_get_mehcall_instr_param_str
(instruction meta-class –
QSMM_EVT_INSTR_CLASS_INIT,
QSMM_EVT_INSTR_CLASS_DONE,
QSMM_EVT_ACTIVATE)

Setting:
qsmm_set_mehcall_instr_param_f,
qsmm_set_mehcall_instr_param_fv
(instruction meta-class –
QSMM_EVT_INSTR_CLASS_INIT)
Registering Instruction Classes
The number of instruction outcomesQuerying:
qsmm_get_mehcall_noutcome
(instruction meta-class –
QSMM_EVT_INSTR_CLASS_INIT,
QSMM_EVT_INSTR_CLASS_DONE,
QSMM_EVT_ACTIVATE)

Setting:
qsmm_set_mehcall_noutcome,
(instruction meta-class –
QSMM_EVT_INSTR_CLASS_INIT)
Setting the Number of Instruction Outcomes
Instruction outcomeQuerying:
qsmm_get_mehcall_outcome
(instruction meta-class –
QSMM_EVT_ACTIVATE)

Setting:
qsmm_set_mehcall_outcome
(instruction meta-class –
QSMM_EVT_ACTIVATE)
Handling Instruction Invocation
The probability of last state transition performedRetrieving:
qsmm_get_mehcall_prob_goto
Handling Instruction Invocation
The probability of last instruction invoked in a stateRetrieving:
qsmm_get_mehcall_prob_action
Handling Instruction Invocation
Multinode model handleRetrieving:
qsmm_get_mehcall_model
This section

The handle of a multinode model associated with a call to the event handler of an instruction meta-class or instruction class set is available via the argument qsmm of that event handler and via the function described below.

Function: qsmm_t qsmm_get_mehcall_model (qsmm_mehcall_t mehcall)

This function returns the handle of a multinode model associated with an event sent to the event handler of an instruction meta-class or instruction class set, where mehcall is an argument of that event handler passing information about the event. The function never returns NULL.