X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fdictionary%2Fsplit-file.c;h=8a134e1e769eca5562e57e31febb49b9c29b03d0;hb=209f7e5ccf28c97641b9e69ef6b9df81efe4dc38;hp=48eec2958161224e021db6600152562543194588;hpb=96994a54e60e9c95b8bba54c2281acf7059b1203;p=pspp diff --git a/src/language/dictionary/split-file.c b/src/language/dictionary/split-file.c index 48eec29581..8a134e1e76 100644 --- a/src/language/dictionary/split-file.c +++ b/src/language/dictionary/split-file.c @@ -43,20 +43,30 @@ int cmd_split_file (struct lexer *lexer, struct dataset *ds) { if (lex_match_id (lexer, "OFF")) - dict_set_split_vars (dataset_dict (ds), NULL, 0); + dict_clear_split_vars (dataset_dict (ds)); else { struct variable **v; size_t n; - /* For now, ignore SEPARATE and LAYERED. */ - (void) (lex_match_id (lexer, "SEPARATE") || lex_match_id (lexer, "LAYERED")); + enum split_type type = (!lex_match_id (lexer, "LAYERED") + && lex_match_id (lexer, "SEPARATE") + ? SPLIT_SEPARATE + : SPLIT_LAYERED); lex_match (lexer, T_BY); if (!parse_variables (lexer, dataset_dict (ds), &v, &n, PV_NO_DUPLICATE)) return CMD_CASCADING_FAILURE; - dict_set_split_vars (dataset_dict (ds), v, n); + 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); } @@ -68,7 +78,7 @@ void output_split_file_values (const struct dataset *ds, const struct ccase *c) { const struct dictionary *dict = dataset_dict (ds); - size_t n_vars = dict_get_split_cnt (dict); + size_t n_vars = dict_get_n_splits (dict); if (n_vars == 0) return;