Fix bug #17329 in REREAD parsing, reported by John Darrington.
[pspp] / src / language / utilities / set.q
index 55913dc09c58941c3324d06b72fdfd1081f093ee..f44a7a932526697ffb6940185bf71300cd694853 100644 (file)
    02110-1301, USA. */
 
 #include <config.h>
-#include <data/settings.h>
-#include <libpspp/message.h>
+
 #include <stdio.h>
 #include <errno.h>
 #include <stdlib.h>
 #include <time.h>
-#include <libpspp/alloc.h>
-#include <language/command.h>
-#include <libpspp/compiler.h>
+
 #include <data/dictionary.h>
-#include <language/line-buffer.h>
+#include <data/format.h>
+#include <data/procedure.h>
+#include <data/settings.h>
+#include <data/variable.h>
+#include <language/command.h>
+#include <language/lexer/format-parser.h>
 #include <language/lexer/lexer.h>
-#include <libpspp/message.h>
+#include <language/line-buffer.h>
+#include <libpspp/alloc.h>
+#include <libpspp/compiler.h>
+#include <libpspp/copyleft.h>
 #include <libpspp/magic.h>
-#include <output/output.h>
+#include <libpspp/message.h>
 #include <math/random.h>
-#include <data/variable.h>
-#include <data/format.h>
-#include <libpspp/copyleft.h>
-#include <data/variable.h>
-
+#include <output/output.h>
 
 #if HAVE_LIBTERMCAP
 #if HAVE_TERMCAP_H
@@ -110,6 +111,8 @@ int tgetnum (const char *);
      xsort=xsort:yes/no.
 */
 
+/* (headers) */
+
 /* (declarations) */
 
 /* (_functions) */
@@ -122,7 +125,7 @@ cmd_set (void)
   struct cmd_set cmd;
   bool ok = true;
 
-  if (!parse_set (&cmd))
+  if (!parse_set (&cmd, NULL))
     return CMD_FAILURE;
 
   if (cmd.sbc_cca)
@@ -286,7 +289,7 @@ do_cc (const char *cc_string, int idx)
    completely blank fields in numeric data imply.  X, Wnd: Syntax is
    SYSMIS or a numeric value. */
 static int
-stc_custom_blanks (struct cmd_set *cmd UNUSED)
+stc_custom_blanks (struct cmd_set *cmd UNUSED, void *aux UNUSED)
 {
   lex_match ('=');
   if ((token == T_ID && lex_id_match ("SYSMIS", tokid)))
@@ -307,7 +310,7 @@ stc_custom_blanks (struct cmd_set *cmd UNUSED)
 /* Parses the EPOCH subcommand, which controls the epoch used for
    parsing 2-digit years. */
 static int
-stc_custom_epoch (struct cmd_set *cmd UNUSED) 
+stc_custom_epoch (struct cmd_set *cmd UNUSED, void *aux UNUSED
 {
   lex_match ('=');
   if (lex_match_id ("AUTOMATIC"))
@@ -333,7 +336,7 @@ stc_custom_epoch (struct cmd_set *cmd UNUSED)
 }
 
 static int
-stc_custom_length (struct cmd_set *cmd UNUSED)
+stc_custom_length (struct cmd_set *cmd UNUSED, void *aux UNUSED)
 {
   int page_length;
 
@@ -360,7 +363,7 @@ stc_custom_length (struct cmd_set *cmd UNUSED)
 }
 
 static int
-stc_custom_seed (struct cmd_set *cmd UNUSED)
+stc_custom_seed (struct cmd_set *cmd UNUSED, void *aux UNUSED)
 {
   lex_match ('=');
   if (lex_match_id ("RANDOM"))
@@ -377,7 +380,7 @@ stc_custom_seed (struct cmd_set *cmd UNUSED)
 }
 
 static int
-stc_custom_width (struct cmd_set *cmd UNUSED)
+stc_custom_width (struct cmd_set *cmd UNUSED, void *aux UNUSED)
 {
   lex_match ('=');
   if (lex_match_id ("NARROW"))
@@ -403,12 +406,12 @@ stc_custom_width (struct cmd_set *cmd UNUSED)
 /* Parses FORMAT subcommand, which consists of a numeric format
    specifier. */
 static int
-stc_custom_format (struct cmd_set *cmd UNUSED)
+stc_custom_format (struct cmd_set *cmd UNUSED, void *aux UNUSED)
 {
   struct fmt_spec fmt;
 
   lex_match ('=');
-  if (!parse_format_specifier (&fmt, 0))
+  if (!parse_format_specifier (&fmt))
     return 0;
   if ((formats[fmt.type].cat & FCAT_STRING) != 0)
     {
@@ -423,7 +426,7 @@ stc_custom_format (struct cmd_set *cmd UNUSED)
 }
 
 static int
-stc_custom_journal (struct cmd_set *cmd UNUSED)
+stc_custom_journal (struct cmd_set *cmd UNUSED, void *aux UNUSED)
 {
   lex_match ('=');
   if (!lex_match_id ("ON") && !lex_match_id ("OFF")) 
@@ -440,7 +443,7 @@ stc_custom_journal (struct cmd_set *cmd UNUSED)
 }
 
 static int
-stc_custom_listing (struct cmd_set *cmd UNUSED)
+stc_custom_listing (struct cmd_set *cmd UNUSED, void *aux UNUSED)
 {
   bool listing;
 
@@ -460,9 +463,9 @@ stc_custom_listing (struct cmd_set *cmd UNUSED)
 }
 
 static int
-stc_custom_disk (struct cmd_set *cmd UNUSED)
+stc_custom_disk (struct cmd_set *cmd UNUSED, void *aux)
 {
-  return stc_custom_listing (cmd);
+  return stc_custom_listing (cmd, aux);
 }
 \f
 static void