Retabify
[official-gcc.git] / gcc / f / global.h
blobeaf99214b8c4597451bc319814b527a279311041
1 /* global.h -- Public #include File (module.h template V1.0)
2 Copyright (C) 1995, 1997 Free Software Foundation, Inc.
3 Contributed by James Craig Burley.
5 This file is part of GNU Fortran.
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.
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.
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.
22 Owning Modules:
23 global.c
25 Modifications:
28 /* Allow multiple inclusion to work. */
30 #ifndef _H_f_global
31 #define _H_f_global
33 /* Simple definitions and enumerations. */
35 typedef enum
37 FFEGLOBAL_typeNONE,
38 FFEGLOBAL_typeMAIN,
39 FFEGLOBAL_typeEXT, /* EXTERNAL is all we know. */
40 FFEGLOBAL_typeSUBR,
41 FFEGLOBAL_typeFUNC,
42 FFEGLOBAL_typeBDATA,
43 FFEGLOBAL_typeCOMMON,
44 FFEGLOBAL_typeANY, /* Confusion reigns, so just ignore. */
45 FFEGLOBAL_type
46 } ffeglobalType;
48 typedef enum
50 FFEGLOBAL_argsummaryNONE, /* No arg present. */
51 FFEGLOBAL_argsummaryVAL, /* Pass-by-value. */
52 FFEGLOBAL_argsummaryREF, /* Pass-by-reference. */
53 FFEGLOBAL_argsummaryDESCR, /* Pass-by-descriptor. */
54 FFEGLOBAL_argsummaryPROC, /* Procedure (intrinsic, external). */
55 FFEGLOBAL_argsummarySUBR, /* Subroutine (intrinsic, external). */
56 FFEGLOBAL_argsummaryFUNC, /* Function (intrinsic, external). */
57 FFEGLOBAL_argsummaryALTRTN, /* Alternate-return (label). */
58 FFEGLOBAL_argsummaryANY,
59 FFEGLOBAL_argsummary
60 } ffeglobalArgSummary;
62 /* Typedefs. */
64 typedef struct _ffeglobal_arginfo_ *ffeglobalArgInfo_;
65 typedef struct _ffeglobal_ *ffeglobal;
67 /* Include files needed by this one. */
69 #include "info.h"
70 #include "lex.h"
71 #include "name.h"
72 #include "symbol.h"
73 #include "target.h"
74 #include "top.h"
76 /* Structure definitions. */
78 struct _ffeglobal_arginfo_
80 ffelexToken t; /* Different from master token when difference is important. */
81 char *name; /* Name of dummy arg, or NULL if not yet known. */
82 ffeglobalArgSummary as;
83 ffeinfoBasictype bt;
84 ffeinfoKindtype kt;
85 bool array;
88 struct _ffeglobal_
90 ffelexToken t;
91 ffename n;
92 #ifdef FFECOM_globalHOOK
93 ffecomGlobal hook;
94 #endif
95 ffeCounter tick; /* Recent transition in this progunit. */
96 ffeglobalType type;
97 bool intrinsic; /* Known as intrinsic? */
98 bool explicit_intrinsic; /* Explicit intrinsic? */
99 union {
100 struct {
101 ffelexToken initt; /* First initial value. */
102 bool have_pad; /* Padding info avail for COMMON? */
103 ffetargetAlign pad; /* Initial padding for COMMON. */
104 ffewhereLine pad_where_line;
105 ffewhereColumn pad_where_col;
106 bool have_save; /* Save info avail for COMMON? */
107 bool save; /* Save info for COMMON. */
108 ffewhereLine save_where_line;
109 ffewhereColumn save_where_col;
110 bool have_size; /* Size info avail for COMMON? */
111 ffetargetOffset size; /* Size info for COMMON. */
112 bool blank; /* TRUE if blank COMMON. */
113 } common;
114 struct {
115 bool defined; /* Seen actual code yet? */
116 ffeinfoBasictype bt; /* NONE for non-function. */
117 ffeinfoKindtype kt; /* NONE for non-function. */
118 ffetargetCharacterSize sz;
119 int n_args; /* 0 for main/blockdata. */
120 ffelexToken other_t; /* Location of reference. */
121 ffeglobalArgInfo_ arg_info; /* Info on each argument. */
122 } proc;
123 } u;
126 /* Global objects accessed by users of this module. */
129 /* Declare functions with prototypes. */
131 void ffeglobal_drive (ffeglobal (*fn) (ffeglobal));
132 void ffeglobal_init_1 (void);
133 void ffeglobal_init_common (ffesymbol s, ffelexToken t);
134 void ffeglobal_new_progunit_ (ffesymbol s, ffelexToken t, ffeglobalType type);
135 void ffeglobal_new_common (ffesymbol s, ffelexToken t, bool blank);
136 void ffeglobal_pad_common (ffesymbol s, ffetargetAlign pad, ffewhereLine wl,
137 ffewhereColumn wc);
138 void ffeglobal_proc_def_arg (ffesymbol s, int argno, const char *name, ffeglobalArgSummary as,
139 ffeinfoBasictype bt, ffeinfoKindtype kt,
140 bool array);
141 void ffeglobal_proc_def_nargs (ffesymbol s, int n_args);
142 bool ffeglobal_proc_ref_arg (ffesymbol s, int argno, ffeglobalArgSummary as,
143 ffeinfoBasictype bt, ffeinfoKindtype kt,
144 bool array, ffelexToken t);
145 bool ffeglobal_proc_ref_nargs (ffesymbol s, int n_args, ffelexToken t);
146 ffeglobal ffeglobal_promoted (ffesymbol s);
147 void ffeglobal_ref_intrinsic (ffesymbol s, ffelexToken t, bool explicit);
148 bool ffeglobal_ref_progunit_ (ffesymbol s, ffelexToken t, ffeglobalType type);
149 void ffeglobal_save_common (ffesymbol s, bool save, ffewhereLine wl,
150 ffewhereColumn wc);
151 bool ffeglobal_size_common (ffesymbol s, ffetargetOffset size);
152 void ffeglobal_terminate_1 (void);
154 /* Define macros. */
156 #if FFECOM_targetCURRENT == FFECOM_targetFFE
157 #define FFEGLOBAL_ENABLED 0
158 #elif FFECOM_targetCURRENT == FFECOM_targetGCC
159 #define FFEGLOBAL_ENABLED 1
160 #else
161 #error
162 #endif
164 #define ffeglobal_common_init(g) ((g)->tick != 0)
165 #define ffeglobal_common_have_pad(g) ((g)->u.common.have_pad)
166 #define ffeglobal_common_have_size(g) ((g)->u.common.have_size)
167 #define ffeglobal_common_pad(g) ((g)->u.common.pad)
168 #define ffeglobal_common_size(g) ((g)->u.common.size)
169 #define ffeglobal_hook(g) ((g)->hook)
170 #define ffeglobal_init_0()
171 #define ffeglobal_init_2()
172 #define ffeglobal_init_3()
173 #define ffeglobal_init_4()
174 #define ffeglobal_new_blockdata(s,t) \
175 ffeglobal_new_progunit_(s,t,FFEGLOBAL_typeBDATA)
176 #define ffeglobal_new_function(s,t) \
177 ffeglobal_new_progunit_(s,t,FFEGLOBAL_typeFUNC)
178 #define ffeglobal_new_program(s,t) \
179 ffeglobal_new_progunit_(s,t,FFEGLOBAL_typeMAIN)
180 #define ffeglobal_new_subroutine(s,t) \
181 ffeglobal_new_progunit_(s,t,FFEGLOBAL_typeSUBR)
182 #define ffeglobal_ref_blockdata(s,t) \
183 ffeglobal_ref_progunit_(s,t,FFEGLOBAL_typeBDATA)
184 #define ffeglobal_ref_external(s,t) \
185 ffeglobal_ref_progunit_(s,t,FFEGLOBAL_typeEXT)
186 #define ffeglobal_ref_function(s,t) \
187 ffeglobal_ref_progunit_(s,t,FFEGLOBAL_typeFUNC)
188 #define ffeglobal_ref_subroutine(s,t) \
189 ffeglobal_ref_progunit_(s,t,FFEGLOBAL_typeSUBR)
190 #define ffeglobal_set_hook(g,h) ((g)->hook = (h))
191 #define ffeglobal_terminate_0()
192 #define ffeglobal_terminate_2()
193 #define ffeglobal_terminate_3()
194 #define ffeglobal_terminate_4()
195 #define ffeglobal_text(g) ffename_text((g)->n)
196 #define ffeglobal_type(g) ((g)->type)
198 /* End of #include file. */
200 #endif