Rebase.
[official-gcc.git] / gcc / fortran / libgfortran.h
blobdf5c14f8cc660932d5263a8e531fe76d8773e90f
1 /* Header file to the Fortran front-end and runtime library
2 Copyright (C) 2007-2014 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
9 version.
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
21 /* Flags to specify which standard/extension contains a feature.
22 Note that no features were obsoleted nor deleted in F2003.
23 Please remember to keep those definitions in sync with
24 gfortran.texi. */
25 #define GFC_STD_F2008_TS (1<<9) /* POST-F2008 technical reports. */
26 #define GFC_STD_F2008_OBS (1<<8) /* Obsolescent in F2008. */
27 #define GFC_STD_F2008 (1<<7) /* New in F2008. */
28 #define GFC_STD_LEGACY (1<<6) /* Backward compatibility. */
29 #define GFC_STD_GNU (1<<5) /* GNU Fortran extension. */
30 #define GFC_STD_F2003 (1<<4) /* New in F2003. */
31 #define GFC_STD_F95 (1<<3) /* New in F95. */
32 #define GFC_STD_F95_DEL (1<<2) /* Deleted in F95. */
33 #define GFC_STD_F95_OBS (1<<1) /* Obsolescent in F95. */
34 #define GFC_STD_F77 (1<<0) /* Included in F77, but not deleted or
35 obsolescent in later standards. */
38 /* Bitmasks for the various FPE that can be enabled. These need to be straight integers
39 e.g., 8 instead of (1<<3), because they will be included in Fortran source. */
40 #define GFC_FPE_INVALID 1
41 #define GFC_FPE_DENORMAL 2
42 #define GFC_FPE_ZERO 4
43 #define GFC_FPE_OVERFLOW 8
44 #define GFC_FPE_UNDERFLOW 16
45 #define GFC_FPE_INEXACT 32
47 /* Defines for floating-point rounding modes. */
48 #define GFC_FPE_DOWNWARD 1
49 #define GFC_FPE_TONEAREST 2
50 #define GFC_FPE_TOWARDZERO 3
51 #define GFC_FPE_UPWARD 4
53 /* Size of the buffer required to store FPU state for any target.
54 In particular, this has to be larger than fenv_t on all glibc targets.
55 Currently, the winner is x86_64 with 32 bytes. */
56 #define GFC_FPE_STATE_BUFFER_SIZE 32
58 /* Bitmasks for the various runtime checks that can be enabled. */
59 #define GFC_RTCHECK_BOUNDS (1<<0)
60 #define GFC_RTCHECK_ARRAY_TEMPS (1<<1)
61 #define GFC_RTCHECK_RECURSION (1<<2)
62 #define GFC_RTCHECK_DO (1<<3)
63 #define GFC_RTCHECK_POINTER (1<<4)
64 #define GFC_RTCHECK_MEM (1<<5)
65 #define GFC_RTCHECK_ALL (GFC_RTCHECK_BOUNDS | GFC_RTCHECK_ARRAY_TEMPS \
66 | GFC_RTCHECK_RECURSION | GFC_RTCHECK_DO \
67 | GFC_RTCHECK_POINTER | GFC_RTCHECK_MEM)
70 /* Possible values for the CONVERT I/O specifier. */
71 typedef enum
73 GFC_CONVERT_NONE = -1,
74 GFC_CONVERT_NATIVE = 0,
75 GFC_CONVERT_SWAP,
76 GFC_CONVERT_BIG,
77 GFC_CONVERT_LITTLE
79 unit_convert;
82 /* Runtime errors. */
83 typedef enum
85 LIBERROR_FIRST = -3, /* Marker for the first error. */
86 LIBERROR_EOR = -2, /* End of record, must be negative. */
87 LIBERROR_END = -1, /* End of file, must be negative. */
88 LIBERROR_OK = 0, /* Indicates success, must be zero. */
89 LIBERROR_OS = 5000, /* OS error, more info in errno. */
90 LIBERROR_OPTION_CONFLICT,
91 LIBERROR_BAD_OPTION,
92 LIBERROR_MISSING_OPTION,
93 LIBERROR_ALREADY_OPEN,
94 LIBERROR_BAD_UNIT,
95 LIBERROR_FORMAT,
96 LIBERROR_BAD_ACTION,
97 LIBERROR_ENDFILE,
98 LIBERROR_BAD_US,
99 LIBERROR_READ_VALUE,
100 LIBERROR_READ_OVERFLOW,
101 LIBERROR_INTERNAL,
102 LIBERROR_INTERNAL_UNIT,
103 LIBERROR_ALLOCATION,
104 LIBERROR_DIRECT_EOR,
105 LIBERROR_SHORT_RECORD,
106 LIBERROR_CORRUPT_FILE,
107 LIBERROR_INQUIRE_INTERNAL_UNIT, /* Must be different from STAT_STOPPED_IMAGE. */
108 LIBERROR_LAST /* Not a real error, the last error # + 1. */
110 libgfortran_error_codes;
112 /* Must kept in sync with libgfortrancaf.h. */
113 typedef enum
115 GFC_STAT_UNLOCKED = 0,
116 GFC_STAT_LOCKED,
117 GFC_STAT_LOCKED_OTHER_IMAGE,
118 GFC_STAT_STOPPED_IMAGE = 6000, /* See LIBERROR_INQUIRE_INTERNAL_UNIT above. */
119 GFC_STAT_FAILED_IMAGE
121 libgfortran_stat_codes;
123 typedef enum
125 GFC_CAF_ATOMIC_ADD = 1,
126 GFC_CAF_ATOMIC_AND,
127 GFC_CAF_ATOMIC_OR,
128 GFC_CAF_ATOMIC_XOR
129 } libcaf_atomic_codes;
131 /* Default unit number for preconnected standard input and output. */
132 #define GFC_STDIN_UNIT_NUMBER 5
133 #define GFC_STDOUT_UNIT_NUMBER 6
134 #define GFC_STDERR_UNIT_NUMBER 0
137 /* FIXME: Increase to 15 for Fortran 2008. Also needs changes to
138 GFC_DTYPE_RANK_MASK. See PR 36825. */
139 #define GFC_MAX_DIMENSIONS 7
141 #define GFC_DTYPE_RANK_MASK 0x07
142 #define GFC_DTYPE_TYPE_SHIFT 3
143 #define GFC_DTYPE_TYPE_MASK 0x38
144 #define GFC_DTYPE_SIZE_SHIFT 6
146 /* Basic types. BT_VOID is used by ISO C Binding so funcs like c_f_pointer
147 can take any arg with the pointer attribute as a param. These are also
148 used in the run-time library for IO. */
149 typedef enum
150 { BT_UNKNOWN = 0, BT_INTEGER, BT_LOGICAL, BT_REAL, BT_COMPLEX,
151 BT_DERIVED, BT_CHARACTER, BT_CLASS, BT_PROCEDURE, BT_HOLLERITH, BT_VOID,
152 BT_ASSUMED