X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fcount.c;h=3b9a0ac098c752593f7b68f99ff9bf5955627e61;hb=e22db86f67a3b77124af022bbd734922c62c424c;hp=25469665baa0032751b2eba87834fb9efe1a9e7e;hpb=4944c86a9318bc5b5578ab145a95c116ffd2c9fd;p=pspp diff --git a/src/count.c b/src/count.c index 25469665ba..3b9a0ac098 100644 --- a/src/count.c +++ b/src/count.c @@ -21,7 +21,6 @@ #include #include #include "alloc.h" -#include "approx.h" #include "command.h" #include "error.h" #include "lexer.h" @@ -56,8 +55,6 @@ Perhaps simultaneity could be implemented as an option. On the other hand, what good are the above commands? */ -#undef DEBUGGING -#define DEBUGGING 1 #include "debug-print.h" /* Definitions. */ @@ -137,21 +134,6 @@ static void count_trns_free (struct trns_header *); static int parse_numeric_criteria (struct counting *); static int parse_string_criteria (struct counting *); -int cmd_count (void); - -int -internal_cmd_count (void) -{ - int code = cmd_count (); - if (!code) - { - struct count_trns c; - c.specs = head; - count_trns_free ((struct trns_header *) & c); - } - return code; -} - int cmd_count (void) { @@ -181,7 +163,7 @@ cmd_count (void) /* Get destination struct variable, or at least its name. */ if (!lex_force_id ()) goto fail; - cnt->d = find_variable (tokid); + cnt->d = dict_lookup_var (default_dict, tokid); if (cnt->d) { if (cnt->d->type == ALPHA) @@ -202,7 +184,8 @@ cmd_count (void) { c->next = NULL; c->v = NULL; - if (!parse_variables (NULL, &c->v, &c->n, PV_DUPLICATE | PV_SAME_TYPE)) + if (!parse_variables (default_dict, &c->v, &c->n, + PV_DUPLICATE | PV_SAME_TYPE)) goto fail; if (!lex_force_match ('(')) @@ -232,12 +215,12 @@ cmd_count (void) for (cnt = head; cnt; cnt = cnt->next) if (!cnt->d) { - /* It's legal, though motivationally questionable, to count to + /* It's valid, though motivationally questionable, to count to the same dest var more than once. */ - cnt->d = find_variable (cnt->n); + cnt->d = dict_lookup_var (default_dict, cnt->n); - if (!cnt->d) - cnt->d = force_create_variable (&default_dict, cnt->n, NUMERIC, 0); + if (cnt->d == NULL) + cnt->d = dict_create_var_assert (default_dict, cnt->n, 0); } #if DEBUGGING @@ -434,22 +417,22 @@ count_numeric (struct counting * cnt, struct ccase * c) assert (0); break; case CNT_SINGLE: - if (approx_ne (cmp, num->a)) + if (cmp != num->a) break; counter++; goto done; case CNT_HIGH: - if (approx_lt (cmp, num->a)) + if (cmp < num->a) break; counter++; goto done; case CNT_LOW: - if (approx_gt (cmp, num->a)) + if (cmp > num->a) break; counter++; goto done; case CNT_RANGE: - if (approx_lt (cmp, num->a) || approx_gt (cmp, num->b)) + if (cmp < num->a || cmp > num->b) break; counter++; goto done;