X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Flanguage%2Fxforms%2Frecode.c;h=467a18652db46384e5b045a174f29d310f3fdee8;hb=9ee1aad236391465bf88b779a5fc9b47a739c698;hp=a2d963188ac949d64fa5e1ea9829d8f59375411a;hpb=339f1956cc727eda788638644ef93ab7852b31cd;p=pspp diff --git a/src/language/xforms/recode.c b/src/language/xforms/recode.c index a2d963188a..467a18652d 100644 --- a/src/language/xforms/recode.c +++ b/src/language/xforms/recode.c @@ -128,8 +128,9 @@ static void set_map_out_str (struct map_out *, struct pool *, static bool enlarge_dst_widths (struct recode_trns *); static void create_dst_vars (struct recode_trns *, struct dictionary *); -static trns_proc_func recode_trns_proc; -static trns_free_func recode_trns_free; +static bool recode_trns_free (void *trns_); + +static const struct trns_class recode_trns_class; /* Parser. */ @@ -173,8 +174,7 @@ cmd_recode (struct lexer *lexer, struct dataset *ds) create_dst_vars (trns, dict); /* Done. */ - add_transformation (ds, - recode_trns_proc, recode_trns_free, trns); + add_transformation (ds, &recode_trns_class, trns); } while (lex_match (lexer, T_SLASH)); @@ -615,7 +615,7 @@ find_src_numeric (struct recode_trns *trns, double value, const struct variable match = value == in->x.f; break; case MAP_MISSING: - match = var_is_num_missing (v, value, MV_ANY); + match = var_is_num_missing (v, value) != 0; break; case MAP_RANGE: match = value >= in->x.f && value <= in->y.f; @@ -676,7 +676,7 @@ find_src_string (struct recode_trns *trns, const uint8_t *value, break; } case MAP_MISSING: - match = var_is_str_missing (src_var, value, MV_ANY); + match = var_is_str_missing (src_var, value) != 0; break; default: NOT_REACHED (); @@ -690,7 +690,7 @@ find_src_string (struct recode_trns *trns, const uint8_t *value, } /* Performs RECODE transformation. */ -static int +static enum trns_result recode_trns_proc (void *trns_, struct ccase **c, casenumber case_idx UNUSED) { struct recode_trns *trns = trns_; @@ -747,3 +747,9 @@ recode_trns_free (void *trns_) pool_destroy (trns->pool); return true; } + +static const struct trns_class recode_trns_class = { + .name = "RECODE", + .execute = recode_trns_proc, + .destroy = recode_trns_free, +};