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