aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/iresolve.c
diff options
context:
space:
mode:
authorFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>2005-08-09 17:33:17 +0000
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>2005-08-09 17:33:17 +0000
commitae8b87895f3ae2557674aad472f58efc2274440b (patch)
treec536f14d5c459cba9c9c7a629d3857e4fb6248ec /gcc/fortran/iresolve.c
parent0ed414a4f6aa5a2d5fb5e2b6b3e508333cea047e (diff)
downloadgcc-ae8b87895f3ae2557674aad472f58efc2274440b.zip
gcc-ae8b87895f3ae2557674aad472f58efc2274440b.tar.gz
gcc-ae8b87895f3ae2557674aad472f58efc2274440b.tar.bz2
check.c (gfc_check_ttynam_sub, [...]): Add check functions for new intrinsics TTYNAM and ISATTY.
* check.c (gfc_check_ttynam_sub, gfc_check_isatty): Add check functions for new intrinsics TTYNAM and ISATTY. * intrinsic.c (add_functions, add_subroutines): Add new intrinsics. * intrinsic.h: Add prototypes for new check and resolve functions. * iresolve.c (gfc_resolve_isatty, gfc_resolve_ttynam_sub): New resolve functions for intrinsics TTYNAM and ISATTY. * gfortran.h (gfc_generic_isym_id): Add symbol for ISATTY. * trans-intrinsic.c: Add case for GFC_ISYM_ISATTY. * Makefile.am: Add file intrinsics/tty.c to Makefile process. * Makefile.in: Regenerate. * io/io.h: Prototypes for new functions stream_isatty and stream_ttyname. * io/unix (stream_isatty, stream_ttyname): New functions to call isatty() and ttyname() on a given unit. * intrinsics/tty.c: New file to implement g77 intrinsics TTYNAM and ISATTY. From-SVN: r102915
Diffstat (limited to 'gcc/fortran/iresolve.c')
-rw-r--r--gcc/fortran/iresolve.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c
index 1b14515..a6f7f27 100644
--- a/gcc/fortran/iresolve.c
+++ b/gcc/fortran/iresolve.c
@@ -712,6 +712,26 @@ gfc_resolve_int (gfc_expr * f, gfc_expr * a, gfc_expr * kind)
void
+gfc_resolve_isatty (gfc_expr * f, gfc_expr * u)
+{
+ gfc_typespec ts;
+
+ f->ts.type = BT_LOGICAL;
+ f->ts.kind = gfc_default_integer_kind;
+ if (u->ts.kind != gfc_c_int_kind)
+ {
+ ts.type = BT_INTEGER;
+ ts.kind = gfc_c_int_kind;
+ ts.derived = NULL;
+ ts.cl = NULL;
+ gfc_convert_type (u, &ts, 2);
+ }
+
+ f->value.function.name = gfc_get_string (PREFIX("isatty_l%d"), f->ts.kind);
+}
+
+
+void
gfc_resolve_ishft (gfc_expr * f, gfc_expr * i, gfc_expr * shift)
{
f->ts = i->ts;
@@ -1939,6 +1959,25 @@ gfc_resolve_fstat_sub (gfc_code * c)
c->resolved_sym = gfc_get_intrinsic_sub_symbol (name);
}
+
+void
+gfc_resolve_ttynam_sub (gfc_code * c)
+{
+ gfc_typespec ts;
+
+ if (c->ext.actual->expr->ts.kind != gfc_c_int_kind)
+ {
+ ts.type = BT_INTEGER;
+ ts.kind = gfc_c_int_kind;
+ ts.derived = NULL;
+ ts.cl = NULL;
+ gfc_convert_type (c->ext.actual->expr, &ts, 2);
+ }
+
+ c->resolved_sym = gfc_get_intrinsic_sub_symbol (PREFIX("ttynam_sub"));
+}
+
+
/* Resolve the UMASK intrinsic subroutine. */
void