-/* PSPP - computes sample statistics.
- Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
+/* PSPP - a program for statistical analysis.
+ Copyright (C) 1997-9, 2000, 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 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.
- 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 <http://www.gnu.org/licenses/>. */
#include <data/dictionary.h>
#include <data/procedure.h>
#include <data/transformations.h>
#include <data/dictionary.h>
#include <data/procedure.h>
#include <data/transformations.h>
#include <language/command.h>
#include <language/lexer/lexer.h>
#include <language/lexer/variable-parser.h>
#include <language/command.h>
#include <language/lexer/lexer.h>
#include <language/lexer/variable-parser.h>
#include <libpspp/compiler.h>
#include <libpspp/hash.h>
#include <libpspp/message.h>
#include <libpspp/compiler.h>
#include <libpspp/hash.h>
#include <libpspp/message.h>
#include "gettext.h"
#define _(msgid) gettext (msgid)
/* FIXME: Implement PRINT subcommand. */
/* An AUTORECODE variable's original value. */
#include "gettext.h"
#define _(msgid) gettext (msgid)
/* FIXME: Implement PRINT subcommand. */
/* An AUTORECODE variable's original value. */
char **dst_names; /* Target variable names. */
struct variable **dst_vars; /* Target variables. */
struct hsh_table **src_values; /* `union arc_value's of source vars. */
char **dst_names; /* Target variable names. */
struct variable **dst_vars; /* Target variables. */
struct hsh_table **src_values; /* `union arc_value's of source vars. */
cmd_autorecode (struct lexer *lexer, struct dataset *ds)
{
struct autorecode_pgm arc;
cmd_autorecode (struct lexer *lexer, struct dataset *ds)
{
struct autorecode_pgm arc;
- if (!parse_variables (lexer, dataset_dict (ds), &arc.src_vars, &arc.var_cnt,
+ if (!parse_variables_const (lexer, dataset_dict (ds), &arc.src_vars,
+ &arc.var_cnt,
- msg (SE, _("Source variable count (%u) does not match "
- "target variable count (%u)."),
- (unsigned) arc.var_cnt, (unsigned) dst_cnt);
+ msg (SE, _("Source variable count (%zu) does not match "
+ "target variable count (%zu)."),
+ arc.var_cnt, dst_cnt);
arc.dst_vars = xnmalloc (arc.var_cnt, sizeof *arc.dst_vars);
arc.src_values = xnmalloc (arc.var_cnt, sizeof *arc.src_values);
for (i = 0; i < dst_cnt; i++)
arc.dst_vars = xnmalloc (arc.var_cnt, sizeof *arc.dst_vars);
arc.src_values = xnmalloc (arc.var_cnt, sizeof *arc.src_values);
for (i = 0; i < dst_cnt; i++)
if (var_is_alpha (arc.src_vars[i]))
arc.src_values[i] = hsh_create (10, compare_alpha_value,
hash_alpha_value, NULL, arc.src_vars[i]);
else
arc.src_values[i] = hsh_create (10, compare_numeric_value,
hash_numeric_value, NULL, NULL);
if (var_is_alpha (arc.src_vars[i]))
arc.src_values[i] = hsh_create (10, compare_alpha_value,
hash_alpha_value, NULL, arc.src_vars[i]);
else
arc.src_values[i] = hsh_create (10, compare_numeric_value,
hash_numeric_value, NULL, NULL);
for (i = 0; i < arc.var_cnt; i++)
{
union arc_value v, *vp, **vpp;
for (i = 0; i < arc.var_cnt; i++)
{
union arc_value v, *vp, **vpp;
for (i = 0; i < arc.var_cnt; i++)
arc.dst_vars[i] = dict_create_var_assert (dataset_dict (ds),
for (i = 0; i < arc.var_cnt; i++)
arc.dst_vars[i] = dict_create_var_assert (dataset_dict (ds),
{
struct arc_item *item = pool_alloc (trns->pool, sizeof *item);
union arc_value *vp = *p;
{
struct arc_item *item = pool_alloc (trns->pool, sizeof *item);
union arc_value *vp = *p;
autorecode_trns_proc, autorecode_trns_free, trns);
}
/* Executes an AUTORECODE transformation. */
static int
autorecode_trns_proc, autorecode_trns_free, trns);
}
/* Executes an AUTORECODE transformation. */
static int
-autorecode_trns_proc (void *trns_, struct ccase *c, casenumber case_idx UNUSED)
+autorecode_trns_proc (void *trns_, struct ccase **c,
+ casenumber case_idx UNUSED)