Git Product home page Git Product logo

lovelyfsm's People

Contributors

larshei avatar

Watchers

 avatar  avatar

lovelyfsm's Issues

add unit tests for mutliple instances

For now, all unit tests use just a single instance.

Make sure that on creating mutliple instances, the instances are

  • different
  • have their own lookup tables
  • are indepent
  • can be deinitialized and reinitialized

Create readme

Provide an readme to let people know

  • what this does
  • what the strengths are
  • what the weaknesses are
  • how well/bad its tested
  • how its used

Allow reusing lookup tables

One of the strenghts of this state machine is, in theory, that you could

  • define one set of states/transitions tables
  • create mutliple instances based on the same tables
  • that way, you can easily create systems that use the same function multiple times, e.g. handling multiple incoming connections or multiple interfaces of the same type.

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.

Types of event and state are not consistent

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.