1 /* Common declarations for all of libgfortran.
2 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
3 Free Software Foundation, Inc.
4 Contributed by Paul Brook <paul@nowt.org>, and
5 Andy Vaught <andy@xena.eas.asu.edu>
7 This file is part of the GNU Fortran runtime library (libgfortran).
9 Libgfortran is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3, or (at your option)
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 General Public License for more details.
19 Under Section 7 of GPL version 3, you are granted additional
20 permissions described in the GCC Runtime Library Exception, version
21 3.1, as published by the Free Software Foundation.
23 You should have received a copy of the GNU General Public License and
24 a copy of the GCC Runtime Library Exception along with this program;
25 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
26 <http://www.gnu.org/licenses/>. */
31 /* Ensure that ANSI conform stdio is used. This needs to be set before
32 any system header file is included. */
33 #if defined __MINGW32__
35 # define gfc_printf gnu_printf
37 # define gfc_printf __printf__
40 /* config.h MUST be first because it can affect system headers. */
50 extern float __strtof (const char *, char **);
51 #define gfc_strtof __strtof
52 extern double __strtod (const char *, char **);
53 #define gfc_strtod __strtod
54 extern long double __strtold (const char *, char **);
55 #define gfc_strtold __strtold
57 #define gfc_strtof strtof
58 #define gfc_strtod strtod
59 #define gfc_strtold strtold
65 #define complex __complex__
68 #include "../gcc/fortran/libgfortran.h"
70 #include "c99_protos.h"
79 #include <sys/types.h>
83 typedef off64_t gfc_offset
;
85 typedef off_t gfc_offset
;
89 #define NULL (void *) 0
93 #define __attribute__(x)
95 #define unlikely(x) (x)
97 #define likely(x) __builtin_expect(!!(x), 1)
98 #define unlikely(x) __builtin_expect(!!(x), 0)
102 /* We use intptr_t and uintptr_t, which may not be always defined in
105 #ifndef HAVE_INTPTR_T
106 #if __SIZEOF_POINTER__ == __SIZEOF_LONG__
107 #define intptr_t long
108 #elif __SIZEOF_POINTER__ == __SIZEOF_LONG_LONG__
109 #define intptr_t long long
110 #elif __SIZEOF_POINTER__ == __SIZEOF_INT__
112 #elif __SIZEOF_POINTER__ == __SIZEOF_SHORT__
113 #define intptr_t short
115 #error "Pointer type with unexpected size"
119 #ifndef HAVE_UINTPTR_T
120 #if __SIZEOF_POINTER__ == __SIZEOF_LONG__
121 #define uintptr_t unsigned long
122 #elif __SIZEOF_POINTER__ == __SIZEOF_LONG_LONG__
123 #define uintptr_t unsigned long long
124 #elif __SIZEOF_POINTER__ == __SIZEOF_INT__
125 #define uintptr_t unsigned int
126 #elif __SIZEOF_POINTER__ == __SIZEOF_SHORT__
127 #define uintptr_t unsigned short
129 #error "Pointer type with unexpected size"
134 /* On mingw, work around the buggy Windows snprintf() by using the one
135 mingw provides, __mingw_snprintf(). We also provide a prototype for
136 __mingw_snprintf(), because the mingw headers currently don't have one. */
137 #if HAVE_MINGW_SNPRINTF
138 extern int __mingw_snprintf (char *, size_t, const char *, ...)
139 __attribute__ ((format (gnu_printf
, 3, 4)));
141 #define snprintf __mingw_snprintf
145 /* For a library, a standard prefix is a requirement in order to partition
146 the namespace. IPREFIX is for symbols intended to be internal to the
148 #define PREFIX(x) _gfortran_ ## x
149 #define IPREFIX(x) _gfortrani_ ## x
151 /* Magic to rename a symbol at the compiler level. You continue to refer
152 to the symbol as OLD in the source, but it'll be named NEW in the asm. */
153 #define sym_rename(old, new) sym_rename1(old, __USER_LABEL_PREFIX__, new)
154 #define sym_rename1(old, ulp, new) sym_rename2(old, ulp, new)
155 #define sym_rename2(old, ulp, new) extern __typeof(old) old __asm__(#ulp #new)
157 /* There are several classifications of routines:
159 (1) Symbols used only within the library,
160 (2) Symbols to be exported from the library,
161 (3) Symbols to be exported from the library, but
162 also used inside the library.
164 By telling the compiler about these different classifications we can
165 tightly control the interface seen by the user, and get better code
166 from the compiler at the same time.
168 One of the following should be used immediately after the declaration
171 internal_proto Marks a symbol used only within the library,
172 and adds IPREFIX to the assembly-level symbol
173 name. The later is important for maintaining
174 the namespace partition for the static library.
176 export_proto Marks a symbol to be exported, and adds PREFIX
177 to the assembly-level symbol name.
179 export_proto_np Marks a symbol to be exported without adding PREFIX.
181 iexport_proto Marks a function to be exported, but with the
182 understanding that it can be used inside as well.
184 iexport_data_proto Similarly, marks a data symbol to be exported.
185 Unfortunately, some systems can't play the hidden
186 symbol renaming trick on data symbols, thanks to
187 the horribleness of COPY relocations.
189 If iexport_proto or iexport_data_proto is used, you must also use
190 iexport or iexport_data after the *definition* of the symbol. */
192 #if defined(HAVE_ATTRIBUTE_VISIBILITY)
193 # define internal_proto(x) \
194 sym_rename(x, IPREFIX (x)) __attribute__((__visibility__("hidden")))
196 # define internal_proto(x) sym_rename(x, IPREFIX(x))
199 #if defined(HAVE_ATTRIBUTE_VISIBILITY) && defined(HAVE_ATTRIBUTE_ALIAS)
200 # define export_proto(x) sym_rename(x, PREFIX(x))
201 # define export_proto_np(x) extern char swallow_semicolon
202 # define iexport_proto(x) internal_proto(x)
203 # define iexport(x) iexport1(x, IPREFIX(x))
204 # define iexport1(x,y) iexport2(x,y)
205 # define iexport2(x,y) \
206 extern __typeof(x) PREFIX(x) __attribute__((__alias__(#y)))
208 # define export_proto(x) sym_rename(x, PREFIX(x))
209 # define export_proto_np(x) extern char swallow_semicolon
210 # define iexport_proto(x) export_proto(x)
211 # define iexport(x) extern char swallow_semicolon
214 /* TODO: detect the case when we *can* hide the symbol. */
215 #define iexport_data_proto(x) export_proto(x)
216 #define iexport_data(x) extern char swallow_semicolon
218 /* The only reliable way to get the offset of a field in a struct
219 in a system independent way is via this macro. */
221 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *) 0)->MEMBER)
224 /* The C99 classification macros isfinite, isinf, isnan, isnormal
225 and signbit are broken or inconsistent on quite a few targets.
226 So, we use GCC's builtins instead.
228 Another advantage for GCC's builtins for these type-generic macros
229 is that it handles floating-point types that the system headers
230 may not support (like __float128). */
233 #define isnan(x) __builtin_isnan(x)
235 #define isfinite(x) __builtin_isfinite(x)
237 #define isinf(x) __builtin_isinf(x)
239 #define isnormal(x) __builtin_isnormal(x)
241 #define signbit(x) __builtin_signbit(x)
243 /* TODO: find the C99 version of these an move into above ifdef. */
244 #define REALPART(z) (__real__(z))
245 #define IMAGPART(z) (__imag__(z))
246 #define COMPLEX_ASSIGN(z_, r_, i_) {__real__(z_) = (r_); __imag__(z_) = (i_);}
250 /* Define the type used for the current record number for large file I/O.
251 The size must be consistent with the size defined on the compiler side. */
252 #ifdef HAVE_GFC_INTEGER_8
253 typedef GFC_INTEGER_8 GFC_IO_INT
;
255 #ifdef HAVE_GFC_INTEGER_4
256 typedef GFC_INTEGER_4 GFC_IO_INT
;
258 #error "GFC_INTEGER_4 should be available for the library to compile".
262 /* The following two definitions must be consistent with the types used
264 /* The type used of array indices, amongst other things. */
265 typedef ssize_t index_type
;
267 /* The type used for the lengths of character variables. */
268 typedef GFC_INTEGER_4 gfc_charlen_type
;
270 /* Definitions of CHARACTER data types:
271 - CHARACTER(KIND=1) corresponds to the C char type,
272 - CHARACTER(KIND=4) corresponds to an unsigned 32-bit integer. */
273 typedef GFC_UINTEGER_4 gfc_char4_t
;
275 /* Byte size of character kinds. For the kinds currently supported, it's
276 simply equal to the kind parameter itself. */
277 #define GFC_SIZE_OF_CHAR_KIND(kind) (kind)
279 /* This will be 0 on little-endian machines and one on big-endian machines. */
280 extern int big_endian
;
281 internal_proto(big_endian
);
283 #define GFOR_POINTER_TO_L1(p, kind) \
284 (big_endian * (kind - 1) + (GFC_LOGICAL_1 *)(p))
286 #define GFC_INTEGER_1_HUGE \
287 (GFC_INTEGER_1)((((GFC_UINTEGER_1)1) << 7) - 1)
288 #define GFC_INTEGER_2_HUGE \
289 (GFC_INTEGER_2)((((GFC_UINTEGER_2)1) << 15) - 1)
290 #define GFC_INTEGER_4_HUGE \
291 (GFC_INTEGER_4)((((GFC_UINTEGER_4)1) << 31) - 1)
292 #define GFC_INTEGER_8_HUGE \
293 (GFC_INTEGER_8)((((GFC_UINTEGER_8)1) << 63) - 1)
294 #ifdef HAVE_GFC_INTEGER_16
295 #define GFC_INTEGER_16_HUGE \
296 (GFC_INTEGER_16)((((GFC_UINTEGER_16)1) << 127) - 1)
299 /* M{IN,AX}{LOC,VAL} need also infinities and NaNs if supported. */
301 #ifdef __FLT_HAS_INFINITY__
302 # define GFC_REAL_4_INFINITY __builtin_inff ()
304 #ifdef __DBL_HAS_INFINITY__
305 # define GFC_REAL_8_INFINITY __builtin_inf ()
307 #ifdef __LDBL_HAS_INFINITY__
308 # ifdef HAVE_GFC_REAL_10
309 # define GFC_REAL_10_INFINITY __builtin_infl ()
311 # ifdef HAVE_GFC_REAL_16
312 # define GFC_REAL_16_INFINITY __builtin_infl ()
315 #ifdef __FLT_HAS_QUIET_NAN__
316 # define GFC_REAL_4_QUIET_NAN __builtin_nanf ("")
318 #ifdef __DBL_HAS_QUIET_NAN__
319 # define GFC_REAL_8_QUIET_NAN __builtin_nan ("")
321 #ifdef __LDBL_HAS_QUIET_NAN__
322 # ifdef HAVE_GFC_REAL_10
323 # define GFC_REAL_10_QUIET_NAN __builtin_nanl ("")
325 # ifdef HAVE_GFC_REAL_16
326 # define GFC_REAL_16_QUIET_NAN __builtin_nanl ("")
330 typedef struct descriptor_dimension
337 descriptor_dimension
;
339 #define GFC_ARRAY_DESCRIPTOR(r, type) \
344 descriptor_dimension dim[r];\
347 /* Commonly used array descriptor types. */
348 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS
, void) gfc_array_void
;
349 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS
, char) gfc_array_char
;
350 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS
, GFC_INTEGER_1
) gfc_array_i1
;
351 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS
, GFC_INTEGER_2
) gfc_array_i2
;
352 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS
, GFC_INTEGER_4
) gfc_array_i4
;
353 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS
, GFC_INTEGER_8
) gfc_array_i8
;
354 #ifdef HAVE_GFC_INTEGER_16
355 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS
, GFC_INTEGER_16
) gfc_array_i16
;
357 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS
, GFC_REAL_4
) gfc_array_r4
;
358 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS
, GFC_REAL_8
) gfc_array_r8
;
359 #ifdef HAVE_GFC_REAL_10
360 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS
, GFC_REAL_10
) gfc_array_r10
;
362 #ifdef HAVE_GFC_REAL_16
363 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS
, GFC_REAL_16
) gfc_array_r16
;
365 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS
, GFC_COMPLEX_4
) gfc_array_c4
;
366 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS
, GFC_COMPLEX_8
) gfc_array_c8
;
367 #ifdef HAVE_GFC_COMPLEX_10
368 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS
, GFC_COMPLEX_10
) gfc_array_c10
;
370 #ifdef HAVE_GFC_COMPLEX_16
371 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS
, GFC_COMPLEX_16
) gfc_array_c16
;
373 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS
, GFC_LOGICAL_1
) gfc_array_l1
;
374 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS
, GFC_LOGICAL_2
) gfc_array_l2
;
375 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS
, GFC_LOGICAL_4
) gfc_array_l4
;
376 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS
, GFC_LOGICAL_8
) gfc_array_l8
;
377 #ifdef HAVE_GFC_LOGICAL_16
378 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS
, GFC_LOGICAL_16
) gfc_array_l16
;
382 #define GFC_DESCRIPTOR_RANK(desc) ((desc)->dtype & GFC_DTYPE_RANK_MASK)
383 #define GFC_DESCRIPTOR_TYPE(desc) (((desc)->dtype & GFC_DTYPE_TYPE_MASK) \
384 >> GFC_DTYPE_TYPE_SHIFT)
385 #define GFC_DESCRIPTOR_SIZE(desc) ((desc)->dtype >> GFC_DTYPE_SIZE_SHIFT)
386 #define GFC_DESCRIPTOR_DATA(desc) ((desc)->data)
387 #define GFC_DESCRIPTOR_DTYPE(desc) ((desc)->dtype)
389 #define GFC_DIMENSION_LBOUND(dim) ((dim)._lbound)
390 #define GFC_DIMENSION_UBOUND(dim) ((dim)._ubound)
391 #define GFC_DIMENSION_STRIDE(dim) ((dim)._stride)
392 #define GFC_DIMENSION_EXTENT(dim) ((dim)._ubound + 1 - (dim)._lbound)
393 #define GFC_DIMENSION_SET(dim,lb,ub,str) \
396 (dim)._lbound = lb; \
397 (dim)._ubound = ub; \
398 (dim)._stride = str; \
402 #define GFC_DESCRIPTOR_LBOUND(desc,i) ((desc)->dim[i]._lbound)
403 #define GFC_DESCRIPTOR_UBOUND(desc,i) ((desc)->dim[i]._ubound)
404 #define GFC_DESCRIPTOR_EXTENT(desc,i) ((desc)->dim[i]._ubound + 1 \
405 - (desc)->dim[i]._lbound)
406 #define GFC_DESCRIPTOR_EXTENT_BYTES(desc,i) \
407 (GFC_DESCRIPTOR_EXTENT(desc,i) * GFC_DESCRIPTOR_SIZE(desc))
409 #define GFC_DESCRIPTOR_STRIDE(desc,i) ((desc)->dim[i]._stride)
410 #define GFC_DESCRIPTOR_STRIDE_BYTES(desc,i) \
411 (GFC_DESCRIPTOR_STRIDE(desc,i) * GFC_DESCRIPTOR_SIZE(desc))
413 /* Macros to get both the size and the type with a single masking operation */
415 #define GFC_DTYPE_SIZE_MASK \
416 ((~((index_type) 0) >> GFC_DTYPE_SIZE_SHIFT) << GFC_DTYPE_SIZE_SHIFT)
417 #define GFC_DTYPE_TYPE_SIZE_MASK (GFC_DTYPE_SIZE_MASK | GFC_DTYPE_TYPE_MASK)
419 #define GFC_DTYPE_TYPE_SIZE(desc) ((desc)->dtype & GFC_DTYPE_TYPE_SIZE_MASK)
421 #define GFC_DTYPE_INTEGER_1 ((GFC_DTYPE_INTEGER << GFC_DTYPE_TYPE_SHIFT) \
422 | (sizeof(GFC_INTEGER_1) << GFC_DTYPE_SIZE_SHIFT))
423 #define GFC_DTYPE_INTEGER_2 ((GFC_DTYPE_INTEGER << GFC_DTYPE_TYPE_SHIFT) \
424 | (sizeof(GFC_INTEGER_2) << GFC_DTYPE_SIZE_SHIFT))
425 #define GFC_DTYPE_INTEGER_4 ((GFC_DTYPE_INTEGER << GFC_DTYPE_TYPE_SHIFT) \
426 | (sizeof(GFC_INTEGER_4) << GFC_DTYPE_SIZE_SHIFT))
427 #define GFC_DTYPE_INTEGER_8 ((GFC_DTYPE_INTEGER << GFC_DTYPE_TYPE_SHIFT) \
428 | (sizeof(GFC_INTEGER_8) << GFC_DTYPE_SIZE_SHIFT))
429 #ifdef HAVE_GFC_INTEGER_16
430 #define GFC_DTYPE_INTEGER_16 ((GFC_DTYPE_INTEGER << GFC_DTYPE_TYPE_SHIFT) \
431 | (sizeof(GFC_INTEGER_16) << GFC_DTYPE_SIZE_SHIFT))
434 #define GFC_DTYPE_LOGICAL_1 ((GFC_DTYPE_LOGICAL << GFC_DTYPE_TYPE_SHIFT) \
435 | (sizeof(GFC_LOGICAL_1) << GFC_DTYPE_SIZE_SHIFT))
436 #define GFC_DTYPE_LOGICAL_2 ((GFC_DTYPE_LOGICAL << GFC_DTYPE_TYPE_SHIFT) \
437 | (sizeof(GFC_LOGICAL_2) << GFC_DTYPE_SIZE_SHIFT))
438 #define GFC_DTYPE_LOGICAL_4 ((GFC_DTYPE_LOGICAL << GFC_DTYPE_TYPE_SHIFT) \
439 | (sizeof(GFC_LOGICAL_4) << GFC_DTYPE_SIZE_SHIFT))
440 #define GFC_DTYPE_LOGICAL_8 ((GFC_DTYPE_LOGICAL << GFC_DTYPE_TYPE_SHIFT) \
441 | (sizeof(GFC_LOGICAL_8) << GFC_DTYPE_SIZE_SHIFT))
442 #ifdef HAVE_GFC_LOGICAL_16
443 #define GFC_DTYPE_LOGICAL_16 ((GFC_DTYPE_LOGICAL << GFC_DTYPE_TYPE_SHIFT) \
444 | (sizeof(GFC_LOGICAL_16) << GFC_DTYPE_SIZE_SHIFT))
447 #define GFC_DTYPE_REAL_4 ((GFC_DTYPE_REAL << GFC_DTYPE_TYPE_SHIFT) \
448 | (sizeof(GFC_REAL_4) << GFC_DTYPE_SIZE_SHIFT))
449 #define GFC_DTYPE_REAL_8 ((GFC_DTYPE_REAL << GFC_DTYPE_TYPE_SHIFT) \
450 | (sizeof(GFC_REAL_8) << GFC_DTYPE_SIZE_SHIFT))
451 #ifdef HAVE_GFC_REAL_10
452 #define GFC_DTYPE_REAL_10 ((GFC_DTYPE_REAL << GFC_DTYPE_TYPE_SHIFT) \
453 | (sizeof(GFC_REAL_10) << GFC_DTYPE_SIZE_SHIFT))
455 #ifdef HAVE_GFC_REAL_16
456 #define GFC_DTYPE_REAL_16 ((GFC_DTYPE_REAL << GFC_DTYPE_TYPE_SHIFT) \
457 | (sizeof(GFC_REAL_16) << GFC_DTYPE_SIZE_SHIFT))
460 #define GFC_DTYPE_COMPLEX_4 ((GFC_DTYPE_COMPLEX << GFC_DTYPE_TYPE_SHIFT) \
461 | (sizeof(GFC_COMPLEX_4) << GFC_DTYPE_SIZE_SHIFT))
462 #define GFC_DTYPE_COMPLEX_8 ((GFC_DTYPE_COMPLEX << GFC_DTYPE_TYPE_SHIFT) \
463 | (sizeof(GFC_COMPLEX_8) << GFC_DTYPE_SIZE_SHIFT))
464 #ifdef HAVE_GFC_COMPLEX_10
465 #define GFC_DTYPE_COMPLEX_10 ((GFC_DTYPE_COMPLEX << GFC_DTYPE_TYPE_SHIFT) \
466 | (sizeof(GFC_COMPLEX_10) << GFC_DTYPE_SIZE_SHIFT))
468 #ifdef HAVE_GFC_COMPLEX_16
469 #define GFC_DTYPE_COMPLEX_16 ((GFC_DTYPE_COMPLEX << GFC_DTYPE_TYPE_SHIFT) \
470 | (sizeof(GFC_COMPLEX_16) << GFC_DTYPE_SIZE_SHIFT))
473 #define GFC_DTYPE_DERIVED_1 ((GFC_DTYPE_DERIVED << GFC_DTYPE_TYPE_SHIFT) \
474 | (sizeof(GFC_INTEGER_1) << GFC_DTYPE_SIZE_SHIFT))
475 #define GFC_DTYPE_DERIVED_2 ((GFC_DTYPE_DERIVED << GFC_DTYPE_TYPE_SHIFT) \
476 | (sizeof(GFC_INTEGER_2) << GFC_DTYPE_SIZE_SHIFT))
477 #define GFC_DTYPE_DERIVED_4 ((GFC_DTYPE_DERIVED << GFC_DTYPE_TYPE_SHIFT) \
478 | (sizeof(GFC_INTEGER_4) << GFC_DTYPE_SIZE_SHIFT))
479 #define GFC_DTYPE_DERIVED_8 ((GFC_DTYPE_DERIVED << GFC_DTYPE_TYPE_SHIFT) \
480 | (sizeof(GFC_INTEGER_8) << GFC_DTYPE_SIZE_SHIFT))
481 #ifdef HAVE_GFC_INTEGER_16
482 #define GFC_DTYPE_DERIVED_16 ((GFC_DTYPE_DERIVED << GFC_DTYPE_TYPE_SHIFT) \
483 | (sizeof(GFC_INTEGER_16) << GFC_DTYPE_SIZE_SHIFT))
486 /* Macros to determine the alignment of pointers. */
488 #define GFC_UNALIGNED_2(x) (((uintptr_t)(x)) & \
489 (__alignof__(GFC_INTEGER_2) - 1))
490 #define GFC_UNALIGNED_4(x) (((uintptr_t)(x)) & \
491 (__alignof__(GFC_INTEGER_4) - 1))
492 #define GFC_UNALIGNED_8(x) (((uintptr_t)(x)) & \
493 (__alignof__(GFC_INTEGER_8) - 1))
494 #ifdef HAVE_GFC_INTEGER_16
495 #define GFC_UNALIGNED_16(x) (((uintptr_t)(x)) & \
496 (__alignof__(GFC_INTEGER_16) - 1))
499 #define GFC_UNALIGNED_C4(x) (((uintptr_t)(x)) & \
500 (__alignof__(GFC_COMPLEX_4) - 1))
502 #define GFC_UNALIGNED_C8(x) (((uintptr_t)(x)) & \
503 (__alignof__(GFC_COMPLEX_8) - 1))
505 /* Runtime library include. */
506 #define stringize(x) expand_macro(x)
507 #define expand_macro(x) # x
509 /* Runtime options structure. */
513 int stdin_unit
, stdout_unit
, stderr_unit
, optional_plus
;
517 const char *separator
;
519 int use_stderr
, all_unbuffered
, unbuffered_preconnected
, default_recl
;
520 int fpe
, dump_core
, backtrace
;
524 extern options_t options
;
525 internal_proto(options
);
527 extern void handler (int);
528 internal_proto(handler
);
531 /* Compile-time options that will influence the library. */
542 size_t record_marker
;
543 int max_subrecord_length
;
549 extern compile_options_t compile_options
;
550 internal_proto(compile_options
);
552 extern void init_compile_options (void);
553 internal_proto(init_compile_options
);
555 #define GFC_MAX_SUBRECORD_LENGTH 2147483639 /* 2**31 - 9 */
557 /* Structure for statement options. */
567 /* This is returned by notification_std to know if, given the flags
568 that were given (-std=, -pedantic) we should issue an error, a warning
571 { NOTIFICATION_SILENT
, NOTIFICATION_WARNING
, NOTIFICATION_ERROR
}
574 /* This is returned by notify_std and several io functions. */
576 { SUCCESS
= 1, FAILURE
}
579 /* The filename and line number don't go inside the globals structure.
580 They are set by the rest of the program and must be linked to. */
582 /* Location of the current library call (optional). */
583 extern unsigned line
;
584 iexport_data_proto(line
);
586 extern char *filename
;
587 iexport_data_proto(filename
);
589 /* Avoid conflicting prototypes of alloca() in system headers by using
590 GCC's builtin alloca(). */
591 #define gfc_alloca(x) __builtin_alloca(x)
594 /* Directory for creating temporary files. Only used when none of the
595 following environment variables exist: GFORTRAN_TMPDIR, TMP and TEMP. */
596 #define DEFAULT_TEMPDIR "/tmp"
598 /* The default value of record length for preconnected units is defined
599 here. This value can be overriden by an environment variable.
600 Default value is 1 Gb. */
601 #define DEFAULT_RECL 1073741824
604 #define CHARACTER2(name) \
605 gfc_charlen_type name ## _len; \
608 typedef struct st_parameter_common
612 const char *filename
;
615 GFC_INTEGER_4
*iostat
;
621 #define IOPARM_LIBRETURN_MASK (3 << 0)
622 #define IOPARM_LIBRETURN_OK (0 << 0)
623 #define IOPARM_LIBRETURN_ERROR (1 << 0)
624 #define IOPARM_LIBRETURN_END (2 << 0)
625 #define IOPARM_LIBRETURN_EOR (3 << 0)
626 #define IOPARM_ERR (1 << 2)
627 #define IOPARM_END (1 << 3)
628 #define IOPARM_EOR (1 << 4)
629 #define IOPARM_HAS_IOSTAT (1 << 5)
630 #define IOPARM_HAS_IOMSG (1 << 6)
632 #define IOPARM_COMMON_MASK ((1 << 7) - 1)
634 #define IOPARM_OPEN_HAS_RECL_IN (1 << 7)
635 #define IOPARM_OPEN_HAS_FILE (1 << 8)
636 #define IOPARM_OPEN_HAS_STATUS (1 << 9)
637 #define IOPARM_OPEN_HAS_ACCESS (1 << 10)
638 #define IOPARM_OPEN_HAS_FORM (1 << 11)
639 #define IOPARM_OPEN_HAS_BLANK (1 << 12)
640 #define IOPARM_OPEN_HAS_POSITION (1 << 13)
641 #define IOPARM_OPEN_HAS_ACTION (1 << 14)
642 #define IOPARM_OPEN_HAS_DELIM (1 << 15)
643 #define IOPARM_OPEN_HAS_PAD (1 << 16)
644 #define IOPARM_OPEN_HAS_CONVERT (1 << 17)
645 #define IOPARM_OPEN_HAS_DECIMAL (1 << 18)
646 #define IOPARM_OPEN_HAS_ENCODING (1 << 19)
647 #define IOPARM_OPEN_HAS_ROUND (1 << 20)
648 #define IOPARM_OPEN_HAS_SIGN (1 << 21)
649 #define IOPARM_OPEN_HAS_ASYNCHRONOUS (1 << 22)
650 #define IOPARM_OPEN_HAS_NEWUNIT (1 << 23)
652 /* library start function and end macro. These can be expanded if needed
653 in the future. cmp is st_parameter_common *cmp */
655 extern void library_start (st_parameter_common
*);
656 internal_proto(library_start
);
658 #define library_end()
662 extern void stupid_function_name_for_static_linking (void);
663 internal_proto(stupid_function_name_for_static_linking
);
665 extern void set_args (int, char **);
666 iexport_proto(set_args
);
668 extern void get_args (int *, char ***);
669 internal_proto(get_args
);
671 extern void store_exe_path (const char *);
672 export_proto(store_exe_path
);
674 extern char * full_exe_path (void);
675 internal_proto(full_exe_path
);
679 extern void show_backtrace (void);
680 internal_proto(show_backtrace
);
684 #if defined(HAVE_GFC_REAL_16)
685 #define GFC_LARGEST_BUF (sizeof (GFC_REAL_16))
686 #elif defined(HAVE_GFC_INTEGER_16)
687 #define GFC_LARGEST_BUF (sizeof (GFC_INTEGER_LARGEST))
688 #elif defined(HAVE_GFC_REAL_10)
689 #define GFC_LARGEST_BUF (sizeof (GFC_REAL_10))
691 #define GFC_LARGEST_BUF (sizeof (GFC_INTEGER_LARGEST))
694 #define GFC_ITOA_BUF_SIZE (sizeof (GFC_INTEGER_LARGEST) * 3 + 2)
695 #define GFC_XTOA_BUF_SIZE (GFC_LARGEST_BUF * 2 + 1)
696 #define GFC_OTOA_BUF_SIZE (GFC_LARGEST_BUF * 3 + 1)
697 #define GFC_BTOA_BUF_SIZE (GFC_LARGEST_BUF * 8 + 1)
699 extern void sys_exit (int) __attribute__ ((noreturn
));
700 internal_proto(sys_exit
);
702 extern const char *gfc_xtoa (GFC_UINTEGER_LARGEST
, char *, size_t);
703 internal_proto(gfc_xtoa
);
705 extern void os_error (const char *) __attribute__ ((noreturn
));
706 iexport_proto(os_error
);
708 extern void show_locus (st_parameter_common
*);
709 internal_proto(show_locus
);
711 extern void runtime_error (const char *, ...)
712 __attribute__ ((noreturn
, format (gfc_printf
, 1, 2)));
713 iexport_proto(runtime_error
);
715 extern void runtime_error_at (const char *, const char *, ...)
716 __attribute__ ((noreturn
, format (gfc_printf
, 2, 3)));
717 iexport_proto(runtime_error_at
);
719 extern void runtime_warning_at (const char *, const char *, ...)
720 __attribute__ ((format (gfc_printf
, 2, 3)));
721 iexport_proto(runtime_warning_at
);
723 extern void internal_error (st_parameter_common
*, const char *)
724 __attribute__ ((noreturn
));
725 internal_proto(internal_error
);
727 extern const char *get_oserror (void);
728 internal_proto(get_oserror
);
730 extern const char *translate_error (int);
731 internal_proto(translate_error
);
733 extern void generate_error (st_parameter_common
*, int, const char *);
734 iexport_proto(generate_error
);
736 extern try notify_std (st_parameter_common
*, int, const char *);
737 internal_proto(notify_std
);
739 extern notification
notification_std(int);
740 internal_proto(notification_std
);
744 extern void set_fpu (void);
745 internal_proto(set_fpu
);
749 extern void *get_mem (size_t) __attribute__ ((malloc
));
750 internal_proto(get_mem
);
752 extern void *internal_malloc_size (size_t) __attribute__ ((malloc
));
753 internal_proto(internal_malloc_size
);
757 extern int check_buffered (int);
758 internal_proto(check_buffered
);
760 extern void init_variables (void);
761 internal_proto(init_variables
);
763 extern void show_variables (void);
764 internal_proto(show_variables
);
766 unit_convert
get_unformatted_convert (int);
767 internal_proto(get_unformatted_convert
);
771 extern int find_option (st_parameter_common
*, const char *, gfc_charlen_type
,
772 const st_option
*, const char *);
773 internal_proto(find_option
);
775 extern gfc_charlen_type
fstrlen (const char *, gfc_charlen_type
);
776 internal_proto(fstrlen
);
778 extern gfc_charlen_type
fstrcpy (char *, gfc_charlen_type
, const char *, gfc_charlen_type
);
779 internal_proto(fstrcpy
);
781 extern gfc_charlen_type
cf_strcpy (char *, gfc_charlen_type
, const char *);
782 internal_proto(cf_strcpy
);
784 /* io/intrinsics.c */
786 extern void flush_all_units (void);
787 internal_proto(flush_all_units
);
791 extern void init_units (void);
792 internal_proto(init_units
);
794 extern void close_units (void);
795 internal_proto(close_units
);
797 extern int unit_to_fd (int);
798 internal_proto(unit_to_fd
);
800 extern int st_printf (const char *, ...)
801 __attribute__ ((format (gfc_printf
, 1, 2)));
802 internal_proto(st_printf
);
804 extern int st_vprintf (const char *, va_list);
805 internal_proto(st_vprintf
);
807 extern char * filename_from_unit (int);
808 internal_proto(filename_from_unit
);
812 extern void stop_string (const char *, GFC_INTEGER_4
)
813 __attribute__ ((noreturn
));
814 export_proto(stop_string
);
816 /* reshape_packed.c */
818 extern void reshape_packed (char *, index_type
, const char *, index_type
,
819 const char *, index_type
);
820 internal_proto(reshape_packed
);
822 /* Repacking functions. These are called internally by internal_pack
823 and internal_unpack. */
825 GFC_INTEGER_1
*internal_pack_1 (gfc_array_i1
*);
826 internal_proto(internal_pack_1
);
828 GFC_INTEGER_2
*internal_pack_2 (gfc_array_i2
*);
829 internal_proto(internal_pack_2
);
831 GFC_INTEGER_4
*internal_pack_4 (gfc_array_i4
*);
832 internal_proto(internal_pack_4
);
834 GFC_INTEGER_8
*internal_pack_8 (gfc_array_i8
*);
835 internal_proto(internal_pack_8
);
837 #if defined HAVE_GFC_INTEGER_16
838 GFC_INTEGER_16
*internal_pack_16 (gfc_array_i16
*);
839 internal_proto(internal_pack_16
);
842 GFC_REAL_4
*internal_pack_r4 (gfc_array_r4
*);
843 internal_proto(internal_pack_r4
);
845 GFC_REAL_8
*internal_pack_r8 (gfc_array_r8
*);
846 internal_proto(internal_pack_r8
);
848 #if defined HAVE_GFC_REAL_10
849 GFC_REAL_10
*internal_pack_r10 (gfc_array_r10
*);
850 internal_proto(internal_pack_r10
);
853 #if defined HAVE_GFC_REAL_16
854 GFC_REAL_16
*internal_pack_r16 (gfc_array_r16
*);
855 internal_proto(internal_pack_r16
);
858 GFC_COMPLEX_4
*internal_pack_c4 (gfc_array_c4
*);
859 internal_proto(internal_pack_c4
);
861 GFC_COMPLEX_8
*internal_pack_c8 (gfc_array_c8
*);
862 internal_proto(internal_pack_c8
);
864 #if defined HAVE_GFC_COMPLEX_10
865 GFC_COMPLEX_10
*internal_pack_c10 (gfc_array_c10
*);
866 internal_proto(internal_pack_c10
);
869 #if defined HAVE_GFC_COMPLEX_16
870 GFC_COMPLEX_16
*internal_pack_c16 (gfc_array_c16
*);
871 internal_proto(internal_pack_c16
);
874 extern void internal_unpack_1 (gfc_array_i1
*, const GFC_INTEGER_1
*);
875 internal_proto(internal_unpack_1
);
877 extern void internal_unpack_2 (gfc_array_i2
*, const GFC_INTEGER_2
*);
878 internal_proto(internal_unpack_2
);
880 extern void internal_unpack_4 (gfc_array_i4
*, const GFC_INTEGER_4
*);
881 internal_proto(internal_unpack_4
);
883 extern void internal_unpack_8 (gfc_array_i8
*, const GFC_INTEGER_8
*);
884 internal_proto(internal_unpack_8
);
886 #if defined HAVE_GFC_INTEGER_16
887 extern void internal_unpack_16 (gfc_array_i16
*, const GFC_INTEGER_16
*);
888 internal_proto(internal_unpack_16
);
891 extern void internal_unpack_r4 (gfc_array_r4
*, const GFC_REAL_4
*);
892 internal_proto(internal_unpack_r4
);
894 extern void internal_unpack_r8 (gfc_array_r8
*, const GFC_REAL_8
*);
895 internal_proto(internal_unpack_r8
);
897 #if defined HAVE_GFC_REAL_10
898 extern void internal_unpack_r10 (gfc_array_r10
*, const GFC_REAL_10
*);
899 internal_proto(internal_unpack_r10
);
902 #if defined HAVE_GFC_REAL_16
903 extern void internal_unpack_r16 (gfc_array_r16
*, const GFC_REAL_16
*);
904 internal_proto(internal_unpack_r16
);
907 extern void internal_unpack_c4 (gfc_array_c4
*, const GFC_COMPLEX_4
*);
908 internal_proto(internal_unpack_c4
);
910 extern void internal_unpack_c8 (gfc_array_c8
*, const GFC_COMPLEX_8
*);
911 internal_proto(internal_unpack_c8
);
913 #if defined HAVE_GFC_COMPLEX_10
914 extern void internal_unpack_c10 (gfc_array_c10
*, const GFC_COMPLEX_10
*);
915 internal_proto(internal_unpack_c10
);
918 #if defined HAVE_GFC_COMPLEX_16
919 extern void internal_unpack_c16 (gfc_array_c16
*, const GFC_COMPLEX_16
*);
920 internal_proto(internal_unpack_c16
);
923 /* Internal auxiliary functions for the pack intrinsic. */
925 extern void pack_i1 (gfc_array_i1
*, const gfc_array_i1
*,
926 const gfc_array_l1
*, const gfc_array_i1
*);
927 internal_proto(pack_i1
);
929 extern void pack_i2 (gfc_array_i2
*, const gfc_array_i2
*,
930 const gfc_array_l1
*, const gfc_array_i2
*);
931 internal_proto(pack_i2
);
933 extern void pack_i4 (gfc_array_i4
*, const gfc_array_i4
*,
934 const gfc_array_l1
*, const gfc_array_i4
*);
935 internal_proto(pack_i4
);
937 extern void pack_i8 (gfc_array_i8
*, const gfc_array_i8
*,
938 const gfc_array_l1
*, const gfc_array_i8
*);
939 internal_proto(pack_i8
);
941 #ifdef HAVE_GFC_INTEGER_16
942 extern void pack_i16 (gfc_array_i16
*, const gfc_array_i16
*,
943 const gfc_array_l1
*, const gfc_array_i16
*);
944 internal_proto(pack_i16
);
947 extern void pack_r4 (gfc_array_r4
*, const gfc_array_r4
*,
948 const gfc_array_l1
*, const gfc_array_r4
*);
949 internal_proto(pack_r4
);
951 extern void pack_r8 (gfc_array_r8
*, const gfc_array_r8
*,
952 const gfc_array_l1
*, const gfc_array_r8
*);
953 internal_proto(pack_r8
);
955 #ifdef HAVE_GFC_REAL_10
956 extern void pack_r10 (gfc_array_r10
*, const gfc_array_r10
*,
957 const gfc_array_l1
*, const gfc_array_r10
*);
958 internal_proto(pack_r10
);
961 #ifdef HAVE_GFC_REAL_16
962 extern void pack_r16 (gfc_array_r16
*, const gfc_array_r16
*,
963 const gfc_array_l1
*, const gfc_array_r16
*);
964 internal_proto(pack_r16
);
967 extern void pack_c4 (gfc_array_c4
*, const gfc_array_c4
*,
968 const gfc_array_l1
*, const gfc_array_c4
*);
969 internal_proto(pack_c4
);
971 extern void pack_c8 (gfc_array_c8
*, const gfc_array_c8
*,
972 const gfc_array_l1
*, const gfc_array_c8
*);
973 internal_proto(pack_c8
);
975 #ifdef HAVE_GFC_REAL_10
976 extern void pack_c10 (gfc_array_c10
*, const gfc_array_c10
*,
977 const gfc_array_l1
*, const gfc_array_c10
*);
978 internal_proto(pack_c10
);
981 #ifdef HAVE_GFC_REAL_16
982 extern void pack_c16 (gfc_array_c16
*, const gfc_array_c16
*,
983 const gfc_array_l1
*, const gfc_array_c16
*);
984 internal_proto(pack_c16
);
987 /* Internal auxiliary functions for the unpack intrinsic. */
989 extern void unpack0_i1 (gfc_array_i1
*, const gfc_array_i1
*,
990 const gfc_array_l1
*, const GFC_INTEGER_1
*);
991 internal_proto(unpack0_i1
);
993 extern void unpack0_i2 (gfc_array_i2
*, const gfc_array_i2
*,
994 const gfc_array_l1
*, const GFC_INTEGER_2
*);
995 internal_proto(unpack0_i2
);
997 extern void unpack0_i4 (gfc_array_i4
*, const gfc_array_i4
*,
998 const gfc_array_l1
*, const GFC_INTEGER_4
*);
999 internal_proto(unpack0_i4
);
1001 extern void unpack0_i8 (gfc_array_i8
*, const gfc_array_i8
*,
1002 const gfc_array_l1
*, const GFC_INTEGER_8
*);
1003 internal_proto(unpack0_i8
);
1005 #ifdef HAVE_GFC_INTEGER_16
1007 extern void unpack0_i16 (gfc_array_i16
*, const gfc_array_i16
*,
1008 const gfc_array_l1
*, const GFC_INTEGER_16
*);
1009 internal_proto(unpack0_i16
);
1013 extern void unpack0_r4 (gfc_array_r4
*, const gfc_array_r4
*,
1014 const gfc_array_l1
*, const GFC_REAL_4
*);
1015 internal_proto(unpack0_r4
);
1017 extern void unpack0_r8 (gfc_array_r8
*, const gfc_array_r8
*,
1018 const gfc_array_l1
*, const GFC_REAL_8
*);
1019 internal_proto(unpack0_r8
);
1021 #ifdef HAVE_GFC_REAL_10
1023 extern void unpack0_r10 (gfc_array_r10
*, const gfc_array_r10
*,
1024 const gfc_array_l1
*, const GFC_REAL_10
*);
1025 internal_proto(unpack0_r10
);
1029 #ifdef HAVE_GFC_REAL_16
1031 extern void unpack0_r16 (gfc_array_r16
*, const gfc_array_r16
*,
1032 const gfc_array_l1
*, const GFC_REAL_16
*);
1033 internal_proto(unpack0_r16
);
1037 extern void unpack0_c4 (gfc_array_c4
*, const gfc_array_c4
*,
1038 const gfc_array_l1
*, const GFC_COMPLEX_4
*);
1039 internal_proto(unpack0_c4
);
1041 extern void unpack0_c8 (gfc_array_c8
*, const gfc_array_c8
*,
1042 const gfc_array_l1
*, const GFC_COMPLEX_8
*);
1043 internal_proto(unpack0_c8
);
1045 #ifdef HAVE_GFC_COMPLEX_10
1047 extern void unpack0_c10 (gfc_array_c10
*, const gfc_array_c10
*,
1048 const gfc_array_l1
*mask
, const GFC_COMPLEX_10
*);
1049 internal_proto(unpack0_c10
);
1053 #ifdef HAVE_GFC_COMPLEX_16
1055 extern void unpack0_c16 (gfc_array_c16
*, const gfc_array_c16
*,
1056 const gfc_array_l1
*, const GFC_COMPLEX_16
*);
1057 internal_proto(unpack0_c16
);
1061 extern void unpack1_i1 (gfc_array_i1
*, const gfc_array_i1
*,
1062 const gfc_array_l1
*, const gfc_array_i1
*);
1063 internal_proto(unpack1_i1
);
1065 extern void unpack1_i2 (gfc_array_i2
*, const gfc_array_i2
*,
1066 const gfc_array_l1
*, const gfc_array_i2
*);
1067 internal_proto(unpack1_i2
);
1069 extern void unpack1_i4 (gfc_array_i4
*, const gfc_array_i4
*,
1070 const gfc_array_l1
*, const gfc_array_i4
*);
1071 internal_proto(unpack1_i4
);
1073 extern void unpack1_i8 (gfc_array_i8
*, const gfc_array_i8
*,
1074 const gfc_array_l1
*, const gfc_array_i8
*);
1075 internal_proto(unpack1_i8
);
1077 #ifdef HAVE_GFC_INTEGER_16
1078 extern void unpack1_i16 (gfc_array_i16
*, const gfc_array_i16
*,
1079 const gfc_array_l1
*, const gfc_array_i16
*);
1080 internal_proto(unpack1_i16
);
1083 extern void unpack1_r4 (gfc_array_r4
*, const gfc_array_r4
*,
1084 const gfc_array_l1
*, const gfc_array_r4
*);
1085 internal_proto(unpack1_r4
);
1087 extern void unpack1_r8 (gfc_array_r8
*, const gfc_array_r8
*,
1088 const gfc_array_l1
*, const gfc_array_r8
*);
1089 internal_proto(unpack1_r8
);
1091 #ifdef HAVE_GFC_REAL_10
1092 extern void unpack1_r10 (gfc_array_r10
*, const gfc_array_r10
*,
1093 const gfc_array_l1
*, const gfc_array_r10
*);
1094 internal_proto(unpack1_r10
);
1097 #ifdef HAVE_GFC_REAL_16
1098 extern void unpack1_r16 (gfc_array_r16
*, const gfc_array_r16
*,
1099 const gfc_array_l1
*, const gfc_array_r16
*);
1100 internal_proto(unpack1_r16
);
1103 extern void unpack1_c4 (gfc_array_c4
*, const gfc_array_c4
*,
1104 const gfc_array_l1
*, const gfc_array_c4
*);
1105 internal_proto(unpack1_c4
);
1107 extern void unpack1_c8 (gfc_array_c8
*, const gfc_array_c8
*,
1108 const gfc_array_l1
*, const gfc_array_c8
*);
1109 internal_proto(unpack1_c8
);
1111 #ifdef HAVE_GFC_COMPLEX_10
1112 extern void unpack1_c10 (gfc_array_c10
*, const gfc_array_c10
*,
1113 const gfc_array_l1
*, const gfc_array_c10
*);
1114 internal_proto(unpack1_c10
);
1117 #ifdef HAVE_GFC_COMPLEX_16
1118 extern void unpack1_c16 (gfc_array_c16
*, const gfc_array_c16
*,
1119 const gfc_array_l1
*, const gfc_array_c16
*);
1120 internal_proto(unpack1_c16
);
1123 /* Helper functions for spread. */
1125 extern void spread_i1 (gfc_array_i1
*, const gfc_array_i1
*,
1126 const index_type
, const index_type
);
1127 internal_proto(spread_i1
);
1129 extern void spread_i2 (gfc_array_i2
*, const gfc_array_i2
*,
1130 const index_type
, const index_type
);
1131 internal_proto(spread_i2
);
1133 extern void spread_i4 (gfc_array_i4
*, const gfc_array_i4
*,
1134 const index_type
, const index_type
);
1135 internal_proto(spread_i4
);
1137 extern void spread_i8 (gfc_array_i8
*, const gfc_array_i8
*,
1138 const index_type
, const index_type
);
1139 internal_proto(spread_i8
);
1141 #ifdef HAVE_GFC_INTEGER_16
1142 extern void spread_i16 (gfc_array_i16
*, const gfc_array_i16
*,
1143 const index_type
, const index_type
);
1144 internal_proto(spread_i16
);
1148 extern void spread_r4 (gfc_array_r4
*, const gfc_array_r4
*,
1149 const index_type
, const index_type
);
1150 internal_proto(spread_r4
);
1152 extern void spread_r8 (gfc_array_r8
*, const gfc_array_r8
*,
1153 const index_type
, const index_type
);
1154 internal_proto(spread_r8
);
1156 #ifdef HAVE_GFC_REAL_10
1157 extern void spread_r10 (gfc_array_r10
*, const gfc_array_r10
*,
1158 const index_type
, const index_type
);
1159 internal_proto(spread_r10
);
1163 #ifdef HAVE_GFC_REAL_16
1164 extern void spread_r16 (gfc_array_r16
*, const gfc_array_r16
*,
1165 const index_type
, const index_type
);
1166 internal_proto(spread_r16
);
1170 extern void spread_c4 (gfc_array_c4
*, const gfc_array_c4
*,
1171 const index_type
, const index_type
);
1172 internal_proto(spread_c4
);
1174 extern void spread_c8 (gfc_array_c8
*, const gfc_array_c8
*,
1175 const index_type
, const index_type
);
1176 internal_proto(spread_c8
);
1178 #ifdef HAVE_GFC_COMPLEX_10
1179 extern void spread_c10 (gfc_array_c10
*, const gfc_array_c10
*,
1180 const index_type
, const index_type
);
1181 internal_proto(spread_c10
);
1185 #ifdef HAVE_GFC_COMPLEX_16
1186 extern void spread_c16 (gfc_array_c16
*, const gfc_array_c16
*,
1187 const index_type
, const index_type
);
1188 internal_proto(spread_c16
);
1192 extern void spread_scalar_i1 (gfc_array_i1
*, const GFC_INTEGER_1
*,
1193 const index_type
, const index_type
);
1194 internal_proto(spread_scalar_i1
);
1196 extern void spread_scalar_i2 (gfc_array_i2
*, const GFC_INTEGER_2
*,
1197 const index_type
, const index_type
);
1198 internal_proto(spread_scalar_i2
);
1200 extern void spread_scalar_i4 (gfc_array_i4
*, const GFC_INTEGER_4
*,
1201 const index_type
, const index_type
);
1202 internal_proto(spread_scalar_i4
);
1204 extern void spread_scalar_i8 (gfc_array_i8
*, const GFC_INTEGER_8
*,
1205 const index_type
, const index_type
);
1206 internal_proto(spread_scalar_i8
);
1208 #ifdef HAVE_GFC_INTEGER_16
1209 extern void spread_scalar_i16 (gfc_array_i16
*, const GFC_INTEGER_16
*,
1210 const index_type
, const index_type
);
1211 internal_proto(spread_scalar_i16
);
1215 extern void spread_scalar_r4 (gfc_array_r4
*, const GFC_REAL_4
*,
1216 const index_type
, const index_type
);
1217 internal_proto(spread_scalar_r4
);
1219 extern void spread_scalar_r8 (gfc_array_r8
*, const GFC_REAL_8
*,
1220 const index_type
, const index_type
);
1221 internal_proto(spread_scalar_r8
);
1223 #ifdef HAVE_GFC_REAL_10
1224 extern void spread_scalar_r10 (gfc_array_r10
*, const GFC_REAL_10
*,
1225 const index_type
, const index_type
);
1226 internal_proto(spread_scalar_r10
);
1230 #ifdef HAVE_GFC_REAL_16
1231 extern void spread_scalar_r16 (gfc_array_r16
*, const GFC_REAL_16
*,
1232 const index_type
, const index_type
);
1233 internal_proto(spread_scalar_r16
);
1237 extern void spread_scalar_c4 (gfc_array_c4
*, const GFC_COMPLEX_4
*,
1238 const index_type
, const index_type
);
1239 internal_proto(spread_scalar_c4
);
1241 extern void spread_scalar_c8 (gfc_array_c8
*, const GFC_COMPLEX_8
*,
1242 const index_type
, const index_type
);
1243 internal_proto(spread_scalar_c8
);
1245 #ifdef HAVE_GFC_COMPLEX_10
1246 extern void spread_scalar_c10 (gfc_array_c10
*, const GFC_COMPLEX_10
*,
1247 const index_type
, const index_type
);
1248 internal_proto(spread_scalar_c10
);
1252 #ifdef HAVE_GFC_COMPLEX_16
1253 extern void spread_scalar_c16 (gfc_array_c16
*, const GFC_COMPLEX_16
*,
1254 const index_type
, const index_type
);
1255 internal_proto(spread_scalar_c16
);
1259 /* string_intrinsics.c */
1261 extern int compare_string (gfc_charlen_type
, const char *,
1262 gfc_charlen_type
, const char *);
1263 iexport_proto(compare_string
);
1265 extern int compare_string_char4 (gfc_charlen_type
, const gfc_char4_t
*,
1266 gfc_charlen_type
, const gfc_char4_t
*);
1267 iexport_proto(compare_string_char4
);
1271 extern void random_seed_i4 (GFC_INTEGER_4
* size
, gfc_array_i4
* put
,
1272 gfc_array_i4
* get
);
1273 iexport_proto(random_seed_i4
);
1274 extern void random_seed_i8 (GFC_INTEGER_8
* size
, gfc_array_i8
* put
,
1275 gfc_array_i8
* get
);
1276 iexport_proto(random_seed_i8
);
1280 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS
, void) array_t
;
1282 extern index_type
size0 (const array_t
* array
);
1283 iexport_proto(size0
);
1287 extern void bounds_equal_extents (array_t
*, array_t
*, const char *,
1289 internal_proto(bounds_equal_extents
);
1291 extern void bounds_reduced_extents (array_t
*, array_t
*, int, const char *,
1292 const char *intrinsic
);
1293 internal_proto(bounds_reduced_extents
);
1295 extern void bounds_iforeach_return (array_t
*, array_t
*, const char *);
1296 internal_proto(bounds_iforeach_return
);
1298 extern void bounds_ifunction_return (array_t
*, const index_type
*,
1299 const char *, const char *);
1300 internal_proto(bounds_ifunction_return
);
1302 extern index_type
count_0 (const gfc_array_l1
*);
1304 internal_proto(count_0
);
1306 /* Internal auxiliary functions for cshift */
1308 void cshift0_i1 (gfc_array_i1
*, const gfc_array_i1
*, ssize_t
, int);
1309 internal_proto(cshift0_i1
);
1311 void cshift0_i2 (gfc_array_i2
*, const gfc_array_i2
*, ssize_t
, int);
1312 internal_proto(cshift0_i2
);
1314 void cshift0_i4 (gfc_array_i4
*, const gfc_array_i4
*, ssize_t
, int);
1315 internal_proto(cshift0_i4
);
1317 void cshift0_i8 (gfc_array_i8
*, const gfc_array_i8
*, ssize_t
, int);
1318 internal_proto(cshift0_i8
);
1320 #ifdef HAVE_GFC_INTEGER_16
1321 void cshift0_i16 (gfc_array_i16
*, const gfc_array_i16
*, ssize_t
, int);
1322 internal_proto(cshift0_i16
);
1325 void cshift0_r4 (gfc_array_r4
*, const gfc_array_r4
*, ssize_t
, int);
1326 internal_proto(cshift0_r4
);
1328 void cshift0_r8 (gfc_array_r8
*, const gfc_array_r8
*, ssize_t
, int);
1329 internal_proto(cshift0_r8
);
1331 #ifdef HAVE_GFC_REAL_10
1332 void cshift0_r10 (gfc_array_r10
*, const gfc_array_r10
*, ssize_t
, int);
1333 internal_proto(cshift0_r10
);
1336 #ifdef HAVE_GFC_REAL_16
1337 void cshift0_r16 (gfc_array_r16
*, const gfc_array_r16
*, ssize_t
, int);
1338 internal_proto(cshift0_r16
);
1341 void cshift0_c4 (gfc_array_c4
*, const gfc_array_c4
*, ssize_t
, int);
1342 internal_proto(cshift0_c4
);
1344 void cshift0_c8 (gfc_array_c8
*, const gfc_array_c8
*, ssize_t
, int);
1345 internal_proto(cshift0_c8
);
1347 #ifdef HAVE_GFC_COMPLEX_10
1348 void cshift0_c10 (gfc_array_c10
*, const gfc_array_c10
*, ssize_t
, int);
1349 internal_proto(cshift0_c10
);
1352 #ifdef HAVE_GFC_COMPLEX_16
1353 void cshift0_c16 (gfc_array_c16
*, const gfc_array_c16
*, ssize_t
, int);
1354 internal_proto(cshift0_c16
);
1357 #endif /* LIBGFOR_H */