DUI_FSM_H #ifndef #define DUI_FSM_H #ifdef the __cplusplus extern "C" { #endif // finite state machine implementation // [current state] perform the [operation] The [trigger event] and into [next state] typedef struct { // trigger event int event; // current status int cur_state; // perform an action void (action *) (void * UserData); // next state int next_state; } dui_fsm_transfer_t; typedef struct { // current status int cur_state; // state transition table dui_fsm_transfer_t * T; // size of the state transition table int t_size; } dui_fsm_t; void dui_fsm_handle (dui_fsm_t * Self, Event int, void * UserData); #ifdef the __cplusplus } #endif #endif