X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fsel-if.c;h=6f6f2d0279269083acb9e072e6648d9c9bf73285;hb=205eaea8e2d95e20baa2c00a495b0ac4f9646372;hp=07fe318f114b578991aee80a73235f46d5fee1f7;hpb=3a7fba81ceae5b049d0f7d671e9e3c3c43bbf703;p=pspp-builds.git diff --git a/src/sel-if.c b/src/sel-if.c index 07fe318f..6f6f2d02 100644 --- a/src/sel-if.c +++ b/src/sel-if.c @@ -33,8 +33,8 @@ struct select_if_trns struct expression *e; /* Test expression. */ }; -static int select_if_proc (struct trns_header *, struct ccase *); -static void select_if_free (struct trns_header *); +static trns_proc_func select_if_proc; +static trns_free_func select_if_free; /* Parses the SELECT IF transformation. */ int @@ -43,10 +43,7 @@ cmd_select_if (void) struct expression *e; struct select_if_trns *t; - lex_match_id ("SELECT"); - lex_match_id ("IF"); - - e = expr_parse (PXP_BOOLEAN); + e = expr_parse (EXPR_BOOLEAN); if (!e) return CMD_FAILURE; @@ -68,9 +65,11 @@ cmd_select_if (void) /* Performs the SELECT IF transformation T on case C. */ static int -select_if_proc (struct trns_header * t, struct ccase * c) +select_if_proc (struct trns_header * t, struct ccase * c, + int case_num) { - return (expr_evaluate (((struct select_if_trns *) t)->e, c, NULL) == 1.0) - 2; + return (expr_evaluate (((struct select_if_trns *) t)->e, c, + case_num, NULL) == 1.0) - 2; } /* Frees SELECT IF transformation T. */ @@ -84,8 +83,6 @@ select_if_free (struct trns_header * t) int cmd_filter (void) { - lex_match_id ("FILTER"); - if (lex_match_id ("OFF")) dict_set_filter (default_dict, NULL); else @@ -103,7 +100,7 @@ cmd_filter (void) return CMD_FAILURE; } - if (v->name[0] == '#') + if (dict_class_from_id (v->name) == DC_SCRATCH) { msg (SE, _("The filter variable may not be scratch.")); return CMD_FAILURE; @@ -123,10 +120,7 @@ cmd_process_if (void) { struct expression *e; - lex_match_id ("PROCESS"); - lex_match_id ("IF"); - - e = expr_parse (PXP_BOOLEAN); + e = expr_parse (EXPR_BOOLEAN); if (!e) return CMD_FAILURE;