This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: arrays and derived data types in namelists
- From: Paul Brook <paul at codesourcery dot com>
- To: fortran at gcc dot gnu dot org
- Cc: "Paul Thomas" <paulthomas2 at wanadoo dot fr>
- Date: Wed, 24 Nov 2004 13:02:06 +0000
- Subject: Re: arrays and derived data types in namelists
- Organization: CodeSourcery
- References: <001a01c4d207$477fac10$0400000a@Paul>
On Wednesday 24 November 2004 09:23, Paul Thomas wrote:
> Is there a strategy in the collective (or not!) mind for implementing the
> missing features in namelists? Most specifically, a lot of the code that I
> work with includes arrays, and occasionally components of derived data
> types.
>
> I have done a bit of tidying up work on list_read.c and thought to try to
> implement arrays, at very least, before submitting (a) patch(s).
If possible tidy up work should be submitted separately from new features.
> I notice that the descriptor dimension array and the derived components are
> missing from namelist_type. Is it intended to add them to this structure
> or a link back to the array descriptor itself?
I think for arrays it makes sense to pass the array descriptor, rather than
the g77-style data pointer plus duplicating most of the array descriptor
information. This gives the compiler the option of reusing an existing
descriptor.
We've thrown a few ideas around on IRC, but didn't reach any conclusions.
We need some sort of interface for registering arrays and derived types.
Two strategies have been suggested:
- Extend the existing st_set_nml_var_* routines, adding new ones for arrays
and derived types. Use these to construct the type descriptions at runtime.
- Have a single st_set_nml_descriptor entry point. Build an in-memory
description of the namelist type at compile time, and pass this. Similar to
how formatted IO is done, but using a compiler/library friendly format rather
than a human readable string.
Both of these have advantages and disadvantages. I personally favour the
latter.
Paul