/* PSPP - computes sample statistics.
Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc.
- Written by Ben Pfaff <blp@gnu.org>.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
#include "value-labels.h"
#include "variable.h"
-#include "stat-macros.h"
#include "minmax.h"
#include "gettext.h"
int32_t n_lines ; /* Number of lines of documents. */
} ATTRIBUTE((packed)) rec_6;
- const char *documents;
- size_t n_lines;
+ const char * documents = dict_get_documents (d);
+ size_t doc_bytes = strlen (documents);
- documents = dict_get_documents (d);
- n_lines = strlen (documents) / 80;
+ assert (doc_bytes % 80 == 0);
rec_6.rec_type = 6;
- rec_6.n_lines = n_lines;
+ rec_6.n_lines = doc_bytes / 80;
buf_write (w, &rec_6, sizeof rec_6);
- buf_write (w, documents, 80 * n_lines);
+ buf_write (w, documents, 80 * rec_6.n_lines);
}
/* Write the alignment, width and scale values */
v = dict_get_var(dict, i);
- params.measure = var_get_measure (v);
+ params.measure = (var_get_measure (v) == MEASURE_NOMINAL ? 1
+ : var_get_measure (v) == MEASURE_ORDINAL ? 2
+ : 3);
params.width = var_get_display_width (v);
- params.align = var_get_alignment (v);
+ params.align = (var_get_alignment (v) == ALIGN_LEFT ? 0
+ : var_get_alignment (v) == ALIGN_RIGHT ? 1
+ : 2);
buf_write (w, ¶ms, sizeof(params));
/* Writes case C to system file W.
Returns 1 if successful, 0 if an I/O error occurred. */
-int
+bool
sfm_write_case (struct sfm_writer *w, const struct ccase *c)
{
if (ferror (w->file))