#include "data/dataset.h"
#include "data/dictionary.h"
#include "language/command.h"
+#include "language/lexer/lexer.h"
#include "language/lexer/variable-parser.h"
#include "libpspp/message.h"
cmd_delete_variables (struct lexer *lexer, struct dataset *ds)
{
struct variable **vars;
- size_t var_cnt;
+ size_t n_vars;
bool ok;
if (proc_make_temporary_transformations_permanent (ds))
- msg (SE, _("%s may not be used after %s. "
- "Temporary transformations will be made permanent."),
- "DELETE VARIABLES", "TEMPORARY");
+ lex_ofs_error (lexer, 0, lex_ofs (lexer) - 1,
+ _("%s may not be used after %s. "
+ "Temporary transformations will be made permanent."),
+ "DELETE VARIABLES", "TEMPORARY");
- if (!parse_variables (lexer, dataset_dict (ds), &vars, &var_cnt, PV_NONE))
+ if (!parse_variables (lexer, dataset_dict (ds), &vars, &n_vars, PV_NONE))
goto error;
- if (var_cnt == dict_get_var_cnt (dataset_dict (ds)))
+ if (n_vars == dict_get_n_vars (dataset_dict (ds)))
{
- msg (SE, _("%s may not be used to delete all variables "
- "from the active dataset dictionary. "
- "Use %s instead."), "DELETE VARIABLES", "NEW FILE");
+ lex_ofs_error (lexer, 0, lex_ofs (lexer) - 1,
+ _("%s may not be used to delete all variables "
+ "from the active dataset dictionary. "
+ "Use %s instead."), "DELETE VARIABLES", "NEW FILE");
goto error;
}
if (!ok)
goto error;
- dict_delete_vars (dataset_dict (ds), vars, var_cnt);
+ dict_delete_vars (dataset_dict (ds), vars, n_vars);
/* XXX A bunch of bugs conspire to make executing transformations again here
necessary, even though it shouldn't be.