larshei / lovelyfsm Goto Github PK
View Code? Open in Web Editor NEWA multi-instance implementation of a finite state machine in C targeted at good readability and easy maintenance.
License: MIT License
A multi-instance implementation of a finite state machine in C targeted at good readability and easy maintenance.
License: MIT License
For now, all unit tests use just a single instance.
Make sure that on creating mutliple instances, the instances are
Some functions are prefixed with lfsm_, others with fsm_.
Provide an readme to let people know
One of the strenghts of this state machine is, in theory, that you could
On creating a second instance, a user may pass the same transition and function table as previously passed to the first instance.
However, for the second instance the lookup tables will be newly created. Therefore a second lookup table set will be generated that should be identical to the already existing lookup tables from the first instance.
Add an init function that inherits most of the data from an already existing state machine instance.
(basically everything but the user data?)
Make sure to count how many contexts a table is currently being used in.
Free lookup tables once not needed anymore.
Events and states are treated as uint8_t throughout the program logic.
But in
typedef struct lfsm_transitions_t {
int current_state;
int event;
int (*condition)( lfsm_t );
int next_state;
} lfsm_transitions_t;
typedef struct lfsm_state_functions_t {
int state;
lfsm_return_t (*on_entry) ( lfsm_t );
lfsm_return_t (*on_run ) ( lfsm_t );
lfsm_return_t (*on_exit ) ( lfsm_t );
} lfsm_state_functions_t;
they are treated as int
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.