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???





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?



Thank you again!





toon@moene.indiv.nluug.nl on 06/17/2000 06:15:40 AM

To:   Raymond K Lau/TMG/CSC@CSC
cc:
Subject:  Re: FW: libf2c compatibility???



rlau@csc.com wrote:

> Can you explain what those data structures are - those define din f2c.h and
the
> other header files?
> Specifically, I am wondering the way those are initialized and what are  the
> relationship between
> the global variables of types those data structure and the actual fortran
> program???

Ah, it starts to come back - it's a pity I didn't save the answer I gave
Craig Burley back in '93, but I think I see how it works.

In f2c.h (actually, if you look into the sources in egcs/libf2c, it's
g2c.hin) you'll find:

struct Vardesc {        /* for Namelist */
        char *name;
        char *addr;
        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.

Hope this helps,

--
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]