summaryrefslogtreecommitdiffstats
path: root/libio
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>1998-02-01 12:29:15 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>1998-02-01 12:29:15 +0000
commit660426353bcfabbe622e49d5fdd04e79272c3d55 (patch)
tree7f82432d8e5d72c64bd5ab979676321ca1746dc6 /libio
parent4dd476d49b5d9edeb46c8ba15b0969ed032bf1da (diff)
downloadppe42-gcc-660426353bcfabbe622e49d5fdd04e79272c3d55.tar.gz
ppe42-gcc-660426353bcfabbe622e49d5fdd04e79272c3d55.zip
* filebuf.cc (filebuf::open): Call _IO_file_open if
_G_HAVE_IO_FILE_OPEN is 1. * libio.h (_IO_fpos64_t, _IO_off64_t): Defined if _G_IO_IO_FILE_VERSION == 0x20001. * libioP.h (_IO_file_open): New declaration. * libio.h (_IO_FILE, _IO_stdin_, _IO_stdout_, _IO_stderr_, _IO_seekoff, _IO_seekpos): Add support for libio in egcs 2.1. * libioP.h (_IO_seekoff_t, _IO_seekpos_t, _IO_seek_t, _IO_seekoff, _IO_seekpos, _IO_default_seekoff, _IO_default_seekpos, _IO_default_seek, _IO_file_seekoff, _IO_file_seek, _IO_str_seekoff, _IO_pos_BAD, _IO_pos_as_off, _IO_pos_0): Ditto. * streambuf.h (streamoff, streampos): Ditto. * gen-params (__extension__): Use only if gcc version >= 2.8. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@17580 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libio')
-rw-r--r--libio/ChangeLog21
-rw-r--r--libio/filebuf.cc5
-rwxr-xr-xlibio/gen-params2
-rw-r--r--libio/libio.h23
-rw-r--r--libio/libioP.h60
-rw-r--r--libio/streambuf.h5
6 files changed, 112 insertions, 4 deletions
diff --git a/libio/ChangeLog b/libio/ChangeLog
index 107c09a753f..7fd5bebcb3f 100644
--- a/libio/ChangeLog
+++ b/libio/ChangeLog
@@ -1,3 +1,24 @@
+Sun Feb 1 13:29:47 1998 H.J. Lu (hjl@gnu.org)
+
+ * filebuf.cc (filebuf::open): Call _IO_file_open if
+ _G_HAVE_IO_FILE_OPEN is 1.
+
+ * libio.h (_IO_fpos64_t, _IO_off64_t): Defined if
+ _G_IO_IO_FILE_VERSION == 0x20001.
+
+ * libioP.h (_IO_file_open): New declaration.
+
+ * libio.h (_IO_FILE, _IO_stdin_, _IO_stdout_, _IO_stderr_,
+ _IO_seekoff, _IO_seekpos): Add support for libio in egcs 2.1.
+ * libioP.h (_IO_seekoff_t, _IO_seekpos_t, _IO_seek_t,
+ _IO_seekoff, _IO_seekpos, _IO_default_seekoff,
+ _IO_default_seekpos, _IO_default_seek, _IO_file_seekoff,
+ _IO_file_seek, _IO_str_seekoff, _IO_pos_BAD, _IO_pos_as_off,
+ _IO_pos_0): Ditto.
+ * streambuf.h (streamoff, streampos): Ditto.
+
+ * gen-params (__extension__): Use only if gcc version >= 2.8.
+
Sun Feb 1 13:08:18 1998 Krister Walfridsson (cato@df.lth.se)
* dbz/dbz.c (putconf): Handle systems which use "long long" as type
diff --git a/libio/filebuf.cc b/libio/filebuf.cc
index 1e2682fbce9..0cc67493a48 100644
--- a/libio/filebuf.cc
+++ b/libio/filebuf.cc
@@ -111,6 +111,10 @@ filebuf* filebuf::open(const char *filename, ios::openmode mode, int prot)
posix_mode |= O_CREAT;
if (mode & (int)ios::noreplace)
posix_mode |= O_EXCL;
+#if _G_HAVE_IO_FILE_OPEN
+ return (filebuf*)_IO_file_open (this, filename, posix_mode, prot,
+ read_write, 0);
+#else
int fd = ::open(filename, posix_mode, prot);
if (fd < 0)
return NULL;
@@ -122,6 +126,7 @@ filebuf* filebuf::open(const char *filename, ios::openmode mode, int prot)
}
_IO_link_in(this);
return this;
+#endif
}
filebuf* filebuf::open(const char *filename, const char *mode)
diff --git a/libio/gen-params b/libio/gen-params
index f23dfbf4532..bd652b68da5 100755
--- a/libio/gen-params
+++ b/libio/gen-params
@@ -382,8 +382,10 @@ typedef int ${macro_prefix}int32_t __attribute__((__mode__(__SI__)));
typedef unsigned int ${macro_prefix}uint32_t __attribute__((__mode__(__SI__)));
typedef int ${macro_prefix}int64_t __attribute__((__mode__(__DI__)));
typedef unsigned int ${macro_prefix}uint64_t __attribute__((__mode__(__DI__)));
+#if __GNUC__ > 2 || __GNUC_MINOR__ >= 8
__extension__ typedef long long ${macro_prefix}llong;
__extension__ typedef unsigned long long ${macro_prefix}ullong;
+#endif
#else
typedef $int16_t ${macro_prefix}int16_t;
typedef $uint16_t ${macro_prefix}uint16_t;
diff --git a/libio/libio.h b/libio/libio.h
index da972859d7e..6e3edcc3041 100644
--- a/libio/libio.h
+++ b/libio/libio.h
@@ -39,6 +39,10 @@
#define _IO_HAVE_ST_BLKSIZE _G_HAVE_ST_BLKSIZE
#define _IO_BUFSIZ _G_BUFSIZ
#define _IO_va_list _G_va_list
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+#define _IO_fpos64_t _G_fpos64_t
+#define _IO_off64_t _G_off64_t
+#endif
#ifdef _G_NEED_STDARG_H
/* This define avoids name pollution if we're using GNU stdarg.h */
@@ -220,7 +224,11 @@ struct _IO_FILE {
int _fileno;
int _blksize;
+#ifdef _G_IO_IO_FILE_VERSION
+ _IO_off_t _old_offset;
+#else
_IO_off_t _offset;
+#endif
#define __HAVE_COLUMN /* temporary */
/* 1+column number of pbase(); 0 is unknown. */
@@ -233,12 +241,22 @@ struct _IO_FILE {
#ifdef _IO_LOCK_T
_IO_LOCK_T _lock;
#endif
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+ _IO_off64_t _offset;
+ int _unused2[16]; /* Make sure we don't get into trouble again. */
+#endif
};
#ifndef __cplusplus
typedef struct _IO_FILE _IO_FILE;
#endif
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+#define _IO_stdin_ _IO_2_1_stdin_
+#define _IO_stdout_ _IO_2_1_stdout_
+#define _IO_stderr_ _IO_2_1_stderr_
+#endif
+
struct _IO_FILE_plus;
extern struct _IO_FILE_plus _IO_stdin_, _IO_stdout_, _IO_stderr_;
#define _IO_stdin ((_IO_FILE*)(&_IO_stdin_))
@@ -321,8 +339,13 @@ extern int _IO_vfprintf __P ((_IO_FILE *, const char *, _IO_va_list));
extern _IO_ssize_t _IO_padn __P ((_IO_FILE *, int, _IO_ssize_t));
extern _IO_size_t _IO_sgetn __P ((_IO_FILE *, void *, _IO_size_t));
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+extern _IO_fpos64_t _IO_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
+extern _IO_fpos64_t _IO_seekpos __P ((_IO_FILE *, _IO_fpos64_t, int));
+#else
extern _IO_fpos_t _IO_seekoff __P ((_IO_FILE *, _IO_off_t, int, int));
extern _IO_fpos_t _IO_seekpos __P ((_IO_FILE *, _IO_fpos_t, int));
+#endif
extern void _IO_free_backup_area __P ((_IO_FILE *));
diff --git a/libio/libioP.h b/libio/libioP.h
index bbe92a4cf16..7a5ca9044e8 100644
--- a/libio/libioP.h
+++ b/libio/libioP.h
@@ -138,8 +138,13 @@ typedef _IO_size_t (*_IO_xsgetn_t) __P ((_IO_FILE *FP, void *DATA,
(MODE==1), or the end of the file (MODE==2).
It matches the streambuf::seekoff virtual function.
It is also used for the ANSI fseek function. */
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+typedef _IO_fpos64_t (*_IO_seekoff_t) __P ((_IO_FILE *FP, _IO_off64_t OFF,
+ int DIR, int MODE));
+#else
typedef _IO_fpos_t (*_IO_seekoff_t) __P ((_IO_FILE *FP, _IO_off_t OFF,
int DIR, int MODE));
+#endif
#define _IO_SEEKOFF(FP, OFF, DIR, MODE) JUMP3 (__seekoff, FP, OFF, DIR, MODE)
/* The 'seekpos' hook also moves the stream position,
@@ -147,7 +152,11 @@ typedef _IO_fpos_t (*_IO_seekoff_t) __P ((_IO_FILE *FP, _IO_off_t OFF,
It matches the streambuf::seekpos virtual function.
It is also used for the ANSI fgetpos and fsetpos functions. */
/* The _IO_seek_cur and _IO_seek_end options are not allowed. */
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+typedef _IO_fpos64_t (*_IO_seekpos_t) __P ((_IO_FILE *, _IO_fpos64_t, int));
+#else
typedef _IO_fpos_t (*_IO_seekpos_t) __P ((_IO_FILE *, _IO_fpos_t, int));
+#endif
#define _IO_SEEKPOS(FP, POS, FLAGS) JUMP2 (__seekpos, FP, POS, FLAGS)
/* The 'setbuf' hook gives a buffer to the file.
@@ -196,7 +205,11 @@ typedef _IO_ssize_t (*_IO_write_t) __P ((_IO_FILE *,const void *,_IO_ssize_t));
It generalizes the Unix lseek(2) function.
It matches the streambuf::sys_seek virtual function, which is
specific to this implementation. */
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+typedef _IO_fpos64_t (*_IO_seek_t) __P ((_IO_FILE *, _IO_off64_t, int));
+#else
typedef _IO_fpos_t (*_IO_seek_t) __P ((_IO_FILE *, _IO_off_t, int));
+#endif
#define _IO_SYSSEEK(FP, OFFSET, MODE) JUMP2 (__seek, FP, OFFSET, MODE)
/* The 'sysclose' hook is used to finalize (close, finish up) an
@@ -260,8 +273,13 @@ struct _IO_FILE_plus
/* Generic functions */
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+extern _IO_fpos64_t _IO_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
+extern _IO_fpos64_t _IO_seekpos __P ((_IO_FILE *, _IO_fpos64_t, int));
+#else
extern _IO_fpos_t _IO_seekoff __P ((_IO_FILE *, _IO_off_t, int, int));
extern _IO_fpos_t _IO_seekpos __P ((_IO_FILE *, _IO_fpos_t, int));
+#endif
extern void _IO_switch_to_main_get_area __P ((_IO_FILE *));
extern void _IO_switch_to_backup_area __P ((_IO_FILE *));
@@ -297,13 +315,24 @@ extern _IO_FILE* _IO_default_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
extern _IO_size_t _IO_default_xsputn __P ((_IO_FILE *, const void *,
_IO_size_t));
extern _IO_size_t _IO_default_xsgetn __P ((_IO_FILE *, void *, _IO_size_t));
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+extern _IO_fpos64_t _IO_default_seekoff __P ((_IO_FILE *,
+ _IO_off64_t, int, int));
+extern _IO_fpos64_t _IO_default_seekpos __P ((_IO_FILE *,
+ _IO_fpos64_t, int));
+#else
extern _IO_fpos_t _IO_default_seekoff __P ((_IO_FILE *, _IO_off_t, int, int));
extern _IO_fpos_t _IO_default_seekpos __P ((_IO_FILE *, _IO_fpos_t, int));
+#endif
extern _IO_ssize_t _IO_default_write __P ((_IO_FILE *, const void *,
_IO_ssize_t));
extern _IO_ssize_t _IO_default_read __P ((_IO_FILE *, void *, _IO_ssize_t));
extern int _IO_default_stat __P ((_IO_FILE *, void *));
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+extern _IO_fpos64_t _IO_default_seek __P ((_IO_FILE *, _IO_off64_t, int));
+#else
extern _IO_fpos_t _IO_default_seek __P ((_IO_FILE *, _IO_off_t, int));
+#endif
extern int _IO_default_sync __P ((_IO_FILE *));
#define _IO_default_close ((_IO_close_t) _IO_default_sync)
@@ -335,7 +364,13 @@ extern void _IO_flush_all_linebuffered __P ((void));
extern int _IO_file_doallocate __P ((_IO_FILE *));
extern _IO_FILE* _IO_file_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+extern _IO_fpos64_t _IO_file_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
+extern _IO_fpos64_t _IO_file_seek __P ((_IO_FILE *, _IO_off64_t, int));
+#else
extern _IO_fpos_t _IO_file_seekoff __P ((_IO_FILE *, _IO_off_t, int, int));
+extern _IO_fpos_t _IO_file_seek __P ((_IO_FILE *, _IO_off_t, int));
+#endif
extern _IO_size_t _IO_file_xsputn __P ((_IO_FILE *, const void *, _IO_size_t));
extern int _IO_file_stat __P ((_IO_FILE *, void *));
extern int _IO_file_close __P ((_IO_FILE *));
@@ -344,13 +379,14 @@ extern int _IO_file_overflow __P ((_IO_FILE *, int));
#define _IO_file_is_open(__fp) ((__fp)->_fileno >= 0)
extern void _IO_file_init __P ((_IO_FILE *));
extern _IO_FILE* _IO_file_attach __P ((_IO_FILE *, int));
+extern _IO_FILE* _IO_file_open __P ((_IO_FILE *, const char *, int, int,
+ int, int));
extern _IO_FILE* _IO_file_fopen __P ((_IO_FILE *, const char *, const char *));
extern _IO_ssize_t _IO_file_write __P ((_IO_FILE *, const void *,
_IO_ssize_t));
extern _IO_ssize_t _IO_file_read __P ((_IO_FILE *, void *, _IO_ssize_t));
extern int _IO_file_sync __P ((_IO_FILE *));
extern int _IO_file_close_it __P ((_IO_FILE *));
-extern _IO_fpos_t _IO_file_seek __P ((_IO_FILE *, _IO_off_t, int));
extern void _IO_file_finish __P ((_IO_FILE *, int));
/* Jumptable functions for proc_files. */
@@ -361,7 +397,11 @@ extern int _IO_proc_close __P ((_IO_FILE *));
extern int _IO_str_underflow __P ((_IO_FILE *));
extern int _IO_str_overflow __P ((_IO_FILE *, int));
extern int _IO_str_pbackfail __P ((_IO_FILE *, int));
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+extern _IO_fpos64_t _IO_str_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
+#else
extern _IO_fpos_t _IO_str_seekoff __P ((_IO_FILE *, _IO_off_t, int, int));
+#endif
extern void _IO_str_finish __P ((_IO_FILE *, int));
/* Other strfile functions */
@@ -475,11 +515,19 @@ extern int _IO_vscanf __P ((const char *, _IO_va_list));
/* _IO_pos_BAD is an _IO_fpos_t value indicating error, unknown, or EOF. */
#ifndef _IO_pos_BAD
-# define _IO_pos_BAD ((_IO_fpos_t) -1)
+# if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+# define _IO_pos_BAD ((_IO_fpos64_t) -1)
+# else
+# define _IO_pos_BAD ((_IO_fpos_t) -1)
+# endif
#endif
/* _IO_pos_as_off converts an _IO_fpos_t value to an _IO_off_t value. */
#ifndef _IO_pos_as_off
-# define _IO_pos_as_off(__pos) ((_IO_off_t) (__pos))
+# if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+# define _IO_pos_as_off(__pos) ((_IO_off64_t) (__pos))
+# else
+# define _IO_pos_as_off(__pos) ((_IO_off_t) (__pos))
+# endif
#endif
/* _IO_pos_adjust adjust an _IO_fpos_t by some number of bytes. */
#ifndef _IO_pos_adjust
@@ -487,7 +535,11 @@ extern int _IO_vscanf __P ((const char *, _IO_va_list));
#endif
/* _IO_pos_0 is an _IO_fpos_t value indicating beginning of file. */
#ifndef _IO_pos_0
-# define _IO_pos_0 ((_IO_fpos_t) 0)
+# if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+# define _IO_pos_0 ((_IO_fpos64_t) 0)
+# else
+# define _IO_pos_0 ((_IO_fpos_t) 0)
+# endif
#endif
#ifdef __cplusplus
diff --git a/libio/streambuf.h b/libio/streambuf.h
index dfee0984a64..9ef47243be6 100644
--- a/libio/streambuf.h
+++ b/libio/streambuf.h
@@ -66,8 +66,13 @@ class ostream; class streambuf;
#undef open
#undef close
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+typedef _IO_off64_t streamoff;
+typedef _IO_fpos64_t streampos;
+#else
typedef _IO_off_t streamoff;
typedef _IO_fpos_t streampos;
+#endif
typedef _IO_ssize_t streamsize;
typedef unsigned long __fmtflags;
OpenPOWER on IntegriCloud