int contents[EOC * 3 + 1]; /* Contents. */
int n_contents; /* Number of entries. */
-
+ /* Continuous variables. */
int n_continuous; /* Number of continuous variables. */
int first_continuous; /* Index into default_dict.var of
first continuous variable. */
MSTR /* String. */
};
+/* A MATRIX DATA parsing token. */
struct matrix_token
{
enum matrix_token_type type;
static int nr_read_splits (struct matrix_data_pgm *, int compare);
static int nr_read_factors (struct matrix_data_pgm *, int cell);
-static void nr_output_data (struct matrix_data_pgm *,
+static void nr_output_data (struct matrix_data_pgm *, struct ccase *,
write_case_func *, write_case_data);
static void matrix_data_read_without_rowtype (struct case_source *source,
+ struct ccase *,
write_case_func *,
write_case_data);
max_cell_index = 0;
vfm_source = create_case_source (&matrix_data_without_rowtype_source_class,
- mx);
+ default_dict, mx);
procedure (NULL, NULL, NULL, NULL);
writes them to the output file. Returns success. */
static void
matrix_data_read_without_rowtype (struct case_source *source,
+ struct ccase *c,
write_case_func *write_case,
write_case_data wc_data)
{
}
}
- nr_output_data (mx, write_case, wc_data);
+ nr_output_data (mx, c, write_case, wc_data);
if (dict_get_split_cnt (default_dict) == 0
|| !another_token (mx->data_file))
CP to the active file. */
static void
dump_cell_content (struct matrix_data_pgm *mx, int content, double *cp,
+ struct ccase *c,
write_case_func *write_case, write_case_data wc_data)
{
int type = content_type[content];
{
- st_bare_pad_copy (temp_case->data[mx->rowtype_->fv].s,
+ st_bare_pad_copy (c->data[mx->rowtype_->fv].s,
content_names[content], 8);
if (type != 1)
- memset (&temp_case->data[mx->varname_->fv].s, ' ', 8);
+ memset (&c->data[mx->varname_->fv].s, ' ', 8);
}
{
for (j = 0; j < mx->n_continuous; j++)
{
int fv = dict_get_var (default_dict, mx->first_continuous + j)->fv;
- temp_case->data[fv].f = *cp;
+ c->data[fv].f = *cp;
cp++;
}
if (type == 1)
- st_bare_pad_copy (temp_case->data[mx->varname_->fv].s,
+ st_bare_pad_copy (c->data[mx->varname_->fv].s,
dict_get_var (default_dict,
mx->first_continuous + i)->name,
8);
/* Finally dump out everything from nr_data[] to the output file. */
static void
-nr_output_data (struct matrix_data_pgm *mx,
+nr_output_data (struct matrix_data_pgm *mx, struct ccase *c,
write_case_func *write_case, write_case_data wc_data)
{
{
split_cnt = dict_get_split_cnt (default_dict);
split = dict_get_split_vars (default_dict);
for (i = 0; i < split_cnt; i++)
- temp_case->data[split[i]->fv].f = split_values[i];
+ c->data[split[i]->fv].f = split_values[i];
}
if (mx->n_factors)
for (factor = 0; factor < mx->n_factors; factor++)
{
- temp_case->data[mx->factors[factor]->fv].f
+ c->data[mx->factors[factor]->fv].f
= nr_factor_values[factor + cell * mx->n_factors];
debug_printf (("f:%s ", mx->factors[factor]->name));
}
&& nr_data[content][cell] != NULL);
dump_cell_content (mx, content, nr_data[content][cell],
- write_case, wc_data);
+ c, write_case, wc_data);
}
}
}
int factor;
for (factor = 0; factor < mx->n_factors; factor++)
- temp_case->data[mx->factors[factor]->fv].f = SYSMIS;
+ c->data[mx->factors[factor]->fv].f = SYSMIS;
}
for (content = 0; content <= PROX; content++)
if (!mx->is_per_factor[content] && nr_data[content] != NULL)
dump_cell_content (mx, content, nr_data[content][0],
- write_case, wc_data);
+ c, write_case, wc_data);
}
}
\f
struct factor_data *wr_current;
static int wr_read_splits (struct matrix_data_pgm *,
+ struct ccase *,
write_case_func *, write_case_data);
-static int wr_output_data (struct matrix_data_pgm *, write_case_func *, write_case_data);
+static int wr_output_data (struct matrix_data_pgm *,
+ struct ccase *, write_case_func *, write_case_data);
static int wr_read_rowtype (const struct matrix_token *, struct file_handle *);
static int wr_read_factors (struct matrix_data_pgm *);
static int wr_read_indeps (struct matrix_data_pgm *);
static void matrix_data_read_with_rowtype (struct case_source *,
+ struct ccase *,
write_case_func *,
write_case_data);
split_values = NULL;
mx->cells = 0;
- vfm_source = create_case_source (&matrix_data_with_rowtype_source_class, mx);
+ vfm_source = create_case_source (&matrix_data_with_rowtype_source_class,
+ default_dict, mx);
procedure (NULL, NULL, NULL, NULL);
/* Read from the data file and write it to the active file. */
static void
matrix_data_read_with_rowtype (struct case_source *source,
+ struct ccase *c,
write_case_func *write_case,
write_case_data wc_data)
{
do
{
- if (!wr_read_splits (mx, write_case, wc_data))
+ if (!wr_read_splits (mx, c, write_case, wc_data))
return;
if (!wr_read_factors (mx))
}
while (another_token (mx->data_file));
- wr_output_data (mx, write_case, wc_data);
+ wr_output_data (mx, c, write_case, wc_data);
}
/* Read the split file variables. If they differ from the previous
set of split variables then output the data. Returns success. */
static int
wr_read_splits (struct matrix_data_pgm *mx,
+ struct ccase *c,
write_case_func *write_case, write_case_data wc_data)
{
int compare;
if (compare && split_values[i] != token.number && !different)
{
- if (!wr_output_data (mx, write_case, wc_data))
+ if (!wr_output_data (mx, c, write_case, wc_data))
return 0;
different = 1;
mx->cells = 0;
file. */
static int
wr_output_data (struct matrix_data_pgm *mx,
+ struct ccase *c,
write_case_func *write_case, write_case_data wc_data)
{
{
split_cnt = dict_get_split_cnt (default_dict);
split = dict_get_split_vars (default_dict);
for (i = 0; i < split_cnt; i++)
- temp_case->data[split[i]->fv].f = split_values[i];
+ c->data[split[i]->fv].f = split_values[i];
}
/* Sort the wr_data list. */
for (factor = 0; factor < mx->n_factors; factor++)
{
- temp_case->data[mx->factors[factor]->fv].f
+ c->data[mx->factors[factor]->fv].f
= iter->factors[factor];
debug_printf (("f:%s ", factors[factor]->name));
}
fill_matrix (mx, content, iter->data[content]);
dump_cell_content (mx, content, iter->data[content],
- write_case, wc_data);
+ c, write_case, wc_data);
}
}
}