#include <stdlib.h>
-#include <procedure.h>
+#include <data/procedure.h>
#include <data/dictionary.h>
#include <data/variable.h>
#include <language/command.h>
#include <language/lexer/lexer.h>
+#include <language/lexer/variable-parser.h>
#include <libpspp/alloc.h>
+#include <libpspp/assertion.h>
#include <libpspp/message.h>
#include <libpspp/misc.h>
#include <libpspp/str.h>
#define _(msgid) gettext (msgid)
int
-cmd_vector (void)
+cmd_vector (struct dataset *ds)
{
/* Just to be different, points to a set of null terminated strings
containing the names of the vectors to be created. The list
/* Maximum allocated position for vecnames, plus one position. */
char *endp = NULL;
+ struct dictionary *dict = dataset_dict (ds);
+
cp = vecnames = xmalloc (256);
endp = &vecnames[256];
do
goto fail;
}
- if (dict_lookup_vector (default_dict, tokid))
+ if (dict_lookup_vector (dict, tokid))
{
msg (SE, _("There is already a vector with name %s."), tokid);
goto fail;
goto fail;
}
- if (!parse_variables (default_dict, &v, &nv,
+ if (!parse_variables (dict, &v, &nv,
PV_SAME_TYPE | PV_DUPLICATE))
goto fail;
- dict_create_vector (default_dict, vecnames, v, nv);
+ dict_create_vector (dict, vecnames, v, nv);
free (v);
}
else if (lex_match ('('))
for (i = 0; i < nv; i++)
{
sprintf (name, "%s%d", cp, i + 1);
- if (dict_lookup_var (default_dict, name))
+ if (dict_lookup_var (dict, name))
{
msg (SE, _("There is already a variable named %s."),
name);
for (i = 0; i < nv; i++)
{
sprintf (name, "%s%d", cp, i + 1);
- v[i] = dict_create_var_assert (default_dict, name, 0);
+ v[i] = dict_create_var_assert (dict, name, 0);
}
- if (!dict_create_vector (default_dict, cp, v, nv))
- assert (0);
+ if (!dict_create_vector (dict, cp, v, nv))
+ NOT_REACHED ();
cp += strlen (cp) + 1;
}
free (v);