/* PSPP - computes sample statistics.
- Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
+ 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
02110-1301, USA. */
#include <config.h>
+
#include "sys-file-writer.h"
#include "sfm-private.h"
-#include <libpspp/message.h>
-#include <stdlib.h>
+
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
+#include <stdlib.h>
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
+
#include <libpspp/alloc.h>
-#include "case.h"
-#include "dictionary.h"
-#include <libpspp/message.h>
-#include "file-handle-def.h"
#include <libpspp/hash.h>
#include <libpspp/magic.h>
+#include <libpspp/message.h>
#include <libpspp/misc.h>
-#include "settings.h"
-#include "stat-macros.h"
#include <libpspp/str.h>
+#include <libpspp/version.h>
+
+#include "case.h"
+#include "dictionary.h"
+#include "file-handle-def.h"
+#include "settings.h"
#include "value-labels.h"
#include "variable.h"
-#include <libpspp/version.h>
-#include <minmax.h>
+
+#include "stat-macros.h"
+#include "minmax.h"
#include "gettext.h"
#define _(msgid) gettext (msgid)
static inline void
write_format_spec (const struct fmt_spec *src, int32_t *dest)
{
- assert(check_output_specifier(src, true));
- *dest = (formats[src->type].spss << 16) | (src->w << 8) | src->d;
+ assert (fmt_check_output (src));
+ *dest = (fmt_to_io (src->type) << 16) | (src->w << 8) | src->d;
}
/* Write the variable record(s) for primary variable P and secondary
int nm; /* Number of missing values, possibly negative. */
sv.rec_type = 2;
- sv.type = min(v->width, MAX_LONG_STRING);
+ sv.type = MIN(v->width, MAX_LONG_STRING);
sv.has_var_label = (v->label != NULL);
mv_copy (&mv, &v->miss);
int ext_len;
- l.label_len = min (strlen (v->label), 255);
+ l.label_len = MIN (strlen (v->label), 255);
ext_len = ROUND_UP (l.label_len, sizeof l.label_len);
memcpy (l.label, v->label, l.label_len);
memset (&l.label[l.label_len], ' ', ext_len - l.label_len);
memset (&sv.write, 0, sizeof sv.write);
memset (&sv.name, 0, sizeof sv.name);
- pad_count = DIV_RND_UP (min(v->width, MAX_LONG_STRING),
+ pad_count = DIV_RND_UP (MIN(v->width, MAX_LONG_STRING),
(int) sizeof (flt64)) - 1;
for (i = 0; i < pad_count; i++)
buf_write (w, &sv, sizeof sv);
static char *
append_string_max (char *dest, const char *src, const char *end)
{
- int nbytes = min (end - dest, (int) strlen (src));
+ int nbytes = MIN (end - dest, (int) strlen (src));
memcpy (dest, src, nbytes);
return dest + nbytes;
}