projects
/
pspp-builds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed bug 12931
[pspp-builds.git]
/
src
/
autorecode.c
diff --git
a/src/autorecode.c
b/src/autorecode.c
index f6b8e15ece49a73ae1737ab9036300198350897a..0b6857ddefbced95684e0e57e983c976956124d8 100644
(file)
--- a/
src/autorecode.c
+++ b/
src/autorecode.c
@@
-14,14
+14,16
@@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
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., 5
9 Temple Place - Suite 330
, Boston, MA
- 0211
1-1307
, USA. */
+ Foundation, Inc., 5
1 Franklin Street, Fifth Floor
, Boston, MA
+ 0211
0-1301
, USA. */
#include <config.h>
#include <config.h>
-#include
<assert.h>
+#include
"error.h"
#include <stdlib.h>
#include "alloc.h"
#include <stdlib.h>
#include "alloc.h"
+#include "case.h"
#include "command.h"
#include "command.h"
+#include "dictionary.h"
#include "error.h"
#include "hash.h"
#include "lexer.h"
#include "error.h"
#include "hash.h"
#include "lexer.h"
@@
-103,7
+105,6
@@
cmd_autorecode (void)
arc.print = 0;
dst_cnt = 0;
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,
lex_match_id ("VARIABLES");
lex_match ('=');
if (!parse_variables (default_dict, &arc.src_vars, &arc.var_cnt,
@@
-150,7
+151,7
@@
cmd_autorecode (void)
goto lossage;
}
for (j = 0; j < i; j++)
goto lossage;
}
for (j = 0; j < i; j++)
- if (!strcmp (arc.dst_names[i], arc.dst_names[j]))
+ if (!strc
asec
mp (arc.dst_names[i], arc.dst_names[j]))
{
msg (SE, _("Duplicate variable name %s among target variables."),
arc.dst_names[i]);
{
msg (SE, _("Duplicate variable name %s among target variables."),
arc.dst_names[i]);
@@
-205,7
+206,8
@@
arc_free (struct autorecode_pgm *arc)
int i;
for (i = 0; i < arc->var_cnt; 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);
}
}
pool_destroy (arc->src_values_pool);
}
@@
-262,7
+264,7
@@
recode (const struct autorecode_pgm *arc)
static int
autorecode_trns_proc (struct trns_header * trns, struct ccase * c,
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 autorecode_trns *t = (struct autorecode_trns *) trns;
int i;
@@
-271,17
+273,15
@@
autorecode_trns_proc (struct trns_header * trns, struct ccase * c,
{
struct arc_spec *spec = &t->specs[i];
struct arc_item *item;
{
struct arc_spec *spec = &t->specs[i];
struct arc_item *item;
+ union value v;
if (spec->src->type == NUMERIC)
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
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;
+ c
ase_data_rw (c, spec->dest->fv)->
f = item->to;
}
return -1;
}
}
return -1;
}
@@
-346,9
+346,9
@@
autorecode_proc_func (struct ccase *c, void *arc_)
union value v, *vp, **vpp;
if (arc->src_vars[i]->type == NUMERIC)
union value v, *vp, **vpp;
if (arc->src_vars[i]->type == NUMERIC)
- v.f = c
->data[arc->src_vars[i]->fv].f
;
+ v.f = c
ase_num (c, arc->src_vars[i]->fv)
;
else
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)
vpp = (union value **) hsh_probe (arc->src_values[i], &v);
if (*vpp == NULL)