02111-1307, USA. */
#include <config.h>
-#include <assert.h>
+#include "error.h"
#include "alloc.h"
+#include "case.h"
#include "command.h"
#include "do-ifP.h"
#include "error.h"
/* Name of indexing variable if applicable. */
char name[9];
- lex_match_id ("LOOP");
-
/* Create and initialize transformations to facilitate
error-handling. */
two = xmalloc (sizeof *two);
assert (token == '=');
lex_get ();
- one->init = expr_parse (PXP_NUMERIC);
+ one->init = expr_parse (EXPR_NUMERIC);
if (!one->init)
return 0;
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);
if (lex_match (T_BY))
{
- one->incr = expr_parse (PXP_NUMERIC);
+ one->incr = expr_parse (EXPR_NUMERIC);
if (!one->incr)
return 0;
}
{
two->flags |= LPC_COND;
- two->cond = expr_parse (PXP_BOOLEAN);
+ two->cond = expr_parse (EXPR_BOOLEAN);
if (!two->cond)
return 0;
}
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;
}
/* 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;
}
/* 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;
}
/* 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)
if (two->flags == 0)
{
two->pass++;
- if (two->pass > set_mxloops)
+ if (two->pass > get_mxloops() )
return two->loop_term;
}
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;
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;
/* New transformation. */
struct break_trns *t;
- lex_match_id ("BREAK");
-
for (loop = ctl_stack; loop; loop = loop->down)
if (loop->type == CST_LOOP)
break;