combine-files: Break apart apply_file_case_and_advance().
[pspp] / src / language / data-io / save.c
index 5b51309b1946240e36afa7122b55d209f0708470..b8031f71ea131055fbf516dfca1bdfeefe724c19 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 1997-9, 2000, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 1997-9, 2000, 2006, 2007, 2008, 2009, 2010, 2011, 2012 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 <stdlib.h>
 
-#include <data/any-writer.h>
-#include <data/case-map.h>
-#include <data/case.h>
-#include <data/casereader.h>
-#include <data/casewriter.h>
-#include <data/dictionary.h>
-#include <data/por-file-writer.h>
-#include <data/procedure.h>
-#include <data/sys-file-writer.h>
-#include <data/transformations.h>
-#include <data/variable.h>
-#include <language/command.h>
-#include <language/data-io/file-handle.h>
-#include <language/data-io/trim.h>
-#include <language/lexer/lexer.h>
-#include <libpspp/assertion.h>
-#include <libpspp/compiler.h>
-
-#include "xalloc.h"
+#include "data/any-writer.h"
+#include "data/case-map.h"
+#include "data/case.h"
+#include "data/casereader.h"
+#include "data/casewriter.h"
+#include "data/dataset.h"
+#include "data/dictionary.h"
+#include "data/por-file-writer.h"
+#include "data/sys-file-writer.h"
+#include "data/transformations.h"
+#include "data/variable.h"
+#include "language/command.h"
+#include "language/data-io/file-handle.h"
+#include "language/data-io/trim.h"
+#include "language/lexer/lexer.h"
+#include "libpspp/assertion.h"
+#include "libpspp/compiler.h"
+
+#include "gl/xalloc.h"
 
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
@@ -159,8 +159,6 @@ parse_write_command (struct lexer *lexer, struct dataset *ds,
   struct case_map *map;       /* Map from input data to data for writer. */
 
   /* Common options. */
-  bool print_map;             /* Print map?  TODO. */
-  bool print_short_names;     /* Print long-to-short name map.  TODO. */
   struct sfm_write_options sysfile_opts;
   struct pfm_write_options porfile_opts;
 
@@ -175,8 +173,6 @@ parse_write_command (struct lexer *lexer, struct dataset *ds,
   dict = dict_clone (dataset_dict (ds));
   writer = NULL;
   map = NULL;
-  print_map = false;
-  print_short_names = false;
   sysfile_opts = sfm_writer_default_options ();
   porfile_opts = pfm_writer_default_options ();
 
@@ -196,12 +192,14 @@ parse_write_command (struct lexer *lexer, struct dataset *ds,
 
          lex_match (lexer, T_EQUALS);
 
-         handle = fh_parse (lexer, FH_REF_FILE | FH_REF_SCRATCH);
+         handle = fh_parse (lexer, FH_REF_FILE, NULL);
          if (handle == NULL)
            goto error;
        }
       else if (lex_match_id (lexer, "NAMES"))
-        print_short_names = true;
+        {
+          /* Not yet implemented. */
+        }
       else if (lex_match_id (lexer, "PERMISSIONS"))
         {
           bool cw;
@@ -213,8 +211,8 @@ parse_write_command (struct lexer *lexer, struct dataset *ds,
             cw = true;
           else
             {
-              lex_error (lexer, _("expecting %s or %s"),
-                         "READONLY", "WRITEABLE");
+              lex_error_expecting (lexer, "READONLY", "WRITEABLE",
+                                   NULL_SENTINEL);
               goto error;
             }
           sysfile_opts.create_writeable = porfile_opts.create_writeable = cw;
@@ -228,7 +226,7 @@ parse_write_command (struct lexer *lexer, struct dataset *ds,
             *retain_unselected = false;
           else
             {
-              lex_error (lexer, _("expecting %s or %s"), "RETAIN", "DELETE");
+              lex_error_expecting (lexer, "RETAIN", "DELETE", NULL_SENTINEL);
               goto error;
             }
         }
@@ -256,7 +254,7 @@ parse_write_command (struct lexer *lexer, struct dataset *ds,
             porfile_opts.type = PFM_TAPE;
           else
             {
-              lex_error (lexer, _("expecting %s or %s"), "COMM", "TAPE");
+              lex_error_expecting (lexer, "COMM", "TAPE", NULL_SENTINEL);
               goto error;
             }
         }
@@ -279,7 +277,7 @@ parse_write_command (struct lexer *lexer, struct dataset *ds,
 
   if (handle == NULL)
     {
-      lex_sbc_missing (lexer, "OUTFILE");
+      lex_sbc_missing ("OUTFILE");
       goto error;
     }