sync/gen_statemachine.ysl2
changeset 577 26ebb2727295
child 578 b313077e13f2
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/sync/gen_statemachine.ysl2	Thu May 05 13:46:01 2016 +0200
     1.3 @@ -0,0 +1,35 @@
     1.4 +// generate state machine code
     1.5 +
     1.6 +// Copyleft (c) 2016, p≡p foundation
     1.7 +
     1.8 +// Written by Volker Birk
     1.9 +
    1.10 +include yslt.yml2
    1.11 +
    1.12 +tstylesheet {
    1.13 +    template "/protocol/fsm"
    1.14 +    ||
    1.15 +    // state machine for «@name»
    1.16 +
    1.17 +    #include "pEpEngine.h"
    1.18 +
    1.19 +
    1.20 +    void sm_«@name»(«@name»_state state)
    1.21 +    {
    1.22 +        switch (state) {
    1.23 +            `` apply "state"
    1.24 +        }
    1.25 +    }
    1.26 +
    1.27 +    ||
    1.28 +
    1.29 +    template "state"
    1.30 +    ||
    1.31 +    case «@name»:
    1.32 +        // bla
    1.33 +        break;
    1.34 +
    1.35 +    ||
    1.36 +}
    1.37 +
    1.38 +