From 909087e0cfa28372c9aca47a86aa51af91b12684 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tobias=20Schl=C3=BCter?= Date: Sat, 15 May 2004 22:44:38 +0200 Subject: [PATCH] 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 --- libgfortran/ChangeLog | 19 +++++++++++++++ libgfortran/io/backspace.c | 2 +- libgfortran/io/close.c | 2 +- libgfortran/io/endfile.c | 2 +- libgfortran/io/inquire.c | 4 ++-- libgfortran/io/io.h | 24 +++++++++---------- libgfortran/io/open.c | 12 +++++----- libgfortran/io/rewind.c | 2 +- libgfortran/io/transfer.c | 2 +- libgfortran/io/unit.c | 48 +++++++++++++++++++------------------- libgfortran/io/unix.c | 10 ++++---- 11 files changed, 73 insertions(+), 54 deletions(-) diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 2ebef7f2d1b..d3bf438fe16 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,22 @@ +2004-05-15 Tobias Schlueter + + 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 PR fortran/15311 diff --git a/libgfortran/io/backspace.c b/libgfortran/io/backspace.c index 7502f1d4863..5cfc43ce888 100644 --- a/libgfortran/io/backspace.c +++ b/libgfortran/io/backspace.c @@ -117,7 +117,7 @@ io_error: void st_backspace (void) { - unit_t *u; + gfc_unit *u; library_start (); diff --git a/libgfortran/io/close.c b/libgfortran/io/close.c index 9e2a5a398ce..48d669b2ce7 100644 --- a/libgfortran/io/close.c +++ b/libgfortran/io/close.c @@ -37,7 +37,7 @@ void st_close (void) { close_status status; - unit_t *u; + gfc_unit *u; library_start (); diff --git a/libgfortran/io/endfile.c b/libgfortran/io/endfile.c index 56f81f09909..ca40fe4eb79 100644 --- a/libgfortran/io/endfile.c +++ b/libgfortran/io/endfile.c @@ -27,7 +27,7 @@ Boston, MA 02111-1307, USA. */ void st_endfile (void) { - unit_t *u; + gfc_unit *u; library_start (); diff --git a/libgfortran/io/inquire.c b/libgfortran/io/inquire.c index 88e805ec96f..20bea1f887d 100644 --- a/libgfortran/io/inquire.c +++ b/libgfortran/io/inquire.c @@ -32,7 +32,7 @@ static char undefined[] = "UNDEFINED"; /* inquire_via_unit()-- Inquiry via unit number. The unit might not exist. */ static void -inquire_via_unit (unit_t * u) +inquire_via_unit (gfc_unit * u) { const char *p; @@ -352,7 +352,7 @@ inquire_via_filename (void) void st_inquire (void) { - unit_t *u; + gfc_unit *u; library_start (); diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h index 3b01912f09a..99c2b0241ae 100644 --- a/libgfortran/io/io.h +++ b/libgfortran/io/io.h @@ -254,13 +254,13 @@ unit_flags; #define DEFAULT_RECL 10000 -typedef struct unit_t +typedef struct gfc_unit { int unit_number; stream *s; - struct unit_t *left, *right; /* Treap links. */ + struct gfc_unit *left, *right; /* Treap links. */ int priority; int read_bad, current_record; @@ -279,7 +279,7 @@ typedef struct unit_t int file_len; 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 maintain, particularly with the constraint of a prefix. */ @@ -293,7 +293,7 @@ typedef struct int reversion_flag; /* Format reversion has occurred. */ int first_item; - unit_t *unit_root; + gfc_unit *unit_root; int seen_dollar; enum {READING, WRITING} mode; @@ -311,7 +311,7 @@ extern global_t g; #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 nodes. */ @@ -409,7 +409,7 @@ stream *output_stream (void); int compare_file_filename (stream *, const char *, int); #define find_file prefix(find_file) -unit_t *find_file (void); +gfc_unit *find_file (void); #define stream_at_bof prefix(stream_at_bof) int stream_at_bof (stream *); @@ -418,7 +418,7 @@ int stream_at_bof (stream *); int stream_at_eof (stream *); #define delete_file prefix(delete_file) -int delete_file (unit_t *); +int delete_file (gfc_unit *); #define file_exists prefix(file_exists) int file_exists (void); @@ -460,24 +460,24 @@ void empty_internal_buffer(stream *); /* unit.c */ #define insert_unit prefix(insert_unix) -void insert_unit (unit_t *); +void insert_unit (gfc_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) int is_internal_unit (void); #define find_unit prefix(find_unit) -unit_t *find_unit (int); +gfc_unit *find_unit (int); #define get_unit prefix(get_unit) -unit_t *get_unit (int); +gfc_unit *get_unit (int); /* open.c */ #define test_endfile prefix(test_endfile) -void test_endfile (unit_t *); +void test_endfile (gfc_unit *); #define new_unit prefix(new_unit) void new_unit (unit_flags *); diff --git a/libgfortran/io/open.c b/libgfortran/io/open.c index e6fa50d776a..cd70622baf7 100644 --- a/libgfortran/io/open.c +++ b/libgfortran/io/open.c @@ -140,7 +140,7 @@ static st_option access_opt[] = { * state from AFTER_ENDFILE to AT_ENDFILE. */ void -test_endfile (unit_t * u) +test_endfile (gfc_unit * u) { if (u->endfile == NO_ENDFILE && file_length (u->s) == file_position (u->s)) @@ -152,7 +152,7 @@ test_endfile (unit_t * u) * to be changed. */ 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 */ @@ -250,7 +250,7 @@ edit_modes (unit_t * u, unit_flags * flags) void new_unit (unit_flags * flags) { - unit_t *u; + gfc_unit *u; stream *s; char tmpname[5 /* fort. */ + 10 /* digits of unit number */ + 1 /* 0 */]; @@ -384,7 +384,7 @@ new_unit (unit_flags * flags) /* 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->s = s; @@ -430,7 +430,7 @@ cleanup: * file. */ static void -already_open (unit_t * u, unit_flags * flags) +already_open (gfc_unit * u, unit_flags * flags) { if (ioparm.file == NULL) @@ -465,7 +465,7 @@ void st_open (void) { unit_flags flags; - unit_t *u = NULL; + gfc_unit *u = NULL; library_start (); diff --git a/libgfortran/io/rewind.c b/libgfortran/io/rewind.c index d068853cf3a..76fd1948e05 100644 --- a/libgfortran/io/rewind.c +++ b/libgfortran/io/rewind.c @@ -28,7 +28,7 @@ Boston, MA 02111-1307, USA. */ void st_rewind (void) { - unit_t *u; + gfc_unit *u; library_start (); diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index b1f0ef10598..2440aea6cf8 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -54,7 +54,7 @@ Boston, MA 02111-1307, USA. */ * transferred. */ -unit_t *current_unit; +gfc_unit *current_unit; static int sf_seen_eor = 0; char scratch[SCRATCH_SIZE]; diff --git a/libgfortran/io/unit.c b/libgfortran/io/unit.c index 87f9095b731..6f35a2101da 100644 --- a/libgfortran/io/unit.c +++ b/libgfortran/io/unit.c @@ -29,7 +29,7 @@ Boston, MA 02111-1307, USA. */ #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 @@ -51,10 +51,10 @@ pseudo_random (void) /* rotate_left()-- Rotate the treap left */ -static unit_t * -rotate_left (unit_t * t) +static gfc_unit * +rotate_left (gfc_unit * t) { - unit_t *temp; + gfc_unit *temp; temp = t->right; t->right = t->right->left; @@ -66,10 +66,10 @@ rotate_left (unit_t * t) /* rotate_right()-- Rotate the treap right */ -static unit_t * -rotate_right (unit_t * t) +static gfc_unit * +rotate_right (gfc_unit * t) { - unit_t *temp; + gfc_unit *temp; temp = t->left; t->left = t->left->right; @@ -95,8 +95,8 @@ compare (int a, int b) /* insert()-- Recursive insertion function. Returns the updated treap. */ -static unit_t * -insert (unit_t * new, unit_t * t) +static gfc_unit * +insert (gfc_unit * new, gfc_unit * t) { int c; @@ -130,7 +130,7 @@ insert (unit_t * new, unit_t * t) * an error to insert a key that already exists. */ void -insert_unit (unit_t * new) +insert_unit (gfc_unit * new) { new->priority = pseudo_random (); @@ -138,10 +138,10 @@ insert_unit (unit_t * new) } -static unit_t * -delete_root (unit_t * t) +static gfc_unit * +delete_root (gfc_unit * t) { - unit_t *temp; + gfc_unit *temp; if (t->left == NULL) return t->right; @@ -168,8 +168,8 @@ delete_root (unit_t * t) * must just point to a treap structure with the key to be deleted. * Returns the new root node of the tree. */ -static unit_t * -delete_treap (unit_t * old, unit_t * t) +static gfc_unit * +delete_treap (gfc_unit * old, gfc_unit * t) { int c; @@ -192,7 +192,7 @@ delete_treap (unit_t * old, unit_t * t) /* delete_unit()-- Delete a unit from a tree */ static void -delete_unit (unit_t * old) +delete_unit (gfc_unit * old) { g.unit_root = delete_treap (old, g.unit_root); @@ -202,10 +202,10 @@ delete_unit (unit_t * old) /* find_unit()-- Given an integer, return a pointer to the unit * structure. Returns NULL if the unit does not exist. */ -unit_t * +gfc_unit * find_unit (int n) { - unit_t *p; + gfc_unit *p; int c; for (c = 0; c < CACHE_SIZE; c++) @@ -241,10 +241,10 @@ find_unit (int n) /* get_unit()-- Returns the unit structure associated with the integer * unit or the internal file. */ -unit_t * +gfc_unit * get_unit (int read_flag) { - unit_t *u; + gfc_unit *u; if (ioparm.internal_unit != NULL) { @@ -290,12 +290,12 @@ void init_units (void) { offset_t m, n; - unit_t *u; + gfc_unit *u; int i; if (options.stdin_unit >= 0) { /* STDIN */ - u = get_mem (sizeof (unit_t)); + u = get_mem (sizeof (gfc_unit)); u->unit_number = options.stdin_unit; u->s = input_stream (); @@ -316,7 +316,7 @@ init_units (void) if (options.stdout_unit >= 0) { /* STDOUT */ - u = get_mem (sizeof (unit_t)); + u = get_mem (sizeof (gfc_unit)); u->unit_number = options.stdout_unit; u->s = output_stream (); @@ -351,7 +351,7 @@ init_units (void) * associated with the stream is freed. Returns nonzero on I/O error. */ int -close_unit (unit_t * u) +close_unit (gfc_unit * u) { int i, rc; diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c index 185608aba33..3cefd2ab5e5 100644 --- a/libgfortran/io/unix.c +++ b/libgfortran/io/unix.c @@ -1112,11 +1112,11 @@ compare_file_filename (stream * s, const char *name, int len) /* find_file0()-- Recursive work function for find_file() */ -static unit_t * -find_file0 (unit_t * u, struct stat *st1) +static gfc_unit * +find_file0 (gfc_unit * u, struct stat *st1) { struct stat st2; - unit_t *v; + gfc_unit *v; if (u == NULL) return NULL; @@ -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 * that has the file already open. Returns a pointer to the unit if so. */ -unit_t * +gfc_unit * find_file (void) { char path[PATH_MAX + 1]; @@ -1194,7 +1194,7 @@ stream_at_eof (stream * s) * with the unit. Returns nonzero if something went wrong. */ int -delete_file (unit_t * u) +delete_file (gfc_unit * u) { char path[PATH_MAX + 1]; -- 2.30.2