4.2.2.1 Function Declaration

You should declare or define an instruction meta-class using the following macro.

Macro: QSMM_INSTR_META_CLASS (instr_meta_class_name)

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 the instruction meta-class. You can prepend the macro with the static keyword to declare or define a 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.

Function argument: qsmm_t qsmm

The handle of a multinode model containing the instruction meta-class.

Function argument: qsmm_mehcall_t mehcall

The parameters of a call to the event handler function. See Event Handler Call Parameters, for a description of parameters of a model event handler call.

For example, you can 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) {
    ...
}
Data type: qsmm_instr_meta_class_func_t

This is a type for a pointer to the event handler function of an instruction meta-class. See above for the description of non-deprecated arguments of that event handler function. To improve compatibility with future versions of QSMM library, avoid declaring the event handler function explicitly—use the macro QSMM_INSTR_META_CLASS instead.