Commit 7fcb1804 by Tobias Schlüter

io.h, [...]: Fix formatting issues, update copyright years.

* io/io.h, io/list_read.c, io/open.c, io/transfer.c, io/write.c:
Fix formatting issues, update copyright years.

From-SVN: r86425
parent b3d1f5b4
/* Copyright (C) 2002-2003 Free Software Foundation, Inc. /* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
Contributed by Andy Vaught Contributed by Andy Vaught
This file is part of the GNU Fortran 95 runtime library (libgfortran). This file is part of the GNU Fortran 95 runtime library (libgfortran).
......
/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
/* Copyright (C) 2002-2003 Free Software Foundation, Inc.
Contributed by Andy Vaught Contributed by Andy Vaught
This file is part of the GNU Fortran 95 runtime library (libgfortran). This file is part of the GNU Fortran 95 runtime library (libgfortran).
...@@ -134,10 +133,10 @@ static st_option access_opt[] = { ...@@ -134,10 +133,10 @@ static st_option access_opt[] = {
}; };
/* test_endfile()-- Given a unit, test to see if the file is /* Given a unit, test to see if the file is positioned at the terminal
* positioned at the terminal point, and if so, change state from point, and if so, change state from NO_ENDFILE flag to AT_ENDFILE.
* NO_ENDFILE flag to AT_ENDFILE. This prevents us from changing the This prevents us from changing the state from AFTER_ENDFILE to
* state from AFTER_ENDFILE to AT_ENDFILE. */ AT_ENDFILE. */
void void
test_endfile (gfc_unit * u) test_endfile (gfc_unit * u)
...@@ -148,14 +147,14 @@ test_endfile (gfc_unit * u) ...@@ -148,14 +147,14 @@ test_endfile (gfc_unit * u)
} }
/* edit_modes()-- Change the modes of a file, those that are allowed /* Change the modes of a file, those that are allowed * to be
* to be changed. */ changed. */
static void static void
edit_modes (gfc_unit * 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. */
if (flags->status != STATUS_UNSPECIFIED && if (flags->status != STATUS_UNSPECIFIED &&
u->flags.status != flags->position) u->flags.status != flags->position)
...@@ -178,7 +177,7 @@ edit_modes (gfc_unit * u, unit_flags * flags) ...@@ -178,7 +177,7 @@ edit_modes (gfc_unit * u, unit_flags * flags)
generate_error (ERROR_BAD_OPTION, generate_error (ERROR_BAD_OPTION,
"Cannot change ACTION parameter in OPEN statement"); "Cannot change ACTION parameter in OPEN statement");
/* Status must be OLD if present */ /* Status must be OLD if present. */
if (flags->status != STATUS_UNSPECIFIED && flags->status != STATUS_OLD) if (flags->status != STATUS_UNSPECIFIED && flags->status != STATUS_OLD)
generate_error (ERROR_BAD_OPTION, generate_error (ERROR_BAD_OPTION,
...@@ -203,7 +202,8 @@ edit_modes (gfc_unit * u, unit_flags * flags) ...@@ -203,7 +202,8 @@ edit_modes (gfc_unit * u, unit_flags * flags)
} }
if (ioparm.library_return == LIBRARY_OK) if (ioparm.library_return == LIBRARY_OK)
{ /* Change the changeable */ {
/* Change the changeable: */
if (flags->blank != BLANK_UNSPECIFIED) if (flags->blank != BLANK_UNSPECIFIED)
u->flags.blank = flags->blank; u->flags.blank = flags->blank;
if (flags->delim != DELIM_UNSPECIFIED) if (flags->delim != DELIM_UNSPECIFIED)
...@@ -212,7 +212,7 @@ edit_modes (gfc_unit * u, unit_flags * flags) ...@@ -212,7 +212,7 @@ edit_modes (gfc_unit * u, unit_flags * flags)
u->flags.pad = flags->pad; u->flags.pad = flags->pad;
} }
/* Reposition the file if necessary. */ /* Reposition the file if necessary. */
switch (flags->position) switch (flags->position)
{ {
...@@ -227,7 +227,7 @@ edit_modes (gfc_unit * u, unit_flags * flags) ...@@ -227,7 +227,7 @@ edit_modes (gfc_unit * u, unit_flags * flags)
u->current_record = 0; u->current_record = 0;
u->last_record = 0; u->last_record = 0;
test_endfile (u); /* We might be at the end */ test_endfile (u); /* We might be at the end. */
break; break;
case POSITION_APPEND: case POSITION_APPEND:
...@@ -235,7 +235,7 @@ edit_modes (gfc_unit * u, unit_flags * flags) ...@@ -235,7 +235,7 @@ edit_modes (gfc_unit * u, unit_flags * flags)
goto seek_error; goto seek_error;
u->current_record = 0; u->current_record = 0;
u->endfile = AT_ENDFILE; /* We are at the end */ u->endfile = AT_ENDFILE; /* We are at the end. */
break; break;
seek_error: seek_error:
...@@ -245,7 +245,7 @@ edit_modes (gfc_unit * u, unit_flags * flags) ...@@ -245,7 +245,7 @@ edit_modes (gfc_unit * u, unit_flags * flags)
} }
/* new_unit()-- Open an unused unit */ /* Open an unused unit. */
void void
new_unit (unit_flags * flags) new_unit (unit_flags * flags)
...@@ -254,13 +254,13 @@ new_unit (unit_flags * flags) ...@@ -254,13 +254,13 @@ new_unit (unit_flags * flags)
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 */];
/* Change unspecifieds to defaults */ /* Change unspecifieds to defaults. */
if (flags->access == ACCESS_UNSPECIFIED) if (flags->access == ACCESS_UNSPECIFIED)
flags->access = ACCESS_SEQUENTIAL; flags->access = ACCESS_SEQUENTIAL;
if (flags->action == ACTION_UNSPECIFIED) if (flags->action == ACTION_UNSPECIFIED)
flags->action = ACTION_READWRITE; /* Processor dependent */ flags->action = ACTION_READWRITE; /* Processor dependent. */
if (flags->form == FORM_UNSPECIFIED) if (flags->form == FORM_UNSPECIFIED)
flags->form = (flags->access == ACCESS_SEQUENTIAL) flags->form = (flags->access == ACCESS_SEQUENTIAL)
...@@ -321,7 +321,7 @@ new_unit (unit_flags * flags) ...@@ -321,7 +321,7 @@ new_unit (unit_flags * flags)
if (flags->status == STATUS_UNSPECIFIED) if (flags->status == STATUS_UNSPECIFIED)
flags->status = STATUS_UNKNOWN; flags->status = STATUS_UNKNOWN;
/* Checks */ /* Checks. */
if (flags->access == ACCESS_DIRECT && ioparm.recl_in == 0) if (flags->access == ACCESS_DIRECT && ioparm.recl_in == 0)
{ {
...@@ -362,7 +362,7 @@ new_unit (unit_flags * flags) ...@@ -362,7 +362,7 @@ new_unit (unit_flags * flags)
internal_error ("new_unit(): Bad status"); internal_error ("new_unit(): Bad status");
} }
/* Make sure the file isn't already open someplace else */ /* Make sure the file isn't already open someplace else. */
if (find_file () != NULL) if (find_file () != NULL)
{ {
...@@ -370,7 +370,7 @@ new_unit (unit_flags * flags) ...@@ -370,7 +370,7 @@ new_unit (unit_flags * flags)
goto cleanup; goto cleanup;
} }
/* Open file */ /* Open file. */
s = open_external (flags->action, flags->status); s = open_external (flags->action, flags->status);
if (s == NULL) if (s == NULL)
...@@ -382,7 +382,7 @@ new_unit (unit_flags * flags) ...@@ -382,7 +382,7 @@ new_unit (unit_flags * flags)
if (flags->status == STATUS_NEW || flags->status == STATUS_REPLACE) if (flags->status == STATUS_NEW || flags->status == STATUS_REPLACE)
flags->status = STATUS_OLD; flags->status = STATUS_OLD;
/* Create the unit structure */ /* Create the unit structure. */
u = get_mem (sizeof (gfc_unit) + ioparm.file_len); u = get_mem (sizeof (gfc_unit) + ioparm.file_len);
...@@ -390,15 +390,15 @@ new_unit (unit_flags * flags) ...@@ -390,15 +390,15 @@ new_unit (unit_flags * flags)
u->s = s; u->s = s;
u->flags = *flags; u->flags = *flags;
/* Unspecified recl ends up with a processor dependent value */ /* Unspecified recl ends up with a processor dependent value. */
u->recl = (ioparm.recl_in != 0) ? ioparm.recl_in : DEFAULT_RECL; u->recl = (ioparm.recl_in != 0) ? ioparm.recl_in : DEFAULT_RECL;
u->last_record = 0; u->last_record = 0;
u->current_record = 0; u->current_record = 0;
/* If the file is direct access, calculate the maximum record number /* If the file is direct access, calculate the maximum record number
* via a division now instead of letting the multiplication overflow via a division now instead of letting the multiplication overflow
* later. */ later. */
if (flags->access == ACCESS_DIRECT) if (flags->access == ACCESS_DIRECT)
u->maxrec = g.max_offset / u->recl; u->maxrec = g.max_offset / u->recl;
...@@ -409,25 +409,24 @@ new_unit (unit_flags * flags) ...@@ -409,25 +409,24 @@ new_unit (unit_flags * flags)
insert_unit (u); insert_unit (u);
/* The file is now connected. Errors after this point leave the /* The file is now connected. Errors after this point leave the
* file connected. Curiously, the standard requires that the file connected. Curiously, the standard requires that the
* position specifier be ignored for new files so a newly connected position specifier be ignored for new files so a newly connected
* file starts out that the initial point. We still need to figure file starts out that the initial point. We still need to figure
* out if the file is at the end or not. */ out if the file is at the end or not. */
test_endfile (u); test_endfile (u);
cleanup: cleanup:
/* Free memory associated with a temporary filename */ /* Free memory associated with a temporary filename. */
if (flags->status == STATUS_SCRATCH) if (flags->status == STATUS_SCRATCH)
free_mem (ioparm.file); free_mem (ioparm.file);
} }
/* already_open()-- Open a unit which is already open. This involves /* Open a unit which is already open. This involves changing the
* changing the modes or closing what is there now and opening the new modes or closing what is there now and opening the new file. */
* file. */
static void static void
already_open (gfc_unit * u, unit_flags * flags) already_open (gfc_unit * u, unit_flags * flags)
...@@ -440,7 +439,7 @@ already_open (gfc_unit * u, unit_flags * flags) ...@@ -440,7 +439,7 @@ already_open (gfc_unit * u, unit_flags * flags)
} }
/* If the file is connected to something else, close it and open a /* If the file is connected to something else, close it and open a
* new unit */ new unit. */
if (!compare_file_filename (u->s, ioparm.file, ioparm.file_len)) if (!compare_file_filename (u->s, ioparm.file, ioparm.file_len))
{ {
...@@ -458,8 +457,7 @@ already_open (gfc_unit * u, unit_flags * flags) ...@@ -458,8 +457,7 @@ already_open (gfc_unit * u, unit_flags * flags)
} }
/*************/ /* Open file. */
/* open file */
void void
st_open (void) st_open (void)
...@@ -469,7 +467,7 @@ st_open (void) ...@@ -469,7 +467,7 @@ st_open (void)
library_start (); library_start ();
/* Decode options */ /* Decode options. */
flags.access = (ioparm.access == NULL) ? ACCESS_UNSPECIFIED : flags.access = (ioparm.access == NULL) ? ACCESS_UNSPECIFIED :
find_option (ioparm.access, ioparm.access_len, access_opt, find_option (ioparm.access, ioparm.access_len, access_opt,
......
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