#include <data/dictionary.h>
#include <libpspp/message.h>
#include "helpers.h"
+#include <language/lexer/format-parser.h>
#include <language/lexer/lexer.h>
#include <language/lexer/variable-parser.h>
+#include <libpspp/assertion.h>
#include <libpspp/misc.h>
#include <libpspp/pool.h>
#include <data/settings.h>
return ¬_on_stack;
default:
- abort ();
+ NOT_REACHED ();
}
}
break;
default:
- abort ();
+ NOT_REACHED ();
}
return true;
break;
case OP_format:
- abort ();
+ NOT_REACHED ();
case OP_ni_format:
if ((*node)->type == OP_format
break;
default:
- abort ();
+ NOT_REACHED ();
}
if (do_coercion)
"JUL", "AUG", "SEP", "OCT", "NOV", "DEC",
};
- time_t last_proc_time = time_of_last_procedure ();
+ time_t last_proc_time = time_of_last_procedure (current_dataset);
struct tm *time;
char temp_buf[10];
return expr_allocate_number (e, SYSMIS);
else if (lex_match_id ("$JDATE"))
{
- time_t time = time_of_last_procedure ();
+ time_t time = time_of_last_procedure (current_dataset);
struct tm *tm = localtime (&time);
return expr_allocate_number (e, expr_ymd_to_ofs (tm->tm_year + 1900,
tm->tm_mon + 1,
}
else if (lex_match_id ("$TIME"))
{
- time_t time = time_of_last_procedure ();
+ time_t time = time_of_last_procedure (current_dataset);
struct tm *tm = localtime (&time);
return expr_allocate_number (e,
expr_ymd_to_date (tm->tm_year + 1900,
{
/* Try to parse it as a format specifier. */
struct fmt_spec fmt;
- if (parse_format_specifier (&fmt, FMTP_SUPPRESS_ERRORS))
+ bool ok;
+
+ msg_disable ();
+ ok = parse_format_specifier (&fmt);
+ msg_enable ();
+
+ if (ok)
return expr_allocate_format (e, &fmt);
/* All attempts failed. */
/* Find vector, skip token.
The caller must already have verified that the current token
is the name of a vector. */
- vector = dict_lookup_vector (default_dict, tokid);
+ vector = dict_lookup_vector (dataset_dict (current_dataset), tokid);
assert (vector != NULL);
lex_get ();
\f
/* Individual function parsing. */
-struct operation operations[OP_first + OP_cnt] = {
+const struct operation operations[OP_first + OP_cnt] = {
#include "parse.inc"
};
const struct operation **first,
const struct operation **last)
{
- struct operation *f;
+ const struct operation *f;
for (f = operations + OP_function_first;
f <= operations + OP_function_last; f++)
size_t var_cnt;
size_t i;
- if (!parse_variables (default_dict, &vars, &var_cnt, PV_SINGLE))
+ if (!parse_variables (dataset_dict (current_dataset), &vars, &var_cnt, PV_SINGLE))
goto fail;
for (i = 0; i < var_cnt; i++)
add_arg (&args, &arg_cnt, &arg_cap,
msg (SE, _("%s is not yet implemented."), f->prototype);
goto fail;
}
- if ((f->flags & OPF_PERM_ONLY) && proc_in_temporary_transformations ())
+ if ((f->flags & OPF_PERM_ONLY) &&
+ proc_in_temporary_transformations (current_dataset))
{
msg (SE, _("%s may not appear after TEMPORARY."), f->prototype);
goto fail;
if (n->type == OP_LAG_Vn || n->type == OP_LAG_Vs)
{
- if (n_lag < 1)
- n_lag = 1;
+ if (dataset_n_lag (current_dataset) < 1)
+ dataset_set_n_lag (current_dataset, 1);
}
else if (n->type == OP_LAG_Vnn || n->type == OP_LAG_Vsn)
{
assert (n->composite.arg_cnt == 2);
assert (n->composite.args[1]->type == OP_pos_int);
n_before = n->composite.args[1]->integer.i;
- if (n_lag < n_before)
- n_lag = n_before;
+ if ( dataset_n_lag (current_dataset) < n_before)
+ dataset_set_n_lag (current_dataset, n_before);
}
free (args);
else if (is_composite (n->type))
return operations[n->type].returns;
else
- abort ();
+ NOT_REACHED ();
}
static const char *
static bool
is_valid_node (union any_node *n)
{
- struct operation *op;
+ const struct operation *op;
size_t i;
assert (n != NULL);