OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgfortran/] [io/] [unix.h] - Blame information for rev 746

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 733 jeremybenn
/* Copyright (C) 2009, 2010
2
   Free Software Foundation, Inc.
3
   Contributed by Janne Blomqvist
4
 
5
This file is part of the GNU Fortran 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 3, or (at your option)
10
any later version.
11
 
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.
16
 
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.
20
 
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/>.  */
25
 
26
#ifndef GFOR_UNIX_H
27
#define GFOR_UNIX_H
28
 
29
#include "io.h"
30
 
31
 
32
struct stream
33
{
34
  ssize_t (*read) (struct stream *, void *, ssize_t);
35
  ssize_t (*write) (struct stream *, const void *, ssize_t);
36
  gfc_offset (*seek) (struct stream *, gfc_offset, int);
37
  gfc_offset (*tell) (struct stream *);
38
  gfc_offset (*size) (struct stream *);
39
  /* Avoid keyword truncate due to AIX namespace collision.  */
40
  int (*trunc) (struct stream *, gfc_offset);
41
  int (*flush) (struct stream *);
42
  int (*close) (struct stream *);
43
};
44
 
45
 
46
/* Inline functions for doing file I/O given a stream.  */
47
static inline ssize_t
48
sread (stream * s, void * buf, ssize_t nbyte)
49
{
50
  return s->read (s, buf, nbyte);
51
}
52
 
53
static inline ssize_t
54
swrite (stream * s, const void * buf, ssize_t nbyte)
55
{
56
  return s->write (s, buf, nbyte);
57
}
58
 
59
static inline gfc_offset
60
sseek (stream * s, gfc_offset offset, int whence)
61
{
62
  return s->seek (s, offset, whence);
63
}
64
 
65
static inline gfc_offset
66
stell (stream * s)
67
{
68
  return s->tell (s);
69
}
70
 
71
static inline gfc_offset
72
ssize (stream * s)
73
{
74
  return s->size (s);
75
}
76
 
77
static inline int
78
struncate (stream * s, gfc_offset length)
79
{
80
  return s->trunc (s, length);
81
}
82
 
83
static inline int
84
sflush (stream * s)
85
{
86
  return s->flush (s);
87
}
88
 
89
static inline int
90
sclose (stream * s)
91
{
92
  return s->close (s);
93
}
94
 
95
 
96
extern int compare_files (stream *, stream *);
97
internal_proto(compare_files);
98
 
99
extern stream *open_external (st_parameter_open *, unit_flags *);
100
internal_proto(open_external);
101
 
102
extern stream *open_internal (char *, int, gfc_offset);
103
internal_proto(open_internal);
104
 
105
extern stream *open_internal4 (char *, int, gfc_offset);
106
internal_proto(open_internal4);
107
 
108
extern char * mem_alloc_w (stream *, int *);
109
internal_proto(mem_alloc_w);
110
 
111
extern char * mem_alloc_r (stream *, int *);
112
internal_proto(mem_alloc_r);
113
 
114
extern gfc_char4_t * mem_alloc_w4 (stream *, int *);
115
internal_proto(mem_alloc_w4);
116
 
117
extern char * mem_alloc_r4 (stream *, int *);
118
internal_proto(mem_alloc_r4);
119
 
120
extern stream *input_stream (void);
121
internal_proto(input_stream);
122
 
123
extern stream *output_stream (void);
124
internal_proto(output_stream);
125
 
126
extern stream *error_stream (void);
127
internal_proto(error_stream);
128
 
129
extern int compare_file_filename (gfc_unit *, const char *, int);
130
internal_proto(compare_file_filename);
131
 
132
extern gfc_unit *find_file (const char *file, gfc_charlen_type file_len);
133
internal_proto(find_file);
134
 
135
extern int delete_file (gfc_unit *);
136
internal_proto(delete_file);
137
 
138
extern int file_exists (const char *file, gfc_charlen_type file_len);
139
internal_proto(file_exists);
140
 
141
extern GFC_IO_INT file_size (const char *file, gfc_charlen_type file_len);
142
internal_proto(file_size);
143
 
144
extern const char *inquire_sequential (const char *, int);
145
internal_proto(inquire_sequential);
146
 
147
extern const char *inquire_direct (const char *, int);
148
internal_proto(inquire_direct);
149
 
150
extern const char *inquire_formatted (const char *, int);
151
internal_proto(inquire_formatted);
152
 
153
extern const char *inquire_unformatted (const char *, int);
154
internal_proto(inquire_unformatted);
155
 
156
extern const char *inquire_read (const char *, int);
157
internal_proto(inquire_read);
158
 
159
extern const char *inquire_write (const char *, int);
160
internal_proto(inquire_write);
161
 
162
extern const char *inquire_readwrite (const char *, int);
163
internal_proto(inquire_readwrite);
164
 
165
extern void flush_if_preconnected (stream *);
166
internal_proto(flush_if_preconnected);
167
 
168
extern int stream_isatty (stream *);
169
internal_proto(stream_isatty);
170
 
171
#ifndef TTY_NAME_MAX
172
#ifdef _POSIX_TTY_NAME_MAX
173
#define TTY_NAME_MAX _POSIX_TTY_NAME_MAX
174
#else
175
/* sysconf(_SC_TTY_NAME_MAX) = 32 which should be enough.  */
176
#define TTY_NAME_MAX 32
177
#endif
178
#endif
179
 
180
extern int stream_ttyname (stream *, char *, size_t);
181
internal_proto(stream_ttyname);
182
 
183
extern int unpack_filename (char *, const char *, int);
184
internal_proto(unpack_filename);
185
 
186
 
187
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.