Actually implement the new procedure code and adapt all of its clients
[pspp-builds.git] / src / data / variable.c
index 266d0c2b7a10fab0cc82e88bb2c67fb7ab336a43..768aa477835a4749f27ab816d8abec4ad4b6aa52 100644 (file)
@@ -21,7 +21,8 @@
 
 #include <stdlib.h>
 
-#include "cat-routines.h"
+
+#include "category.h"
 #include "data-out.h"
 #include "format.h"
 #include "dictionary.h"
@@ -422,7 +423,7 @@ var_is_long_string (const struct variable *v)
 size_t
 var_get_value_cnt (const struct variable *v) 
 {
-  return v->width == 0 ? 1 : DIV_RND_UP (v->width, MAX_SHORT_STRING);
+  return value_cnt_from_width (v->width);
 }
 \f
 /* Returns variable V's missing values. */
@@ -867,9 +868,10 @@ var_get_aux (const struct variable *v)
    cleared, AUX_DTOR(V) will be called.  (var_dtor_free, below,
    may be appropriate for use as AUX_DTOR.) */
 void *
-var_attach_aux (struct variable *v,
+var_attach_aux (const struct variable *v_,
                 void *aux, void (*aux_dtor) (struct variable *)) 
 {
+  struct variable *v = (struct variable *) v_ ; /* cast away const  */
   assert (v->aux == NULL);
   assert (aux != NULL);
   v->aux = aux;
@@ -924,8 +926,9 @@ var_get_obs_vals (const struct variable *v)
 
 /* Sets V's observed categorical values to CAT_VALS. */
 void
-var_set_obs_vals (struct variable *v, struct cat_vals *cat_vals) 
+var_set_obs_vals (const struct variable *v_, struct cat_vals *cat_vals) 
 {
+  struct variable *v = (struct variable *) v_ ; /* cast away const */ 
   cat_stored_values_destroy (v->obs_vals);
   v->obs_vals = cat_vals;
 }