generator sample of no use
authorVolker Birk <vb@pep-project.org>
Thu, 05 May 2016 13:46:01 +0200
changeset 57726ebb2727295
parent 576 ebd20b67dbdd
child 578 b313077e13f2
generator sample of no use
sync/Makefile
sync/gen_statemachine.ysl2
     1.1 --- a/sync/Makefile	Wed May 04 21:37:19 2016 +0200
     1.2 +++ b/sync/Makefile	Thu May 05 13:46:01 2016 +0200
     1.3 @@ -1,2 +1,10 @@
     1.4 +sync_fsm.c: sync.fsm gen_statemachine.ysl2
     1.5 +	yml2proc -y gen_statemachine.ysl2 $< -o $@
     1.6 +
     1.7  sync.xml: sync.fsm fsm.yml2
     1.8  	yml2proc -P sync.fsm -o sync.xml
     1.9 +
    1.10 +.PHONY: clean
    1.11 +
    1.12 +clean:
    1.13 +	rm -f *.xml *.c
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/sync/gen_statemachine.ysl2	Thu May 05 13:46:01 2016 +0200
     2.3 @@ -0,0 +1,35 @@
     2.4 +// generate state machine code
     2.5 +
     2.6 +// Copyleft (c) 2016, p≡p foundation
     2.7 +
     2.8 +// Written by Volker Birk
     2.9 +
    2.10 +include yslt.yml2
    2.11 +
    2.12 +tstylesheet {
    2.13 +    template "/protocol/fsm"
    2.14 +    ||
    2.15 +    // state machine for «@name»
    2.16 +
    2.17 +    #include "pEpEngine.h"
    2.18 +
    2.19 +
    2.20 +    void sm_«@name»(«@name»_state state)
    2.21 +    {
    2.22 +        switch (state) {
    2.23 +            `` apply "state"
    2.24 +        }
    2.25 +    }
    2.26 +
    2.27 +    ||
    2.28 +
    2.29 +    template "state"
    2.30 +    ||
    2.31 +    case «@name»:
    2.32 +        // bla
    2.33 +        break;
    2.34 +
    2.35 +    ||
    2.36 +}
    2.37 +
    2.38 +