#include "case.h"
#include "dictionary.h"
#include "file-handle-def.h"
-#include "filename.h"
+#include "file-name.h"
#include "format.h"
#include "value-labels.h"
#include "variable.h"
#include "gettext.h"
#define _(msgid) gettext (msgid)
-#include <libpspp/debug-print.h>
-
/* System file reader. */
struct sfm_reader
{
/* Reverse the byte order of 32-bit integer *X. */
static inline void
-bswap_int32 (int32 *x_)
+bswap_int32 (int32_t *x_)
{
char *x = (char *) x_;
bswap (x + 0, x + 3);
static int read_header (struct sfm_reader *,
struct dictionary *, struct sfm_read_info *);
-static int parse_format_spec (struct sfm_reader *, int32,
+static int parse_format_spec (struct sfm_reader *, int32_t,
struct fmt_spec *, const struct variable *);
static int read_value_labels (struct sfm_reader *, struct dictionary *,
struct variable **var_by_idx);
/* Read records of types 3, 4, 6, and 7. */
for (;;)
{
- int32 rec_type;
+ int32_t rec_type;
assertive_buf_read (r, &rec_type, sizeof rec_type, 0);
if (r->reverse_endian)
{
struct
{
- int32 subtype P;
- int32 size P;
- int32 count P;
+ int32_t subtype P;
+ int32_t size P;
+ int32_t count P;
}
data;
unsigned long bytes;
{
struct
{
- int32 measure P;
- int32 width P;
- int32 align P;
+ int32_t measure P;
+ int32_t width P;
+ int32_t align P;
}
params;
case 999:
{
- int32 filler;
+ int32_t filler;
assertive_buf_read (r, &filler, sizeof filler, 0);
goto success;
static int
read_machine_int32_info (struct sfm_reader *r, int size, int count)
{
- int32 data[8];
+ int32_t data[8];
int file_bigendian;
int i;
- if (size != sizeof (int32) || count != 8)
+ if (size != sizeof (int32_t) || count != 8)
lose ((ME, _("%s: Bad size (%d) or count (%d) field on record type 7, "
"subtype 3. Expected size %d, count 8."),
- fh_get_filename (r->fh), size, count, sizeof (int32)));
+ fh_get_filename (r->fh), size, count, sizeof (int32_t)));
assertive_buf_read (r, data, sizeof data, 0);
if (r->reverse_endian)
if (sv.has_var_label == 1)
{
/* Disk buffer. */
- int32 len;
+ int32_t len;
/* Read length of label. */
assertive_buf_read (r, &len, sizeof len, 0);
if ( len != 0 )
{
/* Read label into variable structure. */
- vv->label = buf_read (r, NULL, ROUND_UP (len, sizeof (int32)), len + 1);
+ vv->label = buf_read (r, NULL, ROUND_UP (len, sizeof (int32_t)), len + 1);
if (vv->label == NULL)
goto error;
vv->label[len] = '\0';
/* Translates the format spec from sysfile format to internal
format. */
static int
-parse_format_spec (struct sfm_reader *r, int32 s,
+parse_format_spec (struct sfm_reader *r, int32_t s,
struct fmt_spec *f, const struct variable *v)
{
f->type = translate_fmt ((s >> 16) & 0xff);
};
struct label *labels = NULL;
- int32 n_labels; /* Number of labels. */
+ int32_t n_labels; /* Number of labels. */
struct variable **var = NULL; /* Associated variables. */
- int32 n_vars; /* Number of associated variables. */
+ int32_t n_vars; /* Number of associated variables. */
int i;
if (r->reverse_endian)
bswap_int32 (&n_labels);
- if ( n_labels >= ((int32) ~0) / sizeof *labels)
+ if ( n_labels >= ((int32_t) ~0) / sizeof *labels)
{
corrupt_msg(MW, _("%s: Invalid number of labels: %d. Ignoring labels."),
fh_get_filename (r->fh), n_labels);
/* Read record type of type 4 record. */
{
- int32 rec_type;
+ int32_t rec_type;
assertive_buf_read (r, &rec_type, sizeof rec_type, 0);
if (r->reverse_endian)
var = xnmalloc (n_vars, sizeof *var);
for (i = 0; i < n_vars; i++)
{
- int32 var_idx;
+ int32_t var_idx;
struct variable *v;
/* Read variable index, check range. */
static int
read_documents (struct sfm_reader *r, struct dictionary *dict)
{
- int32 line_cnt;
+ int32_t line_cnt;
char *documents;
if (dict_get_documents (dict) != NULL)