xref: /openbsd/gnu/usr.bin/gcc/gcc/f/info.h (revision c87b03e5)
1 /* info.h -- Public #include File (module.h template V1.0)
2    Copyright (C) 1995 Free Software Foundation, Inc.
3    Contributed by James Craig Burley.
4 
5 This file is part of GNU Fortran.
6 
7 GNU Fortran is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11 
12 GNU Fortran is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with GNU Fortran; see the file COPYING.  If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA.
21 
22    Owning Modules:
23       info.c
24 
25    Modifications:
26       30-Aug-90	 JCB  2.0
27 	 Extensive rewrite for new cleaner approach.
28 */
29 
30 /* Allow multiple inclusion to work. */
31 
32 #ifndef GCC_F_INFO_H
33 #define GCC_F_INFO_H
34 
35 /* Simple definitions and enumerations. */
36 
37 typedef enum
38   {
39 #define FFEINFO_BASICTYPE(KWD,LNAM,SNAM) KWD,
40 #include "info-b.def"
41 #undef FFEINFO_BASICTYPE
42     FFEINFO_basictype
43   } ffeinfoBasictype;
44 
45 typedef enum
46   {				/* If these kindtypes aren't in size order,
47 				   change _kindtype_max. */
48     FFEINFO_kindtypeNONE,
49     FFEINFO_kindtypeINTEGER1,
50     FFEINFO_kindtypeINTEGER2,
51     FFEINFO_kindtypeINTEGER3,
52     FFEINFO_kindtypeINTEGER4,
53     FFEINFO_kindtypeINTEGER5,
54     FFEINFO_kindtypeINTEGER6,
55     FFEINFO_kindtypeINTEGER7,
56     FFEINFO_kindtypeINTEGER8,
57     FFEINFO_kindtypeLOGICAL1 = 1,	/* Ok to omit, but ok to overlap. */
58     FFEINFO_kindtypeLOGICAL2,
59     FFEINFO_kindtypeLOGICAL3,
60     FFEINFO_kindtypeLOGICAL4,
61     FFEINFO_kindtypeLOGICAL5,
62     FFEINFO_kindtypeLOGICAL6,
63     FFEINFO_kindtypeLOGICAL7,
64     FFEINFO_kindtypeLOGICAL8,
65     FFEINFO_kindtypeREAL1 = 1,	/* Ok to omit, but ok to overlap. */
66     FFEINFO_kindtypeREAL2,
67     FFEINFO_kindtypeREAL3,
68     FFEINFO_kindtypeREAL4,
69     FFEINFO_kindtypeREAL5,
70     FFEINFO_kindtypeREAL6,
71     FFEINFO_kindtypeREAL7,
72     FFEINFO_kindtypeREAL8,
73     FFEINFO_kindtypeCHARACTER1 = 1,	/* Ok to omit, but ok to overlap. */
74     FFEINFO_kindtypeCHARACTER2,
75     FFEINFO_kindtypeCHARACTER3,
76     FFEINFO_kindtypeCHARACTER4,
77     FFEINFO_kindtypeCHARACTER5,
78     FFEINFO_kindtypeCHARACTER6,
79     FFEINFO_kindtypeCHARACTER7,
80     FFEINFO_kindtypeCHARACTER8,
81     FFEINFO_kindtypeANY,
82     FFEINFO_kindtype
83   } ffeinfoKindtype;
84 
85 typedef enum
86   {
87 #define FFEINFO_KIND(KWD,LNAM,SNAM) KWD,
88 #include "info-k.def"
89 #undef FFEINFO_KIND
90     FFEINFO_kind
91   } ffeinfoKind;
92 
93 typedef enum
94   {
95 #define FFEINFO_WHERE(KWD,LNAM,SNAM) KWD,
96 #include "info-w.def"
97 #undef FFEINFO_WHERE
98     FFEINFO_where
99   } ffeinfoWhere;
100 
101 /* Typedefs. */
102 
103 typedef struct _ffeinfo_ ffeinfo;
104 typedef char ffeinfoRank;
105 
106 /* Include files needed by this one. */
107 
108 #include "target.h"
109 #include "type.h"
110 
111 /* Structure definitions. */
112 
113 struct _ffeinfo_
114   {
115     ffeinfoBasictype basictype;
116     ffeinfoKindtype kindtype;
117     ffeinfoRank rank;
118     ffeinfoKind kind;
119     ffeinfoWhere where;
120     ffetargetCharacterSize size;
121   };
122 
123 /* Global objects accessed by users of this module. */
124 
125 
126 /* Declare functions with prototypes. */
127 
128 ffeinfoBasictype ffeinfo_basictype_combine (ffeinfoBasictype l,
129 					    ffeinfoBasictype r);
130 const char *ffeinfo_basictype_string (ffeinfoBasictype basictype);
131 void ffeinfo_init_0 (void);
132 const char *ffeinfo_kind_message (ffeinfoKind kind);
133 const char *ffeinfo_kind_string (ffeinfoKind kind);
134 ffeinfoKindtype ffeinfo_kindtype_max(ffeinfoBasictype bt,
135 				     ffeinfoKindtype k1,
136 				     ffeinfoKindtype k2);
137 const char *ffeinfo_kindtype_string (ffeinfoKindtype kind_type);
138 const char *ffeinfo_where_string (ffeinfoWhere where);
139 ffeinfo ffeinfo_new (ffeinfoBasictype basictype, ffeinfoKindtype kindtype,
140 		     ffeinfoRank rank, ffeinfoKind kind, ffeinfoWhere where,
141 		     ffetargetCharacterSize size);
142 void ffeinfo_set_type (ffeinfoBasictype basictype, ffeinfoKindtype kindtype,
143 		       ffetype type);
144 ffetype ffeinfo_type (ffeinfoBasictype basictype, ffeinfoKindtype kindtype);
145 
146 /* Define macros. */
147 
148 #define ffeinfo_basictype(i) (i.basictype)
149 #define ffeinfo_init_1()
150 #define ffeinfo_init_2()
151 #define ffeinfo_init_3()
152 #define ffeinfo_init_4()
153 #define ffeinfo_kind(i) (i.kind)
154 #define ffeinfo_kindtype(i) (i.kindtype)
155 #ifdef __GNUC__
156 #define ffeinfo_new(bt,kt,r,k,w,sz) \
157   ((ffeinfo) {(bt), (kt), (r), (k), (w), (sz)})
158 #endif
159 #define ffeinfo_new_any()						      \
160   ffeinfo_new (FFEINFO_basictypeANY, FFEINFO_kindtypeANY, 0,		      \
161 	       FFEINFO_kindANY, FFEINFO_whereANY,			      \
162 	       FFETARGET_charactersizeNONE)
163 #define ffeinfo_new_null()						      \
164   ffeinfo_new (FFEINFO_basictypeNONE, FFEINFO_kindtypeNONE, 0,		      \
165 	       FFEINFO_kindNONE, FFEINFO_whereNONE,			      \
166 	       FFETARGET_charactersizeNONE)
167 #define ffeinfo_rank(i) (i.rank)
168 #define ffeinfo_size(i) (i.size)
169 #define ffeinfo_terminate_0()
170 #define ffeinfo_terminate_1()
171 #define ffeinfo_terminate_2()
172 #define ffeinfo_terminate_3()
173 #define ffeinfo_terminate_4()
174 #define ffeinfo_use(i) i
175 #define ffeinfo_where(i) (i.where)
176 
177 #define FFEINFO_kindtypeINTEGERDEFAULT FFEINFO_kindtypeINTEGER1
178 #define FFEINFO_kindtypeLOGICALDEFAULT FFEINFO_kindtypeLOGICAL1
179 #define FFEINFO_kindtypeREALDEFAULT FFEINFO_kindtypeREAL1
180 #define FFEINFO_kindtypeREALDOUBLE FFEINFO_kindtypeREAL2
181 #define FFEINFO_kindtypeREALQUAD FFEINFO_kindtypeREAL3
182 #define FFEINFO_kindtypeCHARACTERDEFAULT FFEINFO_kindtypeCHARACTER1
183 
184 /* End of #include file. */
185 
186 #endif /* ! GCC_F_INFO_H */
187