Commit 00532602 by Benjamin Kosnik Committed by Benjamin Kosnik

stl_algo (__stl_threshold): Declare external.


2002-02-11   Benjamin Kosnik  <bkoz@redhat.com>

	* include/bits/stl_algo (__stl_threshold): Declare external.
	(__stl_chunk_size): Same.
	* include/bits/stl_bvector.h (__WORD_BIT): Same.
	* include/bits/stl_tree.h (_S_rb_tree_red): Same.
	(_S_rb_tree_black): Same.
	* src/stl-inst.cc (__stl_threshold): Define.
	(__stl_chunk_size): Same.
	(__WORD_BIT): Same.
	(_S_rb_tree_red): Same.
	(_S_rb_tree_black): Same.

	* config/io/basic_file_libio.h (__basic_file): Add declarations.
	* include/bits/basic_file.h: Remove.
	* config/io/c_io_stdio.h: Remove _GLIBCPP_BASIC_FILE_ENCAPSULATION
	Declare generic types, specialization.
        * config/io/basic_file_stdio.cc: Definitions.
	* config/io/c_io_libio.h: Remove _GLIBCPP_BASIC_FILE_INHERITANCE.
	Declare generic types.
	* include/Makefile.am (bits_headers): Remove basic_file.h.
	(extra_target_headers): Change basic_file_model.h to basic_file.h.
	(stamp-target): Same.

	* include/bits/stl_alloc.h: Tweaks.
	* include/bits/localefwd.h: Same.

From-SVN: r49697
parent 1febeb40
2002-02-11 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/stl_algo (__stl_threshold): Declare external.
(__stl_chunk_size): Same.
* include/bits/stl_bvector.h (__WORD_BIT): Same.
* include/bits/stl_tree.h (_S_rb_tree_red): Same.
(_S_rb_tree_black): Same.
* src/stl-inst.cc (__stl_threshold): Define.
(__stl_chunk_size): Same.
(__WORD_BIT): Same.
(_S_rb_tree_red): Same.
(_S_rb_tree_black): Same.
* config/io/basic_file_libio.h (__basic_file): Add declarations.
* include/bits/basic_file.h: Remove.
* config/io/c_io_stdio.h: Remove _GLIBCPP_BASIC_FILE_ENCAPSULATION
Declare generic types, specialization.
* config/io/basic_file_stdio.cc: Definitions.
* config/io/c_io_libio.h: Remove _GLIBCPP_BASIC_FILE_INHERITANCE.
Declare generic types.
* include/Makefile.am (bits_headers): Remove basic_file.h.
(extra_target_headers): Change basic_file_model.h to basic_file.h.
(stamp-target): Same.
* include/bits/stl_alloc.h: Tweaks.
* include/bits/localefwd.h: Same.
2002-02-11 Aaron W LaFramboise <AWLaFramboise@aol.com> 2002-02-11 Aaron W LaFramboise <AWLaFramboise@aol.com>
* include/bits/locale_facets.tcc (collate::do_hash): Fix. * include/bits/locale_facets.tcc (collate::do_hash): Fix.
...@@ -17,7 +44,7 @@ ...@@ -17,7 +44,7 @@
generate, generate_n, remove_copy, remove_copy_if, remove, remove_if, generate, generate_n, remove_copy, remove_copy_if, remove, remove_if,
unique, unique_copy, reverse, reverse_copy): Doxygenate. unique, unique_copy, reverse, reverse_copy): Doxygenate.
2002-02-08 Benjamin Kosnik <bkoz@redhat.com> 2002-02-08 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/locale_facets.h * include/bits/locale_facets.h
(numpunct<_CharT>::_M_initialize_numpunct): Remove definition. (numpunct<_CharT>::_M_initialize_numpunct): Remove definition.
......
...@@ -3,9 +3,6 @@ ...@@ -3,9 +3,6 @@
/* Define if you have a working `mmap' system call. */ /* Define if you have a working `mmap' system call. */
#undef HAVE_MMAP #undef HAVE_MMAP
/* Define if you need to in order for stat and other things to work. */
#undef _POSIX_SOURCE
// Define if GCC supports weak symbols. // Define if GCC supports weak symbols.
#undef _GLIBCPP_SUPPORTS_WEAK #undef _GLIBCPP_SUPPORTS_WEAK
...@@ -702,6 +699,9 @@ ...@@ -702,6 +699,9 @@
/* Define if you have the <nan.h> header file. */ /* Define if you have the <nan.h> header file. */
#undef HAVE_NAN_H #undef HAVE_NAN_H
/* Define if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define if you have the <sys/isa_defs.h> header file. */ /* Define if you have the <sys/isa_defs.h> header file. */
#undef HAVE_SYS_ISA_DEFS_H #undef HAVE_SYS_ISA_DEFS_H
...@@ -711,6 +711,9 @@ ...@@ -711,6 +711,9 @@
/* Define if you have the <sys/resource.h> header file. */ /* Define if you have the <sys/resource.h> header file. */
#undef HAVE_SYS_RESOURCE_H #undef HAVE_SYS_RESOURCE_H
/* Define if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define if you have the <sys/types.h> header file. */ /* Define if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H #undef HAVE_SYS_TYPES_H
......
// Wrapper of C-language FILE struct -*- C++ -*- // Wrapper of C-language FILE struct -*- C++ -*-
// Copyright (C) 2000, 2001 Free Software Foundation, Inc. // Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -31,10 +31,221 @@ ...@@ -31,10 +31,221 @@
// ISO C++ 14882: 27.8 File-based streams // ISO C++ 14882: 27.8 File-based streams
// //
/** @file basic_file.h
* This is an internal header file, included by other library headers.
* You should not attempt to use it directly.
*/
#ifndef _CPP_BASIC_FILE
#define _CPP_BASIC_FILE 1
#pragma GCC system_header
#include <bits/c++config.h>
#include <ios>
#include <libioP.h> #include <libioP.h>
namespace std namespace std
{ {
// Ulrich is going to make some detailed comment here, explaining
// all this unpleasantness, providing detailed performance analysis
// as to why we have to do all this lame vtable hacking instead of a
// sane, function-based approach. This verbiage will provide a clear
// and detailed description of the whole object-layout,
// vtable-swapping, sordid history of this hack.
template<typename _CharT>
struct __basic_file_base: public __c_file_type
{
virtual
~__basic_file_base() { };
virtual int
overflow(int __c = EOF) = 0;
virtual int
underflow() = 0;
virtual int
uflow() = 0;
virtual int
pbackfail(int __c) = 0;
virtual streamsize
xsputn(const _CharT* __s, streamsize __n) = 0;
virtual streamsize
xsgetn(_CharT* __s, streamsize __n) = 0;
virtual streamoff
seekoff(streamoff __off, ios_base::seekdir __way,
ios_base::openmode __mode = ios_base::in | ios_base::out) = 0;
virtual streamoff
seekpos(streamoff __pos,
ios_base::openmode __mode = ios_base::in | ios_base::out) = 0;
virtual streambuf*
setbuf(_CharT* __b, int __len) = 0;
virtual int
sync() = 0;
virtual int
doallocate() = 0;
virtual streamsize
sys_read(_CharT* __s, streamsize __n) = 0;
virtual streamsize
sys_write(const _CharT* __s, streamsize __n) = 0;
virtual streamoff
sys_seek(streamoff __off, ios_base::seekdir __way) = 0;
virtual int
sys_close() = 0;
virtual int
sys_stat(void* __v) = 0;
virtual int
showmanyc() = 0;
virtual void
imbue(void* __v) = 0;
};
// Some of these member functions are based on libio/filebuf.cc.
// Also note that the order and number of virtual functions has to precisely
// match the order and number in the _IO_jump_t struct defined in libioP.h.
template<typename _CharT>
class __basic_file: public __basic_file_base<_CharT>
{
# ifdef _GLIBCPP_USE_WCHAR_T
__c_wfile_type _M_wfile;
# endif
public:
__basic_file(__c_lock* __lock = 0);
void
_M_open_mode(ios_base::openmode __mode, int& __p_mode, int& __rw_mode,
char* __c_mode);
// Equivalent to the normal fopen function.
__basic_file*
open(const char* __name, ios_base::openmode __mode, int __prot = 0664);
// Used for opening the standard streams, cin, cout, cerr, clog,
// and their wide-stream equivalents. Instead of calling open, it
// just sets
// - for libio: __c_file_type->_fileno and the respective _flags bits
// - for stdio: _M_cfile = __file and some internal flags
// and returns.
__basic_file*
sys_open(__c_file_type* __file, ios_base::openmode __mode);
_CharT
sys_getc();
_CharT
sys_ungetc(_CharT);
__basic_file*
close();
bool
is_open();
int
fd();
// NB: Must match FILE specific jump table starting here--this
// means all virtual functions starting with the dtor must match,
// slot by slot. For glibc-based dystems, this means the _IO_FILE
// as the FILE struct and _IO_jump_t as the jump table.
virtual
~__basic_file(); // Takes the place of __finish.
virtual int
overflow(int __c = EOF);
virtual int
underflow();
virtual int
uflow();
virtual int
pbackfail(int __c);
// A complex "write" function that sets all of __c_file_type's
// pointers and associated data members correctly and manages its
// relation to the external byte sequence.
virtual streamsize
xsputn(const _CharT* __s, streamsize __n);
// A complex "read" function that sets all of __c_file_type's
// pointers and associated data members correctly and manages its
// relation to the external byte sequence.
virtual streamsize
xsgetn(_CharT* __s, streamsize __n);
// A complex "seekoff" function that sets all of __c_file_type's
// pointers and associated data members correctly and manages its
// relation to the external byte sequence.
virtual streamoff
seekoff(streamoff __off, ios_base::seekdir __way,
ios_base::openmode __mode = ios_base::in | ios_base::out);
// A complex "seekpos" function that sets all of __c_file_type's
// pointers and associated data members correctly and manages its
// relation to the external byte sequence.
virtual streamoff
seekpos(streamoff __pos,
ios_base::openmode __mode = ios_base::in | ios_base::out);
virtual streambuf*
setbuf(_CharT* __b, int __len);
virtual int
sync();
virtual int
doallocate();
// A simple read function for the external byte sequence, that
// does no mucking around with or setting of the pointers or flags
// in __c_file_type.
virtual streamsize
sys_read(_CharT* __s, streamsize __n);
// A simple write function for the external byte sequence, that
// does no mucking around with or setting of the pointers or flags
// in __c_file_type.
virtual streamsize
sys_write(const _CharT* __s, streamsize __n);
// A simple seek function for the external byte sequence, that
// does no mucking around with or setting of the pointers or flags
// in __c_file_type.
virtual streamoff
sys_seek(streamoff __off, ios_base::seekdir __way);
virtual int
sys_close();
virtual int
sys_stat(void* __v);
virtual int
showmanyc();
virtual void
imbue(void* __v);
};
// __basic_file<char> specializations // __basic_file<char> specializations
template<> template<>
__basic_file<char>::__basic_file(__c_lock* __lock); __basic_file<char>::__basic_file(__c_lock* __lock);
...@@ -283,3 +494,5 @@ namespace std ...@@ -283,3 +494,5 @@ namespace std
void void
__basic_file<_CharT>::imbue(void* /*__v*/) { } __basic_file<_CharT>::imbue(void* /*__v*/) { }
} // namespace std } // namespace std
#endif // _CPP_BASIC_FILE
// Wrapper of C-language FILE struct -*- C++ -*- // Wrapper of C-language FILE struct -*- C++ -*-
// Copyright (C) 2000, 2001 Free Software Foundation, Inc. // Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -35,8 +35,124 @@ ...@@ -35,8 +35,124 @@
namespace std namespace std
{ {
template class __basic_file<char>; // Definitions for __basic_file<char>.
#ifdef _GLIBCPP_USE_WCHAR_T __basic_file<char>::__basic_file(__c_lock* /*__lock*/)
template class __basic_file<wchar_t>; : _M_cfile(NULL), _M_cfile_created(false) { }
#endif
__basic_file<char>::~__basic_file()
{
if (this->is_open())
{
fflush(_M_cfile);
this->close();
}
}
void
__basic_file<char>::_M_open_mode(ios_base::openmode __mode, int&, int&,
char* __c_mode)
{
bool __testb = __mode & ios_base::binary;
bool __testi = __mode & ios_base::in;
bool __testo = __mode & ios_base::out;
bool __testt = __mode & ios_base::trunc;
bool __testa = __mode & ios_base::app;
if (!__testi && __testo && !__testt && !__testa)
strcpy(__c_mode, "w");
if (!__testi && __testo && !__testt && __testa)
strcpy(__c_mode, "a");
if (!__testi && __testo && __testt && !__testa)
strcpy(__c_mode, "w");
if (__testi && !__testo && !__testt && !__testa)
strcpy(__c_mode, "r");
if (__testi && __testo && !__testt && !__testa)
strcpy(__c_mode, "r+");
if (__testi && __testo && __testt && !__testa)
strcpy(__c_mode, "w+");
if (__testb)
strcat(__c_mode, "b");
}
__basic_file<char>*
__basic_file<char>::sys_open(__c_file_type* __file, ios_base::openmode)
{
__basic_file* __ret = NULL;
if (!this->is_open() && __file)
{
_M_cfile = __file;
_M_cfile_created = false;
__ret = this;
}
return __ret;
}
char
__basic_file<char>::sys_getc() { return getc (_M_cfile); }
char
__basic_file<char>::sys_ungetc(char __s) { return ungetc (__s, _M_cfile); }
__basic_file<char>*
__basic_file<char>::open(const char* __name, ios_base::openmode __mode,
int /*__prot*/)
{
__basic_file* __ret = NULL;
int __p_mode = 0;
int __rw_mode = 0;
char __c_mode[4];
_M_open_mode(__mode, __p_mode, __rw_mode, __c_mode);
if (!this->is_open())
{
if ((_M_cfile = fopen(__name, __c_mode)))
{
_M_cfile_created = true;
__ret = this;
}
}
return __ret;
}
bool
__basic_file<char>::is_open() { return _M_cfile != 0; }
int
__basic_file<char>::fd() { return fileno(_M_cfile) ; }
__basic_file<char>*
__basic_file<char>::close()
{
__basic_file* __retval = static_cast<__basic_file*>(NULL);
if (_M_cfile_created && fclose(_M_cfile))
__retval = this;
return __retval;
}
streamsize
__basic_file<char>::xsgetn(char* __s, streamsize __n)
{ return fread(__s, 1, __n, _M_cfile); }
streamsize
__basic_file<char>::xsputn(const char* __s, streamsize __n)
{ return fwrite(__s, 1, __n, _M_cfile); }
streamoff
__basic_file<char>::seekoff(streamoff __off, ios_base::seekdir __way,
ios_base::openmode /*__mode*/)
{
fseek(_M_cfile, __off, __way);
return ftell(_M_cfile);
}
streamoff
__basic_file<char>::seekpos(streamoff __pos, ios_base::openmode /*__mode*/)
{
fseek(_M_cfile, __pos, ios_base::beg);
return ftell(_M_cfile);
}
int
__basic_file<char>::sync() { return fflush(_M_cfile); }
} // namespace std } // namespace std
// Wrapper of C-language FILE struct -*- C++ -*- // Wrapper of C-language FILE struct -*- C++ -*-
// Copyright (C) 2000, 2001 Free Software Foundation, Inc. // Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -31,226 +31,81 @@ ...@@ -31,226 +31,81 @@
// ISO C++ 14882: 27.8 File-based streams // ISO C++ 14882: 27.8 File-based streams
// //
namespace std /** @file basic_file.h
{ * This is an internal header file, included by other library headers.
// Generic definitions for __basic_file * You should not attempt to use it directly.
template<typename _CharT> */
__basic_file<_CharT>::__basic_file(__c_lock* /*__lock*/)
: _M_cfile(NULL), _M_cfile_created(false) { }
template<typename _CharT> #ifndef _CPP_BASIC_FILE
__basic_file<_CharT>::~__basic_file() #define _CPP_BASIC_FILE 1
{
if (this->is_open())
{
fflush(_M_cfile);
this->close();
}
}
template<typename _CharT>
void
__basic_file<_CharT>::_M_open_mode(ios_base::openmode __mode,
int& /*__p_mode*/, int& /*__rw_mode*/,
char* __c_mode)
{
bool __testb = __mode & ios_base::binary;
bool __testi = __mode & ios_base::in;
bool __testo = __mode & ios_base::out;
bool __testt = __mode & ios_base::trunc;
bool __testa = __mode & ios_base::app;
if (!__testi && __testo && !__testt && !__testa)
strcpy(__c_mode, "w");
if (!__testi && __testo && !__testt && __testa)
strcpy(__c_mode, "a");
if (!__testi && __testo && __testt && !__testa)
strcpy(__c_mode, "w");
if (__testi && !__testo && !__testt && !__testa)
strcpy(__c_mode, "r");
if (__testi && __testo && !__testt && !__testa)
strcpy(__c_mode, "r+");
if (__testi && __testo && __testt && !__testa)
strcpy(__c_mode, "w+");
if (__testb)
strcat(__c_mode, "b");
}
template<typename _CharT>
__basic_file<_CharT>*
__basic_file<_CharT>::sys_open(__c_file_type* __file, ios_base::openmode)
{
__basic_file* __ret = NULL;
if (!this->is_open() && __file) #pragma GCC system_header
{
_M_cfile = __file;
_M_cfile_created = false;
__ret = this;
}
return __ret; #include <bits/c++config.h>
} #include <ios>
namespace std
{
// Generic declaration.
template<typename _CharT> template<typename _CharT>
_CharT class __basic_file;
__basic_file<_CharT>::sys_getc()
{
return getc (_M_cfile);
}
template<typename _CharT> // Specialization.
_CharT template<>
__basic_file<_CharT>::sys_ungetc(_CharT __s) class __basic_file<char>
{ {
return ungetc (__s, _M_cfile); // Underlying data source/sink.
} __c_file_type* _M_cfile;
// True iff we opened _M_cfile, and thus must close it ourselves.
template<typename _CharT> bool _M_cfile_created;
__basic_file<_CharT>*
__basic_file<_CharT>::open(const char* __name, ios_base::openmode __mode,
int /*__prot*/)
{
__basic_file* __ret = NULL;
int __p_mode = 0;
int __rw_mode = 0;
char __c_mode[4];
_M_open_mode(__mode, __p_mode, __rw_mode, __c_mode);
if (!this->is_open())
{
if ((_M_cfile = fopen(__name, __c_mode)))
{
_M_cfile_created = true;
__ret = this;
}
}
return __ret;
}
template<typename _CharT>
bool
__basic_file<_CharT>::is_open() { return _M_cfile != 0; }
template<typename _CharT>
int
__basic_file<_CharT>::fd() { return fileno(_M_cfile) ; }
template<typename _CharT>
__basic_file<_CharT>*
__basic_file<_CharT>::close()
{
__basic_file* __retval = static_cast<__basic_file*>(NULL);
if (_M_cfile_created && fclose(_M_cfile))
__retval = this;
return __retval;
}
template<typename _CharT>
streamsize
__basic_file<_CharT>::xsgetn(_CharT* __s, streamsize __n)
{ return fread(__s, 1, __n, _M_cfile); }
template<typename _CharT> public:
streamsize __basic_file(__c_lock* __lock = 0);
__basic_file<_CharT>::xsputn(const _CharT* __s, streamsize __n)
{ return fwrite(__s, 1, __n, _M_cfile); } void
_M_open_mode(ios_base::openmode __mode, int& __p_mode, int& __rw_mode,
template<typename _CharT> char* __c_mode);
streamoff
__basic_file<_CharT>::seekoff(streamoff __off, ios_base::seekdir __way, __basic_file*
ios_base::openmode /*__mode*/) open(const char* __name, ios_base::openmode __mode, int __prot = 0664);
{ fseek(_M_cfile, __off, __way); return ftell(_M_cfile); }
template<typename _CharT> __basic_file*
streamoff sys_open(__c_file_type* __file, ios_base::openmode __mode);
__basic_file<_CharT>::seekpos(streamoff __pos,
ios_base::openmode /*__mode*/)
{ fseek(_M_cfile, __pos, ios_base::beg); return ftell(_M_cfile); }
template<typename _CharT> char
int sys_getc();
__basic_file<_CharT>::sync()
{ return fflush(_M_cfile); }
// NB: Unused. char
template<typename _CharT> sys_ungetc(char);
int
__basic_file<_CharT>::overflow(int /*__c*/)
{ return EOF; }
// NB: Unused. __basic_file*
template<typename _CharT> close();
int
__basic_file<_CharT>::underflow()
{ return EOF; }
// NB: Unused. bool
template<typename _CharT> is_open();
int
__basic_file<_CharT>::uflow()
{ return EOF; }
// NB: Unused. int
template<typename _CharT> fd();
int
__basic_file<_CharT>::pbackfail(int /*__c*/)
{ return EOF; }
// NB: Unused.
template<typename _CharT>
streambuf*
__basic_file<_CharT>::setbuf(_CharT* /*__b*/, int /*__len*/)
{ return reinterpret_cast<streambuf*>(this); }
// NB: Unused. ~__basic_file();
template<typename _CharT>
int
__basic_file<_CharT>::doallocate()
{ return EOF; }
// NB: Unused. streamsize
template<typename _CharT> xsputn(const char* __s, streamsize __n);
streamsize
__basic_file<_CharT>::sys_read(_CharT* __s, streamsize __n)
{ return fread(__s, 1, __n, _M_cfile); }
// NB: Unused. streamsize
template<typename _CharT> xsgetn(char* __s, streamsize __n);
streamsize
__basic_file<_CharT>::sys_write(const _CharT* __s, streamsize __n)
{ return fwrite(__s, 1, __n, _M_cfile); }
// NB: Unused.
template<typename _CharT>
streamoff
__basic_file<_CharT>::sys_seek(streamoff __pos, ios_base::seekdir __way)
{
fseek(_M_cfile, __pos, __way);
return ftell(_M_cfile);
}
// NB: Unused.
template<typename _CharT>
int
__basic_file<_CharT>::sys_close()
{ return fclose(_M_cfile); }
// NB: Unused. streamoff
template<typename _CharT> seekoff(streamoff __off, ios_base::seekdir __way,
int ios_base::openmode __mode = ios_base::in | ios_base::out);
__basic_file<_CharT>::sys_stat(void* /*__v*/)
{ return EOF; }
// NB: Unused. streamoff
template<typename _CharT> seekpos(streamoff __pos,
int ios_base::openmode __mode = ios_base::in | ios_base::out);
__basic_file<_CharT>::showmanyc()
{ return EOF; }
// NB: Unused. int
template<typename _CharT> sync();
void };
__basic_file<_CharT>::imbue(void* /*__v*/) { }
} // namespace std } // namespace std
#endif // _CPP_BASIC_FILE
// underlying io library -*- C++ -*- // underlying io library -*- C++ -*-
// Copyright (C) 2000, 2001 Free Software Foundation, Inc. // Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -55,7 +55,6 @@ namespace std ...@@ -55,7 +55,6 @@ namespace std
#endif #endif
// from basic_file.h // from basic_file.h
#define _GLIBCPP_BASIC_FILE_INHERITANCE 1
typedef _IO_FILE __c_file_type; typedef _IO_FILE __c_file_type;
typedef _IO_wide_data __c_wfile_type; typedef _IO_wide_data __c_wfile_type;
......
// underlying io library -*- C++ -*- // underlying io library -*- C++ -*-
// Copyright (C) 2000, 2001 Free Software Foundation, Inc. // Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -49,7 +49,6 @@ namespace std ...@@ -49,7 +49,6 @@ namespace std
typedef __gthread_mutex_t __c_lock; typedef __gthread_mutex_t __c_lock;
// for basic_file.h // for basic_file.h
#define _GLIBCPP_BASIC_FILE_ENCAPSULATION 1
typedef FILE __c_file_type; typedef FILE __c_file_type;
// for ios_base.h // for ios_base.h
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -34,7 +34,6 @@ glibcpp_builddir=@glibcpp_builddir@ ...@@ -34,7 +34,6 @@ glibcpp_builddir=@glibcpp_builddir@
bits_srcdir = ${glibcpp_srcdir}/include/bits bits_srcdir = ${glibcpp_srcdir}/include/bits
bits_builddir = ./bits bits_builddir = ./bits
bits_headers = \ bits_headers = \
${bits_srcdir}/basic_file.h \
${bits_srcdir}/basic_ios.h \ ${bits_srcdir}/basic_ios.h \
${bits_srcdir}/basic_ios.tcc \ ${bits_srcdir}/basic_ios.tcc \
${bits_srcdir}/basic_string.h \ ${bits_srcdir}/basic_string.h \
...@@ -278,7 +277,7 @@ target_headers = \ ...@@ -278,7 +277,7 @@ target_headers = \
${glibcpp_srcdir}/@CPU_LIMITS_INC_SRCDIR@/cpu_limits.h ${glibcpp_srcdir}/@CPU_LIMITS_INC_SRCDIR@/cpu_limits.h
# These extra_target_headers files are all built with ad hoc naming rules. # These extra_target_headers files are all built with ad hoc naming rules.
extra_target_headers = \ extra_target_headers = \
${target_builddir}/basic_file_model.h \ ${target_builddir}/basic_file.h \
${target_builddir}/c++config.h \ ${target_builddir}/c++config.h \
${target_builddir}/c++io.h \ ${target_builddir}/c++io.h \
${target_builddir}/c++locale.h \ ${target_builddir}/c++locale.h \
...@@ -360,7 +359,7 @@ stamp-target: ${target_headers} ${target_builddir} ...@@ -360,7 +359,7 @@ stamp-target: ${target_headers} ${target_builddir}
@cd ${target_builddir} ;\ @cd ${target_builddir} ;\
if [ ! -f stamp-target ]; then \ if [ ! -f stamp-target ]; then \
@LN_S@ ${target_headers} . || true ;\ @LN_S@ ${target_headers} . || true ;\
@LN_S@ ${glibcpp_srcdir}/@BASIC_FILE_H@ basic_file_model.h || true ;\ @LN_S@ ${glibcpp_srcdir}/@BASIC_FILE_H@ basic_file.h || true ;\
@LN_S@ ${glibcpp_srcdir}/@CSTDIO_H@ c++io.h || true ;\ @LN_S@ ${glibcpp_srcdir}/@CSTDIO_H@ c++io.h || true ;\
@LN_S@ ${glibcpp_srcdir}/@CLOCALE_H@ c++locale.h || true ;\ @LN_S@ ${glibcpp_srcdir}/@CLOCALE_H@ c++locale.h || true ;\
@LN_S@ ${glibcpp_srcdir}/@CMESSAGES_H@ messages_members.h || true ;\ @LN_S@ ${glibcpp_srcdir}/@CMESSAGES_H@ messages_members.h || true ;\
......
...@@ -159,7 +159,6 @@ glibcpp_builddir = @glibcpp_builddir@ ...@@ -159,7 +159,6 @@ glibcpp_builddir = @glibcpp_builddir@
bits_srcdir = ${glibcpp_srcdir}/include/bits bits_srcdir = ${glibcpp_srcdir}/include/bits
bits_builddir = ./bits bits_builddir = ./bits
bits_headers = \ bits_headers = \
${bits_srcdir}/basic_file.h \
${bits_srcdir}/basic_ios.h \ ${bits_srcdir}/basic_ios.h \
${bits_srcdir}/basic_ios.tcc \ ${bits_srcdir}/basic_ios.tcc \
${bits_srcdir}/basic_string.h \ ${bits_srcdir}/basic_string.h \
...@@ -412,7 +411,7 @@ target_headers = \ ...@@ -412,7 +411,7 @@ target_headers = \
# These extra_target_headers files are all built with ad hoc naming rules. # These extra_target_headers files are all built with ad hoc naming rules.
extra_target_headers = \ extra_target_headers = \
${target_builddir}/basic_file_model.h \ ${target_builddir}/basic_file.h \
${target_builddir}/c++config.h \ ${target_builddir}/c++config.h \
${target_builddir}/c++io.h \ ${target_builddir}/c++io.h \
${target_builddir}/c++locale.h \ ${target_builddir}/c++locale.h \
...@@ -611,7 +610,7 @@ stamp-target: ${target_headers} ${target_builddir} ...@@ -611,7 +610,7 @@ stamp-target: ${target_headers} ${target_builddir}
@cd ${target_builddir} ;\ @cd ${target_builddir} ;\
if [ ! -f stamp-target ]; then \ if [ ! -f stamp-target ]; then \
@LN_S@ ${target_headers} . || true ;\ @LN_S@ ${target_headers} . || true ;\
@LN_S@ ${glibcpp_srcdir}/@BASIC_FILE_H@ basic_file_model.h || true ;\ @LN_S@ ${glibcpp_srcdir}/@BASIC_FILE_H@ basic_file.h || true ;\
@LN_S@ ${glibcpp_srcdir}/@CSTDIO_H@ c++io.h || true ;\ @LN_S@ ${glibcpp_srcdir}/@CSTDIO_H@ c++io.h || true ;\
@LN_S@ ${glibcpp_srcdir}/@CLOCALE_H@ c++locale.h || true ;\ @LN_S@ ${glibcpp_srcdir}/@CLOCALE_H@ c++locale.h || true ;\
@LN_S@ ${glibcpp_srcdir}/@CMESSAGES_H@ messages_members.h || true ;\ @LN_S@ ${glibcpp_srcdir}/@CMESSAGES_H@ messages_members.h || true ;\
......
// Wrapper of C-language FILE struct -*- C++ -*-
// Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 27.8 File-based streams
//
/** @file basic_file.h
* This is an internal header file, included by other library headers.
* You should not attempt to use it directly.
*/
#ifndef _CPP_BASIC_FILE
#define _CPP_BASIC_FILE 1
#pragma GCC system_header
#include <bits/c++config.h>
#include <ios>
namespace std
{
// Ulrich is going to make some detailed comment here, explaining
// all this unpleasantness, providing detailed performance analysis
// as to why we have to do all this lame vtable hacking instead of a
// sane, function-based approach. This verbiage will provide a clear
// and detailed description of the whole object-layout,
// vtable-swapping, sordid history of this hack.
template<typename _CharT>
struct __basic_file_base: public __c_file_type
{
virtual
~__basic_file_base() { };
virtual int
overflow(int __c = EOF) = 0;
virtual int
underflow() = 0;
virtual int
uflow() = 0;
virtual int
pbackfail(int __c) = 0;
virtual streamsize
xsputn(const _CharT* __s, streamsize __n) = 0;
virtual streamsize
xsgetn(_CharT* __s, streamsize __n) = 0;
virtual streamoff
seekoff(streamoff __off, ios_base::seekdir __way,
ios_base::openmode __mode = ios_base::in | ios_base::out) = 0;
virtual streamoff
seekpos(streamoff __pos,
ios_base::openmode __mode = ios_base::in | ios_base::out) = 0;
virtual streambuf*
setbuf(_CharT* __b, int __len) = 0;
virtual int
sync() = 0;
virtual int
doallocate() = 0;
virtual streamsize
sys_read(_CharT* __s, streamsize __n) = 0;
virtual streamsize
sys_write(const _CharT* __s, streamsize __n) = 0;
virtual streamoff
sys_seek(streamoff __off, ios_base::seekdir __way) = 0;
virtual int
sys_close() = 0;
virtual int
sys_stat(void* __v) = 0;
virtual int
showmanyc() = 0;
virtual void
imbue(void* __v) = 0;
};
// Some of these member functions are based on libio/filebuf.cc.
// Also note that the order and number of virtual functions has to precisely
// match the order and number in the _IO_jump_t struct defined in libioP.h.
template<typename _CharT>
#ifdef _GLIBCPP_BASIC_FILE_INHERITANCE
class __basic_file: public __basic_file_base<_CharT>
#else
class __basic_file
#endif
{
#if _GLIBCPP_BASIC_FILE_ENCAPSULATION
// underlying data source/sink
__c_file_type* _M_cfile;
// true iff we opened _M_cfile, and thus must close it ourselves
bool _M_cfile_created;
#else
# ifdef _GLIBCPP_USE_WCHAR_T
__c_wfile_type _M_wfile;
# endif
#endif
public:
__basic_file(__c_lock* __lock = 0);
void
_M_open_mode(ios_base::openmode __mode, int& __p_mode, int& __rw_mode,
char* __c_mode);
// Equivalent to the normal fopen function.
__basic_file*
open(const char* __name, ios_base::openmode __mode, int __prot = 0664);
// Used for opening the standard streams, cin, cout, cerr, clog,
// and their wide-stream equivalents. Instead of calling open, it
// just sets
// - for libio: __c_file_type->_fileno and the respective _flags bits
// - for stdio: _M_cfile = __file and some internal flags
// and returns.
__basic_file*
sys_open(__c_file_type* __file, ios_base::openmode __mode);
_CharT
sys_getc();
_CharT
sys_ungetc(_CharT);
__basic_file*
close();
bool
is_open();
int
fd();
// NB: Must match FILE specific jump table starting here--this
// means all virtual functions starting with the dtor must match,
// slot by slot. For glibc-based dystems, this means the _IO_FILE
// as the FILE struct and _IO_jump_t as the jump table.
virtual
~__basic_file(); // Takes the place of __finish.
virtual int
overflow(int __c = EOF);
virtual int
underflow();
virtual int
uflow();
virtual int
pbackfail(int __c);
// A complex "write" function that sets all of __c_file_type's
// pointers and associated data members correctly and manages its
// relation to the external byte sequence.
virtual streamsize
xsputn(const _CharT* __s, streamsize __n);
// A complex "read" function that sets all of __c_file_type's
// pointers and associated data members correctly and manages its
// relation to the external byte sequence.
virtual streamsize
xsgetn(_CharT* __s, streamsize __n);
// A complex "seekoff" function that sets all of __c_file_type's
// pointers and associated data members correctly and manages its
// relation to the external byte sequence.
virtual streamoff
seekoff(streamoff __off, ios_base::seekdir __way,
ios_base::openmode __mode = ios_base::in | ios_base::out);
// A complex "seekpos" function that sets all of __c_file_type's
// pointers and associated data members correctly and manages its
// relation to the external byte sequence.
virtual streamoff
seekpos(streamoff __pos,
ios_base::openmode __mode = ios_base::in | ios_base::out);
virtual streambuf*
setbuf(_CharT* __b, int __len);
virtual int
sync();
virtual int
doallocate();
// A simple read function for the external byte sequence, that
// does no mucking around with or setting of the pointers or flags
// in __c_file_type.
virtual streamsize
sys_read(_CharT* __s, streamsize __n);
// A simple write function for the external byte sequence, that
// does no mucking around with or setting of the pointers or flags
// in __c_file_type.
virtual streamsize
sys_write(const _CharT* __s, streamsize __n);
// A simple seek function for the external byte sequence, that
// does no mucking around with or setting of the pointers or flags
// in __c_file_type.
virtual streamoff
sys_seek(streamoff __off, ios_base::seekdir __way);
virtual int
sys_close();
virtual int
sys_stat(void* __v);
virtual int
showmanyc();
virtual void
imbue(void* __v);
};
} // namespace std
// Now include the bits that are dependent on the underlying I/O
// model chosen at configure time.
#include <bits/basic_file_model.h>
#endif // _CPP_BASIC_FILE
...@@ -119,7 +119,6 @@ namespace std ...@@ -119,7 +119,6 @@ namespace std
// 4. All fields==0 is an empty string, given the extra storage // 4. All fields==0 is an empty string, given the extra storage
// beyond-the-end for a null terminator; thus, the shared // beyond-the-end for a null terminator; thus, the shared
// empty string representation needs no constructor. // empty string representation needs no constructor.
struct _Rep struct _Rep
{ {
// Types: // Types:
......
...@@ -44,14 +44,14 @@ ...@@ -44,14 +44,14 @@
namespace std namespace std
{ {
template<typename _CharT, typename _Traits, typename _Alloc> template<typename _CharT, typename _Traits, typename _Alloc>
const _CharT const typename basic_string<_CharT, _Traits, _Alloc>::size_type
basic_string<_CharT, _Traits, _Alloc>:: basic_string<_CharT, _Traits, _Alloc>::
_Rep::_S_terminal = _CharT(); _Rep::_S_max_size = (((npos - sizeof(_Rep))/sizeof(_CharT)) - 1) / 4;
template<typename _CharT, typename _Traits, typename _Alloc> template<typename _CharT, typename _Traits, typename _Alloc>
const typename basic_string<_CharT, _Traits, _Alloc>::size_type const _CharT
basic_string<_CharT, _Traits, _Alloc>:: basic_string<_CharT, _Traits, _Alloc>::
_Rep::_S_max_size = (((npos - sizeof(_Rep))/sizeof(_CharT)) - 1) / 4; _Rep::_S_terminal = _CharT();
template<typename _CharT, typename _Traits, typename _Alloc> template<typename _CharT, typename _Traits, typename _Alloc>
const typename basic_string<_CharT, _Traits, _Alloc>::size_type const typename basic_string<_CharT, _Traits, _Alloc>::size_type
......
...@@ -446,7 +446,7 @@ namespace std ...@@ -446,7 +446,7 @@ namespace std
// NB: There is no accessor for _M_index because it may be used // NB: There is no accessor for _M_index because it may be used
// before the constructor is run; the effect of calling a member // before the constructor is run; the effect of calling a member
// function (even an inline) would be undefined. // function (even an inline) would be undefined.
mutable size_t _M_index; mutable size_t _M_index;
// Last id number assigned // Last id number assigned
static _Atomic_word _S_highwater; static _Atomic_word _S_highwater;
......
...@@ -1775,7 +1775,7 @@ __result, __binary_pred, _IterType()); ...@@ -1775,7 +1775,7 @@ __result, __binary_pred, _IterType());
} }
} }
const int __stl_threshold = 16; extern const int __stl_threshold;
// sort() and its auxiliary functions. // sort() and its auxiliary functions.
...@@ -2060,7 +2060,7 @@ __result, __binary_pred, _IterType()); ...@@ -2060,7 +2060,7 @@ __result, __binary_pred, _IterType());
__comp); __comp);
} }
const int __stl_chunk_size = 7; extern const int __stl_chunk_size;
template<typename _RandomAccessIter, typename _Distance> template<typename _RandomAccessIter, typename _Distance>
void void
......
// bit_vector and vector<bool> specialization -*- C++ -*- // bit_vector and vector<bool> specialization -*- C++ -*-
// Copyright (C) 2001 Free Software Foundation, Inc. // Copyright (C) 2001, 2002 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -63,8 +63,7 @@ ...@@ -63,8 +63,7 @@
namespace std namespace std
{ {
extern const int __WORD_BIT;
static const int __WORD_BIT = int(CHAR_BIT*sizeof(unsigned int));
struct _Bit_reference { struct _Bit_reference {
unsigned int* _M_p; unsigned int* _M_p;
......
// RB tree implementation -*- C++ -*- // RB tree implementation -*- C++ -*-
// Copyright (C) 2001 Free Software Foundation, Inc. // Copyright (C) 2001, 2002 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -90,10 +90,9 @@ iterators invalidated are those referring to the deleted node. ...@@ -90,10 +90,9 @@ iterators invalidated are those referring to the deleted node.
namespace std namespace std
{ {
typedef bool _Rb_tree_Color_type;
typedef bool _Rb_tree_Color_type; extern const _Rb_tree_Color_type _S_rb_tree_red; // false
const _Rb_tree_Color_type _S_rb_tree_red = false; extern const _Rb_tree_Color_type _S_rb_tree_black; // true
const _Rb_tree_Color_type _S_rb_tree_black = true;
struct _Rb_tree_node_base struct _Rb_tree_node_base
{ {
......
// Explicit instantiation file. // Explicit instantiation file.
// Copyright (C) 1999, 2001 Free Software Foundation, Inc. // Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -35,9 +35,16 @@ ...@@ -35,9 +35,16 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include <ostream> #include <ostream>
#include <map>
namespace std namespace std
{ {
const int __stl_threshold = 16;
const int __stl_chunk_size = 7;
const int __WORD_BIT = int(CHAR_BIT*sizeof(unsigned int));
const _Rb_tree_Color_type _S_rb_tree_red = false;
const _Rb_tree_Color_type _S_rb_tree_black = true;
template class __malloc_alloc_template<0>; template class __malloc_alloc_template<0>;
#ifndef __USE_MALLOC #ifndef __USE_MALLOC
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment