projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
FREQUENCIES and layered split file has tests that work
[pspp]
/
src
/
language
/
dictionary
/
split-file.c
diff --git
a/src/language/dictionary/split-file.c
b/src/language/dictionary/split-file.c
index 48eec2958161224e021db6600152562543194588..8a134e1e769eca5562e57e31febb49b9c29b03d0 100644
(file)
--- 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"))
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;
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;
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);
}
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);
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;
if (n_vars == 0)
return;