Commit 81f4be3c by Tobias Schlüter Committed by Tobias Schlüter

re PR libfortran/15235 (libgfortran doesn't build on Solaris 10)


PR fortran/15235
* gfortran.h (offset_t): Rename to ...
(gfc_offset): ... this.
* io/backspace.c (formatted_backspace, unformatted_backspace),
io/io.h (stream, gfc_unit, global_t, file_length, file_position),
transfer.c (us_read, us_write, next_record_r, next_record_w),
io/unit.c (init_units), unix.c (unix_stream, fd_alloc,
fd_alloc_r_at, fd_alloc_w_at, fd_seek, mmap_alloc,
mmap_alloc_r_at, mmap_alloc_w_at, mmap_seek, mem_alloc_r_at,
mem_alloc_w_at, mem_seek, file_length, file_position): Replace all
occurences of offset_t by gfc_offset.

From-SVN: r81994
parent 7d72d96e
2004-05-18 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
PR fortran/15235
* gfortran.h (offset_t): Rename to ...
(gfc_offset): ... this.
* io/backspace.c (formatted_backspace, unformatted_backspace),
io/io.h (stream, gfc_unit, global_t, file_length, file_position),
transfer.c (us_read, us_write, next_record_r, next_record_w),
io/unit.c (init_units), unix.c (unix_stream, fd_alloc,
fd_alloc_r_at, fd_alloc_w_at, fd_seek, mmap_alloc,
mmap_alloc_r_at, mmap_alloc_w_at, mmap_seek, mem_alloc_r_at,
mem_alloc_w_at, mem_seek, file_length, file_position): Replace all
occurences of offset_t by gfc_offset.
2004-05-16 Paul Brook <paul@codesourcery.com> 2004-05-16 Paul Brook <paul@codesourcery.com>
* io/format.c (write_real): Don't include padding in format. * io/format.c (write_real): Don't include padding in format.
......
...@@ -34,7 +34,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -34,7 +34,7 @@ Boston, MA 02111-1307, USA. */
static void static void
formatted_backspace (void) formatted_backspace (void)
{ {
offset_t base; gfc_offset base;
char *p; char *p;
int n; int n;
...@@ -92,12 +92,12 @@ io_error: ...@@ -92,12 +92,12 @@ io_error:
static void static void
unformatted_backspace (void) unformatted_backspace (void)
{ {
offset_t *p, new; gfc_offset *p, new;
int length; int length;
length = sizeof (offset_t); length = sizeof (gfc_offset);
p = (offset_t *) salloc_r_at (current_unit->s, &length, p = (gfc_offset *) salloc_r_at (current_unit->s, &length,
file_position (current_unit->s) - length); file_position (current_unit->s) - length);
if (p == NULL) if (p == NULL)
goto io_error; goto io_error;
......
...@@ -42,11 +42,11 @@ try; ...@@ -42,11 +42,11 @@ try;
typedef struct stream typedef struct stream
{ {
char *(*alloc_w_at) (struct stream *, int *, offset_t); char *(*alloc_w_at) (struct stream *, int *, gfc_offset);
char *(*alloc_r_at) (struct stream *, int *, offset_t); char *(*alloc_r_at) (struct stream *, int *, gfc_offset);
try (*sfree) (struct stream *); try (*sfree) (struct stream *);
try (*close) (struct stream *); try (*close) (struct stream *);
try (*seek) (struct stream *, offset_t); try (*seek) (struct stream *, gfc_offset);
try (*truncate) (struct stream *); try (*truncate) (struct stream *);
} }
stream; stream;
...@@ -269,7 +269,7 @@ typedef struct gfc_unit ...@@ -269,7 +269,7 @@ typedef struct gfc_unit
endfile; endfile;
unit_flags flags; unit_flags flags;
offset_t recl, last_record, maxrec, bytes_left; gfc_offset recl, last_record, maxrec, bytes_left;
/* recl -- Record length of the file. /* recl -- Record length of the file.
last_record -- Last record number read or written last_record -- Last record number read or written
...@@ -288,7 +288,7 @@ typedef struct ...@@ -288,7 +288,7 @@ typedef struct
{ {
int in_library; /* Nonzero if a library call is being processed. */ int in_library; /* Nonzero if a library call is being processed. */
int size; /* Bytes processed by the current data-transfer statement. */ int size; /* Bytes processed by the current data-transfer statement. */
offset_t max_offset; /* Maximum file offset. */ gfc_offset max_offset; /* Maximum file offset. */
int item_count; /* Item number in a formatted data transfer. */ int item_count; /* Item number in a formatted data transfer. */
int reversion_flag; /* Format reversion has occurred. */ int reversion_flag; /* Format reversion has occurred. */
int first_item; int first_item;
...@@ -445,10 +445,10 @@ const char *inquire_write (const char *, int); ...@@ -445,10 +445,10 @@ const char *inquire_write (const char *, int);
const char *inquire_readwrite (const char *, int); const char *inquire_readwrite (const char *, int);
#define file_length prefix(file_length) #define file_length prefix(file_length)
offset_t file_length (stream *); gfc_offset file_length (stream *);
#define file_position prefix(file_position) #define file_position prefix(file_position)
offset_t file_position (stream *); gfc_offset file_position (stream *);
#define is_seekable prefix(is_seekable) #define is_seekable prefix(is_seekable)
int is_seekable (stream *); int is_seekable (stream *);
......
...@@ -792,13 +792,13 @@ transfer_complex (void *p, int kind) ...@@ -792,13 +792,13 @@ transfer_complex (void *p, int kind)
static void static void
us_read (void) us_read (void)
{ {
offset_t *p; gfc_offset *p;
int n; int n;
n = sizeof (offset_t); n = sizeof (gfc_offset);
p = (offset_t *) salloc_r (current_unit->s, &n); p = (gfc_offset *) salloc_r (current_unit->s, &n);
if (p == NULL || n != sizeof (offset_t)) if (p == NULL || n != sizeof (gfc_offset))
{ {
generate_error (ERROR_BAD_US, NULL); generate_error (ERROR_BAD_US, NULL);
return; return;
...@@ -815,11 +815,11 @@ us_read (void) ...@@ -815,11 +815,11 @@ us_read (void)
static void static void
us_write (void) us_write (void)
{ {
offset_t *p; gfc_offset *p;
int length; int length;
length = sizeof (offset_t); length = sizeof (gfc_offset);
p = (offset_t *) salloc_w (current_unit->s, &length); p = (gfc_offset *) salloc_w (current_unit->s, &length);
if (p == NULL) if (p == NULL)
{ {
...@@ -1111,13 +1111,13 @@ static void ...@@ -1111,13 +1111,13 @@ static void
next_record_r (int done) next_record_r (int done)
{ {
int rlength, length; int rlength, length;
offset_t new; gfc_offset new;
char *p; char *p;
switch (current_mode ()) switch (current_mode ())
{ {
case UNFORMATTED_SEQUENTIAL: case UNFORMATTED_SEQUENTIAL:
current_unit->bytes_left += sizeof (offset_t); /* Skip over tail */ current_unit->bytes_left += sizeof (gfc_offset); /* Skip over tail */
/* Fall through */ /* Fall through */
...@@ -1198,7 +1198,7 @@ next_record_r (int done) ...@@ -1198,7 +1198,7 @@ next_record_r (int done)
static void static void
next_record_w (int done) next_record_w (int done)
{ {
offset_t c, m; gfc_offset c, m;
int length; int length;
char *p; char *p;
...@@ -1225,7 +1225,7 @@ next_record_w (int done) ...@@ -1225,7 +1225,7 @@ next_record_w (int done)
m = current_unit->recl - current_unit->bytes_left; /* Bytes written */ m = current_unit->recl - current_unit->bytes_left; /* Bytes written */
c = file_position (current_unit->s); c = file_position (current_unit->s);
length = sizeof (offset_t); length = sizeof (gfc_offset);
/* Write the length tail */ /* Write the length tail */
...@@ -1233,7 +1233,7 @@ next_record_w (int done) ...@@ -1233,7 +1233,7 @@ next_record_w (int done)
if (p == NULL) if (p == NULL)
goto io_error; goto io_error;
*((offset_t *) p) = m; *((gfc_offset *) p) = m;
if (sfree (current_unit->s) == FAILURE) if (sfree (current_unit->s) == FAILURE)
goto io_error; goto io_error;
...@@ -1243,13 +1243,13 @@ next_record_w (int done) ...@@ -1243,13 +1243,13 @@ next_record_w (int done)
if (p == NULL) if (p == NULL)
generate_error (ERROR_OS, NULL); generate_error (ERROR_OS, NULL);
*((offset_t *) p) = m; *((gfc_offset *) p) = m;
if (sfree (current_unit->s) == FAILURE) if (sfree (current_unit->s) == FAILURE)
goto io_error; goto io_error;
/* Seek past the end of the current record */ /* Seek past the end of the current record */
if (sseek (current_unit->s, c + sizeof (offset_t)) == FAILURE) if (sseek (current_unit->s, c + sizeof (gfc_offset)) == FAILURE)
goto io_error; goto io_error;
break; break;
......
...@@ -289,7 +289,7 @@ is_internal_unit () ...@@ -289,7 +289,7 @@ is_internal_unit ()
void void
init_units (void) init_units (void)
{ {
offset_t m, n; gfc_offset m, n;
gfc_unit *u; gfc_unit *u;
int i; int i;
...@@ -336,13 +336,13 @@ init_units (void) ...@@ -336,13 +336,13 @@ init_units (void)
} }
/* Calculate the maximum file offset in a portable manner. /* Calculate the maximum file offset in a portable manner.
* max will be the largest signed number for the type offset_t. * max will be the largest signed number for the type gfc_offset.
* *
* set a 1 in the LSB and keep a running sum, stopping at MSB-1 bit. */ * set a 1 in the LSB and keep a running sum, stopping at MSB-1 bit. */
g.max_offset = 0; g.max_offset = 0;
for (i=0; i < sizeof(g.max_offset) * 8 - 1; i++) for (i=0; i < sizeof(g.max_offset) * 8 - 1; i++)
g.max_offset = g.max_offset + ((offset_t) 1 << i); g.max_offset = g.max_offset + ((gfc_offset) 1 << i);
} }
......
...@@ -86,11 +86,11 @@ typedef struct ...@@ -86,11 +86,11 @@ typedef struct
stream st; stream st;
int fd; int fd;
offset_t buffer_offset; /* File offset of the start of the buffer */ gfc_offset buffer_offset; /* File offset of the start of the buffer */
offset_t physical_offset; /* Current physical file offset */ gfc_offset physical_offset; /* Current physical file offset */
offset_t logical_offset; /* Current logical file offset */ gfc_offset logical_offset; /* Current logical file offset */
offset_t dirty_offset; /* Start of modified bytes in buffer */ gfc_offset dirty_offset; /* Start of modified bytes in buffer */
offset_t file_length; /* Length of the file, -1 if not seekable. */ gfc_offset file_length; /* Length of the file, -1 if not seekable. */
char *buffer; char *buffer;
int len; /* Physical length of the current buffer */ int len; /* Physical length of the current buffer */
...@@ -293,7 +293,7 @@ fd_flush (unix_stream * s) ...@@ -293,7 +293,7 @@ fd_flush (unix_stream * s)
* to come next. */ * to come next. */
static void static void
fd_alloc (unix_stream * s, offset_t where, int *len) fd_alloc (unix_stream * s, gfc_offset where, int *len)
{ {
char *new_buffer; char *new_buffer;
int n, read_len; int n, read_len;
...@@ -344,9 +344,9 @@ fd_alloc (unix_stream * s, offset_t where, int *len) ...@@ -344,9 +344,9 @@ fd_alloc (unix_stream * s, offset_t where, int *len)
* NULL on I/O error. */ * NULL on I/O error. */
static char * static char *
fd_alloc_r_at (unix_stream * s, int *len, offset_t where) fd_alloc_r_at (unix_stream * s, int *len, gfc_offset where)
{ {
offset_t m; gfc_offset m;
int n; int n;
if (where == -1) if (where == -1)
...@@ -389,9 +389,9 @@ fd_alloc_r_at (unix_stream * s, int *len, offset_t where) ...@@ -389,9 +389,9 @@ fd_alloc_r_at (unix_stream * s, int *len, offset_t where)
* we've already buffered the data or we need to load it. */ * we've already buffered the data or we need to load it. */
static char * static char *
fd_alloc_w_at (unix_stream * s, int *len, offset_t where) fd_alloc_w_at (unix_stream * s, int *len, gfc_offset where)
{ {
offset_t n; gfc_offset n;
if (where == -1) if (where == -1)
where = s->logical_offset; where = s->logical_offset;
...@@ -444,7 +444,7 @@ fd_sfree (unix_stream * s) ...@@ -444,7 +444,7 @@ fd_sfree (unix_stream * s)
static int static int
fd_seek (unix_stream * s, offset_t offset) fd_seek (unix_stream * s, gfc_offset offset)
{ {
s->physical_offset = s->logical_offset = offset; s->physical_offset = s->logical_offset = offset;
...@@ -551,9 +551,9 @@ mmap_flush (unix_stream * s) ...@@ -551,9 +551,9 @@ mmap_flush (unix_stream * s)
* guaranteed to be mappable. */ * guaranteed to be mappable. */
static try static try
mmap_alloc (unix_stream * s, offset_t where, int *len) mmap_alloc (unix_stream * s, gfc_offset where, int *len)
{ {
offset_t offset; gfc_offset offset;
int length; int length;
char *p; char *p;
...@@ -578,9 +578,9 @@ mmap_alloc (unix_stream * s, offset_t where, int *len) ...@@ -578,9 +578,9 @@ mmap_alloc (unix_stream * s, offset_t where, int *len)
static char * static char *
mmap_alloc_r_at (unix_stream * s, int *len, offset_t where) mmap_alloc_r_at (unix_stream * s, int *len, gfc_offset where)
{ {
offset_t m; gfc_offset m;
if (where == -1) if (where == -1)
where = s->logical_offset; where = s->logical_offset;
...@@ -605,7 +605,7 @@ mmap_alloc_r_at (unix_stream * s, int *len, offset_t where) ...@@ -605,7 +605,7 @@ mmap_alloc_r_at (unix_stream * s, int *len, offset_t where)
static char * static char *
mmap_alloc_w_at (unix_stream * s, int *len, offset_t where) mmap_alloc_w_at (unix_stream * s, int *len, gfc_offset where)
{ {
if (where == -1) if (where == -1)
where = s->logical_offset; where = s->logical_offset;
...@@ -632,7 +632,7 @@ mmap_alloc_w_at (unix_stream * s, int *len, offset_t where) ...@@ -632,7 +632,7 @@ mmap_alloc_w_at (unix_stream * s, int *len, offset_t where)
static int static int
mmap_seek (unix_stream * s, offset_t offset) mmap_seek (unix_stream * s, gfc_offset offset)
{ {
s->logical_offset = offset; s->logical_offset = offset;
...@@ -719,9 +719,9 @@ mmap_open (unix_stream * s) ...@@ -719,9 +719,9 @@ mmap_open (unix_stream * s)
static char * static char *
mem_alloc_r_at (unix_stream * s, int *len, offset_t where) mem_alloc_r_at (unix_stream * s, int *len, gfc_offset where)
{ {
offset_t n; gfc_offset n;
if (where == -1) if (where == -1)
where = s->logical_offset; where = s->logical_offset;
...@@ -743,9 +743,9 @@ mem_alloc_r_at (unix_stream * s, int *len, offset_t where) ...@@ -743,9 +743,9 @@ mem_alloc_r_at (unix_stream * s, int *len, offset_t where)
static char * static char *
mem_alloc_w_at (unix_stream * s, int *len, offset_t where) mem_alloc_w_at (unix_stream * s, int *len, gfc_offset where)
{ {
offset_t m; gfc_offset m;
if (where == -1) if (where == -1)
where = s->logical_offset; where = s->logical_offset;
...@@ -762,7 +762,7 @@ mem_alloc_w_at (unix_stream * s, int *len, offset_t where) ...@@ -762,7 +762,7 @@ mem_alloc_w_at (unix_stream * s, int *len, offset_t where)
static int static int
mem_seek (unix_stream * s, offset_t offset) mem_seek (unix_stream * s, gfc_offset offset)
{ {
if (offset > s->file_length) if (offset > s->file_length)
...@@ -1366,7 +1366,7 @@ inquire_readwrite (const char *string, int len) ...@@ -1366,7 +1366,7 @@ inquire_readwrite (const char *string, int len)
/* file_length()-- Return the file length in bytes, -1 if unknown */ /* file_length()-- Return the file length in bytes, -1 if unknown */
offset_t gfc_offset
file_length (stream * s) file_length (stream * s)
{ {
...@@ -1376,7 +1376,7 @@ file_length (stream * s) ...@@ -1376,7 +1376,7 @@ file_length (stream * s)
/* file_position()-- Return the current position of the file */ /* file_position()-- Return the current position of the file */
offset_t gfc_offset
file_position (stream * s) file_position (stream * s)
{ {
......
...@@ -50,7 +50,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -50,7 +50,7 @@ Boston, MA 02111-1307, USA. */
#if HAVE_SYS_TYPES_H #if HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif #endif
typedef off_t offset_t; typedef off_t gfc_offset;
#ifndef NULL #ifndef NULL
#define NULL (void *) 0 #define NULL (void *) 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment