Constness and global namespace patrol.
[pspp] / src / language / xforms / count.c
index e5f3991a620c14c073f99203deb30fb55c1e3fc0..716c5d3999a1d2df7b3d9548ec222b9c60feb11d 100644 (file)
    02110-1301, USA. */
 
 #include <config.h>
-#include "message.h"
+
 #include <stdlib.h>
-#include "alloc.h"
-#include "case.h"
-#include "command.h"
-#include "dictionary.h"
-#include "message.h"
-#include "lexer.h"
-#include "pool.h"
-#include "range-parser.h"
-#include "str.h"
-#include "variable.h"
+
+#include <data/case.h>
+#include <data/dictionary.h>
+#include <data/procedure.h>
+#include <data/transformations.h>
+#include <data/variable.h>
+#include <language/command.h>
+#include <language/lexer/lexer.h>
+#include <language/lexer/range-parser.h>
+#include <language/lexer/variable-parser.h>
+#include <libpspp/alloc.h>
+#include <libpspp/compiler.h>
+#include <libpspp/message.h>
+#include <libpspp/message.h>
+#include <libpspp/pool.h>
+#include <libpspp/str.h>
 
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
@@ -111,7 +117,7 @@ cmd_count (void)
       /* Get destination variable, or at least its name. */
       if (!lex_force_id ())
        goto fail;
-      dv->var = dict_lookup_var (default_dict, tokid);
+      dv->var = dict_lookup_var (dataset_dict (current_dataset), tokid);
       if (dv->var != NULL)
         {
           if (dv->var->type == ALPHA)
@@ -134,7 +140,7 @@ cmd_count (void)
           
          crit->next = NULL;
          crit->vars = NULL;
-         if (!parse_variables (default_dict, &crit->vars, &crit->var_cnt,
+         if (!parse_variables (dataset_dict (current_dataset), &crit->vars, &crit->var_cnt,
                                 PV_DUPLICATE | PV_SAME_TYPE))
            goto fail;
           pool_register (trns->pool, free, crit->vars);
@@ -170,13 +176,13 @@ cmd_count (void)
       {
        /* It's valid, though motivationally questionable, to count to
           the same dest var more than once. */
-       dv->var = dict_lookup_var (default_dict, dv->name);
+       dv->var = dict_lookup_var (dataset_dict (current_dataset), dv->name);
 
        if (dv->var == NULL) 
-          dv->var = dict_create_var_assert (default_dict, dv->name, 0);
+          dv->var = dict_create_var_assert (dataset_dict (current_dataset), dv->name, 0);
       }
 
-  add_transformation (count_trns_proc, count_trns_free, trns);
+  add_transformation (current_dataset, count_trns_proc, count_trns_free, trns);
   return CMD_SUCCESS;
 
 fail:
@@ -249,7 +255,7 @@ parse_string_criteria (struct pool *pool, struct criteria *crit)
        return false;
       cur = &crit->values.str[crit->value_cnt++];
       *cur = pool_alloc (pool, len + 1);
-      str_copy_rpad (*cur, len + 1, ds_c_str (&tokstr));
+      str_copy_rpad (*cur, len + 1, ds_cstr (&tokstr));
       lex_get ();
 
       lex_match (',');
@@ -319,7 +325,7 @@ count_string (struct criteria *crit, struct ccase *c)
 /* Performs the COUNT transformation T on case C. */
 static int
 count_trns_proc (void *trns_, struct ccase *c,
-                 int case_num UNUSED)
+                 casenum_t case_num UNUSED)
 {
   struct count_trns *trns = trns_;
   struct dst_var *dv;