How yanten/statemachine works
A compact C library for running finite state machines. A caller defines states, transitions, events, and optional callbacks, initializes a machine, then submits events; the runtime searches the current state and its parents, selects a guarded transition, runs lifecycle/action callbacks, updates state, and reports the outcome. The source excerpt supports the core dispatch and query behavior; no external services or persistence are indicated.
Main entry points: stateMachine.c Event runtime · stateMachine.h FSM API
Components 6
Other components
- Library caller
- FSM model
src/stateMachine.h - FSM API
src/stateMachine.h - Event runtime
src/stateMachine.c - User callbacks
- State and result
src/stateMachine.h
Connections 10
- Library caller → FSM model: defines states
- Library caller → FSM API: initializes machine
- Library caller → FSM API: submits event
- FSM model → Event runtime: configures dispatch
- FSM API → Event runtime: dispatches event
- Event runtime → User callbacks: checks guard
- Event runtime → User callbacks: runs actions
- Event runtime → User callbacks: runs entry/exit
- Event runtime → State and result: updates and reports
- Library caller → State and result: queries state