stop=:states(n:max_unique_states,"%s>0"),
:errors(n:max_errors),
:timeout(d:time_limit,"%s>0");
- progress=progress:none/dots/fancy;
+ progress=progress:none/dots/fancy/verbose;
output=:verbosity(n:verbosity),
:errverbosity(n:err_verbosity),
:file(s:output_file).
return ok;
}
-/* Fancy progress function for mc_options_set_progress_func. */
-static bool
-fancy_progress (struct mc *mc)
-{
- const struct mc_results *results = mc_get_results (mc);
- if (mc_results_get_stop_reason (results) == MC_CONTINUING)
- fprintf (stderr, "Processed %d unique states, max depth %d, "
- "dropped %d duplicates...\r",
- mc_results_get_unique_state_count (results),
- mc_results_get_max_depth_reached (results),
- mc_results_get_duplicate_dropped_states (results));
- else
- putc ('\n', stderr);
- return true;
-}
-
/* Parses options from LEXER and returns a corresponding
mc_options, or a null pointer if parsing fails. */
static struct mc_options *
if (cmd.progress == CHM_NONE)
mc_options_set_progress_usec (options, 0);
else if (cmd.progress == CHM_DOTS)
- {
- /* Nothing to do: that's the default anyway. */
- }
+ mc_options_set_progress_func (options, mc_progress_dots);
else if (cmd.progress == CHM_FANCY)
- mc_options_set_progress_func (options, fancy_progress);
+ mc_options_set_progress_func (options, mc_progress_fancy);
+ else if (cmd.progress == CHM_VERBOSE)
+ mc_options_set_progress_func (options, mc_progress_verbose);
}
if (cmd.output_file != NULL)
{
};
/* Default progress function. */
-static bool
-default_progress (struct mc *mc)
+bool
+mc_progress_dots (struct mc *mc)
{
if (mc_results_get_stop_reason (mc_get_results (mc)) == MC_CONTINUING)
putc ('.', stderr);
return true;
}
+/* Progress function that prints a one-line summary of the
+ current state on stderr. */
+bool
+mc_progress_fancy (struct mc *mc)
+{
+ const struct mc_results *results = mc_get_results (mc);
+ if (mc_results_get_stop_reason (results) == MC_CONTINUING)
+ fprintf (stderr, "Processed %d unique states, max depth %d, "
+ "dropped %d duplicates...\r",
+ mc_results_get_unique_state_count (results),
+ mc_results_get_max_depth_reached (results),
+ mc_results_get_duplicate_dropped_states (results));
+ else
+ putc ('\n', stderr);
+ return true;
+}
+
+/* Progress function that displays a detailed summary of the
+ current state on stderr. */
+bool
+mc_progress_verbose (struct mc *mc)
+{
+ const struct mc_results *results = mc_get_results (mc);
+
+ /* VT100 clear screen and home cursor. */
+ fprintf (stderr, "\033[H\033[2J");
+
+ if (mc_results_get_stop_reason (results) == MC_CONTINUING)
+ mc_results_print (results, stderr);
+
+ return true;
+}
+
/* Do-nothing progress function. */
static bool
null_progress (struct mc *mc UNUSED)
options->failure_verbosity = 2;
options->output_file = stdout;
options->progress_usec = 250000;
- options->progress_func = default_progress;
+ options->progress_func = mc_progress_dots;
options->aux = NULL;
/* PSPP - a program for statistical analysis.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
void mc_options_set_output_file (struct mc_options *, FILE *);
typedef bool mc_progress_func (struct mc *);
+mc_progress_func mc_progress_dots;
+mc_progress_func mc_progress_fancy;
+mc_progress_func mc_progress_verbose;
+
int mc_options_get_progress_usec (const struct mc_options *);
void mc_options_set_progress_usec (struct mc_options *, int progress_usec);
mc_progress_func *mc_options_get_progress_func (const struct mc_options *);