#include "control-stack.h"
#include <data/case.h>
#include <data/dictionary.h>
-#include <procedure.h>
+#include <data/procedure.h>
#include <data/settings.h>
#include <data/transformations.h>
#include <data/variable.h>
int past_END_LOOP_index; /* Just past END LOOP transformation. */
};
-static struct ctl_class loop_class;
+static const struct ctl_class loop_class;
static trns_finalize_func loop_trns_finalize;
static trns_proc_func loop_trns_proc, end_loop_trns_proc, break_trns_proc;
/* Find index variable and create if necessary. */
if (ok && index_var_name[0] != '\0')
{
- loop->index_var = dict_lookup_var (default_dict, index_var_name);
+ loop->index_var = dict_lookup_var (dataset_dict (current_dataset), index_var_name);
if (loop->index_var == NULL)
- loop->index_var = dict_create_var (default_dict, index_var_name, 0);
+ loop->index_var = dict_create_var (dataset_dict (current_dataset), index_var_name, 0);
}
if (!ok)
if (loop == NULL)
return CMD_CASCADING_FAILURE;
- add_transformation (break_trns_proc, NULL, loop);
+ add_transformation (current_dataset, break_trns_proc, NULL, loop);
return lex_end_of_command ();
}
{
struct loop_trns *loop = loop_;
- add_transformation (end_loop_trns_proc, NULL, loop);
- loop->past_END_LOOP_index = next_transformation ();
+ add_transformation (current_dataset, end_loop_trns_proc, NULL, loop);
+ loop->past_END_LOOP_index = next_transformation (current_dataset);
/* If there's nothing else limiting the number of loops, use
MXLOOPS as a limit. */
static bool
parse_if_clause (struct loop_trns *loop, struct expression **condition)
{
- *condition = expr_parse_pool (loop->pool, default_dict, EXPR_BOOLEAN);
+ *condition = expr_parse_pool (loop->pool, dataset_dict (current_dataset), EXPR_BOOLEAN);
return *condition != NULL;
}
if (!lex_force_match ('='))
return false;
- loop->first_expr = expr_parse_pool (loop->pool, default_dict, EXPR_NUMBER);
+ loop->first_expr = expr_parse_pool (loop->pool, dataset_dict (current_dataset), EXPR_NUMBER);
if (loop->first_expr == NULL)
return false;
lex_sbc_only_once (e == &loop->last_expr ? "TO" : "BY");
return false;
}
- *e = expr_parse_pool (loop->pool, default_dict, EXPR_NUMBER);
+ *e = expr_parse_pool (loop->pool, dataset_dict (current_dataset), EXPR_NUMBER);
if (*e == NULL)
return false;
}
loop->first_expr = loop->by_expr = loop->last_expr = NULL;
loop->loop_condition = loop->end_loop_condition = NULL;
- add_transformation_with_finalizer (loop_trns_finalize,
+ add_transformation_with_finalizer (current_dataset, loop_trns_finalize,
loop_trns_proc, loop_trns_free, loop);
- loop->past_LOOP_index = next_transformation ();
+ loop->past_LOOP_index = next_transformation (current_dataset);
ctl_stack_push (&loop_class, loop);
/* Sets up LOOP for the first pass. */
static int
-loop_trns_proc (void *loop_, struct ccase *c, int case_num)
+loop_trns_proc (void *loop_, struct ccase *c, casenum_t case_num)
{
struct loop_trns *loop = loop_;
/* Finishes a pass through the loop and starts the next. */
static int
-end_loop_trns_proc (void *loop_, struct ccase *c, int case_num UNUSED)
+end_loop_trns_proc (void *loop_, struct ccase *c, casenum_t case_num UNUSED)
{
struct loop_trns *loop = loop_;
/* Executes BREAK. */
static int
-break_trns_proc (void *loop_, struct ccase *c UNUSED, int case_num UNUSED)
+break_trns_proc (void *loop_, struct ccase *c UNUSED, casenum_t case_num UNUSED)
{
struct loop_trns *loop = loop_;
}
/* LOOP control structure class definition. */
-static struct ctl_class loop_class =
+static const struct ctl_class loop_class =
{
"LOOP",
"END LOOP",