added initial innovations functions
[pspp-builds.git] / src / language / dictionary / value-labels.c
index 96b80ba735294adad2dd73852c464eed45c3f933..dec757c356de18ade4bbad808abd7d2e38ed1db8 100644 (file)
    02110-1301, USA. */
 
 #include <config.h>
+
 #include <stdio.h>
 #include <stdlib.h>
-#include "alloc.h"
-#include "command.h"
-#include "message.h"
-#include "hash.h"
-#include "lexer.h"
-#include "str.h"
-#include "value-labels.h"
-#include "variable.h"
+
+#include <data/procedure.h>
+#include <data/value-labels.h>
+#include <data/variable.h>
+#include <language/command.h>
+#include <language/lexer/lexer.h>
+#include <libpspp/alloc.h>
+#include <libpspp/hash.h>
+#include <libpspp/message.h>
+#include <libpspp/str.h>
 
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
@@ -92,17 +95,14 @@ do_value_labels (int erase)
       free (vars);
     }
 
-  if (token != '.')
-    {
-      lex_error (NULL);
-      return CMD_TRAILING_GARBAGE;
-    }
+  if (parse_err)
+    return CMD_FAILURE;
 
-  return parse_err ? CMD_PART_SUCCESS_MAYBE : CMD_SUCCESS;
+  return lex_end_of_command ();
 
  lossage:
   free (vars);
-  return CMD_PART_SUCCESS_MAYBE;
+  return CMD_FAILURE;
 }
 
 /* Verifies that none of the VAR_CNT variables in VARS are long
@@ -157,7 +157,7 @@ get_label (struct variable **vars, size_t var_cnt)
               lex_error (_("expecting string"));
              return 0;
            }
-         buf_copy_str_rpad (value.s, MAX_SHORT_STRING, ds_c_str (&tokstr));
+         buf_copy_str_rpad (value.s, MAX_SHORT_STRING, ds_cstr (&tokstr));
        }
       else
        {
@@ -180,7 +180,7 @@ get_label (struct variable **vars, size_t var_cnt)
          msg (SW, _("Truncating value label to 60 characters."));
          ds_truncate (&tokstr, 60);
        }
-      label = ds_c_str (&tokstr);
+      label = ds_cstr (&tokstr);
 
       for (i = 0; i < var_cnt; i++)
         val_labs_replace (vars[i]->val_labs, value, label);