Added a n_missing parameter to casereader_create_filter_missing.
[pspp-builds.git] / src / language / stats / oneway.q
index e09e8b84559bd382d94288e9083bcfc52ffc09ea..0600fdf2d2e6c260e204a3bca158c29a9803c9b3 100644 (file)
@@ -1,21 +1,18 @@
-/* PSPP - One way ANOVA. -*-c-*-
+/* PSPP - a program for statistical analysis.
+   Copyright (C) 1997-9, 2000, 2007 Free Software Foundation, Inc.
 
-Copyright (C) 1997-9, 2000, 2007 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
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
 
-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 the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301, USA. */
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
 #include <config.h>
 
@@ -34,10 +31,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 #include <language/command.h>
 #include <language/dictionary/split-file.h>
 #include <language/lexer/lexer.h>
-#include <libpspp/alloc.h>
 #include <libpspp/compiler.h>
 #include <libpspp/hash.h>
-#include <libpspp/magic.h>
 #include <libpspp/message.h>
 #include <libpspp/misc.h>
 #include <libpspp/str.h>
@@ -49,6 +44,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 #include <output/table.h>
 #include "sort-criteria.h"
 
+#include "xalloc.h"
+
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
 
@@ -178,8 +175,7 @@ output_oneway(void)
        sum += subc_list_double_at(&cmd.dl_contrast[i],j);
 
       if ( sum != 0.0 )
-       msg(SW,_("Coefficients for contrast %d do not total zero"),
-            (int) i + 1);
+       msg(SW,_("Coefficients for contrast %zu do not total zero"), i + 1);
     }
 
   if ( stat_tables & STAT_DESC )
@@ -435,11 +431,17 @@ show_descriptives(void)
 
       for (count = 0 ; count < hsh_count(gp->group_hash) ; ++count)
        {
+         struct string vstr;
+         ds_init_empty (&vstr);
          gs = gs_array[count];
 
+         var_append_value_name (indep_var, &gs->id, &vstr);
+
          tab_text (t, 1, row + count,
-                   TAB_LEFT | TAT_TITLE, var_get_value_name(indep_var,
-                                                             &gs->id));
+                   TAB_LEFT | TAT_TITLE,
+                   ds_cstr (&vstr));
+
+         ds_destroy (&vstr);
 
          /* Now fill in the numbers ... */
 
@@ -622,10 +624,18 @@ show_contrast_coeffs (short *bad_contrast)
        ++count)
     {
       int i;
+      struct string vstr;
       group_value = group_values[count];
 
+      ds_init_empty (&vstr);
+
+      var_append_value_name (indep_var, group_value, &vstr);
+
       tab_text (t, count + 2, 1, TAB_CENTER | TAT_TITLE,
-               var_get_value_name (indep_var, group_value));
+               ds_cstr (&vstr));
+
+      ds_destroy (&vstr);
+
 
       for (i = 0 ; i < cmd.sbc_contrast ; ++i )
        {
@@ -902,7 +912,10 @@ run_oneway (struct cmd_oneway *cmd,
   struct ccase c;
 
   if (!casereader_peek (input, 0, &c))
-    return;
+    {
+      casereader_destroy (input);
+      return;
+    }
   output_split_file_values (ds, &c);
   case_destroy (&c);
 
@@ -918,10 +931,10 @@ run_oneway (struct cmd_oneway *cmd,
 
   exclude = cmd->incl != ONEWAY_INCLUDE ? MV_ANY : MV_SYSTEM;
   input = casereader_create_filter_missing (input, &indep_var, 1,
-                                            exclude, NULL);
+                                            exclude, NULL, NULL);
   if (cmd->miss == ONEWAY_LISTWISE)
     input = casereader_create_filter_missing (input, vars, n_vars,
-                                              exclude, NULL);
+                                              exclude, NULL, NULL);
   input = casereader_create_filter_weight (input, dict, NULL, NULL);
 
   reader = casereader_clone (input);
@@ -1057,3 +1070,9 @@ postcalc (  struct cmd_oneway *cmd UNUSED )
 
     }
 }
+
+/*
+  Local Variables:
+  mode: c
+  End:
+*/