[patch, fortran]PR25829 Add support for F2003 I/O features

Jerry DeLisle jvdelisle@verizon.net
Sun Mar 16 21:48:00 GMT 2008


:ADDPATCH fortran:

This is a lengthy patch.  It was initiated by FX quite some time ago and I have 
have taken and advanced it to be useful.

I would like this to go into 4.4 branch for several reasons.

1. So we don't lose it and it is in sync with trunk.
2. It will allow others to see and augment this with any missing checks and 
features.
3. It will allow others to exercise and test it.
4. Get the configury magic figured out for using aio.h for systems that support 
it. (need help from others on this)

For the gfortran front end the patch implements:

- the matchers and checks for asynchronous, decimal, encoding, pending, round, 
sign, size, id for OPEN, READ, WRITE, and INQUIRE.
- New WAIT statement.

For the runtime library:

- implements a do nothing stub for the WAIT statement.  I plan another patch 
after this that will implement the actual asynchronous I/O.
- implements the DECIMAL= feature.
- Update the handling of sign.

Some very rough beginnings of test cases included.

Regression tested on x86-64.  OK for trunk after we get the configury stuff 
added for aio.h?

Jerry

2008-03-16  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
	    Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

	PR fortran/25829
	* dump-parse-tree.c (gfc_show_code_node): Show new I/O parameters.
	* gfortran.h (gfc_statement): Add ST_WAIT enumerator.
	(gfc_open): Add pointers for decimal, encoding, round, sign,
	asynchronous. (gfc_inquire): Add pointers for asynchronous, decimal,
	encoding, pending, round, sign, size, id.
	(gfc_wait): New typedef struct. (gfc_dt): Add pointers for id, pos,
	asynchronous, blank, decimal, delim, pad, round, sign.
	(gfc_exec_op): Add EXEC_WAIT enumerator. (gfc_code): Add pointer for
	wait. (gfc_free_wait), (gfc_resolve_wait): New function prototypes.
	* trans-stmt.h (gfc_trans_wait): New function prototype.
	* trans.c (gfc_trans_code): Add case for EXEC_WAIT.
	* io.c (io_tag): Add new tags for DECIMAL, ENCODING, ROUND, SIGN,
	ASYCHRONOUS, ID. (match_open_element): Add matchers for new tags.
	(gfc_free_open): Free new pointers. (gfc_resolve_open): Resolve new
	tags. (gfc_resolve_open): Remove comment around check for allowed
	values and ASYNCHRONOUS, update it.  Likewise for DECIMAL, ENCODING,
	ROUND, and SIGN. (match_dt_element): Add matching for new tags.
	(gfc_free_wait): New function. (gfc_resolve_wait): New function.
	(match_wait_element): New function. (gfc_match_wait): New function.
	* resolve.c (gfc_resolve_blocks): Add case for EXEC_WAIT.
	(resolve_code): Add case for EXEC_WAIT.
	* st.c (gfc_free_statement): Add case for EXEC_WAIT.
	* trans-io.c (ioparam_type): Add IOPARM_ptype_wait. (gfc_st_parameter):
	Add "wait" entry. (iocall): Add IOCALL_WAIT enumerator.
	(gfc_build_io_library_fndecls): Add function declaration for st_wait.
	(gfc_trans_open): Add mask bits for new I/O tags.
	(gfc_trans_inquire): Add mask bits for new I/O tags.
	(gfc_trans_wait): New translation function.
	(build_dt): Add mask bits for new I/O tags.
	* match.c (gfc_match_if) Add matcher for "wait".
	* match.h (gfc_match_wait): Prototype for new function.
	* ioparm.def: Add new I/O parameter definitions.
	* parse.c (decode_statement): Add match for "wait" statement.
	(next_statement): Add case for ST_WAIT. (gfc_ascii_statement): Same.
	* gfortran.map: Add symbol for _gfortran_st_wait.

2008-03-16  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
	    Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

	PR fortran/25829
	* 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 seprator.
	* 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: Include aio.h for future asynchronous support.
	(gfc_aio): New structure for tracking the aio control block.
	(io_mode): New enumerator for keeping track of whether we are doing
	the usual synchronous I/O or the new asychronous.
	(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 and pointer for
	asychronous I/O	control	structure.
	(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 and set paio pointer to NULL.
	(open_internal): Set paio pointer to NULL. (tempfile, regular_file,
	open_external): Fix whitespace. (output_stream, error_stream): Set
	method. (stream_offset): Fix whitespace.
	* transfer.c (st_option decimal_opt[]): New option array.
	(formatted_transfer_scalar): Set sf_read_comma flag based on new
	decimal_status flag. (data_transfer_init): Initialize new parameters.
	Add checks for decimal mode. (st_wait): Add new stub for WAIT.
	* write.c (write_decimal): Use new sign enumerators to set the sign.
	* 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.
	
-------------- next part --------------
A non-text attachment was scrubbed...
Name: f2003-io-RevC.diff
Type: text/x-patch
Size: 55255 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080316/82a54d9e/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test1.f90
Type: text/x-fortran
Size: 613 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080316/82a54d9e/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test2.f90
Type: text/x-fortran
Size: 374 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080316/82a54d9e/attachment-0002.bin>


More information about the Gcc-patches mailing list