]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/fortran/libgfortran.h
Update copyright years in gcc/
[thirdparty/gcc.git] / gcc / fortran / libgfortran.h
CommitLineData
d74b97cc 1/* Header file to the Fortran front-end and runtime library
23a5b65a 2 Copyright (C) 2007-2014 Free Software Foundation, Inc.
d74b97cc
FXC
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
8Software Foundation; either version 3, or (at your option) any later
9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14for more details.
15
16You should have received a copy of the GNU General Public License
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
19
20
21/* Flags to specify which standard/extension contains a feature.
9e0667cd
TB
22 Note that no features were obsoleted nor deleted in F2003.
23 Please remember to keep those definitions in sync with
24 gfortran.texi. */
4650947d 25#define GFC_STD_F2008_TS (1<<9) /* POST-F2008 technical reports. */
58fc89f6
TB
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. */
d74b97cc
FXC
36
37
38/* Bitmasks for the various FPE that can be enabled. */
39#define GFC_FPE_INVALID (1<<0)
40#define GFC_FPE_DENORMAL (1<<1)
41#define GFC_FPE_ZERO (1<<2)
42#define GFC_FPE_OVERFLOW (1<<3)
43#define GFC_FPE_UNDERFLOW (1<<4)
57b4d355 44#define GFC_FPE_INEXACT (1<<5)
d74b97cc 45
82a4f54c
TB
46/* Defines for floating-point rounding modes. */
47#define GFC_FPE_DOWNWARD 1
48#define GFC_FPE_TONEAREST 2
49#define GFC_FPE_TOWARDZERO 3
50#define GFC_FPE_UPWARD 4
51
d74b97cc 52
d3d3011f
FXC
53/* Bitmasks for the various runtime checks that can be enabled. */
54#define GFC_RTCHECK_BOUNDS (1<<0)
55#define GFC_RTCHECK_ARRAY_TEMPS (1<<1)
56#define GFC_RTCHECK_RECURSION (1<<2)
57#define GFC_RTCHECK_DO (1<<3)
20460eb9 58#define GFC_RTCHECK_POINTER (1<<4)
22bdbb0f 59#define GFC_RTCHECK_MEM (1<<5)
d3d3011f 60#define GFC_RTCHECK_ALL (GFC_RTCHECK_BOUNDS | GFC_RTCHECK_ARRAY_TEMPS \
20460eb9 61 | GFC_RTCHECK_RECURSION | GFC_RTCHECK_DO \
22bdbb0f 62 | GFC_RTCHECK_POINTER | GFC_RTCHECK_MEM)
d3d3011f
FXC
63
64
d74b97cc
FXC
65/* Possible values for the CONVERT I/O specifier. */
66typedef enum
67{
68 GFC_CONVERT_NONE = -1,
69 GFC_CONVERT_NATIVE = 0,
70 GFC_CONVERT_SWAP,
71 GFC_CONVERT_BIG,
72 GFC_CONVERT_LITTLE
73}
74unit_convert;
75
76
77/* Runtime errors. */
78typedef enum
79{
80 LIBERROR_FIRST = -3, /* Marker for the first error. */
81 LIBERROR_EOR = -2, /* End of record, must be negative. */
82 LIBERROR_END = -1, /* End of file, must be negative. */
83 LIBERROR_OK = 0, /* Indicates success, must be zero. */
84 LIBERROR_OS = 5000, /* OS error, more info in errno. */
85 LIBERROR_OPTION_CONFLICT,
86 LIBERROR_BAD_OPTION,
87 LIBERROR_MISSING_OPTION,
88 LIBERROR_ALREADY_OPEN,
89 LIBERROR_BAD_UNIT,
90 LIBERROR_FORMAT,
91 LIBERROR_BAD_ACTION,
92 LIBERROR_ENDFILE,
93 LIBERROR_BAD_US,
94 LIBERROR_READ_VALUE,
95 LIBERROR_READ_OVERFLOW,
96 LIBERROR_INTERNAL,
97 LIBERROR_INTERNAL_UNIT,
98 LIBERROR_ALLOCATION,
99 LIBERROR_DIRECT_EOR,
100 LIBERROR_SHORT_RECORD,
101 LIBERROR_CORRUPT_FILE,
be1f1ed9 102 LIBERROR_INQUIRE_INTERNAL_UNIT, /* Must be different from STAT_STOPPED_IMAGE. */
d74b97cc
FXC
103 LIBERROR_LAST /* Not a real error, the last error # + 1. */
104}
105libgfortran_error_codes;
106
60386f50 107/* Must kept in sync with libgfortrancaf.h. */
385e8144
TB
108typedef enum
109{
110 GFC_STAT_UNLOCKED = 0,
111 GFC_STAT_LOCKED,
112 GFC_STAT_LOCKED_OTHER_IMAGE,
5d81ddd0 113 GFC_STAT_STOPPED_IMAGE = 6000 /* See LIBERROR_INQUIRE_INTERNAL_UNIT above. */
385e8144
TB
114}
115libgfortran_stat_codes;
d74b97cc
FXC
116
117/* Default unit number for preconnected standard input and output. */
118#define GFC_STDIN_UNIT_NUMBER 5
119#define GFC_STDOUT_UNIT_NUMBER 6
120#define GFC_STDERR_UNIT_NUMBER 0
121
122
6c397102
TB
123/* FIXME: Increase to 15 for Fortran 2008. Also needs changes to
124 GFC_DTYPE_RANK_MASK. See PR 36825. */
125#define GFC_MAX_DIMENSIONS 7
d74b97cc
FXC
126
127#define GFC_DTYPE_RANK_MASK 0x07
128#define GFC_DTYPE_TYPE_SHIFT 3
129#define GFC_DTYPE_TYPE_MASK 0x38
130#define GFC_DTYPE_SIZE_SHIFT 6
131
a11930ba
JD
132/* Basic types. BT_VOID is used by ISO C Binding so funcs like c_f_pointer
133 can take any arg with the pointer attribute as a param. These are also
134 used in the run-time library for IO. */
ffa61a5e 135typedef enum
a11930ba 136{ BT_UNKNOWN = 0, BT_INTEGER, BT_LOGICAL, BT_REAL, BT_COMPLEX,
45a69325
TB
137 BT_DERIVED, BT_CHARACTER, BT_CLASS, BT_PROCEDURE, BT_HOLLERITH, BT_VOID,
138 BT_ASSUMED
ffa61a5e 139}
a11930ba 140bt;