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.
From-SVN: r91611
2004-12-02 05:20:09 +01:00
|
|
|
/* Implementation of the FLUSH intrinsic.
|
|
|
|
Copyright (C) 2004 Free Software Foundation, Inc.
|
|
|
|
Contributed by Steven G. Kargl <kargls@comcast.net>.
|
|
|
|
|
|
|
|
This file is part of the GNU Fortran 95 runtime library (libgfortran).
|
|
|
|
|
|
|
|
Libgfortran is free software; you can redistribute it and/or
|
2005-01-12 22:27:33 +01:00
|
|
|
modify it under the terms of the GNU General Public
|
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.
From-SVN: r91611
2004-12-02 05:20:09 +01:00
|
|
|
License as published by the Free Software Foundation; either
|
2005-01-12 22:27:33 +01:00
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
In addition to the permissions in the GNU General Public License, the
|
|
|
|
Free Software Foundation gives you unlimited permission to link the
|
|
|
|
compiled version of this file into combinations with other programs,
|
|
|
|
and to distribute those combinations without any restriction coming
|
|
|
|
from the use of this file. (The General Public License restrictions
|
|
|
|
do apply in other respects; for example, they cover modification of
|
|
|
|
the file, and distribution when not linked into a combine
|
|
|
|
executable.)
|
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.
From-SVN: r91611
2004-12-02 05:20:09 +01:00
|
|
|
|
|
|
|
Libgfortran is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2005-01-12 22:27:33 +01:00
|
|
|
GNU General Public License for more details.
|
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.
From-SVN: r91611
2004-12-02 05:20:09 +01:00
|
|
|
|
2005-01-12 22:27:33 +01:00
|
|
|
You should have received a copy of the GNU General Public
|
|
|
|
License along with libgfortran; see the file COPYING. If not,
|
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.
From-SVN: r91611
2004-12-02 05:20:09 +01:00
|
|
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
Boston, MA 02111-1307, USA. */
|
|
|
|
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "libgfortran.h"
|
|
|
|
|
|
|
|
#ifdef HAVE_STDLIB_H
|
|
|
|
#include <stdlib.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "../io/io.h"
|
|
|
|
|
|
|
|
/* SUBROUTINE FLUSH(UNIT)
|
|
|
|
INTEGER, INTENT(IN), OPTIONAL :: UNIT */
|
|
|
|
|
|
|
|
static void
|
|
|
|
recursive_flush (gfc_unit *us)
|
|
|
|
{
|
|
|
|
/* There can be no open files. */
|
|
|
|
if (us == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
flush (us->s);
|
|
|
|
recursive_flush (us->left);
|
|
|
|
recursive_flush (us->right);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
2004-12-12 09:59:05 +01:00
|
|
|
extern void flush_i4 (GFC_INTEGER_4 *);
|
|
|
|
export_proto(flush_i4);
|
|
|
|
|
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.
From-SVN: r91611
2004-12-02 05:20:09 +01:00
|
|
|
void
|
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
2004-12-12 09:59:05 +01:00
|
|
|
flush_i4 (GFC_INTEGER_4 *unit)
|
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.
From-SVN: r91611
2004-12-02 05:20:09 +01:00
|
|
|
{
|
|
|
|
gfc_unit *us;
|
|
|
|
|
|
|
|
/* flush all streams */
|
|
|
|
if (unit == NULL)
|
|
|
|
{
|
|
|
|
us = g.unit_root;
|
|
|
|
recursive_flush(us);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
us = find_unit(*unit);
|
|
|
|
if (us != NULL)
|
|
|
|
flush (us->s);
|
|
|
|
}
|
|
|
|
}
|