diff --git a/src/claim.c b/src/claim.c index 3b509b5..af4c2af 100644 --- a/src/claim.c +++ b/src/claim.c @@ -15,8 +15,11 @@ /* * Validity checks for claims + * + * Note that the first few operate on claims, and that the tests for e.g. the Arachne engine are seperate. */ + #ifdef OKIDEBUG int indac = 0; @@ -440,3 +443,14 @@ check_claim_niagree (const System sys, const int i) termmapDelete (g); return result; } + + +//! Check arachne agreement claim +/** + * Per default, occurs in run 0, but for generality we have left the run parameter in. + *@returns 1 if the claim is true, 0 if it is not. + */ +int arachne_claim_agree (const System sys, const int claim_run, const int claim_index) +{ +} + diff --git a/src/compiler.c b/src/compiler.c index 93f4419..9832cdb 100644 --- a/src/compiler.c +++ b/src/compiler.c @@ -20,6 +20,19 @@ static System sys; static Tac tac_root; +/* + * Structure to store label information + */ +struct labelinfo +{ + Term label; + Term protocol; + Term sendrole; + Term readrole; +}; + +typedef struct labelinfo Labelinfo; + /* * Declaration from system.c */ @@ -898,6 +911,8 @@ compute_role_variables (const System sys, Protocol p, Role r) * a mapping from all events to event/claim labels. * A second table is used to compute the precedence order, and * Warshall's algorithm is used to compute the transitive closure. + * Then, for each claim, the in the preceding labels occurring roles are stored, + * which is useful later. *@returns For each claim in the claim list, a preceding label set is defined. */ void diff --git a/src/label.c b/src/label.c new file mode 100644 index 0000000..8e4b3f6 --- /dev/null +++ b/src/label.c @@ -0,0 +1,25 @@ +/** + * Label info + */ + +#include "memory.h" +#include "term.h" +#include "label.h" + +Labelinfo label_create (const Term label, const Term protocol) +{ + Labelinfo li; + + li = (Labelinfo) memAlloc (sizeof (struct labelinfo)); + li->label = label; + li->protocol = protocol; + li->sendrole = NULL; + li->readrole = NULL; + return li; +} + +void label_destroy (Labelinfo linfo) +{ + memFree (linfo, sizeof (struct labelinfo)); +} + diff --git a/src/label.h b/src/label.h new file mode 100644 index 0000000..71ed060 --- /dev/null +++ b/src/label.h @@ -0,0 +1,22 @@ +#ifndef LABEL +#define LABEL + +#include "term.h" + +/* + * Structure to store label information + */ +struct labelinfo +{ + Term label; + Term protocol; + Term sendrole; + Term readrole; +}; + +typedef struct labelinfo* Labelinfo; + +Labelinfo label_create (const Term label, const Term protocol); +void label_destroy (Labelinfo linfo); + +#endif diff --git a/src/system.c b/src/system.c index 381632e..d3a3966 100644 --- a/src/system.c +++ b/src/system.c @@ -97,6 +97,7 @@ systemInit () sys->rolecount = 0; sys->roleeventmax = 0; sys->claimlist = NULL; + sys->labellist = NULL; /* matching CLP */ sys->constraints = NULL; // no initial constraints diff --git a/src/system.h b/src/system.h index 9e3c8ee..e9cacff 100644 --- a/src/system.h +++ b/src/system.h @@ -176,6 +176,7 @@ struct system int roleeventmax; //!< Maximum number of events in a single role int lastChooseRun; //!< Last run with a choose event Claimlist claimlist; //!< List of claims in the system, with occurrence counts + List labellist; //!< List of labelinfo stuff /* constructed trace pointers, static */ Roledef *traceEvent; //!< Trace roledefs: MaxRuns * maxRoledef