/* PSPP - a program for statistical analysis.
- Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <errno.h>
#include <getopt.h>
#include <inttypes.h>
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
char eye_catcher[61];
uint8_t raw_layout_code[4];
int32_t layout_code;
- int32_t nominal_case_size;
int32_t compressed;
int32_t weight_index;
int32_t ncases;
layout_code = integer_get (r->integer_format,
raw_layout_code, sizeof raw_layout_code);
- nominal_case_size = read_int (r);
+ read_int (r); /* Nominal case size (not actually useful). */
compressed = read_int (r);
weight_index = read_int (r);
ncases = read_int (r);
double value;
value = float_get_double (r->float_format, raw_value);
- for (n_printable = 0; n_printable < sizeof raw_value; n_printable++)
+ for (n_printable = 0; n_printable < 8; n_printable++)
if (!isprint (raw_value[n_printable]))
break;
sys_error (r, "Bad size (%zu) or count (%zu) on extension 4.",
size, count);
- printf ("\tsysmis: %g\n", sysmis);
+ printf ("\tsysmis: %g (%a)\n", sysmis, sysmis);
if (sysmis != SYSMIS)
- sys_warn (r, "File specifies unexpected value %g as %s.",
- sysmis, "SYSMIS");
+ sys_warn (r, "File specifies unexpected value %g (%a) as %s.",
+ sysmis, sysmis, "SYSMIS");
- printf ("\thighest: %g\n", highest);
+ printf ("\thighest: %g (%a)\n", highest, highest);
if (highest != HIGHEST)
- sys_warn (r, "File specifies unexpected value %g as %s.",
- highest, "HIGHEST");
+ sys_warn (r, "File specifies unexpected value %g (%a) as %s.",
+ highest, highest, "HIGHEST");
- printf ("\tlowest: %g\n", lowest);
- if (lowest != LOWEST)
- sys_warn (r, "File specifies unexpected value %g as %s.",
- lowest, "LOWEST");
+ printf ("\tlowest: %g (%a)\n", lowest, lowest);
+ if (lowest != LOWEST && lowest != SYSMIS)
+ sys_warn (r, "File specifies unexpected value %g (%a) as %s.",
+ lowest, lowest, "LOWEST");
}
/* Read record type 7, subtype 7. */
buffer = xmalloc (count);
read_bytes (r, buffer, count);
if (memchr (buffer, 0, count) == 0)
- for (i = 0; i < count; i++)
- {
- unsigned char c = buffer[i];
-
- if (c == '\\')
- printf ("\\\\");
- else if (c == '\n' || isprint (c))
- putchar (c);
- else
- printf ("\\%02x", c);
- }
+ {
+ for (i = 0; i < count; i++)
+ {
+ unsigned char c = buffer[i];
+
+ if (c == '\\')
+ printf ("\\\\");
+ else if (c == '\n' || isprint (c))
+ putchar (c);
+ else
+ printf ("\\%02x", c);
+ }
+ putchar ('\n');
+ }
else
hex_dump (0, buffer, count);
free (buffer);