GithubHelp home page GithubHelp logo

quantumleaps / state-oriented-programming Goto Github PK

View Code? Open in Web Editor NEW
34.0 6.0 17.0 782 KB

State-Oriented Programming: was a cover story article about Hierarchical State Machines in C and C++ published originally in "Embedded Systems Programming" magazine in August 2000. This repository contains the article PDF and the updated code.

Home Page: https://www.state-machine.com/doc/an#HSM

License: Apache License 2.0

C 50.94% Batchfile 0.57% C++ 48.49%
state-machine statecharts hierarchical-state-machine cpp c

state-oriented-programming's Issues

Unable to compile the C++ example on Ubuntu 22.04 and g++ 11.4.0

The error message is:

 g++ watch.cpp hsm.cpp -o watch
watch.cpp: In constructor ‘Watch::Watch()’:
watch.cpp:209:28: error: cannot convert ‘Watch::topHndlr’ from type ‘const Msg* (Watch::)(const Msg*)’ to type ‘EvtHndlr’ {aka ‘const Msg* (Hsm::*)(const Msg*)’}
  209 |   : Hsm("Watch", (EvtHndlr)topHndlr),
      |                            ^~~~~~~~
hsm.cpp: In member function ‘void Hsm::onStart()’:

The C examples compiles & works just fine

This HSM implementation is still relevant and beautiful in its simplicity (and not just for embedded) . My C++ is very basic, how can the code be fixed to work on modern g++?

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.