- Removed --claims flag again.

- Now new reporting on stderr, with claim details.
- Added '--summary' to redirect this report to stdout.
This commit is contained in:
ccremers 2004-07-29 13:08:27 +00:00
parent 17c6fe5136
commit c88c1d4461
3 changed files with 66 additions and 69 deletions

View File

@ -113,7 +113,7 @@ main (int argc, char **argv)
struct arg_lit *switch_enable_symmetry_order = arg_lit0 (NULL, "symm-order", "enable ordering symmetry reductions"); struct arg_lit *switch_enable_symmetry_order = arg_lit0 (NULL, "symm-order", "enable ordering symmetry reductions");
struct arg_lit *switch_disable_noclaims_reductions = arg_lit0 (NULL, "no-noclaims-red", "disable no more claims reductions"); struct arg_lit *switch_disable_noclaims_reductions = arg_lit0 (NULL, "no-noclaims-red", "disable no more claims reductions");
struct arg_lit *switch_disable_endgame_reductions = arg_lit0 (NULL, "no-endgame-red", "disable endgame reductions"); struct arg_lit *switch_disable_endgame_reductions = arg_lit0 (NULL, "no-endgame-red", "disable endgame reductions");
struct arg_lit *switch_claims = arg_lit0 (NULL, "claims", "show claims report"); struct arg_lit *switch_summary = arg_lit0 ("S", "summary", "show summary on stdout instead of stderr");
#ifdef DEBUG #ifdef DEBUG
struct arg_int *switch_por_parameter = arg_int0 (NULL, "pp", NULL, "POR parameter"); struct arg_int *switch_por_parameter = arg_int0 (NULL, "pp", NULL, "POR parameter");
struct arg_lit *switch_debug_indent = arg_lit0 ("I", "debug-indent", struct arg_lit *switch_debug_indent = arg_lit0 ("I", "debug-indent",
@ -132,8 +132,8 @@ main (int argc, char **argv)
switch_state_space_graph, switch_state_space_graph,
switch_scenario, switch_scenario,
switch_latex_output, switch_latex_output,
switch_summary,
switch_progress_bar, switch_progress_bar,
switch_claims,
switch_traversal_method, switch_traversal_method,
switch_match_method, switch_match_method,
@ -325,8 +325,8 @@ main (int argc, char **argv)
sys->switchNomoreClaims = 0; /* disable no more claims cutter */ sys->switchNomoreClaims = 0; /* disable no more claims cutter */
if (switch_disable_endgame_reductions->count > 0) if (switch_disable_endgame_reductions->count > 0)
sys->switchReduceEndgame = 0; /* disable endgame cutter */ sys->switchReduceEndgame = 0; /* disable endgame cutter */
if (switch_claims->count > 0) if (switch_summary->count > 0)
sys->switchClaims = 1; /* claims report */ sys->output = SUMMARY; /* report summary on stdout */
/* /*
* The scenario selector has an important side effect; when it is non-null, * The scenario selector has an important side effect; when it is non-null,
@ -563,23 +563,17 @@ timersPrint (const System sys)
// #define NOTIMERS // #define NOTIMERS
/* display stats, header first */ /* display stats */
#ifdef NOTIMERS if (sys->output != SUMMARY)
fprintf (stderr, "States\t\tAttack\n"); {
#else globalError++;
fprintf (stderr, "Time\t\tStates\t\tAttack\t\tst/sec\n"); }
/* print time */
double seconds;
seconds = (double) clock () / CLOCKS_PER_SEC;
fprintf (stderr, "%.3e\t", seconds);
#endif
/* states traversed */ /* states traversed */
eprintf ("states\t");
statesPrintShort (sys); statesPrintShort (sys);
fprintf (stderr, "\t"); eprintf ("\n");
/* flag /* flag
* *
@ -588,42 +582,42 @@ timersPrint (const System sys)
* NoClaim no claims * NoClaim no claims
*/ */
eprintf ("attack\t");
if (sys->claims == STATES0) if (sys->claims == STATES0)
{ {
fprintf (stderr, "NoClaim\t\t"); eprintf ("NoClaim\n");
} }
else else
{ {
if (sys->failed != STATES0) if (sys->failed != STATES0)
fprintf (stderr, "L:%i\t\t", attackLength(sys->attack)); eprintf ("L:%i\n", attackLength(sys->attack));
else else
fprintf (stderr, "None\t\t"); eprintf ("None\n");
} }
#ifdef NOTIMERS #ifndef NOTIMERS
fprintf (stderr, "\n"); /* print time */
#else
double seconds;
seconds = (double) clock () / CLOCKS_PER_SEC;
eprintf ("time\t%.3e\n", seconds);
/* states per second */ /* states per second */
eprintf ("st/sec\t");
if (seconds > 0) if (seconds > 0)
{ {
fprintf (stderr, "%.3e\t", statesDouble (sys->states) / seconds); eprintf ("%.3e\n", statesDouble (sys->states) / seconds);
} }
else else
{ {
fprintf (stderr, "<inf>\t\t"); eprintf ("<inf>\n");
} }
fprintf (stderr, "\n");
#endif #endif
if (sys->switchClaims)
{
/* Print also individual claims */ /* Print also individual claims */
/* Note that if the output is set to empty, the claim output is redirected to stdout (for e.g. processing) /* Note that if the output is set to empty, the claim output is redirected to stdout (for e.g. processing)
*/ */
if (sys->output != EMPTY)
globalError++;
cl_scan = sys->claimlist; cl_scan = sys->claimlist;
anyclaims = 0; anyclaims = 0;
while (cl_scan != NULL) while (cl_scan != NULL)
@ -632,12 +626,9 @@ timersPrint (const System sys)
* for now, we don't print the actual claim label. * for now, we don't print the actual claim label.
*@todo When termPrint can also go to stderr, fix this. *@todo When termPrint can also go to stderr, fix this.
*/ */
if (!anyclaims)
{
eprintf ("Claim\tOccurrences\n");
anyclaims = 1; anyclaims = 1;
}
eprintf ("claim\t");
termPrint (cl_scan->rolename); termPrint (cl_scan->rolename);
eprintf (":"); eprintf (":");
termPrint (cl_scan->label); termPrint (cl_scan->label);
@ -659,7 +650,10 @@ timersPrint (const System sys)
{ {
warning ("No claims in system."); warning ("No claims in system.");
} }
if (sys->output != EMPTY)
/* reset globalError */
if (sys->output != SUMMARY)
{
globalError--; globalError--;
} }
} }

View File

@ -204,7 +204,10 @@ systemDone (const System sys)
void void
statesPrintShort (const System sys) statesPrintShort (const System sys)
{ {
fprintf (stderr,"%.3e", statesDouble (sys->states)); if (globalError == 0)
statesFormat (stdout, sys->states);
else
statesFormat (stderr, sys->states);
} }
//! Print the number of states. //! Print the number of states.

View File

@ -12,6 +12,8 @@
#define runPointerGet(sys,run) sys->runs[run].index #define runPointerGet(sys,run) sys->runs[run].index
#define runPointerSet(sys,run,newp) sys->runs[run].index = newp #define runPointerSet(sys,run,newp) sys->runs[run].index = newp
enum outputs { EMPTY, ATTACK, STATESPACE, SCENARIOS, SUMMARY };
//! Protocol definition. //! Protocol definition.
struct protocol struct protocol
{ {
@ -91,8 +93,6 @@ struct tracebuf
Varbuf variables; Varbuf variables;
}; };
enum outputs { EMPTY, ATTACK, STATESPACE, SCENARIOS };
//! The main state structure. //! The main state structure.
struct system struct system
{ {