Cleanup: Cleanup of some spacing, conform coding conventions.

This is simply the result from running reindent.sh again.
This commit is contained in:
Cas Cremers 2013-06-19 21:51:52 +02:00
parent c6280d745e
commit 45d5cb0a3a
5 changed files with 55 additions and 50 deletions

View File

@ -1086,48 +1086,48 @@ bind_new_run (const Binding b, const Protocol p, const Role r,
//! Proof markers //! Proof markers
void void
proof_go_down(const Term label, const Term t) proof_go_down (const Term label, const Term t)
{ {
Termlist l; Termlist l;
int depth; int depth;
int len; int len;
if (switches.output != PROOF) if (switches.output != PROOF)
return; return;
// Prepend the terms (the list is in reverse) // Prepend the terms (the list is in reverse)
TERMLISTPREPEND(sys->proofstate,label); TERMLISTPREPEND (sys->proofstate, label);
TERMLISTPREPEND(sys->proofstate,t); TERMLISTPREPEND (sys->proofstate, t);
len = termlistLength(sys->proofstate) / 2; len = termlistLength (sys->proofstate) / 2;
// Display state // Display state
eprintf("Proof state: branch at level %i\n", len); eprintf ("Proof state: branch at level %i\n", len);
l = termlistForward(sys->proofstate); l = termlistForward (sys->proofstate);
depth = 0; depth = 0;
while (l != NULL) while (l != NULL)
{ {
int i; int i;
eprintf("Proof state: "); eprintf ("Proof state: ");
for (i = 0; i < depth; i++) for (i = 0; i < depth; i++)
{ {
eprintf(" "); eprintf (" ");
} }
termPrint(l->prev->term); termPrint (l->prev->term);
eprintf("("); eprintf ("(");
termPrint(l->term); termPrint (l->term);
eprintf("); "); eprintf ("); ");
l = l->prev->prev; l = l->prev->prev;
eprintf("\n"); eprintf ("\n");
depth++; depth++;
} }
} }
void void
proof_go_up(void) proof_go_up (void)
{ {
if (switches.output != PROOF) if (switches.output != PROOF)
return; return;
sys->proofstate = termlistDelTerm(sys->proofstate); sys->proofstate = termlistDelTerm (sys->proofstate);
sys->proofstate = termlistDelTerm(sys->proofstate); sys->proofstate = termlistDelTerm (sys->proofstate);
return; return;
} }
@ -1429,16 +1429,16 @@ bind_goal_regular_run (const Binding b)
#ifdef DEBUG #ifdef DEBUG
debug (5, "Trying to bind to existing run."); debug (5, "Trying to bind to existing run.");
#endif #endif
proof_go_down(TERM_DeEx,b->term); proof_go_down (TERM_DeEx, b->term);
sflag = bind_existing_run (b, p, r, index); sflag = bind_existing_run (b, p, r, index);
proof_go_up(); proof_go_up ();
// bind to new run // bind to new run
#ifdef DEBUG #ifdef DEBUG
debug (5, "Trying to bind to new run."); debug (5, "Trying to bind to new run.");
#endif #endif
proof_go_down(TERM_DeNew,b->term); proof_go_down (TERM_DeNew, b->term);
sflag = sflag && bind_new_run (b, p, r, index); sflag = sflag && bind_new_run (b, p, r, index);
proof_go_up(); proof_go_up ();
indentDepth--; indentDepth--;
return sflag; return sflag;
@ -1634,21 +1634,21 @@ bind_goal_all_options (const Binding b)
if (know_only) if (know_only)
{ {
// Special case: only from intruder // Special case: only from intruder
proof_go_down(TERM_CoOld,b->term); proof_go_down (TERM_CoOld, b->term);
flag = flag && bind_goal_old_intruder_run (b); flag = flag && bind_goal_old_intruder_run (b);
//flag = flag && bind_goal_new_intruder_run (b); //flag = flag && bind_goal_new_intruder_run (b);
proof_go_up(); proof_go_up ();
} }
else else
{ {
// Normal case // Normal case
flag = bind_goal_regular_run (b); flag = bind_goal_regular_run (b);
proof_go_down(TERM_CoOld,b->term); proof_go_down (TERM_CoOld, b->term);
flag = flag && bind_goal_old_intruder_run (b); flag = flag && bind_goal_old_intruder_run (b);
proof_go_up(); proof_go_up ();
proof_go_down(TERM_CoNew,b->term); proof_go_down (TERM_CoNew, b->term);
flag = flag && bind_goal_new_intruder_run (b); flag = flag && bind_goal_new_intruder_run (b);
proof_go_up(); proof_go_up ();
} }
proofDepth--; proofDepth--;

View File

@ -790,30 +790,32 @@ matchEvent (Tac tc)
Labelinfo linfo; Labelinfo linfo;
/* Create fresh Nonce variable */ /* Create fresh Nonce variable */
nsymb = symbolNextFree(TermSymb(TERM_Hidden)); nsymb = symbolNextFree (TermSymb (TERM_Hidden));
tvar = symbolDeclare(nsymb,false); tvar = symbolDeclare (nsymb, false);
//tvar->stype = termlistAdd(NULL,TERM_Nonce); //tvar->stype = termlistAdd(NULL,TERM_Nonce);
/* Make the concrete messages */ /* Make the concrete messages */
mpat = tacTerm (tc->t1.tac); mpat = tacTerm (tc->t1.tac);
mmsg = tacTerm (tc->t2.tac); mmsg = tacTerm (tc->t2.tac);
msg1 = makeTermEncrypt(mmsg,tvar); msg1 = makeTermEncrypt (mmsg, tvar);
msg2 = makeTermEncrypt(mpat,tvar); msg2 = makeTermEncrypt (mpat, tvar);
/* Declare the const */ /* Declare the const */
thisRole->declaredconsts = termlistAdd(thisRole->declaredconsts, tvar); thisRole->declaredconsts = termlistAdd (thisRole->declaredconsts, tvar);
/* And send & recv combo (implementing the syntactic sugar) */ /* And send & recv combo (implementing the syntactic sugar) */
label1 = freshTermPrefix(LABEL_Match); label1 = freshTermPrefix (LABEL_Match);
linfo = label_create (label1, thisProtocol); linfo = label_create (label1, thisProtocol);
sys->labellist = list_append (sys->labellist, linfo); sys->labellist = list_append (sys->labellist, linfo);
myrole = thisRole->nameterm; myrole = thisRole->nameterm;
/* add send event */ /* add send event */
thisRole->roledef = roledefAdd (thisRole->roledef, SEND, label1, myrole, myrole, msg1, NULL); thisRole->roledef =
roledefAdd (thisRole->roledef, SEND, label1, myrole, myrole, msg1, NULL);
markLastRoledef (thisRole->roledef, tc->lineno); markLastRoledef (thisRole->roledef, tc->lineno);
/* add recv event */ /* add recv event */
thisRole->roledef = roledefAdd (thisRole->roledef, RECV, label1, myrole, myrole, msg2, NULL); thisRole->roledef =
roledefAdd (thisRole->roledef, RECV, label1, myrole, myrole, msg2, NULL);
markLastRoledef (thisRole->roledef, tc->lineno); markLastRoledef (thisRole->roledef, tc->lineno);
} }
@ -834,8 +836,9 @@ nonMatchEvent (Tac tc)
mpat = tacTerm (tc->t1.tac); mpat = tacTerm (tc->t1.tac);
mmsg = tacTerm (tc->t2.tac); mmsg = tacTerm (tc->t2.tac);
msg = makeTermTuple(mpat,mmsg); msg = makeTermTuple (mpat, mmsg);
claimCreate (sys, thisProtocol, thisRole, CLAIM_Notequal, NULL, msg, tc->lineno); claimCreate (sys, thisProtocol, thisRole, CLAIM_Notequal, NULL, msg,
tc->lineno);
} }
//! Parse a communication event tc of type event, and add a role definition event for it. //! Parse a communication event tc of type event, and add a role definition event for it.
@ -1272,11 +1275,11 @@ roleCompile (Term nameterm, Tac tc)
case TAC_MATCH: case TAC_MATCH:
if (tc->t3.value == true) if (tc->t3.value == true)
{ {
matchEvent (tc); matchEvent (tc);
} }
else else
{ {
nonMatchEvent (tc); nonMatchEvent (tc);
} }
break; break;
case TAC_CLAIM: case TAC_CLAIM:

View File

@ -204,22 +204,24 @@ inequalityConstraints (const System sys)
Roledef rd; Roledef rd;
rd = sys->runs[run].start; rd = sys->runs[run].start;
for (e = 0; e < sys->runs[run].step; e++) for (e = 0; e < sys->runs[run].step; e++)
{ {
if (rd->type == CLAIM) if (rd->type == CLAIM)
{ {
// It's a claim // It's a claim
if (isTermEqual (rd->claiminfo->type, CLAIM_Notequal)) if (isTermEqual (rd->claiminfo->type, CLAIM_Notequal))
{ {
// TODO ASSERT: Message should be a pair for NotEqual claims // TODO ASSERT: Message should be a pair for NotEqual claims
if (isTermEqual (TermOp1(rd->message),TermOp2(rd->message))) if (isTermEqual
(TermOp1 (rd->message), TermOp2 (rd->message)))
{ {
// Inequality violated, no solution exists that makes them inequal anymore. // Inequality violated, no solution exists that makes them inequal anymore.
if (switches.output == PROOF) if (switches.output == PROOF)
{ {
indentPrint (); indentPrint ();
eprintf ("Pruned because the pattern violates an inequality constraint based on the term "); eprintf
termPrint (TermOp1(rd->message)); ("Pruned because the pattern violates an inequality constraint based on the term ");
termPrint (TermOp1 (rd->message));
eprintf (".\n"); eprintf (".\n");
} }

View File

@ -53,8 +53,8 @@ tacDone (void)
} }
//! Copy a tac //! Copy a tac
Tac Tac
tacCopy(Tac c) tacCopy (Tac c)
{ {
Tac newTac; Tac newTac;

View File

@ -93,7 +93,7 @@ typedef struct tacnode *Tac;
void tacInit (void); void tacInit (void);
void tacDone (void); void tacDone (void);
Tac tacCopy(Tac c); Tac tacCopy (Tac c);
Tac tacCreate (int op); Tac tacCreate (int op);
Tac tacSymb (char *s); Tac tacSymb (char *s);
Tac tacJoin (int op, Tac t1, Tac t2, Tac t3); Tac tacJoin (int op, Tac t1, Tac t2, Tac t3);