New version 3.6 has support for activity diagrams

There are two diagrams that can be used to express dynamic behaviour in the UML. State machine diagrams express the states of an object and the events and transitions to change the state. In contrast activity diagrams (aka flow diagrams) describe the control flow of an algorithm. The great thing of both types of diagrams is that they allow to generate 100% code out of the model description.

The latest version of the sinelabore code generator can now also generate code from activity diagrams. Activity diagrams consist of the following elements:

In addition to this basic elements UML activity diagrams also allow to model loops and decisions.

To generate code from an activity diagram just call the code generator with the new command line parameter -A. The other command line parameters are still the same. Use the -t parameter to define the path in the model file to the class containing the activity. And -l for the target language.

Presently the code generator only supports XMI files exported from Enterprise Architect models and can only generate C code.

The following figure shows a fictitious activity diagram with all the elements presently supported from the code generator.

The code generator supports several configuration parameters that can be specified in the codegen.cfg file. The parameters are:

To generate code from the above example diagram call the code generator the following way:

java -jar codegen.jar -A -p EA -o testcase -t “Model:test:class_with_activities” testcase.xml

The generated c-file can be found here. Due the way the algorithm is generated (based on a while loop with switch / case statements) all kinds of loops including back links can be generated without problem. For the shown diagram the generated code contains just 180 lines of code including empty lines and some documentation.

⇒The activity generator backend is still under development. Error handling and parser robustness must be increased. Additionally sections about the activity generator must be added to the manual.

Nevertheless the generator can already be used for real word applications. Please give it a try! Your feedback is very welcome.


Beside the activity generator backend the new version also contains several improvements in the state machine generator. In addition support for transitions from initial states to choice states in Java was added.

Have fun!