- 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)
{
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 0;
}
@ -561,7 +562,9 @@ bind_existing_to_goal (const Binding b, const int run, const int index)
}
}
/* 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;
}
@ -720,7 +723,8 @@ dotSemiState ()
goal_graph_create (); // create graph
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));
@ -757,8 +761,7 @@ dotSemiState ()
ev2 = 0;
while (ev2 < sys->runs[run2].length)
{
if (graph[graph_nodes (nodes, run2, ev2, run, ev)]
!= 0)
if (graph[graph_nodes (nodes, run2, ev2, run, ev)] != 0)
{
if (notfirstev)
eprintf (",");
@ -996,7 +999,8 @@ dotSemiState ()
eprintf (" ");
// decide color
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)
{
// Towards a claim, so only indirect dependency
@ -1009,9 +1013,13 @@ dotSemiState ()
if (rd->type == READ && rd2->type == 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 :)
eprintf ("[color=forestgreen]");
@ -1019,13 +1027,15 @@ dotSemiState ()
else
{
// Same message, different people
eprintf ("[label=\"redirect\",color=darkorange2]");
eprintf
("[label=\"redirect\",color=darkorange2]");
}
}
else
{
// Not even the same message, intruder construction
eprintf ("[label=\"construct\",color=red]");
eprintf
("[label=\"construct\",color=red]");
}
}
}
@ -1039,7 +1049,8 @@ dotSemiState ()
run3--;
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);
}
@ -1481,7 +1492,8 @@ bind_goal_regular_run (const Binding b)
}
#endif
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;
@ -1670,7 +1682,9 @@ prune_theorems ()
{
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)
{
@ -1730,7 +1744,9 @@ prune_theorems ()
if (sys->output == PROOF)
{
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;
}
@ -1847,7 +1863,8 @@ prune_bounds ()
if (sys->output == PROOF)
{
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;
}

View File

@ -250,20 +250,28 @@ goal_graph_create ()
else
{
// 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);
eprintf (" from run %i occurs in run %i, term ",
eprintf
(" from run %i occurs in run %i, term ",
run2, run);
termPrint (t);
eprintf (" before it is read?\n");
eprintf
(" before it is read?\n");
}
// 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
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;
b = (Binding) data;
if (isTermEqual (b->term, term) &&
run == b->run_to &&
ev == b->ev_to)
if (isTermEqual (b->term, term) && run == b->run_to && ev == b->ev_to)
{ // abort scan, report
return 0;
}

View File

@ -3,7 +3,9 @@
int check_claim_nisynch (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_nisynch (const System sys, const int claim_run, const int claim_index);
int arachne_claim_niagree (const System sys, const int claim_run,
const int claim_index);
int arachne_claim_nisynch (const System sys, const int claim_run,
const int claim_index);
#endif

View File

@ -404,8 +404,7 @@ commEvent (int event, Tac tc)
{
/* we already had this label constant */
/* leaves a garbage tuple. dunnoh what to do with it */
label =
makeTermTuple (thisProtocol->nameterm, label);
label = makeTermTuple (thisProtocol->nameterm, label);
}
}
/**
@ -441,7 +440,9 @@ commEvent (int event, Tac tc)
{
/* set sendrole */
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)
error ("Label defined twice for sendrole!");
linfo->sendrole = fromrole;
@ -456,7 +457,9 @@ commEvent (int event, Tac tc)
// READ
/* set readrole */
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)
error ("Label defined twice for readrole!");
linfo->readrole = torole;
@ -540,7 +543,8 @@ commEvent (int event, Tac tc)
cl->rolename = fromrole;
cl->role = thisRole;
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->count = 0;
cl->complete = 0;
@ -977,7 +981,8 @@ order_label_roles (const Claimlist cl)
#endif
roles_remaining = termlistShallow (cl->roles);
roles_ordered = termlistAdd (NULL, cl->rolename);
roles_remaining = termlistDelTerm (termlistFind (roles_remaining, cl->rolename));
roles_remaining =
termlistDelTerm (termlistFind (roles_remaining, cl->rolename));
distance = 0;
while (roles_remaining != NULL)
@ -1015,7 +1020,9 @@ order_label_roles (const Claimlist cl)
}
#endif
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"
//! 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;
@ -22,13 +23,15 @@ Labelinfo label_create (const Term label, const Protocol protocol)
}
//! Destroy a labelinfo node
void label_destroy (Labelinfo linfo)
void
label_destroy (Labelinfo linfo)
{
memFree (linfo, sizeof (struct labelinfo));
}
//! 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;
@ -55,4 +58,3 @@ Labelinfo label_find (List labellist, const Term label)
}
return linfo;
}

View File

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

View File

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

View File

@ -111,7 +111,8 @@ warshall (int *graph, int nodes)
/**
* 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 todo;
@ -142,7 +143,8 @@ int graph_ranks (int *graph, int *ranks, int nodes)
refn = 0;
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;
else
refn++;