1 /* storag.h -- Public #include File (module.h template V1.0)
2    Copyright (C) 1995, 1996, 2003 Free Software Foundation, Inc.
3    Contributed by James Craig Burley.
4 
5 This file is part of GNU Fortran.
6 
7 GNU Fortran is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11 
12 GNU Fortran is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with GNU Fortran; see the file COPYING.  If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA.
21 
22    Owning Modules:
23       storag.c
24 
25    Modifications:
26 */
27 
28 /* Allow multiple inclusion to work. */
29 
30 #ifndef GCC_F_STORAG_H
31 #define GCC_F_STORAG_H
32 
33 /* Simple definitions and enumerations. */
34 
35 typedef enum
36   {
37     FFESTORAG_typeNONE,
38     FFESTORAG_typeCBLOCK,	/* A COMMON block. */
39     FFESTORAG_typeCOMMON,	/* A COMMON variable. */
40     FFESTORAG_typeLOCAL,	/* A local entity (var/array/equivalence). */
41     FFESTORAG_typeEQUIV,	/* An entity equivalenced into a COMMON/LOCAL
42 				   entity. */
43     FFESTORAG_type
44   } ffestoragType;
45 
46 /* Typedefs. */
47 
48 typedef struct _ffestorag_ *ffestorag;
49 typedef struct _ffestorag_list_ *ffestoragList;
50 typedef struct _ffestorag_list_ ffestoragList_;
51 
52 /* Include files needed by this one. */
53 
54 #include "bld.h"
55 #include "info.h"
56 #include "symbol.h"
57 #include "target.h"
58 
59 /* Structure definitions. */
60 
61 struct _ffestorag_list_
62   {
63     ffestorag first;		/* First storage area in list. */
64     ffestorag last;		/* Last storage area in list. */
65   };
66 
67 struct _ffestorag_
68   {
69     ffestorag next;		/* Next storage area in list. */
70     ffestorag previous;		/* Previous storage area in list. */
71     ffestorag parent;		/* Parent who holds aggregate
72 				   initializations. */
73     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     ffecomStorage hook;		/* Whatever the backend needs here. */
87     ffestoragType type;
88     ffeinfoBasictype basic_type;/* NONE= >1 non-CHARACTER; ANY=
89 				   CHAR+non-CHAR. */
90     ffeinfoKindtype kind_type;	/* NONE= >1 kind type or NONE/ANY basic_type. */
91     ffesymbol type_symbol;	/* First symbol for basic_type/kind_type. */
92     bool is_save;		/* SAVE flag set for this storage area. */
93     bool is_init;		/* INIT flag set for this storage area. */
94   };
95 
96 /* Global objects accessed by users of this module. */
97 
98 extern ffestoragList_ ffestorag_list_;
99 
100 /* Declare functions with prototypes. */
101 
102 void ffestorag_drive (ffestoragList sl, void (*fn) (ffestorag mst, ffestorag st),
103 		      ffestorag mst);
104 void ffestorag_dump (ffestorag s);
105 void ffestorag_end_layout (ffesymbol s);
106 void ffestorag_exec_layout (ffesymbol s);
107 void ffestorag_init_2 (void);
108 ffestorag ffestorag_new (ffestoragList sl);
109 void ffestorag_report (void);
110 void ffestorag_update (ffestorag s, ffesymbol sym, ffeinfoBasictype bt,
111 		       ffeinfoKindtype kt);
112 void ffestorag_update_init (ffestorag s);
113 void ffestorag_update_save (ffestorag s);
114 
115 /* Define macros. */
116 
117 #define ffestorag_accretes(s) ((s)->accretes)
118 #define ffestorag_accretion(s) ((s)->accretion)
119 #define ffestorag_alignment(s) ((s)->alignment)
120 #define ffestorag_basictype(s) ((s)->basic_type)
121 #define ffestorag_hook(s) ((s)->hook)
122 #define ffestorag_init(s) ((s)->init)
123 #define ffestorag_init_0()
124 #define ffestorag_init_1()
125 #define ffestorag_init_3()
126 #define ffestorag_init_4()
127 #define ffestorag_is_init(s) ((s)->is_init)
128 #define ffestorag_is_save(s) ((s)->is_save)
129 #define ffestorag_kindtype(s) ((s)->kind_type)
130 #define ffestorag_list_equivs(s) (&(s)->equivs_)
131 #define ffestorag_list_master() (&ffestorag_list_)
132 #define ffestorag_modulo(s) ((s)->modulo)
133 #define ffestorag_offset(s) ((s)->offset)
134 #define ffestorag_parent(s) ((s)->parent)
135 #define ffestorag_ptr_to_alignment(s) (&(s)->alignment)
136 #define ffestorag_ptr_to_modulo(s) (&(s)->modulo)
137 #define ffestorag_set_accretes(s,a) ((s)->accretes = (a))
138 #define ffestorag_set_accretion(s,a) ((s)->accretion = (a))
139 #define ffestorag_set_alignment(s,a) ((s)->alignment = (a))
140 #define ffestorag_set_basictype(s,b) ((s)->basic_type = (b))
141 #define ffestorag_set_hook(s,h) ((s)->hook = (h))
142 #define ffestorag_set_init(s,i) ((s)->init = (i))
143 #define ffestorag_set_is_init(s,in) ((s)->is_init = (in))
144 #define ffestorag_set_is_save(s,sa) ((s)->is_save = (sa))
145 #define ffestorag_set_kindtype(s,k) ((s)->kind_type = (k))
146 #define ffestorag_set_modulo(s,m) ((s)->modulo = (m))
147 #define ffestorag_set_offset(s,o) ((s)->offset = (o))
148 #define ffestorag_set_parent(s,p) ((s)->parent = (p))
149 #define ffestorag_set_size(s,si) ((s)->size = (si))
150 #define ffestorag_set_symbol(s,sy) ((s)->symbol = (sy))
151 #define ffestorag_set_type(s,t) ((s)->type = (t))
152 #define ffestorag_set_typesymbol(s,sy) ((s)->type_symbol = (sy))
153 #define ffestorag_size(s) ((s)->size)
154 #define ffestorag_symbol(s) ((s)->symbol)
155 #define ffestorag_terminate_0()
156 #define ffestorag_terminate_1()
157 #define ffestorag_terminate_2()
158 #define ffestorag_terminate_3()
159 #define ffestorag_terminate_4()
160 #define ffestorag_type(s) ((s)->type)
161 #define ffestorag_typesymbol(s) ((s)->type_symbol)
162 
163 /* End of #include file. */
164 
165 #endif /* ! GCC_F_STORAG_H */
166