Constness and global namespace patrol.
[pspp-builds.git] / src / language / stats / means.q
index 017b53fe96278c06c1d00dbfa86f6dcd7c75f6d8..bc927b4715ef7668b613dcac0565cf4587325826 100644 (file)
    02110-1301, USA. */
 
 #include <config.h>
+
 #include <stdlib.h>
 #include <stdio.h>
-#include "dictionary.h"
-#include "message.h"
-#include "alloc.h"
-#include "command.h"
-#include "hash.h"
-#include "lexer.h"
-#include "message.h"
-#include "magic.h"
-#include "variable.h"
+
+#include <data/dictionary.h>
+#include <data/procedure.h>
+#include <data/variable.h>
+#include <language/command.h>
+#include <language/lexer/lexer.h>
+#include <libpspp/alloc.h>
+#include <libpspp/hash.h>
+#include <libpspp/magic.h>
+#include <libpspp/message.h>
 
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
 
 /* (headers) */
 
-#include "debug-print.h"
-
 /* (specification)
    means (mns_):
      *tables=custom;
@@ -44,7 +44,7 @@
             name:!names/nonames,
             val:!values/novalues,
             fmt:!table/tree;
-     +missing=miss:!table/include/dependent;
+     missing=miss:!table/include/dependent;
      +cells[cl_]=default,count,sum,mean,stddev,variance,all;
      +statistics[st_]=anova,linearity,all,none.
 */
 /* (functions) */
 
 /* TABLES: Variable lists for each dimension. */
-int n_dim;             /* Number of dimensions. */
-size_t *nv_dim;                /* Number of variables in each dimension. */
-struct variable ***v_dim;      /* Variables in each dimension.  */
+static int n_dim;              /* Number of dimensions. */
+static size_t *nv_dim;         /* Number of variables in each dimension. */
+static struct variable ***v_dim;       /* Variables in each dimension.  */
 
 /* VARIABLES: List of variables. */
-int n_var;
-struct variable **v_var;
+static struct variable **v_var;
 
 /* Parses and executes the T-TEST procedure. */
 int
@@ -72,7 +71,7 @@ cmd_means (void)
   v_dim = NULL;
   v_var = NULL;
 
-  if (!parse_means (&cmd))
+  if (!parse_means (&cmd, NULL))
     goto free;
 
   if (cmd.sbc_cells)
@@ -123,12 +122,12 @@ free:
 
 /* Parses the TABLES subcommand. */
 static int
-mns_custom_tables (struct cmd_means *cmd)
+mns_custom_tables (struct cmd_means *cmd, void *aux UNUSED)
 {
   struct var_set *var_set;
   
   if (!lex_match_id ("TABLES")
-      && (token != T_ID || dict_lookup_var (default_dict, tokid) == NULL)
+      && (token != T_ID || dict_lookup_var (dataset_dict (current_dataset), tokid) == NULL)
       && token != T_ALL)
     return 2;
   lex_match ('=');
@@ -140,7 +139,7 @@ mns_custom_tables (struct cmd_means *cmd)
       return 0;
     }
 
-  var_set = var_set_create_from_dict (default_dict);
+  var_set = var_set_create_from_dict (dataset_dict (current_dataset));
   assert (var_set != NULL);
 
   do