reverting no less nice looking but working version :-/
authorVolker Birk <vb@pep-project.org>
Tue, 12 Jul 2016 18:41:16 +0200
changeset 850d8da56e8da8b
parent 849 8e53eacacca0
child 851 817221f84763
reverting no less nice looking but working version :-/
sync/gen_actions_skeleton.ysl2
     1.1 --- a/sync/gen_actions_skeleton.ysl2	Tue Jul 12 16:43:45 2016 +0200
     1.2 +++ b/sync/gen_actions_skeleton.ysl2	Tue Jul 12 18:41:16 2016 +0200
     1.3 @@ -12,26 +12,21 @@
     1.4      template "/protocol/fsm" document "../src/{@filename}_actions.c.skeleton", "text" {
     1.5          const "name", "@name";
     1.6          const "filename", "@filename";
     1.7 -        ||
     1.8 -        // Actions for «@name» state machine
     1.9 +    ||
    1.10 +    // Actions for «@name» state machine
    1.11  
    1.12 -        #include <assert.h>
    1.13 -        #include "pEp_internal.h"
    1.14 -        #include "keymanagement.h"
    1.15 -        #include "message.h"
    1.16 -        #include "«@filename»_fsm.h"
    1.17 -        #include "baseprotocol.h"
    1.18 -        #include "map_asn1.h"
    1.19 -        ||
    1.20 -        for "func:distinctName(//action)"
    1.21 -            if "substring(@name, 1, 4) = 'send'"
    1.22 -                | #include "../asn.1/«substring(@name, 5, 255)».h"
    1.23 -        |
    1.24 -        for "func:distinctName(//action)"
    1.25 -            call "action"
    1.26 -                with "action", ".",
    1.27 -                with "fsm", "$name",
    1.28 -                with "filename", "$filename";
    1.29 +    #include <assert.h>
    1.30 +    #include "pEp_internal.h"
    1.31 +    #include "keymanagement.h"
    1.32 +    #include "message.h"
    1.33 +    #include "«@filename»_fsm.h"
    1.34 +    #include "baseprotocol.h"
    1.35 +    #include "map_asn1.h"
    1.36 +    `` for "func:distinctName(//action)" if "substring(@name, 1, 4) = 'send'" | #include "../asn.1/«substring(@name, 5, 255)».h"
    1.37 +
    1.38 +    `` for "func:distinctName(//action)" call "action" with "action", ".", with "fsm", "$name", with "filename", "$filename";
    1.39 +
    1.40 +    ||
    1.41      }
    1.42  
    1.43      function "action" {
    1.44 @@ -168,15 +163,15 @@
    1.45                  goto error;
    1.46              if (Identity_from_Struct(me, &msg->me) == NULL)
    1.47                  goto enomem;
    1.48 -            if "parm or $name='OwnKeys'" |
    1.49 -            if "parm/partner"   |> if (Identity_from_Struct(partner, &msg->partner) == NULL)
    1.50 -            if "parm/partner"   |>> goto enomem;
    1.51 -            if "$name='OwnKeys'"|> stringlist_t *sl;
    1.52 -            if "$name='OwnKeys'"|> status = own_key_retrieve(session, &sl);
    1.53 -            if "$name='OwnKeys'"|> if (status != PEP_STATUS_OK)
    1.54 -            if "$name='OwnKeys'"|>> goto error;
    1.55 -            if "$name='OwnKeys'"|> if (KeyList_from_stringlist(sl, &msg->keylist) == NULL)
    1.56 -            if "$name='OwnKeys'"|>> goto enomem;
    1.57 +         `` if "parm or $name='OwnKeys'" |
    1.58 +         `` if "parm/partner"   |> if (Identity_from_Struct(partner, &msg->partner) == NULL)
    1.59 +         `` if "parm/partner"   |>> goto enomem;
    1.60 +         `` if "$name='OwnKeys'"|> stringlist_t *sl;
    1.61 +         `` if "$name='OwnKeys'"|> status = own_key_retrieve(session, &sl);
    1.62 +         `` if "$name='OwnKeys'"|> if (status != PEP_STATUS_OK)
    1.63 +         `` if "$name='OwnKeys'"|>> goto error;
    1.64 +         `` if "$name='OwnKeys'"|> if (KeyList_from_stringlist(sl, &msg->keylist) == NULL)
    1.65 +         `` if "$name='OwnKeys'"|>> goto enomem;
    1.66  
    1.67              if (asn_check_constraints(&asn_DEF_«$name», msg, NULL, NULL)) {
    1.68                  status = PEP_CONTRAINTS_VIOLATED;