- Added local step index to runs.

This commit is contained in:
ccremers 2004-07-14 06:55:05 +00:00
parent 5bb5f610fb
commit 508d49efbb
3 changed files with 16 additions and 17 deletions

View File

@ -119,9 +119,9 @@ executeStep (const System sys, const int run)
printf ("#%i\n", run);
}
#endif
sys->runs[run].step++;
runPointerSet (sys, run, runPoint->next);
/* store knowledge for this step */
(sys->step)++;
sys->traceKnow[sys->step] = sys->know;
@ -200,8 +200,11 @@ explorify (const System sys, const int run)
{
Roledef rd;
int flag;
int myStep;
rd = runPointerGet (sys, run);
myStep = sys->runs[run].step;
if (rd == NULL)
{
fprintf (stderr, "ERROR: trying to progress completed run!\n");
@ -213,7 +216,7 @@ explorify (const System sys, const int run)
/*
* Special checks after (implicit) choose events; always first in run reads.
*/
if (rd == sys->runs[run].start && rd->type == READ)
if (myStep == 0 && rd->type == READ)
{
int rid;
@ -286,7 +289,8 @@ explorify (const System sys, const int run)
{
/* traverse the system after the step */
flag = traverse (sys);
runPointerSet (sys, run, rd);
runPointerSet (sys, run, rd); // reset rd pointer
sys->runs[run].step = myStep; // reset local index
sys->step--;
indentSet (sys->step);
return flag;

View File

@ -249,6 +249,7 @@ ensureValidRun (System sys, int run)
struct run myrun = sys->runs[i];
myrun.role = NULL;
myrun.agents = NULL;
myrun.step = 0;
myrun.index = NULL;
myrun.start = NULL;
myrun.know = knowledgeDuplicate (sys->know);

View File

@ -125,20 +125,14 @@ typedef struct protocol *Protocol;
//! Run container.
struct run
{
//! Protocol of this run.
Protocol protocol;
//! Role of this run.
Role role;
//! Agents involved in this run.
Termlist agents;
//! Current execution point in the run.
Roledef index;
//! Head of the run definition.
Roledef start;
//! Current knowledge of the run.
Knowledge know;
//! Locals of the run.
Termlist locals;
Protocol protocol; //!< Protocol of this run.
Role role; //!< Role of this run.
Termlist agents; //!< Agents involved in this run.
int step; //!< Current execution point in the run (integer)
Roledef index; //!< Current execution point in the run (roledef pointer)
Roledef start; //!< Head of the run definition.
Knowledge know; //!< Current knowledge of the run.
Termlist locals; //!< Locals of the run.
};
//! Shorthand for run pointer.