sync/gen_dot.ysl2
changeset 1409 e9bcd6142d54
child 1513 e7f7e42385b5
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/sync/gen_dot.ysl2	Sun Nov 20 12:25:43 2016 +0100
     1.3 @@ -0,0 +1,38 @@
     1.4 +include yslt.yml2
     1.5 +
     1.6 +tstylesheet {
     1.7 +    template "protocol/fsm" document "{@filename}.dot", "text"
     1.8 +    ||
     1.9 +    digraph finite_state_machine {
    1.10 +        rankdir=LR;
    1.11 +        node [shape = doublecircle];
    1.12 +        `apply "state[@end='1']" mode=end`;
    1.13 +        node [shape = circle];
    1.14 +
    1.15 +        `` apply "state" mode=do
    1.16 +    }
    1.17 +    ||
    1.18 +
    1.19 +    template "state", mode=end > «@name» 
    1.20 +    template "state", mode=do apply "event", 0 with "state", "@name";
    1.21 +
    1.22 +    template "event" {
    1.23 +        param "state";
    1.24 +        choose {
    1.25 +            when "count(transition) > 0"
    1.26 +                apply "transition|condition/transition", 0
    1.27 +                    with "state", "$state", with "event", "@name";
    1.28 +            otherwise
    1.29 +                if "@name != 'Init'"
    1.30 +                    | «$state» -> «$state» [ label="«@name»" ];
    1.31 +        }
    1.32 +    }
    1.33 +
    1.34 +    template "transition" {
    1.35 +        param "state";
    1.36 +        param "event";
    1.37 +
    1.38 +        | «$state» -> «@target» [ label ="«$event»" ];
    1.39 +    }
    1.40 +}
    1.41 +