This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: FW: libf2c compatibility???


rlau@csc.com wrote:

> Okay, we are getting somewhere now.

> What about the  value of the "addr" field in those data structures? How are the
> initialized, if they are set at all?

in response to what I wrote, on implementation of namelist in g77:

> struct Vardesc {        /* for Namelist */
>         char *name;
>         char *addr;		<-- I suppose you mean this one.
>         ftnlen *dims;
>         int  type;
>         };
> typedef struct Vardesc Vardesc;
> 
> struct Namelist {
>         char *name;
>         Vardesc **vars;
>         int nvars;
>         };
> typedef struct Namelist Namelist;
> 
> So a namelist is a structure containing a pointer to the name of the
> namelist, a pointer to an array of variable descriptors and the number
> of them.  A variable descriptor contains a pointer to the name of the
> variable, its start address, the number of dimensions (in case it's an
> array) and an encoding for its type.  The type encoding is defined in
> egcs/libf2c/libI77/lio.h.
> 
> Therefore, if g77 sees a NAMELIST declaration in your Fortran source, it
> has to set up one Namelist structure and an array of as many Vardesc
> structures as there are variables in the namelist.  It uses static
> allocation for this.

Well, as I explained above, they're initialised by the compiler.  The
compiler knows the addresses of all variables it'll allocate, so it can
fill out the Namelist and Vardesc structures.

-- 
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
GNU Fortran 95: http://g95.sourceforge.net/ (under construction)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]