NEWS
-----
+- 2013-04-05 The program is working with LLVM and Clang version 3.0 or higher
- 2012-07-11 We have got a new [mailing list][list].
-- 2011-08-11 Added support for orthogonal states.
Authors
--------
Status
-------
-- The program can found states and transitions in the source code. Now it also supports orthogonal states.
-- The program understands all options and flags as the compilers (gcc, clang, ...).
+- The program can found states and transitions in the source code.
+- The program understands all options and flags as the compilers (gcc, clang, ...). The syntax analysis is done by compiler clang.
- State machines can be defined in more than one file.
-- The state machine can be inside many namespaces, but not inside templates.
+- Program provides diagnostics of state machines eg. event usage, missing typedefs for reactions.
For compiling and correctly working program it is necessary to have
-LLVM and clang version 2.9. We are currently trying to update it for
-LLVM 3.1.
+LLVM and clang version 3.0 or higher.
Usage
------
-The program can be used almost the same way as a C compiler. You will
-typically need to specify locations for all header files except of the
-files stored in system folder(in Linux: /usr/...) using `-I` option.
-Of course you can specify the output filename (`-o` option). Program
-displays all diagnostic messages like compilers. If an error occurs
-the program stops.
+The program is plugin for compiler clang. The produced output file has the same name as the input file with source code.
+It is also possible to use script that also produces the state diagram in format pdf. It can be also found in repository.
####Example of command line invocation:
- ./visualizer main.cpp -o graph.dot -I /home/petr/install/
+ clang++ -Xclang -load -Xclang visualizer.so -Xclang -plugin -Xclang visualize-statechart -c file.cpp
The output file can be transformed into the picture using classical
[dot][graphviz] commands (e.g. `dot -Tpng graph.dot -o graph.png`) . The initial
[[Source code|StopWatch.cpp]]
### Camera
+ - Camera example from boost statechart library
+ - State Storing is red because it has no typedef for reactions and it can be error produced by programmer
[[camera.png]]
-[[Source code|StopWatch.cpp]]
+[[Source code|camera.tar.gz]]
### Big
[[big.png]]
struct state_2; // definice stavu
struct state_3; // definice stavu
struct state_4; // definice stavu
-struct EvA : sc::event< EvA > {};//stisteno A
-struct EvN : sc::event< EvN > {};//stisteno N
+struct EvYes : sc::event< EvYes > {};//stisteno A
+struct EvNo : sc::event< EvNo > {};//stisteno N
struct EvTimer : sc::event< EvTimer > {};//vyprsel cas
struct DU : sc::state_machine< DU, state_1 > {};//Nastaveni inicializacniho stavu
state_1() { cout<<"Chcete zformatovat vas disk (a/n) ? \n";}//FSM_Entry
~state_1() {}//FSM_Exit
typedef mpl::list< // reakce na udalosti
- sc::transition< EvA, state_4 >,
- sc::transition< EvN, state_2 > > reactions;
+ sc::transition< EvYes, state_4 >,
+ sc::transition< EvNo, state_2 > > reactions;
};
struct state_2 : sc::simple_state< state_2, DU >
{
}
~state_3() {}
typedef mpl::list<
- sc::transition< EvN, state_1 >,
+ sc::transition< EvNo, state_1 >,
sc::transition< EvTimer, state_4 > > reactions;
};
struct state_4 : sc::simple_state< state_4, DU >
while(1)
{
cin >> s;
- if (s == "n") Zm.process_event (EvN());
- if (s == "a") Zm.process_event (EvA());
+ if (s == "n") Zm.process_event (EvNo());
+ if (s == "a") Zm.process_event (EvYes());
if (s == "exit") break;
}
return NULL;