]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/fortran/gfortran.h
Daily bump.
[thirdparty/gcc.git] / gcc / fortran / gfortran.h
CommitLineData
6de9cd9a 1/* gfortran header file
ec378180 2 Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation,
9fc4d79b 3 Inc.
6de9cd9a
DN
4 Contributed by Andy Vaught
5
9fc4d79b 6This file is part of GCC.
6de9cd9a 7
9fc4d79b
TS
8GCC is free software; you can redistribute it and/or modify it under
9the terms of the GNU General Public License as published by the Free
10Software Foundation; either version 2, or (at your option) any later
11version.
6de9cd9a 12
9fc4d79b
TS
13GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14WARRANTY; without even the implied warranty of MERCHANTABILITY or
15FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16for more details.
6de9cd9a
DN
17
18You should have received a copy of the GNU General Public License
9fc4d79b 19along with GCC; see the file COPYING. If not, write to the Free
ab57747b
KC
20Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
2102110-1301, USA. */
6de9cd9a
DN
22
23#ifndef GCC_GFORTRAN_H
24#define GCC_GFORTRAN_H
25
26/* It's probably insane to have this large of a header file, but it
27 seemed like everything had to be recompiled anyway when a change
28 was made to a header file, and there were ordering issues with
29 multiple header files. Besides, Microsoft's winnt.h was 250k last
30 time I looked, so by comparison this is perfectly reasonable. */
31
6de9cd9a
DN
32#include "system.h"
33#include "coretypes.h"
c8cc8542 34#include "input.h"
6de9cd9a
DN
35
36/* The following ifdefs are recommended by the autoconf documentation
37 for any code using alloca. */
38
39/* AIX requires this to be the first thing in the file. */
40#ifdef __GNUC__
41#else /* not __GNUC__ */
42#ifdef HAVE_ALLOCA_H
43#include <alloca.h>
44#else /* do not HAVE_ALLOCA_H */
45#ifdef _AIX
46#pragma alloca
47#else
48#ifndef alloca /* predefined by HP cc +Olibcalls */
49char *alloca ();
50#endif /* not predefined */
51#endif /* not _AIX */
52#endif /* do not HAVE_ALLOCA_H */
53#endif /* not __GNUC__ */
54
6de9cd9a
DN
55/* Major control parameters. */
56
6de9cd9a 57#define GFC_MAX_SYMBOL_LEN 63
6de9cd9a
DN
58#define GFC_MAX_LINE 132 /* Characters beyond this are not seen. */
59#define GFC_MAX_DIMENSIONS 7 /* Maximum dimensions in an array. */
60#define GFC_LETTERS 26 /* Number of letters in the alphabet. */
6de9cd9a
DN
61
62#define free(x) Use_gfc_free_instead_of_free()
63#define gfc_is_whitespace(c) ((c==' ') || (c=='\t'))
64
65#ifndef NULL
66#define NULL ((void *) 0)
67#endif
68
69/* Stringization. */
70#define stringize(x) expand_macro(x)
71#define expand_macro(x) # x
72
73/* For a the runtime library, a standard prefix is a requirement to
74 avoid cluttering the namespace with things nobody asked for. It's
75 ugly to look at and a pain to type when you add the prefix by hand,
76 so we hide it behind a macro. */
77#define PREFIX(x) "_gfortran_" x
5b200ac2 78#define PREFIX_LEN 10
6de9cd9a
DN
79
80/* Macro to initialize an mstring structure. */
81#define minit(s, t) { s, NULL, t }
82
83/* Structure for storing strings to be matched by gfc_match_string. */
84typedef struct
85{
86 const char *string;
87 const char *mp;
88 int tag;
89}
90mstring;
91
92
902c2ed4 93/* Flags to specify which standard/extension contains a feature. */
c0309c74
RS
94#define GFC_STD_LEGACY (1<<6) /* Backward compatibility. */
95#define GFC_STD_GNU (1<<5) /* GNU Fortran extension. */
96#define GFC_STD_F2003 (1<<4) /* New in F2003. */
f7b529fa 97/* Note that no features were obsoleted nor deleted in F2003. */
c0309c74
RS
98#define GFC_STD_F95 (1<<3) /* New in F95. */
99#define GFC_STD_F95_DEL (1<<2) /* Deleted in F95. */
100#define GFC_STD_F95_OBS (1<<1) /* Obsoleted in F95. */
101#define GFC_STD_F77 (1<<0) /* Up to and including F77. */
6de9cd9a
DN
102
103/*************************** Enums *****************************/
104
105/* The author remains confused to this day about the convention of
106 returning '0' for 'SUCCESS'... or was it the other way around? The
107 following enum makes things much more readable. We also start
108 values off at one instead of zero. */
109
110typedef enum
111{ SUCCESS = 1, FAILURE }
112try;
113
114/* Matchers return one of these three values. The difference between
115 MATCH_NO and MATCH_ERROR is that MATCH_ERROR means that a match was
116 successful, but that something non-syntactic is wrong and an error
117 has already been issued. */
118
119typedef enum
120{ MATCH_NO = 1, MATCH_YES, MATCH_ERROR }
121match;
122
123typedef enum
124{ FORM_FREE, FORM_FIXED, FORM_UNKNOWN }
125gfc_source_form;
126
127typedef enum
128{ BT_UNKNOWN = 1, BT_INTEGER, BT_REAL, BT_COMPLEX,
d3642f89 129 BT_LOGICAL, BT_CHARACTER, BT_DERIVED, BT_PROCEDURE, BT_HOLLERITH
6de9cd9a
DN
130}
131bt;
132
133/* Expression node types. */
134typedef enum
135{ EXPR_OP = 1, EXPR_FUNCTION, EXPR_CONSTANT, EXPR_VARIABLE,
136 EXPR_SUBSTRING, EXPR_STRUCTURE, EXPR_ARRAY, EXPR_NULL
137}
138expr_t;
139
140/* Array types. */
141typedef enum
142{ AS_EXPLICIT = 1, AS_ASSUMED_SHAPE, AS_DEFERRED,
143 AS_ASSUMED_SIZE, AS_UNKNOWN
144}
145array_type;
146
147typedef enum
148{ AR_FULL = 1, AR_ELEMENT, AR_SECTION, AR_UNKNOWN }
149ar_type;
150
151/* Statement label types. */
152typedef enum
153{ ST_LABEL_UNKNOWN = 1, ST_LABEL_TARGET,
154 ST_LABEL_BAD_TARGET, ST_LABEL_FORMAT
155}
156gfc_sl_type;
157
158/* Intrinsic operators. */
159typedef enum
160{ GFC_INTRINSIC_BEGIN = 0,
161 INTRINSIC_NONE = -1, INTRINSIC_UPLUS = GFC_INTRINSIC_BEGIN,
162 INTRINSIC_UMINUS, INTRINSIC_PLUS, INTRINSIC_MINUS, INTRINSIC_TIMES,
163 INTRINSIC_DIVIDE, INTRINSIC_POWER, INTRINSIC_CONCAT,
164 INTRINSIC_AND, INTRINSIC_OR, INTRINSIC_EQV, INTRINSIC_NEQV,
165 INTRINSIC_EQ, INTRINSIC_NE, INTRINSIC_GT, INTRINSIC_GE,
166 INTRINSIC_LT, INTRINSIC_LE, INTRINSIC_NOT, INTRINSIC_USER,
167 INTRINSIC_ASSIGN,
168 GFC_INTRINSIC_END /* Sentinel */
169}
170gfc_intrinsic_op;
171
172
173/* Strings for all intrinsic operators. */
174extern mstring intrinsic_operators[];
175
176
177/* This macro is the number of intrinsic operators that exist.
178 Assumptions are made about the numbering of the interface_op enums. */
179#define GFC_INTRINSIC_OPS GFC_INTRINSIC_END
180
181/* Arithmetic results. */
182typedef enum
f8e566e5 183{ ARITH_OK = 1, ARITH_OVERFLOW, ARITH_UNDERFLOW, ARITH_NAN,
0de27aac 184 ARITH_DIV0, ARITH_INCOMMENSURATE, ARITH_ASYMMETRIC
6de9cd9a
DN
185}
186arith;
187
188/* Statements. */
189typedef enum
190{
191 ST_ARITHMETIC_IF, ST_ALLOCATE, ST_ATTR_DECL, ST_BACKSPACE, ST_BLOCK_DATA,
192 ST_CALL, ST_CASE, ST_CLOSE, ST_COMMON, ST_CONTINUE, ST_CONTAINS, ST_CYCLE,
193 ST_DATA, ST_DATA_DECL, ST_DEALLOCATE, ST_DO, ST_ELSE, ST_ELSEIF,
194 ST_ELSEWHERE, ST_END_BLOCK_DATA, ST_ENDDO, ST_IMPLIED_ENDDO,
6403ec5f
JB
195 ST_END_FILE, ST_FLUSH, ST_END_FORALL, ST_END_FUNCTION, ST_ENDIF,
196 ST_END_INTERFACE, ST_END_MODULE, ST_END_PROGRAM, ST_END_SELECT,
197 ST_END_SUBROUTINE, ST_END_WHERE, ST_END_TYPE, ST_ENTRY, ST_EQUIVALENCE,
198 ST_EXIT, ST_FORALL, ST_FORALL_BLOCK, ST_FORMAT, ST_FUNCTION, ST_GOTO,
199 ST_IF_BLOCK, ST_IMPLICIT, ST_IMPLICIT_NONE, ST_INQUIRE, ST_INTERFACE,
200 ST_PARAMETER, ST_MODULE, ST_MODULE_PROC, ST_NAMELIST, ST_NULLIFY, ST_OPEN,
201 ST_PAUSE, ST_PRIVATE, ST_PROGRAM, ST_PUBLIC, ST_READ, ST_RETURN, ST_REWIND,
202 ST_STOP, ST_SUBROUTINE, ST_TYPE, ST_USE, ST_WHERE_BLOCK, ST_WHERE, ST_WRITE,
203 ST_ASSIGNMENT, ST_POINTER_ASSIGNMENT, ST_SELECT_CASE, ST_SEQUENCE,
204 ST_SIMPLE_IF, ST_STATEMENT_FUNCTION, ST_DERIVED_DECL, ST_LABEL_ASSIGNMENT,
205 ST_NONE
6de9cd9a
DN
206}
207gfc_statement;
208
209
210/* Types of interfaces that we can have. Assignment interfaces are
211 considered to be intrinsic operators. */
212typedef enum
213{
214 INTERFACE_NAMELESS = 1, INTERFACE_GENERIC,
215 INTERFACE_INTRINSIC_OP, INTERFACE_USER_OP
216}
217interface_type;
218
219/* Symbol flavors: these are all mutually exclusive.
220 10 elements = 4 bits. */
5f42ddb0 221typedef enum sym_flavor
6de9cd9a
DN
222{
223 FL_UNKNOWN = 0, FL_PROGRAM, FL_BLOCK_DATA, FL_MODULE, FL_VARIABLE,
224 FL_PARAMETER, FL_LABEL, FL_PROCEDURE, FL_DERIVED, FL_NAMELIST
225}
226sym_flavor;
227
228/* Procedure types. 7 elements = 3 bits. */
5f42ddb0 229typedef enum procedure_type
6de9cd9a
DN
230{ PROC_UNKNOWN, PROC_MODULE, PROC_INTERNAL, PROC_DUMMY,
231 PROC_INTRINSIC, PROC_ST_FUNCTION, PROC_EXTERNAL
232}
233procedure_type;
234
235/* Intent types. */
5f42ddb0 236typedef enum sym_intent
6de9cd9a
DN
237{ INTENT_UNKNOWN = 0, INTENT_IN, INTENT_OUT, INTENT_INOUT
238}
239sym_intent;
240
241/* Access types. */
5f42ddb0
KG
242typedef enum gfc_access
243{ ACCESS_UNKNOWN = 0, ACCESS_PUBLIC, ACCESS_PRIVATE
6de9cd9a
DN
244}
245gfc_access;
246
247/* Flags to keep track of where an interface came from.
248 4 elements = 2 bits. */
5f42ddb0 249typedef enum ifsrc
6de9cd9a
DN
250{ IFSRC_UNKNOWN = 0, IFSRC_DECL, IFSRC_IFBODY, IFSRC_USAGE
251}
252ifsrc;
253
254/* Strings for all symbol attributes. We use these for dumping the
255 parse tree, in error messages, and also when reading and writing
256 modules. In symbol.c. */
257extern const mstring flavors[];
258extern const mstring procedures[];
259extern const mstring intents[];
260extern const mstring access_types[];
261extern const mstring ifsrc_types[];
262
263/* Enumeration of all the generic intrinsic functions. Used by the
264 backend for identification of a function. */
265
266enum gfc_generic_isym_id
267{
268 /* GFC_ISYM_NONE is used for intrinsics which will never be seen by
269 the backend (eg. KIND). */
270 GFC_ISYM_NONE = 0,
271 GFC_ISYM_ABS,
272 GFC_ISYM_ACHAR,
273 GFC_ISYM_ACOS,
1e399e23 274 GFC_ISYM_ACOSH,
6de9cd9a
DN
275 GFC_ISYM_ADJUSTL,
276 GFC_ISYM_ADJUSTR,
277 GFC_ISYM_AIMAG,
278 GFC_ISYM_AINT,
279 GFC_ISYM_ALL,
280 GFC_ISYM_ALLOCATED,
281 GFC_ISYM_ANINT,
282 GFC_ISYM_ANY,
283 GFC_ISYM_ASIN,
1e399e23 284 GFC_ISYM_ASINH,
6de9cd9a
DN
285 GFC_ISYM_ASSOCIATED,
286 GFC_ISYM_ATAN,
1e399e23 287 GFC_ISYM_ATANH,
6de9cd9a 288 GFC_ISYM_ATAN2,
e8525382
SK
289 GFC_ISYM_J0,
290 GFC_ISYM_J1,
291 GFC_ISYM_JN,
292 GFC_ISYM_Y0,
293 GFC_ISYM_Y1,
294 GFC_ISYM_YN,
6de9cd9a
DN
295 GFC_ISYM_BTEST,
296 GFC_ISYM_CEILING,
297 GFC_ISYM_CHAR,
f77b6ca3 298 GFC_ISYM_CHDIR,
6de9cd9a 299 GFC_ISYM_CMPLX,
b41b2534 300 GFC_ISYM_COMMAND_ARGUMENT_COUNT,
6de9cd9a
DN
301 GFC_ISYM_CONJG,
302 GFC_ISYM_COS,
303 GFC_ISYM_COSH,
304 GFC_ISYM_COUNT,
305 GFC_ISYM_CSHIFT,
306 GFC_ISYM_DBLE,
307 GFC_ISYM_DIM,
308 GFC_ISYM_DOT_PRODUCT,
309 GFC_ISYM_DPROD,
310 GFC_ISYM_EOSHIFT,
e8525382
SK
311 GFC_ISYM_ERF,
312 GFC_ISYM_ERFC,
2bd74949 313 GFC_ISYM_ETIME,
6de9cd9a
DN
314 GFC_ISYM_EXP,
315 GFC_ISYM_EXPONENT,
316 GFC_ISYM_FLOOR,
df65f093 317 GFC_ISYM_FNUM,
6de9cd9a 318 GFC_ISYM_FRACTION,
df65f093 319 GFC_ISYM_FSTAT,
a8c60d7f 320 GFC_ISYM_GETCWD,
4c0c6b9f
SK
321 GFC_ISYM_GETGID,
322 GFC_ISYM_GETPID,
323 GFC_ISYM_GETUID,
f77b6ca3 324 GFC_ISYM_HOSTNM,
6de9cd9a
DN
325 GFC_ISYM_IACHAR,
326 GFC_ISYM_IAND,
b41b2534 327 GFC_ISYM_IARGC,
6de9cd9a
DN
328 GFC_ISYM_IBCLR,
329 GFC_ISYM_IBITS,
330 GFC_ISYM_IBSET,
331 GFC_ISYM_ICHAR,
332 GFC_ISYM_IEOR,
f77b6ca3 333 GFC_ISYM_IERRNO,
6de9cd9a
DN
334 GFC_ISYM_INDEX,
335 GFC_ISYM_INT,
336 GFC_ISYM_IOR,
2bd74949 337 GFC_ISYM_IRAND,
ae8b8789 338 GFC_ISYM_ISATTY,
6de9cd9a
DN
339 GFC_ISYM_ISHFT,
340 GFC_ISYM_ISHFTC,
f77b6ca3 341 GFC_ISYM_KILL,
6de9cd9a
DN
342 GFC_ISYM_LBOUND,
343 GFC_ISYM_LEN,
344 GFC_ISYM_LEN_TRIM,
f77b6ca3 345 GFC_ISYM_LINK,
6de9cd9a
DN
346 GFC_ISYM_LGE,
347 GFC_ISYM_LGT,
348 GFC_ISYM_LLE,
349 GFC_ISYM_LLT,
350 GFC_ISYM_LOG,
351 GFC_ISYM_LOG10,
352 GFC_ISYM_LOGICAL,
353 GFC_ISYM_MATMUL,
354 GFC_ISYM_MAX,
355 GFC_ISYM_MAXLOC,
356 GFC_ISYM_MAXVAL,
357 GFC_ISYM_MERGE,
358 GFC_ISYM_MIN,
359 GFC_ISYM_MINLOC,
360 GFC_ISYM_MINVAL,
361 GFC_ISYM_MOD,
362 GFC_ISYM_MODULO,
363 GFC_ISYM_NEAREST,
364 GFC_ISYM_NINT,
365 GFC_ISYM_NOT,
366 GFC_ISYM_PACK,
367 GFC_ISYM_PRESENT,
368 GFC_ISYM_PRODUCT,
2bd74949 369 GFC_ISYM_RAND,
6de9cd9a 370 GFC_ISYM_REAL,
f77b6ca3 371 GFC_ISYM_RENAME,
6de9cd9a
DN
372 GFC_ISYM_REPEAT,
373 GFC_ISYM_RESHAPE,
374 GFC_ISYM_RRSPACING,
375 GFC_ISYM_SCALE,
376 GFC_ISYM_SCAN,
2bd74949 377 GFC_ISYM_SECOND,
6de9cd9a
DN
378 GFC_ISYM_SET_EXPONENT,
379 GFC_ISYM_SHAPE,
380 GFC_ISYM_SI_KIND,
381 GFC_ISYM_SIGN,
382 GFC_ISYM_SIN,
383 GFC_ISYM_SINH,
384 GFC_ISYM_SIZE,
385 GFC_ISYM_SPACING,
386 GFC_ISYM_SPREAD,
387 GFC_ISYM_SQRT,
388 GFC_ISYM_SR_KIND,
df65f093 389 GFC_ISYM_STAT,
6de9cd9a 390 GFC_ISYM_SUM,
f77b6ca3 391 GFC_ISYM_SYMLNK,
5b1374e9 392 GFC_ISYM_SYSTEM,
6de9cd9a
DN
393 GFC_ISYM_TAN,
394 GFC_ISYM_TANH,
f77b6ca3
FXC
395 GFC_ISYM_TIME,
396 GFC_ISYM_TIME8,
6de9cd9a
DN
397 GFC_ISYM_TRANSFER,
398 GFC_ISYM_TRANSPOSE,
399 GFC_ISYM_TRIM,
400 GFC_ISYM_UBOUND,
d8fe26b2
SK
401 GFC_ISYM_UMASK,
402 GFC_ISYM_UNLINK,
6de9cd9a
DN
403 GFC_ISYM_UNPACK,
404 GFC_ISYM_VERIFY,
405 GFC_ISYM_CONVERSION
406};
407typedef enum gfc_generic_isym_id gfc_generic_isym_id;
408
409/************************* Structures *****************************/
410
411/* Symbol attribute structure. */
412typedef struct
413{
414 /* Variable attributes. */
415 unsigned allocatable:1, dimension:1, external:1, intrinsic:1,
416 optional:1, pointer:1, save:1, target:1,
3d79abbd 417 dummy:1, result:1, assign:1;
6de9cd9a
DN
418
419 unsigned data:1, /* Symbol is named in a DATA statement. */
420 use_assoc:1; /* Symbol has been use-associated. */
421
9056bd70 422 unsigned in_namelist:1, in_common:1;
6de9cd9a 423 unsigned function:1, subroutine:1, generic:1;
d1303acd
TS
424 unsigned implicit_type:1; /* Type defined via implicit rules. */
425 unsigned untyped:1; /* No implicit type could be found. */
6de9cd9a
DN
426
427 /* Function/subroutine attributes */
428 unsigned sequence:1, elemental:1, pure:1, recursive:1;
429 unsigned unmaskable:1, masked:1, contained:1;
430
fe58e076
TK
431 /* This is set if the subroutine doesn't return. Currently, this
432 is only possible for intrinsic subroutines. */
433 unsigned noreturn:1;
434
3d79abbd
PB
435 /* Set if this procedure is an alternate entry point. These procedures
436 don't have any code associated, and the backend will turn them into
437 thunks to the master function. */
438 unsigned entry:1;
8b67b708 439
3d79abbd
PB
440 /* Set if this is the master function for a procedure with multiple
441 entry points. */
442 unsigned entry_master:1;
8b67b708 443
d198b59a
JJ
444 /* Set if this is the master function for a function with multiple
445 entry points where characteristics of the entry points differ. */
446 unsigned mixed_entry_master:1;
3d79abbd 447
6de9cd9a
DN
448 /* Set if a function must always be referenced by an explicit interface. */
449 unsigned always_explicit:1;
450
451 /* Set if the symbol has been referenced in an expression. No further
452 modification of type or type parameters is permitted. */
453 unsigned referenced:1;
454
8b67b708
FXC
455 /* Set if the is the symbol for the main program. This is the least
456 cumbersome way to communicate this function property without
457 strcmp'ing with __MAIN everywhere. */
458 unsigned is_main_program:1;
459
6de9cd9a 460 /* Mutually exclusive multibit attributes. */
5f42ddb0
KG
461 ENUM_BITFIELD (gfc_access) access:2;
462 ENUM_BITFIELD (sym_intent) intent:2;
463 ENUM_BITFIELD (sym_flavor) flavor:4;
464 ENUM_BITFIELD (ifsrc) if_source:2;
6de9cd9a 465
5f42ddb0 466 ENUM_BITFIELD (procedure_type) proc:3;
6de9cd9a
DN
467
468}
469symbol_attribute;
470
471
d4fa05b9
TS
472/* The following three structures are used to identify a location in
473 the sources.
474
475 gfc_file is used to maintain a tree of the source files and how
476 they include each other
6de9cd9a 477
d4fa05b9
TS
478 gfc_linebuf holds a single line of source code and information
479 which file it resides in
6de9cd9a 480
d4fa05b9
TS
481 locus point to the sourceline and the character in the source
482 line.
483*/
6de9cd9a 484
d4fa05b9 485typedef struct gfc_file
6de9cd9a 486{
d4fa05b9
TS
487 struct gfc_file *included_by, *next, *up;
488 int inclusion_line, line;
489 char *filename;
490} gfc_file;
491
492typedef struct gfc_linebuf
493{
c8cc8542
PB
494#ifdef USE_MAPPED_LOCATION
495 source_location location;
496#else
d4fa05b9 497 int linenum;
c8cc8542 498#endif
d4fa05b9
TS
499 struct gfc_file *file;
500 struct gfc_linebuf *next;
501
ba1defa5
RG
502 int truncated;
503
4cdf7223 504 char line[1];
d4fa05b9 505} gfc_linebuf;
4cdf7223
PB
506
507#define gfc_linebuf_header_size (offsetof (gfc_linebuf, line))
508
d4fa05b9
TS
509typedef struct
510{
511 char *nextc;
512 gfc_linebuf *lb;
513} locus;
6de9cd9a 514
0ce0154c
KG
515/* In order for the "gfc" format checking to work correctly, you must
516 have declared a typedef locus first. */
517#if GCC_VERSION >= 4001
518#define ATTRIBUTE_GCC_GFC(m, n) __attribute__ ((__format__ (__gcc_gfc__, m, n))) ATTRIBUTE_NONNULL(m)
519#else
520#define ATTRIBUTE_GCC_GFC(m, n) ATTRIBUTE_NONNULL(m)
521#endif
522
6de9cd9a 523
6de9cd9a
DN
524extern int gfc_suppress_error;
525
526
527/* Character length structures hold the expression that gives the
528 length of a character variable. We avoid putting these into
529 gfc_typespec because doing so prevents us from doing structure
530 copies and forces us to deallocate any typespecs we create, as well
531 as structures that contain typespecs. They also can have multiple
532 character typespecs pointing to them.
533
534 These structures form a singly linked list within the current
535 namespace and are deallocated with the namespace. It is possible to
536 end up with gfc_charlen structures that have nothing pointing to them. */
537
538typedef struct gfc_charlen
539{
540 struct gfc_expr *length;
541 struct gfc_charlen *next;
542 tree backend_decl;
543}
544gfc_charlen;
545
546#define gfc_get_charlen() gfc_getmem(sizeof(gfc_charlen))
547
548/* Type specification structure. FIXME: derived and cl could be union??? */
549typedef struct
550{
551 bt type;
552 int kind;
553 struct gfc_symbol *derived;
554 gfc_charlen *cl; /* For character types only. */
555}
556gfc_typespec;
557
558/* Array specification. */
559typedef struct
560{
561 int rank; /* A rank of zero means that a variable is a scalar. */
562 array_type type;
563 struct gfc_expr *lower[GFC_MAX_DIMENSIONS], *upper[GFC_MAX_DIMENSIONS];
564}
565gfc_array_spec;
566
567#define gfc_get_array_spec() gfc_getmem(sizeof(gfc_array_spec))
568
569
570/* Components of derived types. */
571typedef struct gfc_component
572{
cb9e4f55 573 const char *name;
6de9cd9a
DN
574 gfc_typespec ts;
575
576 int pointer, dimension;
577 gfc_array_spec *as;
578
579 tree backend_decl;
580 locus loc;
581 struct gfc_expr *initializer;
582 struct gfc_component *next;
583}
584gfc_component;
585
586#define gfc_get_component() gfc_getmem(sizeof(gfc_component))
587
588/* Formal argument lists are lists of symbols. */
589typedef struct gfc_formal_arglist
590{
4f613946 591 /* Symbol representing the argument at this position in the arglist. */
6de9cd9a 592 struct gfc_symbol *sym;
4f613946 593 /* Points to the next formal argument. */
6de9cd9a
DN
594 struct gfc_formal_arglist *next;
595}
596gfc_formal_arglist;
597
598#define gfc_get_formal_arglist() gfc_getmem(sizeof(gfc_formal_arglist))
599
600
601/* The gfc_actual_arglist structure is for actual arguments. */
602typedef struct gfc_actual_arglist
603{
cb9e4f55 604 const char *name;
6de9cd9a
DN
605 /* Alternate return label when the expr member is null. */
606 struct gfc_st_label *label;
607
1600fe22
TS
608 /* This is set to the type of an eventual omitted optional
609 argument. This is used to determine if a hidden string length
610 argument has to be added to a function call. */
611 bt missing_arg_type;
612
6de9cd9a
DN
613 struct gfc_expr *expr;
614 struct gfc_actual_arglist *next;
615}
616gfc_actual_arglist;
617
618#define gfc_get_actual_arglist() gfc_getmem(sizeof(gfc_actual_arglist))
619
620
621/* Because a symbol can belong to multiple namelists, they must be
622 linked externally to the symbol itself. */
623typedef struct gfc_namelist
624{
625 struct gfc_symbol *sym;
626 struct gfc_namelist *next;
627}
628gfc_namelist;
629
630#define gfc_get_namelist() gfc_getmem(sizeof(gfc_namelist))
631
632
633/* The gfc_st_label structure is a doubly linked list attached to a
634 namespace that records the usage of statement labels within that
635 space. */
636/* TODO: Make format/statement specifics a union. */
637typedef struct gfc_st_label
638{
639 int value;
640
641 gfc_sl_type defined, referenced;
642
643 struct gfc_expr *format;
644
645 tree backend_decl;
646
647 locus where;
648
649 struct gfc_st_label *prev, *next;
650}
651gfc_st_label;
652
653
654/* gfc_interface()-- Interfaces are lists of symbols strung together. */
655typedef struct gfc_interface
656{
657 struct gfc_symbol *sym;
658 locus where;
659 struct gfc_interface *next;
660}
661gfc_interface;
662
663#define gfc_get_interface() gfc_getmem(sizeof(gfc_interface))
664
665
666/* User operator nodes. These are like stripped down symbols. */
667typedef struct
668{
cb9e4f55 669 const char *name;
6de9cd9a
DN
670
671 gfc_interface *operator;
672 struct gfc_namespace *ns;
673 gfc_access access;
674}
675gfc_user_op;
676
677/* Symbol nodes. These are important things. They are what the
678 standard refers to as "entities". The possibly multiple names that
679 refer to the same entity are accomplished by a binary tree of
680 symtree structures that is balanced by the red-black method-- more
681 than one symtree node can point to any given symbol. */
682
683typedef struct gfc_symbol
684{
cb9e4f55
TS
685 const char *name; /* Primary name, before renaming */
686 const char *module; /* Module this symbol came from */
6de9cd9a
DN
687 locus declared_at;
688
689 gfc_typespec ts;
690 symbol_attribute attr;
691
692 /* The interface member points to the formal argument list if the
693 symbol is a function or subroutine name. If the symbol is a
694 generic name, the generic member points to the list of
695 interfaces. */
696
697 gfc_interface *generic;
698 gfc_access component_access;
699
700 gfc_formal_arglist *formal;
701 struct gfc_namespace *formal_ns;
702
703 struct gfc_expr *value; /* Parameter/Initializer value */
704 gfc_array_spec *as;
705 struct gfc_symbol *result; /* function result symbol */
706 gfc_component *components; /* Derived type components */
707
9056bd70 708 struct gfc_symbol *common_next; /* Links for COMMON syms */
6de9cd9a
DN
709 /* Make sure setup code for dummy arguments is generated in the correct
710 order. */
711 int dummy_order;
712
713 gfc_namelist *namelist, *namelist_tail;
714
715 /* Change management fields. Symbols that might be modified by the
716 current statement have the mark member nonzero and are kept in a
717 singly linked list through the tlink field. Of these symbols,
718 symbols with old_symbol equal to NULL are symbols created within
719 the current statement. Otherwise, old_symbol points to a copy of
720 the old symbol. */
721
722 struct gfc_symbol *old_symbol, *tlink;
723 unsigned mark:1, new:1;
5291e69a
PB
724 /* Nonzero if all equivalences associated with this symbol have been
725 processed. */
726 unsigned equiv_built:1;
6de9cd9a
DN
727 int refs;
728 struct gfc_namespace *ns; /* namespace containing this symbol */
729
730 tree backend_decl;
6de9cd9a
DN
731}
732gfc_symbol;
733
734
9056bd70
TS
735/* This structure is used to keep track of symbols in common blocks. */
736
737typedef struct
738{
739 locus where;
740 int use_assoc, saved;
53814b8f 741 char name[GFC_MAX_SYMBOL_LEN + 1];
9056bd70
TS
742 gfc_symbol *head;
743}
744gfc_common_head;
745
746#define gfc_get_common_head() gfc_getmem(sizeof(gfc_common_head))
747
748
3d79abbd
PB
749/* A list of all the alternate entry points for a procedure. */
750
751typedef struct gfc_entry_list
752{
753 /* The symbol for this entry point. */
754 gfc_symbol *sym;
755 /* The zero-based id of this entry point. */
756 int id;
757 /* The LABEL_EXPR marking this entry point. */
758 tree label;
759 /* The nest item in the list. */
760 struct gfc_entry_list *next;
761}
762gfc_entry_list;
763
764#define gfc_get_entry_list() \
765 (gfc_entry_list *) gfc_getmem(sizeof(gfc_entry_list))
9056bd70 766
6de9cd9a
DN
767/* Within a namespace, symbols are pointed to by symtree nodes that
768 are linked together in a balanced binary tree. There can be
769 several symtrees pointing to the same symbol node via USE
770 statements. */
771
772#define BBT_HEADER(self) int priority; struct self *left, *right
773
774typedef struct gfc_symtree
775{
776 BBT_HEADER (gfc_symtree);
cb9e4f55 777 const char *name;
6de9cd9a
DN
778 int ambiguous;
779 union
780 {
781 gfc_symbol *sym; /* Symbol associated with this node */
782 gfc_user_op *uop;
9056bd70 783 gfc_common_head *common;
6de9cd9a
DN
784 }
785 n;
786
787}
788gfc_symtree;
789
790
3d79abbd
PB
791/* A namespace describes the contents of procedure, module or
792 interface block. */
793/* ??? Anything else use these? */
794
6de9cd9a
DN
795typedef struct gfc_namespace
796{
4f613946
TS
797 /* Tree containing all the symbols in this namespace. */
798 gfc_symtree *sym_root;
799 /* Tree containing all the user-defined operators in the namespace. */
800 gfc_symtree *uop_root;
801 /* Tree containing all the common blocks. */
802 gfc_symtree *common_root;
6de9cd9a 803
4f613946 804 /* If set_flag[letter] is set, an implicit type has been set for letter. */
6de9cd9a 805 int set_flag[GFC_LETTERS];
4f613946
TS
806 /* Keeps track of the implicit types associated with the letters. */
807 gfc_typespec default_type[GFC_LETTERS];
6de9cd9a 808
4f613946 809 /* If this is a namespace of a procedure, this points to the procedure. */
6de9cd9a 810 struct gfc_symbol *proc_name;
4f613946
TS
811 /* If this is the namespace of a unit which contains executable
812 code, this points to it. */
6de9cd9a 813 struct gfc_code *code;
4f613946
TS
814
815 /* Points to the equivalences set up in this namespace. */
6de9cd9a 816 struct gfc_equiv *equiv;
4f613946
TS
817 gfc_interface *operator[GFC_INTRINSIC_OPS];
818
819 /* Points to the parent namespace, i.e. the namespace of a module or
820 procedure in which the procedure belonging to this namespace is
821 contained. The parent namespace points to this namespace either
822 directly via CONTAINED, or indirectly via the chain built by
823 SIBLING. */
824 struct gfc_namespace *parent;
825 /* CONTAINED points to the first contained namespace. Sibling
826 namespaces are chained via SIBLING. */
827 struct gfc_namespace *contained, *sibling;
828
829 gfc_common_head blank_common;
6de9cd9a
DN
830 gfc_access default_access, operator_access[GFC_INTRINSIC_OPS];
831
832 gfc_st_label *st_labels;
294fbfc8
TS
833 /* This list holds information about all the data initializers in
834 this namespace. */
6de9cd9a
DN
835 struct gfc_data *data;
836
837 gfc_charlen *cl_list;
838
4c1f4f52 839 int save_all, seen_save, seen_implicit_none;
3d79abbd
PB
840
841 /* Normally we don't need to refcount namespaces. However when we read
842 a module containing a function with multiple entry points, this
843 will appear as several functions with the same formal namespace. */
844 int refs;
845
846 /* A list of all alternate entry points to this procedure (or NULL). */
847 gfc_entry_list *entries;
0de4325e
TS
848
849 /* Set to 1 if namespace is a BLOCK DATA program unit. */
850 int is_block_data;
6de9cd9a
DN
851}
852gfc_namespace;
853
854extern gfc_namespace *gfc_current_ns;
855
c9543002
TS
856/* Global symbols are symbols of global scope. Currently we only use
857 this to detect collisions already when parsing.
858 TODO: Extend to verify procedure calls. */
859
860typedef struct gfc_gsymbol
861{
862 BBT_HEADER(gfc_gsymbol);
863
973a384d 864 const char *name;
c9543002
TS
865 enum { GSYM_UNKNOWN=1, GSYM_PROGRAM, GSYM_FUNCTION, GSYM_SUBROUTINE,
866 GSYM_MODULE, GSYM_COMMON, GSYM_BLOCK_DATA } type;
867
868 int defined, used;
869 locus where;
870}
871gfc_gsymbol;
872
873extern gfc_gsymbol *gfc_gsym_root;
6de9cd9a
DN
874
875/* Information on interfaces being built. */
876typedef struct
877{
878 interface_type type;
879 gfc_symbol *sym;
880 gfc_namespace *ns;
881 gfc_user_op *uop;
882 gfc_intrinsic_op op;
883}
884gfc_interface_info;
885
886extern gfc_interface_info current_interface;
887
888
889/* Array reference. */
890typedef struct gfc_array_ref
891{
892 ar_type type;
893 int dimen; /* # of components in the reference */
894 locus where;
895 gfc_array_spec *as;
896
897 locus c_where[GFC_MAX_DIMENSIONS]; /* All expressions can be NULL */
898 struct gfc_expr *start[GFC_MAX_DIMENSIONS], *end[GFC_MAX_DIMENSIONS],
899 *stride[GFC_MAX_DIMENSIONS];
900
901 enum
902 { DIMEN_ELEMENT = 1, DIMEN_RANGE, DIMEN_VECTOR, DIMEN_UNKNOWN }
903 dimen_type[GFC_MAX_DIMENSIONS];
904
905 struct gfc_expr *offset;
906}
907gfc_array_ref;
908
909#define gfc_get_array_ref() gfc_getmem(sizeof(gfc_array_ref))
910
911
912/* Component reference nodes. A variable is stored as an expression
913 node that points to the base symbol. After that, a singly linked
914 list of component reference nodes gives the variable's complete
915 resolution. The array_ref component may be present and comes
916 before the component component. */
917
918typedef enum
919 { REF_ARRAY, REF_COMPONENT, REF_SUBSTRING }
920ref_type;
921
922typedef struct gfc_ref
923{
924 ref_type type;
925
926 union
927 {
928 struct gfc_array_ref ar;
929
930 struct
931 {
932 gfc_component *component;
933 gfc_symbol *sym;
934 }
935 c;
936
937 struct
938 {
939 struct gfc_expr *start, *end; /* Substring */
940 gfc_charlen *length;
941 }
942 ss;
943
944 }
945 u;
946
947 struct gfc_ref *next;
948}
949gfc_ref;
950
951#define gfc_get_ref() gfc_getmem(sizeof(gfc_ref))
952
953
954/* Structures representing intrinsic symbols and their arguments lists. */
955typedef struct gfc_intrinsic_arg
956{
957 char name[GFC_MAX_SYMBOL_LEN + 1];
958
959 gfc_typespec ts;
960 int optional;
961 gfc_actual_arglist *actual;
962
963 struct gfc_intrinsic_arg *next;
964
965}
966gfc_intrinsic_arg;
967
968
4f613946
TS
969/* Specifies the various kinds of check functions used to verify the
970 argument lists of intrinsic functions. fX with X an integer refer
971 to check functions of intrinsics with X arguments. f1m is used for
972 the MAX and MIN intrinsics which can have an arbitrary number of
973 arguments, f3ml is used for the MINLOC and MAXLOC intrinsics as
974 these have special semantics. */
975
6de9cd9a
DN
976typedef union
977{
4c0c6b9f 978 try (*f0)(void);
6de9cd9a
DN
979 try (*f1)(struct gfc_expr *);
980 try (*f1m)(gfc_actual_arglist *);
981 try (*f2)(struct gfc_expr *, struct gfc_expr *);
982 try (*f3)(struct gfc_expr *, struct gfc_expr *, struct gfc_expr *);
f3207b37 983 try (*f3ml)(gfc_actual_arglist *);
7551270e 984 try (*f3red)(gfc_actual_arglist *);
6de9cd9a
DN
985 try (*f4)(struct gfc_expr *, struct gfc_expr *, struct gfc_expr *,
986 struct gfc_expr *);
987 try (*f5)(struct gfc_expr *, struct gfc_expr *, struct gfc_expr *,
988 struct gfc_expr *, struct gfc_expr *);
989}
990gfc_check_f;
991
4f613946
TS
992/* Like gfc_check_f, these specify the type of the simplification
993 function associated with an intrinsic. The fX are just like in
994 gfc_check_f. cc is used for type conversion functions. */
6de9cd9a
DN
995
996typedef union
997{
4c0c6b9f 998 struct gfc_expr *(*f0)(void);
6de9cd9a
DN
999 struct gfc_expr *(*f1)(struct gfc_expr *);
1000 struct gfc_expr *(*f2)(struct gfc_expr *, struct gfc_expr *);
1001 struct gfc_expr *(*f3)(struct gfc_expr *, struct gfc_expr *,
1002 struct gfc_expr *);
1003 struct gfc_expr *(*f4)(struct gfc_expr *, struct gfc_expr *,
1004 struct gfc_expr *, struct gfc_expr *);
1005 struct gfc_expr *(*f5)(struct gfc_expr *, struct gfc_expr *,
1006 struct gfc_expr *, struct gfc_expr *,
1007 struct gfc_expr *);
1008 struct gfc_expr *(*cc)(struct gfc_expr *, bt, int);
1009}
1010gfc_simplify_f;
1011
4f613946 1012/* Again like gfc_check_f, these specify the type of the resolution
13795658 1013 function associated with an intrinsic. The fX are just like in
4f613946
TS
1014 gfc_check_f. f1m is used for MIN and MAX, s1 is used for abort().
1015 */
6de9cd9a
DN
1016
1017typedef union
1018{
1019 void (*f0)(struct gfc_expr *);
1020 void (*f1)(struct gfc_expr *, struct gfc_expr *);
1021 void (*f1m)(struct gfc_expr *, struct gfc_actual_arglist *);
1022 void (*f2)(struct gfc_expr *, struct gfc_expr *, struct gfc_expr *);
1023 void (*f3)(struct gfc_expr *, struct gfc_expr *, struct gfc_expr *,
1024 struct gfc_expr *);
1025 void (*f4)(struct gfc_expr *, struct gfc_expr *, struct gfc_expr *,
1026 struct gfc_expr *, struct gfc_expr *);
1027 void (*f5)(struct gfc_expr *, struct gfc_expr *, struct gfc_expr *,
1028 struct gfc_expr *, struct gfc_expr *, struct gfc_expr *);
1029 void (*s1)(struct gfc_code *);
1030}
1031gfc_resolve_f;
1032
1033
1034typedef struct gfc_intrinsic_sym
1035{
cb9e4f55 1036 const char *name, *lib_name;
6de9cd9a
DN
1037 gfc_intrinsic_arg *formal;
1038 gfc_typespec ts;
fe58e076 1039 int elemental, pure, generic, specific, actual_ok, standard, noreturn;
6de9cd9a
DN
1040
1041 gfc_simplify_f simplify;
1042 gfc_check_f check;
1043 gfc_resolve_f resolve;
1044 struct gfc_intrinsic_sym *specific_head, *next;
1045 gfc_generic_isym_id generic_id;
1046
1047}
1048gfc_intrinsic_sym;
1049
1050
1051/* Expression nodes. The expression node types deserve explanations,
1052 since the last couple can be easily misconstrued:
1053
1054 EXPR_OP Operator node pointing to one or two other nodes
1055 EXPR_FUNCTION Function call, symbol points to function's name
1056 EXPR_CONSTANT A scalar constant: Logical, String, Real, Int or Complex
1057 EXPR_VARIABLE An Lvalue with a root symbol and possible reference list
1058 which expresses structure, array and substring refs.
1059 EXPR_NULL The NULL pointer value (which also has a basic type).
1060 EXPR_SUBSTRING A substring of a constant string
1061 EXPR_STRUCTURE A structure constructor
1062 EXPR_ARRAY An array constructor. */
1063
1064#include <gmp.h>
f8e566e5
SK
1065#include <mpfr.h>
1066#define GFC_RND_MODE GMP_RNDN
6de9cd9a
DN
1067
1068typedef struct gfc_expr
1069{
1070 expr_t expr_type;
1071
1072 gfc_typespec ts; /* These two refer to the overall expression */
1073
1074 int rank;
1075 mpz_t *shape; /* Can be NULL if shape is unknown at compile time */
1076
6de9cd9a
DN
1077 /* Nonnull for functions and structure constructors */
1078 gfc_symtree *symtree;
1079
6de9cd9a
DN
1080 gfc_ref *ref;
1081
6de9cd9a
DN
1082 locus where;
1083
d3642f89
FW
1084 /* True if it is converted from Hollerith constant. */
1085 unsigned int from_H : 1;
1086
6de9cd9a
DN
1087 union
1088 {
6de9cd9a 1089 int logical;
f8e566e5
SK
1090 mpz_t integer;
1091
1092 mpfr_t real;
6de9cd9a
DN
1093
1094 struct
1095 {
f8e566e5 1096 mpfr_t r, i;
6de9cd9a
DN
1097 }
1098 complex;
1099
58b03ab2
TS
1100 struct
1101 {
1102 gfc_intrinsic_op operator;
1103 gfc_user_op *uop;
1104 struct gfc_expr *op1, *op2;
1105 }
1106 op;
1107
6de9cd9a
DN
1108 struct
1109 {
1110 gfc_actual_arglist *actual;
6b25a558 1111 const char *name; /* Points to the ultimate name of the function */
6de9cd9a
DN
1112 gfc_intrinsic_sym *isym;
1113 gfc_symbol *esym;
1114 }
1115 function;
1116
1117 struct
1118 {
1119 int length;
1120 char *string;
1121 }
1122 character;
1123
1124 struct gfc_constructor *constructor;
1125 }
1126 value;
1127
1128}
1129gfc_expr;
1130
1131
94538bd1 1132#define gfc_get_shape(rank) ((mpz_t *) gfc_getmem((rank)*sizeof(mpz_t)))
6de9cd9a
DN
1133
1134/* Structures for information associated with different kinds of
1135 numbers. The first set of integer parameters define all there is
1136 to know about a particular kind. The rest of the elements are
1137 computed from the first elements. */
1138
1139typedef struct
1140{
e2cad04b 1141 /* Values really representable by the target. */
14df5747 1142 mpz_t huge, pedantic_min_int, min_int, max_int;
e2cad04b
RH
1143
1144 int kind, radix, digits, bit_size, range;
1145
1146 /* True if the C type of the given name maps to this precision.
1147 Note that more than one bit can be set. */
1148 unsigned int c_char : 1;
1149 unsigned int c_short : 1;
1150 unsigned int c_int : 1;
1151 unsigned int c_long : 1;
1152 unsigned int c_long_long : 1;
6de9cd9a
DN
1153}
1154gfc_integer_info;
1155
1156extern gfc_integer_info gfc_integer_kinds[];
1157
1158
1159typedef struct
1160{
1161 int kind, bit_size;
1162
e2cad04b
RH
1163 /* True if the C++ type bool, C99 type _Bool, maps to this precision. */
1164 unsigned int c_bool : 1;
6de9cd9a
DN
1165}
1166gfc_logical_info;
1167
1168extern gfc_logical_info gfc_logical_kinds[];
1169
1170
1171typedef struct
1172{
2d0aa65f 1173 mpfr_t epsilon, huge, tiny, subnormal;
6de9cd9a 1174 int kind, radix, digits, min_exponent, max_exponent;
6de9cd9a 1175 int range, precision;
e2cad04b
RH
1176
1177 /* The precision of the type as reported by GET_MODE_PRECISION. */
1178 int mode_precision;
1179
1180 /* True if the C type of the given name maps to this precision.
1181 Note that more than one bit can be set. */
1182 unsigned int c_float : 1;
1183 unsigned int c_double : 1;
1184 unsigned int c_long_double : 1;
6de9cd9a
DN
1185}
1186gfc_real_info;
1187
1188extern gfc_real_info gfc_real_kinds[];
1189
1190
1191/* Equivalence structures. Equivalent lvalues are linked along the
1192 *eq pointer, equivalence sets are strung along the *next node. */
1193typedef struct gfc_equiv
1194{
1195 struct gfc_equiv *next, *eq;
1196 gfc_expr *expr;
1197 int used;
1198}
1199gfc_equiv;
1200
1201#define gfc_get_equiv() gfc_getmem(sizeof(gfc_equiv))
1202
1203
1204/* gfc_case stores the selector list of a case statement. The *low
1205 and *high pointers can point to the same expression in the case of
1206 a single value. If *high is NULL, the selection is from *low
1207 upwards, if *low is NULL the selection is *high downwards.
1208
410d1a45
SK
1209 This structure has separate fields to allow single and double linked
1210 lists of CASEs at the same time. The singe linked list along the NEXT
6de9cd9a
DN
1211 field is a list of cases for a single CASE label. The double linked
1212 list along the LEFT/RIGHT fields is used to detect overlap and to
1213 build a table of the cases for SELECT constructs with a CHARACTER
1214 case expression. */
1215
1216typedef struct gfc_case
1217{
1218 /* Where we saw this case. */
1219 locus where;
1220 int n;
1221
1222 /* Case range values. If (low == high), it's a single value. If one of
1223 the labels is NULL, it's an unbounded case. If both are NULL, this
1224 represents the default case. */
1225 gfc_expr *low, *high;
1226
1227 /* Next case label in the list of cases for a single CASE label. */
1228 struct gfc_case *next;
1229
1230 /* Used for detecting overlap, and for code generation. */
1231 struct gfc_case *left, *right;
1232
1233 /* True if this case label can never be matched. */
1234 int unreachable;
1235}
1236gfc_case;
1237
1238#define gfc_get_case() gfc_getmem(sizeof(gfc_case))
1239
1240
1241typedef struct
1242{
1243 gfc_expr *var, *start, *end, *step;
1244}
1245gfc_iterator;
1246
1247#define gfc_get_iterator() gfc_getmem(sizeof(gfc_iterator))
1248
1249
f7b529fa 1250/* Allocation structure for ALLOCATE, DEALLOCATE and NULLIFY statements. */
6de9cd9a
DN
1251
1252typedef struct gfc_alloc
1253{
1254 gfc_expr *expr;
1255 struct gfc_alloc *next;
1256}
1257gfc_alloc;
1258
1259#define gfc_get_alloc() gfc_getmem(sizeof(gfc_alloc))
1260
1261
1262typedef struct
1263{
1264 gfc_expr *unit, *file, *status, *access, *form, *recl,
1265 *blank, *position, *action, *delim, *pad, *iostat;
1266 gfc_st_label *err;
1267}
1268gfc_open;
1269
1270
1271typedef struct
1272{
1273 gfc_expr *unit, *status, *iostat;
1274 gfc_st_label *err;
1275}
1276gfc_close;
1277
1278
1279typedef struct
1280{
1281 gfc_expr *unit, *iostat;
1282 gfc_st_label *err;
1283}
1284gfc_filepos;
1285
1286
1287typedef struct
1288{
1289 gfc_expr *unit, *file, *iostat, *exist, *opened, *number, *named,
1290 *name, *access, *sequential, *direct, *form, *formatted,
1291 *unformatted, *recl, *nextrec, *blank, *position, *action, *read,
1292 *write, *readwrite, *delim, *pad, *iolength;
1293
1294 gfc_st_label *err;
1295
1296}
1297gfc_inquire;
1298
1299
1300typedef struct
1301{
1302 gfc_expr *io_unit, *format_expr, *rec, *advance, *iostat, *size;
1303
1304 gfc_symbol *namelist;
1305 /* A format_label of `format_asterisk' indicates the "*" format */
1306 gfc_st_label *format_label;
1307 gfc_st_label *err, *end, *eor;
1308
1309 locus eor_where, end_where;
1310}
1311gfc_dt;
1312
1313
1314typedef struct gfc_forall_iterator
1315{
1316 gfc_expr *var, *start, *end, *stride;
1317 struct gfc_forall_iterator *next;
1318}
1319gfc_forall_iterator;
1320
1321
1322/* Executable statements that fill gfc_code structures. */
1323typedef enum
1324{
1325 EXEC_NOP = 1, EXEC_ASSIGN, EXEC_LABEL_ASSIGN, EXEC_POINTER_ASSIGN,
3d79abbd
PB
1326 EXEC_GOTO, EXEC_CALL, EXEC_RETURN, EXEC_ENTRY,
1327 EXEC_PAUSE, EXEC_STOP, EXEC_CONTINUE,
6de9cd9a
DN
1328 EXEC_IF, EXEC_ARITHMETIC_IF, EXEC_DO, EXEC_DO_WHILE, EXEC_SELECT,
1329 EXEC_FORALL, EXEC_WHERE, EXEC_CYCLE, EXEC_EXIT,
1330 EXEC_ALLOCATE, EXEC_DEALLOCATE,
1331 EXEC_OPEN, EXEC_CLOSE,
1332 EXEC_READ, EXEC_WRITE, EXEC_IOLENGTH, EXEC_TRANSFER, EXEC_DT_END,
6403ec5f 1333 EXEC_BACKSPACE, EXEC_ENDFILE, EXEC_INQUIRE, EXEC_REWIND, EXEC_FLUSH
6de9cd9a
DN
1334}
1335gfc_exec_op;
1336
1337typedef struct gfc_code
1338{
1339 gfc_exec_op op;
1340
1341 struct gfc_code *block, *next;
1342 locus loc;
1343
1344 gfc_st_label *here, *label, *label2, *label3;
1345 gfc_symtree *symtree;
1346 gfc_expr *expr, *expr2;
1347 /* A name isn't sufficient to identify a subroutine, we need the actual
1348 symbol for the interface definition.
1349 const char *sub_name; */
1350 gfc_symbol *resolved_sym;
1351
1352 union
1353 {
1354 gfc_actual_arglist *actual;
1355 gfc_case *case_list;
1356 gfc_iterator *iterator;
1357 gfc_alloc *alloc_list;
1358 gfc_open *open;
1359 gfc_close *close;
1360 gfc_filepos *filepos;
1361 gfc_inquire *inquire;
1362 gfc_dt *dt;
1363 gfc_forall_iterator *forall_iterator;
1364 struct gfc_code *whichloop;
1365 int stop_code;
3d79abbd 1366 gfc_entry_list *entry;
6de9cd9a
DN
1367 }
1368 ext; /* Points to additional structures required by statement */
1369
1370 /* Backend_decl is used for cycle and break labels in do loops, and
1371 * probably for other constructs as well, once we translate them. */
1372 tree backend_decl;
1373}
1374gfc_code;
1375
1376
1377/* Storage for DATA statements. */
1378typedef struct gfc_data_variable
1379{
1380 gfc_expr *expr;
1381 gfc_iterator iter;
1382 struct gfc_data_variable *list, *next;
1383}
1384gfc_data_variable;
1385
1386
1387typedef struct gfc_data_value
1388{
b8502435 1389 unsigned int repeat;
6de9cd9a 1390 gfc_expr *expr;
6de9cd9a
DN
1391 struct gfc_data_value *next;
1392}
1393gfc_data_value;
1394
1395
1396typedef struct gfc_data
1397{
1398 gfc_data_variable *var;
1399 gfc_data_value *value;
1400 locus where;
1401
1402 struct gfc_data *next;
1403}
1404gfc_data;
1405
1406#define gfc_get_data_variable() gfc_getmem(sizeof(gfc_data_variable))
1407#define gfc_get_data_value() gfc_getmem(sizeof(gfc_data_value))
1408#define gfc_get_data() gfc_getmem(sizeof(gfc_data))
1409
1410
1411/* Structure for holding compile options */
1412typedef struct
1413{
6de9cd9a
DN
1414 char *module_dir;
1415 gfc_source_form source_form;
1416 int fixed_line_length;
1417 int max_identifier_length;
1418 int verbose;
1419
1420 int warn_aliasing;
1421 int warn_conversion;
1422 int warn_implicit_interface;
1423 int warn_line_truncation;
2d8b59df 1424 int warn_underflow;
6de9cd9a
DN
1425 int warn_surprising;
1426 int warn_unused_labels;
1427
3ae9eb27
SK
1428 int flag_default_double;
1429 int flag_default_integer;
1430 int flag_default_real;
6de9cd9a
DN
1431 int flag_dollar_ok;
1432 int flag_underscoring;
1433 int flag_second_underscore;
1434 int flag_implicit_none;
1435 int flag_max_stack_var_size;
1436 int flag_module_access_private;
1437 int flag_no_backend;
1438 int flag_pack_derived;
1439 int flag_repack_arrays;
973ff4c0 1440 int flag_f2c;
ee5426a4 1441 int flag_automatic;
131c66cd 1442 int flag_backslash;
e0bcf78c 1443 int flag_d_lines;
6de9cd9a
DN
1444
1445 int q_kind;
3ae9eb27 1446
6de9cd9a
DN
1447 int warn_std;
1448 int allow_std;
b7892582 1449 int warn_nonstd_intrinsics;
6de9cd9a
DN
1450}
1451gfc_option_t;
1452
1453extern gfc_option_t gfc_option;
1454
1455
1456/* Constructor nodes for array and structure constructors. */
1457typedef struct gfc_constructor
1458{
1459 gfc_expr *expr;
1460 gfc_iterator *iterator;
1461 locus where;
1462 struct gfc_constructor *next;
1463 struct
1464 {
1465 mpz_t offset; /* Record the offset of array element which appears in
1466 data statement like "data a(5)/4/". */
1467 gfc_component *component; /* Record the component being initialized. */
1468 }
1469 n;
1470 mpz_t repeat; /* Record the repeat number of initial values in data
1471 statement like "data a/5*10/". */
1472}
1473gfc_constructor;
1474
1475
1476typedef struct iterator_stack
1477{
1478 gfc_symtree *variable;
1479 mpz_t value;
1480 struct iterator_stack *prev;
1481}
1482iterator_stack;
1483extern iterator_stack *iter_stack;
1484
1485/************************ Function prototypes *************************/
1486
1487/* data.c */
1488void gfc_formalize_init_value (gfc_symbol *);
1489void gfc_get_section_index (gfc_array_ref *, mpz_t *, mpz_t *);
1490void gfc_assign_data_value (gfc_expr *, gfc_expr *, mpz_t);
b8502435 1491void gfc_assign_data_value_range (gfc_expr *, gfc_expr *, mpz_t, mpz_t);
6de9cd9a
DN
1492void gfc_advance_section (mpz_t *, gfc_array_ref *, mpz_t *);
1493
1494/* scanner.c */
1495void gfc_scanner_done_1 (void);
1496void gfc_scanner_init_1 (void);
1497
1498void gfc_add_include_path (const char *);
1499void gfc_release_include_path (void);
1500FILE *gfc_open_included_file (const char *);
1501
6de9cd9a
DN
1502int gfc_at_end (void);
1503int gfc_at_eof (void);
1504int gfc_at_bol (void);
1505int gfc_at_eol (void);
1506void gfc_advance_line (void);
1507int gfc_check_include (void);
1508
1509void gfc_skip_comments (void);
1510int gfc_next_char_literal (int);
1511int gfc_next_char (void);
1512int gfc_peek_char (void);
1513void gfc_error_recovery (void);
1514void gfc_gobble_whitespace (void);
e0bcf78c 1515try gfc_new_file (void);
6de9cd9a 1516
d4fa05b9 1517extern gfc_source_form gfc_current_form;
e0bcf78c 1518extern const char *gfc_source_file;
63645982 1519extern locus gfc_current_locus;
6de9cd9a
DN
1520
1521/* misc.c */
1522void *gfc_getmem (size_t) ATTRIBUTE_MALLOC;
1523void gfc_free (void *);
1524int gfc_terminal_width(void);
1525void gfc_clear_ts (gfc_typespec *);
1526FILE *gfc_open_file (const char *);
1527const char *gfc_article (const char *);
1528const char *gfc_basic_typename (bt);
1529const char *gfc_typename (gfc_typespec *);
1530
1531#define gfc_op2string(OP) (OP == INTRINSIC_ASSIGN ? \
1532 "=" : gfc_code2string (intrinsic_operators, OP))
1533
1534const char *gfc_code2string (const mstring *, int);
1535int gfc_string2code (const mstring *, const char *);
1536const char *gfc_intent_string (sym_intent);
1537
1538void gfc_init_1 (void);
1539void gfc_init_2 (void);
1540void gfc_done_1 (void);
1541void gfc_done_2 (void);
1542
1543/* options.c */
1544unsigned int gfc_init_options (unsigned int, const char **);
1545int gfc_handle_option (size_t, const char *, int);
1546bool gfc_post_options (const char **);
1547
1548/* iresolve.c */
6b25a558 1549const char * gfc_get_string (const char *, ...) ATTRIBUTE_PRINTF_1;
6de9cd9a
DN
1550
1551/* error.c */
1552
1553typedef struct gfc_error_buf
1554{
1555 int flag;
d71b89ca
JJ
1556 size_t allocated, index;
1557 char *message;
6de9cd9a
DN
1558} gfc_error_buf;
1559
1560void gfc_error_init_1 (void);
1561void gfc_buffer_error (int);
1562
0ce0154c
KG
1563void gfc_warning (const char *, ...) ATTRIBUTE_GCC_GFC(1,2);
1564void gfc_warning_now (const char *, ...) ATTRIBUTE_GCC_GFC(1,2);
6de9cd9a
DN
1565void gfc_clear_warning (void);
1566void gfc_warning_check (void);
1567
0ce0154c
KG
1568void gfc_error (const char *, ...) ATTRIBUTE_GCC_GFC(1,2);
1569void gfc_error_now (const char *, ...) ATTRIBUTE_GCC_GFC(1,2);
1570void gfc_fatal_error (const char *, ...) ATTRIBUTE_NORETURN ATTRIBUTE_GCC_GFC(1,2);
1571void gfc_internal_error (const char *, ...) ATTRIBUTE_NORETURN ATTRIBUTE_GCC_GFC(1,2);
6de9cd9a
DN
1572void gfc_clear_error (void);
1573int gfc_error_check (void);
1574
0ce0154c 1575try gfc_notify_std (int, const char *, ...) ATTRIBUTE_GCC_GFC(2,3);
6de9cd9a
DN
1576
1577/* A general purpose syntax error. */
1578#define gfc_syntax_error(ST) \
1579 gfc_error ("Syntax error in %s statement at %C", gfc_ascii_statement (ST));
1580
1581void gfc_push_error (gfc_error_buf *);
1582void gfc_pop_error (gfc_error_buf *);
d71b89ca 1583void gfc_free_error (gfc_error_buf *);
6de9cd9a
DN
1584
1585void gfc_status (const char *, ...) ATTRIBUTE_PRINTF_1;
1586void gfc_status_char (char);
1587
1588void gfc_get_errors (int *, int *);
1589
1590/* arith.c */
1591void gfc_arith_init_1 (void);
1592void gfc_arith_done_1 (void);
1593
5e8e542f 1594/* trans-types.c */
e7a2d5fb 1595int gfc_validate_kind (bt, int, bool);
6de9cd9a 1596extern int gfc_index_integer_kind;
9d64df18 1597extern int gfc_default_integer_kind;
f4e7375a 1598extern int gfc_max_integer_kind;
9d64df18
TS
1599extern int gfc_default_real_kind;
1600extern int gfc_default_double_kind;
1601extern int gfc_default_character_kind;
1602extern int gfc_default_logical_kind;
1603extern int gfc_default_complex_kind;
e8525382 1604extern int gfc_c_int_kind;
6de9cd9a
DN
1605
1606/* symbol.c */
1607void gfc_clear_new_implicit (void);
1107b970
PB
1608try gfc_add_new_implicit_range (int, int);
1609try gfc_merge_new_implicit (gfc_typespec *);
6de9cd9a 1610void gfc_set_implicit_none (void);
6de9cd9a
DN
1611
1612gfc_typespec *gfc_get_default_type (gfc_symbol *, gfc_namespace *);
1613try gfc_set_default_type (gfc_symbol *, int, gfc_namespace *);
1614
1615void gfc_set_component_attr (gfc_component *, symbol_attribute *);
1616void gfc_get_component_attr (symbol_attribute *, gfc_component *);
1617
1618void gfc_set_sym_referenced (gfc_symbol * sym);
1619
1620try gfc_add_allocatable (symbol_attribute *, locus *);
231b2fcc 1621try gfc_add_dimension (symbol_attribute *, const char *, locus *);
6de9cd9a
DN
1622try gfc_add_external (symbol_attribute *, locus *);
1623try gfc_add_intrinsic (symbol_attribute *, locus *);
1624try gfc_add_optional (symbol_attribute *, locus *);
1625try gfc_add_pointer (symbol_attribute *, locus *);
231b2fcc
TS
1626try gfc_add_result (symbol_attribute *, const char *, locus *);
1627try gfc_add_save (symbol_attribute *, const char *, locus *);
6de9cd9a
DN
1628try gfc_add_saved_common (symbol_attribute *, locus *);
1629try gfc_add_target (symbol_attribute *, locus *);
231b2fcc
TS
1630try gfc_add_dummy (symbol_attribute *, const char *, locus *);
1631try gfc_add_generic (symbol_attribute *, const char *, locus *);
6de9cd9a 1632try gfc_add_common (symbol_attribute *, locus *);
231b2fcc
TS
1633try gfc_add_in_common (symbol_attribute *, const char *, locus *);
1634try gfc_add_data (symbol_attribute *, const char *, locus *);
1635try gfc_add_in_namelist (symbol_attribute *, const char *, locus *);
1636try gfc_add_sequence (symbol_attribute *, const char *, locus *);
6de9cd9a
DN
1637try gfc_add_elemental (symbol_attribute *, locus *);
1638try gfc_add_pure (symbol_attribute *, locus *);
1639try gfc_add_recursive (symbol_attribute *, locus *);
231b2fcc
TS
1640try gfc_add_function (symbol_attribute *, const char *, locus *);
1641try gfc_add_subroutine (symbol_attribute *, const char *, locus *);
1642
1643try gfc_add_access (symbol_attribute *, gfc_access, const char *, locus *);
1644try gfc_add_flavor (symbol_attribute *, sym_flavor, const char *, locus *);
1645try gfc_add_entry (symbol_attribute *, const char *, locus *);
1646try gfc_add_procedure (symbol_attribute *, procedure_type,
1647 const char *, locus *);
6de9cd9a
DN
1648try gfc_add_intent (symbol_attribute *, sym_intent, locus *);
1649try gfc_add_explicit_interface (gfc_symbol *, ifsrc,
1650 gfc_formal_arglist *, locus *);
1651try gfc_add_type (gfc_symbol *, gfc_typespec *, locus *);
1652
1653void gfc_clear_attr (symbol_attribute *);
1654try gfc_missing_attr (symbol_attribute *, locus *);
1655try gfc_copy_attr (symbol_attribute *, symbol_attribute *, locus *);
1656
1657try gfc_add_component (gfc_symbol *, const char *, gfc_component **);
1658gfc_symbol *gfc_use_derived (gfc_symbol *);
1659gfc_symtree *gfc_use_derived_tree (gfc_symtree *);
1660gfc_component *gfc_find_component (gfc_symbol *, const char *);
1661
1662gfc_st_label *gfc_get_st_label (int);
1663void gfc_free_st_label (gfc_st_label *);
1664void gfc_define_st_label (gfc_st_label *, gfc_sl_type, locus *);
1665try gfc_reference_st_label (gfc_st_label *, gfc_sl_type);
1666
0366dfe9 1667gfc_namespace *gfc_get_namespace (gfc_namespace *, int);
6de9cd9a
DN
1668gfc_symtree *gfc_new_symtree (gfc_symtree **, const char *);
1669gfc_symtree *gfc_find_symtree (gfc_symtree *, const char *);
1670gfc_user_op *gfc_get_uop (const char *);
1671gfc_user_op *gfc_find_uop (const char *, gfc_namespace *);
1672void gfc_free_symbol (gfc_symbol *);
1673gfc_symbol *gfc_new_symbol (const char *, gfc_namespace *);
1674int gfc_find_symbol (const char *, gfc_namespace *, int, gfc_symbol **);
1675int gfc_find_sym_tree (const char *, gfc_namespace *, int, gfc_symtree **);
1676int gfc_get_symbol (const char *, gfc_namespace *, gfc_symbol **);
1677int gfc_get_sym_tree (const char *, gfc_namespace *, gfc_symtree **);
1678int gfc_get_ha_symbol (const char *, gfc_symbol **);
1679int gfc_get_ha_sym_tree (const char *, gfc_symtree **);
1680
1681int gfc_symbols_could_alias (gfc_symbol *, gfc_symbol *);
1682
1683void gfc_undo_symbols (void);
1684void gfc_commit_symbols (void);
1685void gfc_free_namespace (gfc_namespace *);
1686
1687void gfc_symbol_init_2 (void);
1688void gfc_symbol_done_2 (void);
1689
9056bd70 1690void gfc_traverse_symtree (gfc_symtree *, void (*)(gfc_symtree *));
6de9cd9a
DN
1691void gfc_traverse_ns (gfc_namespace *, void (*)(gfc_symbol *));
1692void gfc_traverse_user_op (gfc_namespace *, void (*)(gfc_user_op *));
1693void gfc_save_all (gfc_namespace *);
1694
1695void gfc_symbol_state (void);
1696
cb9e4f55
TS
1697gfc_gsymbol *gfc_get_gsymbol (const char *);
1698gfc_gsymbol *gfc_find_gsymbol (gfc_gsymbol *, const char *);
c9543002 1699
6de9cd9a
DN
1700/* intrinsic.c */
1701extern int gfc_init_expr;
1702
1703/* Given a symbol that we have decided is intrinsic, mark it as such
1704 by placing it into a special module that is otherwise impossible to
1705 read or write. */
1706
cb9e4f55 1707#define gfc_intrinsic_symbol(SYM) SYM->module = gfc_get_string ("(intrinsic)")
6de9cd9a
DN
1708
1709void gfc_intrinsic_init_1 (void);
1710void gfc_intrinsic_done_1 (void);
1711
1712char gfc_type_letter (bt);
1713gfc_symbol * gfc_get_intrinsic_sub_symbol (const char *);
1714try gfc_convert_type (gfc_expr *, gfc_typespec *, int);
1715try gfc_convert_type_warn (gfc_expr *, gfc_typespec *, int, int);
1716int gfc_generic_intrinsic (const char *);
1717int gfc_specific_intrinsic (const char *);
1718int gfc_intrinsic_name (const char *, int);
1719gfc_intrinsic_sym *gfc_find_function (const char *);
1720
1721match gfc_intrinsic_func_interface (gfc_expr *, int);
1722match gfc_intrinsic_sub_interface (gfc_code *, int);
1723
1724/* simplify.c */
1725void gfc_simplify_init_1 (void);
6de9cd9a
DN
1726
1727/* match.c -- FIXME */
1728void gfc_free_iterator (gfc_iterator *, int);
1729void gfc_free_forall_iterator (gfc_forall_iterator *);
1730void gfc_free_alloc_list (gfc_alloc *);
1731void gfc_free_namelist (gfc_namelist *);
1732void gfc_free_equiv (gfc_equiv *);
1733void gfc_free_data (gfc_data *);
1734void gfc_free_case_list (gfc_case *);
1735
1736/* expr.c */
1737void gfc_free_actual_arglist (gfc_actual_arglist *);
1738gfc_actual_arglist *gfc_copy_actual_arglist (gfc_actual_arglist *);
1739const char *gfc_extract_int (gfc_expr *, int *);
1740
1741gfc_expr *gfc_build_conversion (gfc_expr *);
1742void gfc_free_ref_list (gfc_ref *);
1743void gfc_type_convert_binary (gfc_expr *);
1744int gfc_is_constant_expr (gfc_expr *);
1745try gfc_simplify_expr (gfc_expr *, int);
1746
1747gfc_expr *gfc_get_expr (void);
1748void gfc_free_expr (gfc_expr *);
1749void gfc_replace_expr (gfc_expr *, gfc_expr *);
1750gfc_expr *gfc_int_expr (int);
1751gfc_expr *gfc_logical_expr (int, locus *);
1752mpz_t *gfc_copy_shape (mpz_t *, int);
94538bd1 1753mpz_t *gfc_copy_shape_excluding (mpz_t *, int, gfc_expr *);
6de9cd9a
DN
1754gfc_expr *gfc_copy_expr (gfc_expr *);
1755
1756try gfc_specification_expr (gfc_expr *);
1757
1758int gfc_numeric_ts (gfc_typespec *);
1759int gfc_kind_max (gfc_expr *, gfc_expr *);
1760
1761try gfc_check_conformance (const char *, gfc_expr *, gfc_expr *);
1762try gfc_check_assign (gfc_expr *, gfc_expr *, int);
1763try gfc_check_pointer_assign (gfc_expr *, gfc_expr *);
1764try gfc_check_assign_symbol (gfc_symbol *, gfc_expr *);
1765
54b4ba60 1766gfc_expr *gfc_default_initializer (gfc_typespec *);
294fbfc8
TS
1767gfc_expr *gfc_get_variable_expr (gfc_symtree *);
1768
54b4ba60 1769
6de9cd9a
DN
1770/* st.c */
1771extern gfc_code new_st;
1772
1773void gfc_clear_new_st (void);
1774gfc_code *gfc_get_code (void);
1775gfc_code *gfc_append_code (gfc_code *, gfc_code *);
1776void gfc_free_statement (gfc_code *);
1777void gfc_free_statements (gfc_code *);
1778
1779/* resolve.c */
1780try gfc_resolve_expr (gfc_expr *);
1781void gfc_resolve (gfc_namespace *);
1782int gfc_impure_variable (gfc_symbol *);
1783int gfc_pure (gfc_symbol *);
1784int gfc_elemental (gfc_symbol *);
8d5cfa27 1785try gfc_resolve_iterator (gfc_iterator *, bool);
6de9cd9a 1786try gfc_resolve_index (gfc_expr *, int);
bf302220 1787try gfc_resolve_dim_arg (gfc_expr *);
6de9cd9a
DN
1788
1789/* array.c */
1790void gfc_free_array_spec (gfc_array_spec *);
1791gfc_array_ref *gfc_copy_array_ref (gfc_array_ref *);
1792
1793try gfc_set_array_spec (gfc_symbol *, gfc_array_spec *, locus *);
1794gfc_array_spec *gfc_copy_array_spec (gfc_array_spec *);
1795try gfc_resolve_array_spec (gfc_array_spec *, int);
1796
1797int gfc_compare_array_spec (gfc_array_spec *, gfc_array_spec *);
1798
1799gfc_expr *gfc_start_constructor (bt, int, locus *);
1800void gfc_append_constructor (gfc_expr *, gfc_expr *);
1801void gfc_free_constructor (gfc_constructor *);
1802void gfc_simplify_iterator_var (gfc_expr *);
1803try gfc_expand_constructor (gfc_expr *);
1804int gfc_constant_ac (gfc_expr *);
1805int gfc_expanded_ac (gfc_expr *);
1806try gfc_resolve_array_constructor (gfc_expr *);
1807try gfc_check_constructor_type (gfc_expr *);
1808try gfc_check_iter_variable (gfc_expr *);
1809try gfc_check_constructor (gfc_expr *, try (*)(gfc_expr *));
1810gfc_constructor *gfc_copy_constructor (gfc_constructor * src);
1811gfc_expr *gfc_get_array_element (gfc_expr *, int);
1812try gfc_array_size (gfc_expr *, mpz_t *);
1813try gfc_array_dimen_size (gfc_expr *, int, mpz_t *);
1814try gfc_array_ref_shape (gfc_array_ref *, mpz_t *);
1815gfc_array_ref *gfc_find_array_ref (gfc_expr *);
1816void gfc_insert_constructor (gfc_expr *, gfc_constructor *);
1817gfc_constructor *gfc_get_constructor (void);
1818tree gfc_conv_array_initializer (tree type, gfc_expr * expr);
1819try spec_size (gfc_array_spec *, mpz_t *);
4077d207 1820int gfc_is_compile_time_shape (gfc_array_spec *);
6de9cd9a
DN
1821
1822/* interface.c -- FIXME: some of these should be in symbol.c */
1823void gfc_free_interface (gfc_interface *);
1824int gfc_compare_types (gfc_typespec *, gfc_typespec *);
1825void gfc_check_interfaces (gfc_namespace *);
1826void gfc_procedure_use (gfc_symbol *, gfc_actual_arglist **, locus *);
1827gfc_symbol *gfc_search_interface (gfc_interface *, int,
1828 gfc_actual_arglist **);
1829try gfc_extend_expr (gfc_expr *);
1830void gfc_free_formal_arglist (gfc_formal_arglist *);
1831try gfc_extend_assign (gfc_code *, gfc_namespace *);
1832try gfc_add_interface (gfc_symbol * sym);
1833
1834/* io.c */
1835extern gfc_st_label format_asterisk;
1836
1837void gfc_free_open (gfc_open *);
1838try gfc_resolve_open (gfc_open *);
1839void gfc_free_close (gfc_close *);
1840try gfc_resolve_close (gfc_close *);
1841void gfc_free_filepos (gfc_filepos *);
1842try gfc_resolve_filepos (gfc_filepos *);
1843void gfc_free_inquire (gfc_inquire *);
1844try gfc_resolve_inquire (gfc_inquire *);
1845void gfc_free_dt (gfc_dt *);
1846try gfc_resolve_dt (gfc_dt *);
1847
1848/* module.c */
1849void gfc_module_init_2 (void);
1850void gfc_module_done_2 (void);
1851void gfc_dump_module (const char *, int);
af30f793 1852bool gfc_check_access (gfc_access, gfc_access);
6de9cd9a
DN
1853
1854/* primary.c */
1855symbol_attribute gfc_variable_attr (gfc_expr *, gfc_typespec *);
1856symbol_attribute gfc_expr_attr (gfc_expr *);
1857
1858/* trans.c */
1859void gfc_generate_code (gfc_namespace *);
1860void gfc_generate_module_code (gfc_namespace *);
1861
1862/* bbt.c */
1863typedef int (*compare_fn) (void *, void *);
1864void gfc_insert_bbt (void *, void *, compare_fn);
1865void gfc_delete_bbt (void *, void *, compare_fn);
1866
1867/* dump-parse-tree.c */
1868void gfc_show_namespace (gfc_namespace *);
1869
1870/* parse.c */
1871try gfc_parse_file (void);
1872
53814b8f 1873#endif /* GCC_GFORTRAN_H */