#include <float.h>
#include "algorithm.h"
#include "alloc.h"
+#include "case.h"
#include "command.h"
#include "data-in.h"
#include "dfm.h"
static void read_matrices_with_rowtype (struct matrix_data_pgm *);
static int string_to_content_type (char *, int *);
-#if DEBUGGING
-static void debug_print (void);
-#endif
-
int
cmd_matrix_data (void)
{
goto lossage;
}
-#if DEBUGGING
- debug_print ();
-#endif
-
if (!dfm_open_for_reading (mx->data_file))
goto lossage;
else
return a->subtype < b->subtype ? -1 : a->subtype > b->subtype;
}
-
-#if DEBUGGING
-/* Print out the command as input. */
-static void
-debug_print (void)
-{
- printf ("MATRIX DATA\n\t/VARIABLES=");
-
- {
- int i;
-
- for (i = 0; i < default_dict.nvar; i++)
- printf ("%s ", default_dict.var[i]->name);
- }
- printf ("\n");
-
- printf ("\t/FORMAT=");
- if (fmt == LIST)
- printf ("LIST");
- else if (fmt == FREE)
- printf ("FREE");
- else
- assert (0);
- if (section == LOWER)
- printf (" LOWER");
- else if (section == UPPER)
- printf (" UPPER");
- else if (section == FULL)
- printf (" FULL");
- else
- assert (0);
- if (diag == DIAGONAL)
- printf (" DIAGONAL\n");
- else if (diag == NODIAGONAL)
- printf (" NODIAGONAL\n");
- else
- assert (0);
-
- if (dict_get_split_cnt (default_dict) != 0)
- {
- int i;
-
- printf ("\t/SPLIT=");
- for (i = 0; i < dict_get_split_cnt (default_dict); i++)
- printf ("%s ", dict_get_split_vars (default_dict)[i]->name);
- if (single_split)
- printf ("\t/* single split");
- printf ("\n");
- }
-
- if (n_factors)
- {
- int i;
-
- printf ("\t/FACTORS=");
- for (i = 0; i < n_factors; i++)
- printf ("%s ", factors[i]->name);
- printf ("\n");
- }
-
- if (cells != -1)
- printf ("\t/CELLS=%d\n", cells);
-
- if (mx->pop_n != -1)
- printf ("\t/N=%d\n", mx->pop_n);
-
- if (mx->n_contents)
- {
- int i;
- int space = 0;
-
- printf ("\t/CONTENTS=");
- for (i = 0; i < mx->n_contents; i++)
- {
- if (mx->contents[i] == LPAREN)
- {
- if (space)
- printf (" ");
- printf ("(");
- space = 0;
- }
- else if (mx->contents[i] == RPAREN)
- {
- printf (")");
- space = 1;
- }
- else
- {
-
- assert (mx->contents[i] >= 0 && mx->contents[i] <= PROX);
- if (space)
- printf (" ");
- printf ("%s", content_names[mx->contents[i]]);
- space = 1;
- }
- }
- printf ("\n");
- }
-}
-#endif /* DEBUGGING */
\f
/* Matrix tokenizer. */
vfm_source = create_case_source (&matrix_data_without_rowtype_source_class,
default_dict, &nr);
- procedure (NULL, &nr);
+ procedure (NULL, NULL);
free (nr.split_values);
free (nr.factor_values);
int type = content_type[content];
{
- st_bare_pad_copy (c->data[mx->rowtype_->fv].s,
+ st_bare_pad_copy (case_data_rw (c, mx->rowtype_->fv)->s,
content_names[content], 8);
if (type != 1)
- memset (&c->data[mx->varname_->fv].s, ' ', 8);
+ memset (case_data_rw (c, 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;
- c->data[fv].f = *cp;
+ case_data_rw (c, fv)->f = *cp;
cp++;
}
if (type == 1)
- st_bare_pad_copy (c->data[mx->varname_->fv].s,
+ st_bare_pad_copy (case_data_rw (c, mx->varname_->fv)->s,
dict_get_var (default_dict,
mx->first_continuous + i)->name,
8);
split_cnt = dict_get_split_cnt (default_dict);
split = dict_get_split_vars (default_dict);
for (i = 0; i < split_cnt; i++)
- c->data[split[i]->fv].f = nr->split_values[i];
+ case_data_rw (c, split[i]->fv)->f = nr->split_values[i];
}
if (mx->n_factors)
for (factor = 0; factor < mx->n_factors; factor++)
{
- c->data[mx->factors[factor]->fv].f
+ case_data_rw (c, mx->factors[factor]->fv)->f
= nr->factor_values[factor + cell * mx->n_factors];
debug_printf (("f:%s ", mx->factors[factor]->name));
}
int factor;
for (factor = 0; factor < mx->n_factors; factor++)
- c->data[mx->factors[factor]->fv].f = SYSMIS;
+ case_data_rw (c, mx->factors[factor]->fv)->f = SYSMIS;
}
for (content = 0; content <= PROX; content++)
vfm_source = create_case_source (&matrix_data_with_rowtype_source_class,
default_dict, &wr);
- procedure (NULL, &wr);
+ procedure (NULL, NULL);
free (wr.split_values);
fh_close_handle (mx->data_file);
split_cnt = dict_get_split_cnt (default_dict);
split = dict_get_split_vars (default_dict);
for (i = 0; i < split_cnt; i++)
- c->data[split[i]->fv].f = wr->split_values[i];
+ case_data_rw (c, split[i]->fv)->f = wr->split_values[i];
}
/* Sort the wr->data list. */
for (factor = 0; factor < mx->n_factors; factor++)
{
- c->data[mx->factors[factor]->fv].f
+ case_data_rw (c, mx->factors[factor]->fv)->f
= iter->factors[factor];
debug_printf (("f:%s ", factors[factor]->name));
}