projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Implement ZLIB compressed system file reader and writer.
[pspp]
/
src
/
language
/
data-io
/
save.c
diff --git
a/src/language/data-io/save.c
b/src/language/data-io/save.c
index b930855ec2e27ac246fe884feace49efd1c0c428..7f1347db982a0292895e367cc0571aa3107c4c38 100644
(file)
--- a/
src/language/data-io/save.c
+++ b/
src/language/data-io/save.c
@@
-1,5
+1,5
@@
/* PSPP - a program for statistical analysis.
/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2006, 2007, 2008, 2009, 2010, 2011
, 2012, 2013
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-156,11
+156,10
@@
parse_write_command (struct lexer *lexer, struct dataset *ds,
struct file_handle *handle; /* Output file. */
struct dictionary *dict; /* Dictionary for output file. */
struct casewriter *writer; /* Writer. */
struct file_handle *handle; /* Output file. */
struct dictionary *dict; /* Dictionary for output file. */
struct casewriter *writer; /* Writer. */
+ struct case_map_stage *stage; /* Preparation for 'map'. */
struct case_map *map; /* Map from input data to data for writer. */
/* Common options. */
struct case_map *map; /* Map from input data to data for writer. */
/* Common options. */
- bool print_map; /* Print map? TODO. */
- bool print_short_names; /* Print long-to-short name map. TODO. */
struct sfm_write_options sysfile_opts;
struct pfm_write_options porfile_opts;
struct sfm_write_options sysfile_opts;
struct pfm_write_options porfile_opts;
@@
-174,13
+173,12
@@
parse_write_command (struct lexer *lexer, struct dataset *ds,
handle = NULL;
dict = dict_clone (dataset_dict (ds));
writer = NULL;
handle = NULL;
dict = dict_clone (dataset_dict (ds));
writer = NULL;
+ stage = NULL;
map = NULL;
map = NULL;
- print_map = false;
- print_short_names = false;
sysfile_opts = sfm_writer_default_options ();
porfile_opts = pfm_writer_default_options ();
sysfile_opts = sfm_writer_default_options ();
porfile_opts = pfm_writer_default_options ();
-
case_map_prepare_dict
(dict);
+
stage = case_map_stage_create
(dict);
dict_delete_scratch_vars (dict);
lex_match (lexer, T_SLASH);
dict_delete_scratch_vars (dict);
lex_match (lexer, T_SLASH);
@@
-201,7
+199,9
@@
parse_write_command (struct lexer *lexer, struct dataset *ds,
goto error;
}
else if (lex_match_id (lexer, "NAMES"))
goto error;
}
else if (lex_match_id (lexer, "NAMES"))
- print_short_names = true;
+ {
+ /* Not yet implemented. */
+ }
else if (lex_match_id (lexer, "PERMISSIONS"))
{
bool cw;
else if (lex_match_id (lexer, "PERMISSIONS"))
{
bool cw;
@@
-234,10
+234,13
@@
parse_write_command (struct lexer *lexer, struct dataset *ds,
}
else if (writer_type == SYSFILE_WRITER
&& lex_match_id (lexer, "COMPRESSED"))
}
else if (writer_type == SYSFILE_WRITER
&& lex_match_id (lexer, "COMPRESSED"))
- sysfile_opts.compress
= true
;
+ sysfile_opts.compress
ion = SFM_COMP_SIMPLE
;
else if (writer_type == SYSFILE_WRITER
&& lex_match_id (lexer, "UNCOMPRESSED"))
else if (writer_type == SYSFILE_WRITER
&& lex_match_id (lexer, "UNCOMPRESSED"))
- sysfile_opts.compress = false;
+ sysfile_opts.compression = SFM_COMP_NONE;
+ else if (writer_type == SYSFILE_WRITER
+ && lex_match_id (lexer, "ZCOMPRESSED"))
+ sysfile_opts.compression = SFM_COMP_ZLIB;
else if (writer_type == SYSFILE_WRITER
&& lex_match_id (lexer, "VERSION"))
{
else if (writer_type == SYSFILE_WRITER
&& lex_match_id (lexer, "VERSION"))
{
@@
-303,7
+306,8
@@
parse_write_command (struct lexer *lexer, struct dataset *ds,
if (writer == NULL)
goto error;
if (writer == NULL)
goto error;
- map = case_map_from_dict (dict);
+ map = case_map_stage_get_case_map (stage);
+ case_map_stage_destroy (stage);
if (map != NULL)
writer = case_map_create_output_translator (map, writer);
dict_destroy (dict);
if (map != NULL)
writer = case_map_create_output_translator (map, writer);
dict_destroy (dict);
@@
-312,6
+316,7
@@
parse_write_command (struct lexer *lexer, struct dataset *ds,
return writer;
error:
return writer;
error:
+ case_map_stage_destroy (stage);
fh_unref (handle);
casewriter_destroy (writer);
dict_destroy (dict);
fh_unref (handle);
casewriter_destroy (writer);
dict_destroy (dict);