OSDN Git Service

2001-02-20 Joel Sherrill <joel@OARcorp.com>
[pf3gnuchains/gcc-fork.git] / gcc / f / com.h
1 /* com.h -- Public #include File (module.h template V1.0)
2    Copyright (C) 1995, 1996, 1997, 2000 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       com.c
24
25    Modifications:
26 */
27
28 /* Allow multiple inclusion to work. */
29
30 #ifndef GCC_F_COM_H
31 #define GCC_F_COM_H
32
33 /* Simple definitions and enumerations. */
34
35 #define FFECOM_dimensionsMAX 7  /* Max # dimensions (quick hack). */
36
37 #define FFECOM_SIZE_UNIT "byte" /* Singular form. */
38 #define FFECOM_SIZE_UNITS "bytes"       /* Plural form. */
39
40 #define FFECOM_constantNULL NULL_TREE
41 #define FFECOM_nonterNULL NULL_TREE
42 #define FFECOM_globalNULL NULL_TREE
43 #define FFECOM_labelNULL NULL_TREE
44 #define FFECOM_storageNULL NULL_TREE
45 #define FFECOM_symbolNULL ffecom_symbol_null_
46
47 /* Shorthand for types used in f2c.h and that g77 perhaps allows some
48    flexibility regarding in the section below.  I.e. the actual numbers
49    below aren't important, as long as they're unique.  */
50
51 #define FFECOM_f2ccodeCHAR 1
52 #define FFECOM_f2ccodeSHORT 2
53 #define FFECOM_f2ccodeINT 3
54 #define FFECOM_f2ccodeLONG 4
55 #define FFECOM_f2ccodeLONGLONG 5
56 #define FFECOM_f2ccodeCHARPTR 6         /* char * */
57 #define FFECOM_f2ccodeFLOAT 7
58 #define FFECOM_f2ccodeDOUBLE 8
59 #define FFECOM_f2ccodeLONGDOUBLE 9
60 #define FFECOM_f2ccodeTWOREALS 10
61 #define FFECOM_f2ccodeTWODOUBLEREALS 11
62
63 #if FFECOM_DETERMINE_TYPES      /* only for com.c and configure */
64
65 /* Begin f2c.h information.  This must match the info in the f2c.h used
66    to build the libf2c with which g77-generated code is linked, or there
67    will probably be bugs, some of them difficult to detect or even trigger.  */
68
69 /* The C front-end provides __g77_integer and __g77_uinteger types so that
70    the appropriately-sized signed and unsigned integer types are available
71    for libf2c.  If you change this, also the definitions of those types
72    in ../c-decl.c. */
73 #define FFECOM_f2cINTEGER                       \
74   (LONG_TYPE_SIZE == FLOAT_TYPE_SIZE            \
75    ? FFECOM_f2ccodeLONG                         \
76    : (INT_TYPE_SIZE == FLOAT_TYPE_SIZE          \
77       ? FFECOM_f2ccodeINT                       \
78       : (abort (), -1)))
79
80 #define FFECOM_f2cLOGICAL FFECOM_f2cINTEGER
81
82 /* The C front-end provides __g77_longint and __g77_ulongint types so that
83    the appropriately-sized signed and unsigned integer types are available
84    for libf2c.  If you change this, also the definitions of those types
85    in ../c-decl.c. */
86 #define FFECOM_f2cLONGINT                               \
87  (LONG_TYPE_SIZE == (FLOAT_TYPE_SIZE * 2)               \
88   ? FFECOM_f2ccodeLONG                                  \
89   : (LONG_LONG_TYPE_SIZE == (FLOAT_TYPE_SIZE * 2)       \
90      ? FFECOM_f2ccodeLONGLONG                           \
91      : (abort (), -1)))
92
93 #define FFECOM_f2cADDRESS FFECOM_f2ccodeCHARPTR
94 #define FFECOM_f2cSHORTINT FFECOM_f2ccodeSHORT
95 #define FFECOM_f2cREAL FFECOM_f2ccodeFLOAT
96 #define FFECOM_f2cDOUBLEREAL FFECOM_f2ccodeDOUBLE
97 #define FFECOM_f2cCOMPLEX FFECOM_f2ccodeTWOREALS
98 #define FFECOM_f2cDOUBLECOMPLEX FFECOM_f2ccodeTWODOUBLEREALS
99 #define FFECOM_f2cSHORTLOGICAL FFECOM_f2ccodeSHORT
100 #define FFECOM_f2cLOGICAL1 FFECOM_f2ccodeCHAR
101 #define FFECOM_f2cINTEGER1 FFECOM_f2ccodeCHAR
102
103 /* These must be f2c's INTEGER type, to match runtime/f2c.h.in.  */
104
105 #define FFECOM_f2cFLAG FFECOM_f2cINTEGER
106 #define FFECOM_f2cFTNINT FFECOM_f2cINTEGER
107 #define FFECOM_f2cFTNLEN FFECOM_f2cINTEGER
108
109 #endif  /* #if FFECOM_DETERMINE_TYPES */
110
111 /* Everything else in f2c.h, specifically the structures used in
112    interfacing compiled code with the library, must remain exactly
113    as delivered, or g77 internals (mostly com.c and ste.c) must
114    be modified accordingly to compensate.  Or there will be...trouble.  */
115
116 typedef enum
117   {
118 #define DEFGFRT(CODE,NAME,TYPE,ARGS,VOLATILE,COMPLEX,CONST) CODE,
119 #include "com-rt.def"
120 #undef DEFGFRT
121     FFECOM_gfrt
122   } ffecomGfrt;
123
124 /* Typedefs. */
125
126 #ifndef TREE_CODE
127 #include "tree.h"
128 #endif
129
130 typedef tree ffecomConstant;
131 #define FFECOM_constantHOOK
132 typedef tree ffecomNonter;
133 #define FFECOM_nonterHOOK
134 typedef tree ffecomLabel;
135 #define FFECOM_globalHOOK
136 typedef tree ffecomGlobal;
137 #define FFECOM_labelHOOK
138 typedef tree ffecomStorage;
139 #define FFECOM_storageHOOK
140 typedef struct _ffecom_symbol_ ffecomSymbol;
141 #define FFECOM_symbolHOOK
142
143 struct _ffecom_symbol_
144   {
145     tree decl_tree;
146     tree length_tree;           /* For CHARACTER dummies. */
147     tree vardesc_tree;          /* For NAMELIST. */
148     tree assign_tree;           /* For ASSIGN'ed vars. */
149     bool addr;                  /* Is address of item instead of item. */
150   };
151
152 /* Include files needed by this one. */
153
154 #include "bld.h"
155 #include "info.h"
156 #include "lab.h"
157 #include "storag.h"
158 #include "symbol.h"
159
160 /* Structure definitions. */
161
162
163 /* Global objects accessed by users of this module. */
164
165 extern tree string_type_node;
166 extern tree ffecom_integer_type_node;
167 extern tree ffecom_integer_zero_node;
168 extern tree ffecom_integer_one_node;
169 extern tree ffecom_tree_type[FFEINFO_basictype][FFEINFO_kindtype];
170 extern ffecomSymbol ffecom_symbol_null_;
171 extern ffeinfoKindtype ffecom_pointer_kind_;
172 extern ffeinfoKindtype ffecom_label_kind_;
173
174 extern int ffecom_f2c_typecode_[FFEINFO_basictype][FFEINFO_kindtype];
175 extern tree ffecom_f2c_integer_type_node;
176 extern tree ffecom_f2c_address_type_node;
177 extern tree ffecom_f2c_real_type_node;
178 extern tree ffecom_f2c_doublereal_type_node;
179 extern tree ffecom_f2c_complex_type_node;
180 extern tree ffecom_f2c_doublecomplex_type_node;
181 extern tree ffecom_f2c_longint_type_node;
182 extern tree ffecom_f2c_logical_type_node;
183 extern tree ffecom_f2c_flag_type_node;
184 extern tree ffecom_f2c_ftnlen_type_node;
185 extern tree ffecom_f2c_ftnlen_zero_node;
186 extern tree ffecom_f2c_ftnlen_one_node;
187 extern tree ffecom_f2c_ftnlen_two_node;
188 extern tree ffecom_f2c_ptr_to_ftnlen_type_node;
189 extern tree ffecom_f2c_ftnint_type_node;
190 extern tree ffecom_f2c_ptr_to_ftnint_type_node;
191
192 /* Declare functions with prototypes. */
193
194 tree ffecom_1 (enum tree_code code, tree type, tree node);
195 tree ffecom_1_fn (tree node);
196 tree ffecom_2 (enum tree_code code, tree type, tree node1, tree node2);
197 bool ffecom_2pass_advise_entrypoint (ffesymbol entry);
198 void ffecom_2pass_do_entrypoint (ffesymbol entry);
199 tree ffecom_2s (enum tree_code code, tree type, tree node1, tree node2);
200 tree ffecom_3 (enum tree_code code, tree type, tree node1, tree node2,
201                tree node3);
202 tree ffecom_3s (enum tree_code code, tree type, tree node1, tree node2,
203                 tree node3);
204 tree ffecom_arg_expr (ffebld expr, tree *length);
205 tree ffecom_arg_ptr_to_const_expr (ffebld expr, tree *length);
206 tree ffecom_arg_ptr_to_expr (ffebld expr, tree *length);
207 tree ffecom_call_gfrt (ffecomGfrt ix, tree args, tree hook);
208 tree ffecom_constantunion (ffebldConstantUnion *cu, ffeinfoBasictype bt,
209                            ffeinfoKindtype kt, tree tree_type);
210 tree ffecom_const_expr (ffebld expr);
211 tree ffecom_decl_field (tree context, tree prevfield, const char *name,
212                         tree type);
213 void ffecom_close_include (FILE *f);
214 int ffecom_decode_include_option (char *spec);
215 tree ffecom_end_compstmt (void);
216 void ffecom_end_transition (void);
217 void ffecom_exec_transition (void);
218 void ffecom_expand_let_stmt (ffebld dest, ffebld source);
219 tree ffecom_expr (ffebld expr);
220 tree ffecom_expr_assign (ffebld expr);
221 tree ffecom_expr_assign_w (ffebld expr);
222 tree ffecom_expr_rw (tree type, ffebld expr);
223 tree ffecom_expr_w (tree type, ffebld expr);
224 void ffecom_finish_compile (void);
225 void ffecom_finish_decl (tree decl, tree init, bool is_top_level);
226 void ffecom_finish_progunit (void);
227 tree ffecom_get_invented_identifier (const char *pattern, ...)
228   ATTRIBUTE_PRINTF_1;
229 ffeinfoKindtype ffecom_gfrt_basictype (ffecomGfrt ix);
230 ffeinfoKindtype ffecom_gfrt_kindtype (ffecomGfrt ix);
231 void ffecom_init_0 (void);
232 void ffecom_init_2 (void);
233 tree ffecom_list_expr (ffebld list);
234 tree ffecom_list_ptr_to_expr (ffebld list);
235 tree ffecom_lookup_label (ffelab label);
236 tree ffecom_make_tempvar (const char *commentary, tree type,
237                           ffetargetCharacterSize size, int elements);
238 tree ffecom_modify (tree newtype, tree lhs, tree rhs);
239 void ffecom_save_tree_forever (tree t);
240 void ffecom_file (const char *name);
241 void ffecom_notify_init_storage (ffestorag st);
242 void ffecom_notify_init_symbol (ffesymbol s);
243 void ffecom_notify_primary_entry (ffesymbol fn);
244 FILE *ffecom_open_include (char *name, ffewhereLine l, ffewhereColumn c);
245 void ffecom_prepare_arg_ptr_to_expr (ffebld expr);
246 bool ffecom_prepare_end (void);
247 void ffecom_prepare_expr_ (ffebld expr, ffebld dest);
248 void ffecom_prepare_expr_rw (tree type, ffebld expr);
249 void ffecom_prepare_expr_w (tree type, ffebld expr);
250 void ffecom_prepare_ptr_to_expr (ffebld expr);
251 void ffecom_prepare_return_expr (ffebld expr);
252 tree ffecom_ptr_to_const_expr (ffebld expr);
253 tree ffecom_ptr_to_expr (ffebld expr);
254 tree ffecom_return_expr (ffebld expr);
255 tree ffecom_save_tree (tree t);
256 void ffecom_start_compstmt (void);
257 tree ffecom_start_decl (tree decl, bool is_init);
258 void ffecom_sym_commit (ffesymbol s);
259 ffesymbol ffecom_sym_end_transition (ffesymbol s);
260 ffesymbol ffecom_sym_exec_transition (ffesymbol s);
261 ffesymbol ffecom_sym_learned (ffesymbol s);
262 void ffecom_sym_retract (ffesymbol s);
263 tree ffecom_temp_label (void);
264 tree ffecom_truth_value (tree expr);
265 tree ffecom_truth_value_invert (tree expr);
266 tree ffecom_type_expr (ffebld expr);
267 tree ffecom_which_entrypoint_decl (void);
268
269 /* Define macros. */
270
271 #define ffecom_f2c_typecode(bt,kt) ffecom_f2c_typecode_[(bt)][(kt)]
272 #define ffecom_label_kind() ffecom_label_kind_
273 #define ffecom_pointer_kind() ffecom_pointer_kind_
274 #define ffecom_prepare_expr(e) ffecom_prepare_expr_ ((e), NULL)
275
276 #define ffecom_init_1()
277 #define ffecom_init_3()
278 #define ffecom_init_4()
279 #define ffecom_terminate_0()
280 #define ffecom_terminate_1()
281 #define ffecom_terminate_2()
282 #define ffecom_terminate_3()
283 #define ffecom_terminate_4()
284
285 /* End of #include file. */
286
287 #endif /* ! GCC_F_COM_H */