or->sheets[r->current_sheet].stop_row = r->row - 1;
- if ( or->sheets[r->current_sheet].stop_col < r->col - 1)
+ if ( or->sheets[r->current_sheet].stop_col < r->col - 1)
or->sheets[r->current_sheet].stop_col = r->col - 1;
if (XML_READER_TYPE_END_ELEMENT == r->node_type)
{
while (1 == xmlTextReaderRead (r->rsd.xtr))
{
- int idx;
-
process_node (r, &r->rsd);
/* If the row is finished then stop for now */
if (r->rsd.state == STATE_TABLE && r->rsd.row > r->start_row)
break;
- idx = r->rsd.col - r->start_col -1 ;
+ int idx = r->rsd.col - r->start_col - 1;
- if ( idx < 0)
+ if (idx < 0)
continue;
if (r->stop_col != -1 && idx > r->stop_col - r->start_col)
XML_READER_TYPE_TEXT == r->rsd.node_type)
{
xmlChar *value = xmlTextReaderValue (r->rsd.xtr);
-
- if ( idx >= n_var_specs)
+ if (idx >= n_var_specs)
{
var_spec = xrealloc (var_spec, sizeof (*var_spec) * (idx + 1));
(idx - n_var_specs + 1) * sizeof (*var_spec));
n_var_specs = idx + 1;
}
- var_spec[idx].firstval.text = 0;
- var_spec[idx].firstval.value = 0;
- var_spec[idx].firstval.type = 0;
-
- var_spec [idx].name = strdup (CHAR_CAST (const char *, value));
+ for (int i = 0; i < r->rsd.col_span; ++i)
+ {
+ var_spec[idx - i].firstval.text = 0;
+ var_spec[idx - i].firstval.value = 0;
+ var_spec[idx - i].firstval.type = 0;
+ var_spec[idx - i].name =
+ strdup (CHAR_CAST (const char *, value));
+ }
xmlFree (value);
}
tests/language/data-io/Book1.gnm.unzipped \
tests/language/data-io/test.ods \
tests/language/data-io/newone.ods \
+ tests/language/data-io/readnames.ods \
tests/language/stats/llz.zsav
CLEANFILES += *.save pspp.* foo*
AT_CLEANUP
+
+AT_SETUP([GET DATA /TYPE=ODS readnames])
+
+dnl Check for a bug where in the ODS reader /READNAMES incorrectly
+dnl dealt with repeated names.
+AT_CHECK([cp $top_srcdir/tests/language/data-io/readnames.ods this.ods])dnl
+
+AT_DATA([readnames.sps],[dnl
+GET DATA /TYPE=ODS /FILE='this.ods' /CELLRANGE=RANGE 'A1:H8' /READNAMES=ON
+DISPLAY DICTIONARY.
+LIST.
+])
+
+
+AT_CHECK([pspp -O format=csv readnames.sps], [0],
+[Variable,Description,Position
+freda,Format: F8.2,1
+fred,Format: F8.2,2
+fred_A,Format: F8.2,3
+fred_B,Format: F8.2,4
+fred_C,Format: F8.2,5
+fred_D,Format: F8.2,6
+fred_E,Format: F8.2,7
+
+Table: Data List
+freda,fred,fred_A,fred_B,fred_C,fred_D,fred_E
+1.00,2.00,3.00,4.00,5.00,6.00,7.00
+8.00,9.00,10.00,11.00,12.00,13.00,14.00
+])
+
+AT_CLEANUP
+