sync/gen_dot.ysl2
author Krista Bennett <krista@pep-project.org>
Thu, 18 Jan 2018 00:46:19 +0100
changeset 2410 721952accdee
parent 2287 026ab4dae779
child 2829 e444c3c960bb
permissions -rw-r--r--
DANGER! MERGED IN ENGINE-289! SOME DOC BUGS STILL EXIST - USE WITH CARE!!!
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 {
krista@2271
     7
    template "protocol/fsm" document "{@filename}.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
        const "transitions", "transition|descendant::condition/transition|descendant::alternative/transition";
krista@2271
    25
        choose {
krista@2271
    26
            when "count($transitions) > 0"
krista@2271
    27
                apply "$transitions", 0
krista@2271
    28
                    with "state", "$state", with "event", "@name";
krista@2271
    29
            otherwise
krista@2271
    30
                if "@name != 'Init'"
krista@2271
    31
                    | «$state» -> «$state» [ label="«@name»" ];
krista@2271
    32
        }
krista@2271
    33
    }
krista@2271
    34
krista@2271
    35
    template "transition" {
krista@2271
    36
        param "state";
krista@2271
    37
        param "event";
krista@2271
    38
krista@2271
    39
        | «$state» -> «@target» [ label ="«$event»" ];
krista@2271
    40
    }
krista@2271
    41
}
krista@2271
    42