OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [fortran/] [gfortran.h] - Blame information for rev 20

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.