diff options
| author | Thomas Koenig <Thomas.Koenig@online.de> | 2005-12-10 20:01:56 +0000 |
|---|---|---|
| committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2005-12-10 20:01:56 +0000 |
| commit | 181c9f4a9ba6b2d64c7c0b56b777ad366e05a9c1 (patch) | |
| tree | a3d754eebe0bc2166ffe8c241b2d9dfdd1098340 /libgfortran/io/io.h | |
| parent | 775fe6e36ddaef38cca67c39bf34b93fcb836dc3 (diff) | |
| download | gcc-181c9f4a9ba6b2d64c7c0b56b777ad366e05a9c1.zip gcc-181c9f4a9ba6b2d64c7c0b56b777ad366e05a9c1.tar.gz gcc-181c9f4a9ba6b2d64c7c0b56b777ad366e05a9c1.tar.bz2 | |
re PR fortran/23815 (Add -byteswapio flag)
2005-12-10 Thomas Koenig <Thomas.Koenig@online.de>
PR fortran/23815
* io.c (top level): Add convert to io_tag.
(resolve_tag): convert is GFC_STD_GNU.
(match_open_element): Add convert.
(gfc_free_open): Likewise.
(gfc_resolve_open): Likewise.
(gfc_free_inquire): Likewise.
(match_inquire_element): Likewise.
* dump-parse-tree.c (gfc_show_code_node): Add
convet for open and inquire.
gfortran.h: Add convert to gfc_open and gfc_inquire.
* trans-io.c (gfc_trans_open): Add convert.
(gfc_trans_inquire): Likewise.
* ioparm.def: Add convert to open and inquire.
* gfortran.texi: Document CONVERT.
2005-12-10 Thomas Koenig <Thomas.Koenig@online.de>
PR fortran/23815
* io/file_pos.c (unformatted_backspace): If flags.convert
does not equal CONVERT_NATIVE, reverse the record marker.
* io/open.c: Add convert_opt[].
(st_open): If no convert option is given, set CONVERT_NATIVE.
If CONVERT_BIG or CONVERT_LITTLE are given, set flags.convert to
CONVERT_NATIVE or CONVERT_SWAP (depending on wether we have
a big- or little-endian system).
* io/transfer.c (unformatted_read): Remove unused attribute
from arguments.
If we need to reverse
bytes, break up large transfers into a loop. Split complex
numbers into its two parts.
(unformatted_write): Likewise.
(us_read): If flags.convert does not equal CONVERT_NATIVE,
reverse the record marker.
(next_record_w): Likewise.
(reverse_memcpy): New function.
* io/inquire.c (inquire_via_unit): Implement convert.
* io/io.h (top level): Add enum unit_convert.
Add convert to st_parameter_open and st_parameter_inquire.
Define IOPARM_OPEN_HAS_CONVERT and IOPARM_INQUIRE_HAS_CONVERT.
Increase padding for st_parameter_dt.
Declare reverse_memcpy().
2005-12-10 Thomas Koenig <Thomas.Koenig@online.de>
PR fortran/23815
* gfortran.dg/unf_io_convert_1.f90: New test.
* gfortran.dg/unf_io_convert_2.f90: New test.
* gfortran.dg/unf_io_convert_3.f90: New test.
From-SVN: r108358
Diffstat (limited to 'libgfortran/io/io.h')
| -rw-r--r-- | libgfortran/io/io.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h index e7b0ac1..e364171 100644 --- a/libgfortran/io/io.h +++ b/libgfortran/io/io.h @@ -206,6 +206,10 @@ typedef enum {READING, WRITING} unit_mode; +typedef enum +{ CONVERT_NATIVE, CONVERT_SWAP, CONVERT_BIG, CONVERT_LITTLE } +unit_convert; + #define CHARACTER1(name) \ char * name; \ gfc_charlen_type name ## _len @@ -247,6 +251,7 @@ st_parameter_common; #define IOPARM_OPEN_HAS_ACTION (1 << 14) #define IOPARM_OPEN_HAS_DELIM (1 << 15) #define IOPARM_OPEN_HAS_PAD (1 << 16) +#define IOPARM_OPEN_HAS_CONVERT (1 << 17) typedef struct { @@ -261,6 +266,7 @@ typedef struct CHARACTER2 (action); CHARACTER1 (delim); CHARACTER2 (pad); + CHARACTER1 (convert); } st_parameter_open; @@ -301,6 +307,7 @@ st_parameter_filepos; #define IOPARM_INQUIRE_HAS_READ (1 << 26) #define IOPARM_INQUIRE_HAS_WRITE (1 << 27) #define IOPARM_INQUIRE_HAS_READWRITE (1 << 28) +#define IOPARM_INQUIRE_HAS_CONVERT (1 << 29) typedef struct { @@ -323,6 +330,7 @@ typedef struct CHARACTER2 (read); CHARACTER1 (write); CHARACTER2 (readwrite); + CHARACTER1 (convert); } st_parameter_inquire; @@ -419,7 +427,7 @@ typedef struct st_parameter_dt kind. */ char value[32]; } p; - char pad[16 * sizeof (char *) + 32 * sizeof (int)]; + char pad[16 * sizeof (char *) + 34 * sizeof (int)]; } u; } st_parameter_dt; @@ -438,6 +446,7 @@ typedef struct unit_position position; unit_status status; unit_pad pad; + unit_convert convert; } unit_flags; @@ -738,6 +747,9 @@ internal_proto(init_loop_spec); extern void next_record (st_parameter_dt *, int); internal_proto(next_record); +extern void reverse_memcpy (void *, const void *, size_t); +internal_proto (reverse_memcpy); + /* read.c */ extern void set_integer (void *, GFC_INTEGER_LARGEST, int); |
