]> rtime.felk.cvut.cz Git - l4.git/blobdiff - l4/pkg/libgfortran/lib/contrib/io/unix.h
Update
[l4.git] / l4 / pkg / libgfortran / lib / contrib / io / unix.h
index 52f3e0c811120b18fda3340f055b303f83dc24cc..78a41f79f4b2884b46500e1056d973755c976ca0 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (C) 2009, 2010
-   Free Software Foundation, Inc.
+/* Copyright (C) 2009-2015 Free Software Foundation, Inc.
    Contributed by Janne Blomqvist
 
 This file is part of the GNU Fortran runtime library (libgfortran).
@@ -28,68 +27,78 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
 #include "io.h"
 
-
-struct stream
+struct stream_vtable
 {
-  ssize_t (*read) (struct stream *, void *, ssize_t);
-  ssize_t (*write) (struct stream *, const void *, ssize_t);
-  gfc_offset (*seek) (struct stream *, gfc_offset, int);
-  gfc_offset (*tell) (struct stream *);
-  gfc_offset (*size) (struct stream *);
+  ssize_t (* const read) (struct stream *, void *, ssize_t);
+  ssize_t (* const write) (struct stream *, const void *, ssize_t);
+  gfc_offset (* const seek) (struct stream *, gfc_offset, int);
+  gfc_offset (* const tell) (struct stream *);
+  gfc_offset (* const size) (struct stream *);
   /* Avoid keyword truncate due to AIX namespace collision.  */
-  int (*trunc) (struct stream *, gfc_offset);
-  int (*flush) (struct stream *);
-  int (*close) (struct stream *);
+  int (* const trunc) (struct stream *, gfc_offset);
+  int (* const flush) (struct stream *);
+  int (* const close) (struct stream *);
+  int (* const markeor) (struct stream *);
 };
 
+struct stream
+{
+  const struct stream_vtable *vptr;
+};
 
 /* Inline functions for doing file I/O given a stream.  */
 static inline ssize_t
 sread (stream * s, void * buf, ssize_t nbyte)
 {
-  return s->read (s, buf, nbyte);
+  return s->vptr->read (s, buf, nbyte);
 }
 
 static inline ssize_t
 swrite (stream * s, const void * buf, ssize_t nbyte)
 {
-  return s->write (s, buf, nbyte);
+  return s->vptr->write (s, buf, nbyte);
 }
 
 static inline gfc_offset
 sseek (stream * s, gfc_offset offset, int whence)
 {
-  return s->seek (s, offset, whence);
+  return s->vptr->seek (s, offset, whence);
 }
 
 static inline gfc_offset
 stell (stream * s)
 {
-  return s->tell (s);
+  return s->vptr->tell (s);
 }
 
 static inline gfc_offset
 ssize (stream * s)
 {
-  return s->size (s);
+  return s->vptr->size (s);
 }
 
 static inline int
 struncate (stream * s, gfc_offset length)
 {
-  return s->trunc (s, length);
+  return s->vptr->trunc (s, length);
 }
 
 static inline int
 sflush (stream * s)
 {
-  return s->flush (s);
+  return s->vptr->flush (s);
 }
 
 static inline int
 sclose (stream * s)
 {
-  return s->close (s);
+  return s->vptr->close (s);
+}
+
+static inline int
+smarkeor (stream * s)
+{
+  return s->vptr->markeor (s);
 }
 
 
@@ -180,8 +189,4 @@ internal_proto(stream_isatty);
 extern int stream_ttyname (stream *, char *, size_t);
 internal_proto(stream_ttyname);
 
-extern int unpack_filename (char *, const char *, int);
-internal_proto(unpack_filename);
-
-
 #endif