improved namelist io
Paul Thomas
paulthomas2@wanadoo.fr
Mon Jan 17 05:47:00 GMT 2005
Please find enclosed patches to improve namlist io.
The modifications to trans-io.c and transfer.c are, as yet, kluges. The
existing transfer routines have been extended to transfer the rank of arrays
and a new routine added to send upper and lower bounds. It is not pretty
but it is robust. I have designed something neater that I expect to test in
the next week or so.
The modifications to io.h, write.c and list_read.c are rather more developed
and comply with the fortran standard. These are ready to accept character
arrays but the front end is not ( see PR19467). I have a design ready for
derived type arrays, to go with the improved front end.
I have also attached two out of the eventual four test programs.
What will these modifications do?
1) It reads and writes real and integer scalars and arrays.
2) Qualifiers can be used for integer and real arrays, with assumed range
starts and ends and triplets in both direction.
3) Comma delimited, inverted comma delimited and quote delimited strings are
correctly handled. Namleist write assumes quote delimited, which is a
departure from the standard but does assure that namelist output can be read
by namelist input.
4) Nulls, repeat nulls, blank lines and comments are correctly handled.
5) Derived types, with scalar and array components are correctly read and
written in the mytype%component format.
6) They respond to all the existing PRs on namelist, except 19467=> 17285,
17472, 18122, 18210 and 18392 are fixed.
7) In order to make namelist work, a problem with the interpretation of
comma and comma+space delimiters, in list-directed read, had to be fixed.
(See my message of Jan 10th). AFAIK the patch has been applied to the cvs
source. A further test suite candidate is on its way.
What will they not do?
1) Character arrays are not available because of PR19467, for the moment.
2) Derived type support is limited. Derived type arrays are still not
allowed and mytype= will produce an error.
The missing test programs exercise the derived type support and the error
trapping. I expect both of these to be ready in a day or two.
I will update the Cygwin binaries on the gfortran site to support namelist
in the next 24 hours. I will also sneak a RH9 and Tru64 versions in the
Cygwin directory.
I would appreciate feedback on the front-end, in particular, the coding of
the back-end and such nasties as occur. Still more would I appreciate
somebody sanitising the whole lot. I tried to stick to the coding
standards.... honest!
FSF have an email from me and the necessary paperwork is on its way to me.
Paul Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: io.new.patch
Type: application/octet-stream
Size: 592 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20050117/e61099a4/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: list_read.new.patch
Type: application/octet-stream
Size: 28104 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20050117/e61099a4/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: transfer.new.patch
Type: application/octet-stream
Size: 5058 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20050117/e61099a4/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: trans-io.new.patch
Type: application/octet-stream
Size: 15538 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20050117/e61099a4/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: write.new.patch
Type: application/octet-stream
Size: 6960 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20050117/e61099a4/attachment-0004.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_nml_1.f
Type: application/octet-stream
Size: 1444 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20050117/e61099a4/attachment-0005.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_nml_2.f
Type: application/octet-stream
Size: 1620 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20050117/e61099a4/attachment-0006.obj>
More information about the Fortran
mailing list