case: Introduce new functions for numbers and substrings in cases.
[pspp] / src / language / stats / descriptives.c
index e2cb058aa9048c40511b963ec1724e55121fd0ef..eefd0598e31a6dca612c84ebd5339a77ef7eb05b 100644 (file)
@@ -272,7 +272,7 @@ cmd_descriptives (struct lexer *lexer, struct dataset *ds)
               else
                {
                  enum dsc_statistic s = match_statistic (lexer);
-                 if (s == DSC_NONE )
+                 if (s == DSC_NONE)
                    {
                      lex_error (lexer, NULL);
                      goto error;
@@ -292,7 +292,7 @@ cmd_descriptives (struct lexer *lexer, struct dataset *ds)
           else
            {
              dsc->sort_by_stat = match_statistic (lexer);
-             if (dsc->sort_by_stat == DSC_NONE )
+             if (dsc->sort_by_stat == DSC_NONE)
                dsc->sort_by_stat = DSC_MEAN;
            }
           if (lex_match (lexer, T_LPAREN))
@@ -606,7 +606,7 @@ descriptives_set_all_sysmis_zscores (const struct dsc_trns *t, struct ccase *c)
   const struct dsc_z_score *z;
 
   for (z = t->z_scores; z < t->z_scores + t->z_score_cnt; z++)
-    case_data_rw (c, z->z_var)->f = SYSMIS;
+    *case_num_rw (c, z->z_var) = SYSMIS;
 }
 
 /* Transformation function to calculate Z-scores. Will return SYSMIS if any of
@@ -684,7 +684,7 @@ descriptives_trns_proc (void *trns_, struct ccase **c,
   for (z = t->z_scores; z < t->z_scores + t->z_score_cnt; z++)
     {
       double input = case_num (*c, z->src_var);
-      double *output = &case_data_rw (*c, z->z_var)->f;
+      double *output = case_num_rw (*c, z->z_var);
 
       if (z->mean == SYSMIS || z->std_dev == SYSMIS
           || var_is_num_missing (z->src_var, input, t->exclude))
@@ -727,7 +727,7 @@ setup_z_trns (struct dsc_proc *dsc, struct dataset *ds)
   t->z_score_cnt = cnt;
   t->missing_type = dsc->missing_type;
   t->exclude = dsc->exclude;
-  if ( t->missing_type == DSC_LISTWISE )
+  if (t->missing_type == DSC_LISTWISE)
     {
       t->var_cnt = dsc->var_cnt;
       t->vars = xnmalloc (t->var_cnt, sizeof *t->vars);
@@ -904,7 +904,7 @@ calc_descriptives (struct dsc_proc *dsc, struct casereader *group,
     {
       c = case_create (casewriter_get_proto (dsc->z_writer));
       z_idx = 0;
-      case_data_rw_idx (c, z_idx++)->f = count;
+      *case_num_rw_idx (c, z_idx++) = count;
     }
   else
     c = NULL;
@@ -945,8 +945,8 @@ calc_descriptives (struct dsc_proc *dsc, struct casereader *group,
 
       if (dv->z_name && c != NULL)
         {
-          case_data_rw_idx (c, z_idx++)->f = dv->stats[DSC_MEAN];
-          case_data_rw_idx (c, z_idx++)->f = dv->stats[DSC_STDDEV];
+          *case_num_rw_idx (c, z_idx++) = dv->stats[DSC_MEAN];
+          *case_num_rw_idx (c, z_idx++) = dv->stats[DSC_STDDEV];
         }
     }
 
@@ -1004,7 +1004,7 @@ display (struct dsc_proc *dsc)
     table, PIVOT_AXIS_ROW, N_("Variable"));
   for (size_t i = 0; i < dsc->var_cnt; i++)
     {
-      struct dsc_var *dv = &dsc->vars[i];
+      const struct dsc_var *dv = &dsc->vars[i];
 
       int row = pivot_category_create_leaf (variables->root,
                                             pivot_value_new_variable (dv->v));