Author Topic: EA State Machine C code generator in 600 LOC  (Read 3588 times)

Roman Bretz

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
EA State Machine C code generator in 600 LOC
« on: November 06, 2012, 03:32:29 am »
Alternative approach for EA code-generation-templates. As you know the EA does not generate any C-code for statemachines and the extending of templates for uml behaviors like state machines on your own is very tricky stuff.

Following article describes an alternative approach:
http://blog.lieberlieber.com/2012/11/05/a-custom-uml-state-machine-c-code-generator-in-600-lines/

The article provides very good and very short overview for
- Addin-development
- state machine -> code transformation

The described example needs just 600 lines of C# code. As it is a .NET code you can debug it, trace it, what ever you want and not can using EA templates. The described example supports:
- Primitive state machines
- Signal Triggers
- Composite States
- Entry- and Exit-Actions
- Transition Effects
- Decision Nodes
« Last Edit: November 06, 2012, 03:39:34 am by rbretz »

Roman Bretz

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: EA State Machine C code generator in 600 LOC
« Reply #1 on: November 06, 2012, 03:50:33 am »
try to hover your mouse over the state chart or generated code!

Chrom and Firefox renders the interactive SVG picture correctly and you can visually track the mapping between the parts of the UML state machine and the generated code out of them.

Excepting you use Internet Explorer, then you just see a static picture and have to open SVG picture separately via the link under picture...
« Last Edit: November 06, 2012, 04:01:22 am by rbretz »