58 |
struct trns_header h; |
struct trns_header h; |
59 |
struct pool *owner; /* Contains AUTORECODE specs. */ |
struct pool *owner; /* Contains AUTORECODE specs. */ |
60 |
struct arc_spec *specs; /* AUTORECODE specifications. */ |
struct arc_spec *specs; /* AUTORECODE specifications. */ |
61 |
int spec_cnt; /* Number of specifications. */ |
size_t spec_cnt; /* Number of specifications. */ |
62 |
}; |
}; |
63 |
|
|
64 |
/* Descending or ascending sort order. */ |
/* Descending or ascending sort order. */ |
75 |
char **dst_names; /* Target variable names. */ |
char **dst_names; /* Target variable names. */ |
76 |
struct variable **dst_vars; /* Target variables. */ |
struct variable **dst_vars; /* Target variables. */ |
77 |
struct hsh_table **src_values; /* `union value's of source vars. */ |
struct hsh_table **src_values; /* `union value's of source vars. */ |
78 |
int var_cnt; /* Number of variables. */ |
size_t var_cnt; /* Number of variables. */ |
79 |
struct pool *src_values_pool; /* Pool used by src_values. */ |
struct pool *src_values_pool; /* Pool used by src_values. */ |
80 |
enum direction direction; /* Sort order. */ |
enum direction direction; /* Sort order. */ |
81 |
int print; /* Print mapping table if nonzero. */ |
int print; /* Print mapping table if nonzero. */ |
95 |
cmd_autorecode (void) |
cmd_autorecode (void) |
96 |
{ |
{ |
97 |
struct autorecode_pgm arc; |
struct autorecode_pgm arc; |
98 |
int dst_cnt; |
size_t dst_cnt; |
99 |
int i; |
size_t i; |
100 |
|
|
101 |
arc.src_vars = NULL; |
arc.src_vars = NULL; |
102 |
arc.dst_names = NULL; |
arc.dst_names = NULL; |
120 |
goto lossage; |
goto lossage; |
121 |
if (dst_cnt != arc.var_cnt) |
if (dst_cnt != arc.var_cnt) |
122 |
{ |
{ |
123 |
int i; |
size_t i; |
124 |
|
|
125 |
msg (SE, _("Source variable count (%d) does not match " |
msg (SE, _("Source variable count (%u) does not match " |
126 |
"target variable count (%d)."), arc.var_cnt, dst_cnt); |
"target variable count (%u)."), |
127 |
|
(unsigned) arc.var_cnt, (unsigned) dst_cnt); |
128 |
|
|
129 |
for (i = 0; i < dst_cnt; i++) |
for (i = 0; i < dst_cnt; i++) |
130 |
free (arc.dst_names[i]); |
free (arc.dst_names[i]); |
198 |
free (arc->src_vars); |
free (arc->src_vars); |
199 |
if (arc->dst_names != NULL) |
if (arc->dst_names != NULL) |
200 |
{ |
{ |
201 |
int i; |
size_t i; |
202 |
|
|
203 |
for (i = 0; i < arc->var_cnt; i++) |
for (i = 0; i < arc->var_cnt; i++) |
204 |
free (arc->dst_names[i]); |
free (arc->dst_names[i]); |
207 |
free (arc->dst_vars); |
free (arc->dst_vars); |
208 |
if (arc->src_values != NULL) |
if (arc->src_values != NULL) |
209 |
{ |
{ |
210 |
int i; |
size_t i; |
211 |
|
|
212 |
for (i = 0; i < arc->var_cnt; i++) |
for (i = 0; i < arc->var_cnt; i++) |
213 |
hsh_destroy (arc->src_values[i]); |
hsh_destroy (arc->src_values[i]); |
224 |
{ |
{ |
225 |
struct autorecode_trns *t; |
struct autorecode_trns *t; |
226 |
struct pool *pool; |
struct pool *pool; |
227 |
int i; |
size_t i; |
228 |
|
|
229 |
pool = pool_create (); |
pool = pool_create (); |
230 |
t = xmalloc (sizeof *t); |
t = xmalloc (sizeof *t); |
271 |
int case_idx UNUSED) |
int case_idx UNUSED) |
272 |
{ |
{ |
273 |
struct autorecode_trns *t = (struct autorecode_trns *) trns; |
struct autorecode_trns *t = (struct autorecode_trns *) trns; |
274 |
int i; |
size_t i; |
275 |
|
|
276 |
for (i = 0; i < t->spec_cnt; i++) |
for (i = 0; i < t->spec_cnt; i++) |
277 |
{ |
{ |
294 |
autorecode_trns_free (struct trns_header * trns) |
autorecode_trns_free (struct trns_header * trns) |
295 |
{ |
{ |
296 |
struct autorecode_trns *t = (struct autorecode_trns *) trns; |
struct autorecode_trns *t = (struct autorecode_trns *) trns; |
297 |
int i; |
size_t i; |
298 |
|
|
299 |
for (i = 0; i < t->spec_cnt; i++) |
for (i = 0; i < t->spec_cnt; i++) |
300 |
hsh_destroy (t->specs[i].items); |
hsh_destroy (t->specs[i].items); |
343 |
autorecode_proc_func (struct ccase *c, void *arc_) |
autorecode_proc_func (struct ccase *c, void *arc_) |
344 |
{ |
{ |
345 |
struct autorecode_pgm *arc = arc_; |
struct autorecode_pgm *arc = arc_; |
346 |
int i; |
size_t i; |
347 |
|
|
348 |
for (i = 0; i < arc->var_cnt; i++) |
for (i = 0; i < arc->var_cnt; i++) |
349 |
{ |
{ |