#include <config.h>
#include <procedure.h>
-#include <data/case-source.h>
-#include <data/case-sink.h>
-#include <data/storage-stream.h>
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include "expressions/public.h"
+#include <data/case-source.h>
+#include <data/case-sink.h>
#include <data/case.h>
#include <data/casefile.h>
#include <data/dictionary.h>
#include <data/file-handle-def.h>
#include <data/settings.h>
+#include <data/storage-stream.h>
#include <data/value-labels.h>
#include <data/variable.h>
#include <language/control/control-stack.h>
#include <libpspp/alloc.h>
#include <libpspp/message.h>
-#include <libpspp/message.h>
#include <libpspp/misc.h>
#include <libpspp/str.h>
#include <output/manager.h>
/* Time at which vfm was last invoked. */
static time_t last_vfm_invocation;
+/* Whether we're inside a procedure.
+ For debugging purposes only. */
+static bool in_procedure;
+
/* Lag queue. */
int n_lag; /* Number of cases to lag. */
static int lag_count; /* Number of cases in lag_queue so far. */
static bool
internal_procedure (bool (*proc_func) (struct ccase *, void *), void *aux)
{
- static int recursive_call;
struct write_case_data wc_data;
bool ok;
- assert (++recursive_call == 1);
-
wc_data.proc_func = proc_func;
wc_data.aux = aux;
create_trns_case (&wc_data.trns_case, default_dict);
case_destroy (&wc_data.sink_case);
case_destroy (&wc_data.trns_case);
- assert (--recursive_call == 0);
-
return ok;
}
union value *value = case_data_rw (trns_case, v->fv);
if (v->type == NUMERIC)
- value->f = v->reinit ? 0.0 : SYSMIS;
+ value->f = v->leave ? 0.0 : SYSMIS;
else
memset (value->s, ' ', v->width);
}
static void
open_active_file (void)
{
+ assert (!in_procedure);
+ in_procedure = true;
+
/* Make temp_dict refer to the dictionary right before data
reaches the sink */
if (!temporary)
}
/* Transforms trns_case and writes it to the replacement active
- file if advisable. Returns nonzero if more cases can be
- accepted, zero otherwise. Do not call this function again
- after it has returned zero once. */
+ file if advisable. Returns true if more cases can be
+ accepted, false otherwise. Do not call this function again
+ after it has returned false once. */
static bool
write_case (struct write_case_data *wc_data)
{
for (i = 0; i < var_cnt; i++)
{
struct variable *v = dict_get_var (default_dict, i);
- if (v->reinit)
+ if (!v->leave)
{
if (v->type == NUMERIC)
case_data_rw (c, v->fv)->f = SYSMIS;
process_if_expr = NULL;
dict_set_case_limit (default_dict, 0);
dict_clear_vectors (default_dict);
+
+ assert (in_procedure);
+ in_procedure = false;
+
return cancel_transformations ();
}
\f
add_transformation (trns_proc_func *proc, trns_free_func *free, void *private)
{
struct transformation *trns;
+
+ assert (!in_procedure);
+
if (n_trns >= m_trns)
t_trns = x2nrealloc (t_trns, &m_trns, sizeof *t_trns);
trns = &t_trns[n_trns++];