* decl.c (cplus_expand_expr_stmt): Don't call break_out_cleanups
[official-gcc.git] / gcc / f / com.h
blobb5e77149c0d50605dbbcf79e7b3254dfc04dcc54
1 /* com.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 com.c
25 Modifications:
28 /* Allow multiple inclusion to work. */
30 #ifndef _H_f_com
31 #define _H_f_com
33 /* Simple definitions and enumerations. */
35 #define FFECOM_dimensionsMAX 7 /* Max # dimensions (quick hack). */
37 #define FFECOM_targetFFE 1
38 #define FFECOM_targetGCC 2
40 #ifndef FFE_STANDALONE
41 #define FFECOM_targetCURRENT FFECOM_targetGCC /* Backend! */
42 #define FFECOM_ONEPASS 0
43 #else
44 #define FFECOM_targetCURRENT FFECOM_targetFFE
45 #define FFECOM_ONEPASS 0
46 #endif
48 #if FFECOM_ONEPASS
49 #define FFECOM_TWOPASS 0
50 #else
51 #define FFECOM_TWOPASS 1
52 #endif
54 #define FFECOM_SIZE_UNIT "byte" /* Singular form. */
55 #define FFECOM_SIZE_UNITS "bytes" /* Plural form. */
57 #if FFECOM_targetCURRENT == FFECOM_targetGCC
58 #define FFECOM_constantNULL NULL_TREE
59 #define FFECOM_nonterNULL NULL_TREE
60 #define FFECOM_globalNULL NULL_TREE
61 #define FFECOM_labelNULL NULL_TREE
62 #define FFECOM_storageNULL NULL_TREE
63 #define FFECOM_symbolNULL ffecom_symbol_null_
65 /* Shorthand for types used in f2c.h and that g77 perhaps allows some
66 flexibility regarding in the section below. I.e. the actual numbers
67 below aren't important, as long as they're unique. */
69 #define FFECOM_f2ccodeCHAR 1
70 #define FFECOM_f2ccodeSHORT 2
71 #define FFECOM_f2ccodeINT 3
72 #define FFECOM_f2ccodeLONG 4
73 #define FFECOM_f2ccodeLONGLONG 5
74 #define FFECOM_f2ccodeCHARPTR 6 /* char * */
75 #define FFECOM_f2ccodeFLOAT 7
76 #define FFECOM_f2ccodeDOUBLE 8
77 #define FFECOM_f2ccodeLONGDOUBLE 9
78 #define FFECOM_f2ccodeTWOREALS 10
79 #define FFECOM_f2ccodeTWODOUBLEREALS 11
81 #if FFECOM_DETERMINE_TYPES /* only for com.c and configure */
83 /* Begin f2c.h information. This must match the info in the f2c.h used
84 to build the libf2c with which g77-generated code is linked, or there
85 will probably be bugs, some of them difficult to detect or even trigger. */
87 /* Do we need int (for 32-bit or 64-bit systems) or long (16-bit or
88 normally 32-bit) for f2c-type integers? */
90 #ifndef BITS_PER_WORD
91 #define BITS_PER_WORD 32
92 #endif
94 #ifndef CHAR_TYPE_SIZE
95 #define CHAR_TYPE_SIZE BITS_PER_UNIT
96 #endif
98 #ifndef SHORT_TYPE_SIZE
99 #define SHORT_TYPE_SIZE (BITS_PER_UNIT * MIN ((UNITS_PER_WORD + 1) / 2, 2))
100 #endif
102 #ifndef INT_TYPE_SIZE
103 #define INT_TYPE_SIZE BITS_PER_WORD
104 #endif
106 #ifndef LONG_TYPE_SIZE
107 #define LONG_TYPE_SIZE BITS_PER_WORD
108 #endif
110 #ifndef LONG_LONG_TYPE_SIZE
111 #define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2)
112 #endif
114 #ifndef WCHAR_UNSIGNED
115 #define WCHAR_UNSIGNED 0
116 #endif
118 #ifndef FLOAT_TYPE_SIZE
119 #define FLOAT_TYPE_SIZE BITS_PER_WORD
120 #endif
122 #ifndef DOUBLE_TYPE_SIZE
123 #define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
124 #endif
126 #ifndef LONG_DOUBLE_TYPE_SIZE
127 #define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
128 #endif
130 #if LONG_TYPE_SIZE == FLOAT_TYPE_SIZE
131 # define FFECOM_f2cINTEGER FFECOM_f2ccodeLONG
132 # define FFECOM_f2cLOGICAL FFECOM_f2ccodeLONG
133 #elif INT_TYPE_SIZE == FLOAT_TYPE_SIZE
134 # define FFECOM_f2cINTEGER FFECOM_f2ccodeINT
135 # define FFECOM_f2cLOGICAL FFECOM_f2ccodeINT
136 #else
137 # error Cannot find a suitable type for FFECOM_f2cINTEGER
138 #endif
140 #if LONG_TYPE_SIZE == (FLOAT_TYPE_SIZE * 2)
141 # define FFECOM_f2cLONGINT FFECOM_f2ccodeLONG
142 #elif LONG_LONG_TYPE_SIZE == (FLOAT_TYPE_SIZE * 2)
143 # define FFECOM_f2cLONGINT FFECOM_f2ccodeLONGLONG
144 #else
145 # error Cannot find a suitable type for FFECOM_f2cLONGINT
146 #endif
148 #define FFECOM_f2cADDRESS FFECOM_f2ccodeCHARPTR
149 #define FFECOM_f2cSHORTINT FFECOM_f2ccodeSHORT
150 #define FFECOM_f2cREAL FFECOM_f2ccodeFLOAT
151 #define FFECOM_f2cDOUBLEREAL FFECOM_f2ccodeDOUBLE
152 #define FFECOM_f2cCOMPLEX FFECOM_f2ccodeTWOREALS
153 #define FFECOM_f2cDOUBLECOMPLEX FFECOM_f2ccodeTWODOUBLEREALS
154 #define FFECOM_f2cSHORTLOGICAL FFECOM_f2ccodeSHORT
155 #define FFECOM_f2cLOGICAL1 FFECOM_f2ccodeCHAR
156 #define FFECOM_f2cINTEGER1 FFECOM_f2ccodeCHAR
158 /* These must be f2c's INTEGER type, to match runtime/f2c.h.in. */
160 #define FFECOM_f2cFLAG FFECOM_f2cINTEGER
161 #define FFECOM_f2cFTNINT FFECOM_f2cINTEGER
162 #define FFECOM_f2cFTNLEN FFECOM_f2cINTEGER
164 #endif /* #if FFECOM_DETERMINE_TYPES */
166 /* Everything else in f2c.h, specifically the structures used in
167 interfacing compiled code with the library, must remain exactly
168 as delivered, or g77 internals (mostly com.c and ste.c) must
169 be modified accordingly to compensate. Or there will be...trouble. */
171 typedef enum
173 #define DEFGFRT(CODE,NAME,TYPE,ARGS,VOLATILE,COMPLEX) CODE,
174 #include "com-rt.def"
175 #undef DEFGFRT
176 FFECOM_gfrt
177 } ffecomGfrt;
179 #endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */
181 /* Typedefs. */
183 #if FFECOM_targetCURRENT == FFECOM_targetGCC
184 #ifndef TREE_CODE
185 #include "tree.j"
186 #endif
188 #ifndef BUILT_FOR_270
189 #ifdef DECL_STATIC_CONSTRUCTOR /* In gcc/tree.h. */
190 #define BUILT_FOR_270 1
191 #else
192 #define BUILT_FOR_270 0
193 #endif
194 #endif /* !defined (BUILT_FOR_270) */
196 #ifndef BUILT_FOR_280
197 #ifdef DECL_ONE_ONLY /* In gcc/tree.h. */
198 #define BUILT_FOR_280 1
199 #else
200 #define BUILT_FOR_280 0
201 #endif
202 #endif /* !defined (BUILT_FOR_280) */
204 typedef tree ffecomConstant;
205 #define FFECOM_constantHOOK
206 typedef tree ffecomNonter;
207 #define FFECOM_nonterHOOK
208 typedef tree ffecomLabel;
209 #define FFECOM_globalHOOK
210 typedef tree ffecomGlobal;
211 #define FFECOM_labelHOOK
212 typedef tree ffecomStorage;
213 #define FFECOM_storageHOOK
214 typedef struct _ffecom_symbol_ ffecomSymbol;
215 #define FFECOM_symbolHOOK
217 struct _ffecom_symbol_
219 tree decl_tree;
220 tree length_tree; /* For CHARACTER dummies. */
221 tree vardesc_tree; /* For NAMELIST. */
222 tree assign_tree; /* For ASSIGN'ed vars. */
223 bool addr; /* Is address of item instead of item. */
225 #endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */
227 /* Include files needed by this one. */
229 #include "bld.h"
230 #include "info.h"
231 #include "lab.h"
232 #include "storag.h"
233 #include "symbol.h"
235 /* Structure definitions. */
238 /* Global objects accessed by users of this module. */
240 #if FFECOM_targetCURRENT == FFECOM_targetGCC
241 extern tree string_type_node;
242 extern tree ffecom_integer_type_node;
243 extern tree ffecom_integer_zero_node;
244 extern tree ffecom_integer_one_node;
245 extern tree ffecom_tree_type[FFEINFO_basictype][FFEINFO_kindtype];
246 extern ffecomSymbol ffecom_symbol_null_;
247 extern ffeinfoKindtype ffecom_pointer_kind_;
248 extern ffeinfoKindtype ffecom_label_kind_;
250 extern int ffecom_f2c_typecode_[FFEINFO_basictype][FFEINFO_kindtype];
251 extern tree ffecom_f2c_integer_type_node;
252 extern tree ffecom_f2c_address_type_node;
253 extern tree ffecom_f2c_real_type_node;
254 extern tree ffecom_f2c_doublereal_type_node;
255 extern tree ffecom_f2c_complex_type_node;
256 extern tree ffecom_f2c_doublecomplex_type_node;
257 extern tree ffecom_f2c_longint_type_node;
258 extern tree ffecom_f2c_logical_type_node;
259 extern tree ffecom_f2c_flag_type_node;
260 extern tree ffecom_f2c_ftnlen_type_node;
261 extern tree ffecom_f2c_ftnlen_zero_node;
262 extern tree ffecom_f2c_ftnlen_one_node;
263 extern tree ffecom_f2c_ftnlen_two_node;
264 extern tree ffecom_f2c_ptr_to_ftnlen_type_node;
265 extern tree ffecom_f2c_ftnint_type_node;
266 extern tree ffecom_f2c_ptr_to_ftnint_type_node;
267 #endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */
269 /* Declare functions with prototypes. */
271 #if FFECOM_targetCURRENT == FFECOM_targetGCC
272 tree ffecom_1 (enum tree_code code, tree type, tree node);
273 tree ffecom_1_fn (tree node);
274 tree ffecom_2 (enum tree_code code, tree type, tree node1, tree node2);
275 bool ffecom_2pass_advise_entrypoint (ffesymbol entry);
276 void ffecom_2pass_do_entrypoint (ffesymbol entry);
277 tree ffecom_2s (enum tree_code code, tree type, tree node1, tree node2);
278 tree ffecom_3 (enum tree_code code, tree type, tree node1, tree node2,
279 tree node3);
280 tree ffecom_3s (enum tree_code code, tree type, tree node1, tree node2,
281 tree node3);
282 tree ffecom_arg_expr (ffebld expr, tree *length);
283 tree ffecom_arg_ptr_to_const_expr (ffebld expr, tree *length);
284 tree ffecom_arg_ptr_to_expr (ffebld expr, tree *length);
285 tree ffecom_call_gfrt (ffecomGfrt ix, tree args, tree hook);
286 tree ffecom_constantunion (ffebldConstantUnion *cu, ffeinfoBasictype bt,
287 ffeinfoKindtype kt, tree tree_type);
288 tree ffecom_const_expr (ffebld expr);
289 tree ffecom_decl_field (tree context, tree prevfield, const char *name,
290 tree type);
291 #endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */
292 void ffecom_close_include (FILE *f);
293 int ffecom_decode_include_option (char *spec);
294 #if FFECOM_targetCURRENT == FFECOM_targetGCC
295 tree ffecom_end_compstmt (void);
296 #endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */
297 void ffecom_end_transition (void);
298 void ffecom_exec_transition (void);
299 void ffecom_expand_let_stmt (ffebld dest, ffebld source);
300 #if FFECOM_targetCURRENT == FFECOM_targetGCC
301 tree ffecom_expr (ffebld expr);
302 tree ffecom_expr_assign (ffebld expr);
303 tree ffecom_expr_assign_w (ffebld expr);
304 tree ffecom_expr_rw (tree type, ffebld expr);
305 tree ffecom_expr_w (tree type, ffebld expr);
306 void ffecom_finish_compile (void);
307 void ffecom_finish_decl (tree decl, tree init, bool is_top_level);
308 void ffecom_finish_progunit (void);
309 tree ffecom_get_invented_identifier (const char *pattern, const char *text,
310 int number);
311 ffeinfoKindtype ffecom_gfrt_basictype (ffecomGfrt ix);
312 ffeinfoKindtype ffecom_gfrt_kindtype (ffecomGfrt ix);
313 void ffecom_init_0 (void);
314 void ffecom_init_2 (void);
315 tree ffecom_list_expr (ffebld list);
316 tree ffecom_list_ptr_to_expr (ffebld list);
317 tree ffecom_lookup_label (ffelab label);
318 tree ffecom_make_tempvar (const char *commentary, tree type,
319 ffetargetCharacterSize size, int elements);
320 tree ffecom_modify (tree newtype, tree lhs, tree rhs);
321 #endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */
322 void ffecom_file (char *name);
323 void ffecom_notify_init_storage (ffestorag st);
324 void ffecom_notify_init_symbol (ffesymbol s);
325 void ffecom_notify_primary_entry (ffesymbol fn);
326 FILE *ffecom_open_include (char *name, ffewhereLine l, ffewhereColumn c);
327 #if FFECOM_targetCURRENT == FFECOM_targetGCC
328 void ffecom_prepare_arg_ptr_to_expr (ffebld expr);
329 bool ffecom_prepare_end (void);
330 void ffecom_prepare_expr_ (ffebld expr, ffebld dest);
331 void ffecom_prepare_expr_rw (tree type, ffebld expr);
332 void ffecom_prepare_expr_w (tree type, ffebld expr);
333 void ffecom_prepare_ptr_to_expr (ffebld expr);
334 void ffecom_prepare_return_expr (ffebld expr);
335 tree ffecom_ptr_to_const_expr (ffebld expr);
336 tree ffecom_ptr_to_expr (ffebld expr);
337 tree ffecom_return_expr (ffebld expr);
338 tree ffecom_save_tree (tree t);
339 void ffecom_start_compstmt (void);
340 tree ffecom_start_decl (tree decl, bool is_init);
341 void ffecom_sym_commit (ffesymbol s);
342 #endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */
343 ffesymbol ffecom_sym_end_transition (ffesymbol s);
344 ffesymbol ffecom_sym_exec_transition (ffesymbol s);
345 ffesymbol ffecom_sym_learned (ffesymbol s);
346 #if FFECOM_targetCURRENT == FFECOM_targetGCC
347 void ffecom_sym_retract (ffesymbol s);
348 tree ffecom_temp_label (void);
349 tree ffecom_truth_value (tree expr);
350 tree ffecom_truth_value_invert (tree expr);
351 tree ffecom_type_expr (ffebld expr);
352 tree ffecom_which_entrypoint_decl (void);
354 /* These need to be in the front end with exactly these interfaces,
355 as they're called by the back end. */
357 int mark_addressable (tree expr);
358 #endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */
360 /* Define macros. */
362 #if FFECOM_targetCURRENT == FFECOM_targetFFE
363 #define ffecom_expr(e) (e)
364 #define ffecom_init_0()
365 #define ffecom_init_2()
366 #define ffecom_label_kind() FFEINFO_kindtypeINTEGERDEFAULT
367 #define ffecom_pointer_kind() FFEINFO_kindtypeINTEGERDEFAULT
368 #define ffecom_ptr_to_expr(e) (e)
369 #define ffecom_sym_commit(s)
370 #define ffecom_sym_retract(s)
371 #endif /* FFECOM_targetCURRENT == FFECOM_targetFFE */
373 #if FFECOM_targetCURRENT == FFECOM_targetGCC
374 #define ffecom_f2c_typecode(bt,kt) ffecom_f2c_typecode_[(bt)][(kt)]
375 #define ffecom_label_kind() ffecom_label_kind_
376 #define ffecom_pointer_kind() ffecom_pointer_kind_
377 #define ffecom_prepare_expr(e) ffecom_prepare_expr_ ((e), NULL)
378 #endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */
380 #define ffecom_init_1()
381 #define ffecom_init_3()
382 #define ffecom_init_4()
383 #define ffecom_terminate_0()
384 #define ffecom_terminate_1()
385 #define ffecom_terminate_2()
386 #define ffecom_terminate_3()
387 #define ffecom_terminate_4()
389 /* End of #include file. */
391 #endif