Rewrite Import Dialog.
[pspp] / src / language / data-io / trim.c
index 9f76b10516b1b8d88dc2eba668b919020c784d58..947a7524a84eaa9d00773d9ff8af440b49910351 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 1997-9, 2000, 2006, 2007, 2008, 2010 Free Software Foundation, Inc.
+   Copyright (C) 1997-9, 2000, 2006, 2007, 2008, 2010, 2011 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 <language/data-io/trim.h>
+#include "language/data-io/trim.h"
 
 #include <stdlib.h>
 
-#include <data/dictionary.h>
-#include <data/variable.h>
-#include <language/lexer/lexer.h>
-#include <language/lexer/variable-parser.h>
-#include <libpspp/message.h>
+#include "data/dictionary.h"
+#include "data/variable.h"
+#include "language/lexer/lexer.h"
+#include "language/lexer/variable-parser.h"
+#include "libpspp/message.h"
 
-#include "xalloc.h"
+#include "gl/xalloc.h"
 
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
@@ -81,7 +81,8 @@ parse_dict_rename (struct lexer *lexer, struct dictionary *dict)
       if (v == NULL)
        return 0;
       if (!lex_force_match (lexer, T_EQUALS)
-         || !lex_force_id (lexer))
+         || !lex_force_id (lexer)
+          || !dict_id_is_valid (dict, lex_tokcstr (lexer), true))
        return 0;
       if (dict_lookup_var (dict, lex_tokcstr (lexer)) != NULL)
        {
@@ -111,10 +112,10 @@ parse_dict_rename (struct lexer *lexer, struct dictionary *dict)
        goto done;
       if (!lex_match (lexer, T_EQUALS))
        {
-         msg (SE, _("`=' expected after variable list."));
+          lex_error_expecting (lexer, "`='", NULL_SENTINEL);
          goto done;
        }
-      if (!parse_DATA_LIST_vars (lexer, &new_names, &nn,
+      if (!parse_DATA_LIST_vars (lexer, dict, &new_names, &nn,
                                  PV_APPEND | PV_NO_SCRATCH | PV_NO_DUPLICATE))
        goto done;
       if (nn != nv)