1 // This file is under GNU General Public License 3.0
4 // generate conditions and actions
6 // Copyleft (c) 2017, p≡p foundation
8 // Written by Volker Birk
12 decl _func *name (*type) alias - {
13 template %name=*name, %type=*type, "%type[@name='%name']"
14 call *type with "content" content;
17 decl condition is _func (*type="condition");
18 decl action is _func (*type="action");
21 include standardlib.ysl2
22 include ./functions.ysl2
24 include ./cond_act_*.yml2
26 template "/protocol" {
27 document "generated/{@name}_actions.c", "text" {
29 // This file is under GNU General Public License 3.0
32 #include "pEp_internal.h"
35 #include "«@name»_impl.h"
36 `` for "fsm" | #include "«@name»_fsm.h"
38 static bool _TID_greater(TID_t *t1, TID_t *t2)
40 if (t1->size > t2->size)
43 if (t2->size > t1->size)
46 for (int i=0; i<t1->size; i++) {
47 if (t1->buf[i] > t2->buf[i])
55 apply "func:distinctName(//condition)", 0;
56 apply "func:distinctName(//action[not(starts-with(@name, 'send'))])", 0;
60 template "condition" | #error condition «@name» not implemented\n
61 template "action" | #error action «@name» not implemented\n
63 function "condition" {
66 PEP_STATUS «@name»(PEP_SESSION session, bool *result)
68 assert(session && result);
69 if (!(session && result))
70 return PEP_ILLEGAL_VALUE;
85 PEP_STATUS «@name»(PEP_SESSION session)
89 return PEP_ILLEGAL_VALUE;