- Re-indented the files.

This commit is contained in:
ccremers 2004-11-16 12:07:55 +00:00
parent a38925c9c2
commit 506e42f841
18 changed files with 518 additions and 479 deletions

View File

@ -188,7 +188,8 @@ int
isTermFunctionName (Term t) isTermFunctionName (Term t)
{ {
t = deVar (t); t = deVar (t);
if (t != NULL && isTermLeaf(t) && t->stype != NULL && inTermlist (t->stype, TERM_Function)) if (t != NULL && isTermLeaf (t) && t->stype != NULL
&& inTermlist (t->stype, TERM_Function))
return 1; return 1;
return 0; return 0;
} }
@ -561,7 +562,9 @@ bind_existing_to_goal (const Binding b, const int run, const int index)
} }
} }
/* add the key as a goal */ /* add the key as a goal */
newgoals = newgoals + goal_add (tl->term, b->run_to, b->ev_to, prioritylevel); newgoals =
newgoals + goal_add (tl->term, b->run_to, b->ev_to,
prioritylevel);
tl = tl->next; tl = tl->next;
} }
@ -720,7 +723,8 @@ dotSemiState ()
goal_graph_create (); // create graph goal_graph_create (); // create graph
if (warshall (graph, nodes) == 0) // determine closure if (warshall (graph, nodes) == 0) // determine closure
{ {
eprintf ("// This graph was not completely closed transitively because it contains a cycle!\n"); eprintf
("// This graph was not completely closed transitively because it contains a cycle!\n");
} }
ranks = memAlloc (nodes * sizeof (int)); ranks = memAlloc (nodes * sizeof (int));
@ -757,8 +761,7 @@ dotSemiState ()
ev2 = 0; ev2 = 0;
while (ev2 < sys->runs[run2].length) while (ev2 < sys->runs[run2].length)
{ {
if (graph[graph_nodes (nodes, run2, ev2, run, ev)] if (graph[graph_nodes (nodes, run2, ev2, run, ev)] != 0)
!= 0)
{ {
if (notfirstev) if (notfirstev)
eprintf (","); eprintf (",");
@ -996,7 +999,8 @@ dotSemiState ()
eprintf (" "); eprintf (" ");
// decide color // decide color
rd = roledef_shift (sys->runs[run].start, ev); rd = roledef_shift (sys->runs[run].start, ev);
rd2 = roledef_shift (sys->runs[run2].start,ev2); rd2 =
roledef_shift (sys->runs[run2].start, ev2);
if (rd->type == CLAIM) if (rd->type == CLAIM)
{ {
// Towards a claim, so only indirect dependency // Towards a claim, so only indirect dependency
@ -1009,9 +1013,13 @@ dotSemiState ()
if (rd->type == READ && rd2->type == SEND) if (rd->type == READ && rd2->type == SEND)
{ {
// We want to distinguish where it is from a 'broken' send // We want to distinguish where it is from a 'broken' send
if (isTermEqual (rd->message, rd2->message)) if (isTermEqual
(rd->message, rd2->message))
{ {
if (isTermEqual (rd->from, rd2->from) && isTermEqual (rd->to, rd2->to)) if (isTermEqual
(rd->from, rd2->from)
&& isTermEqual (rd->to,
rd2->to))
{ {
// Wow, a perfect match. Leave the arrow as-is :) // Wow, a perfect match. Leave the arrow as-is :)
eprintf ("[color=forestgreen]"); eprintf ("[color=forestgreen]");
@ -1019,13 +1027,15 @@ dotSemiState ()
else else
{ {
// Same message, different people // Same message, different people
eprintf ("[label=\"redirect\",color=darkorange2]"); eprintf
("[label=\"redirect\",color=darkorange2]");
} }
} }
else else
{ {
// Not even the same message, intruder construction // Not even the same message, intruder construction
eprintf ("[label=\"construct\",color=red]"); eprintf
("[label=\"construct\",color=red]");
} }
} }
} }
@ -1039,7 +1049,8 @@ dotSemiState ()
run3--; run3--;
ev3--; ev3--;
eprintf ("\t// HIDDEN r%ii%i -> r%ii%i because route through r%ii%i\n", eprintf
("\t// HIDDEN r%ii%i -> r%ii%i because route through r%ii%i\n",
run2, ev2, run, ev, run3, ev3); run2, ev2, run, ev, run3, ev3);
} }
@ -1481,7 +1492,8 @@ bind_goal_regular_run (const Binding b)
} }
#endif #endif
if (!termMguSubTerm if (!termMguSubTerm
(b->term, rd->message, test_sub_unification, sys->know->inverses, NULL)) (b->term, rd->message, test_sub_unification, sys->know->inverses,
NULL))
{ {
int sflag; int sflag;
@ -1670,7 +1682,9 @@ prune_theorems ()
{ {
error ("Agent of run %i is NULL", run); error ("Agent of run %i is NULL", run);
} }
if (!realTermLeaf (agent) || (agent->stype != NULL && !inTermlist (agent->stype, TERM_Agent))) if (!realTermLeaf (agent)
|| (agent->stype != NULL
&& !inTermlist (agent->stype, TERM_Agent)))
{ {
if (sys->output == PROOF) if (sys->output == PROOF)
{ {
@ -1730,7 +1744,9 @@ prune_theorems ()
if (sys->output == PROOF) if (sys->output == PROOF)
{ {
indentPrint (); indentPrint ();
eprintf ("Pruned because the actor of run %i is untrusted.\n", run); eprintf
("Pruned because the actor of run %i is untrusted.\n",
run);
} }
return 1; return 1;
} }
@ -1847,7 +1863,8 @@ prune_bounds ()
if (sys->output == PROOF) if (sys->output == PROOF)
{ {
indentPrint (); indentPrint ();
eprintf ("Pruned: proof tree too deep: %i (-l %i switch)\n", proofDepth, sys->switch_maxtracelength); eprintf ("Pruned: proof tree too deep: %i (-l %i switch)\n",
proofDepth, sys->switch_maxtracelength);
} }
return 1; return 1;
} }

View File

@ -250,20 +250,28 @@ goal_graph_create ()
else else
{ {
// It doesn't occur first in a READ, which shouldn't be happening // It doesn't occur first in a READ, which shouldn't be happening
if (sys->output == PROOF) if (sys->output ==
PROOF)
{ {
eprintf ("Term "); eprintf
("Term ");
termPrint (t2); termPrint (t2);
eprintf (" from run %i occurs in run %i, term ", eprintf
(" from run %i occurs in run %i, term ",
run2, run); run2, run);
termPrint (t); termPrint (t);
eprintf (" before it is read?\n"); eprintf
(" before it is read?\n");
} }
// Thus, we create an artificial loop // Thus, we create an artificial loop
if (sys->runs[0].step > 1) if (sys->runs[0].
step > 1)
{ {
// This forces a loop, and thus prunes // This forces a loop, and thus prunes
graph[graph_nodes (nodes, 0,1, 0,0)] = 1; graph
[graph_nodes
(nodes, 0, 1,
0, 0)] = 1;
} }
} }
} }
@ -425,9 +433,7 @@ goal_add (Term term, const int run, const int ev, const int level)
Binding b; Binding b;
b = (Binding) data; b = (Binding) data;
if (isTermEqual (b->term, term) && if (isTermEqual (b->term, term) && run == b->run_to && ev == b->ev_to)
run == b->run_to &&
ev == b->ev_to)
{ // abort scan, report { // abort scan, report
return 0; return 0;
} }

View File

@ -3,7 +3,9 @@
int check_claim_nisynch (const System sys, const int i); int check_claim_nisynch (const System sys, const int i);
int check_claim_niagree (const System sys, const int i); int check_claim_niagree (const System sys, const int i);
int arachne_claim_niagree (const System sys, const int claim_run, const int claim_index); int arachne_claim_niagree (const System sys, const int claim_run,
int arachne_claim_nisynch (const System sys, const int claim_run, const int claim_index); const int claim_index);
int arachne_claim_nisynch (const System sys, const int claim_run,
const int claim_index);
#endif #endif

View File

@ -404,8 +404,7 @@ commEvent (int event, Tac tc)
{ {
/* we already had this label constant */ /* we already had this label constant */
/* leaves a garbage tuple. dunnoh what to do with it */ /* leaves a garbage tuple. dunnoh what to do with it */
label = label = makeTermTuple (thisProtocol->nameterm, label);
makeTermTuple (thisProtocol->nameterm, label);
} }
} }
/** /**
@ -441,7 +440,9 @@ commEvent (int event, Tac tc)
{ {
/* set sendrole */ /* set sendrole */
if (!isTermEqual (fromrole, thisRole->nameterm)) if (!isTermEqual (fromrole, thisRole->nameterm))
error ("Send role does not correspond to execution role at line %i.", tc->lineno); error
("Send role does not correspond to execution role at line %i.",
tc->lineno);
if (linfo->sendrole != NULL) if (linfo->sendrole != NULL)
error ("Label defined twice for sendrole!"); error ("Label defined twice for sendrole!");
linfo->sendrole = fromrole; linfo->sendrole = fromrole;
@ -456,7 +457,9 @@ commEvent (int event, Tac tc)
// READ // READ
/* set readrole */ /* set readrole */
if (!isTermEqual (torole, thisRole->nameterm)) if (!isTermEqual (torole, thisRole->nameterm))
error ("Read role does not correspond to execution role at line %i.", tc->lineno); error
("Read role does not correspond to execution role at line %i.",
tc->lineno);
if (linfo->readrole != NULL) if (linfo->readrole != NULL)
error ("Label defined twice for readrole!"); error ("Label defined twice for readrole!");
linfo->readrole = torole; linfo->readrole = torole;
@ -540,7 +543,8 @@ commEvent (int event, Tac tc)
cl->rolename = fromrole; cl->rolename = fromrole;
cl->role = thisRole; cl->role = thisRole;
if (!isTermEqual (fromrole, thisRole->nameterm)) if (!isTermEqual (fromrole, thisRole->nameterm))
error ("Claim role does not correspond to execution role at line %i.", tc->lineno); error ("Claim role does not correspond to execution role at line %i.",
tc->lineno);
cl->roledef = NULL; cl->roledef = NULL;
cl->count = 0; cl->count = 0;
cl->complete = 0; cl->complete = 0;
@ -977,7 +981,8 @@ order_label_roles (const Claimlist cl)
#endif #endif
roles_remaining = termlistShallow (cl->roles); roles_remaining = termlistShallow (cl->roles);
roles_ordered = termlistAdd (NULL, cl->rolename); roles_ordered = termlistAdd (NULL, cl->rolename);
roles_remaining = termlistDelTerm (termlistFind (roles_remaining, cl->rolename)); roles_remaining =
termlistDelTerm (termlistFind (roles_remaining, cl->rolename));
distance = 0; distance = 0;
while (roles_remaining != NULL) while (roles_remaining != NULL)
@ -1015,7 +1020,9 @@ order_label_roles (const Claimlist cl)
} }
#endif #endif
roles_ordered = termlistAppend (roles_ordered, newrole); roles_ordered = termlistAppend (roles_ordered, newrole);
roles_remaining = termlistDelTerm (termlistFind (roles_remaining, newrole)); roles_remaining =
termlistDelTerm (termlistFind
(roles_remaining, newrole));
} }
} }

View File

@ -9,7 +9,8 @@
#include "system.h" #include "system.h"
//! Create a new labelinfo node //! Create a new labelinfo node
Labelinfo label_create (const Term label, const Protocol protocol) Labelinfo
label_create (const Term label, const Protocol protocol)
{ {
Labelinfo li; Labelinfo li;
@ -22,13 +23,15 @@ Labelinfo label_create (const Term label, const Protocol protocol)
} }
//! Destroy a labelinfo node //! Destroy a labelinfo node
void label_destroy (Labelinfo linfo) void
label_destroy (Labelinfo linfo)
{ {
memFree (linfo, sizeof (struct labelinfo)); memFree (linfo, sizeof (struct labelinfo));
} }
//! Given a list of label infos, yield the correct one or NULL //! Given a list of label infos, yield the correct one or NULL
Labelinfo label_find (List labellist, const Term label) Labelinfo
label_find (List labellist, const Term label)
{ {
Labelinfo linfo; Labelinfo linfo;
@ -55,4 +58,3 @@ Labelinfo label_find (List labellist, const Term label)
} }
return linfo; return linfo;
} }

View File

@ -323,7 +323,8 @@ termMguSubTerm (Term t1, Term t2, int (*iterator) (Termlist, Termlist),
// Recurse // Recurse
flag = flag =
flag && termMguSubTerm (t1, TermOp(t2), iterator, inverses, flag
&& termMguSubTerm (t1, TermOp (t2), iterator, inverses,
keylist_new); keylist_new);
termlistDelete (keylist_new); termlistDelete (keylist_new);

View File

@ -272,8 +272,7 @@ termInTerm (Term t, Term tsub)
if (realTermLeaf (t)) if (realTermLeaf (t))
return 0; return 0;
if (realTermTuple (t)) if (realTermTuple (t))
return (termInTerm (TermOp1(t), tsub) return (termInTerm (TermOp1 (t), tsub) || termInTerm (TermOp2 (t), tsub));
|| termInTerm (TermOp2(t), tsub));
else else
return 0; return 0;
} }
@ -1008,7 +1007,8 @@ term_iterate_deVar (Term term, int (*leaf) (), int (*nodel) (),
else else
flag = flag flag = flag
&& &&
(term_iterate_deVar (TermKey(term), leaf, nodel, nodem, noder)); (term_iterate_deVar
(TermKey (term), leaf, nodel, nodem, noder));
if (noder != NULL) if (noder != NULL)
flag = flag && noder (term); flag = flag && noder (term);
@ -1257,7 +1257,8 @@ termPrintDiff (Term t1, Term t2)
if (realTermEncrypt (t1)) if (realTermEncrypt (t1))
{ {
// Encryption // Encryption
if (isTermEqual (TermOp(t1), TermOp(t2)) || isTermEqual (TermKey(t1), TermKey(t2))) if (isTermEqual (TermOp (t1), TermOp (t2))
|| isTermEqual (TermKey (t1), TermKey (t2)))
{ {
eprintf ("{"); eprintf ("{");
termPrintDiff (TermOp (t1), TermOp (t2)); termPrintDiff (TermOp (t1), TermOp (t2));
@ -1272,7 +1273,8 @@ termPrintDiff (Term t1, Term t2)
else else
{ {
// Tupling // Tupling
if (isTermEqual (TermOp1(t1), TermOp1(t2)) || isTermEqual (TermOp2(t1), TermOp2(t2))) if (isTermEqual (TermOp1 (t1), TermOp1 (t2))
|| isTermEqual (TermOp2 (t1), TermOp2 (t2)))
{ {
eprintf ("("); eprintf ("(");
termPrintDiff (TermOp1 (t1), TermOp1 (t2)); termPrintDiff (TermOp1 (t1), TermOp1 (t2));

View File

@ -111,7 +111,8 @@ warshall (int *graph, int nodes)
/** /**
* Some crude algorithm I sketched on the blackboard. * Some crude algorithm I sketched on the blackboard.
*/ */
int graph_ranks (int *graph, int *ranks, int nodes) int
graph_ranks (int *graph, int *ranks, int nodes)
{ {
int i; int i;
int todo; int todo;
@ -142,7 +143,8 @@ int graph_ranks (int *graph, int *ranks, int nodes)
refn = 0; refn = 0;
while (refn < nodes) while (refn < nodes)
{ {
if (ranks[refn] >= rank && graph[graph_index(refn, n)] != 0) if (ranks[refn] >= rank
&& graph[graph_index (refn, n)] != 0)
refn = nodes + 1; refn = nodes + 1;
else else
refn++; refn++;