]>
Commit | Line | Data |
---|---|---|
56c15991 | 1 | /* Common declarations for all of libgfortran. |
84d33b91 | 2 | Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 |
3 | Free Software Foundation, Inc. | |
4ee9c684 | 4 | Contributed by Paul Brook <paul@nowt.org>, and |
5 | Andy Vaught <andy@xena.eas.asu.edu> | |
6 | ||
b417ea8c | 7 | This file is part of the GNU Fortran 95 runtime library (libgfortran). |
4ee9c684 | 8 | |
b417ea8c | 9 | Libgfortran is free software; you can redistribute it and/or |
4ee9c684 | 10 | modify it under the terms of the GNU Lesser General Public |
11 | License as published by the Free Software Foundation; either | |
12 | version 2.1 of the License, or (at your option) any later version. | |
13 | ||
b417ea8c | 14 | Libgfortran is distributed in the hope that it will be useful, |
4ee9c684 | 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | GNU Lesser General Public License for more details. | |
18 | ||
19 | You should have received a copy of the GNU Lesser General Public | |
20 | License along with libgfor; see the file COPYING.LIB. If not, | |
5ac2525b | 21 | write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
22 | Boston, MA 02110-1301, USA. */ | |
4ee9c684 | 23 | |
b417ea8c | 24 | /* As a special exception, if you link this library with other files, |
25 | some of which are compiled with GCC, to produce an executable, | |
26 | this library does not by itself cause the resulting executable | |
27 | to be covered by the GNU General Public License. | |
28 | This exception does not however invalidate any other reasons why | |
29 | the executable file might be covered by the GNU General Public License. */ | |
30 | ||
4ee9c684 | 31 | |
32 | #ifndef LIBGFOR_H | |
33 | #define LIBGFOR_H | |
34 | ||
52a2cc79 | 35 | /* config.h MUST be first because it can affect system headers. */ |
36 | #include "config.h" | |
37 | ||
5a037dbd | 38 | #include <stdio.h> |
4ee9c684 | 39 | #include <math.h> |
40 | #include <stddef.h> | |
0ee93d57 | 41 | #include <float.h> |
d17a1468 | 42 | #include <stdarg.h> |
4ee9c684 | 43 | |
4ee9c684 | 44 | #if HAVE_COMPLEX_H |
45 | # include <complex.h> | |
46 | #else | |
47 | #define complex __complex__ | |
48 | #endif | |
49 | ||
18f0b7df | 50 | #include "../gcc/fortran/libgfortran.h" |
51 | ||
d213114b | 52 | #include "c99_protos.h" |
53 | ||
334f03a1 | 54 | #if HAVE_IEEEFP_H |
55 | #include <ieeefp.h> | |
56 | #endif | |
57 | ||
56c15991 | 58 | #include "gstdint.h" |
c436f700 | 59 | |
4ee9c684 | 60 | #if HAVE_SYS_TYPES_H |
61 | #include <sys/types.h> | |
62 | #endif | |
b093181d | 63 | typedef off_t gfc_offset; |
4ee9c684 | 64 | |
65 | #ifndef NULL | |
66 | #define NULL (void *) 0 | |
67 | #endif | |
68 | ||
69 | #ifndef __GNUC__ | |
70 | #define __attribute__(x) | |
71 | #endif | |
72 | ||
76c0a846 | 73 | |
3b99ec70 | 74 | /* On mingw, work around the buggy Windows snprintf() by using the one |
75 | mingw provides, __mingw_snprintf(). We also provide a prototype for | |
76 | __mingw_snprintf(), because the mingw headers currently don't have one. */ | |
77 | #if HAVE_MINGW_SNPRINTF | |
78 | extern int __mingw_snprintf (char *, size_t, const char *, ...); | |
79 | #undef snprintf | |
80 | #define snprintf __mingw_snprintf | |
81 | #endif | |
82 | ||
83 | ||
7b6cb5bd | 84 | /* For a library, a standard prefix is a requirement in order to partition |
85 | the namespace. IPREFIX is for symbols intended to be internal to the | |
86 | library. */ | |
87 | #define PREFIX(x) _gfortran_ ## x | |
88 | #define IPREFIX(x) _gfortrani_ ## x | |
89 | ||
90 | /* Magic to rename a symbol at the compiler level. You continue to refer | |
91 | to the symbol as OLD in the source, but it'll be named NEW in the asm. */ | |
92 | #define sym_rename(old, new) sym_rename1(old, __USER_LABEL_PREFIX__, new) | |
93 | #define sym_rename1(old, ulp, new) sym_rename2(old, ulp, new) | |
94 | #define sym_rename2(old, ulp, new) extern __typeof(old) old __asm__(#ulp #new) | |
95 | ||
96 | /* There are several classifications of routines: | |
97 | ||
98 | (1) Symbols used only within the library, | |
99 | (2) Symbols to be exported from the library, | |
100 | (3) Symbols to be exported from the library, but | |
101 | also used inside the library. | |
102 | ||
103 | By telling the compiler about these different classifications we can | |
104 | tightly control the interface seen by the user, and get better code | |
105 | from the compiler at the same time. | |
106 | ||
107 | One of the following should be used immediately after the declaration | |
108 | of each symbol: | |
109 | ||
110 | internal_proto Marks a symbol used only within the library, | |
111 | and adds IPREFIX to the assembly-level symbol | |
112 | name. The later is important for maintaining | |
113 | the namespace partition for the static library. | |
114 | ||
115 | export_proto Marks a symbol to be exported, and adds PREFIX | |
116 | to the assembly-level symbol name. | |
117 | ||
118 | export_proto_np Marks a symbol to be exported without adding PREFIX. | |
119 | ||
120 | iexport_proto Marks a function to be exported, but with the | |
121 | understanding that it can be used inside as well. | |
122 | ||
123 | iexport_data_proto Similarly, marks a data symbol to be exported. | |
124 | Unfortunately, some systems can't play the hidden | |
125 | symbol renaming trick on data symbols, thanks to | |
126 | the horribleness of COPY relocations. | |
127 | ||
128 | If iexport_proto or iexport_data_proto is used, you must also use | |
129 | iexport or iexport_data after the *definition* of the symbol. */ | |
130 | ||
131 | #if defined(HAVE_ATTRIBUTE_VISIBILITY) | |
132 | # define internal_proto(x) \ | |
133 | sym_rename(x, IPREFIX (x)) __attribute__((__visibility__("hidden"))) | |
134 | #else | |
135 | # define internal_proto(x) sym_rename(x, IPREFIX(x)) | |
136 | #endif | |
137 | ||
138 | #if defined(HAVE_ATTRIBUTE_VISIBILITY) && defined(HAVE_ATTRIBUTE_ALIAS) | |
139 | # define export_proto(x) sym_rename(x, PREFIX(x)) | |
140 | # define export_proto_np(x) extern char swallow_semicolon | |
141 | # define iexport_proto(x) internal_proto(x) | |
888d4c42 | 142 | # define iexport(x) iexport1(x, IPREFIX(x)) |
143 | # define iexport1(x,y) iexport2(x,y) | |
144 | # define iexport2(x,y) \ | |
145 | extern __typeof(x) PREFIX(x) __attribute__((__alias__(#y))) | |
7b6cb5bd | 146 | /* ??? We're not currently building a dll, and it's wrong to add dllexport |
147 | to objects going into a static library archive. */ | |
148 | #elif 0 && defined(HAVE_ATTRIBUTE_DLLEXPORT) | |
149 | # define export_proto_np(x) extern __typeof(x) x __attribute__((dllexport)) | |
150 | # define export_proto(x) sym_rename(x, PREFIX(x)) __attribute__((dllexport)) | |
151 | # define iexport_proto(x) export_proto(x) | |
152 | # define iexport(x) extern char swallow_semicolon | |
153 | #else | |
154 | # define export_proto(x) sym_rename(x, PREFIX(x)) | |
155 | # define export_proto_np(x) extern char swallow_semicolon | |
156 | # define iexport_proto(x) export_proto(x) | |
157 | # define iexport(x) extern char swallow_semicolon | |
158 | #endif | |
159 | ||
160 | /* TODO: detect the case when we *can* hide the symbol. */ | |
161 | #define iexport_data_proto(x) export_proto(x) | |
162 | #define iexport_data(x) extern char swallow_semicolon | |
4ee9c684 | 163 | |
164 | /* The only reliable way to get the offset of a field in a struct | |
165 | in a system independent way is via this macro. */ | |
166 | #ifndef offsetof | |
167 | #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *) 0)->MEMBER) | |
168 | #endif | |
169 | ||
fd48ced8 | 170 | /* The isfinite macro is only available with C99, but some non-C99 |
171 | systems still provide fpclassify, and there is a `finite' function | |
b1c49a11 | 172 | in BSD. |
173 | ||
174 | Also, isfinite is broken on Cygwin. | |
175 | ||
176 | When isfinite is not available, try to use one of the | |
fd48ced8 | 177 | alternatives, or bail out. */ |
839904a0 | 178 | |
179 | #if defined(HAVE_BROKEN_ISFINITE) || defined(__CYGWIN__) | |
b1c49a11 | 180 | #undef isfinite |
839904a0 | 181 | #endif |
182 | ||
183 | #if defined(HAVE_BROKEN_ISNAN) | |
184 | #undef isnan | |
185 | #endif | |
186 | ||
187 | #if defined(HAVE_BROKEN_FPCLASSIFY) | |
188 | #undef fpclassify | |
189 | #endif | |
190 | ||
191 | #if !defined(isfinite) | |
192 | #if !defined(fpclassify) | |
193 | #define isfinite(x) ((x) - (x) == 0) | |
194 | #else | |
c14474b7 | 195 | #define isfinite(x) (fpclassify(x) != FP_NAN && fpclassify(x) != FP_INFINITE) |
839904a0 | 196 | #endif /* !defined(fpclassify) */ |
197 | #endif /* !defined(isfinite) */ | |
198 | ||
199 | #if !defined(isnan) | |
200 | #if !defined(fpclassify) | |
201 | #define isnan(x) ((x) != (x)) | |
fd48ced8 | 202 | #else |
839904a0 | 203 | #define isnan(x) (fpclassify(x) == FP_NAN) |
204 | #endif /* !defined(fpclassify) */ | |
fd48ced8 | 205 | #endif /* !defined(isfinite) */ |
206 | ||
4ee9c684 | 207 | /* TODO: find the C99 version of these an move into above ifdef. */ |
208 | #define REALPART(z) (__real__(z)) | |
209 | #define IMAGPART(z) (__imag__(z)) | |
210 | #define COMPLEX_ASSIGN(z_, r_, i_) {__real__(z_) = (r_); __imag__(z_) = (i_);} | |
211 | ||
14c3c235 | 212 | #include "kinds.h" |
4ee9c684 | 213 | |
2185ae8c | 214 | /* Define the type used for the current record number for large file I/O. |
215 | The size must be consistent with the size defined on the compiler side. */ | |
216 | #ifdef HAVE_GFC_INTEGER_8 | |
4d8ee55b | 217 | typedef GFC_INTEGER_8 GFC_IO_INT; |
2185ae8c | 218 | #else |
219 | #ifdef HAVE_GFC_INTEGER_4 | |
4d8ee55b | 220 | typedef GFC_INTEGER_4 GFC_IO_INT; |
2185ae8c | 221 | #else |
222 | #error "GFC_INTEGER_4 should be available for the library to compile". | |
223 | #endif | |
224 | #endif | |
225 | ||
b496d698 | 226 | /* The following two definitions must be consistent with the types used |
227 | by the compiler. */ | |
228 | /* The type used of array indices, amongst other things. */ | |
077620f0 | 229 | typedef ssize_t index_type; |
9ad09405 | 230 | /* The type used for the lengths of character variables. */ |
231 | typedef GFC_INTEGER_4 gfc_charlen_type; | |
4ee9c684 | 232 | |
233 | /* This will be 0 on little-endian machines and one on big-endian machines. */ | |
4ee9c684 | 234 | extern int l8_to_l4_offset; |
7b6cb5bd | 235 | internal_proto(l8_to_l4_offset); |
4ee9c684 | 236 | |
7ed8f627 | 237 | #define GFOR_POINTER_TO_L1(p, kind) \ |
238 | (l8_to_l4_offset * (kind - 1) + (GFC_LOGICAL_1 *)(p)) | |
4ee9c684 | 239 | |
dd765455 | 240 | #define GFC_INTEGER_1_HUGE \ |
241 | (GFC_INTEGER_1)((((GFC_UINTEGER_1)1) << 7) - 1) | |
242 | #define GFC_INTEGER_2_HUGE \ | |
243 | (GFC_INTEGER_2)((((GFC_UINTEGER_2)1) << 15) - 1) | |
4ee9c684 | 244 | #define GFC_INTEGER_4_HUGE \ |
245 | (GFC_INTEGER_4)((((GFC_UINTEGER_4)1) << 31) - 1) | |
246 | #define GFC_INTEGER_8_HUGE \ | |
247 | (GFC_INTEGER_8)((((GFC_UINTEGER_8)1) << 63) - 1) | |
920e54ef | 248 | #ifdef HAVE_GFC_INTEGER_16 |
249 | #define GFC_INTEGER_16_HUGE \ | |
250 | (GFC_INTEGER_16)((((GFC_UINTEGER_16)1) << 127) - 1) | |
251 | #endif | |
252 | ||
4ee9c684 | 253 | |
254 | typedef struct descriptor_dimension | |
255 | { | |
256 | index_type stride; | |
257 | index_type lbound; | |
258 | index_type ubound; | |
259 | } | |
260 | descriptor_dimension; | |
261 | ||
262 | #define GFC_ARRAY_DESCRIPTOR(r, type) \ | |
263 | struct {\ | |
264 | type *data;\ | |
93830de1 | 265 | size_t offset;\ |
4ee9c684 | 266 | index_type dtype;\ |
267 | descriptor_dimension dim[r];\ | |
268 | } | |
269 | ||
270 | /* Commonly used array descriptor types. */ | |
271 | typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, void) gfc_array_void; | |
272 | typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, char) gfc_array_char; | |
dd765455 | 273 | typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_1) gfc_array_i1; |
274 | typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_2) gfc_array_i2; | |
4ee9c684 | 275 | typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_4) gfc_array_i4; |
276 | typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_8) gfc_array_i8; | |
920e54ef | 277 | #ifdef HAVE_GFC_INTEGER_16 |
278 | typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_16) gfc_array_i16; | |
279 | #endif | |
4ee9c684 | 280 | typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_REAL_4) gfc_array_r4; |
281 | typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_REAL_8) gfc_array_r8; | |
920e54ef | 282 | #ifdef HAVE_GFC_REAL_10 |
283 | typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_REAL_10) gfc_array_r10; | |
284 | #endif | |
285 | #ifdef HAVE_GFC_REAL_16 | |
286 | typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_REAL_16) gfc_array_r16; | |
287 | #endif | |
4ee9c684 | 288 | typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_COMPLEX_4) gfc_array_c4; |
289 | typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_COMPLEX_8) gfc_array_c8; | |
920e54ef | 290 | #ifdef HAVE_GFC_COMPLEX_10 |
291 | typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_COMPLEX_10) gfc_array_c10; | |
292 | #endif | |
293 | #ifdef HAVE_GFC_COMPLEX_16 | |
294 | typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_COMPLEX_16) gfc_array_c16; | |
295 | #endif | |
7ed8f627 | 296 | typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_1) gfc_array_l1; |
297 | typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_2) gfc_array_l2; | |
4ee9c684 | 298 | typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_4) gfc_array_l4; |
299 | typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_8) gfc_array_l8; | |
920e54ef | 300 | #ifdef HAVE_GFC_LOGICAL_16 |
301 | typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_16) gfc_array_l16; | |
302 | #endif | |
4ee9c684 | 303 | |
4ee9c684 | 304 | |
305 | #define GFC_DESCRIPTOR_RANK(desc) ((desc)->dtype & GFC_DTYPE_RANK_MASK) | |
306 | #define GFC_DESCRIPTOR_TYPE(desc) (((desc)->dtype & GFC_DTYPE_TYPE_MASK) \ | |
307 | >> GFC_DTYPE_TYPE_SHIFT) | |
308 | #define GFC_DESCRIPTOR_SIZE(desc) ((desc)->dtype >> GFC_DTYPE_SIZE_SHIFT) | |
309 | #define GFC_DESCRIPTOR_DATA(desc) ((desc)->data) | |
310 | #define GFC_DESCRIPTOR_DTYPE(desc) ((desc)->dtype) | |
311 | ||
b74d1e69 | 312 | /* Macros to get both the size and the type with a single masking operation */ |
313 | ||
314 | #define GFC_DTYPE_SIZE_MASK \ | |
315 | ((~((index_type) 0) >> GFC_DTYPE_SIZE_SHIFT) << GFC_DTYPE_SIZE_SHIFT) | |
316 | #define GFC_DTYPE_TYPE_SIZE_MASK (GFC_DTYPE_SIZE_MASK | GFC_DTYPE_TYPE_MASK) | |
317 | ||
318 | #define GFC_DTYPE_TYPE_SIZE(desc) ((desc)->dtype & GFC_DTYPE_TYPE_SIZE_MASK) | |
319 | ||
320 | #define GFC_DTYPE_INTEGER_1 ((GFC_DTYPE_INTEGER << GFC_DTYPE_TYPE_SHIFT) \ | |
321 | | (sizeof(GFC_INTEGER_1) << GFC_DTYPE_SIZE_SHIFT)) | |
322 | #define GFC_DTYPE_INTEGER_2 ((GFC_DTYPE_INTEGER << GFC_DTYPE_TYPE_SHIFT) \ | |
323 | | (sizeof(GFC_INTEGER_2) << GFC_DTYPE_SIZE_SHIFT)) | |
324 | #define GFC_DTYPE_INTEGER_4 ((GFC_DTYPE_INTEGER << GFC_DTYPE_TYPE_SHIFT) \ | |
325 | | (sizeof(GFC_INTEGER_4) << GFC_DTYPE_SIZE_SHIFT)) | |
326 | #define GFC_DTYPE_INTEGER_8 ((GFC_DTYPE_INTEGER << GFC_DTYPE_TYPE_SHIFT) \ | |
327 | | (sizeof(GFC_INTEGER_8) << GFC_DTYPE_SIZE_SHIFT)) | |
328 | #ifdef HAVE_GFC_INTEGER_16 | |
329 | #define GFC_DTYPE_INTEGER_16 ((GFC_DTYPE_INTEGER << GFC_DTYPE_TYPE_SHIFT) \ | |
330 | | (sizeof(GFC_INTEGER_16) << GFC_DTYPE_SIZE_SHIFT)) | |
331 | #endif | |
332 | ||
333 | #define GFC_DTYPE_LOGICAL_1 ((GFC_DTYPE_LOGICAL << GFC_DTYPE_TYPE_SHIFT) \ | |
334 | | (sizeof(GFC_LOGICAL_1) << GFC_DTYPE_SIZE_SHIFT)) | |
335 | #define GFC_DTYPE_LOGICAL_2 ((GFC_DTYPE_LOGICAL << GFC_DTYPE_TYPE_SHIFT) \ | |
336 | | (sizeof(GFC_LOGICAL_2) << GFC_DTYPE_SIZE_SHIFT)) | |
337 | #define GFC_DTYPE_LOGICAL_4 ((GFC_DTYPE_LOGICAL << GFC_DTYPE_TYPE_SHIFT) \ | |
338 | | (sizeof(GFC_LOGICAL_4) << GFC_DTYPE_SIZE_SHIFT)) | |
339 | #define GFC_DTYPE_LOGICAL_8 ((GFC_DTYPE_LOGICAL << GFC_DTYPE_TYPE_SHIFT) \ | |
340 | | (sizeof(GFC_LOGICAL_8) << GFC_DTYPE_SIZE_SHIFT)) | |
341 | #ifdef HAVE_GFC_LOGICAL_16 | |
342 | #define GFC_DTYPE_LOGICAL_16 ((GFC_DTYPE_LOGICAL << GFC_DTYPE_TYPE_SHIFT) \ | |
343 | | (sizeof(GFC_LOGICAL_16) << GFC_DTYPE_SIZE_SHIFT)) | |
344 | #endif | |
345 | ||
346 | #define GFC_DTYPE_REAL_4 ((GFC_DTYPE_REAL << GFC_DTYPE_TYPE_SHIFT) \ | |
347 | | (sizeof(GFC_REAL_4) << GFC_DTYPE_SIZE_SHIFT)) | |
348 | #define GFC_DTYPE_REAL_8 ((GFC_DTYPE_REAL << GFC_DTYPE_TYPE_SHIFT) \ | |
349 | | (sizeof(GFC_REAL_8) << GFC_DTYPE_SIZE_SHIFT)) | |
350 | #ifdef HAVE_GFC_REAL_10 | |
351 | #define GFC_DTYPE_REAL_10 ((GFC_DTYPE_REAL << GFC_DTYPE_TYPE_SHIFT) \ | |
352 | | (sizeof(GFC_REAL_10) << GFC_DTYPE_SIZE_SHIFT)) | |
353 | #endif | |
354 | #ifdef HAVE_GFC_REAL_16 | |
355 | #define GFC_DTYPE_REAL_16 ((GFC_DTYPE_REAL << GFC_DTYPE_TYPE_SHIFT) \ | |
356 | | (sizeof(GFC_REAL_16) << GFC_DTYPE_SIZE_SHIFT)) | |
357 | #endif | |
358 | ||
359 | #define GFC_DTYPE_COMPLEX_4 ((GFC_DTYPE_COMPLEX << GFC_DTYPE_TYPE_SHIFT) \ | |
360 | | (sizeof(GFC_COMPLEX_4) << GFC_DTYPE_SIZE_SHIFT)) | |
361 | #define GFC_DTYPE_COMPLEX_8 ((GFC_DTYPE_COMPLEX << GFC_DTYPE_TYPE_SHIFT) \ | |
362 | | (sizeof(GFC_COMPLEX_8) << GFC_DTYPE_SIZE_SHIFT)) | |
363 | #ifdef HAVE_GFC_COMPLEX_10 | |
364 | #define GFC_DTYPE_COMPLEX_10 ((GFC_DTYPE_COMPLEX << GFC_DTYPE_TYPE_SHIFT) \ | |
365 | | (sizeof(GFC_COMPLEX_10) << GFC_DTYPE_SIZE_SHIFT)) | |
366 | #endif | |
367 | #ifdef HAVE_GFC_COMPLEX_16 | |
368 | #define GFC_DTYPE_COMPLEX_16 ((GFC_DTYPE_COMPLEX << GFC_DTYPE_TYPE_SHIFT) \ | |
369 | | (sizeof(GFC_COMPLEX_16) << GFC_DTYPE_SIZE_SHIFT)) | |
370 | #endif | |
371 | ||
4ee9c684 | 372 | /* Runtime library include. */ |
373 | #define stringize(x) expand_macro(x) | |
374 | #define expand_macro(x) # x | |
375 | ||
376 | /* Runtime options structure. */ | |
377 | ||
378 | typedef struct | |
379 | { | |
ff81ee3b | 380 | int stdin_unit, stdout_unit, stderr_unit, optional_plus; |
4ee9c684 | 381 | int locus; |
382 | ||
383 | int separator_len; | |
384 | const char *separator; | |
385 | ||
3e45a719 | 386 | int use_stderr, all_unbuffered, unbuffered_preconnected, default_recl; |
ed825f1d | 387 | int fpe, dump_core, backtrace; |
4ee9c684 | 388 | } |
389 | options_t; | |
390 | ||
4ee9c684 | 391 | extern options_t options; |
7b6cb5bd | 392 | internal_proto(options); |
4ee9c684 | 393 | |
c7987dcf | 394 | extern void handler (int); |
395 | internal_proto(handler); | |
396 | ||
4ee9c684 | 397 | |
64fc3c4c | 398 | /* Compile-time options that will influence the library. */ |
399 | ||
400 | typedef struct | |
401 | { | |
402 | int warn_std; | |
403 | int allow_std; | |
7833ddd7 | 404 | int pedantic; |
15774a8b | 405 | int convert; |
b7fcd3f9 | 406 | int dump_core; |
99798ba4 | 407 | int backtrace; |
d4862c77 | 408 | int sign_zero; |
f23886ab | 409 | size_t record_marker; |
bbaaa7b1 | 410 | int max_subrecord_length; |
7e5f0027 | 411 | int bounds_check; |
64fc3c4c | 412 | } |
413 | compile_options_t; | |
414 | ||
415 | extern compile_options_t compile_options; | |
416 | internal_proto(compile_options); | |
417 | ||
da6b28c3 | 418 | extern void init_compile_options (void); |
419 | internal_proto(init_compile_options); | |
64fc3c4c | 420 | |
bbaaa7b1 | 421 | #define GFC_MAX_SUBRECORD_LENGTH 2147483639 /* 2**31 - 9 */ |
64fc3c4c | 422 | |
4ee9c684 | 423 | /* Structure for statement options. */ |
424 | ||
425 | typedef struct | |
426 | { | |
427 | const char *name; | |
428 | int value; | |
429 | } | |
430 | st_option; | |
431 | ||
64fc3c4c | 432 | |
158f58e7 | 433 | /* This is returned by notification_std to know if, given the flags |
434 | that were given (-std=, -pedantic) we should issue an error, a warning | |
435 | or nothing. */ | |
436 | typedef enum | |
437 | { SILENT, WARNING, ERROR } | |
438 | notification; | |
439 | ||
02183b45 | 440 | /* This is returned by notify_std and several io functions. */ |
441 | typedef enum | |
442 | { SUCCESS = 1, FAILURE } | |
443 | try; | |
444 | ||
4ee9c684 | 445 | /* The filename and line number don't go inside the globals structure. |
446 | They are set by the rest of the program and must be linked to. */ | |
447 | ||
7b6cb5bd | 448 | /* Location of the current library call (optional). */ |
449 | extern unsigned line; | |
450 | iexport_data_proto(line); | |
4ee9c684 | 451 | |
4ee9c684 | 452 | extern char *filename; |
7b6cb5bd | 453 | iexport_data_proto(filename); |
4ee9c684 | 454 | |
2b573e69 | 455 | /* Avoid conflicting prototypes of alloca() in system headers by using |
456 | GCC's builtin alloca(). */ | |
2b573e69 | 457 | #define gfc_alloca(x) __builtin_alloca(x) |
458 | ||
4ee9c684 | 459 | |
18f0b7df | 460 | /* Directory for creating temporary files. Only used when none of the |
461 | following environment variables exist: GFORTRAN_TMPDIR, TMP and TEMP. */ | |
76c0a846 | 462 | #define DEFAULT_TEMPDIR "/tmp" |
463 | ||
464 | /* The default value of record length for preconnected units is defined | |
465 | here. This value can be overriden by an environment variable. | |
466 | Default value is 1 Gb. */ | |
467 | #define DEFAULT_RECL 1073741824 | |
468 | ||
76c0a846 | 469 | |
470 | #define CHARACTER2(name) \ | |
471 | gfc_charlen_type name ## _len; \ | |
472 | char * name | |
473 | ||
474 | typedef struct st_parameter_common | |
475 | { | |
476 | GFC_INTEGER_4 flags; | |
477 | GFC_INTEGER_4 unit; | |
478 | const char *filename; | |
479 | GFC_INTEGER_4 line; | |
480 | CHARACTER2 (iomsg); | |
481 | GFC_INTEGER_4 *iostat; | |
482 | } | |
483 | st_parameter_common; | |
484 | ||
485 | #undef CHARACTER2 | |
486 | ||
487 | #define IOPARM_LIBRETURN_MASK (3 << 0) | |
488 | #define IOPARM_LIBRETURN_OK (0 << 0) | |
489 | #define IOPARM_LIBRETURN_ERROR (1 << 0) | |
490 | #define IOPARM_LIBRETURN_END (2 << 0) | |
491 | #define IOPARM_LIBRETURN_EOR (3 << 0) | |
492 | #define IOPARM_ERR (1 << 2) | |
493 | #define IOPARM_END (1 << 3) | |
494 | #define IOPARM_EOR (1 << 4) | |
495 | #define IOPARM_HAS_IOSTAT (1 << 5) | |
496 | #define IOPARM_HAS_IOMSG (1 << 6) | |
497 | ||
498 | #define IOPARM_COMMON_MASK ((1 << 7) - 1) | |
499 | ||
500 | #define IOPARM_OPEN_HAS_RECL_IN (1 << 7) | |
501 | #define IOPARM_OPEN_HAS_FILE (1 << 8) | |
502 | #define IOPARM_OPEN_HAS_STATUS (1 << 9) | |
503 | #define IOPARM_OPEN_HAS_ACCESS (1 << 10) | |
504 | #define IOPARM_OPEN_HAS_FORM (1 << 11) | |
505 | #define IOPARM_OPEN_HAS_BLANK (1 << 12) | |
506 | #define IOPARM_OPEN_HAS_POSITION (1 << 13) | |
507 | #define IOPARM_OPEN_HAS_ACTION (1 << 14) | |
508 | #define IOPARM_OPEN_HAS_DELIM (1 << 15) | |
509 | #define IOPARM_OPEN_HAS_PAD (1 << 16) | |
510 | #define IOPARM_OPEN_HAS_CONVERT (1 << 17) | |
84d33b91 | 511 | #define IOPARM_OPEN_HAS_DECIMAL (1 << 18) |
512 | #define IOPARM_OPEN_HAS_ENCODING (1 << 19) | |
513 | #define IOPARM_OPEN_HAS_ROUND (1 << 20) | |
514 | #define IOPARM_OPEN_HAS_SIGN (1 << 21) | |
515 | #define IOPARM_OPEN_HAS_ASYNCHRONOUS (1 << 22) | |
76c0a846 | 516 | |
13f02ebc | 517 | /* library start function and end macro. These can be expanded if needed |
518 | in the future. cmp is st_parameter_common *cmp */ | |
76875ccb | 519 | |
76c0a846 | 520 | extern void library_start (st_parameter_common *); |
7b6cb5bd | 521 | internal_proto(library_start); |
4ee9c684 | 522 | |
60c514ba | 523 | #define library_end() |
4ee9c684 | 524 | |
13f02ebc | 525 | /* main.c */ |
526 | ||
527 | extern void stupid_function_name_for_static_linking (void); | |
528 | internal_proto(stupid_function_name_for_static_linking); | |
529 | ||
7b6cb5bd | 530 | extern void set_args (int, char **); |
531 | export_proto(set_args); | |
4ee9c684 | 532 | |
7b6cb5bd | 533 | extern void get_args (int *, char ***); |
534 | internal_proto(get_args); | |
4ee9c684 | 535 | |
99798ba4 | 536 | extern void store_exe_path (const char *); |
537 | export_proto(store_exe_path); | |
538 | ||
539 | extern char * full_exe_path (void); | |
540 | internal_proto(full_exe_path); | |
541 | ||
542 | /* backtrace.c */ | |
543 | ||
544 | extern void show_backtrace (void); | |
545 | internal_proto(show_backtrace); | |
546 | ||
4ee9c684 | 547 | /* error.c */ |
4ee9c684 | 548 | |
556d0269 | 549 | #define GFC_ITOA_BUF_SIZE (sizeof (GFC_INTEGER_LARGEST) * 3 + 2) |
550 | #define GFC_XTOA_BUF_SIZE (sizeof (GFC_UINTEGER_LARGEST) * 2 + 1) | |
551 | #define GFC_OTOA_BUF_SIZE (sizeof (GFC_INTEGER_LARGEST) * 3 + 1) | |
552 | #define GFC_BTOA_BUF_SIZE (sizeof (GFC_INTEGER_LARGEST) * 8 + 1) | |
553 | ||
b7fcd3f9 | 554 | extern void sys_exit (int) __attribute__ ((noreturn)); |
555 | internal_proto(sys_exit); | |
556 | ||
556d0269 | 557 | extern const char *gfc_itoa (GFC_INTEGER_LARGEST, char *, size_t); |
34991dc4 | 558 | internal_proto(gfc_itoa); |
4ee9c684 | 559 | |
556d0269 | 560 | extern const char *xtoa (GFC_UINTEGER_LARGEST, char *, size_t); |
7b6cb5bd | 561 | internal_proto(xtoa); |
4ee9c684 | 562 | |
7b6cb5bd | 563 | extern void os_error (const char *) __attribute__ ((noreturn)); |
9915365e | 564 | iexport_proto(os_error); |
4ee9c684 | 565 | |
76c0a846 | 566 | extern void show_locus (st_parameter_common *); |
7b6cb5bd | 567 | internal_proto(show_locus); |
4ee9c684 | 568 | |
5a037dbd | 569 | extern void runtime_error (const char *, ...) |
570 | __attribute__ ((noreturn, format (printf, 1, 2))); | |
7b6cb5bd | 571 | iexport_proto(runtime_error); |
4ee9c684 | 572 | |
399aecc1 | 573 | extern void runtime_error_at (const char *, const char *, ...) |
574 | __attribute__ ((noreturn, format (printf, 2, 3))); | |
13f02ebc | 575 | iexport_proto(runtime_error_at); |
576 | ||
76c0a846 | 577 | extern void internal_error (st_parameter_common *, const char *) |
60c514ba | 578 | __attribute__ ((noreturn)); |
7b6cb5bd | 579 | internal_proto(internal_error); |
4ee9c684 | 580 | |
7b6cb5bd | 581 | extern const char *get_oserror (void); |
582 | internal_proto(get_oserror); | |
4ee9c684 | 583 | |
7b6cb5bd | 584 | extern const char *translate_error (int); |
585 | internal_proto(translate_error); | |
4ee9c684 | 586 | |
76c0a846 | 587 | extern void generate_error (st_parameter_common *, int, const char *); |
13f02ebc | 588 | iexport_proto(generate_error); |
4ee9c684 | 589 | |
76c0a846 | 590 | extern try notify_std (st_parameter_common *, int, const char *); |
02183b45 | 591 | internal_proto(notify_std); |
592 | ||
76c0a846 | 593 | extern notification notification_std(int); |
594 | internal_proto(notification_std); | |
595 | ||
8c84a5de | 596 | /* fpu.c */ |
597 | ||
598 | extern void set_fpu (void); | |
599 | internal_proto(set_fpu); | |
600 | ||
4ee9c684 | 601 | /* memory.c */ |
602 | ||
7b6cb5bd | 603 | extern void *get_mem (size_t) __attribute__ ((malloc)); |
604 | internal_proto(get_mem); | |
4ee9c684 | 605 | |
7b6cb5bd | 606 | extern void free_mem (void *); |
607 | internal_proto(free_mem); | |
4ee9c684 | 608 | |
f66be06b | 609 | extern void *internal_malloc_size (size_t) __attribute__ ((malloc)); |
7b6cb5bd | 610 | internal_proto(internal_malloc_size); |
4ee9c684 | 611 | |
4ee9c684 | 612 | /* environ.c */ |
613 | ||
7b6cb5bd | 614 | extern int check_buffered (int); |
615 | internal_proto(check_buffered); | |
4ee9c684 | 616 | |
7b6cb5bd | 617 | extern void init_variables (void); |
618 | internal_proto(init_variables); | |
4ee9c684 | 619 | |
7b6cb5bd | 620 | extern void show_variables (void); |
621 | internal_proto(show_variables); | |
4ee9c684 | 622 | |
76c0a846 | 623 | unit_convert get_unformatted_convert (int); |
624 | internal_proto(get_unformatted_convert); | |
625 | ||
4ee9c684 | 626 | /* string.c */ |
627 | ||
a9b0b7c8 | 628 | extern int find_option (st_parameter_common *, const char *, gfc_charlen_type, |
60c514ba | 629 | const st_option *, const char *); |
7b6cb5bd | 630 | internal_proto(find_option); |
4ee9c684 | 631 | |
a9b0b7c8 | 632 | extern gfc_charlen_type fstrlen (const char *, gfc_charlen_type); |
7b6cb5bd | 633 | internal_proto(fstrlen); |
4ee9c684 | 634 | |
a9b0b7c8 | 635 | extern gfc_charlen_type fstrcpy (char *, gfc_charlen_type, const char *, gfc_charlen_type); |
7b6cb5bd | 636 | internal_proto(fstrcpy); |
4ee9c684 | 637 | |
a9b0b7c8 | 638 | extern gfc_charlen_type cf_strcpy (char *, gfc_charlen_type, const char *); |
7b6cb5bd | 639 | internal_proto(cf_strcpy); |
4ee9c684 | 640 | |
b03ffb00 | 641 | /* io/intrinsics.c */ |
642 | ||
643 | extern void flush_all_units (void); | |
644 | internal_proto(flush_all_units); | |
645 | ||
4ee9c684 | 646 | /* io.c */ |
647 | ||
7b6cb5bd | 648 | extern void init_units (void); |
649 | internal_proto(init_units); | |
4ee9c684 | 650 | |
7b6cb5bd | 651 | extern void close_units (void); |
652 | internal_proto(close_units); | |
4ee9c684 | 653 | |
e4f69ae3 | 654 | extern int unit_to_fd (int); |
655 | internal_proto(unit_to_fd); | |
656 | ||
76c0a846 | 657 | extern int st_printf (const char *, ...) |
658 | __attribute__ ((format (printf, 1, 2))); | |
659 | internal_proto(st_printf); | |
660 | ||
5a037dbd | 661 | extern int st_vprintf (const char *, va_list); |
662 | internal_proto(st_vprintf); | |
663 | ||
f7f911de | 664 | extern char * filename_from_unit (int); |
665 | internal_proto(filename_from_unit); | |
666 | ||
4ee9c684 | 667 | /* stop.c */ |
7b6cb5bd | 668 | |
3a12a488 | 669 | extern void stop_numeric (GFC_INTEGER_4) __attribute__ ((noreturn)); |
7b6cb5bd | 670 | iexport_proto(stop_numeric); |
4ee9c684 | 671 | |
672 | /* reshape_packed.c */ | |
4ee9c684 | 673 | |
7b6cb5bd | 674 | extern void reshape_packed (char *, index_type, const char *, index_type, |
675 | const char *, index_type); | |
676 | internal_proto(reshape_packed); | |
4ee9c684 | 677 | |
98380129 | 678 | /* Repacking functions. These are called internally by internal_pack |
679 | and internal_unpack. */ | |
680 | ||
681 | GFC_INTEGER_1 *internal_pack_1 (gfc_array_i1 *); | |
682 | internal_proto(internal_pack_1); | |
683 | ||
684 | GFC_INTEGER_2 *internal_pack_2 (gfc_array_i2 *); | |
685 | internal_proto(internal_pack_2); | |
4ee9c684 | 686 | |
4ee9c684 | 687 | GFC_INTEGER_4 *internal_pack_4 (gfc_array_i4 *); |
7b6cb5bd | 688 | internal_proto(internal_pack_4); |
4ee9c684 | 689 | |
4ee9c684 | 690 | GFC_INTEGER_8 *internal_pack_8 (gfc_array_i8 *); |
7b6cb5bd | 691 | internal_proto(internal_pack_8); |
4ee9c684 | 692 | |
cdc35053 | 693 | #if defined HAVE_GFC_INTEGER_16 |
e23ab77f | 694 | GFC_INTEGER_16 *internal_pack_16 (gfc_array_i16 *); |
695 | internal_proto(internal_pack_16); | |
cdc35053 | 696 | #endif |
e23ab77f | 697 | |
98380129 | 698 | GFC_REAL_4 *internal_pack_r4 (gfc_array_r4 *); |
699 | internal_proto(internal_pack_r4); | |
700 | ||
701 | GFC_REAL_8 *internal_pack_r8 (gfc_array_r8 *); | |
702 | internal_proto(internal_pack_r8); | |
703 | ||
704 | #if defined HAVE_GFC_REAL_10 | |
705 | GFC_REAL_10 *internal_pack_r10 (gfc_array_r10 *); | |
706 | internal_proto(internal_pack_r10); | |
707 | #endif | |
708 | ||
709 | #if defined HAVE_GFC_REAL_16 | |
710 | GFC_REAL_16 *internal_pack_r16 (gfc_array_r16 *); | |
711 | internal_proto(internal_pack_r16); | |
712 | #endif | |
713 | ||
f27ef643 | 714 | GFC_COMPLEX_4 *internal_pack_c4 (gfc_array_c4 *); |
715 | internal_proto(internal_pack_c4); | |
716 | ||
717 | GFC_COMPLEX_8 *internal_pack_c8 (gfc_array_c8 *); | |
718 | internal_proto(internal_pack_c8); | |
719 | ||
cdc35053 | 720 | #if defined HAVE_GFC_COMPLEX_10 |
e23ab77f | 721 | GFC_COMPLEX_10 *internal_pack_c10 (gfc_array_c10 *); |
722 | internal_proto(internal_pack_c10); | |
cdc35053 | 723 | #endif |
e23ab77f | 724 | |
98380129 | 725 | #if defined HAVE_GFC_COMPLEX_16 |
726 | GFC_COMPLEX_16 *internal_pack_c16 (gfc_array_c16 *); | |
727 | internal_proto(internal_pack_c16); | |
728 | #endif | |
729 | ||
730 | extern void internal_unpack_1 (gfc_array_i1 *, const GFC_INTEGER_1 *); | |
731 | internal_proto(internal_unpack_1); | |
732 | ||
733 | extern void internal_unpack_2 (gfc_array_i2 *, const GFC_INTEGER_2 *); | |
734 | internal_proto(internal_unpack_2); | |
735 | ||
7b6cb5bd | 736 | extern void internal_unpack_4 (gfc_array_i4 *, const GFC_INTEGER_4 *); |
737 | internal_proto(internal_unpack_4); | |
4ee9c684 | 738 | |
7b6cb5bd | 739 | extern void internal_unpack_8 (gfc_array_i8 *, const GFC_INTEGER_8 *); |
740 | internal_proto(internal_unpack_8); | |
8db86b90 | 741 | |
cdc35053 | 742 | #if defined HAVE_GFC_INTEGER_16 |
e23ab77f | 743 | extern void internal_unpack_16 (gfc_array_i16 *, const GFC_INTEGER_16 *); |
744 | internal_proto(internal_unpack_16); | |
cdc35053 | 745 | #endif |
e23ab77f | 746 | |
98380129 | 747 | extern void internal_unpack_r4 (gfc_array_r4 *, const GFC_REAL_4 *); |
748 | internal_proto(internal_unpack_r4); | |
749 | ||
750 | extern void internal_unpack_r8 (gfc_array_r8 *, const GFC_REAL_8 *); | |
751 | internal_proto(internal_unpack_r8); | |
752 | ||
753 | #if defined HAVE_GFC_REAL_10 | |
754 | extern void internal_unpack_r10 (gfc_array_r10 *, const GFC_REAL_10 *); | |
755 | internal_proto(internal_unpack_r10); | |
756 | #endif | |
757 | ||
758 | #if defined HAVE_GFC_REAL_16 | |
759 | extern void internal_unpack_r16 (gfc_array_r16 *, const GFC_REAL_16 *); | |
760 | internal_proto(internal_unpack_r16); | |
761 | #endif | |
762 | ||
f27ef643 | 763 | extern void internal_unpack_c4 (gfc_array_c4 *, const GFC_COMPLEX_4 *); |
764 | internal_proto(internal_unpack_c4); | |
765 | ||
766 | extern void internal_unpack_c8 (gfc_array_c8 *, const GFC_COMPLEX_8 *); | |
767 | internal_proto(internal_unpack_c8); | |
768 | ||
cdc35053 | 769 | #if defined HAVE_GFC_COMPLEX_10 |
e23ab77f | 770 | extern void internal_unpack_c10 (gfc_array_c10 *, const GFC_COMPLEX_10 *); |
771 | internal_proto(internal_unpack_c10); | |
cdc35053 | 772 | #endif |
e23ab77f | 773 | |
b362cebe | 774 | #if defined HAVE_GFC_COMPLEX_16 |
775 | extern void internal_unpack_c16 (gfc_array_c16 *, const GFC_COMPLEX_16 *); | |
776 | internal_proto(internal_unpack_c16); | |
777 | #endif | |
778 | ||
0c279ba7 | 779 | /* Internal auxiliary functions for the pack intrinsic. */ |
780 | ||
781 | extern void pack_i1 (gfc_array_i1 *, const gfc_array_i1 *, | |
782 | const gfc_array_l1 *, const gfc_array_i1 *); | |
783 | internal_proto(pack_i1); | |
784 | ||
785 | extern void pack_i2 (gfc_array_i2 *, const gfc_array_i2 *, | |
786 | const gfc_array_l1 *, const gfc_array_i2 *); | |
787 | internal_proto(pack_i2); | |
788 | ||
789 | extern void pack_i4 (gfc_array_i4 *, const gfc_array_i4 *, | |
790 | const gfc_array_l1 *, const gfc_array_i4 *); | |
791 | internal_proto(pack_i4); | |
792 | ||
793 | extern void pack_i8 (gfc_array_i8 *, const gfc_array_i8 *, | |
794 | const gfc_array_l1 *, const gfc_array_i8 *); | |
795 | internal_proto(pack_i8); | |
796 | ||
797 | #ifdef HAVE_GFC_INTEGER_16 | |
798 | extern void pack_i16 (gfc_array_i16 *, const gfc_array_i16 *, | |
799 | const gfc_array_l1 *, const gfc_array_i16 *); | |
800 | internal_proto(pack_i16); | |
801 | #endif | |
802 | ||
803 | extern void pack_r4 (gfc_array_r4 *, const gfc_array_r4 *, | |
804 | const gfc_array_l1 *, const gfc_array_r4 *); | |
805 | internal_proto(pack_r4); | |
806 | ||
807 | extern void pack_r8 (gfc_array_r8 *, const gfc_array_r8 *, | |
808 | const gfc_array_l1 *, const gfc_array_r8 *); | |
809 | internal_proto(pack_r8); | |
810 | ||
811 | #ifdef HAVE_GFC_REAL_10 | |
812 | extern void pack_r10 (gfc_array_r10 *, const gfc_array_r10 *, | |
813 | const gfc_array_l1 *, const gfc_array_r10 *); | |
814 | internal_proto(pack_r10); | |
815 | #endif | |
816 | ||
817 | #ifdef HAVE_GFC_REAL_16 | |
818 | extern void pack_r16 (gfc_array_r16 *, const gfc_array_r16 *, | |
819 | const gfc_array_l1 *, const gfc_array_r16 *); | |
820 | internal_proto(pack_r16); | |
821 | #endif | |
822 | ||
823 | extern void pack_c4 (gfc_array_c4 *, const gfc_array_c4 *, | |
824 | const gfc_array_l1 *, const gfc_array_c4 *); | |
825 | internal_proto(pack_c4); | |
826 | ||
827 | extern void pack_c8 (gfc_array_c8 *, const gfc_array_c8 *, | |
828 | const gfc_array_l1 *, const gfc_array_c8 *); | |
829 | internal_proto(pack_c8); | |
830 | ||
831 | #ifdef HAVE_GFC_REAL_10 | |
832 | extern void pack_c10 (gfc_array_c10 *, const gfc_array_c10 *, | |
833 | const gfc_array_l1 *, const gfc_array_c10 *); | |
834 | internal_proto(pack_c10); | |
835 | #endif | |
836 | ||
837 | #ifdef HAVE_GFC_REAL_16 | |
838 | extern void pack_c16 (gfc_array_c16 *, const gfc_array_c16 *, | |
839 | const gfc_array_l1 *, const gfc_array_c16 *); | |
840 | internal_proto(pack_c16); | |
841 | #endif | |
842 | ||
d3a07078 | 843 | /* Internal auxiliary functions for the unpack intrinsic. */ |
844 | ||
845 | extern void unpack0_i1 (gfc_array_i1 *, const gfc_array_i1 *, | |
846 | const gfc_array_l1 *, const GFC_INTEGER_1 *); | |
847 | internal_proto(unpack0_i1); | |
848 | ||
849 | extern void unpack0_i2 (gfc_array_i2 *, const gfc_array_i2 *, | |
850 | const gfc_array_l1 *, const GFC_INTEGER_2 *); | |
851 | internal_proto(unpack0_i2); | |
852 | ||
853 | extern void unpack0_i4 (gfc_array_i4 *, const gfc_array_i4 *, | |
854 | const gfc_array_l1 *, const GFC_INTEGER_4 *); | |
855 | internal_proto(unpack0_i4); | |
856 | ||
857 | extern void unpack0_i8 (gfc_array_i8 *, const gfc_array_i8 *, | |
858 | const gfc_array_l1 *, const GFC_INTEGER_8 *); | |
859 | internal_proto(unpack0_i8); | |
860 | ||
861 | #ifdef HAVE_GFC_INTEGER_16 | |
862 | ||
863 | extern void unpack0_i16 (gfc_array_i16 *, const gfc_array_i16 *, | |
864 | const gfc_array_l1 *, const GFC_INTEGER_16 *); | |
865 | internal_proto(unpack0_i16); | |
866 | ||
867 | #endif | |
868 | ||
869 | extern void unpack0_r4 (gfc_array_r4 *, const gfc_array_r4 *, | |
870 | const gfc_array_l1 *, const GFC_REAL_4 *); | |
871 | internal_proto(unpack0_r4); | |
872 | ||
873 | extern void unpack0_r8 (gfc_array_r8 *, const gfc_array_r8 *, | |
874 | const gfc_array_l1 *, const GFC_REAL_8 *); | |
875 | internal_proto(unpack0_r8); | |
876 | ||
877 | #ifdef HAVE_GFC_REAL_10 | |
878 | ||
879 | extern void unpack0_r10 (gfc_array_r10 *, const gfc_array_r10 *, | |
880 | const gfc_array_l1 *, const GFC_REAL_10 *); | |
881 | internal_proto(unpack0_r10); | |
882 | ||
883 | #endif | |
884 | ||
885 | #ifdef HAVE_GFC_REAL_16 | |
886 | ||
887 | extern void unpack0_r16 (gfc_array_r16 *, const gfc_array_r16 *, | |
888 | const gfc_array_l1 *, const GFC_REAL_16 *); | |
889 | internal_proto(unpack0_r16); | |
890 | ||
891 | #endif | |
892 | ||
893 | extern void unpack0_c4 (gfc_array_c4 *, const gfc_array_c4 *, | |
894 | const gfc_array_l1 *, const GFC_COMPLEX_4 *); | |
895 | internal_proto(unpack0_c4); | |
896 | ||
897 | extern void unpack0_c8 (gfc_array_c8 *, const gfc_array_c8 *, | |
898 | const gfc_array_l1 *, const GFC_COMPLEX_8 *); | |
899 | internal_proto(unpack0_c8); | |
900 | ||
901 | #ifdef HAVE_GFC_COMPLEX_10 | |
902 | ||
903 | extern void unpack0_c10 (gfc_array_c10 *, const gfc_array_c10 *, | |
904 | const gfc_array_l1 *mask, const GFC_COMPLEX_10 *); | |
905 | internal_proto(unpack0_c10); | |
906 | ||
907 | #endif | |
908 | ||
909 | #ifdef HAVE_GFC_COMPLEX_16 | |
910 | ||
911 | extern void unpack0_c16 (gfc_array_c16 *, const gfc_array_c16 *, | |
912 | const gfc_array_l1 *, const GFC_COMPLEX_16 *); | |
913 | internal_proto(unpack0_c16); | |
914 | ||
915 | #endif | |
916 | ||
917 | extern void unpack1_i1 (gfc_array_i1 *, const gfc_array_i1 *, | |
918 | const gfc_array_l1 *, const gfc_array_i1 *); | |
919 | internal_proto(unpack1_i1); | |
920 | ||
921 | extern void unpack1_i2 (gfc_array_i2 *, const gfc_array_i2 *, | |
922 | const gfc_array_l1 *, const gfc_array_i2 *); | |
923 | internal_proto(unpack1_i2); | |
924 | ||
925 | extern void unpack1_i4 (gfc_array_i4 *, const gfc_array_i4 *, | |
926 | const gfc_array_l1 *, const gfc_array_i4 *); | |
927 | internal_proto(unpack1_i4); | |
928 | ||
929 | extern void unpack1_i8 (gfc_array_i8 *, const gfc_array_i8 *, | |
930 | const gfc_array_l1 *, const gfc_array_i8 *); | |
931 | internal_proto(unpack1_i8); | |
932 | ||
933 | #ifdef HAVE_GFC_INTEGER_16 | |
934 | extern void unpack1_i16 (gfc_array_i16 *, const gfc_array_i16 *, | |
935 | const gfc_array_l1 *, const gfc_array_i16 *); | |
936 | internal_proto(unpack1_i16); | |
937 | #endif | |
938 | ||
939 | extern void unpack1_r4 (gfc_array_r4 *, const gfc_array_r4 *, | |
940 | const gfc_array_l1 *, const gfc_array_r4 *); | |
941 | internal_proto(unpack1_r4); | |
942 | ||
943 | extern void unpack1_r8 (gfc_array_r8 *, const gfc_array_r8 *, | |
944 | const gfc_array_l1 *, const gfc_array_r8 *); | |
945 | internal_proto(unpack1_r8); | |
946 | ||
947 | #ifdef HAVE_GFC_REAL_10 | |
948 | extern void unpack1_r10 (gfc_array_r10 *, const gfc_array_r10 *, | |
949 | const gfc_array_l1 *, const gfc_array_r10 *); | |
950 | internal_proto(unpack1_r10); | |
951 | #endif | |
952 | ||
953 | #ifdef HAVE_GFC_REAL_16 | |
954 | extern void unpack1_r16 (gfc_array_r16 *, const gfc_array_r16 *, | |
955 | const gfc_array_l1 *, const gfc_array_r16 *); | |
956 | internal_proto(unpack1_r16); | |
957 | #endif | |
958 | ||
959 | extern void unpack1_c4 (gfc_array_c4 *, const gfc_array_c4 *, | |
960 | const gfc_array_l1 *, const gfc_array_c4 *); | |
961 | internal_proto(unpack1_c4); | |
962 | ||
963 | extern void unpack1_c8 (gfc_array_c8 *, const gfc_array_c8 *, | |
964 | const gfc_array_l1 *, const gfc_array_c8 *); | |
965 | internal_proto(unpack1_c8); | |
966 | ||
967 | #ifdef HAVE_GFC_COMPLEX_10 | |
968 | extern void unpack1_c10 (gfc_array_c10 *, const gfc_array_c10 *, | |
969 | const gfc_array_l1 *, const gfc_array_c10 *); | |
970 | internal_proto(unpack1_c10); | |
971 | #endif | |
972 | ||
973 | #ifdef HAVE_GFC_COMPLEX_16 | |
974 | extern void unpack1_c16 (gfc_array_c16 *, const gfc_array_c16 *, | |
975 | const gfc_array_l1 *, const gfc_array_c16 *); | |
976 | internal_proto(unpack1_c16); | |
977 | #endif | |
978 | ||
b74d1e69 | 979 | /* Helper functions for spread. */ |
980 | ||
981 | extern void spread_i1 (gfc_array_i1 *, const gfc_array_i1 *, | |
982 | const index_type, const index_type); | |
983 | internal_proto(spread_i1); | |
984 | ||
985 | extern void spread_i2 (gfc_array_i2 *, const gfc_array_i2 *, | |
986 | const index_type, const index_type); | |
987 | internal_proto(spread_i2); | |
988 | ||
989 | extern void spread_i4 (gfc_array_i4 *, const gfc_array_i4 *, | |
990 | const index_type, const index_type); | |
991 | internal_proto(spread_i4); | |
992 | ||
993 | extern void spread_i8 (gfc_array_i8 *, const gfc_array_i8 *, | |
994 | const index_type, const index_type); | |
995 | internal_proto(spread_i8); | |
996 | ||
997 | #ifdef HAVE_GFC_INTEGER_16 | |
998 | extern void spread_i16 (gfc_array_i16 *, const gfc_array_i16 *, | |
999 | const index_type, const index_type); | |
1000 | internal_proto(spread_i16); | |
1001 | ||
1002 | #endif | |
1003 | ||
1004 | extern void spread_r4 (gfc_array_r4 *, const gfc_array_r4 *, | |
1005 | const index_type, const index_type); | |
1006 | internal_proto(spread_r4); | |
1007 | ||
1008 | extern void spread_r8 (gfc_array_r8 *, const gfc_array_r8 *, | |
1009 | const index_type, const index_type); | |
1010 | internal_proto(spread_r8); | |
1011 | ||
1012 | #ifdef HAVE_GFC_REAL_10 | |
1013 | extern void spread_r10 (gfc_array_r10 *, const gfc_array_r10 *, | |
1014 | const index_type, const index_type); | |
1015 | internal_proto(spread_r10); | |
1016 | ||
1017 | #endif | |
1018 | ||
1019 | #ifdef HAVE_GFC_REAL_16 | |
1020 | extern void spread_r16 (gfc_array_r16 *, const gfc_array_r16 *, | |
1021 | const index_type, const index_type); | |
1022 | internal_proto(spread_r16); | |
1023 | ||
1024 | #endif | |
1025 | ||
1026 | extern void spread_c4 (gfc_array_c4 *, const gfc_array_c4 *, | |
1027 | const index_type, const index_type); | |
1028 | internal_proto(spread_c4); | |
1029 | ||
1030 | extern void spread_c8 (gfc_array_c8 *, const gfc_array_c8 *, | |
1031 | const index_type, const index_type); | |
1032 | internal_proto(spread_c8); | |
1033 | ||
1034 | #ifdef HAVE_GFC_COMPLEX_10 | |
1035 | extern void spread_c10 (gfc_array_c10 *, const gfc_array_c10 *, | |
1036 | const index_type, const index_type); | |
1037 | internal_proto(spread_c10); | |
1038 | ||
1039 | #endif | |
1040 | ||
1041 | #ifdef HAVE_GFC_COMPLEX_16 | |
1042 | extern void spread_c16 (gfc_array_c16 *, const gfc_array_c16 *, | |
1043 | const index_type, const index_type); | |
1044 | internal_proto(spread_c16); | |
1045 | ||
1046 | #endif | |
1047 | ||
1048 | extern void spread_scalar_i1 (gfc_array_i1 *, const GFC_INTEGER_1 *, | |
1049 | const index_type, const index_type); | |
1050 | internal_proto(spread_scalar_i1); | |
1051 | ||
1052 | extern void spread_scalar_i2 (gfc_array_i2 *, const GFC_INTEGER_2 *, | |
1053 | const index_type, const index_type); | |
1054 | internal_proto(spread_scalar_i2); | |
1055 | ||
1056 | extern void spread_scalar_i4 (gfc_array_i4 *, const GFC_INTEGER_4 *, | |
1057 | const index_type, const index_type); | |
1058 | internal_proto(spread_scalar_i4); | |
1059 | ||
1060 | extern void spread_scalar_i8 (gfc_array_i8 *, const GFC_INTEGER_8 *, | |
1061 | const index_type, const index_type); | |
1062 | internal_proto(spread_scalar_i8); | |
1063 | ||
1064 | #ifdef HAVE_GFC_INTEGER_16 | |
1065 | extern void spread_scalar_i16 (gfc_array_i16 *, const GFC_INTEGER_16 *, | |
1066 | const index_type, const index_type); | |
1067 | internal_proto(spread_scalar_i16); | |
1068 | ||
1069 | #endif | |
1070 | ||
1071 | extern void spread_scalar_r4 (gfc_array_r4 *, const GFC_REAL_4 *, | |
1072 | const index_type, const index_type); | |
1073 | internal_proto(spread_scalar_r4); | |
1074 | ||
1075 | extern void spread_scalar_r8 (gfc_array_r8 *, const GFC_REAL_8 *, | |
1076 | const index_type, const index_type); | |
1077 | internal_proto(spread_scalar_r8); | |
1078 | ||
1079 | #ifdef HAVE_GFC_REAL_10 | |
1080 | extern void spread_scalar_r10 (gfc_array_r10 *, const GFC_REAL_10 *, | |
1081 | const index_type, const index_type); | |
1082 | internal_proto(spread_scalar_r10); | |
1083 | ||
1084 | #endif | |
1085 | ||
1086 | #ifdef HAVE_GFC_REAL_16 | |
1087 | extern void spread_scalar_r16 (gfc_array_r16 *, const GFC_REAL_16 *, | |
1088 | const index_type, const index_type); | |
1089 | internal_proto(spread_scalar_r16); | |
1090 | ||
1091 | #endif | |
1092 | ||
1093 | extern void spread_scalar_c4 (gfc_array_c4 *, const GFC_COMPLEX_4 *, | |
1094 | const index_type, const index_type); | |
1095 | internal_proto(spread_scalar_c4); | |
1096 | ||
1097 | extern void spread_scalar_c8 (gfc_array_c8 *, const GFC_COMPLEX_8 *, | |
1098 | const index_type, const index_type); | |
1099 | internal_proto(spread_scalar_c8); | |
1100 | ||
1101 | #ifdef HAVE_GFC_COMPLEX_10 | |
1102 | extern void spread_scalar_c10 (gfc_array_c10 *, const GFC_COMPLEX_10 *, | |
1103 | const index_type, const index_type); | |
1104 | internal_proto(spread_scalar_c10); | |
1105 | ||
1106 | #endif | |
1107 | ||
1108 | #ifdef HAVE_GFC_COMPLEX_16 | |
1109 | extern void spread_scalar_c16 (gfc_array_c16 *, const GFC_COMPLEX_16 *, | |
1110 | const index_type, const index_type); | |
1111 | internal_proto(spread_scalar_c16); | |
1112 | ||
1113 | #endif | |
1114 | ||
4ee9c684 | 1115 | /* string_intrinsics.c */ |
1116 | ||
f20cadb1 | 1117 | extern int compare_string (GFC_INTEGER_4, const char *, |
1118 | GFC_INTEGER_4, const char *); | |
7b6cb5bd | 1119 | iexport_proto(compare_string); |
4ee9c684 | 1120 | |
d694eb47 | 1121 | /* random.c */ |
1122 | ||
3d3b790d | 1123 | extern void random_seed_i4 (GFC_INTEGER_4 * size, gfc_array_i4 * put, |
1124 | gfc_array_i4 * get); | |
1125 | iexport_proto(random_seed_i4); | |
1126 | extern void random_seed_i8 (GFC_INTEGER_8 * size, gfc_array_i8 * put, | |
1127 | gfc_array_i8 * get); | |
1128 | iexport_proto(random_seed_i8); | |
d694eb47 | 1129 | |
5fcc57ce | 1130 | /* size.c */ |
1131 | ||
1132 | typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, void) array_t; | |
1133 | ||
7b6cb5bd | 1134 | extern index_type size0 (const array_t * array); |
1135 | iexport_proto(size0); | |
5fcc57ce | 1136 | |
fd48ced8 | 1137 | #endif /* LIBGFOR_H */ |