Patch #5244.
[pspp-builds.git] / src / language / dictionary / numeric.c
index 4800ac86944f83f894f6cf0df662551bec11669d..71de3d8770ef1bc1e9f5085d96acc534bb641bbd 100644 (file)
    02110-1301, USA. */
 
 #include <config.h>
-#include <libpspp/message.h>
+
 #include <stdlib.h>
-#include <language/command.h>
+
 #include <data/dictionary.h>
-#include <libpspp/message.h>
+#include <data/procedure.h>
+#include <data/variable.h>
+#include <language/command.h>
+#include <language/lexer/format-parser.h>
 #include <language/lexer/lexer.h>
+#include <language/lexer/variable-parser.h>
+#include <libpspp/assertion.h>
+#include <libpspp/message.h>
 #include <libpspp/str.h>
-#include <data/variable.h>
 
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
 
-#include <libpspp/debug-print.h>
-
 /* Parses the NUMERIC command. */
 int
 cmd_numeric (void)
@@ -49,12 +52,12 @@ cmd_numeric (void)
   do
     {
       if (!parse_DATA_LIST_vars (&v, &nv, PV_NONE))
-       return CMD_PART_SUCCESS_MAYBE;
+       return CMD_FAILURE;
 
       /* Get the optional format specification. */
       if (lex_match ('('))
        {
-         if (!parse_format_specifier (&f, 0))
+         if (!parse_format_specifier (&f))
            goto fail;
          if (formats[f.type].cat & FCAT_STRING)
            {
@@ -100,7 +103,7 @@ fail:
   for (i = 0; i < nv; i++)
     free (v[i]);
   free (v);
-  return CMD_PART_SUCCESS_MAYBE;
+  return CMD_FAILURE;
 }
 
 /* Parses the STRING command. */
@@ -122,10 +125,9 @@ cmd_string (void)
   do
     {
       if (!parse_DATA_LIST_vars (&v, &nv, PV_NONE))
-       return CMD_PART_SUCCESS_MAYBE;
+       return CMD_FAILURE;
 
-      if (!lex_force_match ('(')
-         || !parse_format_specifier (&f, 0))
+      if (!lex_force_match ('(') || !parse_format_specifier (&f))
        goto fail;
       if (!(formats[f.type].cat & FCAT_STRING))
        {
@@ -149,8 +151,7 @@ cmd_string (void)
          width = f.w / 2;
          break;
        default:
-         assert (0);
-          abort ();
+          NOT_REACHED ();
        }
 
       /* Create each variable. */
@@ -179,7 +180,7 @@ fail:
   for (i = 0; i < nv; i++)
     free (v[i]);
   free (v);
-  return CMD_PART_SUCCESS_MAYBE;
+  return CMD_FAILURE;
 }
 
 /* Parses the LEAVE command. */
@@ -194,12 +195,7 @@ cmd_leave (void)
   if (!parse_variables (default_dict, &v, &nv, PV_NONE))
     return CMD_CASCADING_FAILURE;
   for (i = 0; i < nv; i++)
-    {
-      if (!v[i]->reinit)
-       continue;
-      v[i]->reinit = 0;
-      v[i]->init = 1;
-    }
+    v[i]->leave = true;
   free (v);
 
   return lex_end_of_command ();