Commit 909087e0 by Tobias Schlüter Committed by Tobias Schlüter

re PR libfortran/15234 (libgfortran doesn't compile on Tru64 UNIX V4.0F)

PR fortran/15234
* io/io.h (unit_t): Rename to ...
(gfc_unit) ... this.
(unit_root, current_unit, find_file, find_unit, get_unit): Now
of type gfc_unit.
(delete_file, insert_unit, close_unit): Argument now of type
gfc_unit.
* backspace.c (st_backspace), close.c (st_close), endfile.c
(st_endfile), inquire.c (inquire_via_unit, st_inquire), open.c
(test_endfile, edit_modes, new_unit, already_open, st_open),
rewind.c (st_rewind), transfer.c (current_unit), unit.c
(internal_unit, unit_cache, rotate_left, rotate_right, insert,
insert_unit, delete_root, delete_treap, delete_unit, find_unit,
get_unit, init_units, close_unit), unix.c (find_file0,
find_file, delete_file): Replace all occurences of unit_t by
gfc_unit.

From-SVN: r81903
parent 85ff6f62
2004-05-15 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
PR fortran/15234
* io/io.h (unit_t): Rename to ...
(gfc_unit) ... this.
(unit_root, current_unit, find_file, find_unit, get_unit): Now
of type gfc_unit.
(delete_file, insert_unit, close_unit): Argument now of type
gfc_unit.
* backspace.c (st_backspace), close.c (st_close), endfile.c
(st_endfile), inquire.c (inquire_via_unit, st_inquire), open.c
(test_endfile, edit_modes, new_unit, already_open, st_open),
rewind.c (st_rewind), transfer.c (current_unit), unit.c
(internal_unit, unit_cache, rotate_left, rotate_right, insert,
insert_unit, delete_root, delete_treap, delete_unit, find_unit,
get_unit, init_units, close_unit), unix.c (find_file0,
find_file, delete_file): Replace all occurences of unit_t by
gfc_unit.
2004-05-15 Bud Davis <bdavis9659@comcast.net> 2004-05-15 Bud Davis <bdavis9659@comcast.net>
PR fortran/15311 PR fortran/15311
......
...@@ -117,7 +117,7 @@ io_error: ...@@ -117,7 +117,7 @@ io_error:
void void
st_backspace (void) st_backspace (void)
{ {
unit_t *u; gfc_unit *u;
library_start (); library_start ();
......
...@@ -37,7 +37,7 @@ void ...@@ -37,7 +37,7 @@ void
st_close (void) st_close (void)
{ {
close_status status; close_status status;
unit_t *u; gfc_unit *u;
library_start (); library_start ();
......
...@@ -27,7 +27,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -27,7 +27,7 @@ Boston, MA 02111-1307, USA. */
void void
st_endfile (void) st_endfile (void)
{ {
unit_t *u; gfc_unit *u;
library_start (); library_start ();
......
...@@ -32,7 +32,7 @@ static char undefined[] = "UNDEFINED"; ...@@ -32,7 +32,7 @@ static char undefined[] = "UNDEFINED";
/* inquire_via_unit()-- Inquiry via unit number. The unit might not exist. */ /* inquire_via_unit()-- Inquiry via unit number. The unit might not exist. */
static void static void
inquire_via_unit (unit_t * u) inquire_via_unit (gfc_unit * u)
{ {
const char *p; const char *p;
...@@ -352,7 +352,7 @@ inquire_via_filename (void) ...@@ -352,7 +352,7 @@ inquire_via_filename (void)
void void
st_inquire (void) st_inquire (void)
{ {
unit_t *u; gfc_unit *u;
library_start (); library_start ();
......
...@@ -254,13 +254,13 @@ unit_flags; ...@@ -254,13 +254,13 @@ unit_flags;
#define DEFAULT_RECL 10000 #define DEFAULT_RECL 10000
typedef struct unit_t typedef struct gfc_unit
{ {
int unit_number; int unit_number;
stream *s; stream *s;
struct unit_t *left, *right; /* Treap links. */ struct gfc_unit *left, *right; /* Treap links. */
int priority; int priority;
int read_bad, current_record; int read_bad, current_record;
...@@ -279,7 +279,7 @@ typedef struct unit_t ...@@ -279,7 +279,7 @@ typedef struct unit_t
int file_len; int file_len;
char file[1]; /* Filename is allocated at the end of the structure. */ char file[1]; /* Filename is allocated at the end of the structure. */
} }
unit_t; gfc_unit;
/* Global variables. Putting these in a structure makes it easier to /* Global variables. Putting these in a structure makes it easier to
maintain, particularly with the constraint of a prefix. */ maintain, particularly with the constraint of a prefix. */
...@@ -293,7 +293,7 @@ typedef struct ...@@ -293,7 +293,7 @@ typedef struct
int reversion_flag; /* Format reversion has occurred. */ int reversion_flag; /* Format reversion has occurred. */
int first_item; int first_item;
unit_t *unit_root; gfc_unit *unit_root;
int seen_dollar; int seen_dollar;
enum {READING, WRITING} mode; enum {READING, WRITING} mode;
...@@ -311,7 +311,7 @@ extern global_t g; ...@@ -311,7 +311,7 @@ extern global_t g;
#define current_unit prefix(current_unit) #define current_unit prefix(current_unit)
extern unit_t *current_unit; extern gfc_unit *current_unit;
/* Format tokens. Only about half of these can be stored in the /* Format tokens. Only about half of these can be stored in the
format nodes. */ format nodes. */
...@@ -409,7 +409,7 @@ stream *output_stream (void); ...@@ -409,7 +409,7 @@ stream *output_stream (void);
int compare_file_filename (stream *, const char *, int); int compare_file_filename (stream *, const char *, int);
#define find_file prefix(find_file) #define find_file prefix(find_file)
unit_t *find_file (void); gfc_unit *find_file (void);
#define stream_at_bof prefix(stream_at_bof) #define stream_at_bof prefix(stream_at_bof)
int stream_at_bof (stream *); int stream_at_bof (stream *);
...@@ -418,7 +418,7 @@ int stream_at_bof (stream *); ...@@ -418,7 +418,7 @@ int stream_at_bof (stream *);
int stream_at_eof (stream *); int stream_at_eof (stream *);
#define delete_file prefix(delete_file) #define delete_file prefix(delete_file)
int delete_file (unit_t *); int delete_file (gfc_unit *);
#define file_exists prefix(file_exists) #define file_exists prefix(file_exists)
int file_exists (void); int file_exists (void);
...@@ -460,24 +460,24 @@ void empty_internal_buffer(stream *); ...@@ -460,24 +460,24 @@ void empty_internal_buffer(stream *);
/* unit.c */ /* unit.c */
#define insert_unit prefix(insert_unix) #define insert_unit prefix(insert_unix)
void insert_unit (unit_t *); void insert_unit (gfc_unit *);
#define close_unit prefix(close_unit) #define close_unit prefix(close_unit)
int close_unit (unit_t *); int close_unit (gfc_unit *);
#define is_internal_unit prefix(is_internal_unit) #define is_internal_unit prefix(is_internal_unit)
int is_internal_unit (void); int is_internal_unit (void);
#define find_unit prefix(find_unit) #define find_unit prefix(find_unit)
unit_t *find_unit (int); gfc_unit *find_unit (int);
#define get_unit prefix(get_unit) #define get_unit prefix(get_unit)
unit_t *get_unit (int); gfc_unit *get_unit (int);
/* open.c */ /* open.c */
#define test_endfile prefix(test_endfile) #define test_endfile prefix(test_endfile)
void test_endfile (unit_t *); void test_endfile (gfc_unit *);
#define new_unit prefix(new_unit) #define new_unit prefix(new_unit)
void new_unit (unit_flags *); void new_unit (unit_flags *);
......
...@@ -140,7 +140,7 @@ static st_option access_opt[] = { ...@@ -140,7 +140,7 @@ static st_option access_opt[] = {
* state from AFTER_ENDFILE to AT_ENDFILE. */ * state from AFTER_ENDFILE to AT_ENDFILE. */
void void
test_endfile (unit_t * u) test_endfile (gfc_unit * u)
{ {
if (u->endfile == NO_ENDFILE && file_length (u->s) == file_position (u->s)) if (u->endfile == NO_ENDFILE && file_length (u->s) == file_position (u->s))
...@@ -152,7 +152,7 @@ test_endfile (unit_t * u) ...@@ -152,7 +152,7 @@ test_endfile (unit_t * u)
* to be changed. */ * to be changed. */
static void static void
edit_modes (unit_t * u, unit_flags * flags) edit_modes (gfc_unit * u, unit_flags * flags)
{ {
/* Complain about attempts to change the unchangeable */ /* Complain about attempts to change the unchangeable */
...@@ -250,7 +250,7 @@ edit_modes (unit_t * u, unit_flags * flags) ...@@ -250,7 +250,7 @@ edit_modes (unit_t * u, unit_flags * flags)
void void
new_unit (unit_flags * flags) new_unit (unit_flags * flags)
{ {
unit_t *u; gfc_unit *u;
stream *s; stream *s;
char tmpname[5 /* fort. */ + 10 /* digits of unit number */ + 1 /* 0 */]; char tmpname[5 /* fort. */ + 10 /* digits of unit number */ + 1 /* 0 */];
...@@ -384,7 +384,7 @@ new_unit (unit_flags * flags) ...@@ -384,7 +384,7 @@ new_unit (unit_flags * flags)
/* Create the unit structure */ /* Create the unit structure */
u = get_mem (sizeof (unit_t) + ioparm.file_len); u = get_mem (sizeof (gfc_unit) + ioparm.file_len);
u->unit_number = ioparm.unit; u->unit_number = ioparm.unit;
u->s = s; u->s = s;
...@@ -430,7 +430,7 @@ cleanup: ...@@ -430,7 +430,7 @@ cleanup:
* file. */ * file. */
static void static void
already_open (unit_t * u, unit_flags * flags) already_open (gfc_unit * u, unit_flags * flags)
{ {
if (ioparm.file == NULL) if (ioparm.file == NULL)
...@@ -465,7 +465,7 @@ void ...@@ -465,7 +465,7 @@ void
st_open (void) st_open (void)
{ {
unit_flags flags; unit_flags flags;
unit_t *u = NULL; gfc_unit *u = NULL;
library_start (); library_start ();
......
...@@ -28,7 +28,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -28,7 +28,7 @@ Boston, MA 02111-1307, USA. */
void void
st_rewind (void) st_rewind (void)
{ {
unit_t *u; gfc_unit *u;
library_start (); library_start ();
......
...@@ -54,7 +54,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -54,7 +54,7 @@ Boston, MA 02111-1307, USA. */
* transferred. * transferred.
*/ */
unit_t *current_unit; gfc_unit *current_unit;
static int sf_seen_eor = 0; static int sf_seen_eor = 0;
char scratch[SCRATCH_SIZE]; char scratch[SCRATCH_SIZE];
......
...@@ -29,7 +29,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -29,7 +29,7 @@ Boston, MA 02111-1307, USA. */
#define CACHE_SIZE 3 #define CACHE_SIZE 3
static unit_t internal_unit, *unit_cache[CACHE_SIZE]; static gfc_unit internal_unit, *unit_cache[CACHE_SIZE];
/* This implementation is based on Stefan Nilsson's article in the /* This implementation is based on Stefan Nilsson's article in the
...@@ -51,10 +51,10 @@ pseudo_random (void) ...@@ -51,10 +51,10 @@ pseudo_random (void)
/* rotate_left()-- Rotate the treap left */ /* rotate_left()-- Rotate the treap left */
static unit_t * static gfc_unit *
rotate_left (unit_t * t) rotate_left (gfc_unit * t)
{ {
unit_t *temp; gfc_unit *temp;
temp = t->right; temp = t->right;
t->right = t->right->left; t->right = t->right->left;
...@@ -66,10 +66,10 @@ rotate_left (unit_t * t) ...@@ -66,10 +66,10 @@ rotate_left (unit_t * t)
/* rotate_right()-- Rotate the treap right */ /* rotate_right()-- Rotate the treap right */
static unit_t * static gfc_unit *
rotate_right (unit_t * t) rotate_right (gfc_unit * t)
{ {
unit_t *temp; gfc_unit *temp;
temp = t->left; temp = t->left;
t->left = t->left->right; t->left = t->left->right;
...@@ -95,8 +95,8 @@ compare (int a, int b) ...@@ -95,8 +95,8 @@ compare (int a, int b)
/* insert()-- Recursive insertion function. Returns the updated treap. */ /* insert()-- Recursive insertion function. Returns the updated treap. */
static unit_t * static gfc_unit *
insert (unit_t * new, unit_t * t) insert (gfc_unit * new, gfc_unit * t)
{ {
int c; int c;
...@@ -130,7 +130,7 @@ insert (unit_t * new, unit_t * t) ...@@ -130,7 +130,7 @@ insert (unit_t * new, unit_t * t)
* an error to insert a key that already exists. */ * an error to insert a key that already exists. */
void void
insert_unit (unit_t * new) insert_unit (gfc_unit * new)
{ {
new->priority = pseudo_random (); new->priority = pseudo_random ();
...@@ -138,10 +138,10 @@ insert_unit (unit_t * new) ...@@ -138,10 +138,10 @@ insert_unit (unit_t * new)
} }
static unit_t * static gfc_unit *
delete_root (unit_t * t) delete_root (gfc_unit * t)
{ {
unit_t *temp; gfc_unit *temp;
if (t->left == NULL) if (t->left == NULL)
return t->right; return t->right;
...@@ -168,8 +168,8 @@ delete_root (unit_t * t) ...@@ -168,8 +168,8 @@ delete_root (unit_t * t)
* must just point to a treap structure with the key to be deleted. * must just point to a treap structure with the key to be deleted.
* Returns the new root node of the tree. */ * Returns the new root node of the tree. */
static unit_t * static gfc_unit *
delete_treap (unit_t * old, unit_t * t) delete_treap (gfc_unit * old, gfc_unit * t)
{ {
int c; int c;
...@@ -192,7 +192,7 @@ delete_treap (unit_t * old, unit_t * t) ...@@ -192,7 +192,7 @@ delete_treap (unit_t * old, unit_t * t)
/* delete_unit()-- Delete a unit from a tree */ /* delete_unit()-- Delete a unit from a tree */
static void static void
delete_unit (unit_t * old) delete_unit (gfc_unit * old)
{ {
g.unit_root = delete_treap (old, g.unit_root); g.unit_root = delete_treap (old, g.unit_root);
...@@ -202,10 +202,10 @@ delete_unit (unit_t * old) ...@@ -202,10 +202,10 @@ delete_unit (unit_t * old)
/* find_unit()-- Given an integer, return a pointer to the unit /* find_unit()-- Given an integer, return a pointer to the unit
* structure. Returns NULL if the unit does not exist. */ * structure. Returns NULL if the unit does not exist. */
unit_t * gfc_unit *
find_unit (int n) find_unit (int n)
{ {
unit_t *p; gfc_unit *p;
int c; int c;
for (c = 0; c < CACHE_SIZE; c++) for (c = 0; c < CACHE_SIZE; c++)
...@@ -241,10 +241,10 @@ find_unit (int n) ...@@ -241,10 +241,10 @@ find_unit (int n)
/* get_unit()-- Returns the unit structure associated with the integer /* get_unit()-- Returns the unit structure associated with the integer
* unit or the internal file. */ * unit or the internal file. */
unit_t * gfc_unit *
get_unit (int read_flag) get_unit (int read_flag)
{ {
unit_t *u; gfc_unit *u;
if (ioparm.internal_unit != NULL) if (ioparm.internal_unit != NULL)
{ {
...@@ -290,12 +290,12 @@ void ...@@ -290,12 +290,12 @@ void
init_units (void) init_units (void)
{ {
offset_t m, n; offset_t m, n;
unit_t *u; gfc_unit *u;
int i; int i;
if (options.stdin_unit >= 0) if (options.stdin_unit >= 0)
{ /* STDIN */ { /* STDIN */
u = get_mem (sizeof (unit_t)); u = get_mem (sizeof (gfc_unit));
u->unit_number = options.stdin_unit; u->unit_number = options.stdin_unit;
u->s = input_stream (); u->s = input_stream ();
...@@ -316,7 +316,7 @@ init_units (void) ...@@ -316,7 +316,7 @@ init_units (void)
if (options.stdout_unit >= 0) if (options.stdout_unit >= 0)
{ /* STDOUT */ { /* STDOUT */
u = get_mem (sizeof (unit_t)); u = get_mem (sizeof (gfc_unit));
u->unit_number = options.stdout_unit; u->unit_number = options.stdout_unit;
u->s = output_stream (); u->s = output_stream ();
...@@ -351,7 +351,7 @@ init_units (void) ...@@ -351,7 +351,7 @@ init_units (void)
* associated with the stream is freed. Returns nonzero on I/O error. */ * associated with the stream is freed. Returns nonzero on I/O error. */
int int
close_unit (unit_t * u) close_unit (gfc_unit * u)
{ {
int i, rc; int i, rc;
......
...@@ -1112,11 +1112,11 @@ compare_file_filename (stream * s, const char *name, int len) ...@@ -1112,11 +1112,11 @@ compare_file_filename (stream * s, const char *name, int len)
/* find_file0()-- Recursive work function for find_file() */ /* find_file0()-- Recursive work function for find_file() */
static unit_t * static gfc_unit *
find_file0 (unit_t * u, struct stat *st1) find_file0 (gfc_unit * u, struct stat *st1)
{ {
struct stat st2; struct stat st2;
unit_t *v; gfc_unit *v;
if (u == NULL) if (u == NULL)
return NULL; return NULL;
...@@ -1140,7 +1140,7 @@ find_file0 (unit_t * u, struct stat *st1) ...@@ -1140,7 +1140,7 @@ find_file0 (unit_t * u, struct stat *st1)
/* find_file()-- Take the current filename and see if there is a unit /* find_file()-- Take the current filename and see if there is a unit
* that has the file already open. Returns a pointer to the unit if so. */ * that has the file already open. Returns a pointer to the unit if so. */
unit_t * gfc_unit *
find_file (void) find_file (void)
{ {
char path[PATH_MAX + 1]; char path[PATH_MAX + 1];
...@@ -1194,7 +1194,7 @@ stream_at_eof (stream * s) ...@@ -1194,7 +1194,7 @@ stream_at_eof (stream * s)
* with the unit. Returns nonzero if something went wrong. */ * with the unit. Returns nonzero if something went wrong. */
int int
delete_file (unit_t * u) delete_file (gfc_unit * u)
{ {
char path[PATH_MAX + 1]; char path[PATH_MAX + 1];
......
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