}
-/* Sets N split vars SPLIT in dictionary D. */
+/* Sets N split vars SPLIT in dictionary D. N is silently capped to a maximum
+ of MAX_SPLITS. */
static void
dict_set_split_vars__ (struct dictionary *d,
struct variable *const *split, size_t n,
enum split_type type, bool skip_callbacks)
{
+ if (n > MAX_SPLITS)
+ n = MAX_SPLITS;
assert (n == 0 || split != NULL);
d->n_splits = n;
SPLIT_SEPARATE, /* Produce separate output for each split. */
SPLIT_LAYERED, /* Output splits in same table. */
};
+#define MAX_SPLITS 8
const struct variable *const *dict_get_split_vars (const struct dictionary *);
size_t dict_get_n_splits (const struct dictionary *);
enum split_type dict_get_split_type (const struct dictionary *);
if (!parse_variables (lexer, dataset_dict (ds), &v, &n, PV_NO_DUPLICATE))
return CMD_CASCADING_FAILURE;
+ if (n > MAX_SPLITS)
+ {
+ verify (MAX_SPLITS == 8);
+ msg (SE, _("At most 8 split variables may be specified."));
+ free (v);
+ return CMD_CASCADING_FAILURE;
+ }
+
dict_set_split_vars (dataset_dict (ds), v, n, type);
free (v);
}
])
AT_CLEANUP
-
-
-
-
AT_SETUP([SPLIT FILE - vs procedures])
AT_DATA([split-file.sps], [dnl
AT_CHECK([pspp -O format=csv split-file.sps], [0],[ignore])
AT_CLEANUP
+
+AT_SETUP([SPLIT FILE - split variable limit])
+AT_DATA([split-file.sps], [dnl
+DATA LIST LIST NOTABLE /V1 TO V9.
+SPLIT FILE BY V1 TO V9.
+])
+AT_CHECK([pspp split-file.sps])
+AT_CLEANUP