Rename section_value to occurrence.
[pspp] / src / language / stats / means.h
index c449cb008750e624cbf5b553a9698563290abea3..b2bdd1387f336dce2b6a136a5e0e7c5b783e1790 100644 (file)
@@ -17,6 +17,8 @@
 #ifndef MEANS_H
 #define MEANS_H
 
+#include "libpspp/hmap.h"
+#include "libpspp/bt.h"
 #include "libpspp/compiler.h"
 
 struct cell_container
@@ -37,18 +39,15 @@ struct layer
 {
   size_t n_factor_vars;
   const struct variable **factor_vars;
-
-  /* A container holding the union of all instances of values used
-     as categories forming this layer.  */
-  struct cell_container instances;
 };
 
 
-struct per_var_data;
+struct statistic;
 
-typedef struct per_var_data *stat_create (struct pool *pool);
-typedef void stat_update  (struct per_var_data *stat, double w, double x);
-typedef double stat_get   (const struct per_var_data *);
+typedef struct statistic *stat_create (struct pool *pool);
+typedef void stat_update  (struct statistic *stat, double w, double x);
+typedef double stat_get   (const struct statistic *);
+typedef void stat_destroy (struct statistic *);
 
 
 struct cell_spec
@@ -59,11 +58,34 @@ struct cell_spec
   /* Keyword for syntax */
   const char *keyword;
 
+  /* The result class for the datum.  */
+  const char *rc;
+
   stat_create *sc;
   stat_update *su;
   stat_get *sd;
+  stat_destroy *sf;
+};
+
+struct summary
+{
+  double n_total;
+  double n_missing;
 };
 
+/* Intermediate data per table.  */
+struct workspace
+{
+  /* An array of n_layers integers which are used
+     to permute access into the factor_vars of each layer.  */
+  int *control_idx;
+
+  /* An array of n_layers cell_containers which hold the union
+     of instances used respectively by each layer.  */
+  struct cell_container *instances;
+
+  struct cell *root_cell;
+};
 
 /* The thing parsed after TABLES= */
 struct mtable
@@ -71,12 +93,18 @@ struct mtable
   size_t n_dep_vars;
   const struct variable **dep_vars;
 
-  const struct variable **control_vars;
-
   struct layer **layers;
   int n_layers;
 
-  struct cell *root_cell;
+  int n_combinations;
+
+  /* An array of n_combinations workspaces.  */
+  struct workspace *ws;
+
+  /* An array of n_combinations * n_dep_vars summaries.
+     These are displayed in the Case Processing
+     Summary box.  */
+  struct summary *summ;
 };
 
 /* A structure created by the parser.  Contains the definition of the
@@ -91,14 +119,11 @@ struct means
   size_t n_tables;
 
   /* Missing value class for categorical variables.  */
-  enum mv_class exclude;
+  enum mv_class ctrl_exclude;
 
   /* Missing value class for dependent variables */
   enum mv_class dep_exclude;
 
-  bool listwise_exclude;
-
-
   /* The statistics to be calculated for each cell.  */
   int *statistics;
   int n_statistics;
@@ -129,6 +154,9 @@ struct dataset;
 struct casereader;
 void run_means (struct means *cmd, struct casereader *input, const struct dataset *ds UNUSED);
 
-void means_shipout (const struct mtable *mt, const struct means *means);
+struct lexer;
+bool means_parse (struct lexer *lexer, struct means *means);
+
+
 
 #endif