Encapsulated the static data of procedure.[ch] into a single object, to be
[pspp-builds.git] / src / language / stats / regression.q
index 3706760a38ed9689b64b4d0afaedd7a05908fb0a..1690abc0c9d1f614a5ddad2e16438a868949fe5d 100644 (file)
@@ -544,7 +544,8 @@ regression_trns_free (void *t_)
   Gets the predicted values.
  */
 static int
-regression_trns_pred_proc (void *t_, struct ccase *c, int case_idx UNUSED)
+regression_trns_pred_proc (void *t_, struct ccase *c, 
+                          casenum_t case_idx UNUSED)
 {
   size_t i;
   size_t n_vals;
@@ -582,7 +583,8 @@ regression_trns_pred_proc (void *t_, struct ccase *c, int case_idx UNUSED)
   Gets the residuals.
  */
 static int
-regression_trns_resid_proc (void *t_, struct ccase *c, int case_idx UNUSED)
+regression_trns_resid_proc (void *t_, struct ccase *c, 
+                           casenum_t case_idx UNUSED)
 {
   size_t i;
   size_t n_vals;
@@ -624,7 +626,7 @@ regression_trns_resid_proc (void *t_, struct ccase *c, int case_idx UNUSED)
 static int
 try_name (char *name)
 {
-  if (dict_lookup_var (default_dict, name) != NULL)
+  if (dict_lookup_var (dataset_dict (current_dataset), name) != NULL)
     return 0;
 
   return 1;
@@ -655,10 +657,10 @@ reg_save_var (const char *prefix, trns_proc_func * f,
   t->n_trns = n_trns;
   t->c = c;
   reg_get_name (name, prefix);
-  new_var = dict_create_var (default_dict, name, 0);
+  new_var = dict_create_var (dataset_dict (current_dataset), name, 0);
   assert (new_var != NULL);
   *v = new_var;
-  add_transformation (f, regression_trns_free, t);
+  add_transformation (current_dataset, f, regression_trns_free, t);
   trns_index++;
 }
 static void
@@ -936,7 +938,7 @@ cmd_regression (void)
     return CMD_FAILURE;
 
   models = xnmalloc (cmd.n_dependent, sizeof *models);
-  if (!multipass_procedure_with_splits (run_regression, &cmd))
+  if (!multipass_procedure_with_splits (current_dataset, run_regression, &cmd))
     return CMD_CASCADING_FAILURE;
   subcommand_save (cmd.sbc_save, models);
   free (v_variables);
@@ -947,7 +949,7 @@ cmd_regression (void)
 /*
   Is variable k the dependent variable?
  */
-static int
+static bool
 is_depvar (size_t k, const struct variable *v)
 {
   /*
@@ -955,9 +957,9 @@ is_depvar (size_t k, const struct variable *v)
      names match.
    */
   if (!compare_var_names (v, v_variables[k], NULL))
-    return 1;
+    return true;
 
-  return 0;
+  return false;
 }
 
 /*
@@ -1002,12 +1004,12 @@ regression_custom_variables (struct cmd_regression *cmd UNUSED,
 
   lex_match ('=');
 
-  if ((token != T_ID || dict_lookup_var (default_dict, tokid) == NULL)
+  if ((token != T_ID || dict_lookup_var (dataset_dict (current_dataset), tokid) == NULL)
       && token != T_ALL)
     return 2;
 
 
-  if (!parse_variables (default_dict, &v_variables, &n_variables, PV_NONE))
+  if (!parse_variables (dataset_dict (current_dataset), &v_variables, &n_variables, PV_NONE))
     {
       free (v_variables);
       return 0;
@@ -1116,7 +1118,7 @@ run_regression (const struct ccase *first,
 
   if (!v_variables)
     {
-      dict_get_vars (default_dict, &v_variables, &n_variables,
+      dict_get_vars (dataset_dict (current_dataset), &v_variables, &n_variables,
                     1u << DC_SYSTEM);
     }