X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Floop.c;h=5e3f16991393149b27e9f136a921c8cd0db1763f;hb=d2f8593a1f1d39a3264682af0da898a3d67b68cf;hp=bfb18e6e4bba917409825d4a077b00d44110dd8b;hpb=205ac3afa4c2b19c85819d8695abf3975bb11807;p=pspp diff --git a/src/loop.c b/src/loop.c index bfb18e6e4b..5e3f169913 100644 --- a/src/loop.c +++ b/src/loop.c @@ -20,6 +20,7 @@ #include #include "error.h" #include "alloc.h" +#include "case.h" #include "command.h" #include "do-ifP.h" #include "error.h" @@ -198,7 +199,7 @@ internal_cmd_loop (void) assert (token == '='); lex_get (); - one->init = expr_parse (PXP_NUMERIC); + one->init = expr_parse (EXPR_NUMERIC); if (!one->init) return 0; @@ -207,7 +208,7 @@ internal_cmd_loop (void) expr_free (one->init); return 0; } - one->term = expr_parse (PXP_NUMERIC); + one->term = expr_parse (EXPR_NUMERIC); if (!one->term) { expr_free (one->init); @@ -216,7 +217,7 @@ internal_cmd_loop (void) if (lex_match (T_BY)) { - one->incr = expr_parse (PXP_NUMERIC); + one->incr = expr_parse (EXPR_NUMERIC); if (!one->incr) return 0; } @@ -229,7 +230,7 @@ internal_cmd_loop (void) { two->flags |= LPC_COND; - two->cond = expr_parse (PXP_BOOLEAN); + two->cond = expr_parse (EXPR_BOOLEAN); if (!two->cond) return 0; } @@ -259,15 +260,6 @@ internal_cmd_loop (void) add_transformation ((struct trns_header *) one); add_transformation ((struct trns_header *) two); -#if DEBUGGING - printf ("LOOP"); - if (two->flags & LPC_INDEX) - printf ("(INDEX)"); - if (two->flags & LPC_COND) - printf ("(IF)"); - printf ("\n"); -#endif - return 1; } @@ -313,7 +305,7 @@ internal_cmd_end_loop (void) /* Parse the expression if any. */ if (lex_match_id ("IF")) { - thr->cond = expr_parse (PXP_BOOLEAN); + thr->cond = expr_parse (EXPR_BOOLEAN); if (!thr->cond) return 0; } @@ -328,13 +320,6 @@ internal_cmd_end_loop (void) /* Pop off the top of stack. */ ctl_stack = ctl_stack->down; -#if DEBUGGING - printf ("END LOOP"); - if (thr->cond) - printf ("(IF)"); - printf ("\n"); -#endif - return 1; } @@ -360,7 +345,7 @@ loop_1_trns_proc (struct trns_header * trns, struct ccase * c, /* Even if the loop is never entered, force the index variable to assume the initial value. */ - c->data[two->index->fv].f = t1.f; + case_data_rw (c, two->index->fv)->f = t1.f; /* Throw out various pathological cases. */ if (!finite (t1.f) || !finite (t2.f) || !finite (t3.f) || t2.f == 0.0) @@ -428,7 +413,7 @@ loop_2_trns_proc (struct trns_header * trns, struct ccase * c, return two->loop_term; /* Set the current value into the case. */ - c->data[two->index->fv].f = two->curr; + case_data_rw (c, two->index->fv)->f = two->curr; /* Decrement the current value. */ two->curr += two->incr; @@ -441,7 +426,7 @@ loop_2_trns_proc (struct trns_header * trns, struct ccase * c, return two->loop_term; /* Set the current value into the case. */ - c->data[two->index->fv].f = two->curr; + case_data_rw (c, two->index->fv)->f = two->curr; /* Increment the current value. */ two->curr += two->incr;