X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=inline;f=src%2Fdo-if.c;h=0dd6466a52895ea9c2fe475c4ad2dcab20d34a78;hb=6d34b6cd00bb26603f8acedd3f0ed69a4484e484;hp=88022b3b4ccf257b163e058f7e19768699c9f229;hpb=fcb9e49b2a2d57af7c001ae5d2eda9ac443ba36b;p=pspp diff --git a/src/do-if.c b/src/do-if.c index 88022b3b4c..0dd6466a52 100644 --- a/src/do-if.c +++ b/src/do-if.c @@ -18,6 +18,7 @@ 02111-1307, USA. */ #include +#include "do-ifP.h" #include #include #include "alloc.h" @@ -73,13 +74,10 @@ */ /* *INDENT-ON* */ -#include "do-ifP.h" - static struct do_if_trns *parse_do_if (void); static void add_ELSE_IF (struct do_if_trns *); -static int goto_trns_proc (struct trns_header *, struct ccase *); -static int do_if_trns_proc (struct trns_header *, struct ccase *); -static void do_if_trns_free (struct trns_header *); +static trns_proc_func goto_trns_proc, do_if_trns_proc; +static trns_free_func do_if_trns_free; /* Parse DO IF. */ int @@ -157,8 +155,6 @@ cmd_else (void) { struct do_if_trns *t; - lex_match_id ("ELSE"); - /* Check that we're in a pleasing situation. */ if (!ctl_stack || ctl_stack->type != CST_DO_IF) { @@ -200,8 +196,6 @@ cmd_end_if (void) /* List iterator. */ struct do_if_trns *iter; - lex_match_id ("IF"); - /* Check that we're in a pleasing situation. */ if (!ctl_stack || ctl_stack->type != CST_DO_IF) { @@ -254,8 +248,6 @@ parse_do_if (void) struct do_if_trns *t; struct expression *e; - lex_match_id ("IF"); - e = expr_parse (PXP_BOOLEAN); if (!e) return NULL; @@ -277,18 +269,20 @@ parse_do_if (void) /* Executes a goto transformation. */ static int -goto_trns_proc (struct trns_header * t, struct ccase * c unused) +goto_trns_proc (struct trns_header * t, struct ccase * c UNUSED, + int case_num UNUSED) { return ((struct goto_trns *) t)->dest; } static int -do_if_trns_proc (struct trns_header * trns, struct ccase * c) +do_if_trns_proc (struct trns_header * trns, struct ccase * c, + int case_num UNUSED) { struct do_if_trns *t = (struct do_if_trns *) trns; union value bool; - expr_evaluate (t->cond, c, &bool); + expr_evaluate (t->cond, c, case_num, &bool); if (bool.f == 1.0) { debug_printf ((_("DO IF %d: true\n"), t->h.index));