- Consistency improvements.
This commit is contained in:
parent
f219461c8d
commit
74851e0393
@ -277,7 +277,7 @@ add_intruder_goal_iterate (Goal goal)
|
|||||||
//! Bind a goal to an existing regular run, if possible
|
//! Bind a goal to an existing regular run, if possible
|
||||||
int
|
int
|
||||||
bind_existing_run (const Goal goal, const Protocol p, const Role r,
|
bind_existing_run (const Goal goal, const Protocol p, const Role r,
|
||||||
const int index)
|
const int index, const int forced_run)
|
||||||
{
|
{
|
||||||
int run, flag;
|
int run, flag;
|
||||||
|
|
||||||
@ -295,29 +295,32 @@ bind_existing_run (const Goal goal, const Protocol p, const Role r,
|
|||||||
goal.rd->bind_index = index;
|
goal.rd->bind_index = index;
|
||||||
for (run = 0; run < sys->maxruns; run++)
|
for (run = 0; run < sys->maxruns; run++)
|
||||||
{
|
{
|
||||||
if (sys->runs[run].protocol == p && sys->runs[run].role == r)
|
if (forced_run >= 0 && forced_run == run)
|
||||||
{
|
{
|
||||||
int old_length;
|
if (sys->runs[run].protocol == p && sys->runs[run].role == r)
|
||||||
Roledef rd;
|
{
|
||||||
|
int old_length;
|
||||||
|
Roledef rd;
|
||||||
|
|
||||||
// Roledef entry
|
// Roledef entry
|
||||||
rd = roledef_shift (sys->runs[run].start, index);
|
rd = roledef_shift (sys->runs[run].start, index);
|
||||||
|
|
||||||
// mgu and iterate
|
// mgu and iterate
|
||||||
old_length = sys->runs[run].length;
|
old_length = sys->runs[run].length;
|
||||||
if (index >= old_length)
|
if (index >= old_length)
|
||||||
sys->runs[run].length = index + 1;
|
sys->runs[run].length = index + 1;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
explanation = "Bind existing run";
|
explanation = "Bind existing run";
|
||||||
e_run = run;
|
e_run = run;
|
||||||
e_term1 = goal.rd->message;
|
e_term1 = goal.rd->message;
|
||||||
#endif
|
#endif
|
||||||
goal.rd->bind_run = run;
|
goal.rd->bind_run = run;
|
||||||
|
|
||||||
flag = (flag
|
flag = (flag
|
||||||
&& termMguInTerm (goal.rd->message, rd->message,
|
&& termMguInTerm (goal.rd->message, rd->message,
|
||||||
mgu_iterate));
|
mgu_iterate));
|
||||||
sys->runs[run].length = old_length;
|
sys->runs[run].length = old_length;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
goal.rd->bind_run = -1;
|
goal.rd->bind_run = -1;
|
||||||
@ -463,7 +466,7 @@ bind_goal_regular (const Goal goal)
|
|||||||
{
|
{
|
||||||
flag = flag && bind_new_run (goal, p, r, index);
|
flag = flag && bind_new_run (goal, p, r, index);
|
||||||
}
|
}
|
||||||
return (flag && bind_existing_run (goal, p, r, index));
|
return (flag && bind_existing_run (goal, p, r, index, run));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p == INTRUDER)
|
if (p == INTRUDER)
|
||||||
@ -542,7 +545,7 @@ bind_intruder_to_regular (Goal goal)
|
|||||||
{
|
{
|
||||||
flag = flag && bind_new_run (goal, p, r, index);
|
flag = flag && bind_new_run (goal, p, r, index);
|
||||||
}
|
}
|
||||||
flag = flag && bind_existing_run (goal, p, r, index);
|
flag = flag && bind_existing_run (goal, p, r, index, run);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* deconstruct key list goals
|
* deconstruct key list goals
|
||||||
|
@ -68,7 +68,7 @@ __inline__ Term deVarScan (Term t);
|
|||||||
#define realTermLeaf(t) (t != NULL && t->type <= LEAF)
|
#define realTermLeaf(t) (t != NULL && t->type <= LEAF)
|
||||||
#define realTermTuple(t) (t != NULL && t->type == TUPLE)
|
#define realTermTuple(t) (t != NULL && t->type == TUPLE)
|
||||||
#define realTermEncrypt(t) (t != NULL && t->type == ENCRYPT)
|
#define realTermEncrypt(t) (t != NULL && t->type == ENCRYPT)
|
||||||
#define realTermVariable(t) (t != NULL && (t->type == VARIABLE || (rolelocal_variable && t->right.runid == -3)))
|
#define realTermVariable(t) (t != NULL && (t->type == VARIABLE || (t->type <= LEAF && rolelocal_variable && t->right.runid == -3)))
|
||||||
#define substVar(t) ((realTermVariable (t) && t->subst != NULL) ? 1 : 0)
|
#define substVar(t) ((realTermVariable (t) && t->subst != NULL) ? 1 : 0)
|
||||||
#define deVar(t) ( substVar(t) ? deVarScan(t->subst) : t)
|
#define deVar(t) ( substVar(t) ? deVarScan(t->subst) : t)
|
||||||
#define isTermLeaf(t) realTermLeaf(deVar(t))
|
#define isTermLeaf(t) realTermLeaf(deVar(t))
|
||||||
|
Loading…
Reference in New Issue
Block a user