[RFC] fseek, an alternative implementation (PR22359)
Daniel Franke
franke.daniel@gmail.com
Sun Apr 29 21:44:00 GMT 2007
While working on the docs last week, I learned, that the FSEEK intrinsic is
not implemented yet.
The FSEEK implementation of g77 takes a statement label to jump to, if an
error occurs. Since there is no other intrinsic that takes a statement label,
considerable effort would be necessary to implement the framework needed. As
demand is low (one PR, no dupes, no usage of FSEEK shown by google-code
search), it might be worthwile to implement the FSEEK intrinsic for
completeness and replace the statement label by a status flag:
g77: CALL FSEEK(unit, offset, whence, *100)
gfortran: CALL FSEEK(unit, offset, whence, status)
IF (status /= 0) goto 100
This is not 100% compability, but reasonable close.
Please find a preliminary patch that implements FSEEK using a status flag
attached. Of course, this implementation (still) has the same problems with
casting/assigning of the status flag as the other intrinsics.
gcc/fortran:
* intrinsic.c (add_subroutines): Added FSEEK.
* intrinsic.h (gfc_resolve_fseek_sub, gfc_check_fseek_sub): New.
* iresolve.c (gfc_resolve_fseek_sub): New.
* check.c (gfc_check_fseek_sub): New.
* intrinsic.texi (FSEEK): Updated.
libgfortran:
* io/intrinsics.c (fseek_i[1248]_sub): New.
* gfortran.map (fseek_i[1248]_sub): New.
Comments are highly welcome :)
Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fseek.patch
Type: text/x-diff
Size: 8605 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070429/42cd2709/attachment.bin>
More information about the Fortran
mailing list