CHANGE: Changed setup of running & commit.
Now: claim(A,Commit,B,data) => claim(B,Running,A,data) and also B is running the right protocol and role.
This commit is contained in:
parent
b01bfc4dcd
commit
f883499d07
44
src/claim.c
44
src/claim.c
@ -771,6 +771,14 @@ arachne_claim_weakagree (const System sys, const int claim_run,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Test commit(X) => running(X)
|
//! Test commit(X) => running(X)
|
||||||
|
/**
|
||||||
|
* To be precise:
|
||||||
|
*
|
||||||
|
* for all claim(a,Commit,b,data) =>
|
||||||
|
* claim(b,Running,a,data)#rid and role(rid) == ROLE(b in claim role spec)
|
||||||
|
*
|
||||||
|
* For now we assume data is non-empty
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
arachne_claim_commit (const System sys, const int claim_run,
|
arachne_claim_commit (const System sys, const int claim_run,
|
||||||
const int claim_index)
|
const int claim_index)
|
||||||
@ -779,8 +787,17 @@ arachne_claim_commit (const System sys, const int claim_run,
|
|||||||
|
|
||||||
int run;
|
int run;
|
||||||
Roledef rd_claim;
|
Roledef rd_claim;
|
||||||
|
Term actor_a;
|
||||||
|
Term actor_b;
|
||||||
|
Term partner_role;
|
||||||
|
Termlist params_a;
|
||||||
|
|
||||||
rd_claim = roledef_shift (sys->runs[claim_run].start, claim_index);
|
rd_claim = roledef_shift (sys->runs[claim_run].start, claim_index);
|
||||||
|
params_a = tuple_to_termlist(rd_claim->message);
|
||||||
|
actor_a = rd_claim->from;
|
||||||
|
actor_b = params_a->term;
|
||||||
|
partner_role = termLeft(rd_claim->claiminfo->parameter);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Iterate over all preceding events (include claim run for consistency with formal definition)
|
* Iterate over all preceding events (include claim run for consistency with formal definition)
|
||||||
*/
|
*/
|
||||||
@ -803,10 +820,30 @@ arachne_claim_commit (const System sys, const int claim_run,
|
|||||||
// (Check: maybe below can also be rd->to)
|
// (Check: maybe below can also be rd->to)
|
||||||
if (isTermEqual (rd->claiminfo->type, CLAIM_Running))
|
if (isTermEqual (rd->claiminfo->type, CLAIM_Running))
|
||||||
{
|
{
|
||||||
if (isTermEqual (rd->message, rd_claim->message))
|
// Now check whether they match up nicely
|
||||||
|
// protocols should be the same
|
||||||
|
if (sys->current_claim->protocol == rd->claiminfo->protocol)
|
||||||
{
|
{
|
||||||
// Claim holds
|
Termlist params_b;
|
||||||
return true;
|
|
||||||
|
params_b = tuple_to_termlist(rd->message);
|
||||||
|
// check agent requirements
|
||||||
|
if (isTermEqual(rd->from,actor_b) && isTermEqual(params_b->term,actor_a))
|
||||||
|
{
|
||||||
|
// check role (also same protocol)
|
||||||
|
if (isTermEqual(partner_role,rd->claiminfo->rolename))
|
||||||
|
{
|
||||||
|
// check parameters
|
||||||
|
if (isTermlistEqual (params_a->next,params_b->next))
|
||||||
|
{
|
||||||
|
// Claim holds
|
||||||
|
termlistDelete(params_b);
|
||||||
|
termlistDelete(params_a);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
termlistDelete(params_b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -814,6 +851,7 @@ arachne_claim_commit (const System sys, const int claim_run,
|
|||||||
rd = rd->next;
|
rd = rd->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
termlistDelete(params_a);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
26
src/dotout.c
26
src/dotout.c
@ -27,6 +27,7 @@
|
|||||||
#include "type.h"
|
#include "type.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
#include "specialterm.h"
|
||||||
|
|
||||||
extern Protocol INTRUDER; // Pointers, to be set by the Init of arachne.c
|
extern Protocol INTRUDER; // Pointers, to be set by the Init of arachne.c
|
||||||
extern Role I_M; // Same here.
|
extern Role I_M; // Same here.
|
||||||
@ -607,6 +608,10 @@ isCommunicationExact (const System sys, Binding b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Ignore some events
|
//! Ignore some events
|
||||||
|
/**
|
||||||
|
* Used only in graph drawing. Return true to ignore, return false to
|
||||||
|
* draw.
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
isEventIgnored (const System sys, int run, int ev)
|
isEventIgnored (const System sys, int run, int ev)
|
||||||
{
|
{
|
||||||
@ -615,17 +620,28 @@ isEventIgnored (const System sys, int run, int ev)
|
|||||||
rd = eventRoledef (sys, run, ev);
|
rd = eventRoledef (sys, run, ev);
|
||||||
if (rd->type == CLAIM)
|
if (rd->type == CLAIM)
|
||||||
{
|
{
|
||||||
if (run != 0)
|
// If we are doing a reachability analysis, show all
|
||||||
|
if (isTermEqual(sys->current_claim->type, CLAIM_Reachable))
|
||||||
{
|
{
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
// If the claim type is commit, we also show running claims
|
||||||
|
if (isTermEqual(sys->current_claim->type, CLAIM_Commit) || isTermEqual(sys->current_claim->type, CLAIM_Reachable))
|
||||||
{
|
{
|
||||||
if (ev != sys->current_claim->ev)
|
if (isTermEqual(rd->claiminfo->type, CLAIM_Running))
|
||||||
{
|
{
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Remaining cases: only active claim is shown
|
||||||
|
if (run == 0)
|
||||||
|
{
|
||||||
|
if (ev == sys->current_claim->ev)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -925,6 +925,17 @@ tuple_to_termlist (Term t)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Get the leftmost term of a tuple (e.g. a non-tuple)
|
||||||
|
Term termLeft(Term t)
|
||||||
|
{
|
||||||
|
t = deVar(t);
|
||||||
|
if (realTermTuple (t))
|
||||||
|
{
|
||||||
|
return termLeft(TermOp1 (t));
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
//! Remove all items from tlbig that occur in tlsmall, and return the pointer to the new tlbig.
|
//! Remove all items from tlbig that occur in tlsmall, and return the pointer to the new tlbig.
|
||||||
Termlist
|
Termlist
|
||||||
termlistMinusTermlist (const Termlist tlbig, const Termlist tlsmall)
|
termlistMinusTermlist (const Termlist tlbig, const Termlist tlsmall)
|
||||||
|
@ -77,6 +77,7 @@ int termlistOrder (Termlist tl1, Termlist tl2);
|
|||||||
int termlist_iterate (Termlist tl, int (*func) ());
|
int termlist_iterate (Termlist tl, int (*func) ());
|
||||||
Term termlist_to_tuple (Termlist tl);
|
Term termlist_to_tuple (Termlist tl);
|
||||||
Termlist tuple_to_termlist (Term t);
|
Termlist tuple_to_termlist (Term t);
|
||||||
|
Term termLeft(Term t);
|
||||||
Termlist termlistMinusTermlist (const Termlist tlbig, const Termlist tlsmall);
|
Termlist termlistMinusTermlist (const Termlist tlbig, const Termlist tlsmall);
|
||||||
|
|
||||||
#define TERMLISTADD(l,t) l = termlistAdd (l,t)
|
#define TERMLISTADD(l,t) l = termlistAdd (l,t)
|
||||||
|
Loading…
Reference in New Issue
Block a user