projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added function to retrieve variable list used in linear model
[pspp]
/
src
/
data
/
sys-file-writer.c
diff --git
a/src/data/sys-file-writer.c
b/src/data/sys-file-writer.c
index 823d0c47e29138950421e7103b964f8ba52b48a4..690a485909d25dfb0304575f0fd89f1f88114855 100644
(file)
--- a/
src/data/sys-file-writer.c
+++ b/
src/data/sys-file-writer.c
@@
-27,9
+27,7
@@
#include <fcntl.h>
#include <sys/stat.h>
#include <time.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <time.h>
-#if HAVE_UNISTD_H
-#include <unistd.h> /* Required by SunOS4. */
-#endif
+#include <unistd.h>
#include <libpspp/alloc.h>
#include "case.h"
#include "dictionary.h"
#include <libpspp/alloc.h>
#include "case.h"
#include "dictionary.h"
@@
-48,8
+46,6
@@
#include "gettext.h"
#define _(msgid) gettext (msgid)
#include "gettext.h"
#define _(msgid) gettext (msgid)
-#include <libpspp/debug-print.h>
-
/* Compression bias used by PSPP. Values between (1 -
COMPRESSION_BIAS) and (251 - COMPRESSION_BIAS) inclusive can be
compressed. */
/* Compression bias used by PSPP. Values between (1 -
COMPRESSION_BIAS) and (251 - COMPRESSION_BIAS) inclusive can be
compressed. */
@@
-149,7
+145,7
@@
sfm_open_writer (struct file_handle *fh, struct dictionary *d,
mode = S_IRUSR | S_IRGRP | S_IROTH;
if (opts.create_writeable)
mode |= S_IWUSR | S_IWGRP | S_IWOTH;
mode = S_IRUSR | S_IRGRP | S_IROTH;
if (opts.create_writeable)
mode |= S_IWUSR | S_IWGRP | S_IWOTH;
- fd = open (fh_get_filename (fh), O_WRONLY | O_CREAT | O_TRUNC, mode);
+ fd = open (fh_get_file
_
name (fh), O_WRONLY | O_CREAT | O_TRUNC, mode);
if (fd < 0)
goto open_error;
if (fd < 0)
goto open_error;
@@
-219,8
+215,8
@@
sfm_open_writer (struct file_handle *fh, struct dictionary *d,
{
struct
{
{
struct
{
- int32 rec_type P;
- int32 filler P;
+ int32
_t
rec_type P;
+ int32
_t
filler P;
}
rec_999;
}
rec_999;
@@
-250,7
+246,7
@@
sfm_open_writer (struct file_handle *fh, struct dictionary *d,
open_error:
msg (ME, _("Error opening \"%s\" for writing as a system file: %s."),
open_error:
msg (ME, _("Error opening \"%s\" for writing as a system file: %s."),
- fh_get_filename (fh), strerror (errno));
+ fh_get_file
_
name (fh), strerror (errno));
goto error;
}
goto error;
}
@@
-374,7
+370,7
@@
write_header (struct sfm_writer *w, const struct dictionary *d)
/* Translates format spec from internal form in SRC to system file
format in DEST. */
static inline void
/* Translates format spec from internal form in SRC to system file
format in DEST. */
static inline void
-write_format_spec (struct fmt_spec *src, int32 *dest)
+write_format_spec (struct fmt_spec *src, int32
_t
*dest)
{
*dest = (formats[src->type].spss << 16) | (src->w << 8) | src->d;
}
{
*dest = (formats[src->type].spss << 16) | (src->w << 8) | src->d;
}
@@
-427,7
+423,7
@@
write_variable (struct sfm_writer *w, struct variable *v)
{
struct label
{
{
struct label
{
- int32 label_len P;
+ int32
_t
label_len P;
char label[255] P;
}
l;
char label[255] P;
}
l;
@@
-470,16
+466,16
@@
write_value_labels (struct sfm_writer *w, struct variable *v, int idx)
{
struct value_label_rec
{
{
struct value_label_rec
{
- int32 rec_type P;
- int32 n_labels P;
+ int32
_t
rec_type P;
+ int32
_t
n_labels P;
flt64 labels[1] P;
};
struct var_idx_rec
{
flt64 labels[1] P;
};
struct var_idx_rec
{
- int32 rec_type P;
- int32 n_vars P;
- int32 vars[1] P;
+ int32
_t
rec_type P;
+ int32
_t
n_vars P;
+ int32
_t
vars[1] P;
};
struct val_labs_iterator *i;
};
struct val_labs_iterator *i;
@@
-532,8
+528,8
@@
write_documents (struct sfm_writer *w, const struct dictionary *d)
{
struct
{
{
struct
{
- int32
rec_type P;
/* Always 6. */
- int32
n_lines P;
/* Number of lines of documents. */
+ int32
_t rec_type P;
/* Always 6. */
+ int32
_t n_lines P;
/* Number of lines of documents. */
}
rec_6;
}
rec_6;
@@
-558,10
+554,10
@@
write_variable_display_parameters (struct sfm_writer *w,
struct
{
struct
{
- int32 rec_type P;
- int32 subtype P;
- int32 elem_size P;
- int32 n_elem P;
+ int32
_t
rec_type P;
+ int32
_t
subtype P;
+ int32
_t
elem_size P;
+ int32
_t
n_elem P;
} vdp_hdr;
vdp_hdr.rec_type = 7;
} vdp_hdr;
vdp_hdr.rec_type = 7;
@@
-576,9
+572,9
@@
write_variable_display_parameters (struct sfm_writer *w,
struct variable *v;
struct
{
struct variable *v;
struct
{
- int32 measure P;
- int32 width P;
- int32 align P;
+ int32
_t
measure P;
+ int32
_t
width P;
+ int32
_t
align P;
}
params;
}
params;
@@
-598,10
+594,10
@@
write_longvar_table (struct sfm_writer *w, const struct dictionary *dict)
{
struct
{
{
struct
{
- int32 rec_type P;
- int32 subtype P;
- int32 elem_size P;
- int32 n_elem P;
+ int32
_t
rec_type P;
+ int32
_t
subtype P;
+ int32
_t
elem_size P;
+ int32
_t
n_elem P;
}
lv_hdr;
}
lv_hdr;
@@
-635,15
+631,15
@@
write_rec_7_34 (struct sfm_writer *w)
{
struct
{
{
struct
{
- int32 rec_type_3 P;
- int32 subtype_3 P;
- int32 data_type_3 P;
- int32 n_elem_3 P;
- int32 elem_3[8] P;
- int32 rec_type_4 P;
- int32 subtype_4 P;
- int32 data_type_4 P;
- int32 n_elem_4 P;
+ int32
_t
rec_type_3 P;
+ int32
_t
subtype_3 P;
+ int32
_t
data_type_3 P;
+ int32
_t
n_elem_3 P;
+ int32
_t
elem_3[8] P;
+ int32
_t
rec_type_4 P;
+ int32
_t
subtype_4 P;
+ int32
_t
data_type_4 P;
+ int32
_t
n_elem_4 P;
flt64 elem_4[3] P;
}
rec_7;
flt64 elem_4[3] P;
}
rec_7;
@@
-666,7
+662,7
@@
write_rec_7_34 (struct sfm_writer *w)
rec_7.rec_type_3 = 7;
rec_7.subtype_3 = 3;
rec_7.rec_type_3 = 7;
rec_7.subtype_3 = 3;
- rec_7.data_type_3 = sizeof (int32);
+ rec_7.data_type_3 = sizeof (int32
_t
);
rec_7.n_elem_3 = 8;
rec_7.elem_3[0] = version_component[0];
rec_7.elem_3[1] = version_component[1];
rec_7.n_elem_3 = 8;
rec_7.elem_3[0] = version_component[0];
rec_7.elem_3[1] = version_component[1];
@@
-887,7
+883,7
@@
sfm_close_writer (struct sfm_writer *w)
if (ok && !fseek (w->file, offsetof (struct sysfile_header, case_cnt),
SEEK_SET))
{
if (ok && !fseek (w->file, offsetof (struct sysfile_header, case_cnt),
SEEK_SET))
{
- int32 case_cnt = w->case_cnt;
+ int32
_t
case_cnt = w->case_cnt;
fwrite (&case_cnt, sizeof case_cnt, 1, w->file);
clearerr (w->file);
}
fwrite (&case_cnt, sizeof case_cnt, 1, w->file);
clearerr (w->file);
}
@@
-897,7
+893,7
@@
sfm_close_writer (struct sfm_writer *w)
if (!ok)
msg (ME, _("An I/O error occurred writing system file \"%s\"."),
if (!ok)
msg (ME, _("An I/O error occurred writing system file \"%s\"."),
- fh_get_filename (w->fh));
+ fh_get_file
_
name (w->fh));
}
fh_close (w->fh, "system file", "we");
}
fh_close (w->fh, "system file", "we");