projects
/
pspp-builds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed some memory leaks.
[pspp-builds.git]
/
src
/
loop.c
diff --git
a/src/loop.c
b/src/loop.c
index 7f8aa87559cbfacc32029715426623aa45c988c0..ebe5ed2257a1f9eaff83b804b8a5b9933296281e 100644
(file)
--- a/
src/loop.c
+++ b/
src/loop.c
@@
-18,9
+18,11
@@
02111-1307, USA. */
#include <config.h>
02111-1307, USA. */
#include <config.h>
-#include
<assert.h>
+#include
"error.h"
#include "alloc.h"
#include "alloc.h"
+#include "case.h"
#include "command.h"
#include "command.h"
+#include "dictionary.h"
#include "do-ifP.h"
#include "error.h"
#include "expr.h"
#include "do-ifP.h"
#include "error.h"
#include "expr.h"
@@
-198,7
+200,7
@@
internal_cmd_loop (void)
assert (token == '=');
lex_get ();
assert (token == '=');
lex_get ();
- one->init = expr_parse (
PXP
_NUMERIC);
+ one->init = expr_parse (
EXPR
_NUMERIC);
if (!one->init)
return 0;
if (!one->init)
return 0;
@@
-207,7
+209,7
@@
internal_cmd_loop (void)
expr_free (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 (!one->term)
{
expr_free (one->init);
@@
-216,7
+218,7
@@
internal_cmd_loop (void)
if (lex_match (T_BY))
{
if (lex_match (T_BY))
{
- one->incr = expr_parse (
PXP
_NUMERIC);
+ one->incr = expr_parse (
EXPR
_NUMERIC);
if (!one->incr)
return 0;
}
if (!one->incr)
return 0;
}
@@
-229,7
+231,7
@@
internal_cmd_loop (void)
{
two->flags |= LPC_COND;
{
two->flags |= LPC_COND;
- two->cond = expr_parse (
PXP
_BOOLEAN);
+ two->cond = expr_parse (
EXPR
_BOOLEAN);
if (!two->cond)
return 0;
}
if (!two->cond)
return 0;
}
@@
-259,15
+261,6
@@
internal_cmd_loop (void)
add_transformation ((struct trns_header *) one);
add_transformation ((struct trns_header *) two);
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;
}
return 1;
}
@@
-313,7
+306,7
@@
internal_cmd_end_loop (void)
/* Parse the expression if any. */
if (lex_match_id ("IF"))
{
/* 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;
}
if (!thr->cond)
return 0;
}
@@
-328,13
+321,6
@@
internal_cmd_end_loop (void)
/* Pop off the top of stack. */
ctl_stack = ctl_stack->down;
/* 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;
}
return 1;
}
@@
-360,7
+346,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. */
/* Even if the loop is never entered, force the index variable
to assume the initial value. */
- c
->data[two->index->fv].
f = t1.f;
+ c
ase_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)
/* Throw out various pathological cases. */
if (!finite (t1.f) || !finite (t2.f) || !finite (t3.f) || t2.f == 0.0)
@@
-428,7
+414,7
@@
loop_2_trns_proc (struct trns_header * trns, struct ccase * c,
return two->loop_term;
/* Set the current value into the case. */
return two->loop_term;
/* Set the current value into the case. */
- c
->data[two->index->fv].
f = two->curr;
+ c
ase_data_rw (c, two->index->fv)->
f = two->curr;
/* Decrement the current value. */
two->curr += two->incr;
/* Decrement the current value. */
two->curr += two->incr;
@@
-441,7
+427,7
@@
loop_2_trns_proc (struct trns_header * trns, struct ccase * c,
return two->loop_term;
/* Set the current value into the case. */
return two->loop_term;
/* Set the current value into the case. */
- c
->data[two->index->fv].
f = two->curr;
+ c
ase_data_rw (c, two->index->fv)->
f = two->curr;
/* Increment the current value. */
two->curr += two->incr;
/* Increment the current value. */
two->curr += two->incr;