summaryrefslogtreecommitdiff
path: root/libgfortran/io/io.h
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2008-11-22 08:10:41 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2008-11-22 08:10:41 +0000
commitb5d015e3eb036000e3aeb3c510b76a7b06cc7b4a (patch)
treefd3f39fc5493d036706217573269adc0cd79d272 /libgfortran/io/io.h
parentb07ff86b61d685482f617bd89d6bb672aa745962 (diff)
downloadgcc-b5d015e3eb036000e3aeb3c510b76a7b06cc7b4a.tar.gz
PR libfortran/37839
* trans-io.c (gfc_build_io_library_fndecls): Decrease pad size back to 16 pointers plus 32 integers. Don't use max integer kind alignment, only gfc_intio_kind's alignment. (gfc_trans_inquire): Only set flags2 if mask2 is non-zero. * ioparm.def: Fix order, bitmasks and types of inquire round, sign and pending fields. Move u in dt before id. * io.c (gfc_free_inquire): Free decimal and size exprs. (match_inquire_element): Match size instead of matching blank twice. (gfc_resolve_inquire): Resolve size. * gfortran.dg/f2003_inquire_1.f03: New test. * gfortran.dg/f2003_io_1.f03: Remove xfail. * gfortran.dg/f2003_io_4.f03: Likewise. * gfortran.dg/f2003_io_5.f03: Likewise. * gfortran.dg/f2003_io_6.f03: Likewise. * gfortran.dg/f2003_io_7.f03: Likewise. * io/io.h (IOPARM_INQUIRE_HAS_ROUND, IOPARM_INQUIRE_HAS_SIGN, IOPARM_INQUIRE_HAS_PENDING): Adjust values. (st_parameter_inquire): Reorder and fix types of round, sign and pending fields. (st_parameter_43, st_parameter_44): Removed. (st_parameter_dt): Put back struct definition directly to u.p declaration. Change type of u.p.size_used from gfc_offset to GFC_IO_INT. Decrease back size of u.pad to 16 pointers and 32 ints. Put id, pos, asynchronous, blank, decimal, delim, pad, round and sign fields after the union. * io/inquire.c (inquire_via_unit, inquire_via_filename): Only read flags2 if it is defined. * io/transfer.c (read_sf, read_block_form, write_block): Cast additions to size_used to GFC_IO_INT instead of gfc_offset. (data_transfer_init): Clear whole u.p struct. Adjust for moving id, pos, asynchronous, blank, decimal, delim, pad, round and sign fields from u.p directly into st_parameter_dt. (finalize_transfer): Don't cast size_used to GFC_IO_INT. * io/file_pos.c (st_endfile): Clear whole u.p struct. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@142111 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/io/io.h')
-rw-r--r--libgfortran/io/io.h268
1 files changed, 93 insertions, 175 deletions
diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h
index ec37be37a81..1f363914866 100644
--- a/libgfortran/io/io.h
+++ b/libgfortran/io/io.h
@@ -310,9 +310,9 @@ st_parameter_filepos;
#define IOPARM_INQUIRE_HAS_ASYNCHRONOUS (1 << 0)
#define IOPARM_INQUIRE_HAS_DECIMAL (1 << 1)
#define IOPARM_INQUIRE_HAS_ENCODING (1 << 2)
-#define IOPARM_INQUIRE_HAS_PENDING (1 << 3)
-#define IOPARM_INQUIRE_HAS_ROUND (1 << 4)
-#define IOPARM_INQUIRE_HAS_SIGN (1 << 5)
+#define IOPARM_INQUIRE_HAS_ROUND (1 << 3)
+#define IOPARM_INQUIRE_HAS_SIGN (1 << 4)
+#define IOPARM_INQUIRE_HAS_PENDING (1 << 5)
#define IOPARM_INQUIRE_HAS_SIZE (1 << 6)
#define IOPARM_INQUIRE_HAS_ID (1 << 7)
@@ -343,9 +343,9 @@ typedef struct
CHARACTER1 (asynchronous);
CHARACTER2 (decimal);
CHARACTER1 (encoding);
- CHARACTER2 (pending);
- CHARACTER1 (round);
- CHARACTER2 (sign);
+ CHARACTER2 (round);
+ CHARACTER1 (sign);
+ GFC_INTEGER_4 *pending;
GFC_INTEGER_4 *size;
GFC_INTEGER_4 *id;
}
@@ -377,172 +377,6 @@ struct format_data;
#define IOPARM_DT_IONML_SET (1 << 31)
-typedef struct st_parameter_43
-{
- void (*transfer) (struct st_parameter_dt *, bt, void *, int,
- size_t, size_t);
- struct gfc_unit *current_unit;
- /* Item number in a formatted data transfer. Also used in namelist
- read_logical as an index into line_buffer. */
- int item_count;
- unit_mode mode;
- unit_blank blank_status;
- unit_sign sign_status;
- int scale_factor;
- int max_pos; /* Maximum righthand column written to. */
- /* Number of skips + spaces to be done for T and X-editing. */
- int skips;
- /* Number of spaces to be done for T and X-editing. */
- int pending_spaces;
- /* Whether an EOR condition was encountered. Value is:
- 0 if no EOR was encountered
- 1 if an EOR was encountered due to a 1-byte marker (LF)
- 2 if an EOR was encountered due to a 2-bytes marker (CRLF) */
- int sf_seen_eor;
- unit_advance advance_status;
- unsigned reversion_flag : 1; /* Format reversion has occurred. */
- unsigned first_item : 1;
- unsigned seen_dollar : 1;
- unsigned eor_condition : 1;
- unsigned no_leading_blank : 1;
- unsigned char_flag : 1;
- unsigned input_complete : 1;
- unsigned at_eol : 1;
- unsigned comma_flag : 1;
- /* A namelist specific flag used in the list directed library
- to flag that calls are being made from namelist read (eg. to
- ignore comments or to treat '/' as a terminator) */
- unsigned namelist_mode : 1;
- /* A namelist specific flag used in the list directed library
- to flag read errors and return, so that an attempt can be
- made to read a new object name. */
- unsigned nml_read_error : 1;
- /* A sequential formatted read specific flag used to signal that a
- character string is being read so don't use commas to shorten a
- formatted field width. */
- unsigned sf_read_comma : 1;
- /* A namelist specific flag used to enable reading input from
- line_buffer for logical reads. */
- unsigned line_buffer_enabled : 1;
- /* An internal unit specific flag used to identify that the associated
- unit is internal. */
- unsigned unit_is_internal : 1;
- /* An internal unit specific flag to signify an EOF condition for list
- directed read. */
- unsigned at_eof : 1;
- /* 16 unused bits. */
-
- char last_char;
- char nml_delim;
-
- int repeat_count;
- int saved_length;
- int saved_used;
- bt saved_type;
- char *saved_string;
- char *scratch;
- char *line_buffer;
- struct format_data *fmt;
- jmp_buf *eof_jump;
- namelist_info *ionml;
- /* A flag used to identify when a non-standard expanded namelist read
- has occurred. */
- int expanded_read;
- /* Storage area for values except for strings. Must be large
- enough to hold a complex value (two reals) of the largest
- kind. */
- char value[32];
- gfc_offset size_used;
-} st_parameter_43;
-
-
-typedef struct st_parameter_44
-{
- GFC_INTEGER_4 *id;
- GFC_IO_INT pos;
- CHARACTER1 (asynchronous);
- CHARACTER2 (blank);
- CHARACTER1 (decimal);
- CHARACTER2 (delim);
- CHARACTER1 (pad);
- CHARACTER2 (round);
- CHARACTER1 (sign);
- void (*transfer) (struct st_parameter_dt *, bt, void *, int,
- size_t, size_t);
- struct gfc_unit *current_unit;
- /* Item number in a formatted data transfer. Also used in namelist
- read_logical as an index into line_buffer. */
- int item_count;
- unit_mode mode;
- unit_blank blank_status;
- unit_sign sign_status;
- int scale_factor;
- int max_pos; /* Maximum righthand column written to. */
- /* Number of skips + spaces to be done for T and X-editing. */
- int skips;
- /* Number of spaces to be done for T and X-editing. */
- int pending_spaces;
- /* Whether an EOR condition was encountered. Value is:
- 0 if no EOR was encountered
- 1 if an EOR was encountered due to a 1-byte marker (LF)
- 2 if an EOR was encountered due to a 2-bytes marker (CRLF) */
- int sf_seen_eor;
- unit_advance advance_status;
- unsigned reversion_flag : 1; /* Format reversion has occurred. */
- unsigned first_item : 1;
- unsigned seen_dollar : 1;
- unsigned eor_condition : 1;
- unsigned no_leading_blank : 1;
- unsigned char_flag : 1;
- unsigned input_complete : 1;
- unsigned at_eol : 1;
- unsigned comma_flag : 1;
- /* A namelist specific flag used in the list directed library
- to flag that calls are being made from namelist read (eg. to
- ignore comments or to treat '/' as a terminator) */
- unsigned namelist_mode : 1;
- /* A namelist specific flag used in the list directed library
- to flag read errors and return, so that an attempt can be
- made to read a new object name. */
- unsigned nml_read_error : 1;
- /* A sequential formatted read specific flag used to signal that a
- character string is being read so don't use commas to shorten a
- formatted field width. */
- unsigned sf_read_comma : 1;
- /* A namelist specific flag used to enable reading input from
- line_buffer for logical reads. */
- unsigned line_buffer_enabled : 1;
- /* An internal unit specific flag used to identify that the associated
- unit is internal. */
- unsigned unit_is_internal : 1;
- /* An internal unit specific flag to signify an EOF condition for list
- directed read. */
- unsigned at_eof : 1;
- /* 16 unused bits. */
-
- char last_char;
- char nml_delim;
-
- int repeat_count;
- int saved_length;
- int saved_used;
- bt saved_type;
- char *saved_string;
- char *scratch;
- char *line_buffer;
- struct format_data *fmt;
- jmp_buf *eof_jump;
- namelist_info *ionml;
- /* A flag used to identify when a non-standard expanded namelist read
- has occurred. */
- int expanded_read;
- /* Storage area for values except for strings. Must be large
- enough to hold a complex value (two reals) of the largest
- kind. */
- char value[32];
- gfc_offset size_used;
-} st_parameter_44;
-
typedef struct st_parameter_dt
{
st_parameter_common common;
@@ -557,13 +391,97 @@ typedef struct st_parameter_dt
to reserve enough space. */
union
{
- st_parameter_43 q;
- st_parameter_44 p;
+ struct
+ {
+ void (*transfer) (struct st_parameter_dt *, bt, void *, int,
+ size_t, size_t);
+ struct gfc_unit *current_unit;
+ /* Item number in a formatted data transfer. Also used in namelist
+ read_logical as an index into line_buffer. */
+ int item_count;
+ unit_mode mode;
+ unit_blank blank_status;
+ unit_sign sign_status;
+ int scale_factor;
+ int max_pos; /* Maximum righthand column written to. */
+ /* Number of skips + spaces to be done for T and X-editing. */
+ int skips;
+ /* Number of spaces to be done for T and X-editing. */
+ int pending_spaces;
+ /* Whether an EOR condition was encountered. Value is:
+ 0 if no EOR was encountered
+ 1 if an EOR was encountered due to a 1-byte marker (LF)
+ 2 if an EOR was encountered due to a 2-bytes marker (CRLF) */
+ int sf_seen_eor;
+ unit_advance advance_status;
+ unsigned reversion_flag : 1; /* Format reversion has occurred. */
+ unsigned first_item : 1;
+ unsigned seen_dollar : 1;
+ unsigned eor_condition : 1;
+ unsigned no_leading_blank : 1;
+ unsigned char_flag : 1;
+ unsigned input_complete : 1;
+ unsigned at_eol : 1;
+ unsigned comma_flag : 1;
+ /* A namelist specific flag used in the list directed library
+ to flag that calls are being made from namelist read (eg. to
+ ignore comments or to treat '/' as a terminator) */
+ unsigned namelist_mode : 1;
+ /* A namelist specific flag used in the list directed library
+ to flag read errors and return, so that an attempt can be
+ made to read a new object name. */
+ unsigned nml_read_error : 1;
+ /* A sequential formatted read specific flag used to signal that a
+ character string is being read so don't use commas to shorten a
+ formatted field width. */
+ unsigned sf_read_comma : 1;
+ /* A namelist specific flag used to enable reading input from
+ line_buffer for logical reads. */
+ unsigned line_buffer_enabled : 1;
+ /* An internal unit specific flag used to identify that the associated
+ unit is internal. */
+ unsigned unit_is_internal : 1;
+ /* An internal unit specific flag to signify an EOF condition for list
+ directed read. */
+ unsigned at_eof : 1;
+ /* 16 unused bits. */
+
+ char last_char;
+ char nml_delim;
+
+ int repeat_count;
+ int saved_length;
+ int saved_used;
+ bt saved_type;
+ char *saved_string;
+ char *scratch;
+ char *line_buffer;
+ struct format_data *fmt;
+ jmp_buf *eof_jump;
+ namelist_info *ionml;
+ /* A flag used to identify when a non-standard expanded namelist read
+ has occurred. */
+ int expanded_read;
+ /* Storage area for values except for strings. Must be large
+ enough to hold a complex value (two reals) of the largest
+ kind. */
+ char value[32];
+ GFC_IO_INT size_used;
+ } p;
/* This pad size must be equal to the pad_size declared in
trans-io.c (gfc_build_io_library_fndecls). The above structure
must be smaller or equal to this array. */
- char pad[32 * sizeof (char *) + 32 * sizeof (int)];
+ char pad[16 * sizeof (char *) + 32 * sizeof (int)];
} u;
+ GFC_INTEGER_4 *id;
+ GFC_IO_INT pos;
+ CHARACTER1 (asynchronous);
+ CHARACTER2 (blank);
+ CHARACTER1 (decimal);
+ CHARACTER2 (delim);
+ CHARACTER1 (pad);
+ CHARACTER2 (round);
+ CHARACTER1 (sign);
}
st_parameter_dt;