4.2.2.8 Function Layout

A template for the event handler of an instruction meta-class:

QSMM_INSTR_META_CLASS(instr_meta_class_name) {
    struct ic_param_s ic_param;
        // structure "ic_param_s" is for holding the binary parameters of
        // an individual instruction class
    if (QSMM_HAS_INSTR_CLASS(mehcall->evt))
        qsmm_get_mehcall_instr_param_bin(
            mehcall, sizeof(ic_param), 0, &ic_param);
                // fetch the binary parameters of an individual
                // instruction class
    switch (mehcall->evt) {
        case QSMM_EVT_INSTR_CLASS_INIT:
            qsmm_set_mehcall_instr_param_f(
                mehcall, fmt, ic_param.field, ...);
                    // set the text parameters of an individual
                    // instruction class
            qsmm_set_mehcall_noutcome(mehcall,noutcome);
                // set the number of outcomes of the instruction class if
                // that number is not equal to 1
            break;
        case QSMM_EVT_INSTR_CLASS_DONE:
            // TODO: deallocate the fields of "ic_param_s" (held in
            //       "ic_param") allocated before a call to
            //       "qsmm_reg_instr_class_v2".
            break;
        case QSMM_EVT_ACTIVATE:
            // TODO: handle the invocation of an instruction with binary
            //       parameters held in "ic_param".
            break;
        case QSMM_EVT_ENT_INIT:
        case QSMM_EVT_ENT_DONE:
        case QSMM_EVT_ENGINE_INIT:
        case QSMM_EVT_ENGINE_DONE:
            // TODO: optionally handle the events.
            break;
    }
    return 0;
}