#include <config.h>
-#include "roc.h"
#include <data/procedure.h>
#include <language/lexer/variable-parser.h>
#include <language/lexer/value-parser.h>
+#include <language/command.h>
#include <language/lexer/lexer.h>
#include <data/casegrouper.h>
if (!parse_variables_const (lexer, dict, &roc.vars, &roc.n_vars,
PV_APPEND | PV_NO_DUPLICATE | PV_NUMERIC))
- return 2;
+ goto error;;
if ( ! lex_force_match (lexer, T_BY))
{
- return 2;
+ goto error;;
}
roc.state_var = parse_variable (lexer, dict);
if ( !lex_force_match (lexer, '('))
{
- return 2;
+ goto error;;
}
parse_value (lexer, &roc.state_value, var_get_width (roc.state_var));
if ( !lex_force_match (lexer, ')'))
{
- return 2;
+ goto error;;
}
else
{
lex_error (lexer, NULL);
- return 2;
+ goto error;;
}
}
}
else
{
lex_error (lexer, NULL);
- return 2;
+ goto error;;
}
}
else if (lex_match_id (lexer, "PRINT"))
else
{
lex_error (lexer, NULL);
- return 2;
+ goto error;;
}
}
}
else
{
lex_error (lexer, NULL);
- return 2;
+ goto error;;
}
lex_force_match (lexer, ')');
}
else
{
lex_error (lexer, NULL);
- return 2;
+ goto error;;
}
lex_force_match (lexer, ')');
}
else
{
lex_error (lexer, NULL);
- return 2;
+ goto error;;
}
lex_force_match (lexer, ')');
}
else
{
lex_error (lexer, NULL);
- return 2;
+ goto error;;
}
}
}
}
}
- run_roc (ds, &roc);
+ if ( ! run_roc (ds, &roc))
+ goto error;;
- return 1;
+ return CMD_SUCCESS;
+
+ error:
+ free (roc.vars);
+ return CMD_FAILURE;
}
+++ /dev/null
-/* PSPP - a program for statistical analysis.
- Copyright (C) 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
- 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.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-#ifndef ROC_H
-#define ROC_H
-
-struct dataset;
-struct lexer;
-int cmd_roc (struct lexer *lexer, struct dataset *ds);
-
-#endif