Encapsulated the static data of procedure.[ch] into a single object, to be
[pspp-builds.git] / src / language / dictionary / formats.c
index d6eb8bfbc1e243d3d6e080cd3812f036b19b1a14..5e1bd7d407fd68e100e0f7b98cf2c44e22a80395 100644 (file)
    02110-1301, USA. */
 
 #include <config.h>
+
 #include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
+
+#include <data/procedure.h>
+#include <data/variable.h>
 #include <language/command.h>
-#include <libpspp/message.h>
+#include <language/lexer/format-parser.h>
 #include <language/lexer/lexer.h>
+#include <language/lexer/variable-parser.h>
+#include <libpspp/message.h>
 #include <libpspp/misc.h>
 #include <libpspp/str.h>
-#include <data/variable.h>
 
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
 
-#include <libpspp/debug-print.h>
-
 enum
   {
     FORMATS_PRINT = 001,
@@ -80,16 +83,16 @@ internal_cmd_formats (int which)
       if (token == '.')
        break;
 
-      if (!parse_variables (default_dict, &v, &cv, PV_NUMERIC))
-       return CMD_PART_SUCCESS_MAYBE;
+      if (!parse_variables (dataset_dict (current_dataset), &v, &cv, PV_NUMERIC))
+       return CMD_FAILURE;
       type = v[0]->type;
 
       if (!lex_match ('('))
        {
-         msg (SE, _("`(' expected after variable list"));
+         msg (SE, _("`(' expected after variable list."));
          goto fail;
        }
-      if (!parse_format_specifier (&f, 0)
+      if (!parse_format_specifier (&f)
           || !check_output_specifier (&f, true)
           || !check_specifier_type (&f, NUMERIC, true))
        goto fail;
@@ -114,5 +117,5 @@ internal_cmd_formats (int which)
 
 fail:
   free (v);
-  return CMD_PART_SUCCESS_MAYBE;
+  return CMD_FAILURE;
 }