- Added encapsulated dot output and claim reporting to the XML output.

This commit is contained in:
ccremers 2006-08-01 07:31:40 +00:00
parent 9a98e66671
commit 5e10206df1
6 changed files with 70 additions and 3 deletions

View File

@ -2364,6 +2364,10 @@ arachneClaim (Claimlist cl)
} }
} }
claimStatusReport (sys, cl); claimStatusReport (sys, cl);
if (switches.xml)
{
xmlOutClaim (sys, cl);
}
return true; return true;
} }
else else

View File

@ -1064,6 +1064,7 @@ claimStatusReport (const System sys, Claimlist cl)
{ {
globalError--; globalError--;
} }
return true; return true;
} }
} }

View File

@ -70,7 +70,8 @@ switchesInit (int argc, char **argv)
switches.output = SUMMARY; // default is to show a summary switches.output = SUMMARY; // default is to show a summary
switches.report = 0; switches.report = 0;
switches.reportClaims = 0; // default don't report on claims switches.reportClaims = 0; // default don't report on claims
switches.xml = 0; // default no xml output (dot) switches.xml = false; // default no xml output
switches.dot = false; // default no dot output
switches.human = false; // not human friendly by default switches.human = false; // not human friendly by default
switches.reportMemory = 0; switches.reportMemory = 0;
switches.reportTime = 0; switches.reportTime = 0;
@ -435,7 +436,7 @@ switcher (const int process, int index, int commandline)
else else
{ {
switches.output = ATTACK; switches.output = ATTACK;
switches.xml = 0; switches.dot = true;
return index; return index;
} }
} }
@ -449,7 +450,7 @@ switcher (const int process, int index, int commandline)
else else
{ {
switches.output = ATTACK; switches.output = ATTACK;
switches.xml = 1; switches.xml = true;
return index; return index;
} }
} }

View File

@ -49,6 +49,7 @@ struct switchdata
int report; int report;
int reportClaims; //!< Enable claims report int reportClaims; //!< Enable claims report
int xml; //!< xml output int xml; //!< xml output
int dot; //!< dot output
int human; //!< human readable int human; //!< human readable
int reportMemory; //!< Memory display switch. int reportMemory; //!< Memory display switch.
int reportTime; //!< Time display switch. int reportTime; //!< Time display switch.

View File

@ -19,6 +19,8 @@
#include "arachne.h" // for get_semitrace_length #include "arachne.h" // for get_semitrace_length
#include "switches.h" #include "switches.h"
#include "specialterm.h" #include "specialterm.h"
#include "claim.h"
#include "dotout.h"
#include "xmlout.h" #include "xmlout.h"
@ -98,6 +100,16 @@ xmlOutInteger (const char *tag, const int value)
xmlPrint ("<%s>%i</%s>", tag, value, tag); xmlPrint ("<%s>%i</%s>", tag, value, tag);
} }
//! Print a state counter element
void
xmlOutStates (const char *tag, states_t value)
{
xmlIndentPrint ();
eprintf ("<%s>", tag);
statesFormat (value);
eprintf ("</%s>\n", tag);
}
//! Print a string //! Print a string
void void
xmlOutString (const char *tag, const char *s) xmlOutString (const char *tag, const char *s)
@ -960,9 +972,55 @@ xmlOutSemitrace (const System sys)
xmlOutRuns (sys); xmlOutRuns (sys);
xmlindent--; xmlindent--;
xmlPrint ("</semitrace>"); xmlPrint ("</semitrace>");
if (switches.dot)
{
// dot encapsulated in XML
xmlPrint ("<dot>");
dotSemiState (sys);
xmlPrint ("</dot>");
}
xmlindent--; xmlindent--;
xmlPrint ("</state>"); xmlPrint ("</state>");
/* restore only claim buffer */ /* restore only claim buffer */
only_claim_label = buffer_only_claim_label; only_claim_label = buffer_only_claim_label;
} }
//! Output for a claim
void
xmlOutClaim (const System sys, Claimlist cl)
{
Protocol p;
p = (Protocol) cl->protocol;
xmlPrint ("<claimstatus>");
xmlindent++;
xmlOutTerm ("claim", cl->type);
xmlOutTerm ("label", cl->label);
xmlOutTerm ("protocol", p->nameterm);
xmlOutTerm ("role", cl->rolename);
xmlOutTerm ("parameter", cl->parameter);
if (!isTermEqual (cl->type, CLAIM_Empty))
{
// something to say about it
xmlOutStates ("failed", cl->failed);
xmlOutStates ("count", cl->count);
xmlOutStates ("states", cl->states);
if (cl->complete)
{
xmlPrint ("<complete />");
}
if (cl->timebound)
{
xmlPrint ("<timebound />");
}
}
xmlindent--;
xmlPrint ("</claimstatus>");
}

View File

@ -2,11 +2,13 @@
#define XMLOUT #define XMLOUT
#include "system.h" #include "system.h"
#include "claim.h"
void xmlOutInit (void); void xmlOutInit (void);
void xmlOutDone (void); void xmlOutDone (void);
void xmlOutSemitrace (const System sys); void xmlOutSemitrace (const System sys);
void xmlOutTrace (const System sys); void xmlOutTrace (const System sys);
void xmlOutClaim (const System sys, Claimlist cl);
#endif #endif