/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2009, 2010, 2011, 2014 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <config.h>
+#include <float.h>
#include <stdint.h>
#include <stdlib.h>
-#include <data/case.h>
-#include <data/dictionary.h>
-#include <data/procedure.h>
-#include <data/transformations.h>
-#include <data/variable.h>
-#include <data/vector.h>
-#include <language/command.h>
-#include <language/expressions/public.h>
-#include <language/lexer/lexer.h>
-#include <libpspp/message.h>
-#include <libpspp/misc.h>
-#include <libpspp/str.h>
-
-#include "xalloc.h"
+#include "data/case.h"
+#include "data/dataset.h"
+#include "data/dictionary.h"
+#include "data/transformations.h"
+#include "data/variable.h"
+#include "data/vector.h"
+#include "language/command.h"
+#include "language/expressions/public.h"
+#include "language/lexer/lexer.h"
+#include "libpspp/message.h"
+#include "libpspp/misc.h"
+#include "libpspp/str.h"
+
+#include "gl/xalloc.h"
#include "gettext.h"
#define _(msgid) gettext (msgid)
lvalue_finalize (lvalue, compute, dict);
- return lex_end_of_command (lexer);
+ return CMD_SUCCESS;
fail:
lvalue_destroy (lvalue, dict);
"as an index into vector %s."),
vector_get_name (compute->vector));
else
- msg (SW, _("When executing COMPUTE: %g is not a valid value as "
+ msg (SW, _("When executing COMPUTE: %.*g is not a valid value as "
"an index into vector %s."),
- index, vector_get_name (compute->vector));
+ DBL_DIG + 1, index, vector_get_name (compute->vector));
return TRNS_CONTINUE;
}
}
else if (rindx < 1 || rindx > vector_get_var_cnt (compute->vector))
{
- msg (SW, _("When executing COMPUTE: %g is not a valid value as "
+ msg (SW, _("When executing COMPUTE: %.*g is not a valid value as "
"an index into vector %s."),
- index, vector_get_name (compute->vector));
+ DBL_DIG + 1, index, vector_get_name (compute->vector));
return TRNS_CONTINUE;
}
lvalue_finalize (lvalue, compute, dict);
- return lex_end_of_command (lexer);
+ return CMD_SUCCESS;
fail:
lvalue_destroy (lvalue, dict);
if (!lex_force_id (lexer))
goto lossage;
- if (lex_look_ahead (lexer) == T_LPAREN)
+ if (lex_next_token (lexer, 1) == T_LPAREN)
{
/* Vector. */
- lvalue->vector = dict_lookup_vector (dict, lex_tokid (lexer));
+ lvalue->vector = dict_lookup_vector (dict, lex_tokcstr (lexer));
if (lvalue->vector == NULL)
{
- msg (SE, _("There is no vector named %s."), lex_tokid (lexer));
+ msg (SE, _("There is no vector named %s."), lex_tokcstr (lexer));
goto lossage;
}
else
{
/* Variable name. */
- const char *var_name = lex_tokid (lexer);
+ const char *var_name = lex_tokcstr (lexer);
lvalue->variable = dict_lookup_var (dict, var_name);
if (lvalue->variable == NULL)
{