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