Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
-/* AIX requires this to be the first thing in the file. */
#include <config.h>
-#if __GNUC__
-#define alloca __builtin_alloca
-#else
-#if HAVE_ALLOCA_H
-#include <alloca.h>
-#else
-#ifdef _AIX
-#pragma alloca
-#else
-#ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-#endif
-#endif
-#endif
-#endif
-
#include <assert.h>
#include <stdlib.h>
#include <ctype.h>
static int nr_read_splits (int compare);
static int nr_read_factors (int cell);
-static void nr_output_data (void);
-static int matrix_data_read_without_rowtype (void);
+static void nr_output_data (write_case_func *, write_case_data);
+static void matrix_data_read_without_rowtype (write_case_func *,
+ write_case_data);
/* Read from the data file and write it to the active file. */
static void
nr_factor_values = xmalloc (sizeof *nr_factor_values * n_factors * cells);
max_cell_index = 0;
- matrix_data_source.read = (void (*)(void)) matrix_data_read_without_rowtype;
+ matrix_data_source.read = matrix_data_read_without_rowtype;
vfm_source = &matrix_data_source;
- procedure (NULL, NULL, NULL);
+ procedure (NULL, NULL, NULL, NULL);
free (split_values);
free (nr_factor_values);
/* When ROWTYPE_ does not appear in the data, reads the matrices and
writes them to the output file. Returns success. */
-static int
-matrix_data_read_without_rowtype (void)
+static void
+matrix_data_read_without_rowtype (write_case_func *write_case,
+ write_case_data wc_data)
{
{
int *cp;
int *bp, *ep, *np;
if (!nr_read_splits (0))
- return 0;
+ return;
for (bp = contents; *bp != EOC; bp = np)
{
for (cp = bp; cp < ep; cp++)
if (!nr_read_data_lines (per_factor, i, *cp, cp != bp))
- return 0;
+ return;
}
}
}
- nr_output_data ();
+ nr_output_data (write_case, wc_data);
if (dict_get_split_cnt (default_dict) == 0 || !another_token ())
- return 1;
+ return;
}
}
/* Write the contents of a cell having content type CONTENT and data
CP to the active file. */
static void
-dump_cell_content (int content, double *cp)
+dump_cell_content (int content, double *cp,
+ write_case_func *write_case, write_case_data wc_data)
{
int type = content_type[content];
dict_get_var (default_dict,
first_continuous + i)->name,
8);
- write_case ();
+ write_case (wc_data);
}
}
}
/* Finally dump out everything from nr_data[] to the output file. */
static void
-nr_output_data (void)
+nr_output_data (write_case_func *write_case, write_case_data wc_data)
{
{
struct variable *const *split;
assert (nr_data[content] != NULL
&& nr_data[content][cell] != NULL);
- dump_cell_content (content, nr_data[content][cell]);
+ dump_cell_content (content, nr_data[content][cell],
+ write_case, wc_data);
}
}
}
for (content = 0; content <= PROX; content++)
if (!is_per_factor[content] && nr_data[content] != NULL)
- dump_cell_content (content, nr_data[content][0]);
+ dump_cell_content (content, nr_data[content][0],
+ write_case, wc_data);
}
}
\f
/* Current factor. */
struct factor_data *wr_current;
-static int wr_read_splits (void);
-static int wr_output_data (void);
+static int wr_read_splits (write_case_func *, write_case_data);
+static int wr_output_data (write_case_func *, write_case_data);
static int wr_read_rowtype (void);
static int wr_read_factors (void);
static int wr_read_indeps (void);
-static int matrix_data_read_with_rowtype (void);
+static void matrix_data_read_with_rowtype (write_case_func *,
+ write_case_data);
/* When ROWTYPE_ appears in the data, reads the matrices and writes
them to the output file. */
split_values = NULL;
cells = 0;
- matrix_data_source.read = (void (*)(void)) matrix_data_read_with_rowtype;
+ matrix_data_source.read = matrix_data_read_with_rowtype;
vfm_source = &matrix_data_source;
- procedure (NULL, NULL, NULL);
+ procedure (NULL, NULL, NULL, NULL);
free (split_values);
fh_close_handle (data_file);
}
/* Read from the data file and write it to the active file. */
-static int
-matrix_data_read_with_rowtype (void)
+static void
+matrix_data_read_with_rowtype (write_case_func *write_case,
+ write_case_data wc_data)
{
do
{
- if (!wr_read_splits ())
- return 0;
+ if (!wr_read_splits (write_case, wc_data))
+ return;
if (!wr_read_factors ())
- return 0;
+ return;
if (!wr_read_indeps ())
- return 0;
+ return;
}
while (another_token ());
- wr_output_data ();
- return 1;
+ wr_output_data (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 (void)
+wr_read_splits (write_case_func *write_case, write_case_data wc_data)
{
int compare;
size_t split_cnt;
if (compare && split_values[i] != mtokval && !different)
{
- if (!wr_output_data ())
+ if (!wr_output_data (write_case, wc_data))
return 0;
different = 1;
cells = 0;
/* Compares doubles A and B, treating SYSMIS as greatest. */
static int
-compare_doubles (const void *a_, const void *b_, void *aux unused)
+compare_doubles (const void *a_, const void *b_, void *aux UNUSED)
{
const double *a = a_;
const double *b = b_;
/* Write out the data for the current split file to the active
file. */
static int
-wr_output_data (void)
+wr_output_data (write_case_func *write_case, write_case_data wc_data)
{
{
struct variable *const *split;
fill_matrix (content, iter->data[content]);
- dump_cell_content (content, iter->data[content]);
+ dump_cell_content (content, iter->data[content],
+ write_case, wc_data);
}
}
}