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., 59 Temple Place - Suite 330, Boston, MA
- 02111-1307, USA. */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA. */
#include <config.h>
-#include <assert.h>
+#include "error.h"
#include <stdlib.h>
#include "alloc.h"
+#include "case.h"
#include "command.h"
+#include "dictionary.h"
#include "error.h"
#include "hash.h"
#include "lexer.h"
#include "var.h"
#include "vfm.h"
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+
/* FIXME: Implement PRINT subcommand. */
/* Explains how to recode one value. `from' must be first element. */
arc.print = 0;
dst_cnt = 0;
- lex_match_id ("AUTORECODE");
lex_match_id ("VARIABLES");
lex_match ('=');
if (!parse_variables (default_dict, &arc.src_vars, &arc.var_cnt,
goto lossage;
}
for (j = 0; j < i; j++)
- if (!strcmp (arc.dst_names[i], arc.dst_names[j]))
+ if (!strcasecmp (arc.dst_names[i], arc.dst_names[j]))
{
msg (SE, _("Duplicate variable name %s among target variables."),
arc.dst_names[i]);
int i;
for (i = 0; i < arc->var_cnt; i++)
- hsh_destroy (arc->src_values[i]);
+ hsh_destroy (arc->src_values[i]);
+ free (arc->src_values);
}
pool_destroy (arc->src_values_pool);
}
for (i = 0; i < arc->var_cnt; i++)
{
struct arc_spec *spec = &t->specs[i];
- void **p = hsh_sort (arc->src_values[i]);
+ void *const *p = hsh_sort (arc->src_values[i]);
int count = hsh_count (arc->src_values[i]);
int j;
static int
autorecode_trns_proc (struct trns_header * trns, struct ccase * c,
- int case_num UNUSED)
+ int case_idx UNUSED)
{
struct autorecode_trns *t = (struct autorecode_trns *) trns;
int i;
{
struct arc_spec *spec = &t->specs[i];
struct arc_item *item;
+ union value v;
if (spec->src->type == NUMERIC)
- item = hsh_force_find (spec->items, &c->data[spec->src->fv].f);
+ v.f = case_num (c, spec->src->fv);
else
- {
- union value v;
- v.c = c->data[spec->src->fv].s;
- item = hsh_force_find (spec->items, &v);
- }
+ v.c = (char *) case_str (c, spec->src->fv);
+ item = hsh_force_find (spec->items, &v);
- c->data[spec->dest->fv].f = item->to;
+ case_data_rw (c, spec->dest->fv)->f = item->to;
}
return -1;
}
union value v, *vp, **vpp;
if (arc->src_vars[i]->type == NUMERIC)
- v.f = c->data[arc->src_vars[i]->fv].f;
+ v.f = case_num (c, arc->src_vars[i]->fv);
else
- v.c = c->data[arc->src_vars[i]->fv].s;
+ v.c = (char *) case_str (c, arc->src_vars[i]->fv);
vpp = (union value **) hsh_probe (arc->src_values[i], &v);
if (*vpp == NULL)