2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / f / com.h
blob4a120afde15f7dfe517c404d72e448cf4ab24910
1 /* com.h -- Public #include File (module.h template V1.0)
2 Copyright (C) 1995, 1996, 1997, 2000, 2003
3 Free Software Foundation, Inc.
4 Contributed by James Craig Burley.
6 This file is part of GNU Fortran.
8 GNU Fortran is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
13 GNU Fortran is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU Fortran; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
21 02111-1307, USA.
23 Owning Modules:
24 com.c
26 Modifications:
29 /* Allow multiple inclusion to work. */
31 #ifndef GCC_F_COM_H
32 #define GCC_F_COM_H
34 /* Simple definitions and enumerations. */
36 #define FFECOM_dimensionsMAX 7 /* Max # dimensions (quick hack). */
38 #define FFECOM_SIZE_UNIT "byte" /* Singular form. */
39 #define FFECOM_SIZE_UNITS "bytes" /* Plural form. */
41 #define FFECOM_constantNULL NULL_TREE
42 #define FFECOM_nonterNULL NULL_TREE
43 #define FFECOM_globalNULL NULL_TREE
44 #define FFECOM_labelNULL NULL_TREE
45 #define FFECOM_storageNULL NULL_TREE
46 #define FFECOM_symbolNULL ffecom_symbol_null_
48 /* Shorthand for types used in f2c.h and that g77 perhaps allows some
49 flexibility regarding in the section below. I.e. the actual numbers
50 below aren't important, as long as they're unique. */
52 #define FFECOM_f2ccodeCHAR 1
53 #define FFECOM_f2ccodeSHORT 2
54 #define FFECOM_f2ccodeINT 3
55 #define FFECOM_f2ccodeLONG 4
56 #define FFECOM_f2ccodeLONGLONG 5
57 #define FFECOM_f2ccodeCHARPTR 6 /* char * */
58 #define FFECOM_f2ccodeFLOAT 7
59 #define FFECOM_f2ccodeDOUBLE 8
60 #define FFECOM_f2ccodeLONGDOUBLE 9
61 #define FFECOM_f2ccodeTWOREALS 10
62 #define FFECOM_f2ccodeTWODOUBLEREALS 11
64 #if FFECOM_DETERMINE_TYPES /* only for com.c and configure */
66 /* Begin f2c.h information. This must match the info in the f2c.h used
67 to build the libf2c with which g77-generated code is linked, or there
68 will probably be bugs, some of them difficult to detect or even trigger. */
70 /* The C front-end provides __g77_integer and __g77_uinteger types so that
71 the appropriately-sized signed and unsigned integer types are available
72 for libf2c. If you change this, also the definitions of those types
73 in ../c-decl.c. */
74 #define FFECOM_f2cINTEGER \
75 (LONG_TYPE_SIZE == FLOAT_TYPE_SIZE \
76 ? FFECOM_f2ccodeLONG \
77 : (INT_TYPE_SIZE == FLOAT_TYPE_SIZE \
78 ? FFECOM_f2ccodeINT \
79 : (abort (), -1)))
81 #define FFECOM_f2cLOGICAL FFECOM_f2cINTEGER
83 /* The C front-end provides __g77_longint and __g77_ulongint types so that
84 the appropriately-sized signed and unsigned integer types are available
85 for libf2c. If you change this, also the definitions of those types
86 in ../c-decl.c. */
87 #define FFECOM_f2cLONGINT \
88 (LONG_TYPE_SIZE == (FLOAT_TYPE_SIZE * 2) \
89 ? FFECOM_f2ccodeLONG \
90 : (LONG_LONG_TYPE_SIZE == (FLOAT_TYPE_SIZE * 2) \
91 ? FFECOM_f2ccodeLONGLONG \
92 : (abort (), -1)))
94 #define FFECOM_f2cADDRESS FFECOM_f2ccodeCHARPTR
95 #define FFECOM_f2cSHORTINT FFECOM_f2ccodeSHORT
96 #define FFECOM_f2cREAL FFECOM_f2ccodeFLOAT
97 #define FFECOM_f2cDOUBLEREAL FFECOM_f2ccodeDOUBLE
98 #define FFECOM_f2cCOMPLEX FFECOM_f2ccodeTWOREALS
99 #define FFECOM_f2cDOUBLECOMPLEX FFECOM_f2ccodeTWODOUBLEREALS
100 #define FFECOM_f2cSHORTLOGICAL FFECOM_f2ccodeSHORT
101 #define FFECOM_f2cLOGICAL1 FFECOM_f2ccodeCHAR
102 #define FFECOM_f2cINTEGER1 FFECOM_f2ccodeCHAR
104 /* These must be f2c's INTEGER type, to match runtime/f2c.h.in. */
106 #define FFECOM_f2cFLAG FFECOM_f2cINTEGER
107 #define FFECOM_f2cFTNINT FFECOM_f2cINTEGER
108 #define FFECOM_f2cFTNLEN FFECOM_f2cINTEGER
110 #endif /* #if FFECOM_DETERMINE_TYPES */
112 /* Everything else in f2c.h, specifically the structures used in
113 interfacing compiled code with the library, must remain exactly
114 as delivered, or g77 internals (mostly com.c and ste.c) must
115 be modified accordingly to compensate. Or there will be...trouble. */
117 typedef enum
119 #define DEFGFRT(CODE,NAME,TYPE,ARGS,VOLATILE,COMPLEX,CONST) CODE,
120 #include "com-rt.def"
121 #undef DEFGFRT
122 FFECOM_gfrt
123 } ffecomGfrt;
125 /* Typedefs. */
127 #ifndef TREE_CODE
128 #include "tree.h"
129 #endif
131 typedef tree ffecomConstant;
132 typedef tree ffecomNonter;
133 typedef tree ffecomLabel;
134 typedef tree ffecomGlobal;
135 typedef tree ffecomStorage;
136 typedef struct _ffecom_symbol_ ffecomSymbol;
138 struct _ffecom_symbol_
140 tree decl_tree;
141 tree length_tree; /* For CHARACTER dummies. */
142 tree vardesc_tree; /* For NAMELIST. */
143 tree assign_tree; /* For ASSIGN'ed vars. */
144 bool addr; /* Is address of item instead of item. */
147 /* Include files needed by this one. */
149 #include "bld.h"
150 #include "info.h"
151 #include "lab.h"
152 #include "storag.h"
153 #include "symbol.h"
155 extern int global_bindings_p (void);
156 extern tree getdecls (void);
157 extern void pushlevel (int);
158 extern tree poplevel (int,int, int);
159 extern void insert_block (tree);
160 extern void set_block (tree);
161 extern tree pushdecl (tree);
163 /* Global objects accessed by users of this module. */
165 extern GTY(()) tree string_type_node;
166 extern GTY(()) tree ffecom_integer_type_node;
167 extern GTY(()) tree ffecom_integer_zero_node;
168 extern GTY(()) tree ffecom_integer_one_node;
169 extern GTY(()) 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_;
174 extern int ffecom_f2c_typecode_[FFEINFO_basictype][FFEINFO_kindtype];
175 extern GTY(()) tree ffecom_f2c_integer_type_node;
176 extern GTY(()) tree ffecom_f2c_address_type_node;
177 extern GTY(()) tree ffecom_f2c_real_type_node;
178 extern GTY(()) tree ffecom_f2c_doublereal_type_node;
179 extern GTY(()) tree ffecom_f2c_complex_type_node;
180 extern GTY(()) tree ffecom_f2c_doublecomplex_type_node;
181 extern GTY(()) tree ffecom_f2c_longint_type_node;
182 extern GTY(()) tree ffecom_f2c_logical_type_node;
183 extern GTY(()) tree ffecom_f2c_flag_type_node;
184 extern GTY(()) tree ffecom_f2c_ftnlen_type_node;
185 extern GTY(()) tree ffecom_f2c_ftnlen_zero_node;
186 extern GTY(()) tree ffecom_f2c_ftnlen_one_node;
187 extern GTY(()) tree ffecom_f2c_ftnlen_two_node;
188 extern GTY(()) tree ffecom_f2c_ptr_to_ftnlen_type_node;
189 extern GTY(()) tree ffecom_f2c_ftnint_type_node;
190 extern GTY(()) tree ffecom_f2c_ptr_to_ftnint_type_node;
192 /* Declare functions with prototypes. */
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_with_type (ffebldConstantUnion *cu,
209 tree tree_type,ffebldConst ct);
210 tree ffecom_constantunion (ffebldConstantUnion *cu, ffeinfoBasictype bt,
211 ffeinfoKindtype kt, tree tree_type);
212 tree ffecom_const_expr (ffebld expr);
213 tree ffecom_decl_field (tree context, tree prevfield, const char *name,
214 tree type);
215 void ffecom_close_include (FILE *f);
216 void ffecom_decode_include_option (const char *dir);
217 tree ffecom_end_compstmt (void);
218 void ffecom_end_transition (void);
219 void ffecom_exec_transition (void);
220 void ffecom_expand_let_stmt (ffebld dest, ffebld source);
221 tree ffecom_expr (ffebld expr);
222 tree ffecom_expr_assign (ffebld expr);
223 tree ffecom_expr_assign_w (ffebld expr);
224 tree ffecom_expr_rw (tree type, ffebld expr);
225 tree ffecom_expr_w (tree type, ffebld expr);
226 void ffecom_finish_compile (void);
227 void ffecom_finish_decl (tree decl, tree init, bool is_top_level);
228 void ffecom_finish_progunit (void);
229 tree ffecom_get_invented_identifier (const char *pattern, ...)
230 ATTRIBUTE_PRINTF_1;
231 ffeinfoKindtype ffecom_gfrt_basictype (ffecomGfrt ix);
232 ffeinfoKindtype ffecom_gfrt_kindtype (ffecomGfrt ix);
233 void ffecom_init_0 (void);
234 void ffecom_init_2 (void);
235 tree ffecom_list_expr (ffebld list);
236 tree ffecom_list_ptr_to_expr (ffebld list);
237 tree ffecom_lookup_label (ffelab label);
238 tree ffecom_make_tempvar (const char *commentary, tree type,
239 ffetargetCharacterSize size, int elements);
240 tree ffecom_modify (tree newtype, tree lhs, tree rhs);
241 void ffecom_save_tree_forever (tree t);
242 void ffecom_file (const char *name);
243 void ffecom_notify_init_storage (ffestorag st);
244 void ffecom_notify_init_symbol (ffesymbol s);
245 void ffecom_notify_primary_entry (ffesymbol fn);
246 FILE *ffecom_open_include (char *name, ffewhereLine l, ffewhereColumn c);
247 void ffecom_prepare_arg_ptr_to_expr (ffebld expr);
248 bool ffecom_prepare_end (void);
249 void ffecom_prepare_expr_ (ffebld expr, ffebld dest);
250 void ffecom_prepare_expr_rw (tree type, ffebld expr);
251 void ffecom_prepare_expr_w (tree type, ffebld expr);
252 void ffecom_prepare_ptr_to_expr (ffebld expr);
253 void ffecom_prepare_return_expr (ffebld expr);
254 tree ffecom_ptr_to_const_expr (ffebld expr);
255 tree ffecom_ptr_to_expr (ffebld expr);
256 tree ffecom_return_expr (ffebld expr);
257 tree ffecom_save_tree (tree t);
258 void ffecom_start_compstmt (void);
259 tree ffecom_start_decl (tree decl, bool is_init);
260 void ffecom_sym_commit (ffesymbol s);
261 ffesymbol ffecom_sym_end_transition (ffesymbol s);
262 ffesymbol ffecom_sym_exec_transition (ffesymbol s);
263 ffesymbol ffecom_sym_learned (ffesymbol s);
264 void ffecom_sym_retract (ffesymbol s);
265 tree ffecom_temp_label (void);
266 tree ffecom_truth_value (tree expr);
267 tree ffecom_truth_value_invert (tree expr);
268 tree ffecom_type_expr (ffebld expr);
269 tree ffecom_which_entrypoint_decl (void);
270 void ffe_parse_file (int);
272 /* Define macros. */
274 #define ffecom_f2c_typecode(bt,kt) ffecom_f2c_typecode_[(bt)][(kt)]
275 #define ffecom_label_kind() ffecom_label_kind_
276 #define ffecom_pointer_kind() ffecom_pointer_kind_
277 #define ffecom_prepare_expr(e) ffecom_prepare_expr_ ((e), NULL)
279 #define ffecom_init_1()
280 #define ffecom_init_3()
281 #define ffecom_init_4()
282 #define ffecom_terminate_0()
283 #define ffecom_terminate_1()
284 #define ffecom_terminate_2()
285 #define ffecom_terminate_3()
286 #define ffecom_terminate_4()
288 /* End of #include file. */
290 #endif /* ! GCC_F_COM_H */