Thanks to Paul Vella, Alan Mead, and Bastián Díaz for helping with this.
switch (value)
{
case 0:
- role = ROLE_NONE;
+ role = ROLE_INPUT;
break;
case 1:
- role = ROLE_INPUT;
+ role = ROLE_OUTPUT;
break;
case 2:
- role = ROLE_OUTPUT;
+ role = ROLE_BOTH;
break;
case 3:
- role = ROLE_BOTH;
+ role = ROLE_NONE;
break;
case 4:
break;
default:
- role = ROLE_NONE;
+ role = ROLE_INPUT;
if (n_warnings++ == 0)
- sys_warn (r, 0, _("Invalid role for variable %s."),
+ sys_warn (r, -1, _("Invalid role for variable %s."),
var_get_name (var));
}
}
if (n_warnings > 1)
- sys_warn (r, 0, _("%zu other variables had invalid roles."),
+ sys_warn (r, -1, _("%zu other variables had invalid roles."),
n_warnings - 1);
}
switch (role)
{
- case ROLE_NONE:
+ case ROLE_INPUT:
default:
s = "0";
break;
- case ROLE_INPUT:
+ case ROLE_OUTPUT:
s = "1";
break;
- case ROLE_OUTPUT:
+ case ROLE_BOTH:
s = "2";
break;
- case ROLE_BOTH:
+ case ROLE_NONE:
s = "3";
break;
type = val_type_from_width (width);
v->alignment = var_default_alignment (type);
v->measure = var_default_measure (type);
- v->role = ROLE_NONE;
+ v->role = ROLE_INPUT;
v->display_width = var_default_display_width (width);
v->print = v->write = var_default_formats (width);
attrset_init (&v->attributes);
{
switch (role)
{
- case ROLE_NONE:
- return _("None");
-
case ROLE_INPUT:
return _("Input");
case ROLE_BOTH:
return _("Both");
+ case ROLE_NONE:
+ return _("None");
+
case ROLE_PARTITION:
return _("Partition");
{
switch (role)
{
- case ROLE_NONE:
- return "NONE";
-
case ROLE_INPUT:
return "INPUT";
case ROLE_BOTH:
return "BOTH";
+ case ROLE_NONE:
+ return "NONE";
+
case ROLE_PARTITION:
return "PARTITION";
/* Intended usage of a variable, for populating dialogs. */
enum var_role
{
- ROLE_NONE,
ROLE_INPUT,
ROLE_OUTPUT,
ROLE_BOTH,
+ ROLE_NONE,
ROLE_PARTITION,
ROLE_SPLIT
};
measure_to_string (var_get_measure (v)));
r++;
- if (role != ROLE_NONE)
+ if (role != ROLE_INPUT)
{
tab_joint_text_format (t, 1, r, 2, r, TAB_LEFT,
_("Role: %s"), var_role_to_string (role));
else if ( lex_match_id (lexer, "SPLIT"))
role = ROLE_SPLIT;
else
- return CMD_FAILURE;
+ {
+ lex_error (lexer, NULL);
+ return CMD_FAILURE;
+ }
if (!parse_variables (lexer, dataset_dict (ds), &v, &nv, PV_NONE))
return CMD_FAILURE;
break;
case VS_ROLE:
- if (!strcmp (new_text, var_role_to_string (ROLE_NONE)))
- var_set_role (var, ROLE_NONE);
- else if (!strcmp (new_text, var_role_to_string (ROLE_INPUT)))
+ if (!strcmp (new_text, var_role_to_string (ROLE_INPUT)))
var_set_role (var, ROLE_INPUT);
else if (!strcmp (new_text, var_role_to_string (ROLE_OUTPUT)))
var_set_role (var, ROLE_OUTPUT);
else if (!strcmp (new_text, var_role_to_string (ROLE_BOTH)))
var_set_role (var, ROLE_BOTH);
+ else if (!strcmp (new_text, var_role_to_string (ROLE_NONE)))
+ var_set_role (var, ROLE_NONE);
else if (!strcmp (new_text, var_role_to_string (ROLE_PARTITION)))
var_set_role (var, ROLE_PARTITION);
else if (!strcmp (new_text, var_role_to_string (ROLE_SPLIT)))
column, cell, render_var_cell, obj, NULL);
add_combo_column (obj, VS_ROLE, _("Role"), 12,
- var_role_to_string (ROLE_NONE), ROLE_NONE,
var_role_to_string (ROLE_INPUT), ROLE_INPUT,
var_role_to_string (ROLE_OUTPUT), ROLE_OUTPUT,
var_role_to_string (ROLE_BOTH), ROLE_BOTH,
+ var_role_to_string (ROLE_NONE), ROLE_NONE,
var_role_to_string (ROLE_PARTITION), ROLE_PARTITION,
var_role_to_string (ROLE_SPLIT), ROLE_SPLIT,
NULL);
if (measure != var_default_measure (type))
syntax_gen_pspp (s, "VARIABLE LEVEL %ss (%ss).\n",
name, measure_to_syntax (measure));
- if (role != ROLE_NONE)
+ if (role != ROLE_INPUT)
syntax_gen_pspp (s, "VARIABLE ROLE /%ss %ss.\n",
var_role_to_syntax (role), name);
if (alignment != var_default_alignment (type))
AT_CHECK([grep -v Measure pspp.csv | grep -v Display], [0],
[[Variable,Description,,Position
FirstVariable,Format: F8.0,,1
-,Role: Input,,
+,Role: Output,,
,Custom attributes:,,
,adèle[1],23,
,adèle[2],34,
VARIABLE ALIGNMENT x (LEFT)/y (RIGHT)/z (CENTER).
VARIABLE WIDTH x (10)/y (12)/z (14).
VARIABLE LEVEL x (SCALE)/y (ORDINAL)/z (NOMINAL).
-VARIABLE ROLE /INPUT x /TARGET y /BOTH z.
+VARIABLE ROLE /TARGET x /BOTH y /NONE z.
DISPLAY DICTIONARY.
])
AT_CHECK([pspp -o pspp.csv var-display.sps])
Variable,Description,,Position
x,Format: F8.2,,1
,Measure: Scale,,
-,Role: Input,,
+,Role: Output,,
,Display Alignment: Left,,
,Display Width: 10,,
y,Format: F8.2,,2
,Measure: Ordinal,,
-,Role: Output,,
+,Role: Both,,
,Display Alignment: Right,,
,Display Width: 12,,
z,Format: F8.2,,3
,Measure: Nominal,,
-,Role: Both,,
+,Role: None,,
,Display Alignment: Center,,
,Display Width: 14,,
])