system files.
+Sat Dec 16 14:09:25 2006 Ben Pfaff <blp@gnu.org>
+
+ * sys-file-reader.c (read_display_parameters): Don't assume that
+ MEASURE_* and ALIGN_* have the same values found in system files.
+
+ * sys-file-writer.c (write_variable_display_parameters): Ditto.
+
+ * variable.h: Change MEASURE_NOMINAL, MEASURE_ORDINAL,
+ MEASURE_SCALE to be 0-based instead of 1-based. This also fixes
+ the value of n_MEASURES, which was off by 1 (at least from my
+ point of view).
+
Sat Dec 16 12:17:34 WST 2006 John Darrington <john@darrington.wattle.id.au>
* dictionary.c dictionary.h vardict.h variable.c: Added optional
int align = read_int32 (r);
struct variable *v;
- if (!measure_is_valid (measure) || !alignment_is_valid (align))
+ if (measure < 1 || measure > 3 || align < 0 || align > 2)
{
if (!warned)
sys_warn (r, _("Invalid variable display parameters. "
}
v = dict_get_var (dict, i);
- var_set_measure (v, measure);
+ var_set_measure (v, (measure == 1 ? MEASURE_NOMINAL
+ : measure == 2 ? MEASURE_ORDINAL
+ : MEASURE_SCALE));
var_set_display_width (v, width);
- var_set_alignment (v, align);
+ var_set_alignment (v, (align == 0 ? ALIGN_LEFT
+ : align == 1 ? ALIGN_RIGHT
+ : ALIGN_CENTRE));
}
}
v = dict_get_var(dict, i);
- params.measure = var_get_measure (v);
+ params.measure = (var_get_measure (v) == MEASURE_NOMINAL ? 1
+ : var_get_measure (v) == MEASURE_ORDINAL ? 2
+ : 3);
params.width = var_get_display_width (v);
- params.align = var_get_alignment (v);
+ params.align = (var_get_alignment (v) == ALIGN_LEFT ? 0
+ : var_get_alignment (v) == ALIGN_RIGHT ? 1
+ : 2);
buf_write (w, ¶ms, sizeof(params));
/* How data is measured. */
enum measure
{
- MEASURE_NOMINAL = 1,
- MEASURE_ORDINAL = 2,
- MEASURE_SCALE = 3,
+ MEASURE_NOMINAL = 0,
+ MEASURE_ORDINAL = 1,
+ MEASURE_SCALE = 2,
n_MEASURES
};
+Sat Dec 16 14:10:43 2006 Ben Pfaff <blp@gnu.org>
+
+ * psppire-var-store.c (text_for_column): Adjust to account for new
+ values of the MEASURE_* enums.
+
+ * var-sheet.c (change_measure): Ditto.
+
Sat Dec 16 12:24:35 WST 2006 John Darrington <john@darrington.wattle.id.au>
* psppire-variable.c psppire-variable.h: Deleted.
{
const gint measure = var_get_measure (pv);
- g_assert (measure - 1 < n_MEASURES);
- return g_locale_to_utf8 (gettext (measures[measure - 1]),
+ g_assert (measure < n_MEASURES);
+ return g_locale_to_utf8 (gettext (measures[measure]),
-1, 0, 0, err);
}
break;
if ( active_item < 0 ) return ;
- var_set_measure (pv, active_item + 1);
+ var_set_measure (pv, active_item);
}