+SV *
+get_attributes (var)
+ struct variable *var
+CODE:
+ HV *attrhash = (HV *) sv_2mortal ((SV *) newHV());
+
+ struct attrset *as = var_get_attributes (var);
+
+ if ( as )
+ {
+ struct attrset_iterator iter;
+ struct attribute *attr;
+
+ for (attr = attrset_first (as, &iter);
+ attr;
+ attr = attrset_next (as, &iter))
+ {
+ int i;
+ const char *name = attribute_get_name (attr);
+
+ AV *values = newAV ();
+
+ for (i = 0 ; i < attribute_get_n_values (attr); ++i )
+ {
+ const char *value = attribute_get_value (attr, i);
+ av_push (values, newSVpv (value, 0));
+ }
+
+ hv_store (attrhash, name, strlen (name),
+ newRV_noinc ((SV*) values), 0);
+ }
+ }
+
+ RETVAL = newRV ((SV *) attrhash);
+ OUTPUT:
+RETVAL
+
+
+const char *
+get_name (var)
+ struct variable * var
+CODE:
+ RETVAL = var_get_name (var);
+ OUTPUT:
+RETVAL
+
+
+const char *
+get_label (var)
+ struct variable * var
+CODE:
+ RETVAL = var_get_label (var);
+ OUTPUT:
+RETVAL
+
+
+SV *
+get_value_labels (var)
+ struct variable *var
+CODE:
+ HV *labelhash = (HV *) sv_2mortal ((SV *) newHV());
+ const struct val_lab *vl;
+ const struct val_labs *labels = var_get_value_labels (var);
+
+ if ( labels )
+ {
+ for (vl = val_labs_first (labels);
+ vl;
+ vl = val_labs_next (labels, vl))
+ {
+ SV *sv = value_to_scalar (&vl->value, var);
+ STRLEN len;
+ const char *s = SvPV (sv, len);
+ hv_store (labelhash, s, len, newSVpv (val_lab_get_label (vl), 0), 0);
+ }
+ }
+
+ RETVAL = newRV ((SV *) labelhash);
+ OUTPUT:
+RETVAL
+
+