1193323Sed/* storag.h -- Public #include File (module.h template V1.0)
2193323Sed   Copyright (C) 1995, 1996 Free Software Foundation, Inc.
3193323Sed   Contributed by James Craig Burley.
4193323Sed
5193323SedThis file is part of GNU Fortran.
6193323Sed
7193323SedGNU Fortran is free software; you can redistribute it and/or modify
8193323Sedit under the terms of the GNU General Public License as published by
9193323Sedthe Free Software Foundation; either version 2, or (at your option)
10193323Sedany later version.
11193323Sed
12193323SedGNU Fortran is distributed in the hope that it will be useful,
13193323Sedbut WITHOUT ANY WARRANTY; without even the implied warranty of
14193323SedMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15193323SedGNU General Public License for more details.
16193323Sed
17193323SedYou should have received a copy of the GNU General Public License
18193323Sedalong with GNU Fortran; see the file COPYING.  If not, write to
19249423Sdimthe Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20249423Sdim02111-1307, USA.
21193323Sed
22193323Sed   Owning Modules:
23193323Sed      storag.c
24193323Sed
25193323Sed   Modifications:
26193323Sed*/
27193323Sed
28193323Sed/* Allow multiple inclusion to work. */
29198892Srdivacky
30193323Sed#ifndef _H_f_storag
31193323Sed#define _H_f_storag
32218893Sdim
33218893Sdim/* Simple definitions and enumerations. */
34218893Sdim
35193323Sedtypedef enum
36193323Sed  {
37193323Sed    FFESTORAG_typeNONE,
38193323Sed    FFESTORAG_typeCBLOCK,	/* A COMMON block. */
39193323Sed    FFESTORAG_typeCOMMON,	/* A COMMON variable. */
40193323Sed    FFESTORAG_typeLOCAL,	/* A local entity (var/array/equivalence). */
41212904Sdim    FFESTORAG_typeEQUIV,	/* An entity equivalenced into a COMMON/LOCAL
42218893Sdim				   entity. */
43193323Sed    FFESTORAG_type
44193323Sed  } ffestoragType;
45193323Sed
46193323Sed/* Typedefs. */
47193323Sed
48193323Sedtypedef struct _ffestorag_ *ffestorag;
49193323Sedtypedef struct _ffestorag_list_ *ffestoragList;
50193323Sedtypedef struct _ffestorag_list_ ffestoragList_;
51193323Sed
52193323Sed/* Include files needed by this one. */
53193323Sed
54193323Sed#include "bld.h"
55193323Sed#include "info.h"
56193323Sed#include "symbol.h"
57193323Sed#include "target.h"
58193323Sed
59193323Sed/* Structure definitions. */
60193323Sed
61193323Sedstruct _ffestorag_list_
62193323Sed  {
63193323Sed    ffestorag first;		/* First storage area in list. */
64193323Sed    ffestorag last;		/* Last storage area in list. */
65193323Sed  };
66193323Sed
67193323Sedstruct _ffestorag_
68193323Sed  {
69193323Sed    ffestorag next;		/* Next storage area in list. */
70193323Sed    ffestorag previous;		/* Previous storage area in list. */
71193323Sed    ffestorag parent;		/* Parent who holds aggregate
72193323Sed				   initializations. */
73193323Sed    ffebld init;		/* Initialization expression. */
74    ffebld accretion;		/* Initializations seen so far for aggregate. */
75    ffetargetOffset accretes;	/* # inits needed to fill entire aggregate. */
76    ffesymbol symbol;		/* NULL if typeLOCAL and non-NULL equivs
77				   and the first "rooted" symbol not known. */
78    ffestoragList_ equivs_;	/* NULL if typeLOCAL and not an EQUIVALENCE
79				   area. */
80    ffetargetOffset size;	/* Size of area. */
81    ffetargetOffset offset;	/* Offset of entity within area, 0 for CBLOCK
82				   and non-equivalence LOCAL, <= 0 for equivalence
83				   LOCAL. */
84    ffetargetAlign alignment;	/* Initial alignment for entity. */
85    ffetargetAlign modulo;	/* Modulo within alignment. */
86#ifdef FFECOM_storageHOOK
87    ffecomStorage hook;		/* Whatever the backend needs here. */
88#endif
89    ffestoragType type;
90    ffeinfoBasictype basic_type;/* NONE= >1 non-CHARACTER; ANY=
91				   CHAR+non-CHAR. */
92    ffeinfoKindtype kind_type;	/* NONE= >1 kind type or NONE/ANY basic_type. */
93    ffesymbol type_symbol;	/* First symbol for basic_type/kind_type. */
94    bool is_save;		/* SAVE flag set for this storage area. */
95    bool is_init;		/* INIT flag set for this storage area. */
96  };
97
98/* Global objects accessed by users of this module. */
99
100extern ffestoragList_ ffestorag_list_;
101
102/* Declare functions with prototypes. */
103
104void ffestorag_drive (ffestoragList sl, void (*fn) (ffestorag mst, ffestorag st),
105		      ffestorag mst);
106void ffestorag_dump (ffestorag s);
107void ffestorag_end_layout (ffesymbol s);
108void ffestorag_exec_layout (ffesymbol s);
109void ffestorag_init_2 (void);
110ffestorag ffestorag_new (ffestoragList sl);
111void ffestorag_report (void);
112void ffestorag_update (ffestorag s, ffesymbol sym, ffeinfoBasictype bt,
113		       ffeinfoKindtype kt);
114void ffestorag_update_init (ffestorag s);
115void ffestorag_update_save (ffestorag s);
116
117/* Define macros. */
118
119#define ffestorag_accretes(s) ((s)->accretes)
120#define ffestorag_accretion(s) ((s)->accretion)
121#define ffestorag_alignment(s) ((s)->alignment)
122#define ffestorag_basictype(s) ((s)->basic_type)
123#define ffestorag_hook(s) ((s)->hook)
124#define ffestorag_init(s) ((s)->init)
125#define ffestorag_init_0()
126#define ffestorag_init_1()
127#define ffestorag_init_3()
128#define ffestorag_init_4()
129#define ffestorag_is_init(s) ((s)->is_init)
130#define ffestorag_is_save(s) ((s)->is_save)
131#define ffestorag_kindtype(s) ((s)->kind_type)
132#define ffestorag_list_equivs(s) (&(s)->equivs_)
133#define ffestorag_list_master() (&ffestorag_list_)
134#define ffestorag_modulo(s) ((s)->modulo)
135#define ffestorag_offset(s) ((s)->offset)
136#define ffestorag_parent(s) ((s)->parent)
137#define ffestorag_ptr_to_alignment(s) (&(s)->alignment)
138#define ffestorag_ptr_to_modulo(s) (&(s)->modulo)
139#define ffestorag_set_accretes(s,a) ((s)->accretes = (a))
140#define ffestorag_set_accretion(s,a) ((s)->accretion = (a))
141#define ffestorag_set_alignment(s,a) ((s)->alignment = (a))
142#define ffestorag_set_basictype(s,b) ((s)->basic_type = (b))
143#define ffestorag_set_hook(s,h) ((s)->hook = (h))
144#define ffestorag_set_init(s,i) ((s)->init = (i))
145#define ffestorag_set_is_init(s,in) ((s)->is_init = (in))
146#define ffestorag_set_is_save(s,sa) ((s)->is_save = (sa))
147#define ffestorag_set_kindtype(s,k) ((s)->kind_type = (k))
148#define ffestorag_set_modulo(s,m) ((s)->modulo = (m))
149#define ffestorag_set_offset(s,o) ((s)->offset = (o))
150#define ffestorag_set_parent(s,p) ((s)->parent = (p))
151#define ffestorag_set_size(s,si) ((s)->size = (si))
152#define ffestorag_set_symbol(s,sy) ((s)->symbol = (sy))
153#define ffestorag_set_type(s,t) ((s)->type = (t))
154#define ffestorag_set_typesymbol(s,sy) ((s)->type_symbol = (sy))
155#define ffestorag_size(s) ((s)->size)
156#define ffestorag_symbol(s) ((s)->symbol)
157#define ffestorag_terminate_0()
158#define ffestorag_terminate_1()
159#define ffestorag_terminate_2()
160#define ffestorag_terminate_3()
161#define ffestorag_terminate_4()
162#define ffestorag_type(s) ((s)->type)
163#define ffestorag_typesymbol(s) ((s)->type_symbol)
164
165/* End of #include file. */
166
167#endif
168