Make the expression code a little nicer and fix bugs found
[pspp-builds.git] / src / get.c
index 0906d71125b45a320558fa9c173d71e297996432..aa3a4e4929bc0324685442c5f9408d6357471cd8 100644 (file)
--- a/src/get.c
+++ b/src/get.c
@@ -18,7 +18,7 @@
    02111-1307, USA. */
 
 #include <config.h>
-#include <assert.h>
+#include "error.h"
 #include <stdlib.h>
 #include "alloc.h"
 #include "command.h"
@@ -79,7 +79,6 @@ cmd_get (void)
   struct get_pgm *pgm;
   int options = GTSV_OPT_NONE;
 
-  lex_match_id ("GET");
   discard_variables ();
 
   lex_match ('/');
@@ -150,8 +149,6 @@ cmd_save_internal (enum save_cmd save_cmd)
 
   int i;
 
-  lex_match_id ("SAVE");
-
   lex_match ('/');
   if (lex_match_id ("OUTFILE"))
     lex_match ('=');
@@ -299,7 +296,7 @@ static int rename_variables (struct dictionary * dict);
 static int
 trim_dictionary (struct dictionary *dict, int *options)
 {
-  if (set_scompression)
+  if (get_scompression())
     *options |= GTSV_OPT_COMPRESSED;
 
   if (*options & GTSV_OPT_SAVE)
@@ -586,9 +583,6 @@ cmd_match_files (void)
   
   int seen = 0;
   
-  lex_match_id ("MATCH");
-  lex_match_id ("FILES");
-
   mtf.head = mtf.tail = NULL;
   mtf.by = NULL;
   mtf.by_cnt = 0;
@@ -744,8 +738,11 @@ cmd_match_files (void)
              name = mtf.tail->last;
              sbc = "LAST";
            }
-         else
-           assert (0);
+         else 
+            {
+              assert (0);
+              abort ();
+            }
 
          lex_match ('=');
          if (token != T_ID)
@@ -826,7 +823,7 @@ cmd_match_files (void)
              if (iter->by[i] == NULL)
                {
                  msg (SE, _("File %s lacks BY variable %s."),
-                      iter->handle ? fh_handle_name (iter->handle) : "*",
+                      iter->handle ? handle_get_name (iter->handle) : "*",
                       mtf.by[i]->name);
                  goto lossage;
                }
@@ -1341,7 +1338,7 @@ mtf_merge_dictionary (struct dictionary *const m, struct mtf_file *f)
            msg (SE, _("Variable %s in file %s (%s) has different "
                       "type or width from the same variable in "
                       "earlier file (%s)."),
-                dv->name, fh_handle_name (f->handle),
+                dv->name, handle_get_name (f->handle),
                 var_type_description (dv), var_type_description (mv));
            return 0;
          }
@@ -1364,8 +1361,6 @@ cmd_import (void)
   int options = GTSV_OPT_NONE;
   int type;
 
-  lex_match_id ("IMPORT");
-
   for (;;)
     {
       lex_match ('/');
@@ -1479,8 +1474,6 @@ cmd_export (void)
 
   int i;
 
-  lex_match_id ("EXPORT");
-
   lex_match ('/');
   if (lex_match_id ("OUTFILE"))
     lex_match ('=');