Beispiel #1
0
/* @(/1/0/0/0) */
static QState Philo_initial(Philo * const me) {
    static QActionHandler const act_[] = {
        Q_ACTION_CAST(&Philo_thinking_e),
        Q_ACTION_CAST(0)
    };
    return QM_INITIAL(&Philo_thinking_s, &act_[0]);
}
Beispiel #2
0
static QState Pelican_pedsEnabled_i(Pelican * const me) {
    static QActionHandler const act_[] = {
        Q_ACTION_CAST(&Pelican_pedsWalk_e),
        Q_ACTION_CAST(0)
    };
    return QM_INITIAL(&Pelican_pedsWalk_s, &act_[0]);
}
Beispiel #3
0
/* @(/2/4/3/0) */
static QState Mine2_initial(Mine2 * const me, QEvt const * const e) {
    static  uint8_t dict_sent;

    if (!dict_sent) {
        /* object dictionaries for Mine2 pool... */
        QS_OBJ_DICTIONARY(&l_mine2[0]);
        QS_OBJ_DICTIONARY(&l_mine2[1]);
        QS_OBJ_DICTIONARY(&l_mine2[2]);
        QS_OBJ_DICTIONARY(&l_mine2[3]);
        QS_OBJ_DICTIONARY(&l_mine2[4]);

        /*function dictionaries for Mine2 HSM... */
        QS_FUN_DICTIONARY(&Mine2_initial);
        QS_FUN_DICTIONARY(&Mine2_unused);
        QS_FUN_DICTIONARY(&Mine2_used);
        QS_FUN_DICTIONARY(&Mine2_planted);
        QS_FUN_DICTIONARY(&Mine2_exploding);

        dict_sent = 1U;
    }
    /* local signals... */
    QS_SIG_DICTIONARY(MINE_PLANT_SIG,    me);
    QS_SIG_DICTIONARY(MINE_DISABLED_SIG, me);
    QS_SIG_DICTIONARY(MINE_RECYCLE_SIG,  me);
    QS_SIG_DICTIONARY(SHIP_IMG_SIG,      me);
    QS_SIG_DICTIONARY(MISSILE_IMG_SIG,   me);

    (void)e; /* avoid the "unreferenced parameter" warning */
    return QM_INITIAL(&Mine2_unused_s, &QMsm_emptyAction_[0]);
}
Beispiel #4
0
static QState Pelican_operational_i(Pelican * const me) {
    static QActionHandler const act_[] = {
        Q_ACTION_CAST(&Pelican_carsEnabled_i),
        Q_ACTION_CAST(0)
    };
    return QM_INITIAL(&Pelican_carsEnabled_s, &act_[0]);
}
Beispiel #5
0
static QState Pelican_carsGreen_i(Pelican * const me) {
    static QActionHandler const act_[] = {
        Q_ACTION_CAST(&Pelican_carsGreenNoPed_e),
        Q_ACTION_CAST(0)
    };
    return QM_INITIAL(&Pelican_carsGreenNoPed_s, &act_[0]);
}
Beispiel #6
0
// @(/3/0/2) .................................................................
// @(/3/0/2/0)
QP::QState Philo::initial(Philo * const me, QP::QEvt const * const e) {
    static QP::QActionHandler const act_[] = {
        Q_ACTION_CAST(&Philo::thinking_e),
        Q_ACTION_CAST(0)
    };
    static bool registered = false; // starts off with 0, per C-standard
    (void)e; // suppress the compiler warning about unused parameter
    if (!registered) {
        registered = true;

        QS_OBJ_DICTIONARY(&l_philo[0]);
        QS_OBJ_DICTIONARY(&l_philo[0].m_timeEvt);
        QS_OBJ_DICTIONARY(&l_philo[1]);
        QS_OBJ_DICTIONARY(&l_philo[1].m_timeEvt);
        QS_OBJ_DICTIONARY(&l_philo[2]);
        QS_OBJ_DICTIONARY(&l_philo[2].m_timeEvt);
        QS_OBJ_DICTIONARY(&l_philo[3]);
        QS_OBJ_DICTIONARY(&l_philo[3].m_timeEvt);
        QS_OBJ_DICTIONARY(&l_philo[4]);
        QS_OBJ_DICTIONARY(&l_philo[4].m_timeEvt);

        QS_FUN_DICTIONARY(&Philo::initial);
        QS_FUN_DICTIONARY(&Philo::thinking);
        QS_FUN_DICTIONARY(&Philo::hungry);
        QS_FUN_DICTIONARY(&Philo::eating);
    }
    QS_SIG_DICTIONARY(HUNGRY_SIG, me);  // signal for each Philos
    QS_SIG_DICTIONARY(TIMEOUT_SIG, me); // signal for each Philos

    me->subscribe(EAT_SIG);
    return QM_INITIAL(&Philo::thinking_s, act_);
}
Beispiel #7
0
/* @(/1/1/1/0) */
static QState Ped_initial(Ped * const me) {
    static QActionHandler const act_[] = {
        Q_ACTION_CAST(&Ped_wait_e),
        Q_ACTION_CAST(0)
    };
    return QM_INITIAL(&Ped_wait_s, &act_[0]);
}
Beispiel #8
0
/* @(/1/0/1/0) */
static QState Pelican_initial(Pelican * const me) {
    static QActionHandler const act_[] = {
        Q_ACTION_CAST(&Pelican_operational_e),
        Q_ACTION_CAST(&Pelican_operational_i),
        Q_ACTION_CAST(0)
    };
    return QM_INITIAL(&Pelican_operational_s, &act_[0]);
}
Beispiel #9
0
static QState QMsmTst_s21_i(QMsmTst * const me) {
    static QActionHandler const act_[] = {
        Q_ACTION_CAST(&QMsmTst_s211_e),
        Q_ACTION_CAST(0)
    };
    BSP_display("s21-INIT;");
    return QM_INITIAL(&QMsmTst_s211_s, &act_[0]);
}
Beispiel #10
0
/* @(/1/0/1/0) */
static QState QMsmTst_initial(QMsmTst * const me, QEvt const * const e) {
    static QActionHandler const act_[] = {
        Q_ACTION_CAST(&QMsmTst_s_e),
        Q_ACTION_CAST(&QMsmTst_s2_e),
        Q_ACTION_CAST(&QMsmTst_s2_i),
        Q_ACTION_CAST(0)
    };
    (void)e; /* avoid compiler warning */
    me->foo = 0U;
    BSP_display("top-INIT;");
    return QM_INITIAL(&QMsmTst_s2_s, &act_[0]);
}
Beispiel #11
0
/* @(/2/1/4/0) */
static QState Ship_initial(Ship * const me, QEvt const * const e) {
    static QActionHandler const act_[] = {
        Q_ACTION_CAST(&Ship_active_i),
        Q_ACTION_CAST(0)
    };
    (void)e; /* avoid the compiler warning 'usused parameter' */
    QActive_subscribe((QActive *)me, TIME_TICK_SIG);
    QActive_subscribe((QActive *)me, PLAYER_TRIGGER_SIG);
    /* object dictionaries... */
    QS_OBJ_DICTIONARY(&l_ship);
    /* function dictionaries for Ship HSM... */
    QS_FUN_DICTIONARY(&Ship_initial);
    QS_FUN_DICTIONARY(&Ship_active);
    QS_FUN_DICTIONARY(&Ship_parked);
    QS_FUN_DICTIONARY(&Ship_flying);
    QS_FUN_DICTIONARY(&Ship_exploding);
    /* local signals... */
    QS_SIG_DICTIONARY(PLAYER_SHIP_MOVE_SIG, &l_ship);
    QS_SIG_DICTIONARY(TAKE_OFF_SIG,         &l_ship);
    QS_SIG_DICTIONARY(HIT_WALL_SIG,         &l_ship);
    QS_SIG_DICTIONARY(HIT_MINE_SIG,         &l_ship);
    QS_SIG_DICTIONARY(DESTROYED_MINE_SIG,   &l_ship);
    return QM_INITIAL(&Ship_active_s, &act_[0]);
}
Beispiel #12
0
/* @(/2/1/4/1) .............................................................*/
static QState Ship_active_i(Ship * const me) {
    return QM_INITIAL(&Ship_parked_s, &QMsm_emptyAction_[0]);
}