PR c++/14032
[official-gcc.git] / libgfortran / libgfortran.h
blob7ce198a1f0ebb52ee09853acc9f123ec77cd3b91
1 /* Common declarations for all of libgfortran.
2 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
3 Contributed by Paul Brook <paul@nowt.org>, and
4 Andy Vaught <andy@xena.eas.asu.edu>
6 This file is part of the GNU Fortran 95 runtime library (libgfortran).
8 Libgfortran is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
13 Libgfortran is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public
19 License along with libgfor; see the file COPYING.LIB. If not,
20 write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
23 /* As a special exception, if you link this library with other files,
24 some of which are compiled with GCC, to produce an executable,
25 this library does not by itself cause the resulting executable
26 to be covered by the GNU General Public License.
27 This exception does not however invalidate any other reasons why
28 the executable file might be covered by the GNU General Public License. */
31 #ifndef LIBGFOR_H
32 #define LIBGFOR_H
34 #include <stdio.h>
35 #include <math.h>
36 #include <stddef.h>
37 #include <float.h>
38 #include <stdarg.h>
40 #if HAVE_COMPLEX_H
41 # include <complex.h>
42 #else
43 #define complex __complex__
44 #endif
46 #include "../gcc/fortran/libgfortran.h"
48 #include "config.h"
49 #include "c99_protos.h"
51 #if HAVE_IEEEFP_H
52 #include <ieeefp.h>
53 #endif
55 #include "gstdint.h"
57 #if HAVE_SYS_TYPES_H
58 #include <sys/types.h>
59 #endif
60 typedef off_t gfc_offset;
62 #ifndef NULL
63 #define NULL (void *) 0
64 #endif
66 #ifndef __GNUC__
67 #define __attribute__(x)
68 #endif
71 /* On mingw, work around the buggy Windows snprintf() by using the one
72 mingw provides, __mingw_snprintf(). We also provide a prototype for
73 __mingw_snprintf(), because the mingw headers currently don't have one. */
74 #if HAVE_MINGW_SNPRINTF
75 extern int __mingw_snprintf (char *, size_t, const char *, ...);
76 #undef snprintf
77 #define snprintf __mingw_snprintf
78 #endif
81 /* For a library, a standard prefix is a requirement in order to partition
82 the namespace. IPREFIX is for symbols intended to be internal to the
83 library. */
84 #define PREFIX(x) _gfortran_ ## x
85 #define IPREFIX(x) _gfortrani_ ## x
87 /* Magic to rename a symbol at the compiler level. You continue to refer
88 to the symbol as OLD in the source, but it'll be named NEW in the asm. */
89 #define sym_rename(old, new) sym_rename1(old, __USER_LABEL_PREFIX__, new)
90 #define sym_rename1(old, ulp, new) sym_rename2(old, ulp, new)
91 #define sym_rename2(old, ulp, new) extern __typeof(old) old __asm__(#ulp #new)
93 /* There are several classifications of routines:
95 (1) Symbols used only within the library,
96 (2) Symbols to be exported from the library,
97 (3) Symbols to be exported from the library, but
98 also used inside the library.
100 By telling the compiler about these different classifications we can
101 tightly control the interface seen by the user, and get better code
102 from the compiler at the same time.
104 One of the following should be used immediately after the declaration
105 of each symbol:
107 internal_proto Marks a symbol used only within the library,
108 and adds IPREFIX to the assembly-level symbol
109 name. The later is important for maintaining
110 the namespace partition for the static library.
112 export_proto Marks a symbol to be exported, and adds PREFIX
113 to the assembly-level symbol name.
115 export_proto_np Marks a symbol to be exported without adding PREFIX.
117 iexport_proto Marks a function to be exported, but with the
118 understanding that it can be used inside as well.
120 iexport_data_proto Similarly, marks a data symbol to be exported.
121 Unfortunately, some systems can't play the hidden
122 symbol renaming trick on data symbols, thanks to
123 the horribleness of COPY relocations.
125 If iexport_proto or iexport_data_proto is used, you must also use
126 iexport or iexport_data after the *definition* of the symbol. */
128 #if defined(HAVE_ATTRIBUTE_VISIBILITY)
129 # define internal_proto(x) \
130 sym_rename(x, IPREFIX (x)) __attribute__((__visibility__("hidden")))
131 #else
132 # define internal_proto(x) sym_rename(x, IPREFIX(x))
133 #endif
135 #if defined(HAVE_ATTRIBUTE_VISIBILITY) && defined(HAVE_ATTRIBUTE_ALIAS)
136 # define export_proto(x) sym_rename(x, PREFIX(x))
137 # define export_proto_np(x) extern char swallow_semicolon
138 # define iexport_proto(x) internal_proto(x)
139 # define iexport(x) iexport1(x, IPREFIX(x))
140 # define iexport1(x,y) iexport2(x,y)
141 # define iexport2(x,y) \
142 extern __typeof(x) PREFIX(x) __attribute__((__alias__(#y)))
143 /* ??? We're not currently building a dll, and it's wrong to add dllexport
144 to objects going into a static library archive. */
145 #elif 0 && defined(HAVE_ATTRIBUTE_DLLEXPORT)
146 # define export_proto_np(x) extern __typeof(x) x __attribute__((dllexport))
147 # define export_proto(x) sym_rename(x, PREFIX(x)) __attribute__((dllexport))
148 # define iexport_proto(x) export_proto(x)
149 # define iexport(x) extern char swallow_semicolon
150 #else
151 # define export_proto(x) sym_rename(x, PREFIX(x))
152 # define export_proto_np(x) extern char swallow_semicolon
153 # define iexport_proto(x) export_proto(x)
154 # define iexport(x) extern char swallow_semicolon
155 #endif
157 /* TODO: detect the case when we *can* hide the symbol. */
158 #define iexport_data_proto(x) export_proto(x)
159 #define iexport_data(x) extern char swallow_semicolon
161 /* The only reliable way to get the offset of a field in a struct
162 in a system independent way is via this macro. */
163 #ifndef offsetof
164 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *) 0)->MEMBER)
165 #endif
167 /* The isfinite macro is only available with C99, but some non-C99
168 systems still provide fpclassify, and there is a `finite' function
169 in BSD.
171 Also, isfinite is broken on Cygwin.
173 When isfinite is not available, try to use one of the
174 alternatives, or bail out. */
176 #if defined(HAVE_BROKEN_ISFINITE) || defined(__CYGWIN__)
177 #undef isfinite
178 #endif
180 #if defined(HAVE_BROKEN_ISNAN)
181 #undef isnan
182 #endif
184 #if defined(HAVE_BROKEN_FPCLASSIFY)
185 #undef fpclassify
186 #endif
188 #if !defined(isfinite)
189 #if !defined(fpclassify)
190 #define isfinite(x) ((x) - (x) == 0)
191 #else
192 #define isfinite(x) (fpclassify(x) != FP_NAN && fpclassify(x) != FP_INFINITE)
193 #endif /* !defined(fpclassify) */
194 #endif /* !defined(isfinite) */
196 #if !defined(isnan)
197 #if !defined(fpclassify)
198 #define isnan(x) ((x) != (x))
199 #else
200 #define isnan(x) (fpclassify(x) == FP_NAN)
201 #endif /* !defined(fpclassify) */
202 #endif /* !defined(isfinite) */
204 /* TODO: find the C99 version of these an move into above ifdef. */
205 #define REALPART(z) (__real__(z))
206 #define IMAGPART(z) (__imag__(z))
207 #define COMPLEX_ASSIGN(z_, r_, i_) {__real__(z_) = (r_); __imag__(z_) = (i_);}
209 #include "kinds.h"
211 /* Define the type used for the current record number for large file I/O.
212 The size must be consistent with the size defined on the compiler side. */
213 #ifdef HAVE_GFC_INTEGER_8
214 typedef GFC_INTEGER_8 GFC_IO_INT;
215 #else
216 #ifdef HAVE_GFC_INTEGER_4
217 typedef GFC_INTEGER_4 GFC_IO_INT;
218 #else
219 #error "GFC_INTEGER_4 should be available for the library to compile".
220 #endif
221 #endif
223 /* The following two definitions must be consistent with the types used
224 by the compiler. */
225 /* The type used of array indices, amongst other things. */
226 typedef ssize_t index_type;
227 /* The type used for the lengths of character variables. */
228 typedef GFC_INTEGER_4 gfc_charlen_type;
230 /* This will be 0 on little-endian machines and one on big-endian machines. */
231 extern int l8_to_l4_offset;
232 internal_proto(l8_to_l4_offset);
234 #define GFOR_POINTER_TO_L1(p, kind) \
235 (l8_to_l4_offset * (kind - 1) + (GFC_LOGICAL_1 *)(p))
237 #define GFC_INTEGER_1_HUGE \
238 (GFC_INTEGER_1)((((GFC_UINTEGER_1)1) << 7) - 1)
239 #define GFC_INTEGER_2_HUGE \
240 (GFC_INTEGER_2)((((GFC_UINTEGER_2)1) << 15) - 1)
241 #define GFC_INTEGER_4_HUGE \
242 (GFC_INTEGER_4)((((GFC_UINTEGER_4)1) << 31) - 1)
243 #define GFC_INTEGER_8_HUGE \
244 (GFC_INTEGER_8)((((GFC_UINTEGER_8)1) << 63) - 1)
245 #ifdef HAVE_GFC_INTEGER_16
246 #define GFC_INTEGER_16_HUGE \
247 (GFC_INTEGER_16)((((GFC_UINTEGER_16)1) << 127) - 1)
248 #endif
250 #define GFC_REAL_4_HUGE FLT_MAX
251 #define GFC_REAL_8_HUGE DBL_MAX
252 #ifdef HAVE_GFC_REAL_10
253 #define GFC_REAL_10_HUGE LDBL_MAX
254 #endif
255 #ifdef HAVE_GFC_REAL_16
256 #define GFC_REAL_16_HUGE LDBL_MAX
257 #endif
259 #define GFC_REAL_4_DIGITS FLT_MANT_DIG
260 #define GFC_REAL_8_DIGITS DBL_MANT_DIG
261 #ifdef HAVE_GFC_REAL_10
262 #define GFC_REAL_10_DIGITS LDBL_MANT_DIG
263 #endif
264 #ifdef HAVE_GFC_REAL_16
265 #define GFC_REAL_16_DIGITS LDBL_MANT_DIG
266 #endif
268 #define GFC_REAL_4_RADIX FLT_RADIX
269 #define GFC_REAL_8_RADIX FLT_RADIX
270 #ifdef HAVE_GFC_REAL_10
271 #define GFC_REAL_10_RADIX FLT_RADIX
272 #endif
273 #ifdef HAVE_GFC_REAL_16
274 #define GFC_REAL_16_RADIX FLT_RADIX
275 #endif
278 typedef struct descriptor_dimension
280 index_type stride;
281 index_type lbound;
282 index_type ubound;
284 descriptor_dimension;
286 #define GFC_ARRAY_DESCRIPTOR(r, type) \
287 struct {\
288 type *data;\
289 size_t offset;\
290 index_type dtype;\
291 descriptor_dimension dim[r];\
294 /* Commonly used array descriptor types. */
295 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, void) gfc_array_void;
296 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, char) gfc_array_char;
297 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_1) gfc_array_i1;
298 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_2) gfc_array_i2;
299 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_4) gfc_array_i4;
300 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_8) gfc_array_i8;
301 #ifdef HAVE_GFC_INTEGER_16
302 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_16) gfc_array_i16;
303 #endif
304 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_REAL_4) gfc_array_r4;
305 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_REAL_8) gfc_array_r8;
306 #ifdef HAVE_GFC_REAL_10
307 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_REAL_10) gfc_array_r10;
308 #endif
309 #ifdef HAVE_GFC_REAL_16
310 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_REAL_16) gfc_array_r16;
311 #endif
312 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_COMPLEX_4) gfc_array_c4;
313 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_COMPLEX_8) gfc_array_c8;
314 #ifdef HAVE_GFC_COMPLEX_10
315 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_COMPLEX_10) gfc_array_c10;
316 #endif
317 #ifdef HAVE_GFC_COMPLEX_16
318 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_COMPLEX_16) gfc_array_c16;
319 #endif
320 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_1) gfc_array_l1;
321 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_2) gfc_array_l2;
322 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_4) gfc_array_l4;
323 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_8) gfc_array_l8;
324 #ifdef HAVE_GFC_LOGICAL_16
325 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_16) gfc_array_l16;
326 #endif
329 #define GFC_DESCRIPTOR_RANK(desc) ((desc)->dtype & GFC_DTYPE_RANK_MASK)
330 #define GFC_DESCRIPTOR_TYPE(desc) (((desc)->dtype & GFC_DTYPE_TYPE_MASK) \
331 >> GFC_DTYPE_TYPE_SHIFT)
332 #define GFC_DESCRIPTOR_SIZE(desc) ((desc)->dtype >> GFC_DTYPE_SIZE_SHIFT)
333 #define GFC_DESCRIPTOR_DATA(desc) ((desc)->data)
334 #define GFC_DESCRIPTOR_DTYPE(desc) ((desc)->dtype)
336 /* Runtime library include. */
337 #define stringize(x) expand_macro(x)
338 #define expand_macro(x) # x
340 /* Runtime options structure. */
342 typedef struct
344 int stdin_unit, stdout_unit, stderr_unit, optional_plus;
345 int allocate_init_flag, allocate_init_value;
346 int locus;
348 int separator_len;
349 const char *separator;
351 int mem_check;
352 int use_stderr, all_unbuffered, default_recl;
354 int fpu_round, fpu_precision, fpe;
356 int sighup, sigint;
357 int dump_core, backtrace;
359 options_t;
361 extern options_t options;
362 internal_proto(options);
364 extern void handler (int);
365 internal_proto(handler);
368 /* Compile-time options that will influence the library. */
370 typedef struct
372 int warn_std;
373 int allow_std;
374 int pedantic;
375 int convert;
376 int dump_core;
377 int backtrace;
378 int sign_zero;
379 size_t record_marker;
380 int max_subrecord_length;
381 int bounds_check;
383 compile_options_t;
385 extern compile_options_t compile_options;
386 internal_proto(compile_options);
388 extern void init_compile_options (void);
389 internal_proto(init_compile_options);
391 #define GFC_MAX_SUBRECORD_LENGTH 2147483639 /* 2**31 - 9 */
393 /* Structure for statement options. */
395 typedef struct
397 const char *name;
398 int value;
400 st_option;
403 /* This is returned by notification_std to know if, given the flags
404 that were given (-std=, -pedantic) we should issue an error, a warning
405 or nothing. */
406 typedef enum
407 { SILENT, WARNING, ERROR }
408 notification;
410 /* This is returned by notify_std and several io functions. */
411 typedef enum
412 { SUCCESS = 1, FAILURE }
413 try;
415 /* The filename and line number don't go inside the globals structure.
416 They are set by the rest of the program and must be linked to. */
418 /* Location of the current library call (optional). */
419 extern unsigned line;
420 iexport_data_proto(line);
422 extern char *filename;
423 iexport_data_proto(filename);
425 /* Avoid conflicting prototypes of alloca() in system headers by using
426 GCC's builtin alloca(). */
427 #define gfc_alloca(x) __builtin_alloca(x)
430 /* Directory for creating temporary files. Only used when none of the
431 following environment variables exist: GFORTRAN_TMPDIR, TMP and TEMP. */
432 #define DEFAULT_TEMPDIR "/tmp"
434 /* The default value of record length for preconnected units is defined
435 here. This value can be overriden by an environment variable.
436 Default value is 1 Gb. */
437 #define DEFAULT_RECL 1073741824
440 #define CHARACTER2(name) \
441 gfc_charlen_type name ## _len; \
442 char * name
444 typedef struct st_parameter_common
446 GFC_INTEGER_4 flags;
447 GFC_INTEGER_4 unit;
448 const char *filename;
449 GFC_INTEGER_4 line;
450 CHARACTER2 (iomsg);
451 GFC_INTEGER_4 *iostat;
453 st_parameter_common;
455 #undef CHARACTER2
457 #define IOPARM_LIBRETURN_MASK (3 << 0)
458 #define IOPARM_LIBRETURN_OK (0 << 0)
459 #define IOPARM_LIBRETURN_ERROR (1 << 0)
460 #define IOPARM_LIBRETURN_END (2 << 0)
461 #define IOPARM_LIBRETURN_EOR (3 << 0)
462 #define IOPARM_ERR (1 << 2)
463 #define IOPARM_END (1 << 3)
464 #define IOPARM_EOR (1 << 4)
465 #define IOPARM_HAS_IOSTAT (1 << 5)
466 #define IOPARM_HAS_IOMSG (1 << 6)
468 #define IOPARM_COMMON_MASK ((1 << 7) - 1)
470 #define IOPARM_OPEN_HAS_RECL_IN (1 << 7)
471 #define IOPARM_OPEN_HAS_FILE (1 << 8)
472 #define IOPARM_OPEN_HAS_STATUS (1 << 9)
473 #define IOPARM_OPEN_HAS_ACCESS (1 << 10)
474 #define IOPARM_OPEN_HAS_FORM (1 << 11)
475 #define IOPARM_OPEN_HAS_BLANK (1 << 12)
476 #define IOPARM_OPEN_HAS_POSITION (1 << 13)
477 #define IOPARM_OPEN_HAS_ACTION (1 << 14)
478 #define IOPARM_OPEN_HAS_DELIM (1 << 15)
479 #define IOPARM_OPEN_HAS_PAD (1 << 16)
480 #define IOPARM_OPEN_HAS_CONVERT (1 << 17)
482 /* library start function and end macro. These can be expanded if needed
483 in the future. cmp is st_parameter_common *cmp */
485 extern void library_start (st_parameter_common *);
486 internal_proto(library_start);
488 #define library_end()
490 /* main.c */
492 extern void stupid_function_name_for_static_linking (void);
493 internal_proto(stupid_function_name_for_static_linking);
495 extern void set_args (int, char **);
496 export_proto(set_args);
498 extern void get_args (int *, char ***);
499 internal_proto(get_args);
501 extern void store_exe_path (const char *);
502 export_proto(store_exe_path);
504 extern char * full_exe_path (void);
505 internal_proto(full_exe_path);
507 /* backtrace.c */
509 extern void show_backtrace (void);
510 internal_proto(show_backtrace);
512 /* error.c */
514 #define GFC_ITOA_BUF_SIZE (sizeof (GFC_INTEGER_LARGEST) * 3 + 2)
515 #define GFC_XTOA_BUF_SIZE (sizeof (GFC_UINTEGER_LARGEST) * 2 + 1)
516 #define GFC_OTOA_BUF_SIZE (sizeof (GFC_INTEGER_LARGEST) * 3 + 1)
517 #define GFC_BTOA_BUF_SIZE (sizeof (GFC_INTEGER_LARGEST) * 8 + 1)
519 extern void sys_exit (int) __attribute__ ((noreturn));
520 internal_proto(sys_exit);
522 extern const char *gfc_itoa (GFC_INTEGER_LARGEST, char *, size_t);
523 internal_proto(gfc_itoa);
525 extern const char *xtoa (GFC_UINTEGER_LARGEST, char *, size_t);
526 internal_proto(xtoa);
528 extern void os_error (const char *) __attribute__ ((noreturn));
529 iexport_proto(os_error);
531 extern void show_locus (st_parameter_common *);
532 internal_proto(show_locus);
534 extern void runtime_error (const char *, ...)
535 __attribute__ ((noreturn, format (printf, 1, 2)));
536 iexport_proto(runtime_error);
538 extern void runtime_error_at (const char *, const char *, ...)
539 __attribute__ ((noreturn, format (printf, 2, 3)));
540 iexport_proto(runtime_error_at);
542 extern void internal_error (st_parameter_common *, const char *)
543 __attribute__ ((noreturn));
544 internal_proto(internal_error);
546 extern const char *get_oserror (void);
547 internal_proto(get_oserror);
549 extern const char *translate_error (int);
550 internal_proto(translate_error);
552 extern void generate_error (st_parameter_common *, int, const char *);
553 iexport_proto(generate_error);
555 extern try notify_std (st_parameter_common *, int, const char *);
556 internal_proto(notify_std);
558 extern notification notification_std(int);
559 internal_proto(notification_std);
561 /* fpu.c */
563 extern void set_fpu (void);
564 internal_proto(set_fpu);
566 /* memory.c */
568 extern void *get_mem (size_t) __attribute__ ((malloc));
569 internal_proto(get_mem);
571 extern void free_mem (void *);
572 internal_proto(free_mem);
574 extern void *internal_malloc_size (size_t) __attribute__ ((malloc));
575 internal_proto(internal_malloc_size);
577 /* environ.c */
579 extern int check_buffered (int);
580 internal_proto(check_buffered);
582 extern void init_variables (void);
583 internal_proto(init_variables);
585 extern void show_variables (void);
586 internal_proto(show_variables);
588 unit_convert get_unformatted_convert (int);
589 internal_proto(get_unformatted_convert);
591 /* string.c */
593 extern int find_option (st_parameter_common *, const char *, gfc_charlen_type,
594 const st_option *, const char *);
595 internal_proto(find_option);
597 extern gfc_charlen_type fstrlen (const char *, gfc_charlen_type);
598 internal_proto(fstrlen);
600 extern gfc_charlen_type fstrcpy (char *, gfc_charlen_type, const char *, gfc_charlen_type);
601 internal_proto(fstrcpy);
603 extern gfc_charlen_type cf_strcpy (char *, gfc_charlen_type, const char *);
604 internal_proto(cf_strcpy);
606 /* io/intrinsics.c */
608 extern void flush_all_units (void);
609 internal_proto(flush_all_units);
611 /* io.c */
613 extern void init_units (void);
614 internal_proto(init_units);
616 extern void close_units (void);
617 internal_proto(close_units);
619 extern int unit_to_fd (int);
620 internal_proto(unit_to_fd);
622 extern int st_printf (const char *, ...)
623 __attribute__ ((format (printf, 1, 2)));
624 internal_proto(st_printf);
626 extern int st_vprintf (const char *, va_list);
627 internal_proto(st_vprintf);
629 extern char * filename_from_unit (int);
630 internal_proto(filename_from_unit);
632 /* stop.c */
634 extern void stop_numeric (GFC_INTEGER_4) __attribute__ ((noreturn));
635 iexport_proto(stop_numeric);
637 /* reshape_packed.c */
639 extern void reshape_packed (char *, index_type, const char *, index_type,
640 const char *, index_type);
641 internal_proto(reshape_packed);
643 /* Repacking functions. */
645 /* ??? These aren't currently used by the compiler, though we
646 certainly could do so. */
647 GFC_INTEGER_4 *internal_pack_4 (gfc_array_i4 *);
648 internal_proto(internal_pack_4);
650 GFC_INTEGER_8 *internal_pack_8 (gfc_array_i8 *);
651 internal_proto(internal_pack_8);
653 #if defined HAVE_GFC_INTEGER_16
654 GFC_INTEGER_16 *internal_pack_16 (gfc_array_i16 *);
655 internal_proto(internal_pack_16);
656 #endif
658 GFC_COMPLEX_4 *internal_pack_c4 (gfc_array_c4 *);
659 internal_proto(internal_pack_c4);
661 GFC_COMPLEX_8 *internal_pack_c8 (gfc_array_c8 *);
662 internal_proto(internal_pack_c8);
664 #if defined HAVE_GFC_COMPLEX_10
665 GFC_COMPLEX_10 *internal_pack_c10 (gfc_array_c10 *);
666 internal_proto(internal_pack_c10);
667 #endif
669 extern void internal_unpack_4 (gfc_array_i4 *, const GFC_INTEGER_4 *);
670 internal_proto(internal_unpack_4);
672 extern void internal_unpack_8 (gfc_array_i8 *, const GFC_INTEGER_8 *);
673 internal_proto(internal_unpack_8);
675 #if defined HAVE_GFC_INTEGER_16
676 extern void internal_unpack_16 (gfc_array_i16 *, const GFC_INTEGER_16 *);
677 internal_proto(internal_unpack_16);
678 #endif
680 extern void internal_unpack_c4 (gfc_array_c4 *, const GFC_COMPLEX_4 *);
681 internal_proto(internal_unpack_c4);
683 extern void internal_unpack_c8 (gfc_array_c8 *, const GFC_COMPLEX_8 *);
684 internal_proto(internal_unpack_c8);
686 #if defined HAVE_GFC_COMPLEX_10
687 extern void internal_unpack_c10 (gfc_array_c10 *, const GFC_COMPLEX_10 *);
688 internal_proto(internal_unpack_c10);
689 #endif
691 #if defined HAVE_GFC_COMPLEX_16
692 extern void internal_unpack_c16 (gfc_array_c16 *, const GFC_COMPLEX_16 *);
693 internal_proto(internal_unpack_c16);
694 #endif
696 /* string_intrinsics.c */
698 extern int compare_string (GFC_INTEGER_4, const char *,
699 GFC_INTEGER_4, const char *);
700 iexport_proto(compare_string);
702 /* random.c */
704 extern void random_seed_i4 (GFC_INTEGER_4 * size, gfc_array_i4 * put,
705 gfc_array_i4 * get);
706 iexport_proto(random_seed_i4);
707 extern void random_seed_i8 (GFC_INTEGER_8 * size, gfc_array_i8 * put,
708 gfc_array_i8 * get);
709 iexport_proto(random_seed_i8);
711 /* size.c */
713 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, void) array_t;
715 extern index_type size0 (const array_t * array);
716 iexport_proto(size0);
718 #endif /* LIBGFOR_H */