?? fsm.h
字號:
#ifndef FSM_H#define FSM_H#define MAX_SYMBOL_LEN 40/** * typedef of the callback function pointer type, * every callback function must be declared like: * void callback(const unsigned char *resource); */typedef void (*callback_ptr)(const unsigned char *resource);/** * an entry in the function table, see sample.c for detailed usage */struct func_table{ unsigned char symbol[MAX_SYMBOL_LEN]; callback_ptr func;};/** * we simply declare the existence of struct FSM here. the defination * is not exposed to end user */struct FSM;/** * create an FSM based on specified configuration file and function * table, return NULL on error */struct FSM *fsm_load(const unsigned char *filename, const struct func_table *funcv, int funcc);/** * trigger an event, callback function will be called and state will * be switched automatically, return zero on success */int fsm_doevent(struct FSM *fsm, const unsigned char *event);/** * switch to given state directly, without invoking callback functions */voidfsm_setstate(struct FSM *fsm, const unsigned char *state);/** * release an FSM created using fsm_load or fsm_create */void fsm_free(struct FSM *fsm);/** * create an empty FSM */struct FSM *fsm_create(const struct func_table *funcv, int funcc);/** * add an state transition rule to the given FSM */intfsm_add(struct FSM *fsm, const unsigned char *state, const unsigned char *event, const unsigned char *next, const unsigned char *func, const unsigned char *resource);#endif /* #ifdef FSM_H */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -