230 |
|
|
231 |
/* Parses a set of numeric criterion values. */ |
/* Parses a set of numeric criterion values. */ |
232 |
static int |
static int |
233 |
parse_numeric_criteria (struct counting * c) |
parse_numeric_criteria (struct counting *c) |
234 |
{ |
{ |
235 |
size_t n = 0; |
size_t n = 0; |
236 |
size_t m = 0; |
size_t m = 0; |
243 |
if (n + 1 >= m) |
if (n + 1 >= m) |
244 |
{ |
{ |
245 |
m += 16; |
m += 16; |
246 |
c->crit.n = xrealloc (c->crit.n, m * sizeof (struct cnt_num)); |
c->crit.n = xnrealloc (c->crit.n, m, sizeof *c->crit.n); |
247 |
} |
} |
248 |
|
|
249 |
cur = &c->crit.n[n++]; |
cur = &c->crit.n[n++]; |
324 |
/* Parses a set of string criteria values. The skeleton is the same |
/* Parses a set of string criteria values. The skeleton is the same |
325 |
as parse_numeric_criteria(). */ |
as parse_numeric_criteria(). */ |
326 |
static int |
static int |
327 |
parse_string_criteria (struct counting * c) |
parse_string_criteria (struct counting *c) |
328 |
{ |
{ |
329 |
int len = 0; |
int len = 0; |
330 |
|
|
344 |
if (n + 1 >= m) |
if (n + 1 >= m) |
345 |
{ |
{ |
346 |
m += 16; |
m += 16; |
347 |
c->crit.n = xrealloc (c->crit.n, m * sizeof (struct cnt_str)); |
c->crit.s = xnrealloc (c->crit.s, m, sizeof *c->crit.s); |
348 |
} |
} |
349 |
|
|
350 |
if (!lex_force_string ()) |
if (!lex_force_string ()) |
368 |
|
|
369 |
/* Counts the number of values in case C matching counting CNT. */ |
/* Counts the number of values in case C matching counting CNT. */ |
370 |
static inline int |
static inline int |
371 |
count_numeric (struct counting * cnt, struct ccase * c) |
count_numeric (struct counting *cnt, struct ccase *c) |
372 |
{ |
{ |
373 |
int counter = 0; |
int counter = 0; |
374 |
size_t i; |
size_t i; |
433 |
|
|
434 |
/* Counts the number of values in case C matching counting CNT. */ |
/* Counts the number of values in case C matching counting CNT. */ |
435 |
static inline int |
static inline int |
436 |
count_string (struct counting * cnt, struct ccase * c) |
count_string (struct counting *cnt, struct ccase *c) |
437 |
{ |
{ |
438 |
int counter = 0; |
int counter = 0; |
439 |
size_t i; |
size_t i; |
466 |
|
|
467 |
/* Performs the COUNT transformation T on case C. */ |
/* Performs the COUNT transformation T on case C. */ |
468 |
static int |
static int |
469 |
count_trns_proc (struct trns_header * trns, struct ccase * c, |
count_trns_proc (struct trns_header *trns, struct ccase *c, |
470 |
int case_num UNUSED) |
int case_num UNUSED) |
471 |
{ |
{ |
472 |
struct cnt_var_info *info; |
struct cnt_var_info *info; |
488 |
|
|
489 |
/* Destroys all dynamic data structures associated with T. */ |
/* Destroys all dynamic data structures associated with T. */ |
490 |
static void |
static void |
491 |
count_trns_free (struct trns_header * t) |
count_trns_free (struct trns_header *t) |
492 |
{ |
{ |
493 |
struct cnt_var_info *iter, *next; |
struct cnt_var_info *iter, *next; |
494 |
|
|