sync/gen_dot.ysl2
author Volker Birk <vb@pep-project.org>
Thu, 06 Jun 2019 12:43:13 +0200
branchsync
changeset 3809 d40dc7086275
parent 2829 e444c3c960bb
child 3810 ff9655d83074
permissions -rw-r--r--
...
     1 // This file is under GNU General Public License 3.0
     2 // see LICENSE.txt
     3 
     4 include yslt.yml2
     5 
     6 tstylesheet {
     7     template "protocol/fsm" document "{@name}.dot", "text"
     8     ||
     9     digraph finite_state_machine {
    10         rankdir=LR;
    11         node [shape = doublecircle];
    12         End;
    13         node [shape = circle];
    14 
    15         `` apply "state" mode=do
    16     }
    17     ||
    18 
    19     template "state", mode=do apply "event", 0 with "state", "@name";
    20 
    21     template "event" {
    22         param "state";
    23         choose {
    24             when "count(transition) > 0"
    25                 apply "transition|condition/transition", 0
    26                     with "state", "$state", with "event", "@name";
    27             otherwise
    28                 if "@name != 'Init'"
    29                     | «$state» -> «$state» [ label="«@name»" ];
    30         }
    31     }
    32 
    33     template "transition" {
    34         param "state";
    35         param "event";
    36 
    37         | «$state» -> «@target» [ label ="«$event»" ];
    38     }
    39 }
    40