aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/intrinsics
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2004-12-12 00:59:05 -0800
committerRichard Henderson <rth@gcc.gnu.org>2004-12-12 00:59:05 -0800
commit7d7b8bfe55f8598f2fa0f842fb7f95060c45fa35 (patch)
treecb0ecd2cd7b8c21d4d1c38261b5b7116e8dd2782 /libgfortran/intrinsics
parentc431e4997fcca052667b780341ddf4df5f6eb55c (diff)
downloadgcc-7d7b8bfe55f8598f2fa0f842fb7f95060c45fa35.zip
gcc-7d7b8bfe55f8598f2fa0f842fb7f95060c45fa35.tar.gz
gcc-7d7b8bfe55f8598f2fa0f842fb7f95060c45fa35.tar.bz2
acinclude.m4 (LIBGFOR_CHECK_ATTRIBUTE_VISIBILITY): New.
* acinclude.m4 (LIBGFOR_CHECK_ATTRIBUTE_VISIBILITY): New. (LIBGFOR_CHECK_ATTRIBUTE_DLLEXPORT): New. (LIBGFOR_CHECK_ATTRIBUTE_ALIAS): New. * configure.ac: Use them. * configure, config.h.in, aclocal.m4: Rebuild. * libgfortran.h (prefix): Remove. (PREFIX, IPREFIX): New. (sym_rename, sym_rename1, sym_rename2): New. (internal_proto, export_proto, export_proto_np): New. (iexport_proto, iexport): New. (iexport_data_proto, iexport_data): New. * intrinsics/abort.c, intrinsics/args.c, intrinsics/associated.c, intrinsics/cpu_time.c, intrinsics/cshift0.c, intrinsics/date_and_time.c, intrinsics/env.c, intrinsics/eoshift0.c, intrinsics/eoshift2.c, intrinsics/etime.c, intrinsics/exit.c, intrinsics/flush.c, intrinsics/fnum.c, intrinsics/getXid.c, intrinsics/getcwd.c, intrinsics/ishftc.c, intrinsics/mvbits.c, intrinsics/pack_generic.c, intrinsics/rand.c, intrinsics/random.c, intrinsics/reshape_generic.c, intrinsics/size.c, intrinsics/spread_generic.c, intrinsics/stat.c, intrinsics/string_intrinsics.c, intrinsics/system.c, intrinsics/system_clock.c, intrinsics/transpose_generic.c, intrinsics/umask.c, intrinsics/unlink.c, intrinsics/unpack_generic.c, io/backspace.c, io/close.c, io/endfile.c, io/inquire.c, io/io.h, io/open.c, io/rewind.c, io/transfer.c, libgfortran.h, m4/cshift1.m4, m4/dotprod.m4, m4/dotprodc.m4, m4/dotprodl.m4, m4/eoshift1.m4, m4/eoshift3.m4, m4/exponent.m4, m4/fraction.m4, m4/iforeach.m4, m4/ifunction.m4, m4/matmul.m4, m4/matmull.m4, m4/nearest.m4, m4/pow.m4, m4/reshape.m4, m4/set_exponent.m4, m4/shape.m4, m4/transpose.m4, runtime/environ.c, runtime/error.c, runtime/in_pack_generic.c, runtime/in_unpack_generic.c, runtime/main.c, runtime/memory.c, runtime/pause.c, runtime/select.c, runtime/stop.c: Use them to mark symbols internal or external. * generated/*: Rebuild. From-SVN: r92045
Diffstat (limited to 'libgfortran/intrinsics')
-rw-r--r--libgfortran/intrinsics/abort.c7
-rw-r--r--libgfortran/intrinsics/args.c73
-rw-r--r--libgfortran/intrinsics/associated.c5
-rw-r--r--libgfortran/intrinsics/cpu_time.c42
-rw-r--r--libgfortran/intrinsics/cshift0.c7
-rw-r--r--libgfortran/intrinsics/date_and_time.c4
-rw-r--r--libgfortran/intrinsics/env.c52
-rw-r--r--libgfortran/intrinsics/eoshift0.c8
-rw-r--r--libgfortran/intrinsics/eoshift2.c8
-rw-r--r--libgfortran/intrinsics/etime.c18
-rw-r--r--libgfortran/intrinsics/exit.c18
-rw-r--r--libgfortran/intrinsics/flush.c5
-rw-r--r--libgfortran/intrinsics/fnum.c9
-rw-r--r--libgfortran/intrinsics/getXid.c24
-rw-r--r--libgfortran/intrinsics/getcwd.c23
-rw-r--r--libgfortran/intrinsics/ishftc.c9
-rw-r--r--libgfortran/intrinsics/mvbits.c8
-rw-r--r--libgfortran/intrinsics/pack_generic.c8
-rw-r--r--libgfortran/intrinsics/rand.c34
-rw-r--r--libgfortran/intrinsics/random.c57
-rw-r--r--libgfortran/intrinsics/reshape_generic.c3
-rw-r--r--libgfortran/intrinsics/size.c11
-rw-r--r--libgfortran/intrinsics/spread_generic.c4
-rw-r--r--libgfortran/intrinsics/stat.c75
-rw-r--r--libgfortran/intrinsics/string_intrinsics.c51
-rw-r--r--libgfortran/intrinsics/system.c16
-rw-r--r--libgfortran/intrinsics/system_clock.c16
-rw-r--r--libgfortran/intrinsics/transpose_generic.c3
-rw-r--r--libgfortran/intrinsics/umask.c34
-rw-r--r--libgfortran/intrinsics/unlink.c24
-rw-r--r--libgfortran/intrinsics/unpack_generic.c8
31 files changed, 436 insertions, 228 deletions
diff --git a/libgfortran/intrinsics/abort.c b/libgfortran/intrinsics/abort.c
index cc2a422..8ab86ba 100644
--- a/libgfortran/intrinsics/abort.c
+++ b/libgfortran/intrinsics/abort.c
@@ -21,11 +21,10 @@ Boston, MA 02111-1307, USA. */
#include <stdlib.h>
#include "libgfortran.h"
+void PREFIX(abort) (void);
+export_proto_np(PREFIX(abort));
-void prefix(abort) (void);
-
-void prefix(abort) ()
+void PREFIX(abort) (void)
{
abort ();
}
-
diff --git a/libgfortran/intrinsics/args.c b/libgfortran/intrinsics/args.c
index 984fa91..f674281 100644
--- a/libgfortran/intrinsics/args.c
+++ b/libgfortran/intrinsics/args.c
@@ -28,8 +28,11 @@ Boston, MA 02111-1307, USA. */
/* Get a commandline argument. */
+extern void getarg_i4 (GFC_INTEGER_4 *, char *, gfc_charlen_type);
+iexport_proto(getarg_i4);
+
void
-prefix(getarg_i4) (GFC_INTEGER_4 *pos, char *val, gfc_charlen_type val_len)
+getarg_i4 (GFC_INTEGER_4 *pos, char *val, gfc_charlen_type val_len)
{
int argc;
int arglen;
@@ -50,24 +53,29 @@ prefix(getarg_i4) (GFC_INTEGER_4 *pos, char *val, gfc_charlen_type val_len)
memcpy (val, argv[*pos], arglen);
}
}
+iexport(getarg_i4);
/* INTEGER*8 wrapper of getarg. */
+extern void getarg_i8 (GFC_INTEGER_8 *, char *, gfc_charlen_type);
+export_proto (getarg_i8);
+
void
-prefix(getarg_i8) (GFC_INTEGER_8 *pos, char *val, gfc_charlen_type val_len)
+getarg_i8 (GFC_INTEGER_8 *pos, char *val, gfc_charlen_type val_len)
{
- GFC_INTEGER_4 pos4;
-
- pos4 = (GFC_INTEGER_4) *pos;
- prefix(getarg_i4) (&pos4, val, val_len);
+ GFC_INTEGER_4 pos4 = (GFC_INTEGER_4) *pos;
+ getarg_i4 (&pos4, val, val_len);
}
/* Return the number of commandline arguments. */
+extern GFC_INTEGER_4 iargc (void);
+export_proto(iargc);
+
GFC_INTEGER_4
-prefix(iargc) (void)
+iargc (void)
{
int argc;
char **argv;
@@ -96,14 +104,16 @@ prefix(iargc) (void)
#define GFC_GC_FAILURE 42
+extern void get_command_argument_i4 (GFC_INTEGER_4 *, char *, GFC_INTEGER_4 *,
+ GFC_INTEGER_4 *, gfc_charlen_type);
+iexport_proto(get_command_argument_i4);
+
/* Get a single commandline argument. */
void
-prefix(get_command_argument_i4) (GFC_INTEGER_4 *number,
- char *value,
- GFC_INTEGER_4 *length,
- GFC_INTEGER_4 *status,
- gfc_charlen_type value_len)
+get_command_argument_i4 (GFC_INTEGER_4 *number, char *value,
+ GFC_INTEGER_4 *length, GFC_INTEGER_4 *status,
+ gfc_charlen_type value_len)
{
int argc, arglen = 0, stat_flag = GFC_GC_SUCCESS;
char **argv;
@@ -146,24 +156,26 @@ prefix(get_command_argument_i4) (GFC_INTEGER_4 *number,
if (status != NULL)
*status = stat_flag;
}
+iexport(get_command_argument_i4);
/* INTEGER*8 wrapper for get_command_argument. */
+extern void get_command_argument_i8 (GFC_INTEGER_8 *, char *, GFC_INTEGER_8 *,
+ GFC_INTEGER_8 *, gfc_charlen_type);
+export_proto(get_command_argument_i8);
+
void
-prefix(get_command_argument_i8) (GFC_INTEGER_8 *number,
- char *value,
- GFC_INTEGER_8 *length,
- GFC_INTEGER_8 *status,
- gfc_charlen_type value_len)
+get_command_argument_i8 (GFC_INTEGER_8 *number, char *value,
+ GFC_INTEGER_8 *length, GFC_INTEGER_8 *status,
+ gfc_charlen_type value_len)
{
GFC_INTEGER_4 number4;
GFC_INTEGER_4 length4;
GFC_INTEGER_4 status4;
number4 = (GFC_INTEGER_4) *number;
- prefix (get_command_argument_i4) (&number4, value, &length4, &status4,
- value_len);
+ get_command_argument_i4 (&number4, value, &length4, &status4, value_len);
if (length)
*length = length4;
if (status)
@@ -173,11 +185,13 @@ prefix(get_command_argument_i8) (GFC_INTEGER_8 *number,
/* Return the whole commandline. */
+extern void get_command_i4 (char *, GFC_INTEGER_4 *, GFC_INTEGER_4 *,
+ gfc_charlen_type);
+iexport_proto(get_command_i4);
+
void
-prefix(get_command_i4) (char *command,
- GFC_INTEGER_4 *length,
- GFC_INTEGER_4 *status,
- gfc_charlen_type command_len)
+get_command_i4 (char *command, GFC_INTEGER_4 *length, GFC_INTEGER_4 *status,
+ gfc_charlen_type command_len)
{
int i, argc, arglen, thisarg;
int stat_flag = GFC_GC_SUCCESS;
@@ -229,20 +243,23 @@ prefix(get_command_i4) (char *command,
if (status != NULL)
*status = stat_flag;
}
+iexport(get_command_i4);
/* INTEGER*8 wrapper for get_command. */
+extern void get_command_i8 (char *, GFC_INTEGER_8 *, GFC_INTEGER_8 *,
+ gfc_charlen_type);
+export_proto(get_command_i8);
+
void
-prefix(get_command_i8) (char *command,
- GFC_INTEGER_8 *length,
- GFC_INTEGER_8 *status,
- gfc_charlen_type command_len)
+get_command_i8 (char *command, GFC_INTEGER_8 *length, GFC_INTEGER_8 *status,
+ gfc_charlen_type command_len)
{
GFC_INTEGER_4 length4;
GFC_INTEGER_4 status4;
- prefix (get_command_i4) (command, &length4, &status4, command_len);
+ get_command_i4 (command, &length4, &status4, command_len);
if (length)
*length = length4;
if (status)
diff --git a/libgfortran/intrinsics/associated.c b/libgfortran/intrinsics/associated.c
index e7805f1..012ffc1 100644
--- a/libgfortran/intrinsics/associated.c
+++ b/libgfortran/intrinsics/associated.c
@@ -21,8 +21,9 @@ Boston, MA 02111-1307, USA. */
#include "libgfortran.h"
-#define associated prefix(associated)
-
+extern GFC_LOGICAL_4 associated (const gfc_array_void *,
+ const gfc_array_void *);
+export_proto(associated);
GFC_LOGICAL_4
associated (const gfc_array_void *pointer, const gfc_array_void *target)
diff --git a/libgfortran/intrinsics/cpu_time.c b/libgfortran/intrinsics/cpu_time.c
index 887debc..58f2253 100644
--- a/libgfortran/intrinsics/cpu_time.c
+++ b/libgfortran/intrinsics/cpu_time.c
@@ -101,29 +101,43 @@ __cpu_time_1 (long *sec, long *usec)
#endif /* HAVE_GETRUSAGE */
}
-#undef CPU_TIME
-#define CPU_TIME(KIND) \
-void prefix(cpu_time_##KIND) (GFC_REAL_##KIND *__time) \
-{ \
- long sec, usec; \
- __cpu_time_1 (&sec, &usec); \
- *__time = (GFC_REAL_##KIND) sec + \
- ((GFC_REAL_##KIND) usec) * 1.e-6; \
+extern void cpu_time_4 (GFC_REAL_4 *);
+iexport_proto(cpu_time_4);
+
+void cpu_time_4 (GFC_REAL_4 *time)
+{
+ long sec, usec;
+ __cpu_time_1 (&sec, &usec);
+ *time = sec + usec * (GFC_REAL_4)1.e-6;
}
+iexport(cpu_time_4);
-CPU_TIME(4)
-CPU_TIME(8)
+extern void cpu_time_8 (GFC_REAL_8 *);
+export_proto(cpu_time_8);
+
+void cpu_time_8 (GFC_REAL_8 *time)
+{
+ long sec, usec;
+ __cpu_time_1 (&sec, &usec);
+ *time = sec + usec * (GFC_REAL_8)1.e-6;
+}
+
+extern void second_sub (GFC_REAL_4 *);
+export_proto(second_sub);
void
-prefix(second_sub) (GFC_REAL_4 *s)
+second_sub (GFC_REAL_4 *s)
{
- prefix(cpu_time_4)(s);
+ cpu_time_4 (s);
}
+extern GFC_REAL_4 second (void);
+export_proto(second);
+
GFC_REAL_4
-prefix(second) (void)
+second (void)
{
GFC_REAL_4 s;
- prefix(cpu_time_4)(&s);
+ cpu_time_4 (&s);
return s;
}
diff --git a/libgfortran/intrinsics/cshift0.c b/libgfortran/intrinsics/cshift0.c
index 6d7a801..9fd8785 100644
--- a/libgfortran/intrinsics/cshift0.c
+++ b/libgfortran/intrinsics/cshift0.c
@@ -238,6 +238,10 @@ __cshift0 (gfc_array_char * ret, const gfc_array_char * array,
}
+extern void __cshift0_4 (gfc_array_char *, const gfc_array_char *,
+ const GFC_INTEGER_4 *, const GFC_INTEGER_4 *);
+export_proto_np(__cshift0_4);
+
void
__cshift0_4 (gfc_array_char * ret, const gfc_array_char * array,
const GFC_INTEGER_4 * pshift, const GFC_INTEGER_4 * pdim)
@@ -245,6 +249,9 @@ __cshift0_4 (gfc_array_char * ret, const gfc_array_char * array,
__cshift0 (ret, array, *pshift, pdim ? *pdim : 1);
}
+extern void __cshift0_8 (gfc_array_char *, const gfc_array_char *,
+ const GFC_INTEGER_8 *, const GFC_INTEGER_8 *);
+export_proto_np(__cshift0_8);
void
__cshift0_8 (gfc_array_char * ret, const gfc_array_char * array,
diff --git a/libgfortran/intrinsics/date_and_time.c b/libgfortran/intrinsics/date_and_time.c
index e0b0123..67679f8 100644
--- a/libgfortran/intrinsics/date_and_time.c
+++ b/libgfortran/intrinsics/date_and_time.c
@@ -121,6 +121,10 @@ Boston, MA 02111-1307, USA. */
be to use ftime.
*/
+extern void date_and_time (char *, char *, char *, gfc_array_i4 *,
+ GFC_INTEGER_4, GFC_INTEGER_4, GFC_INTEGER_4);
+export_proto(date_and_time);
+
void
date_and_time (char *__date,
char *__time,
diff --git a/libgfortran/intrinsics/env.c b/libgfortran/intrinsics/env.c
index ab596fc..d116f1c 100644
--- a/libgfortran/intrinsics/env.c
+++ b/libgfortran/intrinsics/env.c
@@ -28,13 +28,14 @@ Boston, MA 02111-1307, USA. */
/* GETENV (NAME, VALUE), g77 intrinsic for retrieving the value of
- an environment variable. The name of the variable is specified in
- NAME, and the result is stored into VALUE. */
+ an environment variable. The name of the variable is specified in
+ NAME, and the result is stored into VALUE. */
+
+void PREFIX(getenv) (char *, char *, gfc_charlen_type, gfc_charlen_type);
+export_proto_np(PREFIX(getenv));
void
-prefix(getenv) (char * name,
- char * value,
- gfc_charlen_type name_len,
+PREFIX(getenv) (char * name, char * value, gfc_charlen_type name_len,
gfc_charlen_type value_len)
{
char *name_nt;
@@ -89,16 +90,16 @@ prefix(getenv) (char * name,
/* Processor-specific failure code. */
#define GFC_FAILURE 42
+extern void get_environment_variable_i4 (char *, char *, GFC_INTEGER_4 *,
+ GFC_INTEGER_4 *, GFC_LOGICAL_4 *,
+ gfc_charlen_type, gfc_charlen_type);
+iexport_proto(get_environment_variable_i4);
+
void
-prefix(get_environment_variable_i4)
- (
- char *name,
- char *value,
- GFC_INTEGER_4 *length,
- GFC_INTEGER_4 *status,
- GFC_LOGICAL_4 *trim_name,
- gfc_charlen_type name_len,
- gfc_charlen_type value_len)
+get_environment_variable_i4 (char *name, char *value, GFC_INTEGER_4 *length,
+ GFC_INTEGER_4 *status, GFC_LOGICAL_4 *trim_name,
+ gfc_charlen_type name_len,
+ gfc_charlen_type value_len)
{
int stat = GFC_SUCCESS, res_len = 0;
char *name_nt;
@@ -159,20 +160,21 @@ prefix(get_environment_variable_i4)
if (length != NULL)
*length = res_len;
}
+iexport(get_environment_variable_i4);
/* INTEGER*8 wrapper for get_environment_variable. */
+extern void get_environment_variable_i8 (char *, char *, GFC_INTEGER_8 *,
+ GFC_INTEGER_8 *, GFC_LOGICAL_8 *,
+ gfc_charlen_type, gfc_charlen_type);
+export_proto(get_environment_variable_i8);
+
void
-prefix(get_environment_variable_i8)
- (
- char *name,
- char *value,
- GFC_INTEGER_8 *length,
- GFC_INTEGER_8 *status,
- GFC_LOGICAL_8 *trim_name,
- gfc_charlen_type name_len,
- gfc_charlen_type value_len)
+get_environment_variable_i8 (char *name, char *value, GFC_INTEGER_8 *length,
+ GFC_INTEGER_8 *status, GFC_LOGICAL_8 *trim_name,
+ gfc_charlen_type name_len,
+ gfc_charlen_type value_len)
{
GFC_INTEGER_4 length4, status4;
GFC_LOGICAL_4 trim_name4;
@@ -180,8 +182,8 @@ prefix(get_environment_variable_i8)
if (trim_name)
trim_name4 = *trim_name;
- prefix (get_environment_variable_i4) (name, value, &length4, &status4,
- &trim_name4, name_len, value_len);
+ get_environment_variable_i4 (name, value, &length4, &status4,
+ &trim_name4, name_len, value_len);
if (length)
*length = length4;
diff --git a/libgfortran/intrinsics/eoshift0.c b/libgfortran/intrinsics/eoshift0.c
index db9dd657..df749a4 100644
--- a/libgfortran/intrinsics/eoshift0.c
+++ b/libgfortran/intrinsics/eoshift0.c
@@ -187,6 +187,10 @@ __eoshift0 (gfc_array_char * ret, const gfc_array_char * array,
}
}
+extern void __eoshift0_4 (gfc_array_char *, const gfc_array_char *,
+ const GFC_INTEGER_4 *, const char *,
+ const GFC_INTEGER_4 *);
+export_proto_np(__eoshift0_4);
void
__eoshift0_4 (gfc_array_char * ret, const gfc_array_char * array,
@@ -196,6 +200,10 @@ __eoshift0_4 (gfc_array_char * ret, const gfc_array_char * array,
__eoshift0 (ret, array, *pshift, pbound, pdim ? *pdim : 1);
}
+extern void __eoshift0_8 (gfc_array_char *, const gfc_array_char *,
+ const GFC_INTEGER_8 *, const char *,
+ const GFC_INTEGER_8 *);
+export_proto_np(__eoshift0_8);
void
__eoshift0_8 (gfc_array_char * ret, const gfc_array_char * array,
diff --git a/libgfortran/intrinsics/eoshift2.c b/libgfortran/intrinsics/eoshift2.c
index a20da55..388486d 100644
--- a/libgfortran/intrinsics/eoshift2.c
+++ b/libgfortran/intrinsics/eoshift2.c
@@ -203,6 +203,10 @@ __eoshift2 (gfc_array_char * ret, const gfc_array_char * array,
}
}
+extern void __eoshift2_4 (gfc_array_char *, const gfc_array_char *,
+ const GFC_INTEGER_4 *, const gfc_array_char *,
+ const GFC_INTEGER_4 *);
+export_proto_np(__eoshift2_4);
void
__eoshift2_4 (gfc_array_char * ret, const gfc_array_char * array,
@@ -212,6 +216,10 @@ __eoshift2_4 (gfc_array_char * ret, const gfc_array_char * array,
__eoshift2 (ret, array, *pshift, bound, pdim ? *pdim : 1);
}
+extern void __eoshift2_8 (gfc_array_char *, const gfc_array_char *,
+ const GFC_INTEGER_8 *, const gfc_array_char *,
+ const GFC_INTEGER_8 *);
+export_proto_np(__eoshift2_8);
void
__eoshift2_8 (gfc_array_char * ret, const gfc_array_char * array,
diff --git a/libgfortran/intrinsics/etime.c b/libgfortran/intrinsics/etime.c
index d8c2f11..9a8f976 100644
--- a/libgfortran/intrinsics/etime.c
+++ b/libgfortran/intrinsics/etime.c
@@ -30,8 +30,11 @@ Boston, MA 02111-1307, USA. */
#include <sys/resource.h>
#endif
+extern void etime_sub (gfc_array_r4 *t, GFC_REAL_4 *result);
+iexport_proto(etime_sub);
+
void
-prefix(etime_sub) (gfc_array_r4 *t, GFC_REAL_4 *result)
+etime_sub (gfc_array_r4 *t, GFC_REAL_4 *result)
{
GFC_REAL_4 tu, ts, tt, *tp;
index_type dim;
@@ -70,18 +73,25 @@ prefix(etime_sub) (gfc_array_r4 *t, GFC_REAL_4 *result)
*tp = ts;
*result = tt;
}
+iexport(etime_sub);
+
+extern GFC_REAL_4 etime (gfc_array_r4 *t);
+export_proto(etime);
GFC_REAL_4
-prefix(etime) (gfc_array_r4 *t)
+etime (gfc_array_r4 *t)
{
GFC_REAL_4 val;
- prefix(etime_sub) (t, &val);
+ etime_sub (t, &val);
return val;
}
/* LAPACK's test programs declares ETIME external, therefore we
need this. */
+extern GFC_REAL_4 etime_ (GFC_REAL_4 *t);
+export_proto_np(etime_);
+
GFC_REAL_4
etime_ (GFC_REAL_4 *t)
{
@@ -94,6 +104,6 @@ etime_ (GFC_REAL_4 *t)
desc.dim[0].stride = 1;
desc.data = t;
- prefix(etime_sub) (&desc, &val);
+ etime_sub (&desc, &val);
return val;
}
diff --git a/libgfortran/intrinsics/exit.c b/libgfortran/intrinsics/exit.c
index f15d567..fcb792e 100644
--- a/libgfortran/intrinsics/exit.c
+++ b/libgfortran/intrinsics/exit.c
@@ -30,18 +30,20 @@ Boston, MA 02111-1307, USA. */
/* SUBROUTINE EXIT(STATUS)
INTEGER, INTENT(IN), OPTIONAL :: STATUS */
+extern void exit_i4 (GFC_INTEGER_4 *);
+export_proto(exit_i4);
+
void
-prefix(exit_i4) (GFC_INTEGER_4 * status)
+exit_i4 (GFC_INTEGER_4 * status)
{
- if (status == NULL)
- exit(0);
- exit(*status);
+ exit (status ? *status : 0);
}
+extern void exit_i8 (GFC_INTEGER_8 *);
+export_proto(exit_i8);
+
void
-prefix(exit_i8) (GFC_INTEGER_8 * status)
+exit_i8 (GFC_INTEGER_8 * status)
{
- if (status == NULL)
- exit(0);
- exit((int) *status);
+ exit (status ? *status : 0);
}
diff --git a/libgfortran/intrinsics/flush.c b/libgfortran/intrinsics/flush.c
index 5f75195..3e70909 100644
--- a/libgfortran/intrinsics/flush.c
+++ b/libgfortran/intrinsics/flush.c
@@ -45,8 +45,11 @@ recursive_flush (gfc_unit *us)
}
+extern void flush_i4 (GFC_INTEGER_4 *);
+export_proto(flush_i4);
+
void
-prefix(flush_i4) (GFC_INTEGER_4 * unit)
+flush_i4 (GFC_INTEGER_4 *unit)
{
gfc_unit *us;
diff --git a/libgfortran/intrinsics/fnum.c b/libgfortran/intrinsics/fnum.c
index 251cfb4..f559464 100644
--- a/libgfortran/intrinsics/fnum.c
+++ b/libgfortran/intrinsics/fnum.c
@@ -28,15 +28,20 @@ Boston, MA 02111-1307, USA. */
INTEGER FNUM
INTEGER, INTENT(IN), :: UNIT */
+extern GFC_INTEGER_4 fnum_i4 (GFC_INTEGER_4 *);
+export_proto(fnum_i4);
+
GFC_INTEGER_4
-prefix(fnum_i4) (GFC_INTEGER_4 * unit)
+fnum_i4 (GFC_INTEGER_4 *unit)
{
return unit_to_fd (*unit);
}
+extern GFC_INTEGER_8 fnum_i8 (GFC_INTEGER_8 *);
+export_proto(fnum_i8);
GFC_INTEGER_8
-prefix(fnum_i8) (GFC_INTEGER_8 * unit)
+fnum_i8 (GFC_INTEGER_8 * unit)
{
return unit_to_fd (*unit);
}
diff --git a/libgfortran/intrinsics/getXid.c b/libgfortran/intrinsics/getXid.c
index 01aec12..4690d14 100644
--- a/libgfortran/intrinsics/getXid.c
+++ b/libgfortran/intrinsics/getXid.c
@@ -30,22 +30,34 @@ Boston, MA 02111-1307, USA. */
#include "libgfortran.h"
#ifdef HAVE_GETGID
-GFC_INTEGER_4 prefix(getgid) (void)
+extern GFC_INTEGER_4 PREFIX(getgid) (void);
+export_proto_np(PREFIX(getgid));
+
+GFC_INTEGER_4
+PREFIX(getgid) (void)
{
- return (GFC_INTEGER_4) getgid ();
+ return getgid ();
}
#endif
#ifdef HAVE_GETPID
-GFC_INTEGER_4 prefix(getpid) (void)
+extern GFC_INTEGER_4 PREFIX(getpid) (void);
+export_proto_np(PREFIX(getpid));
+
+GFC_INTEGER_4
+PREFIX(getpid) (void)
{
- return (GFC_INTEGER_4) getpid ();
+ return getpid ();
}
#endif
#ifdef HAVE_GETUID
-GFC_INTEGER_4 prefix(getuid) (void)
+extern GFC_INTEGER_4 PREFIX(getuid) (void);
+export_proto_np(PREFIX(getuid));
+
+GFC_INTEGER_4
+PREFIX(getuid) (void)
{
- return (GFC_INTEGER_4) getuid ();
+ return getuid ();
}
#endif
diff --git a/libgfortran/intrinsics/getcwd.c b/libgfortran/intrinsics/getcwd.c
index 86afa6c..318a3a9 100644
--- a/libgfortran/intrinsics/getcwd.c
+++ b/libgfortran/intrinsics/getcwd.c
@@ -31,9 +31,11 @@ Boston, MA 02111-1307, USA. */
#include <errno.h>
+extern void getcwd_i4_sub (char *, GFC_INTEGER_4 *, gfc_charlen_type);
+iexport_proto(getcwd_i4_sub);
+
void
-prefix(getcwd_i4_sub) (char * cwd, GFC_INTEGER_4 * status,
- gfc_charlen_type cwd_len)
+getcwd_i4_sub (char *cwd, GFC_INTEGER_4 *status, gfc_charlen_type cwd_len)
{
char str[cwd_len + 1], *s;
GFC_INTEGER_4 stat;
@@ -50,22 +52,27 @@ prefix(getcwd_i4_sub) (char * cwd, GFC_INTEGER_4 * status,
if (status != NULL)
*status = stat;
}
+iexport(getcwd_i4_sub);
+
+extern void getcwd_i8_sub (char *, GFC_INTEGER_8 *, gfc_charlen_type);
+export_proto(getcwd_i8_sub);
void
-prefix(getcwd_i8_sub) (char * cwd, GFC_INTEGER_8 * status,
- gfc_charlen_type cwd_len)
+getcwd_i8_sub (char *cwd, GFC_INTEGER_8 *status, gfc_charlen_type cwd_len)
{
GFC_INTEGER_4 status4;
-
- prefix (getcwd_i4_sub) (cwd, &status4, cwd_len);
+ getcwd_i4_sub (cwd, &status4, cwd_len);
if (status)
*status = status4;
}
+extern GFC_INTEGER_4 PREFIX(getcwd) (char *, gfc_charlen_type);
+export_proto_np(PREFIX(getcwd));
+
GFC_INTEGER_4
-prefix(getcwd) (char * cwd, gfc_charlen_type cwd_len)
+PREFIX(getcwd) (char *cwd, gfc_charlen_type cwd_len)
{
GFC_INTEGER_4 status;
- prefix(getcwd_i4_sub) (cwd, &status, cwd_len);
+ getcwd_i4_sub (cwd, &status, cwd_len);
return status;
}
diff --git a/libgfortran/intrinsics/ishftc.c b/libgfortran/intrinsics/ishftc.c
index 2677c33..7d5767c 100644
--- a/libgfortran/intrinsics/ishftc.c
+++ b/libgfortran/intrinsics/ishftc.c
@@ -21,11 +21,8 @@ Boston, MA 02111-1307, USA. */
#include "libgfortran.h"
-#define ishftc4 prefix(ishftc4)
-GFC_INTEGER_4 ishftc4 (GFC_INTEGER_4, GFC_INTEGER_4, GFC_INTEGER_4);
-
-#define ishftc8 prefix(ishftc8)
-GFC_INTEGER_8 ishftc8 (GFC_INTEGER_8, GFC_INTEGER_8, GFC_INTEGER_8);
+extern GFC_INTEGER_4 ishftc4 (GFC_INTEGER_4, GFC_INTEGER_4, GFC_INTEGER_4);
+export_proto(ishftc4);
GFC_INTEGER_4
ishftc4 (GFC_INTEGER_4 i, GFC_INTEGER_4 shift, GFC_INTEGER_4 size)
@@ -44,6 +41,8 @@ ishftc4 (GFC_INTEGER_4 i, GFC_INTEGER_4 shift, GFC_INTEGER_4 size)
return (i & mask) | (bits >> (size - shift)) | ((i << shift) & ~mask);
}
+extern GFC_INTEGER_8 ishftc8 (GFC_INTEGER_8, GFC_INTEGER_8, GFC_INTEGER_8);
+export_proto(ishftc8);
GFC_INTEGER_8
ishftc8 (GFC_INTEGER_8 i, GFC_INTEGER_8 shift, GFC_INTEGER_8 size)
diff --git a/libgfortran/intrinsics/mvbits.c b/libgfortran/intrinsics/mvbits.c
index 97fdc41..140547b 100644
--- a/libgfortran/intrinsics/mvbits.c
+++ b/libgfortran/intrinsics/mvbits.c
@@ -29,6 +29,10 @@ Boston, MA 02111-1307, USA. */
/* MVBITS copies LEN bits starting at bit position FROMPOS from FROM
into TO, starting at bit position TOPOS. */
+extern void SUB_NAME (const TYPE *, const GFC_INTEGER_4 *,
+ const GFC_INTEGER_4 *, TYPE *, const GFC_INTEGER_4 *);
+export_proto(SUB_NAME);
+
void
SUB_NAME (const TYPE *from, const GFC_INTEGER_4 *frompos,
const GFC_INTEGER_4 *len, TYPE *to, const GFC_INTEGER_4 *topos)
@@ -46,7 +50,7 @@ SUB_NAME (const TYPE *from, const GFC_INTEGER_4 *frompos,
#ifndef SUB_NAME
# define TYPE GFC_INTEGER_4
# define UTYPE GFC_UINTEGER_4
-# define SUB_NAME prefix (mvbits_i4)
+# define SUB_NAME mvbits_i4
# include "mvbits.c"
# undef SUB_NAME
# undef TYPE
@@ -54,7 +58,7 @@ SUB_NAME (const TYPE *from, const GFC_INTEGER_4 *frompos,
# define TYPE GFC_INTEGER_8
# define UTYPE GFC_UINTEGER_8
-# define SUB_NAME prefix (mvbits_i8)
+# define SUB_NAME mvbits_i8
# include "mvbits.c"
# undef SUB_NAME
# undef TYPE
diff --git a/libgfortran/intrinsics/pack_generic.c b/libgfortran/intrinsics/pack_generic.c
index 75a8661..0332b79 100644
--- a/libgfortran/intrinsics/pack_generic.c
+++ b/libgfortran/intrinsics/pack_generic.c
@@ -65,6 +65,10 @@ Boston, MA 02111-1307, USA. */
There are two variants of the PACK intrinsic: one, where MASK is
array valued, and the other one where MASK is scalar. */
+extern void __pack (gfc_array_char *, const gfc_array_char *,
+ const gfc_array_l4 *, const gfc_array_char *);
+export_proto_np(__pack);
+
void
__pack (gfc_array_char * ret, const gfc_array_char * array,
const gfc_array_l4 * mask, const gfc_array_char * vector)
@@ -265,6 +269,10 @@ __pack (gfc_array_char * ret, const gfc_array_char * array,
}
}
+extern void __pack_s (gfc_array_char *ret, const gfc_array_char *array,
+ const GFC_LOGICAL_4 *, const gfc_array_char *);
+export_proto_np(__pack_s);
+
void
__pack_s (gfc_array_char * ret, const gfc_array_char * array,
const GFC_LOGICAL_4 * mask, const gfc_array_char * vector)
diff --git a/libgfortran/intrinsics/rand.c b/libgfortran/intrinsics/rand.c
index f4e78d0..7989020 100644
--- a/libgfortran/intrinsics/rand.c
+++ b/libgfortran/intrinsics/rand.c
@@ -38,19 +38,29 @@ static GFC_UINTEGER_8 rand_seed = 1;
/* Set the seed of the irand generator. Note 0 is a bad seed. */
-void
-prefix(srand) (GFC_INTEGER_4 *i)
+static void
+srand_internal (GFC_INTEGER_8 i)
{
- rand_seed = (GFC_UINTEGER_8) (*i != 0) ? *i : 123459876;
+ rand_seed = i ? i : 123459876;
}
+extern void PREFIX(srand) (GFC_INTEGER_4 *i);
+export_proto_np(PREFIX(srand));
+
+void
+PREFIX(srand) (GFC_INTEGER_4 *i)
+{
+ srand_internal (*i);
+}
/* Return an INTEGER in the range [1,GFC_RAND_M-1]. */
+extern GFC_INTEGER_4 irand (GFC_INTEGER_4 *);
+iexport_proto(irand);
+
GFC_INTEGER_4
-prefix(irand) (GFC_INTEGER_4 *i)
+irand (GFC_INTEGER_4 *i)
{
-
GFC_INTEGER_4 j;
if (i)
j = *i;
@@ -66,25 +76,29 @@ prefix(irand) (GFC_INTEGER_4 *i)
/* Reset the RN sequence to system-dependent sequence and return the
first value. */
case 1:
- j = 0;
- prefix(srand) (&j);
+ srand_internal (0);
break;
/* Seed the RN sequence with j and return the first value. */
default:
- prefix(srand) (&j);
+ srand_internal (j);
+ break;
}
rand_seed = GFC_RAND_A * rand_seed % GFC_RAND_M;
return (GFC_INTEGER_4) rand_seed;
}
+iexport(irand);
/* Return a random REAL in the range [0,1). */
+extern GFC_REAL_4 PREFIX(rand) (GFC_INTEGER_4 *i);
+export_proto_np(PREFIX(rand));
+
GFC_REAL_4
-prefix(rand) (GFC_INTEGER_4 *i)
+PREFIX(rand) (GFC_INTEGER_4 *i)
{
- return normalize_r4_i4 (prefix(irand) (i) - 1, GFC_RAND_M1 - 1);
+ return normalize_r4_i4 (irand (i) - 1, GFC_RAND_M1 - 1);
}
diff --git a/libgfortran/intrinsics/random.c b/libgfortran/intrinsics/random.c
index 2cc5d20..0ea60ecc 100644
--- a/libgfortran/intrinsics/random.c
+++ b/libgfortran/intrinsics/random.c
@@ -20,6 +20,20 @@ License along with libgfor; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+#include "libgfortran.h"
+
+extern void random_r4 (GFC_REAL_4 *);
+iexport_proto(random_r4);
+
+extern void random_r8 (GFC_REAL_8 *);
+iexport_proto(random_r8);
+
+extern void arandom_r4 (gfc_array_r4 *);
+export_proto(arandom_r4);
+
+extern void arandom_r8 (gfc_array_r8 *);
+export_proto(arandom_r8);
+
#if 0
/* The Mersenne Twister code is currently commented out due to
@@ -45,7 +59,6 @@ Boston, MA 02111-1307, USA. */
Generation. ( Early in 1998 ). */
-#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
@@ -56,8 +69,6 @@ Boston, MA 02111-1307, USA. */
#include <unistd.h>
#endif
-#include "libgfortran.h"
-
/*Use the 'big' generator by default ( period -> 2**19937 ). */
#define MT19937
@@ -89,8 +100,7 @@ static unsigned int seed[N];
and also reading and writing of the seed. */
void
-random_seed (GFC_INTEGER_4 * size, const gfc_array_i4 * put,
- const gfc_array_i4 * get)
+random_seed (GFC_INTEGER_4 *size, gfc_array_i4 *put, gfc_array_i4 *get)
{
/* Initialize the seed in system dependent manner. */
if (get == NULL && put == NULL && size == NULL)
@@ -167,6 +177,7 @@ random_seed (GFC_INTEGER_4 * size, const gfc_array_i4 * put,
get->data[i * get->dim[0].stride] = seed[i];
}
}
+iexport(random_seed);
/* Here is the internal routine which generates the random numbers
in 'batches' based upon the need for a new batch.
@@ -197,7 +208,6 @@ random_generate (void)
/* A routine to return a REAL(KIND=4). */
-#define random_r4 prefix(random_r4)
void
random_r4 (GFC_REAL_4 * harv)
{
@@ -209,10 +219,10 @@ random_r4 (GFC_REAL_4 * harv)
*harv = (GFC_REAL_4) ((GFC_REAL_4) (GFC_UINTEGER_4) seed[i++] /
(GFC_REAL_4) (~(GFC_UINTEGER_4) 0));
}
+iexport(random_r4);
/* A routine to return a REAL(KIND=8). */
-#define random_r8 prefix(random_r8)
void
random_r8 (GFC_REAL_8 * harv)
{
@@ -225,12 +235,12 @@ random_r8 (GFC_REAL_8 * harv)
(GFC_REAL_8) (~(GFC_UINTEGER_8) 0);
i += 2;
}
+iexport(random_r8);
/* Code to handle arrays will follow here. */
/* REAL(KIND=4) REAL array. */
-#define arandom_r4 prefix(arandom_r4)
void
arandom_r4 (gfc_array_r4 * harv)
{
@@ -304,7 +314,6 @@ arandom_r4 (gfc_array_r4 * harv)
/* REAL(KIND=8) array. */
-#define arandom_r8 prefix(arandom_r8)
void
arandom_r8 (gfc_array_r8 * harv)
{
@@ -376,8 +385,8 @@ arandom_r8 (gfc_array_r8 * harv)
}
}
}
-#endif /* Mersenne Twister code */
+#else
/* George Marsaglia's KISS (Keep It Simple Stupid) random number generator.
@@ -418,9 +427,6 @@ arandom_r8 (gfc_array_r8 * harv)
"There is no copyright on the code below." included the original
KISS algorithm. */
-#include "config.h"
-#include "libgfortran.h"
-
#define GFC_SL(k, n) ((k)^((k)<<(n)))
#define GFC_SR(k, n) ((k)^((k)>>(n)))
@@ -436,7 +442,6 @@ static GFC_UINTEGER_4 kiss_seed[4] = KISS_DEFAULT_SEED;
static GFC_UINTEGER_4
kiss_random_kernel(void)
{
-
GFC_UINTEGER_4 kiss;
kiss_seed[0] = 69069 * kiss_seed[0] + 1327217885;
@@ -446,16 +451,14 @@ kiss_random_kernel(void)
kiss = kiss_seed[0] + kiss_seed[1] + (kiss_seed[2] << 16) + kiss_seed[3];
return kiss;
-
}
/* This function produces a REAL(4) value from the uniform distribution
with range [0,1). */
void
-prefix(random_r4) (GFC_REAL_4 *x)
+random_r4 (GFC_REAL_4 *x)
{
-
GFC_UINTEGER_4 kiss;
kiss = kiss_random_kernel ();
@@ -464,26 +467,27 @@ prefix(random_r4) (GFC_REAL_4 *x)
kiss_random_kernel ();
*x = normalize_r4_i4 (kiss, ~(GFC_UINTEGER_4) 0);
}
+iexport(random_r4);
/* This function produces a REAL(8) value from the uniform distribution
with range [0,1). */
void
-prefix(random_r8) (GFC_REAL_8 *x)
+random_r8 (GFC_REAL_8 *x)
{
-
GFC_UINTEGER_8 kiss;
kiss = ((GFC_UINTEGER_8)kiss_random_kernel ()) << 32;
kiss += kiss_random_kernel ();
*x = normalize_r8_i8 (kiss, ~(GFC_UINTEGER_8) 0);
}
+iexport(random_r8);
/* This function fills a REAL(4) array with values from the uniform
distribution with range [0,1). */
void
-prefix(arandom_r4) (gfc_array_r4 *x)
+arandom_r4 (gfc_array_r4 *x)
{
index_type count[GFC_MAX_DIMENSIONS - 1];
index_type extent[GFC_MAX_DIMENSIONS - 1];
@@ -513,7 +517,7 @@ prefix(arandom_r4) (gfc_array_r4 *x)
while (dest)
{
- prefix(random_r4) (dest);
+ random_r4 (dest);
/* Advance to the next element. */
dest += stride0;
@@ -547,7 +551,7 @@ prefix(arandom_r4) (gfc_array_r4 *x)
distribution with range [0,1). */
void
-prefix(arandom_r8) (gfc_array_r8 *x)
+arandom_r8 (gfc_array_r8 *x)
{
index_type count[GFC_MAX_DIMENSIONS - 1];
index_type extent[GFC_MAX_DIMENSIONS - 1];
@@ -577,7 +581,7 @@ prefix(arandom_r8) (gfc_array_r8 *x)
while (dest)
{
- prefix(random_r8) (dest);
+ random_r8 (dest);
/* Advance to the next element. */
dest += stride0;
@@ -607,8 +611,8 @@ prefix(arandom_r8) (gfc_array_r8 *x)
}
}
-/* prefix(random_seed) is used to seed the PRNG with either a default
- set of seeds or user specified set of seeds. prefix(random_seed)
+/* random_seed is used to seed the PRNG with either a default
+ set of seeds or user specified set of seeds. random_seed
must be called with no argument or exactly one argument. */
void
@@ -666,3 +670,6 @@ random_seed (GFC_INTEGER_4 *size, gfc_array_i4 *put, gfc_array_i4 *get)
get->data[i * get->dim[0].stride] = (GFC_INTEGER_4) kiss_seed[i];
}
}
+iexport(random_seed);
+
+#endif /* mersenne twister */
diff --git a/libgfortran/intrinsics/reshape_generic.c b/libgfortran/intrinsics/reshape_generic.c
index 5314456..aecc6b6 100644
--- a/libgfortran/intrinsics/reshape_generic.c
+++ b/libgfortran/intrinsics/reshape_generic.c
@@ -28,6 +28,9 @@ Boston, MA 02111-1307, USA. */
typedef GFC_ARRAY_DESCRIPTOR(1, index_type) shape_type;
typedef GFC_ARRAY_DESCRIPTOR(GFC_MAX_DIMENSIONS, char) parray;
+extern void __reshape (parray *, parray *, shape_type *,
+ parray *, shape_type *);
+export_proto_np(__reshape);
/* The shape parameter is ignored. We can currently deduce the shape from the
return array. */
diff --git a/libgfortran/intrinsics/size.c b/libgfortran/intrinsics/size.c
index f83f6c0..b001f34 100644
--- a/libgfortran/intrinsics/size.c
+++ b/libgfortran/intrinsics/size.c
@@ -21,7 +21,8 @@ Boston, MA 02111-1307, USA. */
#include "libgfortran.h"
-index_type size0 (const array_t * array)
+index_type
+size0 (const array_t * array)
{
int n;
index_type size;
@@ -37,9 +38,13 @@ index_type size0 (const array_t * array)
}
return size;
}
+iexport(size0);
-#define size1 prefix(size1)
-index_type size1 (const array_t * array, index_type dim)
+extern index_type size1 (const array_t * array, index_type dim);
+export_proto(size1);
+
+index_type
+size1 (const array_t * array, index_type dim)
{
index_type size;
diff --git a/libgfortran/intrinsics/spread_generic.c b/libgfortran/intrinsics/spread_generic.c
index f65f869..0cada54 100644
--- a/libgfortran/intrinsics/spread_generic.c
+++ b/libgfortran/intrinsics/spread_generic.c
@@ -25,6 +25,10 @@ Boston, MA 02111-1307, USA. */
#include <string.h>
#include "libgfortran.h"
+extern void __spread (const gfc_array_char *, const gfc_array_char *,
+ const index_type *, const index_type *);
+export_proto_np(__spread);
+
void
__spread (const gfc_array_char * ret, const gfc_array_char * source,
const index_type * along, const index_type * pncopies)
diff --git a/libgfortran/intrinsics/stat.c b/libgfortran/intrinsics/stat.c
index 8f250d4..de4a147 100644
--- a/libgfortran/intrinsics/stat.c
+++ b/libgfortran/intrinsics/stat.c
@@ -52,9 +52,13 @@ Boston, MA 02111-1307, USA. */
CHARACTER(len=*), INTENT(IN) :: FILE
INTEGER, INTENT(OUT), :: SARRAY(13) */
+extern void stat_i4_sub (char *, gfc_array_i4 *, GFC_INTEGER_4 *,
+ gfc_charlen_type);
+iexport_proto(stat_i4_sub);
+
void
-prefix(stat_i4_sub) (char * name, gfc_array_i4 * sarray,
- GFC_INTEGER_4 * status, gfc_charlen_type name_len)
+stat_i4_sub (char *name, gfc_array_i4 *sarray, GFC_INTEGER_4 *status,
+ gfc_charlen_type name_len)
{
int val;
char *str;
@@ -68,10 +72,10 @@ prefix(stat_i4_sub) (char * name, gfc_array_i4 * sarray,
/* If the array is too small, abort. */
if (sarray->dim[0].ubound + 1 - sarray->dim[0].lbound < 13)
- runtime_error ("Array size of SARRAY is too small.");
+ runtime_error ("Array size of SARRAY is too small.");
if (sarray->dim[0].stride == 0)
- sarray->dim[0].stride = 1;
+ sarray->dim[0].stride = 1;
/* Trim trailing spaces from name. */
while (name_len > 0 && name[name_len - 1] == ' ')
@@ -141,10 +145,15 @@ prefix(stat_i4_sub) (char * name, gfc_array_i4 * sarray,
if (status != NULL)
*status = (val == 0) ? 0 : errno;
}
+iexport(stat_i4_sub);
+
+extern void stat_i8_sub (char *, gfc_array_i8 *, GFC_INTEGER_8 *,
+ gfc_charlen_type);
+iexport_proto(stat_i8_sub);
void
-prefix(stat_i8_sub) (char * name, gfc_array_i8 * sarray,
- GFC_INTEGER_8 * status, gfc_charlen_type name_len)
+stat_i8_sub (char *name, gfc_array_i8 *sarray, GFC_INTEGER_8 *status,
+ gfc_charlen_type name_len)
{
int val;
char *str;
@@ -158,10 +167,10 @@ prefix(stat_i8_sub) (char * name, gfc_array_i8 * sarray,
/* If the array is too small, abort. */
if (sarray->dim[0].ubound + 1 - sarray->dim[0].lbound < 13)
- runtime_error ("Array size of SARRAY is too small.");
+ runtime_error ("Array size of SARRAY is too small.");
if (sarray->dim[0].stride == 0)
- sarray->dim[0].stride = 1;
+ sarray->dim[0].stride = 1;
/* Trim trailing spaces from name. */
while (name_len > 0 && name[name_len - 1] == ' ')
@@ -231,25 +240,27 @@ prefix(stat_i8_sub) (char * name, gfc_array_i8 * sarray,
if (status != NULL)
*status = (val == 0) ? 0 : errno;
}
+iexport(stat_i8_sub);
+extern GFC_INTEGER_4 stat_i4 (char *, gfc_array_i4 *, gfc_charlen_type);
+export_proto(stat_i4);
GFC_INTEGER_4
-prefix(stat_i4) (char * name, gfc_array_i4 * sarray,
- gfc_charlen_type name_len)
+stat_i4 (char *name, gfc_array_i4 *sarray, gfc_charlen_type name_len)
{
-
GFC_INTEGER_4 val;
- prefix(stat_i4_sub) (name, sarray, &val, name_len);
+ stat_i4_sub (name, sarray, &val, name_len);
return val;
}
+extern GFC_INTEGER_8 stat_i8 (char *, gfc_array_i8 *, gfc_charlen_type);
+export_proto(stat_i8);
GFC_INTEGER_8
-prefix(stat_i8) (char * name, gfc_array_i8 * sarray,
- gfc_charlen_type name_len)
+stat_i8 (char *name, gfc_array_i8 *sarray, gfc_charlen_type name_len)
{
GFC_INTEGER_8 val;
- prefix(stat_i8_sub) (name, sarray, &val, name_len);
+ stat_i8_sub (name, sarray, &val, name_len);
return val;
}
@@ -264,9 +275,11 @@ prefix(stat_i8) (char * name, gfc_array_i8 * sarray,
INTEGER, INTENT(IN) :: UNIT
INTEGER, INTENT(OUT) :: SARRAY(13) */
+extern void fstat_i4_sub (GFC_INTEGER_4 *, gfc_array_i4 *, GFC_INTEGER_4 *);
+iexport_proto(fstat_i4_sub);
+
void
-prefix(fstat_i4_sub) (GFC_INTEGER_4 * unit, gfc_array_i4 * sarray,
- GFC_INTEGER_4 * status)
+fstat_i4_sub (GFC_INTEGER_4 *unit, gfc_array_i4 *sarray, GFC_INTEGER_4 *status)
{
int val;
struct stat sb;
@@ -279,10 +292,10 @@ prefix(fstat_i4_sub) (GFC_INTEGER_4 * unit, gfc_array_i4 * sarray,
/* If the array is too small, abort. */
if (sarray->dim[0].ubound + 1 - sarray->dim[0].lbound < 13)
- runtime_error ("Array size of SARRAY is too small.");
+ runtime_error ("Array size of SARRAY is too small.");
if (sarray->dim[0].stride == 0)
- sarray->dim[0].stride = 1;
+ sarray->dim[0].stride = 1;
/* Convert Fortran unit number to C file descriptor. */
val = unit_to_fd (*unit);
@@ -346,10 +359,13 @@ prefix(fstat_i4_sub) (GFC_INTEGER_4 * unit, gfc_array_i4 * sarray,
if (status != NULL)
*status = (val == 0) ? 0 : errno;
}
+iexport(fstat_i4_sub);
+
+extern void fstat_i8_sub (GFC_INTEGER_8 *, gfc_array_i8 *, GFC_INTEGER_8 *);
+iexport_proto(fstat_i8_sub);
void
-prefix(fstat_i8_sub) (GFC_INTEGER_8 * unit, gfc_array_i8 * sarray,
- GFC_INTEGER_8 * status)
+fstat_i8_sub (GFC_INTEGER_8 *unit, gfc_array_i8 *sarray, GFC_INTEGER_8 *status)
{
int val;
struct stat sb;
@@ -362,10 +378,10 @@ prefix(fstat_i8_sub) (GFC_INTEGER_8 * unit, gfc_array_i8 * sarray,
/* If the array is too small, abort. */
if (sarray->dim[0].ubound + 1 - sarray->dim[0].lbound < 13)
- runtime_error ("Array size of SARRAY is too small.");
+ runtime_error ("Array size of SARRAY is too small.");
if (sarray->dim[0].stride == 0)
- sarray->dim[0].stride = 1;
+ sarray->dim[0].stride = 1;
/* Convert Fortran unit number to C file descriptor. */
val = unit_to_fd ((int) *unit);
@@ -429,21 +445,26 @@ prefix(fstat_i8_sub) (GFC_INTEGER_8 * unit, gfc_array_i8 * sarray,
if (status != NULL)
*status = (val == 0) ? 0 : errno;
}
+iexport(fstat_i8_sub);
+extern GFC_INTEGER_4 fstat_i4 (GFC_INTEGER_4 *, gfc_array_i4 *);
+export_proto(fstat_i4);
GFC_INTEGER_4
-prefix(fstat_i4) (GFC_INTEGER_4 * unit, gfc_array_i4 * sarray)
+fstat_i4 (GFC_INTEGER_4 *unit, gfc_array_i4 *sarray)
{
GFC_INTEGER_4 val;
- prefix(fstat_i4_sub) (unit, sarray, &val);
+ fstat_i4_sub (unit, sarray, &val);
return val;
}
+extern GFC_INTEGER_8 fstat_i8 (GFC_INTEGER_8 *, gfc_array_i8 *);
+export_proto(fstat_i8);
GFC_INTEGER_8
-prefix(fstat_i8) (GFC_INTEGER_8 * unit, gfc_array_i8 * sarray)
+fstat_i8 (GFC_INTEGER_8 *unit, gfc_array_i8 *sarray)
{
GFC_INTEGER_8 val;
- prefix(fstat_i8_sub) (unit, sarray, &val);
+ fstat_i8_sub (unit, sarray, &val);
return val;
}
diff --git a/libgfortran/intrinsics/string_intrinsics.c b/libgfortran/intrinsics/string_intrinsics.c
index faacaab..f5b5bc1 100644
--- a/libgfortran/intrinsics/string_intrinsics.c
+++ b/libgfortran/intrinsics/string_intrinsics.c
@@ -35,40 +35,40 @@ Boston, MA 02111-1307, USA. */
/* String functions. */
-#define copy_string prefix(copy_string)
-void copy_string (GFC_INTEGER_4, char *, GFC_INTEGER_4, const char *);
+extern void copy_string (GFC_INTEGER_4, char *, GFC_INTEGER_4, const char *);
+export_proto(copy_string);
-#define concat_string prefix(concat_string)
-void concat_string (GFC_INTEGER_4, char *,
- GFC_INTEGER_4, const char *,
- GFC_INTEGER_4, const char *);
+extern void concat_string (GFC_INTEGER_4, char *,
+ GFC_INTEGER_4, const char *,
+ GFC_INTEGER_4, const char *);
+export_proto(concat_string);
-#define string_len_trim prefix(string_len_trim)
-GFC_INTEGER_4 string_len_trim (GFC_INTEGER_4, const char *);
+extern GFC_INTEGER_4 string_len_trim (GFC_INTEGER_4, const char *);
+export_proto(string_len_trim);
-#define adjustl prefix(adjustl)
-void adjustl (char *, GFC_INTEGER_4, const char *);
+extern void adjustl (char *, GFC_INTEGER_4, const char *);
+export_proto(adjustl);
-#define adjustr prefix(adjustr)
-void adjustr (char *, GFC_INTEGER_4, const char *);
+extern void adjustr (char *, GFC_INTEGER_4, const char *);
+export_proto(adjustr);
-#define string_index prefix(string_index)
-GFC_INTEGER_4 string_index (GFC_INTEGER_4, const char *, GFC_INTEGER_4,
- const char *, GFC_LOGICAL_4);
+extern GFC_INTEGER_4 string_index (GFC_INTEGER_4, const char *, GFC_INTEGER_4,
+ const char *, GFC_LOGICAL_4);
+export_proto(string_index);
-#define string_scan prefix(string_scan)
-GFC_INTEGER_4 string_scan (GFC_INTEGER_4, const char *, GFC_INTEGER_4,
- const char *, GFC_LOGICAL_4);
+extern GFC_INTEGER_4 string_scan (GFC_INTEGER_4, const char *, GFC_INTEGER_4,
+ const char *, GFC_LOGICAL_4);
+export_proto(string_scan);
-#define string_verify prefix(string_verify)
-GFC_INTEGER_4 string_verify (GFC_INTEGER_4, const char *, GFC_INTEGER_4,
- const char *, GFC_LOGICAL_4);
+extern GFC_INTEGER_4 string_verify (GFC_INTEGER_4, const char *, GFC_INTEGER_4,
+ const char *, GFC_LOGICAL_4);
+export_proto(string_verify);
-#define string_trim prefix(string_trim)
-void string_trim (GFC_INTEGER_4 *, void **, GFC_INTEGER_4, const char *);
+extern void string_trim (GFC_INTEGER_4 *, void **, GFC_INTEGER_4, const char *);
+export_proto(string_trim);
-#define string_repeat prefix(string_repeat)
-void string_repeat (char *, GFC_INTEGER_4, const char *, GFC_INTEGER_4);
+extern void string_repeat (char *, GFC_INTEGER_4, const char *, GFC_INTEGER_4);
+export_proto(string_repeat);
/* The two areas may overlap so we use memmove. */
@@ -136,6 +136,7 @@ compare_string (GFC_INTEGER_4 len1, const char * s1,
return 0;
}
+iexport(compare_string);
/* The destination and source should not overlap. */
diff --git a/libgfortran/intrinsics/system.c b/libgfortran/intrinsics/system.c
index d962601..308717e 100644
--- a/libgfortran/intrinsics/system.c
+++ b/libgfortran/intrinsics/system.c
@@ -39,9 +39,12 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "libgfortran.h"
+extern void system_sub (const char *fcmd, GFC_INTEGER_4 * status,
+ gfc_charlen_type cmd_len);
+iexport_proto(system_sub);
+
void
-prefix(system_sub) (const char * fcmd, GFC_INTEGER_4 * status,
- gfc_charlen_type cmd_len)
+system_sub (const char *fcmd, GFC_INTEGER_4 *status, gfc_charlen_type cmd_len)
{
char cmd[cmd_len + 1];
int stat;
@@ -53,12 +56,15 @@ prefix(system_sub) (const char * fcmd, GFC_INTEGER_4 * status,
if (status)
*status = stat;
}
+iexport(system_sub);
+
+extern GFC_INTEGER_4 PREFIX(system) (const char *, gfc_charlen_type);
+export_proto_np(PREFIX(system));
GFC_INTEGER_4
-prefix(system) (char * fcmd, gfc_charlen_type cmd_len)
+PREFIX(system) (const char *fcmd, gfc_charlen_type cmd_len)
{
GFC_INTEGER_4 stat;
-
- prefix(system_sub) (fcmd, &stat, cmd_len);
+ system_sub (fcmd, &stat, cmd_len);
return stat;
}
diff --git a/libgfortran/intrinsics/system_clock.c b/libgfortran/intrinsics/system_clock.c
index d11d1a9..b778b03 100644
--- a/libgfortran/intrinsics/system_clock.c
+++ b/libgfortran/intrinsics/system_clock.c
@@ -41,14 +41,22 @@ static struct timeval tp0 = {-1, 0};
static time_t t0 = (time_t) -2;
#endif
+
+extern void system_clock_4 (GFC_INTEGER_4 *, GFC_INTEGER_4 *, GFC_INTEGER_4 *);
+export_proto(system_clock_4);
+
+extern void system_clock_8 (GFC_INTEGER_8 *, GFC_INTEGER_8 *, GFC_INTEGER_8 *);
+export_proto(system_clock_8);
+
+
/* prefix(system_clock_4) is the INTEGER(4) version of the SYSTEM_CLOCK
intrinsic subroutine. It returns the number of clock ticks for the current
system time, the number of ticks per second, and the maximum possible value
for COUNT. On the first call to SYSTEM_CLOCK, COUNT is set to zero. */
void
-prefix(system_clock_4)(GFC_INTEGER_4 *count, GFC_INTEGER_4 *count_rate,
- GFC_INTEGER_4 *count_max)
+system_clock_4(GFC_INTEGER_4 *count, GFC_INTEGER_4 *count_rate,
+ GFC_INTEGER_4 *count_max)
{
GFC_INTEGER_4 cnt;
GFC_INTEGER_4 rate;
@@ -123,8 +131,8 @@ prefix(system_clock_4)(GFC_INTEGER_4 *count, GFC_INTEGER_4 *count_rate,
/* INTEGER(8) version of the above routine. */
void
-prefix(system_clock_8)(GFC_INTEGER_8 *count, GFC_INTEGER_8 *count_rate,
- GFC_INTEGER_8 *count_max)
+system_clock_8 (GFC_INTEGER_8 *count, GFC_INTEGER_8 *count_rate,
+ GFC_INTEGER_8 *count_max)
{
GFC_INTEGER_8 cnt;
GFC_INTEGER_8 rate;
diff --git a/libgfortran/intrinsics/transpose_generic.c b/libgfortran/intrinsics/transpose_generic.c
index 55d2729..ba3014f 100644
--- a/libgfortran/intrinsics/transpose_generic.c
+++ b/libgfortran/intrinsics/transpose_generic.c
@@ -25,6 +25,9 @@ Boston, MA 02111-1307, USA. */
#include <assert.h>
#include "libgfortran.h"
+extern void __transpose (gfc_array_char *, gfc_array_char *);
+export_proto_np(__transpose);
+
void
__transpose (gfc_array_char * ret, gfc_array_char * source)
{
diff --git a/libgfortran/intrinsics/umask.c b/libgfortran/intrinsics/umask.c
index cf41451..2e8e165 100644
--- a/libgfortran/intrinsics/umask.c
+++ b/libgfortran/intrinsics/umask.c
@@ -35,41 +35,51 @@ Boston, MA 02111-1307, USA. */
INTEGER, INTENT(IN) :: MASK
INTEGER, INTENT(OUT), OPTIONAL :: OLD */
+extern void umask_i4_sub (GFC_INTEGER_4 *, GFC_INTEGER_4 *);
+iexport_proto(umask_i4_sub);
+
void
-prefix(umask_i4_sub) (GFC_INTEGER_4 * mask, GFC_INTEGER_4 * old)
+umask_i4_sub (GFC_INTEGER_4 *mask, GFC_INTEGER_4 *old)
{
- mode_t val;
-
- val = umask((mode_t) *mask);
+ mode_t val = umask((mode_t) *mask);
if (old != NULL)
*old = (GFC_INTEGER_4) val;
}
+iexport(umask_i4_sub);
+
+extern void umask_i8_sub (GFC_INTEGER_8 *, GFC_INTEGER_8 *);
+iexport_proto(umask_i8_sub);
void
-prefix(umask_i8_sub) (GFC_INTEGER_8 * mask, GFC_INTEGER_8 * old)
+umask_i8_sub (GFC_INTEGER_8 *mask, GFC_INTEGER_8 *old)
{
- mode_t val;
-
- val = umask((mode_t) *mask);
+ mode_t val = umask((mode_t) *mask);
if (old != NULL)
*old = (GFC_INTEGER_8) val;
}
+iexport(umask_i8_sub);
/* INTEGER FUNCTION UMASK(MASK)
INTEGER, INTENT(IN) :: MASK */
+extern GFC_INTEGER_4 umask_i4 (GFC_INTEGER_4 *);
+export_proto(umask_i4);
+
GFC_INTEGER_4
-prefix(umask) (GFC_INTEGER_4 * mask)
+umask_i4 (GFC_INTEGER_4 *mask)
{
GFC_INTEGER_4 old;
- prefix(umask_i4_sub) (mask, &old);
+ umask_i4_sub (mask, &old);
return old;
}
+extern GFC_INTEGER_8 umask_i8 (GFC_INTEGER_8 *);
+export_proto(umask_i8);
+
GFC_INTEGER_8
-prefix(umask_i8) (GFC_INTEGER_8 * mask)
+umask_i8 (GFC_INTEGER_8 *mask)
{
GFC_INTEGER_8 old;
- prefix(umask_i8_sub) (mask, &old);
+ umask_i8_sub (mask, &old);
return old;
}
diff --git a/libgfortran/intrinsics/unlink.c b/libgfortran/intrinsics/unlink.c
index 7ea2a10..b918706 100644
--- a/libgfortran/intrinsics/unlink.c
+++ b/libgfortran/intrinsics/unlink.c
@@ -35,11 +35,13 @@ Boston, MA 02111-1307, USA. */
CHARACTER(LEN= ), INTENT(IN) :: NAME
INTEGER, INTENT(OUT), OPTIONAL :: STATUS) */
+extern void unlink_i4_sub (char *name, GFC_INTEGER_4 *status,
+ gfc_charlen_type name_len);
+iexport_proto(unlink_i4_sub);
+
void
-prefix(unlink_i4_sub) (char * name, GFC_INTEGER_4 * status,
- gfc_charlen_type name_len)
+unlink_i4_sub (char *name, GFC_INTEGER_4 *status, gfc_charlen_type name_len)
{
-
char *str, *s;
GFC_INTEGER_4 stat;
@@ -57,14 +59,17 @@ prefix(unlink_i4_sub) (char * name, GFC_INTEGER_4 * status,
if (status != NULL)
*status = (stat == 0) ? stat : errno;
}
+iexport(unlink_i4_sub);
+extern void unlink_i8_sub (char *name, GFC_INTEGER_8 *status,
+ gfc_charlen_type name_len);
+export_proto(unlink_i8_sub);
void
-prefix(unlink_i8_sub) (char * name, GFC_INTEGER_8 * status,
- gfc_charlen_type name_len)
+unlink_i8_sub (char *name, GFC_INTEGER_8 *status, gfc_charlen_type name_len)
{
GFC_INTEGER_4 status4;
- prefix (unlink_i4_sub) (name, &status4, name_len);
+ unlink_i4_sub (name, &status4, name_len);
if (status)
*status = status4;
}
@@ -73,10 +78,13 @@ prefix(unlink_i8_sub) (char * name, GFC_INTEGER_8 * status,
/* INTEGER FUNCTION UNLINK(NAME)
CHARACTER(LEN= ), INTENT(IN) :: NAME */
+extern GFC_INTEGER_4 PREFIX(unlink) (char *, gfc_charlen_type);
+export_proto_np(PREFIX(unlink));
+
GFC_INTEGER_4
-prefix(unlink) (char * name, gfc_charlen_type name_len)
+PREFIX(unlink) (char *name, gfc_charlen_type name_len)
{
GFC_INTEGER_4 status;
- prefix(unlink_i4_sub) (name, &status, name_len);
+ unlink_i4_sub (name, &status, name_len);
return status;
}
diff --git a/libgfortran/intrinsics/unpack_generic.c b/libgfortran/intrinsics/unpack_generic.c
index a301b58..16deea4 100644
--- a/libgfortran/intrinsics/unpack_generic.c
+++ b/libgfortran/intrinsics/unpack_generic.c
@@ -25,6 +25,10 @@ Boston, MA 02111-1307, USA. */
#include <string.h>
#include "libgfortran.h"
+extern void __unpack1 (const gfc_array_char *, const gfc_array_char *,
+ const gfc_array_l4 *, const gfc_array_char *);
+export_proto_np(__unpack1);
+
void
__unpack1 (const gfc_array_char * ret, const gfc_array_char * vector,
const gfc_array_l4 * mask, const gfc_array_char * field)
@@ -140,6 +144,10 @@ __unpack1 (const gfc_array_char * ret, const gfc_array_char * vector,
}
}
+extern void __unpack0 (const gfc_array_char *, const gfc_array_char *,
+ const gfc_array_l4 *, char *);
+export_proto_np(__unpack0);
+
void
__unpack0 (const gfc_array_char * ret, const gfc_array_char * vector,
const gfc_array_l4 * mask, char * field)