- Moved role creation into the protocol creation. This will make it
easier to add MSC-style input to the input language compiler later.
This commit is contained in:
parent
506e42f841
commit
f2a2c8ea14
@ -633,14 +633,20 @@ normalDeclaration (Tac tc)
|
|||||||
void
|
void
|
||||||
roleCompile (Term nameterm, Tac tc)
|
roleCompile (Term nameterm, Tac tc)
|
||||||
{
|
{
|
||||||
Role r;
|
/* locate the role, protocol into thisRole */
|
||||||
|
/* scan through role list */
|
||||||
/* make new (empty) current protocol with name */
|
thisRole = thisProtocol->roles;
|
||||||
r = roleCreate (nameterm);
|
while (thisRole != NULL && !isTermEqual (thisRole->nameterm, nameterm))
|
||||||
thisRole = r;
|
{
|
||||||
/* add protocol to list */
|
thisRole = thisRole->next;
|
||||||
r->next = thisProtocol->roles;
|
}
|
||||||
thisProtocol->roles = r;
|
if (thisRole == NULL)
|
||||||
|
{
|
||||||
|
printf ("ERROR: undeclared role name ");
|
||||||
|
termPrint (nameterm);
|
||||||
|
printf (" in line ");
|
||||||
|
errorTac (tc->lineno);
|
||||||
|
}
|
||||||
|
|
||||||
/* parse the content of the role */
|
/* parse the content of the role */
|
||||||
levelInit ();
|
levelInit ();
|
||||||
@ -779,19 +785,27 @@ protocolCompile (Symbol prots, Tac tc, Tac tcroles)
|
|||||||
pr->rolenames = NULL;
|
pr->rolenames = NULL;
|
||||||
while (tcroles != NULL)
|
while (tcroles != NULL)
|
||||||
{
|
{
|
||||||
|
Term rolename;
|
||||||
|
Role r;
|
||||||
|
|
||||||
if (sys->engine == ARACHNE_ENGINE)
|
if (sys->engine == ARACHNE_ENGINE)
|
||||||
{
|
{
|
||||||
Term rolename;
|
|
||||||
|
|
||||||
rolename = levelVar (tcroles->t1.sym);
|
rolename = levelVar (tcroles->t1.sym);
|
||||||
rolename->stype = termlistAdd (NULL, TERM_Agent);
|
rolename->stype = termlistAdd (NULL, TERM_Agent);
|
||||||
pr->rolenames = termlistAppend (pr->rolenames, rolename);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pr->rolenames =
|
rolename = levelConst (tcroles->t1.sym);
|
||||||
termlistAppend (pr->rolenames, levelConst (tcroles->t1.sym));
|
|
||||||
}
|
}
|
||||||
|
/* add name to list of role names */
|
||||||
|
pr->rolenames = termlistAppend (pr->rolenames, rolename);
|
||||||
|
/* make new (empty) current protocol with name */
|
||||||
|
r = roleCreate (rolename);
|
||||||
|
/* add role to role list of the protocol */
|
||||||
|
r->next = thisProtocol->roles;
|
||||||
|
thisProtocol->roles = r;
|
||||||
|
|
||||||
|
/* next role name */
|
||||||
tcroles = tcroles->next;
|
tcroles = tcroles->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user