-
-/* Returns true if VAR_TYPE is a valid variable type. */
-bool
-var_type_is_valid (enum var_type var_type)
-{
- return var_type == NUMERIC || var_type == ALPHA;
-}
-
-/* Returns an adjective describing the given variable TYPE,
- suitable for use in phrases like "numeric variable". */
-const char *
-var_type_adj (enum var_type type)
-{
- return type == NUMERIC ? _("numeric") : _("string");
-}
-
-/* Returns a noun describing a value of the given variable TYPE,
- suitable for use in phrases like "a number". */
-const char *
-var_type_noun (enum var_type type)
-{
- return type == NUMERIC ? _("number") : _("string");
-}
-\f
-/* Returns true if M is a valid variable measurement level,
- false otherwise. */
-bool
-measure_is_valid (enum measure m)
-{
- return m == MEASURE_NOMINAL || m == MEASURE_ORDINAL || m == MEASURE_SCALE;
-}
-
-/* Returns true if A is a valid alignment,
- false otherwise. */
-bool
-alignment_is_valid (enum alignment a)
-{
- return a == ALIGN_LEFT || a == ALIGN_RIGHT || a == ALIGN_CENTRE;
-}
+#define N_(msgid) (msgid)
+
+/* This should follow the definition in Gtk */
+typedef struct
+{
+ int value;
+ const char *name;
+ const char *label;
+} GEnumValue;
+
+const GEnumValue align[] =
+ {
+ {ALIGN_LEFT, "left", N_("Left")},
+ {ALIGN_RIGHT, "right", N_("Right")},
+ {ALIGN_CENTRE, "center", N_("Center")},
+ {0,0,0}
+ };
+
+const GEnumValue measure[] =
+ {
+ {MEASURE_UNKNOWN, "unknown", N_("Unknown")},
+ {MEASURE_NOMINAL, "nominal", N_("Nominal")},
+ {MEASURE_ORDINAL, "ordinal", N_("Ordinal")},
+ {MEASURE_SCALE, "scale", N_("Scale")},
+ {0,0,0}
+ };
+
+const GEnumValue role[] =
+ {
+ {ROLE_INPUT, "input", N_("Input")},
+ {ROLE_TARGET, "output", N_("Output")},
+ {ROLE_BOTH, "both", N_("Both")},
+ {ROLE_NONE, "none", N_("None")},
+ {ROLE_PARTITION, "partition", N_("Partition")},
+ {ROLE_SPLIT, "split", N_("Split")},
+ {0,0,0}
+ };
+
+/* A variable. */
+struct variable
+ {
+ int ref_cnt;
+ /* Dictionary information. */
+ char *name; /* Variable name. Mixed case. */
+ int width; /* 0 for numeric, otherwise string width. */
+ struct missing_values miss; /* Missing values. */
+ struct fmt_spec print; /* Default format for PRINT. */
+ struct fmt_spec write; /* Default format for WRITE. */
+ struct val_labs *val_labs; /* Value labels. */
+ char *label; /* Variable label. */
+ struct string name_and_label; /* The name and label in the same string */
+
+ /* GUI information. */
+ enum measure measure; /* Nominal, ordinal, or continuous. */
+ enum var_role role; /* Intended use. */
+ int display_width; /* Width of data editor column. */
+ enum alignment alignment; /* Alignment of data in GUI. */
+
+ /* Case information. */
+ bool leave; /* Leave value from case to case? */
+
+ /* Data for use by containing dictionary. */
+ struct vardict_info *vardict;
+
+ /* Used only for system and portable file input and output.
+ See short-names.h. */
+ char **short_names;
+ size_t n_short_names;
+
+ /* Custom attributes. */
+ struct attrset attributes;
+ };