projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix error messages and comment.
[pspp]
/
src
/
language
/
stats
/
autorecode.c
diff --git
a/src/language/stats/autorecode.c
b/src/language/stats/autorecode.c
index 560f9f99ddd15bbbd908cd9fd90a0959eee84ff6..41ac1058880a3a5a167486b17894b9036836fe3d 100644
(file)
--- a/
src/language/stats/autorecode.c
+++ b/
src/language/stats/autorecode.c
@@
-27,6
+27,7
@@
#include <data/variable.h>
#include <language/command.h>
#include <language/lexer/lexer.h>
#include <data/variable.h>
#include <language/command.h>
#include <language/lexer/lexer.h>
+#include <language/lexer/variable-parser.h>
#include <libpspp/alloc.h>
#include <libpspp/compiler.h>
#include <libpspp/hash.h>
#include <libpspp/alloc.h>
#include <libpspp/compiler.h>
#include <libpspp/hash.h>
@@
-92,16
+93,16
@@
struct autorecode_pgm
static trns_proc_func autorecode_trns_proc;
static trns_free_func autorecode_trns_free;
static trns_proc_func autorecode_trns_proc;
static trns_free_func autorecode_trns_free;
-static bool autorecode_proc_func (const struct ccase *, void *);
+static bool autorecode_proc_func (const struct ccase *, void *
, const struct dataset *
);
static hsh_compare_func compare_alpha_value, compare_numeric_value;
static hsh_hash_func hash_alpha_value, hash_numeric_value;
static hsh_compare_func compare_alpha_value, compare_numeric_value;
static hsh_hash_func hash_alpha_value, hash_numeric_value;
-static void recode (const struct autorecode_pgm *);
+static void recode (
struct dataset *,
const struct autorecode_pgm *);
static void arc_free (struct autorecode_pgm *);
/* Performs the AUTORECODE procedure. */
int
static void arc_free (struct autorecode_pgm *);
/* Performs the AUTORECODE procedure. */
int
-cmd_autorecode (
void
)
+cmd_autorecode (
struct dataset *ds
)
{
struct autorecode_pgm arc;
size_t dst_cnt;
{
struct autorecode_pgm arc;
size_t dst_cnt;
@@
-120,7
+121,7
@@
cmd_autorecode (void)
lex_match_id ("VARIABLES");
lex_match ('=');
lex_match_id ("VARIABLES");
lex_match ('=');
- if (!parse_variables (d
efault_dict
, &arc.src_vars, &arc.var_cnt,
+ if (!parse_variables (d
ataset_dict (ds)
, &arc.src_vars, &arc.var_cnt,
PV_NO_DUPLICATE))
goto lossage;
if (!lex_force_match_id ("INTO"))
PV_NO_DUPLICATE))
goto lossage;
if (!lex_force_match_id ("INTO"))
@@
-158,7
+159,7
@@
cmd_autorecode (void)
{
int j;
{
int j;
- if (dict_lookup_var (d
efault_dict
, arc.dst_names[i]) != NULL)
+ if (dict_lookup_var (d
ataset_dict (ds)
, arc.dst_names[i]) != NULL)
{
msg (SE, _("Target variable %s duplicates existing variable %s."),
arc.dst_names[i], arc.dst_names[i]);
{
msg (SE, _("Target variable %s duplicates existing variable %s."),
arc.dst_names[i], arc.dst_names[i]);
@@
-184,13
+185,13
@@
cmd_autorecode (void)
arc.src_values[i] = hsh_create (10, compare_numeric_value,
hash_numeric_value, NULL, NULL);
arc.src_values[i] = hsh_create (10, compare_numeric_value,
hash_numeric_value, NULL, NULL);
- ok = procedure (autorecode_proc_func, &arc);
+ ok = procedure (
ds,
autorecode_proc_func, &arc);
for (i = 0; i < arc.var_cnt; i++)
for (i = 0; i < arc.var_cnt; i++)
- arc.dst_vars[i] = dict_create_var_assert (d
efault_dict
,
+ arc.dst_vars[i] = dict_create_var_assert (d
ataset_dict (ds)
,
arc.dst_names[i], 0);
arc.dst_names[i], 0);
- recode (&arc);
+ recode (
ds,
&arc);
arc_free (&arc);
return ok ? CMD_SUCCESS : CMD_CASCADING_FAILURE;
arc_free (&arc);
return ok ? CMD_SUCCESS : CMD_CASCADING_FAILURE;
@@
-227,7
+228,7
@@
arc_free (struct autorecode_pgm *arc)
/* AUTORECODE transformation. */
static void
/* AUTORECODE transformation. */
static void
-recode (const struct autorecode_pgm *arc)
+recode (
struct dataset *ds,
const struct autorecode_pgm *arc)
{
struct autorecode_trns *trns;
size_t i;
{
struct autorecode_trns *trns;
size_t i;
@@
-266,12
+267,13
@@
recode (const struct autorecode_pgm *arc)
hsh_force_insert (spec->items, item);
}
}
hsh_force_insert (spec->items, item);
}
}
- add_transformation (autorecode_trns_proc, autorecode_trns_free, trns);
+ add_transformation (ds,
+ autorecode_trns_proc, autorecode_trns_free, trns);
}
/* Executes an AUTORECODE transformation. */
static int
}
/* Executes an AUTORECODE transformation. */
static int
-autorecode_trns_proc (void *trns_, struct ccase *c,
int
case_idx UNUSED)
+autorecode_trns_proc (void *trns_, struct ccase *c,
casenumber
case_idx UNUSED)
{
struct autorecode_trns *trns = trns_;
size_t i;
{
struct autorecode_trns *trns = trns_;
size_t i;
@@
-309,7
+311,7
@@
autorecode_trns_free (void *trns_)
/* AUTORECODE procedure. */
static int
/* AUTORECODE procedure. */
static int
-compare_alpha_value (const void *a_, const void *b_, void *v_)
+compare_alpha_value (const void *a_, const void *b_,
const
void *v_)
{
const union arc_value *a = a_;
const union arc_value *b = b_;
{
const union arc_value *a = a_;
const union arc_value *b = b_;
@@
-319,7
+321,7
@@
compare_alpha_value (const void *a_, const void *b_, void *v_)
}
static unsigned
}
static unsigned
-hash_alpha_value (const void *a_, void *v_)
+hash_alpha_value (const void *a_,
const
void *v_)
{
const union arc_value *a = a_;
const struct variable *v = v_;
{
const union arc_value *a = a_;
const struct variable *v = v_;
@@
-328,7
+330,7
@@
hash_alpha_value (const void *a_, void *v_)
}
static int
}
static int
-compare_numeric_value (const void *a_, const void *b_,
void *foo
UNUSED)
+compare_numeric_value (const void *a_, const void *b_,
const void *aux
UNUSED)
{
const union arc_value *a = a_;
const union arc_value *b = b_;
{
const union arc_value *a = a_;
const union arc_value *b = b_;
@@
-337,7
+339,7
@@
compare_numeric_value (const void *a_, const void *b_, void *foo UNUSED)
}
static unsigned
}
static unsigned
-hash_numeric_value (const void *a_,
void *foo
UNUSED)
+hash_numeric_value (const void *a_,
const void *aux
UNUSED)
{
const union arc_value *a = a_;
{
const union arc_value *a = a_;
@@
-345,7
+347,7
@@
hash_numeric_value (const void *a_, void *foo UNUSED)
}
static bool
}
static bool
-autorecode_proc_func (const struct ccase *c, void *arc_)
+autorecode_proc_func (const struct ccase *c, void *arc_
, const struct dataset *ds UNUSED
)
{
struct autorecode_pgm *arc = arc_;
size_t i;
{
struct autorecode_pgm *arc = arc_;
size_t i;