standard library


C++ I/O library (experimental) C++ I/O library (experimental) This is an experimental snapshot of SGI's standard C++ library. You should download it if you are interested in contributing to an ongoing development effort, but not (yet) if you are looking for a library implementation that is guaranteed to work "out of the box". This snapshot includes the entire standard C++ library: STL, iostream/locale, and numerics (valarray and complex). It does not include a standard C library implementation; it is intended to interoperate with an existing C library. Please note that some aspects of an I/O library are inherently platform-specific. (See below for more details.) This library has been tested on IRIX 6.x using the SGI MIPSpro 7.3 compiler, and on Linux, using glibc 2.0 and the egcs 1.1.2 compilers. It passes simple tests on Microsoft Windows NT using the Microsoft Visual C++ 6.0 compiler (with Service Pack 3). Compiling it on other platforms will almost certainly require at least some work. Porting to another version of Unix, using a relatively recent C++ compiler, should not be difficult. We welcome suggestions, patches, and bug fixes. Please send comments to stl@sgi.com. Some notes on the structure of the I/O library It shares some files, such as char_traits.h, with our STL. These snapshots include the full STL distribution as well as the iostreams implementation, since it's hard to draw a line between these two parts of the standard C++ library. Certain parts of the STL depend on the I/O library, and they behave differently depending on whether they use "classic" AT&T cfront iostreams or a standard-conforming I/O implementation with templatized iostreams. To use the new iostreams library you must tell the compiler where to find the headers, add the I/O library to the link line, and tell the STL that it should use standard-conforming iostreams. A compilation line may look something like this: g++ -I. -D__STL_USE_NEW_IOSTREAMS -g hello.cxx libCio.a Alternatively, you can edit the stl_config.h header so that the macro __STL_USE_NEW_IOSTREAMS gets defined automatically. Locales are a tricky point. It is impossible to layer C++ locales on top of the C library locales. The problem is that the standard C library only has one active locale at a time, as determined by the global setlocale function. In C++, though, locales are objects, and there can be any number of active locales at the same time. In a single-threaded world it would be possible (although horribly inefficient) to implement this with setlocale, but there's no safe way to do that in a multithreaded environment. This iostream/locale library is intended to coexist with a preexisting C library. It assumes that for any C library implementation there is some way---just not a portable way---to get at the underlying data files so that we can have multiple active locales. We defined an interface, found in in c_locale.h, for this functionality. Our C++ I/O library requires some implementation for the c_locale.h interface. We believe that implementing the c_locale.h interface is the major work involved in porting the I/O library to a new platform. We have implemented the c_locale interface for the IRIX C library (it is not included here because it includes code that, for legal reasons, SGI can't release as open source), and for the GNU glibc 2.x library. Additionally, we provide a stub implementation of the c_locale interface. This interface is used only for named locales that the OS knows about, such as (in IRIX) "de", "es_MX", and "fr_BE". It isn't used for user-defined locales, or for the classic locale. So the stub implementation takes any string, and returns a failure indication when the user attempts to create a named locale. That's perfectly conforming, according to the C++ standard, and it's even useful. (At least for people who don't have a pressing need for internationalization.) This can serve as a stopgap for platforms where we don't yet have a real c_locale implementation. There are a couple of smaller places where we have system-dependent code. One, of course, is in basic_filebuf (see especially fstream.cxx), which makes system calls for reading and writing. (On Unix, it uses such system calls as open, close, read, write, fcntl, lseek, mmap, and munmap.) We have tried to abstract out as much system-dependent stuff as possible into the _Filebuf_base class. At present it supports IRIX and Linux; porting to other versions of Unix should be easy. There is also some incomplete support for NT; issues there include the '\n' <-> CRLF translation in text mode, and the use of native Win32 system calls, especially for memory mapped I/O. Another place where we've got system dependent code is syncing with stdio. The C++ standard requires that there be a mode in which iostreams and stdio are synchronized (the C++ standard is imprecise about just what synchronization means, but, after talking to the people who wrote that part of the standard, it's clear that it means a very close coupling), and it requires that synchronized mode be the default. We could have satisfied this requirement by implementing things in terms of putc and getc, but that would have been horribly inefficient. Instead we did something uglier, but more efficient: we directly manipulate the pointers inside a FILE object. We've encapsulated knowledge of struct FILE into the header <stl_stdio_file.h>, which defines a few inline functions for this manipulation. Again, this header has to be modified for every OS that we target. This has not proven to be a serious problem in practice, since most stdio implementations appear to be very similar to each other. (An aside: the C++ standard does not say what type of streambuf is used by the standard streams, cin, cout, cerr, etc. Our choice: the wide streams, and in unsynchronized mode the narrow streams as well, use basic_filebuf. In synchronized mode the narrow streams instead use SGI::stdio_istreambuf or SGI::stdio_ostreambuf. Those classes are defined in the header <stdio_streambuf>, and, of course, they are extensions.) Initialization of iostreams is tricky. The standard specifies how it's supposed to work in some detail, and it doesn't seem to be possible to do it portably. Our solution, which is admittedly a ghastly hack, is in iostream.cxx. It's nonportable, but it will work on many platforms. On some platforms there are better ways of doing this. Areas that need more work Portability to other platforms Workarounds for compilers that don't support the full C++ language Writing a low-level locale implementation for other C libraries. Use native file I/O system calls for non-Unix operating systems. Testing on other configurations The basic_fstream class sometimes uses memory-mapped I/O for file input. It should also use memory-mapped I/O for output when possible. Testing of nontrivial code conversions from wide to narrow characters, especially with variable-width and state-dependent encodings, has been sporadic; it's likely that there are still bugs in this area. Most of the relevant code is in <fstream>. The numeric input facets handle istreambuf_iterator naively. They should look directly at the buffer inside the streambuf, rather than using sgetc, sbumpc, and snextc to get one character at a time. (See the header <istream> for an example of how this can be done.) The same optimization applies to the time and monetary facets, but they're less important. There has been some performance tuning for better execution speed, but there has been very little performance tuning for code size or compilation speed. Snapshots June 8, 2000 stdlib_20000608.tar.gz stdlib_20000608.zip Many small bug fixes and compatibility patches. Change to the low-level locale API to improve handling of locale "", which indicates that we are to use a locale that corresponds to the user's preference. (The major changes are in c_locale.h and locale.cxx.) This change is probably a performance improvement in the common case. May 5, 2000 stdlib_20000505.tar.gz stdlib_20000505.zip Changed deque to remove the extension of a third, default template parameter by which the user can control the node size. The extension does not appear to be standard-conforming. April 18, 2000 stdlib_20000418.tar.gz stdlib_20000418.zip Changed basic_istream::seekg and basic_ostream::seekp so that they conform to the resolution to library issue 136 adopted in Tokyo. (seekg should set only the get pointer, and seekp should set only get put pointer.) Fixed a bug that affects string output when the width is nonzero; thanks to Volker H. Simonis for a bug report and patch. Changed bitset to remove the extension of a second template parameter. The extension does not appear to be standard-conforming (see library issue 94), and it isn't very useful anyway. April 14, 2000 stdlib_20000414.tar.gz stdlib_20000414.zip Small bug fixes. Thanks to Alain Miniussi for patches to satisfy compiler that perform certain strict error checks, and to Boris Fomitchev for a Sun compatibility patch. April 3, 2000 stdlib_20000403.tar.gz stdlib_20000403.zip Numeric I/O bug fixes. Thanks to Dave Abrahams for a hex input patch. March 28, 2000 stdlib_20000328.tar.gz stdlib_20000328.zip Various bug fixes. Thanks to Kevin Shepherd for Sun and Win32 patches, and Dan Tsafrir for a g++ 2.91 patch. March 21, 2000 stdlib_20000321.tar.gz stdlib_20000321.zip Various bug fixes, including workarounds for Microsoft C++ 5.0 limitations. Thanks to Jan Mikkelsen for changes for Intel C++ compatibility patches, and Jochen Schlick for UnixWare 7 compatibility patches. February 18, 2000 stdlib_20000218.tar.gz stdlib_20000218.zip Fixed another native Win32 API problem; thanks again to Kevin Shepherd. Algorithmic improvement to make list<>::reverse() smaller and faster; thanks to John D. Valois. January 28, 2000 stdlib_20000128.tar.gz stdlib_20000128.zip Fixed a memory leak in basic_filebuf. Fixed another native Win32 API problem; thanks again to Kevin Shepherd and Boris Fomitchev. January 25, 2000 stdlib_20000125.tar.gz stdlib_20000125.zip Bug fixes. Thanks to Kevin Shepherd and Boris Fomitchev for patches that fix a Win32 initialization problem. January 10, 2000 stdlib_20000110.tar.gz stdlib_20000110.zip The Win32 version of this library now uses the native Win32 API, rather than Unix emulation. Thanks to Kevin Shepherd for the patch to support native Win32 calls. January 7, 2000 stdlib_20000107.tar.gz stdlib_20000107.zip More bug fixes and compatibility improvements. Thanks to Jan Mikkelsen for an Intel C++ compatibility patch. December 28, 1999 stdlib_19991228.tar.gz stdlib_19991228.zip Minor bug fixes. Thanks to Vadim Egorov for a time facets patch. December 15, 1999 stdlib_19991215.tar.gz stdlib_19991215.zip Changes for Microsoft compatibility. Library now passes more complete test suite using Visual C++ 6.0 SP3. December 10, 1999 stdlib_19991210.tar.gz stdlib_19991210.zip More small bug fixes. November 23, 1999 stdlib_19991123.tar.gz stdlib_19991123.zip Minor bug fixes and performance improvements. Makefile is now provided for Microsoft C++ and for IRIX. October 14, 1999 stdlib_19991014.tar.gz stdlib_19991014.zip Library now compiles and passes simple tests using Microsoft Visual C++ 6.0 (with Service Pack 3). September 5, 1999 stdlib_19990905.tar.gz stdlib_19990905.zip Library now includes support for class complex. August 30, 1999 stdlib_19990830.tar.gz stdlib_19990830.zip   The C++ I/O library is released under the same terms as the SGI STL. Copyright © 1999 Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Silicon Graphics makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. Copyright © 1999 Silicon Graphics, Inc. All Rights Reserved. TrademarkInformation

Wyszukiwarka

Podobne podstrony:
STM32 Migracja do Standard Peripheral Library wer 3 1 0
wytyczne do standar przyl4
IS Multiroom Standard HD
SP StandardSpec
3 Standardy urbanistyczne dla terenow mieszkaniowych wybrane zagadnienia
standardy procedur medycznych
vzdelavaci standard zo sj a lit pre gymnazia s vyucovacim j madarkym
Standard AX 700 brochures
Voice Over Ip Protocols And Standards By Rakesh Arora (Voip)
EASA Workshop Standards
Wykład 12 XML NOWOCZESNY STANDARD ZAPISU I WYMIANY DOKUMENTU

więcej podobnych podstron