1 |
14 |
jlechner |
/* Copyright (C) 2002, 2003, 2004, 2005
|
2 |
|
|
Free Software Foundation, Inc.
|
3 |
|
|
Contributed by Andy Vaught
|
4 |
|
|
|
5 |
|
|
This file is part of the GNU Fortran 95 runtime library (libgfortran).
|
6 |
|
|
|
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 2, or (at your option)
|
10 |
|
|
any later version.
|
11 |
|
|
|
12 |
|
|
In addition to the permissions in the GNU General Public License, the
|
13 |
|
|
Free Software Foundation gives you unlimited permission to link the
|
14 |
|
|
compiled version of this file into combinations with other programs,
|
15 |
|
|
and to distribute those combinations without any restriction coming
|
16 |
|
|
from the use of this file. (The General Public License restrictions
|
17 |
|
|
do apply in other respects; for example, they cover modification of
|
18 |
|
|
the file, and distribution when not linked into a combine
|
19 |
|
|
executable.)
|
20 |
|
|
|
21 |
|
|
Libgfortran is distributed in the hope that it will be useful,
|
22 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
23 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
24 |
|
|
GNU General Public License for more details.
|
25 |
|
|
|
26 |
|
|
You should have received a copy of the GNU General Public License
|
27 |
|
|
along with Libgfortran; see the file COPYING. If not, write to
|
28 |
|
|
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
29 |
|
|
Boston, MA 02110-1301, USA. */
|
30 |
|
|
|
31 |
|
|
/* Unix stream I/O module */
|
32 |
|
|
|
33 |
|
|
#define BUFFER_SIZE 8192
|
34 |
|
|
|
35 |
|
|
typedef struct
|
36 |
|
|
{
|
37 |
|
|
stream st;
|
38 |
|
|
|
39 |
|
|
int fd;
|
40 |
|
|
gfc_offset buffer_offset; /* File offset of the start of the buffer */
|
41 |
|
|
gfc_offset physical_offset; /* Current physical file offset */
|
42 |
|
|
gfc_offset logical_offset; /* Current logical file offset */
|
43 |
|
|
gfc_offset dirty_offset; /* Start of modified bytes in buffer */
|
44 |
|
|
gfc_offset file_length; /* Length of the file, -1 if not seekable. */
|
45 |
|
|
|
46 |
|
|
char *buffer;
|
47 |
|
|
int len; /* Physical length of the current buffer */
|
48 |
|
|
int active; /* Length of valid bytes in the buffer */
|
49 |
|
|
|
50 |
|
|
int prot;
|
51 |
|
|
int ndirty; /* Dirty bytes starting at dirty_offset */
|
52 |
|
|
|
53 |
|
|
int special_file; /* =1 if the fd refers to a special file */
|
54 |
|
|
|
55 |
|
|
unsigned unbuffered:1;
|
56 |
|
|
|
57 |
|
|
char small_buffer[BUFFER_SIZE];
|
58 |
|
|
|
59 |
|
|
}
|
60 |
|
|
unix_stream;
|
61 |
|
|
|
62 |
|
|
extern stream *init_error_stream (unix_stream *);
|
63 |
|
|
internal_proto(init_error_stream);
|