+/* Add a field for CASE_INDEX, WIDTH to SC, with DIRECTION as the sort order.
+ Returns true if successful, false if CASE_INDEX already has a field
+ in SC. */
+bool
+subcase_add (struct subcase *sc, int case_index, int width,
+ enum subcase_direction direction)
+{
+ if (!subcase_contains (sc, case_index))
+ {
+ subcase_add_always (sc, case_index, width, direction);
+ return true;
+ }
+ else
+ return false;
+}
+
+/* Add a field for VAR to SC, with DIRECTION as the sort order,
+ regardless of whether VAR already has a field in SC. */
+void
+subcase_add_var_always (struct subcase *sc, const struct variable *var,
+ enum subcase_direction direction)
+{
+ return subcase_add_always (sc, var_get_case_index (var),
+ var_get_width (var), direction);
+}
+
+/* Add a field for CASE_INDEX, WIDTH to SC, with DIRECTION as the
+ sort order, regardless of whether CASE_INDEX already has a
+ field in SC. */
+void
+subcase_add_always (struct subcase *sc, int case_index, int width,
+ enum subcase_direction direction)
+{
+ struct subcase_field *field;