projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed behaviour of oneway when presented with missing values
[pspp]
/
src
/
file-type.c
diff --git
a/src/file-type.c
b/src/file-type.c
index bc33599da97db2d33a0171c00f438aaba1f57799..ec076146c7725a4b9e1880671cba4a130df0b1f2 100644
(file)
--- a/
src/file-type.c
+++ b/
src/file-type.c
@@
-21,6
+21,7
@@
#include "error.h"
#include <stdlib.h>
#include "alloc.h"
#include "error.h"
#include <stdlib.h>
#include "alloc.h"
+#include "case.h"
#include "command.h"
#include "data-in.h"
#include "dfm.h"
#include "command.h"
#include "data-in.h"
#include "dfm.h"
@@
-444,7
+445,7
@@
cmd_record_type (void)
if (!lex_force_string ())
goto error;
rct->v[rct->nv].c = xmalloc (fty->record.nc + 1);
if (!lex_force_string ())
goto error;
rct->v[rct->nv].c = xmalloc (fty->record.nc + 1);
- st_bare_pad_copy (rct->v[rct->nv].c, ds_
value
(&tokstr),
+ st_bare_pad_copy (rct->v[rct->nv].c, ds_
c_str
(&tokstr),
fty->record.nc + 1);
}
else
fty->record.nc + 1);
}
else
@@
-623,9
+624,6
@@
file_type_source_read (struct case_source *source,
write_case_data wc_data UNUSED)
{
struct file_type_pgm *fty = source->aux;
write_case_data wc_data UNUSED)
{
struct file_type_pgm *fty = source->aux;
- char *line;
- int len;
-
struct fmt_spec format;
dfm_push (fty->handle);
struct fmt_spec format;
dfm_push (fty->handle);
@@
-633,19
+631,22
@@
file_type_source_read (struct case_source *source,
format.type = fty->record.fmt;
format.w = fty->record.nc;
format.d = 0;
format.type = fty->record.fmt;
format.w = fty->record.nc;
format.d = 0;
- while (
NULL != (line = dfm_get_record (fty->handle, &len)
))
+ while (
!dfm_eof (fty->handle
))
{
{
+ struct len_string line;
struct record_type *iter;
union value v;
int i;
struct record_type *iter;
union value v;
int i;
+ dfm_expand_tabs (fty->handle);
+ dfm_get_record (fty->handle, &line);
if (formats[fty->record.fmt].cat & FCAT_STRING)
{
struct data_in di;
if (formats[fty->record.fmt].cat & FCAT_STRING)
{
struct data_in di;
- v.c = c
->data[fty->record.v->fv].
s;
+ v.c = c
ase_data_rw (c, fty->record.v->fv)->
s;
- data_in_finite_line (&di, l
ine, len
,
+ data_in_finite_line (&di, l
s_c_str (&line), ls_length (&line)
,
fty->record.fc, fty->record.fc + fty->record.nc);
di.v = (union value *) v.c;
di.flags = 0;
fty->record.fc, fty->record.fc + fty->record.nc);
di.v = (union value *) v.c;
di.flags = 0;
@@
-668,7
+669,7
@@
file_type_source_read (struct case_source *source,
{
struct data_in di;
{
struct data_in di;
- data_in_finite_line (&di, l
ine, len
,
+ data_in_finite_line (&di, l
s_c_str (&line), ls_length (&line)
,
fty->record.fc, fty->record.fc + fty->record.nc);
di.v = &v;
di.flags = 0;
fty->record.fc, fty->record.fc + fty->record.nc);
di.v = &v;
di.flags = 0;
@@
-676,7
+677,7
@@
file_type_source_read (struct case_source *source,
di.format = format;
data_in (&di);
di.format = format;
data_in (&di);
-
memcpy (&c->data[fty->record.v->fv].f, &v.f, sizeof v.f)
;
+
case_data_rw (c, fty->record.v->fv)->f = v.f
;
for (iter = fty->recs_head; iter; iter = iter->next)
{
if (iter->flags & RCT_OTHER)
for (iter = fty->recs_head; iter; iter = iter->next)
{
if (iter->flags & RCT_OTHER)
@@
-688,13
+689,13
@@
file_type_source_read (struct case_source *source,
if (fty->wild)
msg (SW, _("Unknown record type %g."), v.f);
}
if (fty->wild)
msg (SW, _("Unknown record type %g."), v.f);
}
- dfm_f
w
d_record (fty->handle);
+ dfm_f
orwar
d_record (fty->handle);
continue;
found:
/* Arrive here if there is a matching record_type, which is in
iter. */
continue;
found:
/* Arrive here if there is a matching record_type, which is in
iter. */
- dfm_f
w
d_record (fty->handle);
+ dfm_f
orwar
d_record (fty->handle);
}
/* switch(fty->type)
}
/* switch(fty->type)