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