Commit Graph

92 Commits

Author SHA1 Message Date
Jerry DeLisle 50220190d2 re PR fortran/38398 (g0.w edit descriptor: Update for F2008 Tokyo meeting changes)
2008-12-21  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/38398
	* io/io.h (st_parameter_dt): Add new bit to keep track of when to
	suppress blanks for g0 formatting.
	* io/transfer.c (formatted_transfer_scalar): Always call write_real_g0
	for g0 formatting.
	* io.c (write.c): Do not use ES formatting and use new bit to suppress
	blanks.
	* io/write_float.def (output_float): Adjust the location of setting the
	width so that it can be adjusted when suppressing blanks.  Set number of
	blanks to zero when dtp->u.p.g0_no_blanks is set. Do some minor code
	clean-up and add some white space for readability.

From-SVN: r142871
2008-12-21 21:23:52 +00:00
Jakub Jelinek e14568432a re PR libfortran/37839 (st_parameter_dt has unwanted padding, is out of sync with compiler)
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.

From-SVN: r142111
2008-11-22 09:10:41 +01:00
Jerry DeLisle 80ad19715e re PR fortran/37863 (Display of a value close but less to 1 shows 2 with '(F3.0)')
2008-10-17  Jerry DeLisle  <jvdelisle@gcc.gnu.org

	PR libfortran/37707
	* io/write_float.def (WRITE_FLOAT): Round to 1.0 correctly.
	* io/io.h (st_parameter_44): Fix id type declaration.

From-SVN: r141207
2008-10-18 05:23:47 +00:00
Jerry DeLisle 105b713696 re PR fortran/37498 (Incorrect array value returned - 4.3 ABI Broken)
2008-09-25  Jerry DeLisle  <jvdelisle@gcc.gnu.org

	PR libfortran/37498
	* list_read.c (eat_separator): Revert previous patch and move
	delim_status, decimal_status, and pad_status to gfc_unit.
	(parse_real): Ditto. (read_real): Ditto.
	* read.c (read_a): Likewise. (read_a_char4): Likewise.
	(read_f): Likewise.
	* inquire.c (inquire_via_unit): Add missing check for
	IOPARM_INQUIRE_HAS_FLAGS2. (inquire_via_filename): Likewise.
	* io.h (unit_sign_s): Move delim_status, decimal_status, and pad_status
	to gfc_unit.
	* transfer.c (read_sf): Ditto. (read_block_form): Ditto.
	(formatted_transfer_scalar): Ditto. (data_transfer_init): Ditto.
	* write.c (write_default_char4): Ditto. (write_utf8_char4): Ditto.
	(write_character): Ditto. (write_real_g0): Ditto.
	(list_formatted_write_scalar): Ditto. (nml_write_obj): Ditto.
	(namelist_write): Ditto.
	* write_float.def (calculate_sign): Ditto. (output_float): Ditto.

From-SVN: r140684
2008-09-26 06:19:42 +00:00
Jerry DeLisle d7445152be re PR fortran/37498 (Incorrect array value returned - 4.3 ABI Broken)
2008-09-22  Jerry DeLisle  <jvdelisle@gcc.gnu.org

	PR fortran/37498
	* trans-io.c (gfc_build_io_library_fndecls): Bump pad size.
	(build_dt): Set mask bit for IOPARM_dt_f2003.
	* ioparm.def: Add IOPARM_dt_f2003.

2008-09-22  Jerry DeLisle  <jvdelisle@gcc.gnu.org

	PR libfortran/37498
	* file_pos (st_endfile): Clear memory only for libfortran 4.3 private
	area.
	* list_read.c (eat_separator): Only access F2003 I/O parameters if
	IOPARM_DT_HAS_F2003 bit is set. (parse_real): Ditto.
	(read_real): Ditto.
	* read.c (read_a): Likewise. (read_a_char4): Likewise though not
	strictly necessary. (read_f): Likewise.
	* io.h (unit_sign_s): New enumerator to allow duplication of
	st_parameter structures. (IOPARM_DT_HAS_F2003): New mask bit.
	(st_parameter_43): New structure copied from 4.3 version of 
	st_paramater_dt private section. (st_parameter_44): New structure with
	F2003 items added. (st_parameter_dt): Modified to create union of new
	and old structures to allow correct memory setting for 4.3 ABI
	compatibility. Bumped the pad size.
	* transfer.c (read_sf): Do not use F2003 I/O memory areas unless
	IOPARM_DT_HAS_F2003 bit has been set. (read_block_form): Ditto.
	(formatted_transfer_scalar): Ditto. (data_transfer_init): Ditto and
	add comment, fix formatting.
	* write.c (write_default_char4): Likewise though not strictly necessary.
	(write_utf8_char4): Ditto. (write_character): Ditto.
	(write_real_g0): Ditto. (list_formatted_write_scalar): Ditto.
	(nml_write_obj): Ditto. (namelist_write): Ditto.
	* write_float.def (calculate_sign): Eliminate warning by including all
	cases in switch. (output_float): Output only decimal point of F2003 flag
	is not set.

From-SVN: r140576
2008-09-23 03:52:19 +00:00
Jerry DeLisle 900e887f6d re PR fortran/37228 (F2008: Support g0.<d> edit descriptor)
2008-09-01  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/37228
	* io.c (check_format): Allow specifying precision with g0 format.

2008-09-01  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/37301
	PR libfortran/37228
	* io/io.h (write_real_g0): Declare new function to handle g0.d format.
	* io/transfer.c (formatted_transfer_scalar): Use new function.
	* io/format.c (parse_format_list): Enable g0.d.
	* io/write.c (write_a_char4): Delete unused var.
	(set_fnode_default): New function to set the default fnode w, d, and e
	factored from write_real. (write_real): Use new factored function.
	(write_real_g0): New function that sets d to that passed by g0.d format
	specifier and set format to ES.  Default values for w and e are used
	from the new function, set_fnode_default.

2008-09-01  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/37228
	* gfortran.dg/fmt_g0_4.f08: Revised test.

From-SVN: r139886
2008-09-02 10:50:13 +02:00
Jerry DeLisle cea93abbe2 re PR libfortran/35863 ([F2003] Implement ENCODING="UTF-8")
2008-06-13  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/35863
	* libgfortran.h: Change l8_to_l4_offset to big_endian and add endian_off.
	* runtime/main.c: Fix error in comment. Change l8_to_l4_offset to
	big_endian. (determine_endianness): Add endian_off and set its value
	according to big_endian.
	* gfortran.map: Add symbol for new _gfortran_transfer_character_wide.
	* io/io.h: Add prototype declarations for new functions.
	* io/list_read.c (list_formatted_read_scalar): Modify to handle kind=4.
	(list_formatted_read): Calculate stride based on kind for character type
	and use it when calling list_formatted_read_scalar.
	* io/inquire.c (inquire_via_unit): Change l8_to_l4_offset to big_endian.
	* io/open.c (st_open): Change l8_to_l4_offset to big_endian.
	* io/read.c (read_a_char4): New function to handle formatted read.
	* io/write.c: Define GFC_CHAR4(x) to improve readability of code.
	(write_a_char4): New function to handle formatted write.
	(write_character): Modify to accept the kind parameter and adjust for
	endianess of the machine. (list_formatted_write): Calculate the stride
	resulting from the kind and adjust the list_formatted_write_scalar call
	accordingly. (nml_write_obj): Adjust calls to write_character.
	(namelist_write): Likewise.
	* io/transfer.c (formatted_transfer_scaler): Rename 'len' argument to
	'kind' argument to better describe what it is. Add calls to new
	functions for kind == 4. (formatted_transfer): Modify to handle the case
	of type character and kind equals 4 to pass in the kind to the transfer
	routines. (transfer_character_wide): Add this new function.
	(transfer_array): Don't set kind to the character string length. Adjust
	strides bases on character kind.
	(unformatted_read): Adjust size based on kind for character types.
	(unformatted_write): Likewise. (data_transfer_init): Change
	l8_to_l4_offset to big_endian.

From-SVN: r136763
2008-06-13 20:28:08 +00:00
Jerry DeLisle 9355110f96 re PR fortran/36420 (Fortran 2008: g0 edit descriptor)
2008-06-07  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/36420
	PR libfortran/36421
	PR libfortran/36422
	* io/io.h: Add prototype for write_real.
	* io/transfer.c (formatted_transfer_scalar): For FMT_G and width zero,
	use write_real.
	* io/format.c: Add zero width error message. (parse_format_list): Use
	error message for FMT_A if followed by FMT_ZERO. Use zero width error
	message	for FMT_G if mode is READ or if -std=f95 or f2003. (fmormat0):
	Fix typo in comment.
	* io/write.c (write_a): Set wlen to len if FMT_G and length is zero.
	(write_l): Add wlen variable and use it if FMT_G and width is zero.
	(write_decimal): If FMT_G, set m to -1 to flag processor dependent
	formatting. (write_real): Remove static declaration.

From-SVN: r136545
2008-06-07 23:59:53 +00:00
Janne Blomqvist 8947fd62fa Part 1.1 of PR25561.
2008-05-15  Janne Blomqvist  <jb@gcc.gnu.org>

	PR libfortran/25561
	* io/io.h (struct fbuf): Change pointer to position offset.
	* io/fbuf.c (fbuf_init): Reduce default size of buffer, ptr=>pos
	changes.
	(fbuf_reset): ptr=>pos changes.
	(fbuf_alloc): If the request doesn't fit, don't waste memory by
	keeping flushed bytes. ptr=>pos changes.
	(fbuf_flush): ptr=>pos changes.
	(fbuf_seek): Don't seek past the left tab limit, don't update active
	byte count.
	* io/open.c (new_unit): If RECL has been specified, used that as
	initial buffer size.

From-SVN: r135433
2008-05-16 20:42:44 +03:00
Janne Blomqvist 15877a88eb Part 1 of PR 25561.
2008-05-15  Janne Blomqvist  <jb@gcc.gnu.org>

	PR libfortran/25561
	* Makefile.am: Add fbuf.c to gfor_io_src.
	* Makefile.in: Regenerate.
	* io/io.h (read_block): Remove.
	(struct stream): Remove alloc_r_at function pointer.
	(salloc_r): Remove.
	(salloc_r_at): Remove.
	(salloc_w_at): Remove.
	(salloc_w): Remove offset argument.
	(struct fbuf): New struct for format buffer.
	(struct gfc_unit): Add fbuf.
	(read_block_form): New prototype.
	(fbuf_init): Likewise.
	(fbuf_destroy): Likewise.
	(fbuf_reset): Likewise.
	(fbuf_alloc): Likewise.
	(fbuf_flush): Likewise.
	(fbuf_seek): Likewise.
	* io/file_pos.c (formatted_backspace): Change to use sread.
	(unformatted_backspace): Likewise.
	(st_backspace): Flush format buffer.
	(st_rewind): Likewise.
	* io/list_read.c (next_char): Likewise.
	(nml_query): Tidying, flush format buffer.
	* io/open.c (new_unit): Init format buffer.
	* io/read.c (read_l): Change to use read_block_form.
	(read_a): Likewise.
	(read_decimal): Likewise.
	(read_radix): Likewise.
	(read_f): Likewise.
	(read_x): Empty reads also for stream I/O.
	* io/transfer.c (read_sf): Change to use sread.
	(read_block): Rename to read_block_form, change prototype, use sread.
	(read_block_direct): Don't seek stream files.
	(write_block): Change to use fbuf if external file, don't seek stream
	files.
	(write_buf): Don't seek stream files.
	(formatted_transfer_scalar): Use fbuf for external files.
	(us_read): Change to use sread.
	(pre_position): Do nothing for stream I/O.
	(data_transfer_init): Flush fbuf when switching from write to read, if
	POS is specified, seek stream file to correct offset.
	(skip_record): Change to use sread.
	(min_off): New function.
	(next_record_r): Change to use sread.
	(next_record_w): Change to use sset/sseek, flush fbuf.
	(finalize_transfer): Flush fbuf.
	* io/unit.c (init_units): Init fbuf for stdout, stderr.
	(close_unit_1): Destroy fbuf.
	(finish_last_advance_record): Flush fbuf, no need to seek.
	* io/unix.c (fd_alloc_r_at): Remove unused where argument.
	(fd_alloc_w_at): Likewise.
	(fd_read): Remove third argument to fd_alloc_r_at.
	(fd_write): Remove third argument to fd_alloc_w_at.
	(fd_sset): Likewise.
	(fd_open): Don't set alloc_r_at.
	(mem_alloc_r_at): Remove unused where argument.
	(mem_alloc_w_at): Likewise.
	(mem_read): Don't incorrectly return previous errno, remove unused
	third argument to alloc function.
	(mem_write): Likewise.
	(mem_set): Likewise.
	(open_internal): Don't set alloc_r_at pointer.
	* io/fbuf.c: New file.

From-SVN: r135373
2008-05-15 18:53:34 +03:00
Jerry DeLisle 931149a6b7 PR fortran/25829 28655
2008-04-07  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/25829 28655
	* io/open.c (edit_modes): Set flags.async. (new_unit) Set flags.async
	and flags.status. (st_open): Initialize flags.async.
	* io/list_read.c (read_charactor): Use delim_status instead of
	flags.delim.
	* io/read.c (read_x): Use pad_status instead of flags.pad.
	* io/inquire.c (inquire_via_unit): Add new checks.
	(inquire_via_filename): Likewise.
	* io/io.h (st_parameter_inquire): Add new flags.
	(st_parameter_dt): Likewise.
	* io/unit.c (get_internal_unit): Set flags.async. (init_units): Set
	flags.async.
	* io/transfer.c: Add delim and pad option arrays. (read_sf): Use
	pad_status instead of flags.pad. (read_block): Likewise.
	(data_transfer_init): Set flags.async and add checks.
	* io/write.c (write_character): Use delim_status.
	(list_formatted_write_scalar): Likewise. (nml_write_obj): Likewise.
	(namelist_write): Likewise.

From-SVN: r133988
2008-04-07 22:05:52 +00:00
Jerry DeLisle 10256cbe95 PR fortran/25829 28655
2008-04-05  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/25829 28655
	* gfortran.map: Add new symbol, _gfortran_st_wait.
	* libgfortran.h (st_paramter_common): Add new I/O parameters.
	* open.c (st_option decimal_opt[], st_option encoding_opt[],
	st_option round_opt[], st_option sign_opt[], st_option async_opt[]): New
	parameter option arrays. (edit_modes): Add checks for new parameters.
	(new_unit): Likewise. (st_open): Likewise.
	* list_read.c (CASE_SEPERATORS): Add ';' as a valid separator.
	(eat_separator): Handle deimal comma. (read_logical): Fix whitespace.
	(parse_real): Handle decimal comma. (read_real): Handle decimal comma.
	* read.c (read_a): Use decimal status flag to allow comma in place of a
	decimal point. (read_f): Allow comma as acceptable character in float.
	According to decimal flag, substitute a period for a comma.
	(read_x): If decimal status flag is comma, disable the read_comma flag,
	not allowing comma as a delimiter, an extension otherwise.
	* io.h: (unit_decimal, unit_encoding, unit_round, unit_sign,
	unit_async): New enumerators. Add all new I/O parameters.
	* unix.c (unix_stream, int_stream): Add io_mode	asychronous I/O	control.
	(move_pos_offset, fd_alloc_w_at): Fix some whitespace.
	(fd_sfree): Use new enumerator. (fd_read): Likewise.
	(fd_write): Likewise. (fd_close): Fix whitespace.
	(fd_open): Use new enumertors. (tempfile, regular_file,
	open_external): Fix whitespace. (output_stream, error_stream): Set
	method. (stream_offset): Fix whitespace.
	* transfer.c: (st_option decimal_opt[], sign_opt[], blank_opt[]): New
	option arrays. 	(formatted_transfer_scalar): Set sf_read_comma flag
	based on new decimal_status flag. (data_transfer_init): Initialize new
	parameters. Add checks for decimal, sign, and blank. (st_wait): New stub.
	* format.c: (format_lex): Add format specifiers DP, DC, and D.
	(parse_format_list): Parse the new specifiers.
	* write.c (write_decimal): Use new sign enumerators to set the sign.
	(write_complex): Handle decimal comma and semi-colon separator.
	(nml_write_obj): Likewise.
	* write_float.def: Revise sign enumerators. (calculate_sign): Use new
	sign enumerators. (output_float): Likewise. Use new decimal_status flag
	to set the decimal character to a point or a comma.

From-SVN: r133943
2008-04-05 22:18:03 +00:00
Thomas Koenig 9370b3c0f9 re PR fortran/34565 (internal write to string array fails)
2008-01-03  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR libfortran/34565
	* io/io.h:  Adjust protoypes for open_internal(),
	next_array_record() and init_loop_spec().
	* io/list_read.c (next_char):  Use argument "finished"
	of next_array_record to check for end on internal file.
	* io/unit.c:  Calculate the offset for an array
	internal file and supply this informatin to open_internal().
	* io/unix.c (open_internal):  Set the offset for the internal
	file on open.
	* io/transfer.c (init_loop_spec):  Calculate the starting
	record in case of negative strides.  Return size of 0 for
	an empty array.
	(next_array_record):  Use an extra flag to signal that the
	array is finished.
	(next_record_r):  Use the new flag to next_array_record().
	(next_record_w):  Likewise.

2008-01-03  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR libfortran/34565
	* gfortran.dg/internal_readwrite_1.f90:  New test.
	* gfortran.dg/internal_readwrite_2.f90:  New test.

From-SVN: r131305
2008-01-03 19:49:38 +00:00
Thomas Koenig 108bc19009 re PR libfortran/34370 (file positioning after nonadvancing i/o)
2007-12-13  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR libfortran/34370
	PR libfortran/34323
	PR libfortran/34405
	* io/io.h:  Add previous_nonadvancing_write to gfc_unit.
	Add prototype for finish_last_advance_record.
	* io/file_pos.c (st_backspace):  Generate error if backspace is
	attempted for direct access or unformatted stream.
	If there are bytes left from a previous ADVANCE="no", write
	them out before performing the backspace.
	(st_endfile):  Generate error if endfile is attempted for
	direct access.
	If there are bytes left from a previous ADVANCE="no", write
	them out before performing the endfile.
	(st_rewind):  Generate error if rewind is attempted for
	direct access.
	* unit.c (close_unit_1):  Move functionality to write
	previously written bytes to...
	(finish_last_advance_record):  ... here.
	* transfer.c (data_transfer_init):  If reading, reset
	previous_nonadvancing_write.
	(finalize_transfer):  Set the previous_noadvancing_write
	flag if we are writing and ADVANCE="no" was specified.
	Only call next_record() if advance="no" wasn't specified.

2007-12-13  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR libfortran/34370
	PR libfortran/34323
	PR libfortran/34405
	* gfortran.dg/advance_6.f90:  New test case.
	* gfortran.dg/direct_io_7.f90:  New test case.
	* gfortran.dg/streamio_13.f90:  New test case.

From-SVN: r130912
2007-12-13 19:35:09 +00:00
Francois-Xavier Coudert a01246247e * io/io.h: Include libgfortran.h first.
From-SVN: r128442
2007-09-12 16:20:27 +00:00
David Edelsohn 200809cbbf libgfortran.h: Include config.h first.
* libgfortran.h: Include config.h first.
        * io/io.h (struct stream): Rename truncate to trunc.
        * io/unix.c (fd_open): Same.
        (open_internal): Same.

From-SVN: r128182
2007-09-06 08:40:50 -04:00
Francois-Xavier Coudert 25a5e75613 re PR libfortran/31607 (CALL SYSTEM produces garbled output when writing to a buffered file)
PR libfortran/31607
	* intrinsics/system.c (system_sub): Call flush_all_units.
	* io/io.h (flush_all_units): Move prototype to libgfortran.h.
	* libgfortran.h (flush_all_units): Add prototype.

From-SVN: r124510
2007-05-07 19:48:40 +00:00
Jerry DeLisle d10fb73e91 re PR libfortran/31501 (libgfortran internal unit I/O performance issues)
2007-04-28  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/31501
	* io/list_read.c (next_char): Fix whitespace.
	* io/io.h: Remove prototypes and define macros for is_array_io,
	is_stream_io, and is_internal_unit.
	* io/unit.c (is_array_io), (is_internal_unit), (is_stream_io): Delete
	these functions.
	* io/transfer.c (read_sf): Change handling of internal_unit to make a
	single call to salloc_r and use memcpy to transfer the data.

From-SVN: r124266
2007-04-28 23:23:35 +00:00
Jerry DeLisle 16d962d92c re PR libfortran/31532 (INQUIRE(...,POSITION=...) not standard conforming)
2007-04-27  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/31532
	* io/file_pos.c (st_backspace): Set flags.position for end of file
	condition and use new function update_position.
	(st_endfile): Use new function update_position.
	* io/io.h: Add prototype for new function.
	* io/inquire.c (inquire_via_unit): If not direct access, set NEXTREC
	to zero.
	* io/unit.c (update_position): New function to update position info
	used by inquire.
	* io/transfer.c (next_record): Fix typo and use new function.

From-SVN: r124252
2007-04-28 02:03:21 +00:00
Jerry DeLisle 08f9246a45 re PR libfortran/31052 ([4.2 only] Bad IOSTAT values when readings NAMELISTs past EOF)
2007-04-01  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/31052
	* io/open.c (test_endfile): Delete this function.
	(edit_modes): Delete call to test_endfile.
	(new_unit): Likewise.
	* io/io.h: Delete prototype for test_endfile.
	* io/transfer.c (next_record_r): Remove use of test_endfile.
	(st_read):  Add test for end file condition and adjust status.

From-SVN: r123403
2007-04-01 17:32:20 +00:00
Jerry DeLisle beb6a65e75 re PR fortran/31199 (write with "t1" + nonadvancing transfer format gives wrong output)
2007-03-25  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/31199
	*io/io.h: Add saved_pos to gfc_unit structure.
	*io/open.c (new_unit): Initialize saved_pos.
	*io/transfer.c (data_transfer_init): Set max_pos to value in saved_pos.
	(next_record_w): Fix whitespace.
	(finalze_transfer): Calculate max_pos for ADVANCE="no" and save it for
	later use.  If not ADVANCE="no" set saved_pos to zero.

From-SVN: r123205
2007-03-26 03:23:15 +00:00
Jerry DeLisle 9a7b6ea727 re PR libfortran/31052 ([4.2 only] Bad IOSTAT values when readings NAMELISTs past EOF)
2007-03-22  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/31052
	* file_pos.c: Update Copyright year.
	* io/open.c (test_endfile): Restore test_endfile to fix SPEC regression.
	Update Copyright year.
	* io/io.h: Same.
	* io/unix.c (is_special): Add missing type for this function.
	Update Copyright year.
	* io/transfer.c (next_record_r): Restore test_endfile.
	(st_read): Fix whitespace.  Update Copyright year

From-SVN: r123139
2007-03-23 00:13:19 +00:00
Jerry DeLisle 7ab8aa3620 re PR libfortran/31052 ([4.2 only] Bad IOSTAT values when readings NAMELISTs past EOF)
2007-03-18  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/31052
	* io/file_position (st_rewind): Fix comments. Remove use of
	test_endfile. Don't seek if already at 0 position.  Use new is_special
	function to set endfile state.
	* io/open.c (test_endfile): Delete this function.
	* io/io.h: Delete prototype for test_endfile.  Add prototype
	for is_special.
	* io/unix.c (is_special): New function. Fix whitespace.
	* io/transfer.c (next_record_r): Remove use of test_endfile.

From-SVN: r123038
2007-03-18 18:13:50 +00:00
Francois-Xavier Coudert 0dce3ca161 re PR libfortran/27107 (Make dependency on io/io.h broken)
PR libfortran/27107
	* runtime/environ.c: Don't include io/io.h.
	* runtime/string.c: Don't include io/io.h.
	(compare0): Add cast to avoid warning.
	* runtime/error.c: Don't include io/io.h.
	(st_printf): Move to io/unix.c.
	* intrinsics/flush.c: Delete, contents moved to io/intrinsics.c.
	* intrinsics/fget.c: Likewise.
	* intrinsics/ftell.c: Likewise.
	* intrinsics/tty.c: Likewise.
	* libgfortran.h (DEFAULT_RECL, notification_std,
	get_unformatted_convert, IOPARM_*, st_parameter_common, unit_convert,
	DEFAULT_TEMPDIR): New declarations.
	* io/io.h (DEFAULT_RECL, notification_std, get_unformatted_convert,
	IOPARM_*, st_parameter_common, unit_convert, DEFAULT_TEMPDIR):
	Move to libgfortran.h.
	* io/unix.c: Add io/unix.h content.
	(st_printf): New function.
	* io/intrinsics.c: New file.
	* io/unix.h: Remove, contents moved into unix.c.
	* libtool-version: Update library version to 3.0.0.
	* configure.ac: Update library version to 0.3.
	* Makefile.am (intrinsics/fget.c, intrinsics/flush.c,
	intrinsics/ftell.c, intrinsics/tty.c, libgfortran.h): Remove targets.
	* Makefile.in: Regenerate.
	* configure: Regenerate.

From-SVN: r120869
2007-01-17 19:44:00 +00:00
Jerry DeLisle cf79465213 re PR libfortran/30014 (INQUIRE (iolength = xx) limited to kind=4)
2006-12-27  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/30014
	*io/io.h (st_parameter_dt): Change *size and *iolength type to
	GFC_IO_INT.
	*io/transfer.c (finalize_transfer): Cast dtp->u.p.size_used to
	GFC_IO_INT.  (iolength_transfer): Cast size * nelems to GFC_IO_INT.

From-SVN: r120234
2006-12-28 01:40:23 +00:00
Thomas Koenig 07b3bbf200 re PR libfortran/29568 (implement unformatted files with subrecords (Intel style))
2006-12-01  Thomas Koenig  <Thomas.Koenig@online.de>

	PR libfortran/29568
	* gfortran.dg/convert_implied_open.f90:  Change to
	new default record length.
	* gfortran.dg/unf_short_record_1.f90:  Adapt to
	new error message.
	* gfortran.dg/unformatted_subrecords_1.f90:  New test.

2006-12-01  Thomas Koenig  <Thomas.Koenig@online.de>

	PR libfortran/29568
	* gfortran.h (gfc_option_t):  Add max_subrecord_length.
	(top level): Define MAX_SUBRECORD_LENGTH.
	* lang.opt:  Add option -fmax-subrecord-length=.
	* trans-decl.c:  Add new function set_max_subrecord_length.
	(gfc_generate_function_code): If we are within the main
	program and max_subrecord_length has been set, call
	set_max_subrecord_length.
	* options.c (gfc_init_options):  Add defaults for
	max_subrecord_lenght, convert and record_marker.
	(gfc_handle_option):  Add handling for
	-fmax_subrecord_length.
	* invoke.texi:  Document the new default for
	-frecord-marker=<n>.

2006-12-01  Thomas Koenig  <Thomas.Koenig@online.de>

	PR libfortran/29568
	* libgfortran/libgfortran.h (compile_options_t):  Add
	record_marker. (top level):  Define GFC_MAX_SUBRECORD_LENGTH.
	* runtime/compile_options.c (set_record_marker):  Change
	default to four-byte record marker.
	(set_max_subrecord_length):  New function.
	* runtime/error.c (translate_error):  Change error message
	for short record on unformatted read.
	* io/io.h (gfc_unit):  Add recl_subrecord, bytes_left_subrecord
	and continued.
	* io/file_pos.c (unformatted_backspace):  Change default of record
	marker size to four bytes.  Loop over subrecords.
	* io/open.c:  Default recl is max_offset.  If
	compile_options.max_subrecord_length has been set, set set
	u->recl_subrecord to its value, to the maximum value otherwise.
	* io/transfer.c (top level):  Add prototypes for us_read, us_write,
	next_record_r_unf and next_record_w_unf.
	(read_block_direct):  Separate codepaths for unformatted direct
	and unformatted sequential.  If a recl has been set by the
	user, use the number of bytes left for the record if it is smaller
	than the read request.  Loop over subrecords.  Set an error if the
	user has set a recl and the read was short.
	(write_buf):  Separate codepaths for unformatted direct and
	unformatted sequential. If a recl has been set by the
	user, use the number of bytes left for the record if it is smaller
	than the read request.  Loop over subrecords.  Set an error if the
	user has set a recl and the read was short.
	(us_read):  Add parameter continued (to indicate that bytes_left
	should not be intialized).  Change default of record marker size
	to four bytes. Use subrecord.  If the subrecord length is smaller than
	zero, this indicates a continuation.
	(us_write):  Add parameter continued (to indicate that the continued
	flag should be set).  Use subrecord.
	(pre_position):  Use 0 for continued on us_write and us_read calls.
	(skip_record):  New function.
	(next_record_r_unf):  New function.
	(next_record_r):  Use next_record_r_unf.
	(write_us_marker):  Default size for record markers is four bytes.
	(next_record_w_unf):  New function.
	(next_record_w):  Use next_record_w_unf.

From-SVN: r119412
2006-12-01 21:04:38 +00:00
Jerry DeLisle b0c6db58ad io.h (unit_flags): Add new flag has_recl.
2006-11-22  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	* io/io.h (unit_flags): Add new flag has_recl.
	* io.open.c (new_unit): Set flag if RECL= was specified.
	* io/transfer.c (us_write): If flag set, leave recl as initialized by
	new_unit.

From-SVN: r119087
2006-11-22 07:32:09 +00:00
Jerry DeLisle 807fb853ee re PR fortran/29563 (Internal read loses data.)
2006-10-25  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/29563
	* io/io.h (st_parameter_dt): Add new flag at_eof.
	* io/list_read.c (next_char): Set flag when EOF and return '\n' to
	signal EOR.  Check flag on next call and jump out.
	* io/unit.c (get_internal_unit): Initialize new flag.

From-SVN: r118059
2006-10-26 04:35:45 +00:00
Tobias Burnus 8b6dba81f0 in_pack.m4: Fixed a typo.
2006-10-16  Tobias Burnus  <burnus@net-b.de>

        * m4/in_pack.m4: Fixed a typo.
        * m4/iforeach.m4: Fixed a typo.
        * m4/eoshift1.m4: Fixed a typo.
        * m4/eoshift3.m4: Fixed a typo.
        * m4/cshift1.m4: Fixed a typo.
        * m4/in_unpack.m4: Fixed a typo.
        * m4/reshape.m4: Fixed a typo.
        * m4/ifunction.m4: Fixed a typo.
        * runtime/environ.c: Fixed a typo.
        * runtime/in_pack_generic.c: Fixed a typo.
        * runtime/in_unpack_generic.c: Fixed a typo.
        * runtime/memory.c: Fixed a typo.
        * intrinsics/cshift0.c: Fixed a typo.
        * intrinsics/cpu_time.c: Fixed a typo.
        * intrinsics/pack_generic.c: Fixed a typo.
        * intrinsics/unpack_generic.c: Fixed a typo.
        * intrinsics/eoshift0.c: Fixed a typo.
        * intrinsics/eoshift2.c: Fixed a typo.
        * intrinsics/reshape_generic.c: Fixed a typo.
        * io/open.c: Fixed a typo.
        * io/list_read.c: Fixed a typo.
        * io/io.h: Fixed a typo.
        * io/transfer.c: Fixed a typo.
        * io/write.c: Fixed a typo.

From-SVN: r117857
2006-10-18 19:17:49 +02:00
Jerry DeLisle 701306112e re PR fortran/29053 (Consecutive STREAM I/O file positions mixed up)
2006-09-14  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/29053
	* io.h (gfc_unit): Add variable, strm_pos, to track
	STREAM I/O file position.
	* file_pos.c (st_rewind): Set strm_pos to beginning.
	* open.c (new_unit): Initialize strm_pos.
	* read.c (read_x): Bump strm_pos.
	* inquire.c (inquire_via_unit): Return strm_pos value.
	* transfer.c (read_block),(read_block_direct),(write_block)
	(write_buf): Seek to strm_pos - 1.  Update strm_pos when done.
	(pre_position): Initialize strm_pos.
	(data_transfer_init): Set strm_pos if DT_HAS_REC.
	(finalize_transfer): Flush file, no need to update strm_pos.

From-SVN: r116970
2006-09-15 13:16:15 +00:00
Jerry DeLisle 91b30ee5b9 re PR fortran/25828 ([f2003] ACCESS='STREAM' io support)
2006-08-15  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/25828
	* libgfortran.h: Rename GFC_LARGE_IO_INT to GFC_IO_INT.
	* io/file_pos.c (st_backspace): Ignore if access=STREAM.
	(st_rewind): Handle case of access=STREAM.
	* io/open.c (access_opt): Add STREAM_ACCESS.
	(edit_modes): Set current_record to zero only if not STREAM.
	(new_unit): Initialize maxrec, recl, and last_record for STREAM.
	* io/read.c (read_x): Advance file position for STREAM.
	* io/io.h (enum unit_access): Align IOPARM flags with frontend.
	Add ACCESS_STREAM. Add prototype for is_stream_io () function.
	Use GFC_IO_INT.
	* io/inquire.c (inquire_via_unit): Add text for access = "STREAM".
	* io/unit.c (is_stream_io): New function to return true if access =
	STREAM.
	* io/transfer.c (file_mode): Add modes for unformatted stream and
	formatted stream. (current_mode): Return appropriate file mode based
	on access flags.
	(read_block): Handle formatted stream reads.
	(read_block_direct): Handle unformatted stream reads.
	(write_block): Handle formatted stream writes.
	(write_buf): Handle unformatted stream writes.
	(unformatted_read): Fix up, use temporary for size.
	(pre_position): Position file for STREAM access.
	(data_transfer_init): Initialize for stream access, skip irrelevent
	error checks.
	(next_record_r),(next_record_w), and (next_record): Do nothing for
	stream I/O.
	(finalize_transfer): Flush when all done if stream I/O.

From-SVN: r116172
2006-08-15 23:06:44 +00:00
Jerry DeLisle 566ffce895 re PR libfortran/25289 (Cannot handle record numbers large than huge(0_4))
2006-07-23  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/25289
	* libgfortran.h: Add conditional definition of GFC_LARGE_IO_INT type.
	* io/io.h (st_parameter_dt): Define rec as type GFC_LARGE_IO_INT.

From-SVN: r115698
2006-07-24 00:17:52 +00:00
Jerry DeLisle 2e4444278c re PR libfortran/27704 (Incorrect runtime error on multiple OPEN)
2006-07-03  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/27704
	* runtime/error.c (notify_std): Pass common flags into function. Use
	flags to show locus of error or warning.
	* libgfortran.h: Add enum try.  Add prototype for notify_std.
	* io/open.c (edit_modes): Allow status="old" and add extension to
	allow status="scratch"
	*io/list_read.c (nml_read_obj): Update call to notify_std.
	*io/io.h: Remove enum try and prototype for notify_std.
	*io/transfer.c (read_sf): Update call to notify_std.
	*io/format.c (parse_format_list): Update call to notify_std.

From-SVN: r115168
2006-07-04 01:36:31 +00:00
Francois-Xavier Coudert ee4ac5b0b4 io.h: Move proto for unit_to_fd...
* io/io.h: Move proto for unit_to_fd...
	* libgfortran.h: ...here.

From-SVN: r114983
2006-06-25 08:46:09 +00:00
Janne Blomqvist 59c0928b6a io.h (find_or_create_unit): Correct export declaration.
2006-05-27  Janne Blomqvist  <jb@gcc.gnu.org>

	* io/io.h (find_or_create_unit): Correct export declaration.

From-SVN: r114151
2006-05-27 11:36:49 +03:00
Jerry DeLisle 25292a1bf1 re PR libfortran/24459 ([4.1 Only] gfortran namelist problem)
2006-05-20  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/24459
	* io/list_read.c (nml_parse_qualifier): Leave loop spec end value
	at default value unless -std=f95 or if an array section
	is specified in namelist input.  Warn if -pedantic.
	* io/io.h (st_parameter_dt): Add expanded_read flag.

From-SVN: r113924
2006-05-20 07:14:50 +00:00
Jerry DeLisle 54ffdb125c re PR libfortran/20257 (Fortran runtime error: End of record occurs when writing large arrays)
2006-04-22  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/20257
	* io/io.h: Add prototypes for get_internal_unit and free_internal_unit.
	* io/unit.c (get_internal_unit): Initialize unit number, not zero.
	(free_internal_unit): New function to consolidate freeing memory.
	(get_unit): Initialize internal_unit_desc to NULL when unit is
	external.
	* io/unix.c (mem_close): Check for not NULL before freeing memory.
	* io/transfer.c (read_block): Reset bytes_left and skip error if unit
	is preconnected and default record length is reached.
	(read_block_direct): Ditto.
	(write_block): Ditto.
	(write_buf): Ditto.
	(data_transfer_init): Only flush if not internal unit.
	(finalize_transfer): Ditto and delete code to free memory used by
	internal units.
	(st_read_done): Use new function - free_internal_unit.
	(st_write_done): Use new function - free_internal unit.

From-SVN: r113190
2006-04-23 02:04:58 +00:00
Jerry DeLisle 6f34d6e078 re PR fortran/26766 ([F2003] Recursive I/O still (again) broken)
2006-04-12  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/26766
	* io/io.h: Add bit to identify associated unit as internal.
	* io/unit.c (get_external_unit): Renamed the find_unit_1 function to
	reflect the external unit functionality vs internal unit.
	(get_internal_unit): New function to allocate and initialize an internal
	unit structure.
	(get_unit): Use get_internal_unit and get_external_unit.
	(is_internal_unit): Revised to use new bit added in io.h.
	* io/transfer.c (data_transfer_init): Fix line width.
	(st_read_done): Free memory allocated for internal unit.
	(st_write_done): Add test to only flush and truncate when not an
	internal unit.  Free memory allocated for internal unit.

From-SVN: r112914
2006-04-13 06:24:58 +00:00
Jakub Jelinek ebf85e50c0 io.h (st_parameter_dt): Revert 2005-12-10 change to u.pad, fix comment.
* io/io.h (st_parameter_dt): Revert 2005-12-10 change to
	u.pad, fix comment.
	(check_st_parameter_dt): New compile time assert.

From-SVN: r112850
2006-04-11 09:15:00 +02:00
Jerry DeLisle 967d4d456c re PR libfortran/26890 (SIZE parameter interacts with same variable in IO list character length specification.)
2006-04-07  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/26890
	* io/io.h: Revert change to pad size made on 2006-03-30.
	Add comment explaining dependency with fortran/trans-io.c.

From-SVN: r112769
2006-04-07 23:05:12 +00:00
Jerry DeLisle d57d342432 re PR libfortran/26890 (SIZE parameter interacts with same variable in IO list character length specification.)
2006-03-30  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/26890
	* io/io.h: Add size_used to st_parameter_dt, adjust pad size.
	*io/transfer.c (data_transfer_init): Initialize size_used to zero.
	(read_sf): Use size_used.
	(read_block): Likewise.
	(read_block_direct): Likewise.
	(write_block): Likewise.
	(write_buf): Likewise and eliminate erroneous FAILURE return.
	(finalize_transfer): Assign value of size_used to *dtp->size.

From-SVN: r112570
2006-03-31 05:11:03 +00:00
Jerry DeLisle 0853054e96 re PR libfortran/26661 (Sequential formatted read goes too far)
2006-03-25  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/26661
	* io/io.h: Add read_sf so it can be used by read_x.
	* io/transfer.c (read_sf): Pass no_error flag to read_sf.  Use it to
	break out rather than error on EOF or EOR conditions.
	(read_block): Update call to read_sf.
	(read_block_direct): Ditto.
	* io/read.c (read_x): Use the modified read_sf instead of read_block.

From-SVN: r112390
2006-03-26 02:15:44 +00:00
Jerry DeLisle c9f15d9c0e re PR libfortran/26136 (List directed input with underfilled (logicals) array read incorrectly)
2006-02-28  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/26136
	* io/io.h: Add flag for reading from line_buffer.
	* io/list_read.c (l_push_char): New function to save namelist
	input when reading logicals.
	(free_line): New function to free line_buffer memory.
	(next_char): Added feature to read from line_buffer.
	(read_logical): Use new functions to test for '=' after reading a
	logical value, checking for possible variable name.
	(namelist_read): Use free_line when all done.

From-SVN: r111597
2006-03-01 06:04:45 +00:00
François-Xavier Coudert 8f0d39a86b re PR libfortran/21303 (L edit descriptor without a width)
PR libfortran/21303

	* gfortran.h (notification): New enumeration.
	(gfc_notification_std): Prototype for the new function.
	* error.c (gfc_notification_std): New function.
	* io.c (check_format): Handle the case of a L format descriptor
	without a width.

	* runtime/error.c (notification_std): New function.
	* libgfortran.h (notification): New enumeration.
	* io/io.h (notification_std): Prototype for the new function. 
	* io/format.c (parse_format_list): Handle the case of a L format
	descriptor without a width.

	* gcc/testsuite/gfortran.dg/fmt_l.f90: New test.

From-SVN: r111281
2006-02-19 21:31:02 +00:00
Janne Blomqvist 82b8244c51 re PR libfortran/25949 (Unbounded I/O buffer memory usage for formatted IO)
2006-02-12  Janne Blomqvist  <jb@gcc.gnu.org>

	PR libgfortran/25949
	* io/io.h: Add set function pointer to struct stream.  
	* io/unix.c (fd_seek): Only update offset, don't seek.
	(fd_sset): New function.
	(fd_read): Call lseek directly if necessary.
	(fd_write): Likewise.
	(fd_open): Set pointer to fd_sset.
	(mem_set): New function.
	(open_internal): Set pointer to mem_set.
	* io/transfer.c (write_block_direct): Rename to write_buf, add
	error return, non-pointer length argument.
	(unformatted_write): Update to use write_buf.
	(us_write): Simplify by using swrite instead of salloc_w.
	(write_us_marker): New function.
	(new_record_w): Use sset instead of memset, use write_us_marker,
	simplify by using swrite instead of salloc_w.

From-SVN: r110895
2006-02-12 21:59:32 +02:00
Thomas Koenig eaa90d25da re PR fortran/23815 (Add -byteswapio flag)
2005-02-06  Thomas Koenig  <Thomas.Koenig@online.de>

	PR libfortran/23815
	* gfortran.texi: Document the GFORTRAN_CONVERT_UNIT environment
	variable.
	* invoke.texi:  Mention the "Runtime" chapter.
	Document the -fconvert= option.
	* gfortran.h:  Add options_convert.
	* lang.opt:  Add fconvert=little-endian, fconvert=big-endian,
	fconvert=native and fconvert=swap.
	* trans-decl.c (top level):  Add gfor_fndecl_set_convert.
	(gfc_build_builtin_function_decls):  Set gfor_fndecl_set_convert.
	(gfc_generate_function_code):  If -fconvert was specified,
	and this is the main program, add a call to set_convert().
	* options.c:  Handle the -fconvert options.

2005-02-06  Thomas Koenig  <Thomas.Koenig@online.de>

	PR libfortran/23815
	* runtime/environ.c (init_unformatted):  Add GFORTRAN_CONVERT_UNIT
	environment variable.
	(top level):  Add defines, type and static variables for
	GFORTRAN_CONVERT_UNIT handling.
	(search_unit):  New function.
	(match_word): New function.
	(match_integer): New function.
	(next_token): New function.
	(push_token): New function.
	(mark_single): New function.
	(mark_range): New funciton.
	(do_parse): New function.
	(init_unformatted): New function.
	(get_unformatted_convert): New function.
	* runtime/compile_options.c:  Add set_convert().
	* libgfortran.h:  Add convert to compile_options_t.
	* io/open.c (st_open): Call get_unformatted_convert to get
	unit default; if CONVERT_NONE is returned, check for
	the presence of a CONVERT specifier and use it.
	As default, use compile_options.convert.
	* io/io.h (top level): Add CONVERT_NONE to unit_convert, to signal
	"nothing has been set".
	(top level): Add prototype for get_unformatted_convert.

2005-02-06  Thomas Koenig  <Thomas.Koenig@online.de>

	PR libfortran/23815
	* unf_io_convert_4.f90:  New test.

From-SVN: r110664
2006-02-06 20:12:44 +00:00
Thomas Koenig 181c9f4a9b 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
2005-12-10 20:01:56 +00:00
Jerry DeLisle b14c7e14ab re PR libfortran/25039 ([4.1 only] comma short-circuit field width)
2005-12-08  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/25039
	* io/io.h: Create a new flag sf_read_comma to control comma
	separators in numeric reads.
	* io/transfer.c (formatted_transfer_scalar): Initialize the flag.
	(read_sf): Check for commas coming in and if the flag is set,
	shortcut the read.
	* io/read.c (read_a) (read_x): Clear the flag for character reads and
	reset it after the reads.

From-SVN: r108271
2005-12-09 02:53:41 +00:00
Jakub Jelinek e669bd2b69 acinclude.m4 (LIBGFOR_CHECK_PRAGMA_WEAK): Rename to...
libfortran/24991
	* acinclude.m4 (LIBGFOR_CHECK_PRAGMA_WEAK): Rename to...
	(LIBGFOR_GTHREAD_WEAK): ... this.  Define SUPPORTS_WEAK rather
	than HAVE_PRAGMA_WEAK.  Define GTHREAD_USE_WEAK to 0 on hosts
	that shouldn't use weak in gthr.h.
	* configure.ac: Use LIBGFOR_GTHREAD_WEAK instead of
	LIBGFOR_CHECK_PRAGMA_WEAK.
	* config.h.in: Regenerated.
	* configure: Regenerated.
	* io/io.h (SUPPORTS_WEAK): Don't define here.

From-SVN: r107616
2005-11-28 20:51:02 +01:00
David Edelsohn a0ba8cb101 random.c: Include config.h
* intrinsics/random.c: Include config.h
        * io/size_from_kind.c: Include config.h and libgfortran.h
        * io/io.h: Revert 2005-11-21 change.

From-SVN: r107577
2005-11-27 17:09:40 -05:00