X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Ftests%2Fcheck-model.q;h=a2654717888d5232f679eacb57190b2284587b50;hb=5ee84736663824fe12474b78dace867e42893a14;hp=77fba35501d7ab732a89e7e227f8ceb30f529763;hpb=5060fdedfe17e843301ac0c738e12488af467378;p=pspp-builds.git
diff --git a/src/language/tests/check-model.q b/src/language/tests/check-model.q
index 77fba355..a2654717 100644
--- a/src/language/tests/check-model.q
+++ b/src/language/tests/check-model.q
@@ -1,22 +1,21 @@
-/* PSPP - computes sample statistics.
+/* PSPP - a program for statistical analysis.
Copyright (C) 2007 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 the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
+ 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
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA. */
+ along with this program. If not, see . */
#include
+#include
#include
@@ -65,7 +64,7 @@ static void print_results (const struct mc_results *, FILE *);
true if the model checker run found no errors, false
otherwise. */
bool
-check_model (struct lexer *lexer,
+check_model (struct lexer *lexer,
struct mc_results *(*checker) (struct mc_options *, void *aux),
void *aux)
{
@@ -83,13 +82,13 @@ check_model (struct lexer *lexer,
print_results (results, output_file);
- if (output_file != stdout && output_file != stderr)
+ if (output_file != stdout && output_file != stderr)
{
- if (fwriteerror (output_file) < 0)
+ if (fwriteerror (output_file) < 0)
{
/* We've already discarded the name of the output file.
Oh well. */
- error (0, errno, "error closing output file");
+ error (0, errno, "error closing output file");
}
}
@@ -101,7 +100,7 @@ check_model (struct lexer *lexer,
/* Fancy progress function for mc_options_set_progress_func. */
static bool
-fancy_progress (struct mc *mc)
+fancy_progress (struct mc *mc)
{
const struct mc_results *results = mc_get_results (mc);
if (mc_results_get_stop_reason (results) == MC_CONTINUING)
@@ -118,7 +117,7 @@ fancy_progress (struct mc *mc)
/* Parses options from LEXER and returns a corresponding
mc_options, or a null pointer if parsing fails. */
static struct mc_options *
-parse_options (struct lexer *lexer)
+parse_options (struct lexer *lexer)
{
struct cmd_check_model cmd;
struct mc_options *options;
@@ -138,7 +137,7 @@ parse_options (struct lexer *lexer)
if (cmd.sbc_search > 0)
msg (SW, _("PATH and SEARCH subcommands are mutually exclusive. "
"Ignoring PATH."));
- else
+ else
{
struct subc_list_int *list = &cmd.il_path[0];
int count = subc_list_int_count (list);
@@ -146,7 +145,7 @@ parse_options (struct lexer *lexer)
{
struct mc_path path;
int i;
-
+
mc_path_init (&path);
for (i = 0; i < count; i++)
mc_path_push (&path, subc_list_int_at (list, i));
@@ -157,19 +156,19 @@ parse_options (struct lexer *lexer)
msg (SW, _("At least one value must be specified on PATH."));
}
}
- if (cmd.max_depth != NOT_LONG)
+ if (cmd.max_depth != LONG_MIN)
mc_options_set_max_depth (options, cmd.max_depth);
- if (cmd.hash_bits != NOT_LONG)
+ if (cmd.hash_bits != LONG_MIN)
{
int hash_bits;
mc_options_set_hash_bits (options, cmd.hash_bits);
hash_bits = mc_options_get_hash_bits (options);
if (hash_bits != cmd.hash_bits)
- msg (SW, _("Hash bits adjusted to %d."), hash_bits);
+ msg (SW, _("Hash bits adjusted to %d."), hash_bits);
}
- if (cmd.queue_limit != NOT_LONG)
+ if (cmd.queue_limit != LONG_MIN)
mc_options_set_queue_limit (options, cmd.queue_limit);
- if (cmd.drop != -1)
+ if (cmd.drop != -1)
{
enum mc_queue_limit_strategy drop
= (cmd.drop == CHM_NEWEST ? MC_DROP_NEWEST
@@ -180,17 +179,17 @@ parse_options (struct lexer *lexer)
}
if (cmd.sbc_search > 0)
mc_options_set_seed (options, cmd.n_seed[0]);
- if (cmd.max_unique_states != NOT_LONG)
+ if (cmd.max_unique_states != LONG_MIN)
mc_options_set_max_unique_states (options, cmd.max_unique_states);
- if (cmd.max_errors != NOT_LONG)
+ if (cmd.max_errors != LONG_MIN)
mc_options_set_max_errors (options, cmd.max_errors);
if (cmd.time_limit != SYSMIS)
mc_options_set_time_limit (options, cmd.time_limit);
- if (cmd.verbosity != NOT_LONG)
+ if (cmd.verbosity != LONG_MIN)
mc_options_set_verbosity (options, cmd.verbosity);
- if (cmd.err_verbosity != NOT_LONG)
+ if (cmd.err_verbosity != LONG_MIN)
mc_options_set_failure_verbosity (options, cmd.err_verbosity);
- if (cmd.progress != -1)
+ if (cmd.progress != -1)
{
if (cmd.progress == CHM_NONE)
mc_options_set_progress_usec (options, 0);
@@ -204,7 +203,7 @@ parse_options (struct lexer *lexer)
if (cmd.output_file != NULL)
{
FILE *output_file = fopen (cmd.output_file, "w");
- if (output_file == NULL)
+ if (output_file == NULL)
{
error (0, errno, _("error opening \"%s\" for writing"),
cmd.output_file);
@@ -215,12 +214,15 @@ parse_options (struct lexer *lexer)
mc_options_set_output_file (options, output_file);
}
+
+ free_check_model (&cmd);
+
return options;
}
/* Prints a description of RESULTS to stream F. */
static void
-print_results (const struct mc_results *results, FILE *f)
+print_results (const struct mc_results *results, FILE *f)
{
enum mc_stop_reason reason = mc_results_get_stop_reason (results);