sync/gen_dot.ysl2
author Edouard Tisserant <edouard@pep-project.org>
Mon, 08 May 2017 22:09:00 +0200
changeset 1763 8428975706d9
parent 1709 dcebe0692d63
child 2287 026ab4dae779
permissions -rw-r--r--
Merged
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";
edouard@1709
    24
        const "transitions", "transition|descendant::condition/transition|descendant::alternative/transition";
vb@1409
    25
        choose {
edouard@1709
    26
            when "count($transitions) > 0"
edouard@1709
    27
                apply "$transitions", 0
vb@1409
    28
                    with "state", "$state", with "event", "@name";
vb@1409
    29
            otherwise
vb@1409
    30
                if "@name != 'Init'"
vb@1409
    31
                    | «$state» -> «$state» [ label="«@name»" ];
vb@1409
    32
        }
vb@1409
    33
    }
vb@1409
    34
vb@1409
    35
    template "transition" {
vb@1409
    36
        param "state";
vb@1409
    37
        param "event";
vb@1409
    38
vb@1409
    39
        | «$state» -> «@target» [ label ="«$event»" ];
vb@1409
    40
    }
vb@1409
    41
}
vb@1409
    42