diff options
author | Steven G. Kargl <kargls@comcast.net> | 2004-12-02 04:10:26 +0000 |
---|---|---|
committer | Paul Brook <pbrook@gcc.gnu.org> | 2004-12-02 04:10:26 +0000 |
commit | df65f0938c4b76b388958c04666e0efd279ba333 (patch) | |
tree | c20ca282f2b337834e069d56d9239c0253de5b3e /gcc/fortran/check.c | |
parent | 8930ce20d027c54f5019ab3b0171222bf85e357c (diff) | |
download | gcc-df65f0938c4b76b388958c04666e0efd279ba333.zip gcc-df65f0938c4b76b388958c04666e0efd279ba333.tar.gz gcc-df65f0938c4b76b388958c04666e0efd279ba333.tar.bz2 |
flush.c: New file.
2004-12-02 Steven G. Kargl <kargls@comcast.net>
Paul Brook <paul@codesourcery.com>
libgfortran/
* intrinsics/flush.c: New file.
* intrinsics/fnum.c: ditto
* intrinsics/stat.c: ditto
* io/io.h (unit_to_fd): Add prototype.
* io/unix.c (unit_to_fd): New function.
* configure.ac: Add test for members of struct stat. Check for
sys/types.h and sys/stat.h
* Makefile.am: Add intrinsics/{flush.c,fnum.c,stat.c}
* configure.in: Regenerate.
* config.h.in: Regenerate.
* Makefile.in: Regenerate.
fortran/
* check.c (gfc_check_flush, gfc_check_fnum): New functions.
(gfc_check_fstat, gfc_check_fstat_sub): New functions.
(gfc_check_stat, gfc_check_stat_sub): New functions.
* gfortran.h (GFC_ISYM_FNUM,GFC_ISYM_FSTAT,GFC_ISYM_STAT): New symbols
* intrinsic.c (add_functions,add_subroutines): Add flush, fnum,
fstat, and stat to intrinsics symbol tables.
* intrinsic.h (gfc_check_flush, gfc_resolve_stat_sub): Add prototypes.
(gfc_resolve_fstat_sub, gfc_resolve_stat): Ditto.
* iresolve.c (gfc_resolve_fnum, gfc_resolve_fstat): New functions.
(gfc_resolve_stat, gfc_resolve_flush): New functions.
(gfc_resolve_stat_sub,gfc_resolve_fstat_sub): New functions
* trans-intrinsic.c (gfc_conv_intrinsic_function): Add new intrinsics.
Co-Authored-By: Paul Brook <paul@codesourcery.com>
From-SVN: r91609
Diffstat (limited to 'gcc/fortran/check.c')
-rw-r--r-- | gcc/fortran/check.c | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c index 3920864..0b4f92e6 100644 --- a/gcc/fortran/check.c +++ b/gcc/fortran/check.c @@ -750,6 +750,20 @@ gfc_check_eoshift (gfc_expr * array, gfc_expr * shift, gfc_expr * boundary, } +try +gfc_check_fnum (gfc_expr * unit) +{ + + if (type_check (unit, 0, BT_INTEGER) == FAILURE) + return FAILURE; + + if (scalar_check (unit, 0) == FAILURE) + return FAILURE; + + return SUCCESS; +} + + /* This is used for the g77 one-argument Bessel functions, and the error function. */ @@ -1623,6 +1637,7 @@ gfc_check_spread (gfc_expr * source, gfc_expr * dim, gfc_expr * ncopies) if (type_check (ncopies, 2, BT_INTEGER) == FAILURE) return FAILURE; + if (scalar_check (ncopies, 2) == FAILURE) return FAILURE; @@ -1631,6 +1646,104 @@ gfc_check_spread (gfc_expr * source, gfc_expr * dim, gfc_expr * ncopies) try +gfc_check_fstat (gfc_expr * unit, gfc_expr * array) +{ + + if (type_check (unit, 0, BT_INTEGER) == FAILURE) + return FAILURE; + + if (scalar_check (unit, 0) == FAILURE) + return FAILURE; + + if (type_check (array, 1, BT_INTEGER) == FAILURE + || kind_value_check (unit, 0, gfc_default_integer_kind) == FAILURE) + return FAILURE; + + if (array_check (array, 1) == FAILURE) + return FAILURE; + + return SUCCESS; +} + + +try +gfc_check_fstat_sub (gfc_expr * unit, gfc_expr * array, gfc_expr * status) +{ + + if (type_check (unit, 0, BT_INTEGER) == FAILURE) + return FAILURE; + + if (scalar_check (unit, 0) == FAILURE) + return FAILURE; + + if (type_check (array, 1, BT_INTEGER) == FAILURE + || kind_value_check (array, 1, gfc_default_integer_kind) == FAILURE) + return FAILURE; + + if (array_check (array, 1) == FAILURE) + return FAILURE; + + if (status == NULL) + return SUCCESS; + + if (type_check (status, 2, BT_INTEGER) == FAILURE + || kind_value_check (status, 2, gfc_default_integer_kind) == FAILURE) + return FAILURE; + + if (scalar_check (status, 2) == FAILURE) + return FAILURE; + + return SUCCESS; +} + + +try +gfc_check_stat (gfc_expr * name, gfc_expr * array) +{ + + if (type_check (name, 0, BT_CHARACTER) == FAILURE) + return FAILURE; + + if (type_check (array, 1, BT_INTEGER) == FAILURE + || kind_value_check (array, 1, gfc_default_integer_kind) == FAILURE) + return FAILURE; + + if (array_check (array, 1) == FAILURE) + return FAILURE; + + return SUCCESS; +} + + +try +gfc_check_stat_sub (gfc_expr * name, gfc_expr * array, gfc_expr * status) +{ + + if (type_check (name, 0, BT_CHARACTER) == FAILURE) + return FAILURE; + + if (type_check (array, 1, BT_INTEGER) == FAILURE + || kind_value_check (array, 1, gfc_default_integer_kind) == FAILURE) + return FAILURE; + + if (array_check (array, 1) == FAILURE) + return FAILURE; + + if (status == NULL) + return SUCCESS; + + if (type_check (status, 2, BT_INTEGER) == FAILURE + || kind_value_check (array, 1, gfc_default_integer_kind) == FAILURE) + return FAILURE; + + if (scalar_check (status, 2) == FAILURE) + return FAILURE; + + return SUCCESS; +} + + +try gfc_check_transfer (gfc_expr * source ATTRIBUTE_UNUSED, gfc_expr * mold ATTRIBUTE_UNUSED, gfc_expr * size) @@ -2139,6 +2252,23 @@ gfc_check_exit (gfc_expr * status) try +gfc_check_flush (gfc_expr * unit) +{ + + if (unit == NULL) + return SUCCESS; + + if (type_check (unit, 0, BT_INTEGER) == FAILURE) + return FAILURE; + + if (scalar_check (unit, 0) == FAILURE) + return FAILURE; + + return SUCCESS; +} + + +try gfc_check_umask (gfc_expr * mask) { |