/* Data parser for textual data like that read by DATA LIST. */
struct data_parser
{
- const struct dictionary *dict; /*Dictionary of destination */
+ struct dictionary *dict; /* Dictionary of destination */
enum data_parser_type type; /* Type of data to parse. */
int skip_records; /* Records to skip before first real data. */
/* Creates and returns a new data parser. */
struct data_parser *
-data_parser_create (const struct dictionary *dict)
+data_parser_create (struct dictionary *dict)
{
struct data_parser *parser = xmalloc (sizeof *parser);
parser->fields = NULL;
parser->field_cnt = 0;
parser->field_allocated = 0;
- parser->dict = dict;
+ parser->dict = dict_ref (dict);
parser->span = true;
parser->empty_line_has_field = false;
{
size_t i;
+ dict_unref (parser->dict);
for (i = 0; i < parser->field_cnt; i++)
free (parser->fields[i].name);
free (parser->fields);
parser->records_per_case),
parser->records_per_case, fh_get_name (fh));
struct pivot_table *table = pivot_table_create__ (
- pivot_value_new_user_text (title, -1));
+ pivot_value_new_user_text (title, -1), "Fixed Data Records");
free (title);
pivot_dimension_create (
int first_column = f->first_column;
int last_column = f->first_column + f->format.w - 1;
- char *columns = xasprintf ("%3d-%3d", first_column, last_column);
+ char *columns = xasprintf ("%d-%d", first_column, last_column);
pivot_table_put2 (table, 1, variable_idx,
pivot_value_new_user_text (columns, -1));
free (columns);
{
struct pivot_table *table = pivot_table_create__ (
pivot_value_new_text_format (N_("Reading free-form data from %s."),
- fh_get_name (fh)));
+ fh_get_name (fh)),
+ "Free-Form Data Records");
pivot_dimension_create (
table, PIVOT_AXIS_COLUMN, N_("Attributes"), N_("Format"));
struct data_parser_casereader *r = r_;
if (dfm_reader_error (r->reader))
casereader_force_error (reader);
- data_parser_destroy (r->parser);
dfm_close_reader (r->reader);
caseproto_unref (r->proto);
+ data_parser_destroy (r->parser);
free (r);
}