wlmaker
Loading...
Searching...
No Matches
fsm.h
Go to the documentation of this file.
1/* ========================================================================= */
22#ifndef __WLMTK_FSM_H__
23#define __WLMTK_FSM_H__
24
25#include <libbase/libbase.h>
26#include <stdbool.h>
27#include <stddef.h>
28
29#ifdef __cplusplus
30extern "C" {
31#endif // __cplusplus
32
35
37typedef struct {
39 int state;
41 int event;
45 bool (*handler)(wlmtk_fsm_t *fsm_ptr, void *ud_ptr);
47
55
57#define WLMTK_FSM_TRANSITION_SENTINEL { \
58 .state = -1, \
59 .event = -1, \
60 .to_state = -1, \
61 .handler = NULL, \
62 }
63
72 wlmtk_fsm_t *fsm_ptr,
73 const wlmtk_fsm_transition_t *transitions,
74 int initial_state);
75
91 wlmtk_fsm_t *fsm_ptr,
92 int event,
93 void *ud_ptr);
94
96extern const bs_test_set_t wlmtk_fsm_test_set;
97
98#ifdef __cplusplus
99} // extern "C"
100#endif // __cplusplus
101
102#endif /* __WLMTK_FSM_H__ */
103/* == End of fsm.h ====================================================== */
bool wlmtk_fsm_event(wlmtk_fsm_t *fsm_ptr, int event, void *ud_ptr)
Definition fsm.c:40
void wlmtk_fsm_init(wlmtk_fsm_t *fsm_ptr, const wlmtk_fsm_transition_t *transitions, int initial_state)
Definition fsm.c:30
const bs_test_set_t wlmtk_fsm_test_set
Definition fsm.c:71
Definition fsm.h:49
int state
Definition fsm.h:53
const wlmtk_fsm_transition_t * transitions
Definition fsm.h:51
Definition fsm.h:37
int event
Definition fsm.h:41
int to_state
Definition fsm.h:43
int state
Definition fsm.h:39