- spec = ll_to_dls_var_spec (ll_head (&dls->specs));
- for (row = 1; row <= dls->record_cnt; row++)
- {
- struct substring line;
-
- if (dfm_eof (dls->reader))
- {
- msg (SW, _("Partial case of %d of %d records discarded."),
- row - 1, dls->record_cnt);
- return false;
- }
- dfm_expand_tabs (dls->reader);
- line = dfm_get_record (dls->reader);
-
- ll_for_each_continue (spec, struct dls_var_spec, ll, &dls->specs)
- data_in (ss_substr (line, spec->first_column - 1, spec->input.w),
- spec->input.type, spec->input.d, spec->first_column,
- case_data_rw_idx (c, spec->fv), fmt_var_width (&spec->input));
-
- dfm_forward_record (dls->reader);
- }
-
- return true;
-}
-
-/* Reads a case from the data file into C, parsing it according
- to free-format syntax rules in DLS.
- Returns true if successful, false at end of file or on I/O error. */
-static bool
-read_from_data_list_free (const struct data_list_pgm *dls, struct ccase *c)
-{
- struct dls_var_spec *spec;
-
- ll_for_each (spec, struct dls_var_spec, ll, &dls->specs)
- {
- struct substring field;
-
- /* Cut out a field and read in a new record if necessary. */
- while (!cut_field (dls, &field))
- {
- if (!dfm_eof (dls->reader))
- dfm_forward_record (dls->reader);
- if (dfm_eof (dls->reader))
- {
- if (&spec->ll != ll_head (&dls->specs))
- msg (SW, _("Partial case discarded. The first variable "
- "missing was %s."), spec->name);
- return false;
- }
- }
-
- data_in (field, spec->input.type, 0,
- dfm_get_column (dls->reader, ss_data (field)),
- case_data_rw_idx (c, spec->fv), fmt_var_width (&spec->input));
- }
- return true;
-}
-
-/* Reads a case from the data file and parses it according to
- list-format syntax rules.
- Returns true if successful, false at end of file or on I/O error. */
-static bool
-read_from_data_list_list (const struct data_list_pgm *dls, struct ccase *c)
-{
- struct dls_var_spec *spec;
-
- if (dfm_eof (dls->reader))
- return false;
-
- ll_for_each (spec, struct dls_var_spec, ll, &dls->specs)
- {
- struct substring field;
-
- if (!cut_field (dls, &field))
- {
- if (get_undefined ())
- msg (SW, _("Missing value(s) for all variables from %s onward. "
- "These will be filled with the system-missing value "
- "or blanks, as appropriate."),
- spec->name);
- ll_for_each_continue (spec, struct dls_var_spec, ll, &dls->specs)
- {
- int width = fmt_var_width (&spec->input);
- if (width == 0)
- case_data_rw_idx (c, spec->fv)->f = SYSMIS;
- else
- memset (case_data_rw_idx (c, spec->fv)->s, ' ', width);
- }
- break;
- }
-
- data_in (field, spec->input.type, 0,
- dfm_get_column (dls->reader, ss_data (field)),
- case_data_rw_idx (c, spec->fv), fmt_var_width (&spec->input));
- }
-
- dfm_forward_record (dls->reader);
- return true;
-}
-
-/* Destroys DATA LIST transformation DLS.