Browse Source

nicer and working ;-)

rok-mac
Volker Birk 6 years ago
parent
commit
1e4e7bb7ee
1 changed files with 40 additions and 28 deletions
  1. +40
    -28
      sync/gen_actions_skeleton.ysl2

+ 40
- 28
sync/gen_actions_skeleton.ysl2 View File

@ -12,21 +12,27 @@ tstylesheet {
template "/protocol/fsm" document "../src/{@filename}_actions.c.skeleton", "text" {
const "name", "@name";
const "filename", "@filename";
||
// Actions for «@name» state machine
#include <assert.h>
#include "pEp_internal.h"
#include "keymanagement.h"
#include "message.h"
#include "«@filename»_fsm.h"
#include "baseprotocol.h"
#include "map_asn1.h"
`` for "func:distinctName(//action)" if "substring(@name, 1, 4) = 'send'" | #include "../asn.1/«substring(@name, 5, 255)».h"
`` for "func:distinctName(//action)" call "action" with "action", ".", with "fsm", "$name", with "filename", "$filename";
||
||
// Actions for «@name» state machine
#include <assert.h>
#include "pEp_internal.h"
#include "keymanagement.h"
#include "message.h"
#include "«@filename»_fsm.h"
#include "baseprotocol.h"
#include "map_asn1.h"
||
for "func:distinctName(//action)"
if "substring(@name, 1, 4) = 'send'"
| #include "../asn.1/«substring(@name, 5, 255)».h"
|
for "func:distinctName(//action)"
call "action"
with "action", ".",
with "fsm", "$name",
with "filename", "$filename";
|
}
function "action" {
@ -35,11 +41,15 @@ tstylesheet {
param "filename", "'###'";
choose {
when "substring($action/@name, 1, 4) = 'send'"
call "send_action" with "action", "$action",
with "fsm", "$fsm", with "filename", "$filename";
call "send_action"
with "action", "$action",
with "fsm", "$fsm",
with "filename", "$filename";
otherwise
call "other_action" with "action", "$action",
with "fsm", "$fsm", with "filename", "$filename";
call "other_action"
with "action", "$action",
with "fsm", "$fsm",
with "filename", "$filename";
}
}
@ -163,15 +173,17 @@ tstylesheet {
goto error;
if (Identity_from_Struct(me, &msg->me) == NULL)
goto enomem;
`` if "parm or $name='OwnKeys'" |
`` if "parm/partner" |> if (Identity_from_Struct(partner, &msg->partner) == NULL)
`` if "parm/partner" |>> goto enomem;
`` if "$name='OwnKeys'"|> stringlist_t *sl;
`` if "$name='OwnKeys'"|> status = own_key_retrieve(session, &sl);
`` if "$name='OwnKeys'"|> if (status != PEP_STATUS_OK)
`` if "$name='OwnKeys'"|>> goto error;
`` if "$name='OwnKeys'"|> if (KeyList_from_stringlist(sl, &msg->keylist) == NULL)
`` if "$name='OwnKeys'"|>> goto enomem;
||
if "parm or $name='OwnKeys'" |
if "parm/partner" |> if (Identity_from_Struct(partner, &msg->partner) == NULL)
if "parm/partner" |>> goto enomem;
if "$name='OwnKeys'"|> stringlist_t *sl;
if "$name='OwnKeys'"|> status = own_key_retrieve(session, &sl);
if "$name='OwnKeys'"|> if (status != PEP_STATUS_OK)
if "$name='OwnKeys'"|>> goto error;
if "$name='OwnKeys'"|> if (KeyList_from_stringlist(sl, &msg->keylist) == NULL)
if "$name='OwnKeys'"|>> goto enomem;
||
if (asn_check_constraints(&asn_DEF_«$name», msg, NULL, NULL)) {
status = PEP_CONTRAINTS_VIOLATED;


Loading…
Cancel
Save