p≡p engine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.1 KiB

  1. // This file is under GNU General Public License 3.0
  2. // see LICENSE.txt
  3. include yslt.yml2
  4. tstylesheet {
  5. template "protocol/fsm" document "{@filename}.dot", "text"
  6. ||
  7. digraph finite_state_machine {
  8. rankdir=LR;
  9. node [shape = doublecircle];
  10. `apply "state[@end='1']" mode=end`;
  11. node [shape = circle];
  12. `` apply "state" mode=do
  13. }
  14. ||
  15. template "state", mode=end > «@name»
  16. template "state", mode=do apply "event", 0 with "state", "@name";
  17. template "event" {
  18. param "state";
  19. const "transitions", "transition|descendant::condition/transition|descendant::alternative/transition";
  20. choose {
  21. when "count($transitions) > 0"
  22. apply "$transitions", 0
  23. with "state", "$state", with "event", "@name";
  24. otherwise
  25. if "@name != 'Init'"
  26. | «$state» -> «$state» [ label="«@name»" ];
  27. }
  28. }
  29. template "transition" {
  30. param "state";
  31. param "event";
  32. | «$state» -> «@target» [ label ="«$event»" ];
  33. }
  34. }