aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/intrinsic.c
diff options
context:
space:
mode:
authorSteven G. Kargl <kargls@comcast.net>2004-06-12 17:34:47 +0000
committerPaul Brook <pbrook@gcc.gnu.org>2004-06-12 17:34:47 +0000
commit2bd749490845f2edc7de74dca4b29fd7d7698dff (patch)
treea1452828cb51b5aff27e540fe28a2545fc15adb8 /gcc/fortran/intrinsic.c
parentb08eae928826bd8474cd30a33949af242dfc400c (diff)
downloadgcc-2bd749490845f2edc7de74dca4b29fd7d7698dff.zip
gcc-2bd749490845f2edc7de74dca4b29fd7d7698dff.tar.gz
gcc-2bd749490845f2edc7de74dca4b29fd7d7698dff.tar.bz2
check.c (gfc_check_second_sub, [...]): New functions.
* check.c (gfc_check_second_sub, gfc_check_irand, gfc_check_rand gfc_check_srand, gfc_check_etime, gfc_check_etime_sub): New functions. * gfortran.h (gfc_generic_isym_id): New symbols GFC_ISYM_ETIME, GFC_ISYM_IRAND, GFC_ISYM_RAND, GFC_ISYM_SECOND. * trans-intrinsic.c: Use symbols. * intrinsic.c (add_sym_2s): New function. * intrinsic.c: Add etime, dtime, irand, rand, second, srand. * intrinsic.h: Function prototypes. * iresolve.c (gfc_resolve_etime_sub, gfc_resolve_second_sub gfc_resolve_srand): New functions. libgfortran * Makefile.am: Add rand.c and etime.c * Makefile.in: Regenerated. * aclocal.in: Regenerated. * cpu_time.c (second_sub, second): New functions. * rand.c (irand, rand, srand): New file. * etime.c (etime_sub, etime): New file. From-SVN: r83034
Diffstat (limited to 'gcc/fortran/intrinsic.c')
-rw-r--r--gcc/fortran/intrinsic.c76
1 files changed, 76 insertions, 0 deletions
diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c
index 95e208f..7247d89 100644
--- a/gcc/fortran/intrinsic.c
+++ b/gcc/fortran/intrinsic.c
@@ -429,6 +429,32 @@ static void add_sym_2 (const char *name, int elemental, int actual_ok, bt type,
}
+/* Add the name of an intrinsic subroutine with two arguments to the list
+ of intrinsic names. */
+
+static void add_sym_2s (const char *name, int elemental, int actual_ok, bt type,
+ int kind,
+ try (*check)(gfc_expr *,gfc_expr *,gfc_expr *),
+ gfc_expr *(*simplify)(gfc_expr *,gfc_expr *,gfc_expr *),
+ void (*resolve)(gfc_code *),
+ const char* a1, bt type1, int kind1, int optional1,
+ const char* a2, bt type2, int kind2, int optional2
+ ) {
+ gfc_check_f cf;
+ gfc_simplify_f sf;
+ gfc_resolve_f rf;
+
+ cf.f3 = check;
+ sf.f3 = simplify;
+ rf.s1 = resolve;
+
+ add_sym (name, elemental, actual_ok, type, kind, cf, sf, rf,
+ a1, type1, kind1, optional1,
+ a2, type2, kind2, optional2,
+ (void*)0);
+}
+
+
static void add_sym_3 (const char *name, int elemental, int actual_ok, bt type,
int kind,
try (*check)(gfc_expr *,gfc_expr *,gfc_expr *),
@@ -989,6 +1015,16 @@ add_functions (void)
make_generic ("epsilon", GFC_ISYM_NONE);
+ /* G77 compatibility */
+ add_sym_1 ("etime", 0, 1, BT_REAL, 4,
+ gfc_check_etime, NULL, NULL,
+ x, BT_REAL, 4, 0);
+
+ make_alias ("dtime");
+
+ make_generic ("etime", GFC_ISYM_ETIME);
+
+
add_sym_1 ("exp", 1, 1, BT_REAL, dr,
NULL, gfc_simplify_exp, gfc_resolve_exp, x, BT_REAL, dr, 0);
@@ -1098,6 +1134,13 @@ add_functions (void)
make_generic ("ior", GFC_ISYM_IOR);
+ /* The following function is for G77 compatibility. */
+ add_sym_1 ("irand", 0, 1, BT_INTEGER, 4,
+ gfc_check_irand, NULL, NULL,
+ i, BT_INTEGER, 4, 0);
+
+ make_generic ("irand", GFC_ISYM_IRAND);
+
add_sym_2 ("ishft", 1, 1, BT_INTEGER, di,
gfc_check_ishft, gfc_simplify_ishft, gfc_resolve_ishft,
i, BT_INTEGER, di, 0, sh, BT_INTEGER, di, 0);
@@ -1386,6 +1429,13 @@ add_functions (void)
make_generic ("radix", GFC_ISYM_NONE);
+ /* The following function is for G77 compatibility. */
+ add_sym_1 ("rand", 0, 1, BT_REAL, 4,
+ gfc_check_rand, NULL, NULL,
+ i, BT_INTEGER, 4, 0);
+
+ make_generic ("rand", GFC_ISYM_RAND);
+
add_sym_1 ("range", 0, 1, BT_INTEGER, di,
gfc_check_range, gfc_simplify_range, NULL,
x, BT_REAL, dr, 0);
@@ -1436,6 +1486,11 @@ add_functions (void)
make_generic ("scan", GFC_ISYM_SCAN);
+ /* Added for G77 compatibility garbage. */
+ add_sym_0 ("second", 0, 1, BT_REAL, 4, NULL, NULL, NULL);
+
+ make_generic ("second", GFC_ISYM_SECOND);
+
add_sym_1 ("selected_int_kind", 0, 1, BT_INTEGER, di,
NULL, gfc_simplify_selected_int_kind, NULL,
r, BT_INTEGER, di, 0);
@@ -1606,6 +1661,8 @@ add_functions (void)
bck, BT_LOGICAL, dl, 1);
make_generic ("verify", GFC_ISYM_VERIFY);
+
+
}
@@ -1634,11 +1691,25 @@ add_subroutines (void)
gfc_check_cpu_time, NULL, gfc_resolve_cpu_time,
tm, BT_REAL, dr, 0);
+ /* More G77 compatibility garbage. */
+ add_sym_1s ("second", 0, 1, BT_UNKNOWN, 0,
+ gfc_check_second_sub, NULL, gfc_resolve_second_sub,
+ tm, BT_REAL, dr, 0);
+
add_sym_4 ("date_and_time", 0, 1, BT_UNKNOWN, 0,
gfc_check_date_and_time, NULL, NULL,
dt, BT_CHARACTER, dc, 1, tm, BT_CHARACTER, dc, 1,
zn, BT_CHARACTER, dc, 1, vl, BT_INTEGER, di, 1);
+ /* More G77 compatibility garbage. */
+ add_sym_2s ("etime", 0, 1, BT_UNKNOWN, 0,
+ gfc_check_etime_sub, NULL, gfc_resolve_etime_sub,
+ vl, BT_REAL, 4, 0, tm, BT_REAL, 4, 0);
+
+ add_sym_2s ("dtime", 0, 1, BT_UNKNOWN, 0,
+ gfc_check_etime_sub, NULL, gfc_resolve_etime_sub,
+ vl, BT_REAL, 4, 0, tm, BT_REAL, 4, 0);
+
add_sym_2 ("getarg", 0, 1, BT_UNKNOWN, 0,
NULL, NULL, NULL,
c, BT_INTEGER, di, 0, vl, BT_CHARACTER, dc, 0);
@@ -1659,6 +1730,11 @@ add_subroutines (void)
sz, BT_INTEGER, di, 1, pt, BT_INTEGER, di, 1,
gt, BT_INTEGER, di, 1);
+ /* More G77 compatibility garbage. */
+ add_sym_1s ("srand", 0, 1, BT_UNKNOWN, di,
+ gfc_check_srand, NULL, gfc_resolve_srand,
+ c, BT_INTEGER, 4, 0);
+
add_sym_3s ("system_clock", 0, 1, BT_UNKNOWN, 0,
gfc_check_system_clock, NULL, gfc_resolve_system_clock,
c, BT_INTEGER, di, 1, cr, BT_INTEGER, di, 1,