2 Free Software Foundation, Inc.
3 Contributed by Janne Blomqvist
5 This file is part of the GNU Fortran runtime library (libgfortran).
7 Libgfortran is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
12 Libgfortran is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 Under Section 7 of GPL version 3, you are granted additional
18 permissions described in the GCC Runtime Library Exception, version
19 3.1, as published by the Free Software Foundation.
21 You should have received a copy of the GNU General Public License and
22 a copy of the GCC Runtime Library Exception along with this program;
23 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24 <http://www.gnu.org/licenses/>. */
33 ssize_t (*read) (struct stream *, void *, ssize_t);
34 ssize_t (*write) (struct stream *, const void *, ssize_t);
35 off_t (*seek) (struct stream *, off_t, int);
36 off_t (*tell) (struct stream *);
37 /* Avoid keyword truncate due to AIX namespace collision. */
38 int (*trunc) (struct stream *, off_t);
39 int (*flush) (struct stream *);
40 int (*close) (struct stream *);
43 /* Inline functions for doing file I/O given a stream. */
45 sread (stream * s, void * buf, ssize_t nbyte)
47 return s->read (s, buf, nbyte);
51 swrite (stream * s, const void * buf, ssize_t nbyte)
53 return s->write (s, buf, nbyte);
57 sseek (stream * s, off_t offset, int whence)
59 return s->seek (s, offset, whence);
69 struncate (stream * s, off_t length)
71 return s->trunc (s, length);
87 extern int compare_files (stream *, stream *);
88 internal_proto(compare_files);
90 extern stream *open_external (st_parameter_open *, unit_flags *);
91 internal_proto(open_external);
93 extern stream *open_internal (char *, int, gfc_offset);
94 internal_proto(open_internal);
96 extern char * mem_alloc_w (stream *, int *);
97 internal_proto(mem_alloc_w);
99 extern char * mem_alloc_r (stream *, int *);
100 internal_proto(mem_alloc_w);
102 extern stream *input_stream (void);
103 internal_proto(input_stream);
105 extern stream *output_stream (void);
106 internal_proto(output_stream);
108 extern stream *error_stream (void);
109 internal_proto(error_stream);
111 extern int compare_file_filename (gfc_unit *, const char *, int);
112 internal_proto(compare_file_filename);
114 extern gfc_unit *find_file (const char *file, gfc_charlen_type file_len);
115 internal_proto(find_file);
117 extern int delete_file (gfc_unit *);
118 internal_proto(delete_file);
120 extern int file_exists (const char *file, gfc_charlen_type file_len);
121 internal_proto(file_exists);
123 extern const char *inquire_sequential (const char *, int);
124 internal_proto(inquire_sequential);
126 extern const char *inquire_direct (const char *, int);
127 internal_proto(inquire_direct);
129 extern const char *inquire_formatted (const char *, int);
130 internal_proto(inquire_formatted);
132 extern const char *inquire_unformatted (const char *, int);
133 internal_proto(inquire_unformatted);
135 extern const char *inquire_read (const char *, int);
136 internal_proto(inquire_read);
138 extern const char *inquire_write (const char *, int);
139 internal_proto(inquire_write);
141 extern const char *inquire_readwrite (const char *, int);
142 internal_proto(inquire_readwrite);
144 extern gfc_offset file_length (stream *);
145 internal_proto(file_length);
147 extern int is_seekable (stream *);
148 internal_proto(is_seekable);
150 extern int is_special (stream *);
151 internal_proto(is_special);
153 extern void flush_if_preconnected (stream *);
154 internal_proto(flush_if_preconnected);
156 extern void empty_internal_buffer(stream *);
157 internal_proto(empty_internal_buffer);
159 extern int stream_isatty (stream *);
160 internal_proto(stream_isatty);
162 extern char * stream_ttyname (stream *);
163 internal_proto(stream_ttyname);
165 extern int unpack_filename (char *, const char *, int);
166 internal_proto(unpack_filename);