make sync.svg
authorVolker Birk <vb@pep.foundation>
Sun, 20 Nov 2016 12:25:43 +0100
changeset 1409e9bcd6142d54
parent 1405 dbb4866e1b6c
child 1411 25a8f419816d
make sync.svg
.hgignore
sync/Makefile
sync/devicegroup.fsm
sync/gen_dot.ysl2
     1.1 --- a/.hgignore	Wed Nov 16 17:38:27 2016 +0100
     1.2 +++ b/.hgignore	Sun Nov 20 12:25:43 2016 +0100
     1.3 @@ -41,3 +41,6 @@
     1.4  tags
     1.5  asn.1/pEpEngineASN1/pEpEngineASN1.vcxproj.user
     1.6  src/sync_fsm.c
     1.7 +*.xml
     1.8 +*.dot
     1.9 +*.svg
     2.1 --- a/sync/Makefile	Wed Nov 16 17:38:27 2016 +0100
     2.2 +++ b/sync/Makefile	Sun Nov 20 12:25:43 2016 +0100
     2.3 @@ -13,4 +13,13 @@
     2.4  .PHONY: clean
     2.5  
     2.6  clean:
     2.7 -	rm -f *.xml *.xsl ../src/sync_fsm.* ../src/*.skeleton .statemachines .skeletons
     2.8 +	rm -f *.xml *.xsl ../src/sync_fsm.* ../src/*.skeleton .statemachines .skeletons *.dot *.svg
     2.9 +
    2.10 +%.xml: %.fsm
    2.11 +	yml2c $< -o $@
    2.12 +
    2.13 +%.dot: devicegroup.fsm gen_dot.ysl2
    2.14 +	yml2proc -y gen_dot.ysl2 $<
    2.15 +
    2.16 +%.svg: %.dot
    2.17 +	dot -Tsvg -o $@ $<
     3.1 --- a/sync/devicegroup.fsm	Wed Nov 16 17:38:27 2016 +0100
     3.2 +++ b/sync/devicegroup.fsm	Sun Nov 20 12:25:43 2016 +0100
     3.3 @@ -26,7 +26,7 @@
     3.4              }
     3.5          }
     3.6  
     3.7 -        state Sole {
     3.8 +        state Sole end=1 {
     3.9              on KeyGen // injected by generate_keypair()
    3.10                  do sendBeacon;
    3.11              on CannotDecrypt
    3.12 @@ -70,7 +70,7 @@
    3.13              }
    3.14          }
    3.15  
    3.16 -        state Grouped {
    3.17 +        state Grouped end=1 {
    3.18              on Init 
    3.19                  do enterGroup;
    3.20              on KeyGen
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/sync/gen_dot.ysl2	Sun Nov 20 12:25:43 2016 +0100
     4.3 @@ -0,0 +1,38 @@
     4.4 +include yslt.yml2
     4.5 +
     4.6 +tstylesheet {
     4.7 +    template "protocol/fsm" document "{@filename}.dot", "text"
     4.8 +    ||
     4.9 +    digraph finite_state_machine {
    4.10 +        rankdir=LR;
    4.11 +        node [shape = doublecircle];
    4.12 +        `apply "state[@end='1']" mode=end`;
    4.13 +        node [shape = circle];
    4.14 +
    4.15 +        `` apply "state" mode=do
    4.16 +    }
    4.17 +    ||
    4.18 +
    4.19 +    template "state", mode=end > «@name» 
    4.20 +    template "state", mode=do apply "event", 0 with "state", "@name";
    4.21 +
    4.22 +    template "event" {
    4.23 +        param "state";
    4.24 +        choose {
    4.25 +            when "count(transition) > 0"
    4.26 +                apply "transition|condition/transition", 0
    4.27 +                    with "state", "$state", with "event", "@name";
    4.28 +            otherwise
    4.29 +                if "@name != 'Init'"
    4.30 +                    | «$state» -> «$state» [ label="«@name»" ];
    4.31 +        }
    4.32 +    }
    4.33 +
    4.34 +    template "transition" {
    4.35 +        param "state";
    4.36 +        param "event";
    4.37 +
    4.38 +        | «$state» -> «@target» [ label ="«$event»" ];
    4.39 +    }
    4.40 +}
    4.41 +