OSDN Git Service

85bd43df98c047a2a0a6c967baab9b517a044101
[pf3gnuchains/gcc-fork.git] / gcc / fortran / libgfortran.h
1 /* Header file to the Fortran front-end and runtime library
2    Copyright (C) 2007, 2008, 2009, 2010
3    Free Software Foundation, Inc.
4
5 This file is part of GCC.
6
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
10 version.
11
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3.  If not see
19 <http://www.gnu.org/licenses/>.  */
20
21
22 /* Flags to specify which standard/extension contains a feature.
23    Note that no features were obsoleted nor deleted in F2003.
24    Please remember to keep those definitions in sync with
25    gfortran.texi.  */
26 #define GFC_STD_F2008   (1<<7)  /* New in F2008.  */
27 #define GFC_STD_LEGACY  (1<<6)  /* Backward compatibility.  */
28 #define GFC_STD_GNU     (1<<5)  /* GNU Fortran extension.  */
29 #define GFC_STD_F2003   (1<<4)  /* New in F2003.  */
30 #define GFC_STD_F95     (1<<3)  /* New in F95.  */
31 #define GFC_STD_F95_DEL (1<<2)  /* Deleted in F95.  */
32 #define GFC_STD_F95_OBS (1<<1)  /* Obsolescent in F95.  */
33 #define GFC_STD_F77     (1<<0)  /* Included in F77, but not deleted or
34                                    obsolescent in later standards.  */
35
36
37 /* Bitmasks for the various FPE that can be enabled.  */
38 #define GFC_FPE_INVALID    (1<<0)
39 #define GFC_FPE_DENORMAL   (1<<1)
40 #define GFC_FPE_ZERO       (1<<2)
41 #define GFC_FPE_OVERFLOW   (1<<3)
42 #define GFC_FPE_UNDERFLOW  (1<<4)
43 #define GFC_FPE_PRECISION  (1<<5)
44
45
46 /* Bitmasks for the various runtime checks that can be enabled.  */
47 #define GFC_RTCHECK_BOUNDS      (1<<0)
48 #define GFC_RTCHECK_ARRAY_TEMPS (1<<1)
49 #define GFC_RTCHECK_RECURSION   (1<<2)
50 #define GFC_RTCHECK_DO          (1<<3)
51 #define GFC_RTCHECK_POINTER     (1<<4)
52 #define GFC_RTCHECK_MEM         (1<<5)
53 #define GFC_RTCHECK_ALL        (GFC_RTCHECK_BOUNDS | GFC_RTCHECK_ARRAY_TEMPS \
54                                 | GFC_RTCHECK_RECURSION | GFC_RTCHECK_DO \
55                                 | GFC_RTCHECK_POINTER | GFC_RTCHECK_MEM)
56
57
58 /* Possible values for the CONVERT I/O specifier.  */
59 typedef enum
60 {
61   GFC_CONVERT_NONE = -1,
62   GFC_CONVERT_NATIVE = 0,
63   GFC_CONVERT_SWAP,
64   GFC_CONVERT_BIG,
65   GFC_CONVERT_LITTLE
66 }
67 unit_convert;
68
69
70 /* Runtime errors.  */
71 typedef enum
72 {
73   LIBERROR_FIRST = -3,          /* Marker for the first error.  */
74   LIBERROR_EOR = -2,            /* End of record, must be negative.  */
75   LIBERROR_END = -1,            /* End of file, must be negative.  */
76   LIBERROR_OK = 0,              /* Indicates success, must be zero.  */
77   LIBERROR_OS = 5000,           /* OS error, more info in errno.  */
78   LIBERROR_OPTION_CONFLICT,
79   LIBERROR_BAD_OPTION,
80   LIBERROR_MISSING_OPTION,
81   LIBERROR_ALREADY_OPEN,
82   LIBERROR_BAD_UNIT,
83   LIBERROR_FORMAT,
84   LIBERROR_BAD_ACTION,
85   LIBERROR_ENDFILE,
86   LIBERROR_BAD_US,
87   LIBERROR_READ_VALUE,
88   LIBERROR_READ_OVERFLOW,
89   LIBERROR_INTERNAL,
90   LIBERROR_INTERNAL_UNIT,
91   LIBERROR_ALLOCATION,
92   LIBERROR_DIRECT_EOR,
93   LIBERROR_SHORT_RECORD,
94   LIBERROR_CORRUPT_FILE,
95   LIBERROR_LAST                 /* Not a real error, the last error # + 1.  */
96 }
97 libgfortran_error_codes;
98
99 typedef enum
100 {
101   GFC_STAT_UNLOCKED = 0,
102   GFC_STAT_LOCKED,
103   GFC_STAT_LOCKED_OTHER_IMAGE,
104   GFC_STAT_STOPPED_IMAGE,
105   GFC_INQUIRE_INTERNAL_UNIT  /* Must be different from STAT_STOPPED_IMAGE.  */
106 }
107 libgfortran_stat_codes;
108
109 /* Default unit number for preconnected standard input and output.  */
110 #define GFC_STDIN_UNIT_NUMBER 5
111 #define GFC_STDOUT_UNIT_NUMBER 6
112 #define GFC_STDERR_UNIT_NUMBER 0
113
114
115 /* FIXME: Increase to 15 for Fortran 2008. Also needs changes to
116    GFC_DTYPE_RANK_MASK. See PR 36825.  */
117 #define GFC_MAX_DIMENSIONS 7
118
119 #define GFC_DTYPE_RANK_MASK 0x07
120 #define GFC_DTYPE_TYPE_SHIFT 3
121 #define GFC_DTYPE_TYPE_MASK 0x38
122 #define GFC_DTYPE_SIZE_SHIFT 6
123
124 typedef enum
125 {
126   GFC_DTYPE_UNKNOWN = 0,
127   GFC_DTYPE_INTEGER,
128   /* TODO: recognize logical types.  */
129   GFC_DTYPE_LOGICAL,
130   GFC_DTYPE_REAL,
131   GFC_DTYPE_COMPLEX,
132   GFC_DTYPE_DERIVED,
133   GFC_DTYPE_CHARACTER
134 }
135 dtype;
136