Use the following macro to register the event handler function of an instruction meta-class.
This macro registers an instruction meta-class instr_meta_class_name for a multinode model.
The event handler function of the instruction meta-class previously declared or defined by the macro QSMM_INSTR_META_CLASS should have the name instr_meta_class_name.
The event handler function will be receiving a parameter paramp in mehcall->param_p on all events, where mehcall is an argument of that event handler function.
The macro QSMM_REG_INSTR_META_CLASS_PARAM expands to:
qsmm_reg_instr_meta_class((model), #instr_meta_class_name,
&instr_meta_class_name, (paramp))
Below there is the description of a function called by the macro QSMM_REG_INSTR_META_CLASS_PARAM.
int qsmm_reg_instr_meta_class (qsmm_t model, const char *instr_meta_class_name, qsmm_instr_meta_class_func_t instr_meta_class_func, void *paramp) ¶This function registers an instruction meta-class instr_meta_class_name for a multinode model.
A function instr_meta_class_func will be the event handler of the instruction meta-class.
The event handler will be receiving a parameter paramp in mehcall->param_p on all events, where mehcall is an argument of that event handler.
A string instr_meta_class_name must begin with an English letter or underscore followed by zero or more characters where each character is an English letter, decimal digit, or underscore.
After registering an instruction meta-class, the function sends the event QSMM_EVT_ENT_INIT to the event handler, and it can perform the initialization of the instruction meta-class.
The function returns a non-negative value on success or a negative error code on failure. Currently, the function can return the following error codes.
QSMM_ERR_INVALThe string instr_meta_class_name has invalid format.
QSMM_ERR_EXISTA program has already registered an instruction meta-class or instruction class set named instr_meta_class_name in the multinode model.
QSMM_ERR_NOMEMThere was not enough memory to perform the operation.
Use the following function to get a pointer to the event handler of an instruction meta-class and the user parameter of that event handler.
int qsmm_get_instr_meta_class_handler (qsmm_t model, const char *instr_meta_class_name, qsmm_instr_meta_class_func_t *instr_meta_class_func_p, void **param_pp) ¶This function retrieves the parameters of the event handler of an instruction meta-class instr_meta_class_name registered for a multinode model.
If instr_meta_class_func_p is not NULL, the function sets *instr_meta_class_func_p to a pointer to that event handler.
If param_pp is not NULL, the function sets *param_pp to a parameter of the event handler passed in mehcall->param_p on all events, where mehcall is an argument of that event handler.
The function returns a non-negative value on success or a negative error code on failure. Currently, the function can return the following error codes.
QSMM_ERR_NOTFOUNDThe instruction meta-class instr_meta_class_name not found.
QSMM_ERR_TYPEAn entity named instr_meta_class_name is not an instruction meta-class. The entity is an instruction class set.
QSMM_ERR_NOMEMThere was not enough memory to perform the operation.