1 // This file is under GNU General Public License 3.0
4 // generate conditions and actions
6 // Copyleft (c) 2017, 2018, 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)
46 if (t1->size > t2->size)
48 if (t2->size > t1->size)
51 for (int i=0; i<t1->size; i++) {
52 if (t1->buf[i] > t2->buf[i])
54 if (t2->buf[i] > t1->buf[i])
62 apply "func:distinctName(//condition)", 0;
63 apply "func:distinctName(//action)", 0;
64 callTimeoutHandler KeySync;
68 template "condition" | #error condition «@name» not implemented\n
69 template "action" | #error action «@name» not implemented\n
71 function "condition" {
74 PEP_STATUS «@name»(PEP_SESSION session, bool *result)
76 assert(session && result);
77 if (!(session && result))
78 return PEP_ILLEGAL_VALUE;
93 PEP_STATUS «@name»(PEP_SESSION session)
97 return PEP_ILLEGAL_VALUE;
103 return PEP_STATUS_OK;